Difference between revisions of "Building Bitfighter"

From Bitfighter
(Centos Dedicated Instructions)
(Windows)
 
(26 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
This page is dedicated to getting Bitfighter to build on your system of choice.  Some useful links:
 
This page is dedicated to getting Bitfighter to build on your system of choice.  Some useful links:
*[http://code.google.com/p/bitfighter/source/list Changelog]
+
*[https://github.com/bitfighter/bitfighter Browse source]
*[http://code.google.com/p/bitfighter/source/browse Browse source]
+
*[https://github.com/bitfighter/bitfighter/commits/master Changelog]
  
 
Also, please see the README.txt included in the source.
 
Also, please see the README.txt included in the source.
  
 
===Source Code===
 
===Source Code===
Bitfighter uses Mercurial (hg) to manage the source code.  Here is some useful Mercurial information:
+
Bitfighter has migrated to Git to manage the source code, on the GitHub website.  Here is some useful Git information:
*[[Contribute_using_Mercurial]]
+
*[https://try.github.io Intro to Git]
 +
*[https://guides.github.com/activities/hello-world/ Simple GitHub usage]
 +
*[https://guides.github.com/ Other GitHub guides]
  
 
The Bitfighter code can be found here:
 
The Bitfighter code can be found here:
*[http://code.google.com/p/bitfighter/source/checkout Source Checkout]
+
*[https://github.com/bitfighter/bitfighter Source Checkout (Click 'Clone or download')]
  
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:
+
If you have Git 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/
+
  git clone https://github.com/bitfighter/bitfighter.git 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:
 
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
+
  git tag
  
 
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:
 
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-019d
+
  git checkout bitfighter-019f
 
+
  
 
===Windows===
 
===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 and later====
+
We have migrated to [CMake http://www.cmake.org/] for Windows builds in version 019 and later (and currently in the most recent development code). Note that we recommend using Visual Studio 2017 (though other versions will work) for the building environment on Windows.  To build:
We have migrated to [CMake http://www.cmake.org/] for Windows builds in version 019 and later (and currently in the most recent development code). Note that we recommend using Visual Studio 2013 (though other versions will work) for the building environment on Windows.  To build:
+
  
 
# Install CMake from http://www.cmake.org/
 
# Install CMake from http://www.cmake.org/
 
# In a terminal, change to the 'build' directory in the bitfighter source code tree.
 
# In a terminal, change to the 'build' directory in the bitfighter source code tree.
# Run the following command (A list of CMake 'generators' for different build environments can be found [here http://www.cmake.org/cmake/help/v3.1/manual/cmake-generators.7.html#manual:cmake-generators(7)]):   
+
# Run the following command (A list of CMake 'generators' for different build environments can be found [here http://www.cmake.org/cmake/help/v3.8/manual/cmake-generators.7.html#manual:cmake-generators(7)]):   
#* cmake -G "Visual Studio 12 2013" ..  # Substitute a different generator if you like
+
#* '''cmake -G "Visual Studio 17 2022" -A x64 ..''' # Substitute a different generator if you like
 +
#** To target Windows XP, add the proper toolset to the CMake command: '''cmake -G "Visual Studio 15 2017" -T "v141_xp" ..'''
 
# Open the resulting Visual Studio solution file
 
# Open the resulting Visual Studio solution file
 
# To run and debug, you may need to right click "Bitfighter" in solution explorer, and choose "Set as StartUp Project"  (the active project is shown in bold text)
 
# To run and debug, you may need to right click "Bitfighter" in solution explorer, and choose "Set as StartUp Project"  (the active project is shown in bold text)
 +
# If the game starts, but you can't find the window, try running the debug build from the cmdline (in the exe folder) like this: '''bitfighter_debug.exe -window -winwidth 600 -winpos 4 28'''; then quit the game and it should run fine moving forward.  This is a rare issue.
  
 
===Linux===
 
===Linux===
Line 43: Line 43:
 
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/]   
 
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/]   
  
Bitfighter has several common, open source dependencies:
+
Bitfighter has several common, open source dependencies, which can be easily installed:
* SDL
+
 
* zlib
+
* sudo apt-get install cmake libphysfs-dev libsdl2-dev libopenal-dev libvorbis-dev libmodplug-dev libspeex-dev
* 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:
 
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:
Line 57: Line 52:
  
 
You will also need the following to compile:
 
You will also need the following to compile:
* cmake
+
* cmake version 3+ (sometimes called cmake3)
 
* make
 
* make
 
* gcc / g++
 
* gcc / g++
Line 63: Line 58:
 
Once your dependencies are installed, you can build bitfighter with these steps:
 
Once your dependencies are installed, you can build bitfighter with these steps:
 
# cd build
 
# cd build
# cmake ..
+
# cmake ..   [or cmake3 ..]
 
# make
 
# make
  
 
If you want to build a dedicated server (with no GUI), replace the 'make' step above with:
 
If you want to build a dedicated server (with no GUI), replace the 'make' step above with:
# make dedicated
+
# make bitfighterd
  
 
Next, you'll need to copy the resources to where the executable was built:
 
Next, you'll need to copy the resources to where the executable was built:
Line 76: Line 71:
 
# touch standalone.txt
 
# touch standalone.txt
  
====Centos Dedicated Instructions====
+
====Centos Dedicated Server Instructions (Easy!)====
 
'''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'''
 
  <nowiki>
 
  <nowiki>
  
# We recommend that you install and run a dedicated bitfighter server with a special user account
+
# We recommend that you install and run a dedicated bitfighter server with a special  
# used only for this purpose, that does not have root access.
+
# 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
+
# First, create a bitfighter user; you can skip this step if you want to use an  
# build system when 018a was released.  019 will be easier!
+
# existing account
 
+
# Here we create a bitfighter user; you can skip this step if you want to use an existing  
+
 
+
account
+
 
useradd bitfighter      # Create the account
 
useradd bitfighter      # Create the account
 
passwd bitfighter        # Set the password.  Pick a good one!
 
passwd bitfighter        # Set the password.  Pick a good one!
Line 96: Line 87:
 
sudo yum update    # system should be up to date
 
sudo yum update    # system should be up to date
  
# The following sets up the EPEL repository for extra packages (needed for mercurial)
+
# The following sets up the EPEL repository for extra packages (needed for newer git)
 
# Choose one based on your server architecture
 
# Choose one based on your server architecture
 
# 32 bit:
 
# 32 bit:
Line 103: Line 94:
 
sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
 
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
+
sudo yum install git gcc gcc-c++ zip ncurses-devel readline-devel patch cmake3 screen
  
  
Line 110: Line 101:
 
cd ~
 
cd ~
  
# Get the source code -- this will create a folder called bitfighter in your current location
+
# Get the source code -- this will create a folder called bitfighter in your  
# This may take a couple of minutes
+
# current location.  This may take a couple of minutes!
hg clone https://code.google.com/p/bitfighter/
+
git clone https://github.com/bitfighter/bitfighter.git bitfighter
  
 
# Update to the tag/revision you want
 
# Update to the tag/revision you want
 
cd bitfighter
 
cd bitfighter
hg up bitfighter-018a
+
git checkout bitfighter-019f
 
+
# 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)
 
# Build the dedicated server (called bitfighterd)
 
cd build
 
cd build
cmake ..          # This creates a Makefile for the next step; may emit warnings about PNG and ZLIB
+
cmake3 ..          # Creates a Makefile for the next step; may emit warnings
 
make bitfighterd
 
make bitfighterd
  
Line 135: Line 117:
 
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 (don't skip this!!)
 
</nowiki>
 
</nowiki>
  
 
===OS X===
 
===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].)
 
  
'''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.
+
We have migrated to CMake for OS X as well.  You must have the following software installed (in addition to the bitfighter source code):
 +
# CMake
 +
# XCode (includes development libraries and compilers)
 +
 
 +
To build:
 +
# Open a terminal
 +
# Set up the compatibility environment by running:  
 +
#* export MACOSX_DEPLOYMENT_TARGET=10.6
 +
# change into the 'build' directory within the Bitfighter source
 +
# Run CMake:
 +
#* cmake ..
 +
# Build with 'make':
 +
#* make Bitfighter
 +
# The .app will be built in the 'exe' sub-folder of the main bitfighter source directory
  
To build in Xcode:
+
Building with XCode is supported with CMake, but it is untested with Bitfighter.  To do so:
# Navigate through bitfighter > build > osx > Xcode > Bitfighter.xcodeproj
+
# Open a terminal
# Open Bitfighter.xcodeproj with Xcode.
+
# Set up the compatibility environment by running:
# Click 'Build and Go' at the top.  Bitfighter should compile successfully and attempt to launch.
+
#* export MACOSX_DEPLOYMENT_TARGET=10.6
#*'''Note:''' building from trunk may NOT complete successfully and/or the launch may fail.
+
# change into the 'build' directory within the Bitfighter source
#Your new build will be found at Bitfighter > build > osx > build > Debug / release > *
+
# Run CMake using the Xcode generator:
 +
#* cmake -G Xcode ..
 +
# This will create an Xcode project within the 'build' directory that you can open
  
  
 
====Notes====
 
====Notes====
# The bitfighter project also builds the tnl and libtomcrypt frameworks automatically before compiling the bitfighter source itself.
+
# Bitfighter user settings are found in $HOME/Library/Application Support/Bitfighter
# The following frameworks are added automatically to the bundle:
+
#*libtomcrypt.framework
+
#*tnl.framework
+
#*Openal-Soft.framework
+
# Settings are found in $HOME/Library/Application Support/Bitfighter
+

Latest revision as of 02:37, 9 January 2023

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 has migrated to Git to manage the source code, on the GitHub website. Here is some useful Git information:

The Bitfighter code can be found here:

If you have Git 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:

git clone https://github.com/bitfighter/bitfighter.git 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:

git tag

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:

git checkout bitfighter-019f

Windows

We have migrated to [CMake http://www.cmake.org/] for Windows builds in version 019 and later (and currently in the most recent development code). Note that we recommend using Visual Studio 2017 (though other versions will work) for the building environment on Windows. 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 the following command (A list of CMake 'generators' for different build environments can be found [here http://www.cmake.org/cmake/help/v3.8/manual/cmake-generators.7.html#manual:cmake-generators(7)]):
    • cmake -G "Visual Studio 17 2022" -A x64 .. # Substitute a different generator if you like
      • To target Windows XP, add the proper toolset to the CMake command: cmake -G "Visual Studio 15 2017" -T "v141_xp" ..
  4. Open the resulting Visual Studio solution file
  5. To run and debug, you may need to right click "Bitfighter" in solution explorer, and choose "Set as StartUp Project" (the active project is shown in bold text)
  6. If the game starts, but you can't find the window, try running the debug build from the cmdline (in the exe folder) like this: bitfighter_debug.exe -window -winwidth 600 -winpos 4 28; then quit the game and it should run fine moving forward. This is a rare issue.

Linux

Detailed Instructions

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, which can be easily installed:

  • sudo apt-get install cmake libphysfs-dev libsdl2-dev libopenal-dev libvorbis-dev libmodplug-dev libspeex-dev

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 version 3+ (sometimes called cmake3)
  • make
  • gcc / g++

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

  1. cd build
  2. cmake .. [or cmake3 ..]
  3. make

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

  1. make bitfighterd

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 Server Instructions (Easy!)

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.

# First, 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 newer git)
# 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 git gcc gcc-c++ zip ncurses-devel readline-devel patch cmake3 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!
git clone https://github.com/bitfighter/bitfighter.git bitfighter

# Update to the tag/revision you want
cd bitfighter
git checkout bitfighter-019f

# Build the dedicated server (called bitfighterd)
cd build
cmake3 ..          # Creates a Makefile for the next step; may emit warnings
make bitfighterd

# 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 (don't skip this!!)

OS X

We have migrated to CMake for OS X as well. You must have the following software installed (in addition to the bitfighter source code):

  1. CMake
  2. XCode (includes development libraries and compilers)

To build:

  1. Open a terminal
  2. Set up the compatibility environment by running:
    • export MACOSX_DEPLOYMENT_TARGET=10.6
  3. change into the 'build' directory within the Bitfighter source
  4. Run CMake:
    • cmake ..
  5. Build with 'make':
    • make Bitfighter
  6. The .app will be built in the 'exe' sub-folder of the main bitfighter source directory

Building with XCode is supported with CMake, but it is untested with Bitfighter. To do so:

  1. Open a terminal
  2. Set up the compatibility environment by running:
    • export MACOSX_DEPLOYMENT_TARGET=10.6
  3. change into the 'build' directory within the Bitfighter source
  4. Run CMake using the Xcode generator:
    • cmake -G Xcode ..
  5. This will create an Xcode project within the 'build' directory that you can open


Notes

  1. Bitfighter user settings are found in $HOME/Library/Application Support/Bitfighter