# Server

### From Q4MAX

## 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 with matching md5 sums :

quake4/q4base

game code

    74116b447201abd973ef226f43c314a1 game000.pk4

    877a84dc170400ee58f5ccafbbb5fc53 game100.pk4

    619e0e916fd079d93162243e1d8c20e6 game200.pk4

media

    b201b914167f47061fa5f975af527122 pak001.pk4

    dabe2c88e004198947431250e3f4ca1d pak002.pk4

    8573f05af4c9568880cc464d06292079 pak003.pk4

    12ff4006a7f7181ac16835d05c59905f pak004.pk4

    3576213f4e00f06baf3cd5de089a538a pak005.pk4

    aec7bb418b9a86256f9e5daee894dee2 pak006.pk4

    0f53b4fb4df2c14fcd10012baf8b2f87 pak007.pk4

    b099d75869f0ffcbcb8e5166374af345 pak008.pk4

    cb2b44bf573559dc19b488d9e1e5bec3 pak009.pk4

    d024073349dc917b4feab49e6abc417b pak010.pk4

    98c854d94ce1da5272952b77821823df pak011.pk4

    e77a2fda6656495d38773e05bbffda33 pak012.pk4

    c1383eeb82a7d303b27d3884180ffd22 pak013.pk4

    e2ec0b8ce4c460bf196ef61280ae20e0 pak014.pk4

    1c74cadf76ea4567edc75af6fc6a4fcb pak015.pk4

    3f005b0703c7b8f7c77627d2f091dd9e pak016.pk4

    909d24e331efc8b40e818af02faebf4c pak017.pk4

    15af0fb2c33b0743edc0ff11199fffb0 pak018.pk4

    5865f9172801fee0c48b7a83d17b29ca pak019.pk4

    482565b7860b81e21d586bcb117d0aff pak020.pk4

language files

    669d6d9a30b798d19434972475b98c53 zpak_english.pk4

    609d085ed8bbd8db1e3b52a06818a745 zpak_english_01.pk4

    a4d6207c12ce47f1effc60d7fe8b5b9d zpak_english_02.pk4

    9d13ed76b9db99175381a83b6d46a929 zpak_english_03.pk4

    2cabddd692e214c78c20a464da43f1ef zpak_french.pk4

    5eb83cae50559e8ada7ead26b1ba2a88 zpak_french_01.pk4

    9b6bcb78e9733d6afa56133d453d0152 zpak_french_02.pk4

    3fbea36af6316859b44d00516a37ef81 zpak_french_03.pk4

    4ee7eb637cde6bcfe3a9ffac5e4579dd zpak_italian.pk4

    0067eb7b6236011d36319176d838fde8 zpak_italian_01.pk4

    0dc4bdd35cdfaf201aea93af541586a3 zpak_italian_02.pk4

    923a72b912b3c1490f52bf9dc34f8316 zpak_italian_03.pk4

    36eee38e6c2dce12986f7192a5a996e5 zpak_spanish.pk4

    5fa204bb992f3e2e81b6a26835955a8e zpak_spanish_01.pk4

    1c90da720b88192e0c07324ddd940ac6 zpak_spanish_02.pk4

    4d198b6e352eaf3f6a088d62816f43ff zpak_spanish_03.pk4

note : the German version of Q4 uses a different set of assets and has different pak001-0012 files.

quake4/q4max

    ad1272104ea659fa19639c8b327ae4c9 zz-q4max-game-077.pk4

    7598e5c5cd6c64ee814e0049320e8e9b zz-q4max-media-077.pk4

If some of the pak001-020 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.

You do not need all languages. Make sure you have all the files for each language present on the server, though.

## 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.

### 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.

## Configuring Your Q4Max Server

As a server admin, you have a number of options. The easiest way to do this 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 the settings which you will need to change, as well as a number of the options available to you.

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.

### Auto Download

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, use the following configuration parameters:

    set net_serverDownload "2"
    set net_serverDlBaseURL "http://q4files.escapedturkey.net/quake4/pk4s/"
    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://q4files.escapedturkey.net/quake4/pk4s/q4max/zz-q4max-game-077.pk4 http://q4files.escapedturkey.net/quake4/pk4s/q4max/zz-q4max-media-077.pk4

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

The links given in the above example are valid and free for general use. You are encouraged to upload any custom maps into the q4base directory that are not already uploaded. If you chose to use a different net_serverDlBaseURL, then check links in a similar structure on your server are valid.

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-077.pk4;q4max/zz-q4max-media-077.pk4;q4base/map_swq4dm1_final.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 at least suggest you use HTTP redirection.

### 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).

### Statistics

If you wish to produce statistics of the games played on your server, you can use q4maxXML, 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 g_password ""   // client password.  Also requires si_usePass to be set.
    seta si_usePass "0"   // Set to 1 if clients require a password.

    //=================
    // 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 "1" //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_privatePlayers "0" //number of private player slots. public slots = maxplayers - privateplayers
    seta g_privatePassword "" ///password required to use private slots.
    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" // Enable 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

    //==============
    // 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
    seta net_serverSnapshotDelay "50" // delay between snapshots in milliseconds, default is 80.
    ///Don't go too low, as processing snapshots may hurt client performance: 30ms snaps may be too much for low-end machines.

    // URL redirect - if you want to redirect
    //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

    // ingame HTTP download
    set net_serverDownload "2"		// enable HTTP download
    set net_serverDLTable "*"		// make all files available for download
    set net_serverDlBaseURL "http://q4files.escapedturkey.net/quake4/pk4s/"	// download from files.quake4world.com - upload any maps that they don't have online.

    //==============
    // MASTERSERVERS
    //==============

    seta sv_master1 "q4master.idsoftware.com"
    seta sv_master2 "master3.idsoftware.com"
    seta sv_master3 "master0.gamespy.com"

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

    seta g_log "0" //enables game logging, recommend 1
    seta logFile "0" // 1=buffer log 2=flush after each print
    seta logFileName "stats.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.
    seta g_mapCycle ""
    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.77
    // swelt, with thanks to sLater.
    //
    //END OF FILE