Difference between revisions of "Building Bitfighter"

From Bitfighter
(Linux)
Line 4: Line 4:
 
*[http://code.google.com/p/bitfighter/source/list Changelog]
 
*[http://code.google.com/p/bitfighter/source/list Changelog]
 
*[http://code.google.com/p/bitfighter/source/browse Browse source]
 
*[http://code.google.com/p/bitfighter/source/browse Browse source]
 +
 +
Also, please see the README.txt included in the source.
  
 
===Source Code===
 
===Source Code===
Bitfighter now uses Mercurial (hg) to obtain the source code.  Here is some useful Mercurial information:
+
Bitfighter uses Mercurial (hg) to manage the source code.  Here is some useful Mercurial information:
 
*[[Contribute_using_Mercurial]]
 
*[[Contribute_using_Mercurial]]
  
Line 12: Line 14:
 
*[http://code.google.com/p/bitfighter/source/checkout Source Checkout]
 
*[http://code.google.com/p/bitfighter/source/checkout Source Checkout]
  
At the least, you can just copy and paste this into your terminal browser, after installing Mercurial:
+
If you have Mercurial installed, you can easily check out a copy of the source code by running this command in a terminal in a folder of your chosing:
 
+
 
  hg clone https://code.google.com/p/bitfighter/
 
  hg clone https://code.google.com/p/bitfighter/
  
If you don't want to compile the current development version, update to a specific released version after cloning:
+
After checking out the code, if you don't want to compile the current development version, you can update to a specific released version.  To see a list of released versions, type in:
 +
hg tags
 +
 
 +
We recommend to always chose the latest release as the build instructions for older releases will be different that what is shown here on this wiki page.  Update to a release that you want:
 +
hg up bitfighter-018a
  
hg up bitfighter-018
 
  
 
===Windows===
 
===Windows===
Bitfighter can be built with MS Visual C++ 2010 Express Edition, a free download from Microsoft, and a much-improved IDE over previous versions.
+
====018a and earlier====
 +
Bitfighter is built with MS Visual C++ 2010 Express Edition for versions 018a and earlier.  See the solution file at the root of the code tree.
  
===Linux===
+
====019 (development) and later====
Bitfighter should build on any major flavor of Linux.  It has been tested and is known to work on Ubuntu, LinuxMint, Centos, Fedora, Debian, Mandriva and openSUSE. If you can not get it to work, you can try running it in wine: [http://www.winehq.org/]   
+
We will be migrating to [CMake http://www.cmake.org/] for Windows builds in version 019 and later (and currently in the most recent development code). To build:
  
The Bitfighter client depends on SDL, libpng, libvorbis, and libspeex development libraries. These are not needed to build the dedicated server.
+
# Install CMake from http://www.cmake.org/
 +
# In a terminal, change to the 'build' directory in the bitfighter source code tree.
 +
# Run one of these commands to build in the environment of your choice. (See a list of CMake 'generators' [here http://www.cmake.org/cmake/help/v2.8.10/cmake.html#section_Generators]): 
 +
#* cmake -G "Visual Studio 10" .. 
 +
#* cmake -G "MSYS Makefiles" ..
 +
# Open the resulting Visual Studio solution file OR run MinGW 'make', depending on what environment you chose to build
  
Bitfighter must be compiled with the gcc/g++ compiler, which is usually not installed by default in most Linux distributions.  Mercurial is required to obtain the source code.
+
Note that we recommend using Visual Studio 2010 for the building environment on Windows.
  
 +
===Linux===
 +
Bitfighter should build on any major flavor of Linux.  It has been tested and is known to work on Ubuntu, LinuxMint, Centos, Fedora, Debian, Mandriva and openSUSE. If you can not get it to work, you can try running it in wine: [http://www.winehq.org/] 
  
'''Building full game client on a clean install of Ubuntu'''
+
Bitfighter has several common, open source dependencies:
These instructions should work on both 32 and 64 bit platforms.
+
* SDL
<source lang="bash">
+
* zlib
#### NOTE #### These instructions may be slightly out-of-date
+
* libpng
####          Until they are updated, please refer to the Centos instructions below,
+
* openal
####          which are current as of 018a
+
* libvorbis
 +
* libspeex
 +
* libmodplug
  
sudo apt-get update
+
You must install these '''and their development headers''' using your distribution's preferred method. The development headers for these libraries have similar names with a suffix, for example:
sudo apt-get install mercurial g++ libreadline6-dev libncurses5-dev
+
* libvorbis-dev or vorbis-devel
sudo apt-get install libsdl1.2-dev libopenal-dev
+
sudo apt-get install libspeex-dev libvorbis-dev libpng-dev libmodplug-dev
+
  
# Get the source code
+
You will also need the following to compile:
hg clone https://code.google.com/p/bitfighter/
+
* cmake
 +
* make
 +
* gcc / g++
  
# Update to the tag/revision you want -- this may take a couple of minutes
+
Once your dependencies are installed, you can build bitfighter with these steps:
cd bitfighter
+
# cd build
hg up bitfighter-018
+
# cmake ..
 +
# make
  
# Build the game -- the standard options should work
+
If you want to build a dedicated server (with no GUI), replace the 'make' step above with:
make
+
# make dedicated
  
# Copy required files into exe folder:
+
Next, you'll need to copy the resources to where the executable was built:
cd exe
+
# cd ../exe
cp -r ../resource/* .
+
# cp -r ../resource/* .
 
+
</source>
+
Once successfully built, you shouldn't need to built it again unless you are changing version. To run Bitfighter, browse to bitfighter/exe and start bitfighter from there, or in a command, do the following:
+
<source lang="bash">
+
cd bitfighter/exe
+
./bitfighter
+
</source>
+
  
 +
And if you wish to run in standalone mode, create a standalone.txt file in the 'exe' folder to trigger this mode:
 +
# touch standalone.txt
  
 +
====Centos Dedicated Instructions====
 
'''Building a dedicated server on a typical clean Centos 5 or 6 virtual server instance'''
 
'''Building a dedicated server on a typical clean Centos 5 or 6 virtual server instance'''
 
<source lang="bash">
 
<source lang="bash">
Line 118: Line 129:
 
make dedicated  
 
make dedicated  
  
# Copy required files into exe folder:
+
# Copy required files into exe folder (found at the root of the code tree):
cd exe
+
cd ../exe
 
cp -r ../resource/* .
 
cp -r ../resource/* .
 
touch standalone.txt    # Tell bitfighterd to run in portable mode
 
touch standalone.txt    # Tell bitfighterd to run in portable mode
Line 125: Line 136:
  
 
===OS X===
 
===OS X===
Bitfighter builds on OS X using Xcode 3.1 or greater.  You must have developer tools installed to build bitfighter on OS X!
+
Bitfighter builds on OS X using Xcode 3 (3.1 or greater) but *not* Xcode 4 (yet).  You must have developer tools installed to build bitfighter on OS X!
 
(You can get them [http://developer.apple.com/technologies/tools/xcode.html from Apple].)
 
(You can get them [http://developer.apple.com/technologies/tools/xcode.html from Apple].)
  
 
'''Note:''' If you don't wish to download Xcode with iOS integration (saves about 2GB off of downloading) you can get older versions on the [http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wo/5.1.17.2.1.3.3.1.0.1.1.0.3.3.3.3.1 developer downloads page].  Xcode 3.2.2 is the latest without iOS built in.
 
'''Note:''' If you don't wish to download Xcode with iOS integration (saves about 2GB off of downloading) you can get older versions on the [http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wo/5.1.17.2.1.3.3.1.0.1.1.0.3.3.3.3.1 developer downloads page].  Xcode 3.2.2 is the latest without iOS built in.
  
====Getting the source====
+
To build in Xcode:
 
+
# Navigate through bitfighter > build > osx > Xcode > Bitfighter.xcodeproj
You can grab the source the typical command line way below, or you can grab your own copy of [http://jasonfharris.com/machg/ Mac Hg], and manager your source with a GUI
+
# Open Bitfighter.xcodeproj with Xcode.
 
+
# Click 'Build and Go' at the top.  Bitfighter should compile successfully and attempt to launch.
Grabbing the source is just like any other terminal, simply navigate here:
+
Applications > Utilities > Terminal and paste in the HG command + url + foldername,[http://bitfighter.org/wiki/index.php?title=Building_Bitfighter#Source_Code which can be found here]
+
 
+
Also like normal, you can find this download in your home folder
+
 
+
====Building Bitfighter====
+
 
+
#Navigate through bitfighter > build > osx > Xcode > Bitfighter.xcodeproj
+
#Open Bitfighter.xcodeproj with Xcode.
+
#Click 'Build and Go' at the top.  Bitfighter should compile successfully and attempt to launch.
+
 
#*'''Note:''' building from trunk may NOT complete successfully and/or the launch may fail.
 
#*'''Note:''' building from trunk may NOT complete successfully and/or the launch may fail.
 
#Your new build will be found at Bitfighter > build > osx > build > Debug / release > *
 
#Your new build will be found at Bitfighter > build > osx > build > Debug / release > *
  
=====Quickbuild=====
 
 
If your lazy like me, you can do this a quicker way.
 
Right after you download the source, stay in the terminal window
 
Open a new window, and click
 
 
<Code>
 
cd (filename you chose when you downloaded the game)
 
 
cd zap
 
 
xcodebuild
 
 
</Code>
 
 
It will start punching in alot of code in the window. just let this sit for a while and soon it will be built. The product will be stored in the same place you stored before
 
 
 
Now you have successfully built your own Bitfighter game.
 
  
 
====Notes====
 
====Notes====
Line 173: Line 155:
 
#*tnl.framework
 
#*tnl.framework
 
#*Openal-Soft.framework
 
#*Openal-Soft.framework
#*FreeALUT.framework
+
# Settings are found in $HOME/Library/Application Support/Bitfighter
# Upon first launch of your newly created game, an alias is created that points to your user's bitfighter data directory.  It is located at Documents > bitfighter_settings.  The data directory contains bitfighter settings as well as the levels, scripts, and screenshots save locations.
+

Revision as of 11:54, 15 July 2013

This page is dedicated to getting Bitfighter to build on your system of choice. Some useful links:

Also, please see the README.txt included in the source.

Source Code

Bitfighter uses Mercurial (hg) to manage the source code. Here is some useful Mercurial information:

The Bitfighter code can be found here:

If you have Mercurial installed, you can easily check out a copy of the source code by running this command in a terminal in a folder of your chosing:

hg clone https://code.google.com/p/bitfighter/

After checking out the code, if you don't want to compile the current development version, you can update to a specific released version. To see a list of released versions, type in:

hg tags

We recommend to always chose the latest release as the build instructions for older releases will be different that what is shown here on this wiki page. Update to a release that you want:

hg up bitfighter-018a


Windows

018a and earlier

Bitfighter is built with MS Visual C++ 2010 Express Edition for versions 018a and earlier. See the solution file at the root of the code tree.

019 (development) and later

We will be migrating to [CMake http://www.cmake.org/] for Windows builds in version 019 and later (and currently in the most recent development code). To build:

  1. Install CMake from http://www.cmake.org/
  2. In a terminal, change to the 'build' directory in the bitfighter source code tree.
  3. Run one of these commands to build in the environment of your choice. (See a list of CMake 'generators' [here http://www.cmake.org/cmake/help/v2.8.10/cmake.html#section_Generators]):
    • cmake -G "Visual Studio 10" ..
    • cmake -G "MSYS Makefiles" ..
  4. Open the resulting Visual Studio solution file OR run MinGW 'make', depending on what environment you chose to build

Note that we recommend using Visual Studio 2010 for the building environment on Windows.

Linux

Bitfighter should build on any major flavor of Linux. It has been tested and is known to work on Ubuntu, LinuxMint, Centos, Fedora, Debian, Mandriva and openSUSE. If you can not get it to work, you can try running it in wine: [1]

Bitfighter has several common, open source dependencies:

  • SDL
  • zlib
  • libpng
  • openal
  • libvorbis
  • libspeex
  • libmodplug

You must install these and their development headers using your distribution's preferred method. The development headers for these libraries have similar names with a suffix, for example:

  • libvorbis-dev or vorbis-devel

You will also need the following to compile:

  • cmake
  • make
  • gcc / g++

Once your dependencies are installed, you can build bitfighter with these steps:

  1. cd build
  2. cmake ..
  3. make

If you want to build a dedicated server (with no GUI), replace the 'make' step above with:

  1. make dedicated

Next, you'll need to copy the resources to where the executable was built:

  1. cd ../exe
  2. cp -r ../resource/* .

And if you wish to run in standalone mode, create a standalone.txt file in the 'exe' folder to trigger this mode:

  1. touch standalone.txt

Centos Dedicated Instructions

Building a dedicated server on a typical clean Centos 5 or 6 virtual server instance

# We recommend that you install and run a dedicated bitfighter server with a special user account 
# used only for this purpose, that does not have root access.
 
# These instructions are unusually long and complex due to the fact we were transitioning to a new
# build system when 018a was released.  019 will be easier!
 
# Here we create a bitfighter user; you can skip this step if you want to use an existing account
useradd bitfighter       # Create the account
passwd bitfighter        # Set the password.  Pick a good one!
 
# Do the following as a user that has sudo privileges
 
sudo yum update    # system should be up to date
 
# The following sets up the EPEL repository for extra packages (needed for mercurial)
# Choose one based on your server architecture
# 32 bit:
sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# 64 bit:
sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
 
sudo yum install mercurial gcc gcc-c++ zip ncurses-devel readline-devel patch cmake screen
 
 
# Do the following as the bitfighter user
su bitfighter
cd ~
 
# Get the source code -- this will create a folder called bitfighter in your current location
# This may take a couple of minutes
hg clone https://code.google.com/p/bitfighter/
 
# Update to the tag/revision you want
cd bitfighter
hg up bitfighter-018a
 
# Apply some special patches to the build system for 018a
wget -O patch1.diff http://pastebin.com/raw.php?i=GKn4qbuC
wget -O patch2.diff http://pastebin.com/raw.php?i=wUzsxVp2
patch -p1 < patch1.diff
patch -p1 < patch2.diff
 
# Delete a file added by the patches above that isn't acutally needed
rm cmake/Modules/FindZLIB.cmake
 
# Build the dedicated server (called bitfighterd)
cd build
cmake ..          # This creates a Makefile for the next step
make dedicated 
 
# Copy required files into exe folder (found at the root of the code tree):
cd ../exe
cp -r ../resource/* .
touch standalone.txt     # Tell bitfighterd to run in portable mode

OS X

Bitfighter builds on OS X using Xcode 3 (3.1 or greater) but *not* Xcode 4 (yet). You must have developer tools installed to build bitfighter on OS X! (You can get them from Apple.)

Note: If you don't wish to download Xcode with iOS integration (saves about 2GB off of downloading) you can get older versions on the developer downloads page. Xcode 3.2.2 is the latest without iOS built in.

To build in Xcode:

  1. Navigate through bitfighter > build > osx > Xcode > Bitfighter.xcodeproj
  2. Open Bitfighter.xcodeproj with Xcode.
  3. Click 'Build and Go' at the top. Bitfighter should compile successfully and attempt to launch.
    • Note: building from trunk may NOT complete successfully and/or the launch may fail.
  4. Your new build will be found at Bitfighter > build > osx > build > Debug / release > *


Notes

  1. The bitfighter project also builds the tnl and libtomcrypt frameworks automatically before compiling the bitfighter source itself.
  2. The following frameworks are added automatically to the bundle:
    • libtomcrypt.framework
    • tnl.framework
    • Openal-Soft.framework
  3. Settings are found in $HOME/Library/Application Support/Bitfighter