Setting up an UFO2000 server

From UFOpaedia
Jump to navigation Jump to search

In principle, for playing online, you do need an online server. Usually the public ufo2000.net server should do just fine. But maybe you want to set up a private server or a backup server.

How to get the binary and what it brings with it

In order to run your own server, you can either use the supplied precompiled ufo2000.exe from the project page, or for linux, you will need to compile it yourself. Don't worry, the latter is no big deal. You should have a look at Compiling for Linux (UFO2000)#Compiling_the_server, then.

Starting and stopping

You should have either the ufo2000-srv.exe (Windows) or the ufo2000-srv (Linux). You can either start it manually (stopping with CTRL+C) or let it be done by an init-script/the systems service-manager. For the moment, it is not recommended, to use the demonized-mode, as there have been reports of problems with that. On piece of advice at this point: If you choose to run the server on a regular basis, e. g. on a root-server, you really should not run the server as root. Better use an init-script, running it as a limited user. That way, it's far less dangerous, running the ufo2000-server. There are no known security issues, but the problem usually are the not known one. If somebody may find any, the service run as root is a big security risk. So keep that in mind, when running ufo2000 servers, or any other gaming server for that matter.

If you want the server to be a backup-server, don't forget to add it to this list!

Ports and routers

When running, the server automatically opens up a tiny web server, showing the current players on the server. You can reach it via http://<server-adress>:2000. The Port 2000 (TCP) is also the port, where the server listens for connections of the game. If you run it behind a NAT (e. g. used by most home routers), you will also need to forward that port to the computer, running the service.

Configuration

The file ufo2000-srv.conf contains a few options for configuration:

daemonize               = 0
tcp_port                = 2000
players_count_limit     = 32
connections_count_limit = 64
login_time_limit        = 10000
username_size_limit     = 25
packet_size_limit       = 65536

Most of it should be rather self explaining. As said before, for the moment better not use the deamonize-option.

Stats and passwords

Stats

There is a function for recording of results of all played games. These results are saved in the file ufo2000.db. To query this file, e. g. with a php-script, you need access to it, provided by php. You will need to install php for use with an apache server. Usually, this is already the case. You will also need the pdo drivers for the query itself. On Ubuntu 14.04 you can install the required files with this:

sudo apt-get install php5-sqlite sqlite

From that on, you can build your own server stats-page.

Passwords

All users connecting to the server, will have the opportunity to choose a password, when connecting the first time with a certain user name. This password will remain! It's saved as a MD5-hash, and can only be changed by manipulating the database-table ufo2000_users. You can either delete a user completely, or let him give you a new password-hash. The user has no way of changing it himself and you won't have any means of recovering a lost password, as there are only hashes in the table.

Logs

The file ufo2000-srv.log contains server logs. If you experience problems, first look there, to further isolate the problem.