Difference between revisions of "Building Bitfighter"

From Bitfighter
m (Building Bitfighter)
(Windows)
 
(147 intermediate revisions by 26 users not shown)
Line 1: Line 1:
=Source=
+
{{TOC right}}
The current version of the Bitfighter source is available via SVN:
+
<pre>
+
svn co <nowiki>https://zap.svn.sourceforge.net/svnroot/zap/release-013a</nowiki> bitfighter
+
</pre>
+
  
=Linux=
+
This page is dedicated to getting Bitfighter to build on your system of choiceSome useful links:
Bitfighter should build on any major flavor of LinuxIt has been tested and is known to work on Ubuntu and Centos.
+
*[https://github.com/bitfighter/bitfighter Browse source]
 +
*[https://github.com/bitfighter/bitfighter/commits/master Changelog]
  
The Bitfighter client depends on Freeglut and the Lua development libraries. Freeglut is not needed to build a Bitfighter dedicated server (without client portions).
+
Also, please see the README.txt included in the source.
  
Bitfighter must be compiled with the g++ compiler, which is not included in many Linux distributionsSVN is required to obtain the source code.
+
===Source Code===
 +
Bitfighter has migrated to Git to manage the source code, on the GitHub websiteHere is some useful Git information:
 +
*[https://try.github.io Intro to Git]
 +
*[https://guides.github.com/activities/hello-world/ Simple GitHub usage]
 +
*[https://guides.github.com/ Other GitHub guides]
  
To get the Bitfighter source, use SVN (get the latest production version using the command at the top of this page)
+
The Bitfighter code can be found here:
 +
*[https://github.com/bitfighter/bitfighter Source Checkout (Click 'Clone or download')]
  
The game will build out-of-the-box on many distros. For details of the various build options, please see the top-level Makefile.
+
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
  
'''Building full game client on a clean install of Ubuntu'''
+
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:
These instructions should work on both 32 and 64 bit platforms.
+
git checkout bitfighter-019f
<source lang="bash">
+
sudo apt-get update
+
sudo apt-get install subversion g++ libreadline6-dev
+
sudo apt-get install freeglut-dev libopenal-dev libalut-dev
+
  
# Get the source code
+
===Windows===
svn co https://zap.svn.sourceforge.net/svnroot/zap/[version] bitfighter
+
  
# Build the game -- the standard options should work
+
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:
cd bitfighter
+
make
+
  
# Copy required files into exe folder:
+
# Install CMake from http://www.cmake.org/
cd exe
+
# In a terminal, change to the 'build' directory in the bitfighter source code tree.
cp -r ../installer/levels .
+
# 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)]): 
cp -r ../installer/robots .
+
#* '''cmake -G "Visual Studio 17 2022" -A x64 ..'''  # Substitute a different generator if you like
cp -r ../installer/sfx .
+
#** To target Windows XP, add the proper toolset to the CMake command: '''cmake -G "Visual Studio 15 2017" -T "v141_xp" ..'''
cp -r ../installer/screenshots .
+
# 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)
 +
# 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.
  
</source>
+
===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: [http://www.winehq.org/] 
  
'''Building a dedicated server on a typical clean Centos virtual server instance'''
+
Bitfighter has several common, open source dependencies, which can be easily installed:
<source lang="bash">
+
yum -y update
+
yum -y install subversion
+
yum -y install gcc
+
yum -y install gcc-c++
+
yum -y install zip        # For archiving purposes
+
  
yum install -y ncurses-devel    # Needed on some servers
+
* sudo apt-get install cmake libphysfs-dev libsdl2-dev libopenal-dev libvorbis-dev libmodplug-dev libspeex-dev
yum install -y readline-devel    # Needed on some servers
+
  
 +
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
  
# Get the source code
 
svn co https://zap.svn.sourceforge.net/svnroot/zap/[version] bitfighter
 
  
# Build the dedicated server (called bitfighterd)
+
You will also need the following to compile:
cd bitfighter
+
* cmake version 3+ (sometimes called cmake3)
make dedicated
+
* make
 +
* gcc / g++
  
# Copy required files into exe folder:
+
Once your dependencies are installed, you can build bitfighter with these steps:
cd exe
+
# cd build
cp -r ../installer/levels .
+
# cmake ..   [or cmake3 ..]
cp -r ../installer/robots .
+
# make
cp -r ../installer/sfx .
+
cp -r ../installer/screenshots .
+
</source>
+
  
=Windows=
+
If you want to build a dedicated server (with no GUI), replace the 'make' step above with:
Bitfighter can be built with MS Visual C++ 2010 Express Edition, a free download from Microsoft, and a much-improved IDE over previous versions. 
+
# make bitfighterd
  
To compile, you'll need to obtain a few files directly from Microsoft -- see the <i>readme.txt</i> in the folder <i>win_include_do_not_distribute</i>.
+
Next, you'll need to copy the resources to where the executable was built:
 +
# cd ../exe
 +
# cp -r ../resource/* .
  
=OS X=
+
And if you wish to run in standalone mode, create a standalone.txt file in the 'exe' folder to trigger this mode:
Bitfighter builds on OS X using xcode.
+
# touch standalone.txt
Note that you must have developer tools installed to build bitfighter on OS X!
+
(You can get them [from Apple.[http://developer.apple.com/technologies/tools/xcode.html]])
+
  
 +
====Centos Dedicated Server Instructions (Easy!)====
 +
'''Building a dedicated server on a typical clean Centos 5 or 6 virtual server instance'''
 +
<nowiki>
  
===Getting the source===
+
# We recommend that you install and run a dedicated bitfighter server with a special
The Bitfighter source is available via SVN.  To access SVN on your Mac, open Applications > Utilities > Terminal and paste the svn command shown at the top of this page.
+
# user account used only for this purpose, that does not have root access.
  
This will download the Bitfighter source into your home folder.
+
# 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!
  
The Bitfighter xcode project will be at:
+
# Do the following as a user that has sudo privileges
  
*Bitfighter > Zap > bitfighter.xcodeproj
+
sudo yum update    # system should be up to date
  
''Do not use the osx project folder, the project has been moved and it is no longer used''
+
# 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
  
Before you are able to compile it, you will have to build two additional frameworks included with the source, libtomcrypt and tnl.
+
sudo yum install git gcc gcc-c++ zip ncurses-devel readline-devel patch cmake3 screen
  
===Building libtomcrypt===
 
Navigate out of zap and into the folder libtomcrypt.
 
*You will find another xcode file named  libtomcrypt.xcodeproj
 
*Build this framework by opening the project and finding the target icon. Click open the triangle, right click it, and select "build 'libtomcrypt'"
 
*When completed, navigate back to the bitfighter root folder.
 
  
===Building tnl===
+
# Do the following as the bitfighter user
*As before, navigate through TNL > tnl.xcodeproj
+
su bitfighter
*Once open, find ''external frameworks and...> Linked frameworks > libtomcript.framework"
+
cd ~
*Select the framework and click the info button.  xcode has not found framework we just build correctly, so we need to manually choose its path
+
*Click the choose button
+
*Find and open your bitfighter root folder
+
*Navigate through Libtomcrypt > Build > Debug > Libtomcrypt.framework and click choose.
+
  
Now that you have your framework in place, you can build tnl.xcodeproj the same way you built libtomcrypt.xcodeproj
+
# 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
  
===Building Bitfighter===
+
# Update to the tag/revision you want
Now you are ready to build bitfighter.xcodeproj.
+
cd bitfighter
Navigate through Bitfighter > Zap > Bitfighter.xcodeproj
+
git checkout bitfighter-019f
  
Open it, and locate the same Linked frameworks folder that you did when you built the tnl framework.
+
# Build the dedicated server (called bitfighterd)
 
+
cd build
Now we need to locate both libtomcrypt.framework and tnl.framework
+
cmake3 ..         # Creates a Makefile for the next step; may emit warnings
*select the framework, and click info.
+
make bitfighterd
*where it says path in red, click choose and locate through
+
 
+
Home > bitfighter > libtomcrypt > build > debug > libtomcrypt.framework
+
for libtomcrypt
+
 
+
and
+
Home > bitfighter > tnl > build > debug > tnl.framework
+
for tnl
+
  
once you have chosen the correct paths for the frameworks, Click Build and Go at the top.
+
# Copy required files into exe folder (found at the root of the code tree):
Bitfighter should compile successfully and attempt to launch.  
+
cd ../exe
+
cp -r ../resource/* .
If you get an error message saying bitfighter crashed upon launch, follow these steps to fix this
+
touch standalone.txt  # Tell bitfighterd to run in portable mode (don't skip this!!)
*Navigate to your bitfighter and through Zap > build > debug > Bitfighter.app
+
</nowiki>
*Right click it and select "show package contents"
+
*Navigate through contents and make a new folder called frameworks IF there isn't one there already.  
+
*If there is a folder, open it.
+
*Now you'll need to put a few frameworks in it
+
  
These frameworks are mandatory, they MUST be in the folder for Bitfighter to work:
+
===OS X===
  
*ALUT.framework
+
We have migrated to CMake for OS X as well. You must have the following software installed (in addition to the bitfighter source code):
*Libtomcrypt.framework
+
# CMake
*tnl.framework
+
# XCode (includes development libraries and compilers)
*openal.framework
+
  
**you may also need carbon.framework and cocoa.framework**
+
To build:
**right click on them in xcode and select reveal in finder to find them**
+
# 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 find these frameworks, go back to the bitfighter project window in xcode
+
Building with XCode is supported with CMake, but it is untested with Bitfighter. To do so:
Navigate back to where all the frameworks were.
+
# Open a terminal
Right click on a framework and select "reveal in finder"
+
# Set up the compatibility environment by running:
Copy the framework to your clipboard, and paste it in the frameworks folder you just made, or that was already there.
+
#* export MACOSX_DEPLOYMENT_TARGET=10.6
*Repeat these steps for all four frameworks
+
# change into the 'build' directory within the Bitfighter source
*If a framework is already there, skip that one
+
# Run CMake using the Xcode generator:
 +
#* cmake -G Xcode ..
 +
# This will create an Xcode project within the 'build' directory that you can open
  
When you are done with this, you can copy your bitfighter.app game and paste it into the installer folder, located in Bitfighter > Installer, and launch it.
 
*By doing this, you acquire your sfx folder, your levels folder, your screenshots folder, and your robots folder
 
*NOTE Make sure you copy your bitfighter.app game to the installer folder if you intend on making edits to the xcode project.
 
  
Now you have successfully built your own Bitfighter game.
+
====Notes====
 +
# Bitfighter user 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