The maritime parallax

GOSPORT CLOUD

AssaultCube Centos Server

February 2019


Assaultcube, weighing in at 40mb, requires a smallish VPS, perhaps 1-2gb will surfice.If you do not have a VPS at the moment consider OVH or Contabo, I have been using these for quite a few years, for website hosting and game servers.Both offer brilliant packages for a VPS.
This will come in three parts, firstly the installation of AC, then a simple script to maintain the screen sessions using Ncurses and dialog boxes. Finally a method of automating a process to check if the server is running when we log off.



Scroll to Top

It is not imperative to have knowledge of Linux to complete the server installation, this is just a copy and paste exercise. Click on the button below to view the linux commands that will be used.
Ensure you have root access to your VPS.
Log on as root and use the password supplied by your host.

Linux Commands

Root User [ Setup Server ]


yum install deltarpm

yum install deltarpm -y

Centos is very much a bare bones install, Installing Epel Release adds extra libraries.

yum install epel-release -y

Check for any updates. ( -y saves confirming each file of installation ).

yum update-y

Install libraries and files required by AC. Including Nano text editor, Screen session manager, Lnav log viewer and Midnight Commander file manager.

yum install readline-devel crypto-utils gcc-c++ zlib-devel SDL-devel SDL_image SDL_image-devel libogg-devel libvorbis-devel openal-soft-devel libcurl-devel clang clang-devel SDL_mixer-devel libcurl-devel nano screen unzip lnav wget mc -y

Create a user and add to the system. Lets just call the user newuser

adduser newuser 

Allocate the new user a password

passwd newuser 

Allocate user sudo privilages.By adding to the wheel allows the user to upload/download files etc.

usermod -a -G wheel newuser 

The server is set with the libraries required by AC.
The root user is no longer required.
At this point log out of the server.
Log back in as the new user and of course using the password.

Sudo User


Logged into your home directory. Now install Assaultcube master.zip file.

wget https://github.com/assaultcube/AC/archive/master.zip 

Unzip AC-master.zip. Note that this is a directory with our files inside.

unzip master.zip

Re-name 'AC-master'directory to something more manageable, lets call it 'ac'

mv AC-master ac 

Move to the src directory.

 cd /home/username/ac/source/src 

Compile the native server.

make clean && make install

With the compiling completed. Move back to the ac directory.

cd /home/username/ac 

Configure AC Settings


To start the server, create a small bash shell file. I have called it express.sh, up to you what you intend to call the server.

nano express.sh

Copy and paste the following into the editor. This is two lines. When finished press 'ctrl o' save the file, then 'ctrl x' to exit the editor.

#!/bin/sh
./bin_unix/native_server -PfkbmasRCDePtw -T -kA10 -kB60 -McURD -D3 -Wdemos/express -n"\f3Express Server" -o"\f5Welcome to the Express Server" -c16 -f28763

Make the shell file executable.

chmod +x express.sh.
Bash Script Info

Set passwords for each admin in the serverpwd.cfg file in the config directory.

nano config.serverpwd.cfg

Below is an example of password structure.
password then 0 // player name

password  0  //player-name
apple  0  // matrix
lemon  0  //vector

Messages of the day displayed when server is visited. More info on this is available on AC Wiki

nano config/serverinfo_txt

Start a the native server in a screen session

 screen -dmS servername bash /home/username/ac/servername.sh 

Check if the session is functioning. Now it is safe to log off.

screen -ls

Ncurser Dialog Box (Optional)


Eventually the server will need updating of some kind, whether that be map rotations, blacklists or passwords. It is easier to do this with a menu driven system. Ncurses library can be used to create dialog boxes.
It is not the best result visually, yet it does offer an easy method of editing server files, or perhaps stop and restart a server. Ncurses requires to be downloaded and installed. It is not a big package.

dialog menu
Ncurses Script

Install Ncurses using the your Sudo elevated status.
This time you will be asked for your password.

sudo yum install ncurses-d

Edit the Dialog scipt to your requirements. Server name etc.

nano dialog.sh

When editing is completed. Make the file executable

chmod +x dialog.sh

Check to see that the dialog works

./dialog.sh

Set the dialog box to execute each time you log into your Centos server
The user profile has to be edited.
Change the username and servername and save the file,to point to your bash executable file.

nano /home/username/.bash_profile

Crontabs


Crontab is a simple method to set a frequency to activate a function.
In this instance we want to check if the server is actually active, if not to start again.
To do this , create a small bash file, I have called the file crash.sh, to check the server and then set the crontab to execute the bash file.

Create bash file called crash.sh

nano /home/username/ac/crash.sh

Copy and paste below into the editor, edit server name.
This is just checking if the server is active, if not restart the server.

#!/bin/bash
  user=$(whoami)
  if ! screen -list | grep -q "SERVER_NAME"; then
  cd /home/$user/ac/
  screen -dmS  SERVER_NAME bash /home/$user/ac/SERVER_NAME".sh" 

Once again, make the file executable using chmod

chmod +x crash.sh 

Now for the Crontab

export VISUAL=nano; crontab -e 

This will create a crontab that executes crash.sh every 5 minutes.

*/5 * * * * /home/user/ac/crash.sh 

Redundant Files and Directories


Lets start with a clean screen.

clear 

If you are not in the AC directory then use this below.

cd /home/username/ac/

List files and directories inside of the directory.

ls 

Delete all unwanted files.

rm assaultcube.bat assaultcube_portable.bat assaultcube.sh            changelog.txt check_install.sh install_or_remove_menuitem.sh README.html server.bat README.md server.sh server_wizard.sh server_wizard.bat -y 

We are using Linux so goodbye to the Windows Directory.

rm -rf bin_win32  

AC Youtube Anthem


Finally it is all done. But I could not finish without displaying a video called AC anthem I found on Youtube. Dont forget to switch on subtitles.



Credits


The Devs who have given so much of their time to create this game to be played free.
The management Devs, who maintain the day to day affairs.
Xray-dog who sponsers the masterserver out of his own pocket. Medusa and Jamz who do their utmost to monitor in game.

Hats off to the likes of players like shad99 and more who dedicate so much time creating maps.
Lastly to a player who gave so much to AC, For3v3r, Probably one of the kindest and most generous players that I have known. Sponsering servers worldwide and creating a membership of so many gifted players. Gratitude has to be given for his introducing me to Centos. From there I progressed to PHP, Html and Jquery, although it is mostly a hobby.
Today I still play AC most days when I get time. Matrix aka vector

See you in game, until then Adios!


Basic Centos Commands

×
  • lsLists files and directories in the present location.
  • clearClear the screen
  • cdChange directory. ie cd/user/files
  • cd ..Go back a directory
  • ~This is called a tilde. Move to users home directory
  • mvChange a file or directories name
  • yumCentos package manager for installing package.
  • adduserAdd a user to the system
  • passwd usernameAllocate password for a user
  • usermodModify user permissions
  • sudoGive user elevated permisions.
  • wgetUsed to download a file.
  • unzip Uncompress a file
  • make clean Delete previous file version
  • &&Chain Command. (Create two commands on one line)
  • make installCompile a new file
  • chmodChange Mode. Alter permissions of a file or directory
  • screenAllows a session to continue running when logged out.
  • rmRemove a file or directory

Bash file explained

×
  • #bin/sh
    Identifies it as a Bash file

  • ./bin_unix/native_server
    Start a server session

  • -PfkbmasRCDePtw -T -kA10 -kB60 -McURD -D3
    These are triggers that give control of the game environment.

  • -Wdemos/servername
    Save demos to a file called servername

  • -n"\f3servername
    Server ID displayed in AC

  • -o
    Start of severnames description

  • -c16
    Set how many players. In this case 16

  • -f28763
    Connection port on the AC masterserver.

Ncurser Dialog Menu Script

×