Howto:Set up a multiplayer server

From FlightGear wiki
Jump to: navigation, search

This page is dedicated to providing a short overview about installing the FlightGear Multiplayer Server ('fgms'). The reader is assumed to be reasonably familiar with working in a Unix/Linux shell environment.

Pre-Requisites

  • A computer running a variant of *nix to compile and host the server. Speed of the machine isn't of great consequence as the protocol is a multiplexer which doesn't require much processing grunt.
  • direct/physical or remote access to the server (i.e. SSH/telnet, a conventional web hosting package will usually not be sufficient!)-suitable hosting packages are: dedicated root servers, virtual private servers, shell servers - for a collection of free shell account providers that may be suitable for fgms, see Free Shell Providers (you may want to check this out if you are interested in running fgms but don't have hosting yet)
  • if the server is meant to be a public internet server: an internet connection, featuring sufficient upstream/downstream capabilities (see below for details concerning bandwidth requirements).
  • firewall policies will need to be set up to allow for incoming and outgoing UDP traffic for the corresponding ports, the same applies to the administration port (TCP)
  • permission to run unattended background processes (this may only be an issue with certain limited hosting packages)
  • a working GNU toolchain including gcc/g++ (compiler), make & cmake
  • fgms source code, currently version 0.10.23
  • about 5-10 MB of hard disk space (mainly required for building the binary)

Traffic & Bandwidth Considerations

Note: Currently (May 2008), the server code basically boils down to a packet multiplexer (i.e. most data is -unconditionally- transmitted to all 'active' clients), which may thus create considerable amounts of traffic; this ought to be taken into consideration due to bandwidth limitations in most hosting packages (i.e. fgms may create considerable amounts of traffic!). For basic calculations: inbound traffic is 25 Kilobit per second while outbound is 25 Kbits per second for each plane/client that can 'see' another.

By default, assuming a 10hz update interval, each active fgfs client will currently cause I/O traffic of approximately 5 kbytes/sec (one update consuming ~500 bytes) [1].

As client updates have to be propagated to all other active clients by the server, this number has to be multiplied by the number of active clients -1 (i.e. clients within a configurable range, minus the originating client). In addition, the fgms system allows for traffic updates to be sort of 'mirrored' on (relayed to) other configurable multiplayer/relay servers.

This feature makes it possible for users/clients to use an arbitrary server (with acceptable latency), but still see clients/vehicles connected to different servers. Thus, such relay servers may additionally increase inbound/outbound traffic considerably as all traffic is mirrored/propagated to such relays.

Having more servers should actually decrease the load on each server in high load situations, i.e. when most of the clients are within range of each other. See this brief note on the theoretical bandwidth behaviour of fgms.

Facts

In March 2008, the main fgms multiplayer server (pigeond.net) was reported to consume approximately 15 gb of bandwidth per day, with an average throughput of 200 kB/sec and peak loads of up to ~ 650 kB/sec [2].

During the same month (the much less used but interconnected) mpserver06.flightgear.org had on average 742 MB incoming and 688 MB outgoing traffic per day (i.e. 72 kbit/sec respective 66 kbit/sec on average).

In September 2009, mpserver 05 had a massive peak bandwidth of 1.0 MB/sec. Average bandwidth consumed was about 9 GB of bandwidth per day. The average bandwidth usage per day is climbing due to more users moving from 02 to 05.

In July 2013, mpserver01 load was reported averaging at 10 MBit/sec

Reducing bandwidth requirements

Total network traffic is mainly determined by the number of active clients that 'see eachother' and configured mirrors. If traffic considerations are relevant, the following options exist to reduce overall server/network load:

  • configure a relatively low "server.out_of_reach" value, so that clients outside a certain range are not provided with updates (usually about 100 nm on the main server network)
  • for virtual gatherings (i.e. fly-ins), have clients use airports and places that do not have lots of other traffic (i.e. in other words, avoid places like standard airports such as KSFO)
  • avoid the use of unnecessary relay servers
  • if you are not interested in your server being publicly available, only share its address with your friends privately
  • for local testing/development purposes, you may want to run only a private fgms session, that may be specific to your LAN or even computer.

Getting & Building fgms

  • You will need the build tools cmake and make, and also g++ to compile the fgms application. These can usually be found in the package manager for most the common Linux distributions. You will also need the git client to fetch the source code from the repository, if you plan to download it from the command line interface (see below).
  • Once the build tools are installed on your machine, create a directory to hold the source code. This could be named anything, such as fgms. Create it in your user home directory. Note that this WILL NOT be the directory where the program will be compiled.
  • Now 'cd' into the directory you just made, where you will run the command to fetch the source code from the git repository (see below).
  • To download the latest stable version via HTTP, you can use direct your browse to the URL http://gitorious.org/fgms/fgms-0-x/. Download and unzip the source code, and place it in the directory you created above.
  • To download a file directly to your server from an ssh session, you can use git tools with the following command:
$git clone git://gitorious.org/fgms/fgms-0-x.git

Compiling FGMS

For FreeBSD-specific instructions, please see Howto:Set up a multiplayer server on FreeBSD

NOTE: In general, on any current machine this process should not take longer than about 60 seconds.

  • Once you have the source code, 'cd' into the ~/fgms/fgms-0-x/ directory and note the presence of the CMakeLists.txt file and the README.cmake file. Open the README.cmake file and take a minute to read it over. Also, note the path to the CMakeLists.txt file, as you will need this in the following steps.
  • Now create a build-fgms directory in your home directory, and 'cd' into it. From inside the ~/build-fgms/ directory, run the cmake command using the path to the CMakeLists.txt as an argument. For example: cmake /home/<user_name>/fgms/fgms-0-x/
  • Once the build finishes, you can either run the "cmake --build ..." command as shown in the README.cmake file, or you can simply use "make" to build the program.
  • Once the compilation process finishes, you need to install the program using "make install" (as user), or you can also install as root.
  • Once the program has been installed, you need to copy the fgms_example.conf file from the /fgms/fgms-0-x/src/server directory, into the build-fgms directory. To do this from inside the /fgms/fgms-0-x/src/server directory, you can use this command: cp ./fgms_example.conf ~/build-fgms/
  • Now 'cd' into the build-fgms directory, and rename the file you just copied as "fgms.conf" so that fgms can find the proper configuration.

Setting up the config file

At this point you should have a working 'fgms' binary in the build-fgms directory. If the server will be offline or for private use (i.e. LAN-only, please comment out the relay servers section. This will save bandwidth from the server being consumed.

  • Edit the fgms.conf file according to the instructions found elsewhere on this page, then save and close the file.
Cquote1.png As long as you are not absolutly sure what you are doing you should:

- disable tracking

- disable HUB setting[1]
— Oliver Schröder
Cquote2.png


Cquote1.png fgms will ignore traffic comming from unknown relays and since the multiplayer network is a star topology you should list only mpserver01

as your only relay. Currently mpserver01 is the only HUB, Although multiple HUBs should work I have not tested a multi HUB environment yet.

And for those interrested: Current traffic load on mpserver01 is around 10 MBit/s[2]
— Oliver Schröder
Cquote2.png
Cquote1.png your fgms.conf should look like:
# basic setting
server.name = mpserver02
server.port = 5000

# you can telnet to this port with this username/password
# and see statistics (nice cisco like CLI)
server.admin_port = 6002
server.admin_user = fred
server.admin_pass = fred

server.admin_enable = fred

# mpserver01 does this
server.tracked = false

# mpserver01 is hub
server.is_hub = false
[3]
— Oliver Schröder
Cquote2.png
Cquote1.png
# don't set this too high
server.out_of_reach = 100

# your only relay should be mpserver01
relay.host = mpserver01.flightgear.org
relay.port = 5000

# you don't need a crossfeed, it's only interresting for fgms-developers
# crossfeed.host = foo.example.com
# crossfeed.port = 5002

# you can add static entries of IPs which get blocked,
# but it's generally not needed and you can add them via
# the admin CLI
# blacklist = 123.123.123.123
[4]
— Oliver Schröder
Cquote2.png

Running FGMS for the first time

In addition to its configuration file, FGMS supports a number of configuration parameters that can be passed at startup (and that will by default override any configuration file settings), to get a summary of supported parameters, you may want to run:

$ ./fgms --help

Which should present you with the following output:

options are:
-h            print this help screen
-a PORT       listen to PORT for telnet
-c config     read 'config' as configuration file
-p PORT       listen to PORT
-t TTL        Time a client is active while not sending packets
-o OOR        nautical miles two players must be apart to be out of reach
-l LOGFILE    Log to LOGFILE
-v LEVEL      verbosity (loglevel) in range 1 (few) and 5 (much)
-d            do _not_ run as a daemon (stay in foreground)
-D            do run as a daemon

the default is to run as a daemon, which can be overridden in the
config file.
commandline parameters always override config file options

After having finished the fgms configuration, you can try running fgms and start up fgfs to use the new server.

Public Server

If you'd like to make it a public server, you can simply use your external (public) IP address to set up the multiplayer in fgfs.

For others to know about your public server you should notify the developers of the existence of your server by posting a message to the developers mailing list.

Add your server to this list: http://wiki.flightgear.org/Howto:Multiplayer#Servers

Related content

  1. Oliver Schröder (Wed, 10 Jul 2013 13:53:55 -0700). Re: [Flightgear-devel] New FlightGear Multiplayer Server.
  2. Oliver Schröder (Wed, 10 Jul 2013 13:53:55 -0700). Re: [Flightgear-devel] New FlightGear Multiplayer Server.
  3. Oliver Schröder (Wed, 10 Jul 2013 13:53:55 -0700). Re: [Flightgear-devel] New FlightGear Multiplayer Server.
  4. Oliver Schröder (Wed, 10 Jul 2013 13:53:55 -0700). Re: [Flightgear-devel] New FlightGear Multiplayer Server.