Server

From Q4MAX

Contents

Installing a Dedicated Server

A full install of Quake 4 is required in order to run a dedicated server. Make sure the server's Quake 4 install has the following pk4s, and that the checksums are correct.

quake4/q4base contents

media

Quake 4 checksum MD5 checksum filename
0xf2cbc998b201b914167f47061fa5f975af527122 pak001.pk4
0x7f8d80d1dabe2c88e004198947431250e3f4ca1d pak002.pk4
0x1b57b2078573f05af4c9568880cc464d06292079pak003.pk4
0x385aa57812ff4006a7f7181ac16835d05c59905fpak004.pk4
0x60d50a1d3576213f4e00f06baf3cd5de089a538apak005.pk4
0x9099ed11aec7bb418b9a86256f9e5daee894dee2pak006.pk4
0xaf301fff0f53b4fb4df2c14fcd10012baf8b2f87pak007.pk4
0x4ac6f6d9b099d75869f0ffcbcb8e5166374af345pak008.pk4
0x36030c7dcb2b44bf573559dc19b488d9e1e5bec3pak009.pk4
0x4b80fbdad024073349dc917b4feab49e6abc417bpak010.pk4
0x8acf4cfa98c854d94ce1da5272952b77821823dfpak011.pk4
0xbe4120b0e77a2fda6656495d38773e05bbffda33pak012.pk4
0x6ad67f40c1383eeb82a7d303b27d3884180ffd22pak013.pk4
0xee51cd59e2ec0b8ce4c460bf196ef61280ae20e0pak014.pk4
0xf5bf4e0c1c74cadf76ea4567edc75af6fc6a4fcbpak015.pk4
0x2196f58c3f005b0703c7b8f7c77627d2f091dd9epak016.pk4
0x91118a35909d24e331efc8b40e818af02faebf4cpak017.pk4
0x98a14f0315af0fb2c33b0743edc0ff11199fffb0pak018.pk4
0xbc82ac795865f9172801fee0c48b7a83d17b29capak019.pk4
0xce74cda5482565b7860b81e21d586bcb117d0affpak020.pk4
0x2ba6e70c615306b72e71f2ed9224b3f16183795cpak021.pk4
0x4e390eecb4692f9e82390ea39750749e18f3fa09pak022.pk4
0xd081394379d90c4564d043036b0e3831d158ea7dq4cmp_pak001.pk4

note : the German version of Q4 uses a different set of assets and has different pak001-0012 files. id's Quake 4 GNU/Linux FAQ

language files

Quake 4 checksum MD5 checksum filename
0x5868f530669d6d9a30b798d19434972475b98c53zpak_english.pk4
0xd9f04b8b609d085ed8bbd8db1e3b52a06818a745zpak_english_01.pk4
0x9dbd91fda4d6207c12ce47f1effc60d7fe8b5b9dzpak_english_02.pk4
0x2eb6ad89d13ed76b9db99175381a83b6d46a929zpak_english_03.pk4
0xac1d3432a538f278423514e74261f1a78282f603zpak_english_04.pk4

You need all paks for one language only. We recommend you stick to the english zpaks + sys_lang english. Many strings come localized from the server such as vote strings or chat tokens, so things could become confusing for many people.

quake4/q4max contents

Quake 4 checksum MD5 checksum filename
0x422cf46bbd75454d5f0a01b619a0205bfde71d93zz-q4max-game-082.pk4
0x84855b3b3dce44a89fa84616227abae5be386efdzz-q4max-media-082.pk4

If some of the pak001-022 or Q4Max files are missing or return different checksums, it is likely that something will not work properly. In this case you should obviously replace the faulty files with valid copies.

Configuring Your Q4Max Server

As a server admin, you have a number of options. The easiest way to set things up is with a config file that contains all the settings you'd like to change. Provided below is a commented sample server.cfg which has most settings which you will need to change, as well as a number of the options available to you.
Be sure to check the server variables reference for more information on Q4Max specific server settings.

One of the most important sections of the server.cfg is the modes section. It's here that you choose what "type" of server you want to run. Setting si_mode determines what gameplay mode the server will default to on startup. So for a clan arena server, you'd set si_mode "CA".

The si_modes setting determines what modes are available on the server. Leaving the default of "" allows any modes to be selected. If you only wanted your server to be used for clan arena, you'd set si_modes "CA". For multiple modes, add a space seperated list: si_modes "CA TDM CTF".

For more details about modes, and how to configure custom modes, see the Modes page.

Referee list

Since version 0.71 you can setup automatic referee privileges on your server.

Create a file called "reflist.txt" in your server's Q4MAX directory and put the GUIDs of your admins/clanmates/etc in it. The GUID used are the 11 characters returned by com_guid on each player's machine, which are also used by Raven's built-in friends system.

You can get someone's guid ingame with the players console command.

Note that if the guid contains non-alphanumeric characters like / then you will need to place the guid in quotes.

For example, a q4max/reflist.txt such as this one will automatically referee AnthonyJ whenever he joins your server.

// reflist.txt may contain comments prefixed with two slashes

// AnthonyJ
mJDZJQH0WA8

Auto Download

From an external server

To configure Quake 4 to automatically download the mod and maps that are on your server, you need to place the files on a webserver. The directory structure of this should match the structure of your quake4 directories - ie, it should have a q4base/ directory with any custom maps in it, and a q4max/ directory with the q4max pk4s.

To enable autodownload from an external server, use the following configuration parameters:

set net_serverDownload "2"
set net_serverDlBaseURL "http://my.q4.repository.com"
set net_serverDlTable "*" 

The URL referenced in net_serverDLBaseURL should point to the directory which contains the q4base/ and q4max/ directories that you created, each of which contain the same pk4's as on your game server. For example, with the above settings, the following links should be valid:

http://my.q4.repository.com/q4max/zz-q4max-game-081.pk4
http://my.q4.repository.com/q4max/zz-q4max-media-081.pk4

Do not forget to check that any other maps you have also in the q4base dir on the server.

Note that when q4 adds the filenames of the pk4's, they will be translated to lowercase. Therefore, if your webserver is case sensitive, then you must ensure that all the files are lowercase on the webserver.

If you dont put a * in net_serverdltable, you must list every pk4 installed that is available for download (including directory prefix) i.e:

 net_serverdltable "q4max/zz-q4max-game-081.pk4;q4max/zz-q4max-media-081.pk4;q4base/map_tmp02.pk4"

We would strongly recommend against doing this, as it would be easy to miss a pk4 from this list, and it is unnecessary.

Having configured autodownload, we would recommend removing all custom pk4's from your client, and attempting to connect to test the download of all files. This will verify that it is all configured correctly. If you get an error message, check the console, as a more detailed error message is given (eg the URL that is tried, and returned 404 etc)

If for whatever reason you cannot use auto-download, then we suggest you at least use HTTP redirection.

From the built-in http server

Warning : using the built-in http server can crash your server.

To enable autodownload from Quake 4's built-in HTTP server, use the following configuration parameters:

set net_serverDownload 3
set net_serverDlBaseURL ""
set net_serverDlTable "*"

You may also want to alter these variables:

  • net_httpServerPort

TCP port to start the built-in HTTP server on

  • net_httpServerGlobalBW

Global bandwidth limit in kilobytes/second
0 disables the limit.

  • net_httpServerPlayerBW

Per-download bandwidth limit in kilobytes/second
0 disables the limit.

HTTP Redirection

If you cannot configure a webserver to host the files that are on your server to make them available via Auto Download, you can use HTTP Redirection, which will instead open a web-page on which you can list the files that the player needs. do this by configuring the following parameters:

seta net_serverDownload "1"
seta si_serverURL "http://www.q4max.com/wiki/index.php/FAQ"

If you have a web page with a list of links to current content, change the si_serverURL variable to point there. If you don't have that facility, feel free to direct them to our FAQ page which includes a list of the most common addon maps (but beware of adding anything not on that list).

Referrals

You can track access to the HTTP file resource (http downloads 2 and 3) by Referer with whatever administrative tool you would normally use for this job. Auto-download requests come in with an HTTP Referer showing the server's external ip:port the clients were connecting to.

For example, our public server's logs would show the following referers :

  • 78.143.19.101:28004 for downloads triggered by players,
  • 78.143.19.101:28104 for downloads triggered by Q4TV viewers.

Statistics

If you wish to produce statistics of the games played on your server, you can use MAXstats, a php based parser which generates webpages showing summaries of the games. Tools / webpage scripters are free to create their own parsers of the XML data we produce (let us know if you do). A sample of what the statistics may look like can be found here. To enable server-side generation of XML you need to enable the cvar sv_logXMLStats.

Sample Server Config

You can find this config in q4max/cfg/example-server.cfg . The most recent version may also be downloaded from here.

//===================================================
// Template Server Config
//===================================================

//=================
// IDENTIFICATION
//=================
seta si_name "Q4Max Server" // Your server name, as it appears in game browsers
seta g_motd "Message of the Day" // change this!
// Note, the more of the following info sets you include, the more data is pulled on every server browse.  Crop them if you dont want them
sets ".Administrator" "admin"  //It's you!
sets ".Email" "admin@whatever.com"  //change this!
sets ".URL" "http://somewebsite.com" //change this!
//Good idea to list all the maps needed on your server on the website too...


//=================
// PASSWORDS
//=================
seta net_serverRemoteConsolePassword ""   // rcon password. Powerful, only for server admins
seta ref_password ""   // Referee password.
seta si_usePass "0"   // Set to 1 if clients require a password.
seta g_password ""   // client password required if si_usePass 1
seta si_privatePlayers "0" //number of private player slots. public slots = maxplayers - privateplayers
seta g_privatePassword "" //password required to use private slots.

//=================
// VOTING
//=================

// There are a lot of controls for voting.  Some server admins may want to enable everything and let
// the users decide.  Others may want to enforce a strict set of rules.
// Q4max aims to make these decisions easy for server admins to implement.

// First off, basic rules for voting
seta si_allowVoting "1"         // Blanket ban on voting if 0.  Not recommended.
seta vote_limit "5"         // Number of votes a client can do.  0 is unlimited.
seta vote_percent "51"         // Percentage of positives required.  Recommend 51.  Higher can seem like a good idea, but normally ends up with one trouble maker screwing it up for everyone else.

// Then some important vote decisions
seta vote_allow_referee "1"      // If you don't want elected refs, set to 0. 1 makes life easier for Clanbase and similar internet competitions.
seta vote_allow_map "1"         // Recommend always allow map voting, unless you enforce a map cycle.

// Then the rest of the vote decisions - see the Votes doc page for more
seta vote_allow_xgosounds "1"
seta vote_allow_weaponrespawn "1"
seta vote_allow_warmup "1"
seta vote_allow_timelimit "1"
seta vote_allow_teamdamage "1"
seta vote_allow_selfdamage "1"
seta vote_allow_scorelimit "1"
seta vote_allow_restart "1"
seta vote_allow_remove "1"
seta vote_allow_random "1"
seta vote_allow_poweruprespawn "1"
seta vote_allow_overtime "1"
seta vote_allow_nextmap "1"
seta vote_allow_mutespecs "1"
seta vote_allow_modelsounds "1"
seta vote_allow_kick "1"
seta vote_allow_footsteps "1"
seta vote_allow_falldamage "1"
seta vote_allow_dropweapons "1"
seta vote_allow_droppowerups "1"
seta vote_allow_buymode "1"
seta vote_allow_autobalance "1"
seta vote_allow_armorsystem "1"
seta vote_allow_armordecay "1"


//=================
// GENERAL SETTINGS
//=================

seta sv_punkbuster "0" //server side punkbuster
seta si_pure "1" //server does not allow any modified paks. Leave this at 1
seta si_warmup "1" //do warmup
seta si_useready "1" //don't start a game unless everyone is ready
seta si_minPlayers "2" //min to start a game (when warmup enabled)
seta si_maxPlayers "12" //max players allowed in games
seta si_numPlayers "12" //max players allowed on server
seta si_spectators "1" //allow spectators or force all to play
seta g_spectatorChat "1" //let spectators talk to everyone during game
seta si_autobalance "0" // Autobalancing of teams - 0/1
seta g_feedScorebot "1" // Ensable scores in server info.
seta sv_logXMLStats "0" // Enable XML dumps of the match stats
seta g_allowLockteams "1" // Allow everyone to use lockteam. On 0, only referees can lock/unlock.
seta g_teamAutoJoin "0" // Force clients to spec on first joining a teammgame if 0, or allow automatic join if 1.
seta g_allowMultipov "1" // Enables/disables the 'multipov' command for clients. Server admins should only set this if they have stability issues with multipov
seta g_allowSpecTimers "0" // Enables/disables the item timers for spectator clients.
seta sys_lang "english" // Requires zpak_english pk4s, recommended.

//==============
// MODE SETTINGS
//==============

// This is how Q4max handles different gametypes.  si_gametype is no longer required.

seta si_mode "CA" // This is the default mode.  DM for the tournament mode, FFA, TDM, CTF etc.
seta si_modes "" // This is the list of available modes, space separated. "" for all.


//========
// NETWORK
//========

seta net_lanserver "0" //1 for LAN-only servers, 0 for internet servers.
seta net_serverAllowServerMod "1" //allow server-side mods


//////////
/// WARNING: The following setting can seriously affect performance, especially when combined with higher tickrates.
/// If you are expecting large numbers on the server, you may wish to adjust the settings from those given here.
/// To improve performance, either raise net_serverSnapshotDelay, or lower si_fps in your special modes, or both.
/// We do not currently recommend si_fps 125 combined with a low value of net_serverSnapshotDelay unless the server and all clients are known
/// to be of a high enough spec (eg LAN tournaments), however testing shows that a 90/30 combination provides a good compromise.

seta net_serverSnapshotDelay "30" // delay between snapshots in milliseconds, default is 80.


//==========
// Downloads
//==========


// if you want to use an external HTTP server, use these settings:
set net_serverDownload 2 // enable auto download via an external http server
set net_serverDlBaseURL "http://my.q4.repository.com" // change to your http server's address
set net_serverDlTable "*" // these are the pk4's that can be downloaded. 

// if you want to use the built-in HTTP server (unstable), use these settings:
// set net_serverDownload 3 // enable auto download via built in HTTP server
// set net_serverDlBaseURL ""
// set net_serverDlTable "*" 
// and optionally :
// net_httpServerPort "" // TCP port to start the built-in HTTP server on
// net_httpServerGlobalBW "" // Global bandwidth limit in kilobytes/second, 0 = no limit
// net_httpServerPlayerBW // Per-download bandwidth limit in kilobytes/second, 0 = no limit

// If you want to use URL redirection (why??) use this:
// seta net_serverDownload "1" // enable URL redirection for clients who dont have all necessary files
// seta si_serverURL "http://www.q4max.com/wiki/index.php/FAQ" // change this to a web page with a list of your maps if you have custom content


//=======
// Q4TV
//=======

// These settings will spawn a repeater for Q4TV broadcasting.
// We recommend you stick to a little number of viewers that dedicated repeater slaves (with many viewer slots) will connect to. This will be easier on your server.

set net_spawnRepeater "1" // Spawn the repeater when the server is spawned
setr ri_name "My Q4TV" // Custom name for the repeater, will show instead of the source's si_name
set ri_maxViewers "2" // Maximum number of viewers to allow

// set ri_privateViewers "" // Number of private viewer slots
// set ri_useViewerPass "1" // use viewerPassword (or not)
// set g_viewerPassword "viewerpass" // Password for viewers
// set g_privateViewerPassword "" // Password for private viewer slots. Clients need to set privatePassword to this value when connecting.
// set g_repeaterPassword "repeaterpass" // Password for repeater slaves. These need to set privatePassword to this value when connecting.

// set g_notvchat "0" //Server side control to allow TV spectator chat.
// set net_repeaterPort "" // repeater port. default is 28104.


//========
// LOGGING
//========

seta logFile "0" // 0-no logging 1-buffer log 2-flush after each print - 1 should be fine in most cases
seta logFileName "q4mConsole.log" // name of logfile
seta com_logMPStats "0" // writing of multiplayer stats to StatisticsLog.txt


//===========
// MAPCYCLING
//===========

// For FFA and CTF servers, you may want to build a map cycle.
// if set, g_mapCycle will be preferred to si_mapCycle
// Only set one of these options at a time, i.e, set the unused one to "" instead of commenting it out.
// g_mapCycle takes precedence over si_mapCycle but play it safe with the above rule.
// Likewise, if you want no mapcycle to be used, set the two options to "".

seta g_mapCycle "" //this uses .scriptcfg files
seta si_mapCycle "mp/q4dm7;mp/q4dm3;mp/q4dm2;mp/q4dm5;mp/q4dm4;mp/q4dm1;mp/q4dm8"


//=================
// START THE SERVER
//=================

seta si_map "mp/q4dm7" // Default map.
spawnserver

// Comment "heartbeat" out if running a LAN only server
// (see net_LANserver "1" under NETWORK)
heartbeat


//===================================================
// Q4Max Template 0.80
// Q4Max team, with thanks to sLater.
//
//END OF FILE

Starting a Dedicated Server

  • Windows

Make a shortcut to quake4ded.exe, right-click it and select Properties. In the Properties window, select the Shortcut tab. In the Target field, add command line options after the path and .exe name For example :

Quake4Ded.exe +set fs_game q4max +exec server.cfg
  • Linux
/usr/local/games/quake4/q4ded.x86 +set fs_basepath "/usr/local/games/quake4" +set fs_game q4max +exec server.cfg

Note: Setting fs_basepath is only necessary if you do not start the server from the quake4 root directory. If you do, then you can safely leave this variable at the default. If you do set this variable, ensure that there is no trailing slash, as it is thought that this may cause issues with Auto-download.

Warning: Commandline settings are reapplied on engine reloads. Make sure your commandline is as clean as possible or you may experience problems (having si_map set there being the most obvious one).

Running multiple Dedicated Servers from a Single Host

  • Windows
Quake4Ded.exe +set fs_basepath "C:/Program Files/Quake 4" +set fs_savepath "C:/q4srv1" +set fs_game q4max +exec server.cfg
  • Linux
/usr/local/games/quake4/q4ded.x86 +set fs_basepath "/usr/local/games/quake4" +set fs_savepath "/home/q4srv1" +set fs_game q4max +exec server.cfg


fs_basepath needs to point to your Quake 4 directory. fs_savepath can be chosen freely and should be different for each server, the specified folder will be created on server launch if it does not exist. The server will store log files in the mod's subdirectory there, along with some other files needed for server operation. You can reference different server configs for each session.

Note: make sure you do not have a trailing slash at the end of either fs_savepath or fs_basepath.

Things you can add to the server command line:

+set net_ip "[ip address]" // e.g. "192.168.0.1"

+set net_LANserver "[0 | 1]" // e.g. "1" for a LAN only server, "0" for an internet server

+set net_port "[port number]" // e.g. "28004"


Running a Dedicated Server and a Client on a single machine

Listen servers were not very reliable in Quake 3, but they are worse now in Quake 4. We have decided not to support them for now and recommend you always use dedicated servers instead. Running one and a client on a single machine doesn't have a big performance hit, it will surely eat a little more RAM though.

Your dedicated server command line should have fs_savepath set for it to run alongside a client.

  • Windows
Quake4Ded.exe +set fs_game q4max +set fs_savepath "C:/q4srv1" +exec server.cfg
  • Linux
/usr/local/games/quake4/q4ded.x86 +set fs_basepath "/usr/local/games/quake4" +set fs_game q4max +set fs_savepath "/home/q4srv1" +exec server.cfg

Note: make sure you do not have a trailing slash at the end of either fs_savepath or fs_basepath.

  • Mac OS X

Even if you respect different savepaths for the dedicated server and the client, it appears it is not possible to run them simultaneously. This seems to be a limitation on the mac version of Quake 4, not simply Q4Max.