Game server configuration allows a server adminstrator to provide varying and customized experiences. There are numerous settings and console variables (cvars) for Xonotic, however they can be searched in-game using apropos, or out of game using cacs. There are two types of servers: listen and dedicated. Listen servers are spawned by a game client and are available only for the host's playing session. Dedicated servers are intended to be persistently available.
Starting a Dedicated Server Edit
The files needed to set up a Xonotic server come with the game, from the main game directory inside /server/. This section assumes network configuration such as port forwarding have already been done.
- Copy the shell script or batch file corresponding to the operating system the server will be running on, from /server/ into the main game directory.
- This is so the shell script can launch the game executable in the server mode.
- Copy server.cfg to the user profile for Xonotic.
- Linux: ~/.xonotic/data
- Mac: ~/Library/Application Support/xonotic/data
- Windows: %USERPROFILE%\Saved Games\xonotic\data
- Note: do not copy to the additional folder named data, within data.
- Deploy the server by executing the shell script.
Much like config.cfg stores player preferences as a list of commands to execute on launch, server.cfg stores server settings.
Starting a Listen Server Edit
- At the main menu, select Multiplayer.
- Select the tab 'Create'.
- Select desired options.
- Click Start.
Listen servers can be configured to the same degree as dedicated servers. Listen servers get their settings from config.cfg or the state of the client's console. However, since the game writes to config.cfg e.g in the event the user changes preferences, it is unideal to store server settings in config.cfg. Server settings can instead be stored in autoexec.cfg, the file that is automatically executed when the game client is launched and will not be managed by the game.
Configuring an Already Online Server Edit
Xonotic servers do not need to be restarted for changes to take effect. Instead, they may be configured on-the spot by the server administrator by the console command rcon. In order to set up rcon, within server.cfg, rcon_password must be set. From a game client, the server administrator may log in typing the following into the developer console (~).
Update Server Configuration Edit
rcon exec server.cfg // updates the server's configuration by re-executing the .cfg
Replace server.cfg with the file containing your server configuration file if you are using a different file.
Update Server Packages Edit
rcon fs_rescan // updates the server's files e.g adding a new map or server package
In general, rcon is used to execute commands or change settings remotely, which allows server administrator to make small changes without editing a file.
Note: Listen servers do not use rcon, hence commands for listen servers are as is, as opposed to being prefixed with rcon and requiring an rcon_password set.
Enabling Custom Maps Edit
In order to host unofficial maps, the server needs the custom map itself and a file host to provide the download service to clients that do not already have the map file. Xonotic identifies maps by file name; additionally it only concatenates a base url and the file name as the download url to send to clients. Thus the file host must not change the file names.
Relevant Cvars Edit
The following sets the default url to serve to clients to the one specified in url. Be careful not to include a space at the end of the url.
The following is relevant to updating the map list. Note, fs_rescan must have been executed beforehand so the server has the file to begin with. One may manually add the map name to the list (exclude the file extension), or submit an empty string to include all possible maps.
g_maplist "" // include all possible maps in the maplist
The following sets the number of vote options on the map voting menu that appears at the conclusion of a match.
The following enables map shuffling on the map voting menu, and is required in order for the map list to be different per vote menu (as opposed to the first few maps in alphabetical order).
Multiple Download Sources Edit
If there are multiple download sources for the catalog of the server's maps, a plain text file curl_urls.txt may be used to specify which links per map are sent to clients. This text file belongs in the user profile for xonotic. The following describes the format per line.
In above example, any map with a name matching the wildcard pattern i.e cts_mappername_mapname1, cts_mappername_mapname2, and so forth, will direct to http://dl.xonotic.co/ for download. Other pattern matches will direct to the respective url.
Note: the server will only send one download link to the clients. It will not, for example, send the url associated with sv_curl_defaulturl, then resend another link within curl_urls.txt if the file is unavailable at the former.
Advanced Options Edit
The following are cvars that may be added to server.cfg or executed through rcon.
Custom Vote Options Edit
These grant players the ability to change server settings depending on consensus.
- Alias a mnemonic for the cvar(s) that will be executed on the event a vote passes.
- Add the vote to the list of vote commands.
For example, a vote to set the match to 1v1.
alias duel "settemp g_maxplayers 2" // restrict to 2 players for current match only
alias noduel "g_maxplayers 0" // lift player restriction
addvote duel noduel // multiple options can be added within one line
Per-Game Type Settings Edit
These allow a server to vary in settings per game type by executing when the game mode is selected on the game type options menu.
The following is executed first unconditionally before all else. It is useful for resetting the server to a default state from which all other modes modify from.
Note: executing default*.cfg's will also execute defaultXonotic.cfg and may reset options set in server.cfg.
alias sv_vote_gametype_hook_all "<cvars>"
alias sv_vote_gametype_hook_cts "exec defaultXDF.cfg"
The template server.cfg provides a list of possible values for game types by default. Excerpt provided below.
// GAME MODE: what type of server do you want to host? // possible values: dm (deathmatch), tdm (team deathmatch), dom (domination), ctf (ctf), ft (freeze tag), lms (last man standing), ka (keepaway), inv (invasion), kh (keyhunt), as (assault), ons (onslaught), rc (race), nb (nexball)