Compiling a server

Intro - A guide for Linux
This guide starts at installing the dependencies and will help with installing, as well applying the hit-reg fix which is used as an example of editing the server source.

The extent of this guide.
This is not a server-setup guide. If you just want to setup a server, then you don’t necessarily need to compile a new binary for your server. However, if you want to modify your server to add/change/remove functionality, then this guide will get you started in the right direct. ''Note: If you modify your server to the extent that it changes game play, it will not be allowed to register to the AC MasterServer. unless you are applying the hit-reg fix which is an allowed modification.''

This guide is written for Ubuntu. If you use another flavor of linux, then some of it may be slightly different. This guide will be helpful if you want to install the hit-reg fix on your server. Although this guide is written for AC ver. 1.1.0.4, it should be the same method for future releases of AC.

About Screen-Sharing and SSH
This guide is written to be executed with SSH. The problem with screen-sharing is it tends to be very slow to update and can have very annoying latency issues and can not provide useful features such as copy-paste. It can be quite annoying to type out every command. Even with screen-sharing, most of the work is done in the terminal so it makes sense to just use SSH.

Understanding paths
If you are new to any sort of command-line interaction, you may be new to the way computers represent where you are in the server. Paths are fairly simple to understand. Directories (folders) are separated by slash marks (‘/’ on linux, ‘' on windows). So a path may look like this: Desktop/assaultcube/packages/textures/file.jpg ...which it will be like if you opened (double clicked) the folder “assaultcube” on your desktop, and then opened up packages, and then textures. The “file.jpg” means we are talking about file.jpg in the folder textures. When using a command line, you have to keep track of where you are by using these text paths. You can change the directory you are currently by using the command “cd” (which you can remember by calling it “change directory"). For instance, when you start up SSH, you will most likely be in your user’s home folder. To navigate to “textures” you would do this: cd Desktop/assaultcube/packages/textures/file.jpg There are a couple of special symbols you can use when writing paths. ‘.’ refers to the current directory. So if you had the folder “packages” open, you could refer to “file.jpg” like:  ./file.jpg This is called a relative path, it is relative to where you already are. An absolute path starts at the topmost directory in your system, and works its way down to where you are. So an absolute path would look something like this:  /Users/Ronald_Reagan/Desktop/assaultcube/packages/textures/file.jpg Notice how relative paths are much shorter and easier to type out?

One of the most frequently used symbols you will see when looking at paths is ‘..’. This means to go up a directory. So, if you had “packages” open, going up a directory would land you in “Desktop”. An example of this path is if you were in the folder “mapmodels” in your “packages” folder: ../textures/file.jpg This is also an example of a relative path.

The last special symbol I’ll talk about is the tilda; ‘~’. The tilda key is located, on QWERTY keyboards, right below the escape key. The ‘~’ refers to the current user’s home directory. For an example: these two lines both refer to the same directory: /Users/Ronald_Reagan/Desktop/assaultcube/ ~/Desktop/assaultcube So, just to review: A single period refers to the current directory, two periods refer to up one directory, and a tilda refers to the current users home directory. cd /Users/Ronald_Reagan/Desktop/ cd ~/Desktop/ cd ./Desktop/ The above will all get you to the desktop (the last one only if you started in the users home directory), and the following will get you back to the users home directory: cd ../

Getting the Source
If you have already gotten the AC package for running a server, you probably already have the source. You will find it in assaultcube/source. Navigate to this directory. If you haven’t gotten the source yet, navigate to where you want to put AC, and enter this into the prompt: $ wget -Oassaultcube.tar.bz2 http://downloads.sourceforge.net/project/actiongame/AssaultCube%20Version%201.1.0.4/AssaultCube_v1.1.0.4_source.tar.bz2 This will download the assaultcube source, and save it to the file “assaultcube.tar.bz2”. Now we will extract it from the archive: tar jxf assaultcube.tar.bz2 This will create a folder 1.1.0.4, which contains another folder “source”. Lets clean up and remove the archive. rm assaultcube.tar.bz2 The command rm will delete the file.

Modifying the Source
For this example I will add in the hit reg fix. Start by changing the directory to the directory containing the source. cd ./1.1.0.4/source/src/ Now we will modify the source using a command line text editor, called nano: nano serverevents.h Because the change is on line 42 of the file, lets use a shortcut to navigate there. Hold down control and press the underscore key. You will see this: wait<gs.gunwait[e.gun] || Navigate the cursor to the end of the row using your arrow keys and delete the whole line. You can also have the cursor at the beginning of the line and press Control-K. Press Control-X. At the bottom of the screen you will see it asking you if you want to save and because we want to save, we will press y and hit enter. Now lets go back to the folder containing 1.1.0.4: cd ../../../ We will now be in the folder that contains 1.1.0.4

Installing Dependencies
I will assume you have none of the required dependencies. With the package manager, it is pretty simple to install the required packages. Because we are only making the server source, we don’t need most of the libraries such as SDL, OpenAL or OpenGL. We just need the build-essentials: sudo apt-get install build-essential This will ask you for a password. Enter your password and follow the onscreen instructions if there are any. If it asks you any questions you do not know how to answer, just hit enter. It will probably end up just fine.

There is one more dependency we need, zlib. As far as I know, zlib is not in the package manager so we will have to manually install it. This will be similar to when we downloaded the source: wget -Ozlib.tar.gz http://zlib.net/zlib-1.2.8.tar.gz  tar -zxvf zlib.tar.gz  cd zlib-1.2.8/ Now we will follow the install instructions they give us: ./configure; make test If you don’t see any error messages, then it is alright to run: sudo make install Enter your password in if it asks you for it. This should be it for us, so lets go back to our containing directory and clean up a bit. cd ../ rm -R zlib-1.2.8/ rm zlib.tar.gz Notice the -R argument for the first rm command, this allows you to delete folders.

That does it for the dependancies! Lets go compile AC!

Compiling AC
We will start by navigating into the src folder: cd 1.1.0.4/source/src/ Now we will compile a the server binary: make server This will take a bit, and spit out tons of crud at you. If nothing looks like it went wrong (common tip offs are “ERROR” or “FATAL”) then AC is compiled! The file we just made is named ac_server and is in our current directory. Now you need to move the binary to where you put the rest of your server. You will do this with the command mv (“move”) mv ./ac_server ../../../bin_unix/ This will put it into the bin_unix folder at the same level of our 1.1.0.4 folder.

The Short Guide
This is everything we did condensed into just shell commands. I left out the part on how to modify the source. wget -Oassaultcube.tar.bz2 http://downloads.sourceforge.net/project/actiongame/AssaultCube%20Version%201.1.0.4/AssaultCube_v1.1.0.4_source.tar.bz2 tar -jxf assaultcube.tar.bz2 rm assaultcube.tar.bz2

sudo apt-get install build-essential

wget -Ozlib.tar.gz http://zlib.net/zlib-1.2.8.tar.gz  tar -zxvf zlib.tar.gz  cd zlib-1.2.8/ ./configure; make test sudo make install cd ../ rm -R zlib-1.2.8/ rm zlib.tar.gz

cd 1.1.0.4/source/src/ make server

mv ./ac_server ../../../bin_unix/

Links
AC Forum Thread

Original post

Server setup

Server guide

Server hints 1.0.4