Skip to content

Latest commit

 

History

History
227 lines (208 loc) · 69.6 KB

CHANGES.md

File metadata and controls

227 lines (208 loc) · 69.6 KB

Changes in OpenCoD2-Plus Server

Everything this fork adds to voron00/CoD2rev_Server, in detail: the functions, variables and fixes behind each milestone that the README summarizes. The script functions marked as coming from zk_libcod keep its names and arguments, so scripts written for it run here.

Building and running

  • Releases: ready-to-run archives for Linux and Windows, from v1.0.0-rc1, on the Releases page.

  • Windows build with MinGW (32-bit), cross-compiled from Linux or built on Windows itself from cmd with MSYS2's MinGW-w64; GitHub Actions checks both.

  • Game version selectable at build time: the server can be built as 1.0 or as 1.3.

  • Hardened builds: the stack protector, _FORTIFY_SOURCE checks and, on Linux, read-only relocations are on, so many buffer overflows stop the server instead of being exploitable. -fno-strict-aliasing and -fwrapv keep the reversed code, which casts between types and relies on signed overflow wrapping, correct at higher optimization levels.

  • Linux 64-bit by default: make builds a 64-bit server that needs no 32-bit packages (gcc-multilib), and make ARCH=x86 the 32-bit one; it works as the 32-bit one, which stays the default. GitHub Actions publishes both.

  • CoD2 1.3 Plus as a build: make PLUS=1 builds the server for the CoD2 1.3 Plus client; every other build is unchanged and takes stock clients. GitHub Actions publishes it as cod2rev_lnxded-1.3-plus.

  • Trajectories and view bob in float, as 1.3: grenades, movers and the gravity of every entity with a trajectory, and the view bob that places a player's eye, were computed partly in double, in another order than the 1.3 client that predicts them; they now follow its float math. So do the hip spread added in the air, the side move on ladders, the damage kick, the radius damage box, the angle of a missile's landing, the weapon position's speed cap and the compass angle of teammates, whose constants were doubles where 1.3 loads floats; also the movement's damage timer, the speed while stunned and the animation lengths, which truncate a product to whole milliseconds.

  • Float math on SSE2: every x86 build computed with x87 at 80 bits, while the 1.3 client sets x87 to 24 bits and predicts movement with it; results also changed with how the compiler kept values in registers. The server now computes with SSE2, which rounds each float operation as the client does. 32-bit builds need an SSE2 processor (Pentium 4 or later).

  • Experimental arm64 build: make ARCH=arm64 on a 64-bit ARM host (a Raspberry Pi 3, 4 or 5 with a 64-bit system) builds a native server. It is experimental until a full match with several players has run on it.

  • Simpler builds: make builds the Linux binary directly, make windows cross-compiles for Windows, and GitHub Actions builds every variant on each push.

  • Example server.cfg: scripts/server.cfg.example lists every variable the server registers; scripts/gen_server_cfg.py regenerates it from the source.

  • Launchers: scripts/windows/iniciar_cod2rev.bat and scripts/linux/iniciar_cod2rev.sh, with a LAN mode and an internet mode. Both use port 28960, and they set logfile 2 (and sv_cracked 1 in LAN mode only) before +exec server.cfg, so server.cfg can change them; another config can take its place (CFG=plus.cfg on Linux, a second argument such as iniciar_cod2rev.bat internet 20hz.cfg on Windows); they used to set them after it, overriding the admin's config, and turned on sv_cracked in internet mode too.

  • Script errors don't flood the log (make PLUS=1): outside developer mode a runtime error does not end the script thread, as in the original game, so a broken mod repeats the same error every frame, and with logErrors 1 the console log got one block per frame. A Plus server prints the first one and then a line with how many times it happened, every 10 s, and the count left when the error stops; the scripts run as before.

  • Ready config for a Plus server: scripts/plus.cfg runs your server.cfg and then sets what a 60 Hz CoD2 1.3 Plus server with its own downloads needs (sv_fps 60, sv_allowDownload 1, sv_wwwDownload 1, sv_wwwBaseURL auto), with the router and firewall ports in its header. CFG=plus.cfg ./iniciar_cod2rev.sh internet or systemctl enable --now cod2rev@plus start it.

  • systemd unit: scripts/linux/cod2rev@.service runs one server per instance (cod2rev@public execs public.cfg) with its own fs_homepath in /var/lib/cod2rev/<instance>, as an unprivileged user, with net_strictPort 1, a restart after a crash and a clean stop with SIGTERM. The port, dedicated and the map can be set per instance in /etc/cod2rev/<instance>.env.

  • One server for 1.0 and 1.3: the 1.0 build already plays with 1.3 clients, and net_altPort opens a second port that announces 1.3, with its own heartbeats, so the same game appears in the server lists of both versions. Real 1.0 and 1.3 clients played one match, kills both ways. Run it on the 1.0 game files: without iw_15.iwd, whose scripts and menus 1.0 clients lack.

Security and stability

  • Traces into models at the map start: the skeleton memory for animated models was set up by the first server frame, so on the first map after startup a bulletTrace from a gametype's main or CodeCallback_StartGameType that reached a script model crashed the server (zPAM Plus re on mp_toujane_fix and mp_burgundy). It is now set up before the game starts.

  • Compressed messages bounded: the server Huffman-codes each message to a client into a stack buffer of the largest message size, but a rare byte takes up to 11 bits, so a message full of them (chat text, for one) grew past the buffer on 1.3; on 1.0 the buffer is 16 KB for snapshots of up to 128 KB. Compression now stops at the buffer's end and the client is dropped with EXE_SERVERMESSAGEOVERFLOW.

  • manymaps map names checked: the map name built the paths of the link manymaps creates, so map ../x (from rcon, or a mod passing player text to map) linked an .iwd from outside the library to outside the game folder. Names with /, \ or : are no longer looked up in the library.

  • Over-long query challenges ignored: a getinfo or getstatus whose challenge filled the info string made every later key fail and print the whole string, about 16 KB of console and log per request. As in ioquake3, a challenge over 128 characters gets no reply.

  • Rate limiter reports throttled: each request the limiter dropped started a script thread (CodeCallback_CLSpam, or CodeCallback_DPrintf through the debug print), so a flood from forged addresses turned into script work. At most 10 drops a second are reported now.

  • Rate limiter table keyed: addresses were spread over the table's 1024 chains by a fixed sum of their bytes, so forged packets from chosen addresses could fill one chain and make every lookup walk it. The spread now uses a random seed chosen at startup.

  • Download acks checked: nextdl for the block the client was on moved the window even when that block had never been read, so a burst of them made the next frame read many blocks at once. Only blocks already read can be acknowledged.

  • Client commands per message capped: flood protection only kept commands from the game, so one message carrying hundreds of userinfo, cp or vdr commands ran them all in one frame and lagged everybody. A message now runs at most 64 new commands; the client sends the rest again in its next packets. cp with more checksums than the server has iwds is refused before its duplicate check, which cost the square of their number.

  • Authorize replies after the connect: a reply to a challenge whose client had already connected still set the GUID a reconnect with that challenge takes, and one for challenge 0 matched an empty slot; both are ignored now. Replies are only checked by their source IP, so GUIDs should not grant admin rights.

  • Client address kept from others behind its IP: a packet with a client's qport moved the client's address to its sender before the netchan checked it, and voice did it with no check at all, so anyone behind the same IP (a NAT, a CGNAT) who guessed the 16-bit qport could talk as the client or, with a huge sequence number, make every later packet of the client look old until it timed out. A changed port is now taken only from a packet that continues the client's sequence (at most 1024 ahead), and never from voice; a client whose router changes its port keeps playing.

  • Gamestate requests limited: a client that had not entered the game could send donedl as often as it liked, and each one made the server compress and send the whole gamestate, which froze the map for everybody. Requests from a client are now limited to 5 at once and 1 a second per slot; a refused one is sent as soon as the limit allows it, so a client that waits for it does not time out.

  • connect rate limit: each connect clears about 500 KB and can run the gametype's connect code, so a flood with one valid challenge slowed the map for everybody. An address gets 10 attempts, then 1 a second, also on LAN, sharing the count with getchallenge: players behind one NAT who all reconnect at once get in about one a second. 127.0.0.1 has no limit, because a local proxy's players all come from there. CodeCallback_CLSpam receives CONNECT:ADDRESS.

  • iplist.txt behind a local proxy: a proxied client is also checked by the real address the proxy reports, not only by the proxy's own.

  • Joining during a getchallenge flood: made-up addresses used up the global limit, and at 1000 requests a second a player needed 40 seconds to join, at 3000 they could not. A client that asks again now has a limit of its own and joins at its first retry, 3 seconds later.

  • Bans checked on every connect: iplist.txt, the GUID ban list and the temporary kick bans were only read when the authorize server answered, so iplist.txt did not apply with sv_noAuthorize 1, to LAN addresses or after an authorize timeout, and none of them to a client resending its old challenge after a kick. connect now checks them too; on those first three paths the GUID is unknown, so only iplist.txt can refuse.

  • Signed challenges: a challenge is now an HMAC of the player's address under a key drawn at startup, so a player whose challenge a flood of made-up addresses pushed out of the table still joins, a few seconds later. On LAN and with sv_noAuthorize getchallenge takes no slot and has no global limit. sv_challengeStateless 1 does the same on the internet for a server under such a flood: the CD key is checked at connect, and each join waits about 3 seconds more.

  • Menu commands limited: mr (menu responses) skips flood protection so menus keep working, and each one runs the gametype's scripts, so a client could send hundreds a second. A client now gets a burst of 20, then 20 a second.

  • Malformed packets logged at most 10 a second: a bad command byte, a wrong user command count, a bad acknowledge, an invalid mute number or voice packet printed a line each, so one client could flood the console and the log.

  • Chat cannot show the game's messages: a chat line starting with byte 0x14 made the rest a localized string, so a player could show "Vote passed", a kick or any other game message after their name. Only 0x15, the mark the client itself puts at the start of chat, is kept.

  • Server lists during a query flood: getinfo and getstatus shared one limit of 10 replies a second, so a few addresses querying often hid the server from browsers and from the masters, and a flood also stopped the status this server sends the masters on its own. getinfo, whose replies are short, now has 100 a second of its own, getstatus keeps its 10, and the masters skip both global limits.

  • Votes limited per player: 1.3 checks for three votes called but never counted them, so one player could call vote after vote. A player now calls at most three votes a map (with g_oldVoting 1, the default).

  • Joining during a query flood: getchallenge shared a limit of 10 replies a second with getinfo and getstatus, so a few spoofed queries kept players out. It has its own limit of 100 a second now.

  • Rcon lockout after failed attempts: after several wrong passwords, the IP address is ignored by rcon for a while. A correct password resets the counter, and 127.x.x.x addresses and those in sv_rconWhitelist are never locked, so spoofed guesses cannot lock out the admin. The global limit of 10 requests a second runs before the password is compared, because spoofed guesses from a new address each time would otherwise only be limited by bandwidth: during a flood rcon only answers addresses in sv_rconWhitelist and, unless sv_limitLocalRcon is on, local tools. Keep your admin addresses in sv_rconWhitelist.

  • Bounded strings in libcod script functions: the libcod printf and sprintf, the asynchronous SQLite and exec calls and the player rename no longer write past their buffers when a script passes long strings. findConfigStringIndex and findConfigStringIndexOriginal check that the whole range they search exists instead of only its ends, and toUpper no longer returns unterminated text for strings of 1024 characters or more (they are cut to 1023). On Windows, manymaps and file_link create and remove links with the system calls instead of del and mklink commands built from unquoted paths, which broke on spaces and could run other commands.

  • libcod SQLite, exec, JSON and MySQL fixes: an array or struct passed to an async SQLite or exec call is kept until its callback runs, and an async entity query whose entity is deleted meanwhile skips its callback instead of running it on another entity. An exec callback that calls exec_async_checkdone() no longer runs itself again until the server crashes. A failed async SQLite query is printed to the console instead of raising a script error that repeated on every async_sqlite_checkdone and held back all later results. Async queries no longer reserve 4 MB each or stall sqlite_open/sqlite_close while the worker runs, queries longer than 1024 characters are no longer cut, and sqlite_query returns NULL columns as "" so later columns keep their index. json_stringify and json_save turn an array with gaps in its indexes into a JSON object instead of dropping the indexes, and json_save refuses names ending in a dot or a space or containing :, which on Windows could still write a .cfg. mysql_real_connect and mysql_async_initializer no longer crash the server when the connection fails, and binarybuffer_write raises an error for a value of the wrong type.

  • MySQL on 64-bit Linux: make WITH_MYSQL=true builds the MySQL functions against the system's MariaDB or MySQL client library (no 32-bit one exists in today's distributions). A handle of 0 (a failed mysql_real_connect, or mysql_store_result after a statement without rows) passed to another MySQL function raised nothing and crashed the server; it is now a script error. Async queries no longer race with the script reading their results, and mysql_reuse_connection no longer returns a connection after mysql_close. In every build, an int64 value such as a libcod handle can now be compared with and added to an int: handle == 0 gave a type error.

  • Network input hardening: a connected player could crash the server or overwrite its memory with an oversized compressed message, a fragmented message, a name containing % (written to the log by the stock gametypes), callvote clientkick with a negative number or voice packets. These paths are now bounds-checked, and the file handles of interrupted HTTP downloads are closed.

  • libcod proxy address and downloads: the real address that a local proxy passes in the ip userinfo key is only trusted from 127.0.0.1, must be an IPv4 address and is cleared on every connect. A donedl from a player already in the game no longer makes the server resend the whole gamestate. getIP() returns 127.0.0.1 for a local client that came without a proxy; it returned an empty string. status shows that real address, with the proxy's port.

  • Downloads and passwords: the check meant to stop clients from downloading the stock iw_*.iwd files never matched, so any client could fetch them (hundreds of MB each); they and the server-only _svr_ iwds are now refused, also before an HTTP redirect. Downloads no longer get stuck when the map changes during one, a client message too large to decompress drops the client instead of being cut short, and rcon, g_password and sv_privatePassword are compared in constant time.

  • Bans, game log and other fixes found in zk_libcod: addip and g_banIPs kept a list of banned addresses that nothing checked; it is now enforced on connect, also for players behind a local proxy. The last address in g_banIPs is no longer skipped, and a long addip no longer overflows the stack. Line breaks in chat messages and player names could write fake lines into games_mp.log and split getstatus replies; they are now removed. A wrong rcon password no longer holds up the right one, a userinfo no longer swallows the next chat message, and holding the grenade button without grenades no longer hides the player's shots and footsteps from the others. The effect entities of grenade explosions are now freed instead of piling up until the map ends, a script that deletes a turret in use no longer ends the map, and a long map name passed to a script function no longer stops the server.

  • Map names, format strings and script values: map from the console or rcon with a name of 64 characters or more, and callvote map or typemap with exactly 64, overflowed the map name buffer; they are now refused. Errors that put a script, entity or file name into their format string (an unknown weapon in getWeaponModel, an animtree, a trigger_radius, an impure iwd) printed garbage or crashed when the name contained %, and errors while parsing script data files printed the wrong file and line and could crash. The script runtime error dialog and the Couldn't load file error now include the message and the file name, and the compiler checks the format strings of the print and error functions (-Wformat). setcvar and makeCvarServerInfo now store the value with double quotes turned into single quotes, as their cleaning step intended. The bad rcon message and the netchan statistics keep working after the millisecond counter wraps, and master and authorize ports above 32767 are no longer printed negative.

  • Fatal errors in the log: the reason of a fatal error only went to stderr; the console log now has it after FATAL:, except for errors in the startup configs, before the log opens, and on Linux the log files are flushed before exiting. Both launchers set logfileRotate 5, so the console log of a crash survives the next start.

  • Crash reports: when the server crashes, it writes the signal or exception, the faulting address and the call addresses to the console and to crash.log in fs_homepath. addr2line -f -e <binary> <address> turns them into source locations. On Linux the process then dies with the same signal as before, so core dumps still work. Every worker thread (SQLite, MySQL, exec, sounds, JSON, HTTP and WebSocket) gets its own alternate signal stack, so a stack overflow there is reported too instead of killing the server silently, and a failed thread creation prints its real error. An async SQLite query whose worker thread can't be started now raises a script error instead of waiting forever.

  • Errors raised by an rcon command: rcon output goes to a buffer on the stack of the function that handles the packet, and an error (error drop, or a drop in a map command) jumped out of it without ending the redirect, so the error message and the cleanup were written over that freed stack: the message was lost and the stack could be corrupted. The redirect is now flushed while the buffer is valid, so the rcon client gets the output up to the error and the console log the error itself.

  • Async SQLite queries survive a map restart: queries still queued when a map or round restarted were dropped without a word, so writes made at the end of a round were lost: 498 of 500 in a test. They run now, and only their callback is skipped.

  • json_save_async on Windows: only the first save of a file worked; later ones returned 0 and left the old content.

  • Big data no longer ends the map: the script string pool holds about 512 KB, and a JSON file with more distinct text than that, or a database cell of 64 KB, stopped the map with a terminal error. json_parse, json_load and json_load_async refuse documents with more than 256 KB of distinct text, and sqlite_query and mysql_fetch_row cut a cell to 64999 characters.

  • MySQL functions gated, with timeouts: the handles of mysql_* are raw pointers and they reach any host, so like the other unsafe functions they now need +set sv_libcodUnsafe 1. A connection gives up after 5 s, a read or write after 30 s, where a database that stopped answering used to freeze the server, and the async list holds at most 512 queries, finished ones included until mysql_async_getresult_and_free collects them; past that a new query is a script error. Mods that use MySQL need the variable.

  • getArrayKeys with numbers: it dropped integer keys, so an array indexed by numbers gave an empty list with no error. They come back as ints now, among the string keys. Keys that are objects are still left out. It also crashed the server on an array nothing else held, such as getArrayKeys(strTok("a b", " ")).

  • Unsafe libcod functions off by default: a mod could run shell commands, read or replace any file the server user can, read and write raw memory or send packets to any address. system, exec and exec_async_*, memory_*, binarybuffer_*, fopen, fread, fwrite, fclose, fsize, ftime, file_link, file_unlink, file_exists, remove_file/fremove, scandir, fs_loaddir/loadDir, sendPacket and printOutOfBand now raise a script error unless the server is started with +set sv_libcodUnsafe 1. sqlite_open opens its file under fs_homepath/<mod> as json_save does (:memory: still works), and refuses paths that leave it and .iwd, .cfg, .gsc, .so and .dll names. ATTACH and VACUUM INTO are refused, because SQL could otherwise create files anywhere, also through a player name in a mod's query. httpFetch and webSocketConnect no longer connect to loopback, private, link-local, shared or multicast addresses, also when a public name resolves to one, unless the server is started with +set sv_httpAllowPrivate 1. Both variables can only be set on the command line, and a script's setCvar does not change them. Mods that use these functions need the variable. With it on, a mod must never build their commands, paths or addresses from player text, which would give that player the server's shell or files.

  • Too many dvars is no longer fatal: the server holds at most 1280 dvars, and one more stopped it with a fatal error. A script that names a new dvar with setCvar or makeCvarServerInfo when there is no room now gets a script error, and set, seta, sets, setu, dvar_bool, dvar_int and dvar_float from the console, rcon or a config print an error. A mod that stores data in one dvar per player or per round could stop a server this way after enough maps.

  • Precache limits that warn instead of stopping the map (from zk_libcod, same names): with g_safePrecache 1, a model or effect past the engine's limits, or a model set without being precached, prints a warning and shows the default model (xmodel/default_static_model) or the missing-effect sprite instead of ending the map; both take index 1, set aside when the map loads. g_reservedModels keeps that many model slots out of reach of the map's own entities, so the map, gametype and startGameType scripts can still precache their models on maps with many of them. Both take effect from the next map.

  • Plus ID: the OpenCoD2-Plus client can prove a key-pair identity at connect: it signs the challenge and the server address with ECDSA P-256 and the server gives the player an ID such as P-ABCD-EFGH-IJKL-MNOP that no one else can take, with no hardware data. The keys are optional, so every build takes them and other clients join as before, without an ID; an invalid signature or another server's address only leaves the player without one, and is logged. sv_requirePlusId 1 refuses players without an ID, sv_publicAddress names the address players dial (needed behind NAT; a port in it is the one players dial, for docker -p or a NAT remap; on a LAN only the host's own IPs are taken), rcon plusIdStatus lists the IDs and scripts read them with getPlusId(). The server also counts the playtime of each ID in plusid_seen.txt (sv_plusIdSeenFile, which several servers can share), shown by plusIdStatus and read with getPlusIdPlaytime() and getPlusIdFirstSeen(). rcon banPlusId <id|clientnum> <minutes> <reason...> and unbanPlusId <id> keep local bans in plusid_bans.json: a banned ID is dropped and refused with the reason, and a new ID that shares the guid or IP of a live ban is only flagged (plusIdStatus, getPlusIdFlags(), log). Shared ban lists: sv_banLists "url|pubhex;..." names up to 8 signed lists of IDs that the server fetches every sv_banListRefresh minutes, verifies with the maintainer's key, caches in plusid_lists/ and applies even when the host is down; a bad, oversized or older version keeps the last good one, and rcon banListStatus shows each list's state. scripts/banlist.py makes keys, signs, verifies and checks lists. See plus-id.md.

Compatibility and server behaviour

  • Script VM optimized: the interpreter loop was built without optimization because its state had to survive the jump out of a script error. That state now stays in memory, so the loop is optimized like the rest: a script-heavy loop runs about 11% faster.
  • CoD2 Plus handshake: the make PLUS=1 build (CoD2 1.3 Plus) only takes the CoD2 Plus client, and tells any other client to update to CoD2 1.3 Plus. The 1.0 build, bots and local clients are not affected.
  • CoD2 Plus snapshots: the make PLUS=1 build sends the CoD2 Plus client entity times as a short offset, about 12% less traffic at 40 Hz. Plus version 122 needs the matching client.
  • CoD2 Plus gameplay rules (Plus version 123): the make PLUS=1 build fixes bugs that zPAM fixed from script, for Plus clients only, which predict the same (plus-protocol.md):
    • Fast reload: firing a bolt-action or the shotgun, pressing reload and switching weapons twice no longer fires again sooner than the rechamber allows. With those weapons a switch taken back while the weapon still drops raises it again (so does a drop for a ladder or a mantle that ends in time), and a reload that cuts the shot keeps the shot's time left.
    • Prone peek: going prone while leaning no longer moves the head and hitbox from the side to the middle in one frame. The lean comes back to the prone limit as fast as a lean let go, about 300 ms, while the body goes down.
    • Climbing sound: nothing changes here; the Plus client plays the weapon raise that a ladder or a mantle sends with no weapon, so every player hears what the climber hears.
    • MG clip: leaving a turret keeps the player behind the gun, where using it put them, instead of taking them back to where they stood when they took it, so a turret can no longer be used to peek from behind cover.
  • Antilag rewinds the pose too (make PLUS=1): a shot is traced against the other players where they were when the shooter fired, but only their position went back: their lean, yaw, aim and stance flags stayed those of the present, so a shot at a head that leaned out a moment ago missed it. The Plus server keeps each player's pose for every frame and puts it back with the position, the animation of a stance change included: a shot at a head that was there before the player crouched, went prone or stood up hits it.
  • Antilag and killcam at 60 Hz: the server looked up its recorded frames as if sv_fps 60 meant 60 frames a second, but frames last 16 ms, 62.5 a second. A second back came out as 960 ms, so the antilag placed the other players up to two frames after the moment of the shot, and the killcam started late. It now counts whole frames. Nothing changes at 20 or 40 Hz.
  • The server sets the rate at 20, 40 and 60 Hz (make PLUS=1): a Plus server is named by its rate and sv_fps alone sets it. Every Plus client gets a snapshot every frame and 1,000 bytes a second per Hz (25,000 at least), whatever its rate and snaps, which stop at 25000 and 30. g_forceSnaps and g_forceRate still set them, and a change by rcon now takes effect at once instead of when the player reconnects. 30 and 50 Hz are left out, as they stretch a script's wait 0.05.
  • Turrets and trigger_hurt at any sv_fps (make PLUS=1): a manned MG took 50 ms off its time between shots every server frame, so above 20 Hz it fired faster: twice at 40 Hz, once a frame at 60. It now fires at its weapon's rate at any frame rate, an unmanned turret turns back at the same speed, and a trigger_hurt hurts every 50 ms (or second) at 50 and 60 Hz too. Nothing changes at 20 Hz or in other builds.
  • Plus server serves its own downloads over HTTP (make PLUS=1, Linux): a home server has no web host for its mod iwds, and the UDP download is slow. With sv_wwwDownload 1 and sv_wwwBaseURL auto (in a cfg, as the console takes // for a comment) the server redirects Plus clients to plus:<name> and serves the file itself on TCP on the game port, so open that port in TCP in the router. Only Plus clients use it; a Plus client too old to know plus: (the released 123 client) refuses the redirect and gets the UDP download, where the stock server would drop it for a wwwdl fail before wwwdl ack. A request is served only to an IP that was just redirected to that file (other IPs are closed at once) (5 minutes to start; a started transfer finishes unless it moves under 1 MB in 30 s, and is then reset), only GET and HEAD, and all downloads share sv_wwwMaxRate. One console line per finished download. On a Windows Plus build auto redirects nobody. The client's part is in plus-protocol.md.
  • Votes survive a reconnect (make PLUS=1): a player who left and joined again got a cleared client, so they could vote a second time in the same vote, or call three more votes. A Plus server keeps both by IP until the map changes; a player from the same IP who joins next takes them.
  • Fixed shotgun pellet spread (from CoD2x, same name): with g_shotgun_spread_fix 1 the shotgun's 8 pellets follow one of CoD2x's two fixed patterns, turned at random per shot, so the same shot no longer kills or misses by chance; zPAM 4.x tunes its shotgun ranges for it. The server traces the pellets and sends their impacts, so every client, stock or Plus, sees them where they hit. Off by default.
  • wait follows sv_fps: scripts keep their timing in seconds at any server frame rate, instead of running faster with it. Above 20 Hz (make PLUS=1) the part of a frame a wait cannot take carries to the thread's next wait, so a loop of wait 0.05 at 62.5 Hz averages 50 ms instead of 48, and wait 1 1 s instead of 1.008.
  • 20% less traffic to clients: the snapshot writer sent every field of a changed entity in full, even the ones that had not changed. It now marks them as unchanged, as the original does, with the same network format, so every client benefits.
  • Master servers:
    • sv_master2 is preset to master.cod2x.me, the CoD2x community master.
    • The host:port format in sv_master1–sv_master5 now works.
    • A DNS failure is retried instead of clearing the master.
    • On Linux, +set sv_master2 "" on the command line now clears the master. The empty argument used to vanish, so set changed nothing and the server kept sending heartbeats to it.
  • Overflow fix for Game Pass clients: sending the system info to a client using protocol 119 could overflow a buffer and crash the server.
  • Large messages from 1.3 clients: fragmented messages sent by 1.3 clients were misread and dropped; they are now read in the 1.3 format.
  • dedicated is honoured: +set dedicated 1 was ignored and every server announced itself to the master servers. Now 1 keeps the server off the public list and 2, the default, announces it.
  • Game files on Windows drives: the Linux build could not see the game files on file systems with large inode numbers, such as Windows drives under WSL. It is now built with 64-bit file offsets.
  • Steady game clock on Linux: the server measured time with the wall clock, so every clock correction (NTP, virtual machine time sync) froze the game for a moment. It now uses the monotonic clock.
  • Bots after a map change: after a map change, bots stayed connected but out of the game, holding their slots, so the bots mod kept adding more until the server was full. They now come back into the game as soon as the new map loads.
  • Eye bob: the eye the server shoots from never bobbed: BG_GetBobCycle divided the cycle by 255 as integers, so it was always a whole turn; as in 1.3 (0x4fddb6) it divides as a float, and a walking player's eye now bobs. BG_GetSpeed returned the velocity's full length, so a jump or a fall counted as moving; as in 1.3 (0x4fde06), it takes the horizontal speed only, so the eye does not bob in the air.
  • Fewer stalls and a cleaner startup: the master server name is resolved once instead of on every authorization timeout, and the server no longer warns about every +set on the command line.

Administration

  • Mod folder layout (from zk_libcod, same names): fs_callbacks names the script with the CodeCallback_* functions (default maps/mp/gametypes/_callbacksetup), fs_gametypes the folder of the gametype scripts and their .txt descriptions (default maps/mp/gametypes), and fs_mapScriptDirectories where a map's main is: 0 maps/mp/<map>, 1 maps/mp/<map>/<map>, 2 that first and then maps/mp/<map>. loc_loadLocalizedMods 1 lists the mod's localized_*.iwd files in sv_iwds/sv_iwdNames too, so pure clients load them. With manymaps, a stock map's iwd in the library now replaces the stock one only with fs_replaceStockMaps 1; it used to be linked whenever the server changed to it from a custom map.
  • Load and network switches (from zk_libcod, same names): sv_isLookingAtOnDemand 1 skips the trace that finds what each player looks at every frame and runs it only when a script calls isLookingAt; it also turns off the friendly and enemy crosshair names and trigger_lookat. sv_fastDownloadSpeed (1–8) sets how many messages a frame sv_fastDownload sends a downloading client. sv_minimizeSysteminfo 1 sends timescale, g_synchronousClients, the fall damage heights, sv_cheats, sv_disableClientConsole, sv_voice and sv_voiceQuality with the gamestate instead of the systeminfo, to leave room for the names and checksums of more iwds; a change reaches a client only with its next gamestate (zk_libcod's levels 2 and 3 do the same as 1 here, as the dvars they add do not exist). zk_libcod's net_noFragmentationDelay is not needed: this server already sends all pending fragments of a message at once.
  • More admin switches (from zk_libcod, same names): g_corpseHit 0 makes bullets hit a corpse as the surface under it instead of with blood, g_spectateBots 0 keeps spectators from following bots, g_logPickup 0 leaves the Weapon; and Item; pickup lines out of the game log, sv_botKickMessages 0 hides the message for kicked bots, sv_noAuthorize 1 lets players in without asking the CD key authorization server (they get GUID 0), and sv_authorizeTimeout sets how long a connecting player waits for that server (5000 ms, as before). sv_limitLocalRcon 1 rate-limits rcon from LAN addresses too; unlike zk_libcod it is off by default, as LAN addresses were never limited here. zk_libcod's sv_disconnectMessages and sv_botReconnectMode are not needed: the disconnect message is already not shown, and bots already come back after a map change (sv_kickbots drops them instead).
  • Map ambience switches: as zPAM's scr_allow_ambient_* cvars, but for every mod and map: g_ambientSound 0 silences the distant battle sounds (ambientPlay), g_fireFx 0 leaves out the map's looped fx/fire/ effects and the looped sounds whose alias contains fire (smallfire, medfire, bigfire on the stock maps), g_smokeFx 0 the looped fx/smoke/ effects, g_weatherFx 0 the looped fx/dust/ (the sand on Toujane), fx/misc/snow_ and fx/misc/fogbank_ effects, and g_fog 0 the fog set by setExpFog and setCullFog. Only looped map effects (playLoopedFx) are filtered: playFx, such as the SD flak88 explosion, grenades and smoke grenades, is unchanged. The effect entities are still spawned but never sent, so scripts that keep or delete them work as before. A change applies from the next map or map_restart. All are on by default; turning the fog off lets players see further.
  • Dvar queries show the right default: typing a dvar's name (in the console or through rcon) printed its current value as the default too, and on some compilers and CPUs the default as the current value; dvarlist could show the current value as the latched one. Both values had shared one text buffer.
  • Passwords kept out of the log: rcon_password and sv_privatePassword are shown as ******** in the console log.
  • Logging and admin settings: the console log can be renamed (logfileName), keep the logs of previous runs (logfileRotate) and start each line with the date and time (logTimestamps). Accepted rcon commands can be left out of the log (sv_logRcon), the CD key authorization server can be changed (sv_authorizeServer, sv_authorizePort), the server can impose a rate and snapshot rate on every client (g_forceRate, g_forceSnaps), and the messages announcing a kick or a timeout can be turned off (sv_kickMessages, sv_timeoutMessages). The names are the same as in zk_libcod, so its configs keep working.
  • Long-running servers restart between maps: the server time only goes back to 0 when the server shuts down, and the engine forces that at about day 21.7, in the middle of whatever match is running. After about day 18.6 the server now does it on the next map change instead, so players are disconnected between maps; the forced restart remains for a map that never changes. Commands sent over rcon that shut the server down (killserver, or a map change that restarts it) also get their reply now: it used to be sent to an empty address.
  • Snapshot counters reload the map instead of dropping players: on a map that runs for many hours without a map change or a round restart, the counters of the snapshot buffers reach their limit and the server shut down and dropped every player. Since every map load resets them, it now reloads the current map and the players stay connected, as on a map change.
  • Clean shutdown on Linux: SIGTERM, SIGINT (Ctrl+C) and SIGHUP make the server quit as the quit command does: players get the final message, the masters the flatline heartbeat, and games_mp.log and the console log are closed (with g_logSync 0 the last lines used to be lost). A second signal while it quits exits at once, a signal that nohup or the shell ignores stays ignored, and SIGPIPE is ignored. On Windows, logging off or shutting down the system now quits the same way; closing the console window already did.
  • Console log errors: when the console log can't be opened (a read-only fs_homepath, a bad logfileName), the server prints the reason once and tries again only when logfile or logfileName changes. It used to print that the log was opened, retry on every line printed and rotate the older logs away with logfileRotate on each retry.
  • Game log rotation: with g_logRotateSize, a games_mp.log that has reached that size is renamed to games_mp.log.1 when the next map starts, keeping g_logRotate older copies. It used to grow forever.
  • Strict port: net_strictPort 1 stops the server with an error when net_port is busy, instead of starting on one of the next 9 ports, where players and the masters don't look for it.

libcod script functions and callbacks

  • Last player methods from zk_libcod (same names): getAuthorizationStatus() returns the CD key authorization server's answer for the player ("KEY_IS_GOOD", "INVALID_CDKEY", "BANNED_CDKEY"…, or "" when the server was not asked), setActivateOnUseButtonRelease(1) makes uses (weapon pickups, planting, use triggers) happen when the player lets go of the button, lookAtKiller(inflictor, attacker) turns a dead player's view to the killer (entity numbers, as zk_libcod), and playScriptAnimation(event, isContinue, force) plays an animation script event on the player's model and returns its duration. zk_libcod's setWeaponFuseTime and setWeaponRaiseTime are left out: the client predicts both times.
  • More callbacks (from zk_libcod, same names and parameters): _callbacksetup.gsc can define CodeCallback_PlayerEvent(event, parm) (on the player, for each predictable player event such as firing or footsteps), CodeCallback_EntityEvent(event, parm) (on the entity, for each entity event such as an explosion or a bounce), CodeCallback_Notify(message, args) (on the entity, for each notify the engine sends to it: damage, trigger, menuresponse…), CodeCallback_NotifyDebug(object, message, args) (every notify, script ones included, at the start of the next frame; at most 4096 a frame and 16 arguments each), CodeCallback_MoverBlockage(mover) (on an entity that blocks a moving script brush model, model or origin), CodeCallback_MapWeaponsLoad(num, info) and CodeCallback_MapTurretsLoad(num, info) (before the gametype's main; with g_spawnMapWeapons 0 or g_spawnMapTurrets 0 the map's weapons or turrets are not spawned nor precached and are described in info: classname, origin, angles and count for weapons; classname, origin, angles, the four arcs (-1 when unset), model, weaponinfo, export and script_gameobjectname for turrets), CodeCallback_DPrintf(message) (every debug print of the main thread outside a running builtin, whose parameters it would clear, developer or not; unlike zk_libcod the message is still printed with developer set) and CodeCallback_CLSpam(type, ip) (when an address goes over the getinfo, getstatus, getchallenge, connect or rcon rate limit, at most 10 times a second in all; LAN addresses have no limit except on connect). g_noMoverBlockage 1 lets movers go on when something blocks them.
  • error(), logErrors and execute (from zk_libcod, same names): error(message, [terminal]) raises a script error with that message, or ends the map when terminal is set. With logErrors 1, script runtime errors are written to the console log without developer mode (the message only: file and line need developer mode). execute and execute_async_* are zk_libcod's names for exec and exec_async_* and need sv_libcodUnsafe as they do.
  • More libcod callbacks and player methods (from zk_libcod, same names): _callbacksetup.gsc can define CodeCallback_Error(critical, function, message, position) (script runtime errors, delivered on the next frame; in developer mode position is the "file:line" of the error, and developer 2 reports errors without stopping the map), CodeCallback_HitchWarning(msec), CodeCallback_Pickup(type, weapon, name, quantity, clip, origin, angles) (replaces the stock pickup), CodeCallback_Suicide() (replaces suicide(); processSuicide() kills), CodeCallback_WeaponChange(index, name) and one callback per button press: Attack, Melee, Use, Reload, LeanLeft, LeanRight, Prone, Crouch, Stand, Ads, MeleeBreath, HoldBreath, Frag and Smoke (CodeCallback_<name>Button()). New player methods: isFiring, isMeleeing, isReloading, isThrowingGrenade, isUsingBinoculars, isRechambering, isShellShocked, isChatting, holdBreathButtonPressed, get/setCurrentWeaponAmmo, get/setCurrentWeaponClipAmmo, getCurrentWeaponSlot, get/setSpeed, get/setGravity, getGroundEntity, getViewOrigin, getPlayerstateFlags, getInactivityTime, getEnterTime and processSuicide. Unlike zk_libcod, the weapon change and error callbacks never run inside player movement or the script VM, and a suicide() inside CodeCallback_Suicide does not loop.
  • Admin and server functions (from zk_libcod, same names): player methods muteClient/unmuteClient, setHiddenFromScoreboard and setHiddenFromServerStatus with their is… getters (hidden players are left out of the scoreboard, or out of getstatus and the getinfo count), setAllowSpectators, setConfigstringForPlayer, getServerCommandQueueSize, getCDKeyHash and getClientHudElemCount; functions setConsolePrefix, setNextTestClientName and resetTestClientNaming. CodeCallback_RemoteCommand(from, args) receives accepted rcon commands and processRemoteCommand() runs them; it replaces remotecommand(from, pointer), which crashed the server with any value a script could pass. clientCommand() (also processClientCommand()) now only works inside CodeCallback_PlayerCommand, for that player, instead of running leftover arguments that could be another player's. A map command, killserver or quit run with cmd_executestring or processRemoteCommand() no longer crashes the server (it runs once the script thread is done), and what a script set for a player with setSpeed, setGravity and the like no longer carries over to the next player in that slot.
  • graphAutodiscover links like graphAutodiscoverEx: the two built graphs apart, and the plain one linked every neighbour both ways as a walk, also across a drop or a hole. It now makes the same typed, one-way-down links: on mp_toujane the same 2051 nodes with 23 fewer edges, and 20 nodes that only those edges reached are no longer accessible from the seed. A graph already saved does not change until it is rebuilt.
  • Waypoint graphs with A* and more script functions (from zk_libcod): graphCreate, graphAddNode, graphAddEdge, graphFindPath, graphFindClosestNode, graphAutodiscover, graphSave/graphLoad and the rest of zk_libcod's graph* functions let bot scripts navigate a map (src/libcod/gsc_graph.cpp, ported under its MIT license). Unlike in zk_libcod, graphs are also cleared on a fast map_restart (every round of SD), a bad id or file returns undefined without ending the script thread, graphLoad refuses files over 64 MB and files with a negative or non-finite edge cost or a non-finite origin, and graphSave refuses .iwd, .cfg and .gsc names (also with a trailing . or space, or a :, which Windows would strip or read as a stream). graphAutodiscoverEx also takes an array of seed origins and floods from all of them at once, so a graph that reaches sv_graphMaxNodes is spread over the map instead of filling up around the first seed, and it keeps linking the nodes it has after the cap. Also new: abs, floor, ceil, pow, atan2, roundTo, getMilliseconds, getMicroseconds, toHex, fromHex, ord, chr, getEntityCount, logPrintConsole and the getUserinfo/setUserinfo methods; bulletTrace and bulletTracePassed take an optional content mask, and bulletTrace also returns flags, contents and material; with sv_botUseTriggerUse 1, a bot standing in a use trigger (such as an SD bomb zone) gets self waittill("bot_trigger", trigger).
  • Weapon and combat functions (from zk_libcod, same names): player methods setWeaponSpreadScale, setTurretSpreadScale, setMeleeRangeScale, setMeleeWidthScale, setMeleeHeightScale, setFireRangeScale, setBulletMask/getBulletMask, setFireThroughWalls, enableBulletImpacts/disableBulletImpacts, useTurret, canUseTurret, stopUseTurret, canMantle, getWeaponAnimation, forceShot and noClip; entity methods spawnGrenade, getGrenadeFuseTime/addGrenadeFuseTime, isTurret, getTurretOwner, get/setWeaponItemAmmo, get/setWeaponItemClipAmmo and get/setItemQuantity; functions getWeaponFuseTime, getWeaponRaiseTime, getWeaponMoveSpeedScale, getWeaponDisplayName, isSemiAutoWeapon, ignoreWeapon and resetIgnoredWeapons. Left out because the client predicts them and would stutter: zk_libcod's setters for jump height, step size and weapon move speed, and setHoldingWeaponDown.
  • zk_libcod names and more script functions: zk_libcod's names now work for functions this fork already had under libcod's names (executeCommand, sendCommandToClient, sendPacket, findConfigStringIndex, fremove, loadDir, getClientConnectState, connectionlessPacketToClient/ToServer, processClientUserinfoChange, throwGrenade, throwSmokeGrenade, setAim, setAnimation), so scripts written for zk_libcod run unchanged. New entity methods getTagOrigin, getTagAngles, hasTag, isLinkedTo, getVMin, getVMax, get/setClipmask, getContents and setLight; player methods overrideContents, isUseTouching, getProtocolString, setOriginAndAngles and setWalkValues (bots); functions makeString, makeClientLocalizedString, getCvarFlags, getSurfaceName, setNorthYaw, getMovers and get/setSavePersist. setAnim with an animation name the server doesn't know returns false instead of stopping the map.
  • Per-player visibility, effects and collision (from zk_libcod, same names): entity methods hideFromPlayer (the opposite of the stock showToPlayer; undone when that player's slot is freed) and notSolidForPlayer/solidForPlayer (a brush model one player walks through); player methods playFxForPlayer, playFxOnTagForPlayer, earthquakeForPlayer, enableEarthquakes/disableEarthquakes, setNorthYawForPlayer, setCullFogForPlayer, setExpFogForPlayer, objective_player_add/_delete/_icon/_position/_state (per-player compass objectives), enableSilent/disableSilent (the others stop hearing a player's steps and landings) and setCollisionTeam/getCollisionTeam ("axis", "allies", "none" or "axis_allies"). What a player walks through is also sent as not solid in that player's snapshots, so the client predicts the same as the server. Unlike zk_libcod, silenced events stay in the player's own playerState, so its prediction is unchanged. Left out: the manual snapshot entity list (zk_libcod's version breaks delta compression) and the talker icons (it fakes voice packets).
  • Physics for scripts (from zk_libcod, same names): script models can fall and bounce: enableGravity([collideModels], [alignToGround]), disableGravity, isGravityEnabled, enableBounce([parallel], [perpendicular]), disableBounce, set/add/getEntityVelocity and set/getMaxEntityVelocity, with land and bounce notifies (surface name, ground entity). They move on the trajectories the client already extrapolates, so it draws the same path; unlike zk_libcod, the speed limit is also sent to the client, models no longer stick to walls and their angles survive enableGravity. With g_bulletDrop 1, enableBulletDrop/disableBulletDrop, setBulletVelocity and setBulletDrag make a player's bullets fly over the next frames, dropping and slowing down, with impacts, penetration and the bullet settings above still applying; zk_libcod's bullet models are left out.
  • JSON (from zk_libcod, same names): json_parse, json_stringify, json_load, json_save and the non-blocking json_load_async/json_save_async with json_async_done/json_async_result turn JSON into GSC arrays and back, in memory or in files of the mod folder. Built on yyjson, which is compiled into the binary. Unlike zk_libcod, the async writer also works on Windows and saving .iwd, .cfg, .gsc, .so or .dll files is refused.
  • Sounds through voice chat (from zk_libcod, same names): loadSoundFile encodes an 8192 Hz mono 16-bit sound (raw PCM or WAV) into Speex in the background, and playSoundFile plays it to a player as voice chat from any player, with sound_file_done/sound_file_stop notifies; also stopSoundFile, isPlayingSoundFile, getRemainingSoundFileDuration, getSoundFileDuration and loadSpeexFile/saveSpeexFile. libspeex is compiled into the binary. Unlike zk_libcod, sounds take the memory they need (not a 513 MB array), the playback follows the real frame time, and Speex files can't overflow the voice queue. A WAV with a broken chunk size is refused instead of hanging the server, and chunks after the samples (such as LIST tags) are neither played nor counted in the duration. A player whose voice queue is full gets the rest of the sound on the next frames instead of losing those packets, and saveSpeexFile refuses names that end in a dot or a space, which Windows drops, so evil.cfg. can no longer get past its refusal of .iwd, .cfg, .gsc, .so and .dll names.
  • HTTP and WebSocket clients (from zk_libcod, same names and callbacks): httpFetch(url, method, data, headers, timeout, ::onDone, ::onError, [allowInsecure]) makes one request and calls onDone(status, body, headers) (headers in an array keyed by lowercase name) or onError(message) on a later frame; webSocketConnect(url, headers, ::onConnect, ::onMessage, ::onClose, ::onError, [reconnectDelayMs], [pingIntervalMs], [allowInsecure]) returns an id from 0 to 15 (or -1), reconnects on its own and delivers whole text messages, with webSocketSendText(id, text) and webSocketClose(id); the http_fetch and websocket_* spellings work too. Requests and connections run on their own threads, so a slow server never holds up the game, and they belong to the level: on a map change or map_restart requests are cancelled and connections closed, and nothing arrives late. http, https, ws and wss URLs only; bodies, headers and messages over 65000 bytes go to onError (messages are dropped); at most 16 requests and 16 connections at once; redirects are not followed (a 3xx comes to onDone with its location header). A timeout of 0 means the longest, a day. A response with a NUL or a control character in a header name, more than 100 header lines, a Content-Length that isn't plain digits (or repeated with different values) or more than 5 interim responses goes to onError. Each connection keeps at most 1 MB of messages the script hasn't taken yet (the rest are dropped and logged) and delivers at most 64 events per frame. Unlike zk_libcod, which is an optional Linux build with libwebsockets, this is built in on Linux and Windows with Mbed TLS 3.6 (src/libcod/mbedtls, Apache-2.0), WebSocket certificates are checked too (against the system's CA list or sv_httpCaFile, unless allowInsecure is set), a bad webSocketConnect URL returns -1 instead of retrying, and sv_httpAllowedHosts can limit the hosts scripts reach.
  • More bot buttons in libcod: the script methods useButton, throwSmoke and holdBreath make a bot press use (to plant or defuse the bomb), throw a smoke grenade or hold its breath, like the existing fireWeapon and throwNade. Each takes 1 to press and 0 to release.

Bots mod

  • Bots use stairs between floors: the waypoint graph left upper floors and cellars cut off from the rest of the map, so a bot that spawned on one never left it: 27 of the 128 spawn points of mp_carentan and of mp_toujane, 5 of mp_burgundy, 12 of mp_brecourt; now 2, 3, 2 and 0. graphAutodiscover and graphAutodiscoverEx keep a node per floor and per side of a wall in each grid cell, look a quarter and half a step aside for a doorway or a narrow stair, and link stairs by walking them in 8-unit steps. Graphs have about a third more nodes (mp_brecourt 16183). The cache is now waypoints/<map>_v3.graph, so maps build their graph again once.
  • Bots patrol only where they can walk: a random patrol node could be on a floor the graph does not connect, 13% of the time on mp_carentan, and the bot then stood at the closest point until the patrol timed out.
  • Bots out of ammo fight on: a bot with nothing left kept pressing reload and never fired again. It now changes to its other weapon, or walks at the target to knife it.
  • Simple bots: mods/bots is a small script mod whose bots navigate each map over a waypoint graph built with the libcod graph* functions: the first time a map is played the graph is generated from all its spawn points at once and saved as waypoints/<map>_v2.graph in the mod folder, and later loads read it. With nobody in sight they follow what they last saw or heard shooting, patrol towards the enemy side, and only after 20 s without contact head for the nearest enemy. They aim down the sight at range, throw grenades at mid range, knife up close and reload between fights. In SD and CTF each life a bot draws a role: attackers plant the bomb or hunt, defenders guard a bomb site or hunt, and once the bomb is planted the defenders go to defuse it while the planters guard it; in CTF bots steal and bring home the enemy flag, or defend their own, chase its carrier and return it when it is dropped (SD in dual bomb mode is played without objectives). scripts/install_bots.py installs it; bots_count, bots_skill and bots_debug control them.
  • Bots play HQ: bots take the radio by standing inside it and guard it from around once their team holds it. Radios the waypoint graph can't reach (roofs, cut-off floors) leave the rotation when at least 3 others remain, because a neutral radio never goes away and no bot could take it.
  • Fewer path searches and grenade suicides: a bot chasing a moving enemy searched a new path each time the enemy passed into the area of another waypoint, and every tick an enemy flickered in and out of sight; it now follows a moving goal twice a second (at once when the goal jumps far), so the busiest bot searches at most 6 times a second instead of 8. After a throw, a bot no longer walks towards where it threw for the fuse, and it checks the first 60% of the throw (up to 400 units) for cover the grenade would bounce off, not just 150 units: grenade suicides went from 2.8 to 1.4 per 100 throws.
  • Whole graph on mp_brecourt: the waypoint graph of mp_brecourt needs 15014 nodes, so the old cap of 8192 stopped the graph at about half of the map. sv_graphMaxNodes defaults to 32768 (it was 16384, which the graph with floors nearly fills on mp_brecourt, 16183 nodes), and mp_carentan, mp_toujane and mp_burgundy 2085 to 3010. A graph cut off by the cap prints a warning on the console, so a big custom map shows that it needs more.

Testing tools

  • Test client that reads snapshots: scripts/cod2snap.py parses everything the server sends to a client (gamestate, server commands, snapshots with the playerstate, entities and client states, in 1.0 and 1.3), and cod2client.read_frames() returns one frame per snapshot, so tests can check what one client receives.
  • HTTP and WebSocket test: scripts/http_test.py runs local HTTP, HTTPS, WS and WSS servers, makes a test mod call httpFetch and webSocket* against them, and checks the results, the certificate checks, the limits, malformed responses, WebSocket floods, that the server keeps answering during a slow request and that a map change or map_restart drops the old level's requests and connections.
  • Smoke test: scripts/smoke_test.py starts the Linux server against a real game folder and checks that it loads a map, answers queries and lets a minimal client (scripts/cod2client.py) connect, receive the gamestate, enter the game and send commands, including in fragmented messages. A second run in internet mode (dedicated 2) heartbeats to a fake master on 127.0.0.1 and checks the heartbeats, the status sent on its own, the replies to the master's queries and the flatline when SIGTERM stops it, with the real masters cleared so nothing leaves the machine. It also checks that SIGTERM exits with code 0 after closing games_mp.log, that a console log that can't be opened is reported once and rotates nothing, that g_logRotateSize rotates the game log that net_strictPort stops a second server on a busy port, and that a bulletTrace into a script model before the first frame works.

New variables

Variable Default Range Description
sv_rconMaxAttempts 5 0–100 Wrong rcon passwords allowed per IP before the lockout. 0 disables the lockout.
sv_rconLockTime 600 0–86400 Lockout duration in seconds. It is also the window in which attempts are counted.
sv_rconWhitelist "" — IP addresses, separated by spaces or commas, that are never locked out of rcon nor rate limited. Host names are ignored.
logfileName "" — Console log file, in fs_homepath/<mod>. Empty uses console_mp_server.log; names with .. or a full path are ignored.
logfileRotate 0 0–1000 Logs of previous runs kept when the server starts, as <name>.1 (newest) to <name>.N.
logTimestamps 0 0–1 1 starts each console log line with the date and time.
g_logRotateSize 0 0–2047 Size in MB at which g_log (games_mp.log) is rotated when the next map starts. 0 never rotates it.
g_logRotate 1 1–1000 Older game logs kept when g_logRotateSize rotates it, as <name>.1 (newest) to <name>.N.
sv_plus 123 read-only make PLUS=1 build only: the Plus protocol version, so a mod can require this build with getCvarInt("sv_plus"). Not sent in serverinfo; other builds do not have it.
sv_plusNotice empty text make PLUS=1 build only: what a client without CoD2 Plus reads when refused. Empty uses the default, with the link to the client.
net_altPort 0 0–65535 Second UDP port of the 1.0 build, announced as protocol 118 and version 1.3. 0 keeps it closed. Only read at start, so set it on the command line.
net_strictPort 0 0–1 1 stops the server when net_port is busy instead of trying the next 9 ports. Only read at startup, so set it on the command line.
sv_logRcon 1 0–1 0 leaves accepted rcon commands out of the log. Wrong passwords are always logged.
sv_authorizeServer cod2master.activision.com — CD key authorization server. A new value is used from the next connection.
sv_authorizePort 20700 1–65535 Port of the authorization server.
g_forceRate 0 0–1000000 Rate given to every client instead of its own (minimum 1000). 0 keeps the client's; on a Plus server, 0 is 1,000 bytes a second per Hz (25,000 at least).
g_forceSnaps 0 0–1000 Snapshots per second given to every client. 0 keeps the client's; on a Plus server, 0 is a snapshot every frame.
sv_wwwMaxRate 1024 0–1000000 make PLUS=1 build only: KB/s that all downloads of sv_wwwBaseURL auto share. 0 is no cap.
sv_wwwMaxConnections 4 1–64 make PLUS=1 build only: downloads of sv_wwwBaseURL auto served at once; more are closed and the client uses UDP.
sv_wwwMaxPerIP 2 1–64 make PLUS=1 build only: downloads served at once to one IP.
sv_lanForceRate 1 0–1 0 gives LAN clients the rate and snapshots of internet ones, instead of every frame with no rate limit. Plus build only.
sv_kickMessages 1 0–1 0 hides the message that tells everyone a player was kicked.
sv_timeoutMessages 1 0–1 0 hides the message that tells everyone a player timed out.
sv_botUseTriggerUse 0 0–1 1 sends a bot a bot_trigger notify, with the trigger, while it stands in a use trigger it could use.
g_safePrecache 0 0–1 1 turns model and effect precache overflows, and models set without precaching, into warnings: they are shown as the default model or missing effect. From the next map.
g_reservedModels 0 0–255 Model slots the map's own entities can't use, kept for the scripts' precaches. From the next map.
logErrors 0 0–1 1 writes script runtime errors to the console log without developer mode (message only). On a Plus server the same message again prints only as a count, every 10 s.
g_noMoverBlockage 0 0–1 1 lets movers (script brush models, models, origins) go on when an entity blocks them.
g_spawnMapWeapons 1 0–1 0 neither spawns nor precaches the map's weapons; CodeCallback_MapWeaponsLoad gets them.
g_spawnMapTurrets 1 0–1 0 neither spawns nor precaches the map's turrets; CodeCallback_MapTurretsLoad gets them.
g_corpseHit 1 0–1 0 makes bullets hit a corpse as the surface under it instead of with blood.
g_spectateBots 1 0–1 0 keeps spectators from following bots.
g_logPickup 1 0–1 0 leaves weapon and item pickups out of the game log.
sv_botKickMessages 1 0–1 0 hides the message for kicked bots.
sv_noAuthorize 0 0–1 1 skips the CD key authorization server; players get GUID 0.
sv_challengeStateless 0 0–1 1 answers getchallenge with the signed challenge alone, with no slot and no global limit, and checks the CD key at connect: a flood of made-up addresses cannot keep players out, but each join waits about 3 seconds more.
sv_publicAddress "" — ip:port players reach the server at, which their Plus ID signatures must name; the port may differ from net_port (docker -p, a NAT remap). Empty: only LAN players get a Plus ID.
sv_requirePlusId 0 0–1 1 refuses players without a valid Plus ID, with sv_plusIdNotice.
sv_plusIdNotice "" text What a player refused by sv_requirePlusId reads. Empty uses the default, with the link to the client.
sv_plusIdSeenFile plusid_seen.txt path Where the playtime of each Plus ID is kept (id first_seen seconds), relative to fs_homepath or absolute; servers can share one file.
sv_banLists "" text Signed shared ban lists, `"url
sv_banListRefresh 30 1–10080 Minutes between fetches of each shared ban list.
sv_authorizeTimeout 5000 0–1200000 Milliseconds a connecting player waits for the authorization server.
sv_limitLocalRcon 0 0–1 1 applies the rcon rate limit to LAN addresses too.
sv_isLookingAtOnDemand 0 0–1 1 finds what a player looks at only when a script calls isLookingAt (no crosshair names or trigger_lookat then).
sv_fastDownloadSpeed 8 1–8 Messages a frame sv_fastDownload sends a downloading client.
g_ambientSound 1 0–1 0 silences the map's distant battle sounds. From the next map.
g_fireFx 1 0–1 0 leaves out the map's looped fx/fire/ effects and fire sounds. From the next map.
g_smokeFx 1 0–1 0 leaves out the map's looped fx/smoke/ effects. From the next map.
g_weatherFx 1 0–1 0 leaves out the map's looped dust, snow and fog bank effects. From the next map.
g_fog 1 0–1 0 keeps map scripts from setting fog. From the next map.
sv_minimizeSysteminfo 0 0–3 Above 0, moves some dvars from the systeminfo to the gamestate to make room for more iwds. From the next map.
fs_callbacks "" — Script with the CodeCallback_* functions; empty is maps/mp/gametypes/_callbacksetup.
fs_gametypes "" — Folder of the gametype scripts; empty is maps/mp/gametypes.
fs_mapScriptDirectories 0 0–2 Where a map's main is: 0 maps/mp/<map>, 1 maps/mp/<map>/<map>, 2 that first, then maps/mp/<map>.
fs_replaceStockMaps 0 0–1 1 lets manymaps replace a stock map with the iwd of the same name in the library.
loc_loadLocalizedMods 0 0–1 1 lists the mod's localized_*.iwd files for pure clients too.
g_bulletDrop 0 0–1 1 lets enableBulletDrop give a player's bullets travel time and drop.
g_bulletDropMaxTime 10000 50–60000 Milliseconds a dropping bullet flies before it is dropped.
g_shotgun_spread_fix 0 0–1 1 fires the 8 pellets of a shotgun on one of CoD2x's two fixed patterns, turned at random per shot, instead of each at random within the spread. Takes precedence over g_fixedWeaponSpreads for an 8-pellet weapon.
sv_httpAllowedHosts "" — Hosts httpFetch and webSocketConnect may reach, separated by spaces or commas; *.example.com allows its subdomains. Empty allows every host.
sv_libcodUnsafe 0 0–1 1 lets scripts use the libcod functions that reach the shell, raw memory, files by any path or any network address. Command line only.
sv_httpAllowPrivate 0 0–1 1 lets httpFetch and webSocketConnect connect to loopback, private, link-local, shared and multicast addresses. Command line only.
sv_httpCaFile "" — PEM file with the certificates https and wss trust. Empty uses the system's: /etc/ssl/certs/ca-certificates.crt or /etc/pki/tls/certs/ca-bundle.crt on Linux, the certificate store on Windows. On Windows the store only holds the root certificates the system has already downloaded, so set this to a CA bundle (such as the cacert.pem from curl) if https or wss hosts fail verification. The file is read again when the variable changes or after an hour.
g_debugGraph 0 0–1 1 prints debug messages from the graph functions.
sv_graphAstarMaxIterations 0 0–100000 Maximum nodes one graphFindPath expands. 0 means no limit.
sv_graphAstarWeight 1 1–2 A* heuristic weight. Above 1, paths are found faster but can be longer.
sv_graphMaxGraphs 8 1–64 Maximum number of graphs at once.
sv_graphMaxNodes 32768 64–65535 Maximum nodes in one graph.