# Server

### From Q4MAX

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

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

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

### 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://www.someurlhere.com/paks/"
    set net_serverDlTable "q4base/map_l4dm1.pk4;q4max/q4max073.pk4;q4max/q4max073l.pk4;q4max/q4max073w.pk4"

Then make sure that the following links are valid:

http://www.someurlhere.com/paks/q4max/q4max073.pk4 http://www.someurlhere.com/paks/q4max/q4max073w.pk4 http://www.someurlhere.com/paks/q4max/q4max073l.pk4 http://www.someurlhere.com/paks/q4base/map_l4dm1.pk4

(and any other maps you have also in the q4base dir on the server)

Note that in q4max 0.73 you cannot place a * in the net_serverDlTable cvar to signify that you want all pk4s to be downloadable.

Also note that at present there appears to be a bug with some linux servers which causes the downloads to fail as the filepaths requested are missing the first character (eg "4base/map_l4dm1.pk4" instead of "q4base/map_l4dm1.pk4"). It is believed this relates to the fs_basepath variable. Ensure that this does not have a trailing slash, or remove setting this variable and cd to the appropriate directory before launching the server.

If this workaround does not work for you, then we 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 as well as a sample client config.

    //===================================================
    // 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!
    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...
    // Note, the more of these info sets you include, the more data is pulled on every server browse.  Crop them if you dont want them.

    //=================
    // 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 if clients require a password.

    //=================
    // VOTING
    //=================
    // There are alot 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.  Not recommended.
    seta vote_limit 3         // 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
    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_kick "1"
    seta vote_allow_instagib "1"
    seta vote_allow_gametype "1"
    seta vote_allow_footsteps "1"
    seta vote_allow_falldamage "1"
    seta vote_allow_dropweapons "1"
    seta vote_allow_droppowerups "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
    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" // Enable scores in server info
    seta sv_logXMLStats "0" // Enable XML dumps of the match stats

    //=================
    // 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_serverAllowServerMod "1" //allow server-side mods
    sets net_serverSnapshotDelay "30" //delay between snapshots in milliseconds, default is 80 - using sets instead of seta to allow
    clients to see if you've changed it
    seta net_serverMaxClientRate "25600" //max rate to clients in bytes/sec
    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

    //========
    // 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 ""
    // 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
    heartbeat // Comment this out if running a LAN only server (net_LANserver "1")

    //===================================================
    // Q4Max Template V0.1
    // swelt, with thanks to sLater.
    //
    //END OF FILE