tws-zombies-scripts

Combined working repo for the TWS Plutonium Zombies scripts and native plugins across two games.

Changelog · Current component versions

Layout

The scripts still deploy to the game's existing storage/t5/scripts/sp/ or storage/t6/scripts/zm/ directories; the new source layout does not change GSC namespaces.

Versioning

versions.json records the current source version of each individual script and each native plugin. Every .gsc file has its own version, keyed by its exact filename. Changing one script bumps only that script's version; other scripts increase only when their own source changes.

Component Manifest key Source
Each T5 script Exact filename, e.g. tws_t5_afk.gsc Corresponding file in t5/scripts/
Each T6 script Exact filename, e.g. tws_t6_afk.gsc Corresponding file in t6/scripts/
T5 plugin t5-plugin t5/plugins/tws-t5-gsc-utils/
T6 plugin t6-plugin t6/plugins/tws-t6-gsc-utils/

Every completed script or plugin change includes a version bump for each affected component and an entry in CHANGELOG.md. Each entry identifies each changed script or plugin and its new version, compatibility requirements, and deployment steps. Shared helpers such as tws_t5_common.gsc have their own versions; document required dependency versions when compatibility changes. A shared helper change alone does not bump its unchanged consumers. Changes to shared build/dependency tooling also bump the plugins they affect.

Versions use MAJOR.MINOR.PATCH: increase the patch for fixes and internal changes, the minor for compatible features, and the major for breaking changes to commands, configuration, native APIs, or data contracts. Reset lower fields when increasing the minor or major. Bump once per logical change; documentation-only and test-only changes are exempt. All 23 scripts and both plugins advance independently.

The initial 1.0.0 versions document the existing source baseline. These TWS versions are separate from upstream revisions in each plugin's upstream.json and the existing native loader plugin_version() value. Component versions identify source changes; consult the changelog for compatible script/plugin combinations and receiver requirements. Maintenance rules are in AGENTS.md.

Release manifest

release.json is the deployment contract for Electric Cherry. It lists all 23 scripts and both native plugin artifacts; documentation, tools, and plugin source files are not deployable entries. The root schemaVersion is 1, and files contains these fields:

Field Meaning
kind script for GSC source, or plugin for a native DLL
name Exact Electric Cherry script/plugin name
game t5 or t6
map Optional canonical map scope; omitted means the whole game
filename Deployment basename, with no directory or traversal segments
versionKey Key in the unchanged, flat versions.json
path Repository-relative GSC file path; present only for scripts
buildArtifact true for plugins, which have no source path

For example, tws_t5_afk maps t5/scripts/tws_t5_afk.gsc to tws_t5_afk.gsc on T5 servers, using versions.json["tws_t5_afk.gsc"]. The tws-t6-gsc-utils entry names tws-t6-gsc-utils.dll and uses the t6-plugin version key. Its buildArtifact: true tells importers to leave it for the manual plugin build/upload workflow until automated builds are available. Never import a plugin's C++ source as its release binary.

Read the manifest, versions, and source files at the same immutable commit. Keep version values only in versions.json, so existing manual upload tooling continues to work. Current entries use game scopes; a future map-scoped entry must use Electric Cherry's canonical map identifier for that game.

Run node tools/check_release.mjs. The CI check loop runs it automatically. It rejects missing scripts or versions, stale version keys, missing source files, unsafe paths, duplicate identities, overlapping deployment targets, and plugin entries that pretend to be source files. Script and plugin versions do not change for manifest-only edits; no game deployment or new runtime dependency is needed.

Continuous integration

The Gitea Actions workflow runs the CI / checks job on every pull request and push to main, using a Linux runner with the ubuntu-latest label and a node:22-trixie-slim container. It runs every tools/check_*.mjs (including the release manifest check), restores both plugins' pinned dependencies, then runs every tools/test_plugin_*.py. The runners stop on the first failure and automatically include new matching checks. The job needs no repository or deployment secrets.

The CI container is limited to 2 GiB RAM (no extra swap) and two CPUs. Native suites run sequentially, with a five-minute deadline and 256 KiB combined output limit each. Exceeding either limit fails the job and kills the suite and its children. ASan and UBSan stop on errors; core dumps are disabled. Debian Trixie provides GCC 14, avoiding the GCC 12 sanitizer startup/log-flood bug on hosts with 32-bit mmap randomization. Local runs should likewise use GCC 14 or a sanitizer runtime with the high-entropy ASLR fixes.

To run the same checks locally on Linux, install Node.js 22 and the native test dependencies, then run from the repository root:

sudo apt-get update
sudo apt-get install -y --no-install-recommends python3 g++ git libcurl4-openssl-dev pkg-config
set -eu
for check in tools/check_*.mjs; do
  node "$check"
done
python3 tools/fetch_plugin_deps.py all
python3 tools/tests/test_plugin_runner.py
python3 tools/run_plugin_tests.py

The plugin tests compile the real portable code against engine shims with address and undefined-behavior sanitizers. AFK component fixtures use separate working directories for T5 and T6 so journal corruption targets the current engine rather than leftover state from the preceding test. node tools/check_structure.mjs checks every .gsc file in both games at file scope: only comments, #include lines and function definitions, every brace, parenthesis and bracket matched, and no function defined twice. The fixture checks run only the functions they can find in a script, so text left between functions by a bad edit would otherwise pass them while the game's compiler rejects the file. It is a structure check, not a compiler. These checks do not build Windows plugin DLLs or validate Plutonium's VM. Windows plugin builds remain manual; the T6 compiler check still needs PowerShell and gsc-tool for T6 PC. Live game validation remains required before deploying gameplay changes.

Building plugins

Plugin source is vendored as regular tracked files so local modifications travel with this repository. Each plugin's upstream.json records its upstream revision and exact Git dependency revisions. Dependencies and build outputs are ignored. The dependency loader replaces upstream's submodule setup; nested upstream .github files are retained for reference and do not run as this repo's CI.

Use Windows with Visual Studio 2022 C++ build tools, a Windows SDK, Git, and Python 3.9+. From a Developer PowerShell with msbuild on PATH, at the repository root:

.\tools\build_plugins.ps1 -Game all -Configuration Release

This restores pinned dependencies, generates both projects, and builds x86 DLLs. Upstream's Premake setup also downloads its MySQL client dependency on first use. Outputs are t5/plugins/tws-t5-gsc-utils/build/bin/Release/tws-t5-gsc-utils.dll and t6/plugins/tws-t6-gsc-utils/build/bin/Release/tws-t6-gsc-utils.dll. Remove the old t5-gsc-utils.dll or t6-gsc-utils.dll before installing the corresponding tws- DLL in Plutonium/plugins/; load only one version per game. Restart the server process; restarting only the map cannot load an updated plugin.

Use python tools/fetch_plugin_deps.py all --check to verify dependency revisions without fetching. Use python3 tools/test_plugin_http.py on macOS/Linux with a C++20 compiler and libcurl development files to compile the real HTTP utilities and test local stalled connections, response deadlines, status reporting and recovery. These portable tests do not build the Windows DLLs or exercise Plutonium's VM. Run python3 tools/test_plugin_component.py to compile the completion/option handling against host engine shims with address and undefined-behavior sanitizers. Run python3 tools/test_plugin_script_strings.py to count script-string references through the real array-key and notify code against a reference-counting engine shim; --git-ref <rev> runs the same cases against older plugin sources.

Both plugins now default to a 5-second connection timeout and 15-second total transfer timeout. Request options can override these with positive millisecond values. Telemetry explicitly sets those limits and logs native HTTP status and timings. See the T5 and T6 plugin notes. Telemetry retries and durable replay require the updated plugins; see the delivery and rollout notes.

Telemetry delivery and rollout (T5 and T6)

Telemetry 1.1.0 also checks tws_end_match every second while reporting is initialized. EC sends set tws_end_match "<match>", using the exact current telemetry match key (not EC's numeric database ID). A matching request during an active match announces Match ended by admin to all connected players and emits the stock end_game notification once. Missing, stale or different IDs, requests before match start, and requests after game over do nothing. Init clears the dvar even when reporting is disabled or configuration/recovery fails; those states do not start the admin watcher. Normal telemetry game-end capture and bank/AFK game-over handlers remain in charge of final stats and settlement. EC's controls require Electric Cherry #214.

Validate on both games and each deployed map before rollout: request the current ID and confirm the normal intermission/next-map sequence, one completed EC match with every player's stats, and normal bank/AFK settlement. Repeat with an earlier match ID and after natural game over; nothing should happen. The portable node tools/check_telemetry.mjs checks use engine shims and do not prove stock map transitions or remote settlement.

Deploy Electric Cherry #144 before these reporters. Replay requires the receiver to associate reports with match and deduplicate seq; the legacy receiver can apply an old end to a newer match. Build and install both updated TWS plugins, restart the server processes, then deploy the corresponding scripts. The new telemetryNewMatch, telemetryLoad, telemetryStore, telemetryRemove and telemetryResponse functions are required even if telemetry is disabled by dvar.

Stat reports now include both score (spendable balance) and score_total (stock cumulative match score) for each player. Deploy Electric Cherry's score_total receiver support before these scripts; older receivers discard the extra field. No additional plugin update is needed for this field. The first stock end_game signal is captured without yielding, before intermission replaces the balance with the total. game_start remains an identity-only roster.

Every heartbeat, round_change and game_end also carries zombieDeaths, the stock match total of zombie deaths by any cause (level.global_zombies_killed in both games), including trap, nuke and other kills credited to no player. A round reached with far fewer credited kills than the round needs can then be checked against the zombies that actually died (Electric Cherry #319). It is a non-negative integer, never lower than an earlier report of the match, and 0 when the stock counter is missing. What the counter includes differs by game; see the T5 and T6 notes. Receivers that predate the field ignore it, and it needs no plugin update.

Every captured report includes a match key (random native process token plus an increasing match counter, at most 64 characters) and a positive seq. game_start is sequence 1. Retries and replay send the exact original JSON; sequence numbers are never reassigned. Player snapshots still reflect capture time; no client timestamp has been added and API receipt times retain their existing meaning.

A single sender keeps game_start and game_end at the queue head on transport failure, native timeout, HTTP 429 or 5xx. Delays are 1, 2, 4, 8, 16, then 30 seconds between attempts, capped at 30 seconds without a retry-count limit. Other 4xx (and redirects) are logged and dropped. A 2xx with a JSON boolean "ok": true acknowledges delivery; empty, malformed or negative 2xx replies and missing HTTP diagnostics are unacknowledged and retried for boundaries. Accepted reports log Electric Cherry's telemetry.timing.matchId as ec_match_id when supplied. Heartbeats and round changes remain best effort. Waiting heartbeats are coalesced to the newest snapshot, preserving round reports and any in-flight request. Intentional coalescing can produce gaps in seq.

The native outbox saves start/end snapshots synchronously before sending, and removes them only after acknowledgment or a terminal HTTP rejection. Files live under fs_homepath/tws-telemetry/t5/ or t6/, scoped to the exact server name and endpoint. Keep this directory on persistent writable storage across process or container restarts; it contains player snapshots but no authorization token. Use a single process per server/endpoint and storage directory. Endpoint/server changes use a separate outbox, so restore the original configuration to replay its backlog. Keep tws_server_id stable between maps. On map/process startup, recovered boundaries precede any new game_start. An accepted report whose acknowledgment/removal was lost is safely replayed with the same identity.

Writes replace the committed file only after a complete temporary write. A storage error blocks the affected boundary before sending and logs an error; unsaved in-memory reports cannot survive a restart. Unreadable/corrupt saved data disables telemetry until storage is repaired and the map restarted, preserving the file for recovery. Each outbox is limited to 4,096 reports / 16 MiB, with individual report bodies below 20 KiB; reaching a limit fails visibly without discarding the saved backlog. Disk removal failures retry cleanup without sending an already resolved report again during the same map. The plugin cannot recover a game_end that was never captured (for example, a process crash during play).

Run node tools/check_telemetry.mjs for both reporters' queue/retry fixtures and python3 tools/test_plugin_telemetry.py for native storage, acknowledgment and process-restart checks with sanitizers. The native test uses each restored JSON dependency; alternatively pass --json-header '/path/{game}-json.hpp' with the single headers from each plugin's pinned revision. These tests use engine shims. Validate Windows DLL linking and both games in Plutonium before rollout: force a timeout/429/503 at start and end, confirm permanent 400/401 failures do not retry, restart a map and then a process with pending boundaries, and confirm their original match IDs complete before the next start. Also verify a 2xx without ok: true stays pending, an outage retains only the latest waiting heartbeat, and a disk failure is visible without advancing past an unsaved boundary.

Parity

T5 and T6 are separate source trees, not a shared library — GSC namespaces, includes, and stock APIs differ enough between the two engines that a shared file is not practical. Feature parity is enforced pairwise: a change landed in t5/ should be considered for a companion change in t6/, adapted to T6 conventions.

Modules currently in each tree:

Module T5 T6
common t5/scripts/tws_t5_common.gsc t6/scripts/tws_t6_common.gsc
hud t5/scripts/tws_t5_hud.gsc t6/scripts/tws_t6_hud.gsc
afk t5/scripts/tws_t5_afk.gsc t6/scripts/tws_t6_afk.gsc
lock t5/scripts/tws_t5_lock.gsc t6/scripts/tws_t6_lock.gsc
telemetry t5/scripts/tws_t5_telemetry.gsc t6/scripts/tws_t6_telemetry.gsc — queued game_start / heartbeat / round_change / game_end matching T5, plus T6-only mapSlug and map_vote for map-pool lobbies
join t5/scripts/tws_t5_join.gsc t6/scripts/tws_t6_join.gsc
bank tws_t5_bank.gsc tws_t6_bank.gsc — persistent shared GUID bank
leaderboard t5/scripts/tws_t5_leaderboard.gsc t6/scripts/tws_t6_leaderboard.gsc
mapvote Not yet ported t6/scripts/tws_t6_mapvote.gsc — next-map vote and idle rotation for map-pool lobbies
awards t5/scripts/tws_t5_awards.gsc t6/scripts/tws_t6_awards.gsc — game-over awards list, solo summary and near-miss line
rank t5/scripts/tws_t5_rank.gsc — chat lines only; BO1 has no clan tag t6/scripts/tws_t6_rank.gsc — Element 115 exposure: connect lines, .rank, clan tag and game-over lines

The T6 map vote ships first; a T5 port is planned once the BO2 map-pool trial shows it helps. See Map-pool lobbies.

Lobby lock voting (T5 and T6)

Lock scripts 1.1.0 add exact, case-insensitive .lock and .unlock chat commands, also listed in .help when the lock module is installed. Since lock 1.3.0, .lock is available from round 1 (it was round 6 onward before; see Solo and co-op games); .unlock is available whenever the server is locked unless an admin owns the lock. Both require a strict majority of the current connected players: 1 of 1, 2 of 2, 2 of 3, or 3 of 4. Dead, spectating and AFK players count equally. Larger lobbies use floor(players / 2) + 1.

Typing the command starts a 60-second vote and casts your vote; teammates type the same command to support it. Solo commands apply immediately. Each connection gets one vote per ballot. Repeats neither add votes nor extend the deadline. Joins and disconnects update the majority; disconnected votes are discarded, and reconnecting does not restore a vote. A smaller roster can pass an ongoing vote with the remaining votes. An expired vote needs fresh votes from everyone. Typing the command for the current state only replies privately; it does not withdraw a vote or cancel an ongoing ballot.

Automatic locking remains at tws_lock_round (default 20) and happens at most once per match. A successful .unlock vote keeps the lobby open for the rest of that match, including when players lock and unlock before round 20. Players can still vote .lock again. An .unlock request while already open does not disable the automatic lock. Automatic locking clears any unfinished manual lock ballot. Each activation generates a fresh g_password; existing players remain connected. Startup and game over clear the password and votes.

Lock scripts 1.2.0 also accept EC admin commands through set tws_lock_admin "<sequence>:lock" or "<sequence>:unlock", checked every 0.5 seconds. Use a fresh nonempty sequence without colons for each action; sequences are opaque strings, and every applied sequence is ignored on replay for the rest of the map, even if its action changes. Malformed values do nothing. Admin actions cancel pending votes. An admin lock applies at any round, is admin-owned until an admin unlock or game over, and refuses player .unlock votes. An admin unlock clears ownership and disables automatic locking even when already open; players may still vote .lock at any round. Everyone sees Server locked by admin or Server unlocked by admin in ordinary message text. Startup and game over clear the admin request and ownership.

The module publishes tws_lock_state as open, auto, vote or admin. This is module-owned output, not a control; direct g_password changes are not tracked. Telemetry 1.1.0 includes optional lock on every captured event when lock 1.2.0+ is installed. It omits the field without that module, including when its dvar remains from a preceding map. Game-end reports use open, independent of cleanup listener order. Retry/replay preserves capture-time state; EC sees updates on the next normal telemetry event (heartbeats every 30 seconds). Deploy Electric Cherry #214 for admin controls and receiver/display support. No new native plugin dependency is required. Copy the matching lock/telemetry scripts and restart the map; no full server-process restart is required for these script changes.

There is no automatic lock prompt. Vote progress and state changes use ordinary message text, with private replies for unavailable/repeated commands; no center-screen popup or recurring reminder is added.

Compatibility: no new dependency requirement; keep the matching common and HUD modules installed (common 1.0.0+, HUD 1.0.0+). HUD supplies round notifications. Copy each updated lock script to its existing game script directory and restart the map. No native plugin update, full server-process restart or other deployment action is required.

Run node tools/check_lock.mjs, node tools/check_telemetry.mjs and node tools/check_hud.mjs for portable vote, lifecycle and help pagination checks. Compile the T6 script using the T6 compiler check. Before rollout, verify on live T5 and T6 servers:

  1. Try .lock in rounds 1 and 6, then both commands with 1–4 players. Confirm the exact majority, instant solo behavior, private duplicate replies and ordinary vote text. Check both commands in .help and .commands.
  2. Let a vote expire, then retry; disconnect a voter, disconnect a non-voter, reconnect and join mid-vote. Verify the current roster and fresh votes count.
  3. Allow round-20 auto-lock, unlock, advance another round and relock. Also lock/unlock early and cross round 20. Confirm a new client is blocked when locked and can join when unlocked; connected players stay in the game.
  4. End the match with a lock or pending vote, then restart the map. Confirm the next lobby is open and old votes cannot change it. Check a custom tws_lock_round and confirm .lock still works in earlier rounds.
  5. Send an admin lock at round 1: confirm new joins fail, connected players stay and .unlock is refused. Send an admin unlock and confirm a newcomer can join, round 20 does not relock, and player voting still works at any round. Repeat a sequence, then repeat an older sequence after a newer action; neither should act again. Confirm game over clears the password, admin request and ownership, publishes open, and EC receives each state.

Solo and co-op games (T5 and T6)

Electric Cherry keeps a solo and a co-op record for each map (Electric Cherry #317): a game is solo only if no other player was ever in it, spectators included. Common T5 1.12.0 / T6 1.11.0 records everyone who connects, lock 1.3.0 lets a player alone lock from round 1 and says it is solo so far, leaderboard T5 1.9.0 / T6 1.10.0 chases the solo record until a second player connects and the co-op record after (and .leaders shows both), awards 1.2.0 uses the category the game ended in for the near-miss, and telemetry T5 1.3.0 / T6 1.4.0 sends allPlayers on game_end. Against an older controller or common the scripts keep the single map record as before. See the solo and co-op guide for the exact lines, fallbacks, response sizes, deployment and live checks.

Player bank (T5 and T6)

Install tws_t5_bank.gsc or tws_t6_bank.gsc alongside the game's common and telemetry scripts (1.0.0 or later). Players can use .b (or .bal, .balance, .bank or .money) to read their balance, .d <amount|all> to deposit spendable points, and .w <amount|all> to withdraw. Configured bank modules register all three commands in .help. Balances are shared by GUID across games and survive map/server restarts. Transfers do not change score_total; bank-assisted matches still count on existing leaderboards.

Deploy Electric Cherry #146 first, then build/install both native plugins 1.2.0 and restart the server processes. The plugins provide bankLoad, bankStore, bankRemove and bankResponse. Removing the bank script is necessary to omit these linking requirements; disabling it by dvar does not avoid linking.

Electric Cherry generates a unique bank token when it prepares a native server instance and injects it through that instance's private electric_cherry_bank.cfg, with tws_server_id supplied by the launch configuration. Both bank scripts 2.0.0 always use https://ec.thewrightserver.net/api/bank; tws_bank_url is no longer read, even if an old configuration still sets it. The host agent's enrolled controller address is independent and continues to serve agent traffic. Agent 1.9.1+ writes only the private tws_bank_token in the bank configuration. Rebuilds and host moves keep the instance token; destroying the instance revokes it. Reusing a server name gets a new token. There is no EC_BANK_TOKENS map or per-server secret to maintain. Keep secrets outside shared scripts and promoted configs. Set tws_bank_enabled 0 to disable the module; restart maps after script/config changes. Electric Cherry's EC_BANK_MAX_BALANCE defaults to 250000 (range 1–1000000). Each transfer and bank-funded spendable balance is capped at 1000000 points.

Transfers require a living player recorded in the server's current telemetry match. Newcomers may wait until the next 30-second heartbeat. The game validates points and player state again after a prepare reply; failed or uncertain prepares leave game points unchanged and cancel the reservation. After points move, a durable commit decision retries settlement without applying them again. A transfer in progress blocks new bank requests on that server. A GUID can have only one prepared transfer across the fleet.

Preserve tws-bank/t5/ and tws-bank/t6/, relative to the game process working directory, across process/container restarts, with one process per server/endpoint directory. EC host agents 1.9.1+ settle pending journals before deleting runtime storage on removal, rebuild, migration or launch cancellation. Update the agents before enabling the bank. An outage or invalid journal blocks cleanup and preserves the files. Decisions are scoped to server name and URL and contain no token. Recoveries run before new bank requests; failed cleanup/replies retry with the original identity. Corrupt storage blocks the bank; failed writes prevent points changes. Restore storage or credentials to finish pending work, rather than deleting the journal. Holds have no automatic expiry. Already-applied withdrawals are match points and are not refunded when a match ends or its process crashes. As with any live score, the journal cannot make game memory and the remote database atomic across a machine/storage failure.

Bank diagnostics — TWS #14

Bank scripts 2.0.2 require their matching TWS plugins 1.2.0+. Startup logs report the script version, the loaded plugin's TWS version via bankVersion(), the effective endpoint, a validated server ID, credential format validation, and the loaded journal count. Credential validation checks the local format; HTTP 401/403 still identifies a credential rejected by EC. A failed journal load logs pending=unknown and disables the bank; invalid configuration reports that journals were not loaded. Server IDs outside the bounded log-safe token alphabet are shown as invalid/unavailable without changing the configured API identity.

Each HTTP attempt receives a local correlation=bank-<map milliseconds>-<counter> for console diagnostics, including .b. These IDs are scoped to a map/process log, never sent to EC, and never replace durable transfer IDs. Balance requests still omit the API request ID and require an empty response ID. Transfer logs also include their original request ID, linking prepare, journal and settlement.

Outcomes distinguish request creation, transport failure, HTTP rejection, missing diagnostics/response, invalid acknowledgment (with a fixed parser reason), request-ID mismatch, unexpected state, and valid application rejection. Available HTTP status, curl code and cumulative DNS/connect/TLS/total milliseconds are included; absent or malformed fields say unavailable. Only allowlisted response codes reach logs; unfamiliar codes say unknown. No token, authorization header, raw response/request body, transport exception or private configuration contents are logged. Existing point accounting, journal format, API payloads, retry delays and player-facing messages are unchanged.

Settlement lines add the durable decision, attempt count, pending seconds, next retry delay, cleanup failures and eventual resolution. Pending time begins when a new cancel decision is attempted; recovered journals measure from this map's load, so downtime is not included. Counters reset on map/process restart. Repeated identical failures per action are summarized at most every 30 seconds, with a suppressed count. Reason/status/code changes and recovery log immediately. Native storage logs similarly identify load/write/remove failures and recovery. Rate-limited attempts retain their correlation internally; only emitted lines appear in the console. No log history or retry metadata is added to the journal.

Build/install both updated DLLs and restart each full server process, then install the corresponding scripts and restart the map if they were copied after startup. bankVersion() is a new linking requirement even when the bank is disabled by dvar. No EC/agent change or new third-party dependency is required; existing bank API, common/telemetry and endpoint-migration requirements still apply. Verify deployed DLL and GSC SHA-256 hashes against the built release artifacts, and confirm startup reports script=2.0.3 plugin=1.2.0 before interpreting results. An old bank script checksum on Ascension was reported in issue #14; deploying only the DLL does not update GSC. No deployment was performed here.

Run node tools/check_bank.mjs --ec-root /path/to/electric-cherry and python3 tools/test_plugin_bank.py. On both T5 and T6, compile/link and test successful .b/deposit/withdrawal, HTTP 401/403, timeout, malformed JSON/schema, wrong response ID, unwritable/corrupt journals and settlement recovery after a map/process restart. Check first/change/recovery logs, 30-second suppression, HTTP timings, unchanged player messages/points and one remote ledger entry per transfer. Keep journal files intact during failure tests. Windows DLL/GSC builds, installed-artifact verification and these live game checks remain required.

Bank identity validation

Bank scripts 2.0.1 use T5's player getGuid() and T6's persistent player.guid, matching each game's telemetry identity source. Both normalize integer identities to strings and preserve existing strings exactly, including large or zero-prefixed GUIDs. Missing or invalid identities show a private "Bank player identity unavailable" message before any request, journal write or score change. GUIDs must meet EC's existing 1–64 character token contract (A–Z, a–z, 0–9, _, ., :, -). Persisted decisions and their retries retain that original string identity, even after the player disconnects.

No new plugin or EC update is required for this fix. Install the updated bank script in each game's script directory and restart the map. This does not repair an older numeric-GUID journal: preserve any such pending decisions and their request IDs for scoped recovery; never delete them to unblock a rebuild. The endpoint upgrade procedure below still applies to legacy URLs.

Run node tools/check_bank.mjs for both scripts' portable fixtures. To also exercise the actual EC bank service and bank migrations with isolated SQLite:

node tools/check_bank.mjs --ec-root /path/to/electric-cherry
python3 tools/test_plugin_bank.py

The optional EC check requires that checkout's installed typescript and better-sqlite3 dependencies. It uses no EC configuration, credentials, network or production database. It covers numeric rejection, normalized balances and transfers, zero-balance .w all, cancellation, and idempotent commit replay. Native checks require the pinned JSON headers as described above. These tests do not validate game VM linking, HTTP route authentication or deployed artifacts.

After deployment, compare the SHA-256 hashes of both installed bank scripts with the source files from this release, and confirm the map restarted. On T5 and T6, check .b, a deposit, a withdrawal, and .w all with zero bank balance (an insufficient-balance message with no point change). Confirm EC records string GUIDs matching telemetry, one ledger entry per completed transfer, and unchanged score_total. On a test server, interrupt settlement and restart the map/process: the original request ID and decision must settle once without reapplying game points. GSC compilation and these live checks remain required.

Upgrading the bank endpoint

Deploy the Electric Cherry agent 1.9.1+ companion to TWS #13 before installing bank scripts 2.0.0. It accepts journals for the public game endpoint and the legacy bank URL derived from that host's enrolled controller. It settles through the existing authenticated, instance-scoped agent API at the controller; it never follows journal URLs and rejects other endpoint identities. The instance token and server identity must stay the same through the upgrade.

If the old tws_bank_url differs from the public endpoint, rebuild the server through EC with agent 1.9.1+ and the new scripts. The agent stops the old process and settles its original commit/cancel decisions before starting the replacement and deleting old storage. A lost reply replays the same request ID; EC deduplicates it. An outage, corrupt journal or failed acknowledgment retains storage and blocks the replacement. Resolve the failure and retry the rebuild. Keep the enrolled controller address unchanged until legacy decisions drain. Do not merely replace scripts and restart the map: native journals are keyed by server and endpoint, so the new scripts cannot see a legacy endpoint's pending decisions. Do not rename, rewrite or delete those journals to force migration.

If the previous endpoint already was the exact public URL, install the scripts and restart the map; saved decisions replay under the same journal identity. No new plugin build or full process restart is required for that case. Other legacy endpoints are refused by the agent and require recovery with their original configuration before switching. No deployment has been performed here.

Run node tools/check_bank.mjs and python3 tools/test_plugin_bank.py. Before rollout, build/link Windows DLLs, compile GSC, and verify both games: help, balance and all commands, score HUD/persistence, max/overdraw errors, death/respawn/disconnect during HTTP, late telemetry, lost prepare/commit responses, disk failures and map/process restart with pending decisions. For this upgrade also verify stale URL settings are ignored, an empty .b shows zero, .w all reports insufficient balance, and an EC rebuild/removal settles legacy and public journals without duplicate ledger entries or lost points.

Core HUD and service window (T5 and T6)

The core uses a light, unboxed layout: match time above round time at the upper left, TWS ZOMBIES | discord.tws.lol centered along the top, and the zombie count centered near the bottom above a slim health bar. The complete N ZOMBIES text uses one centered element at the health track's midpoint, keeping the group centered as the count gains or loses digits. It uses a uniform font scale of 1.25 and shows -- ZOMBIES before data is available. Current/maximum HP appears to the right of the bar only while injured, then disappears at full health. The AFK reserve countdown is independently centered on screen. Text uses an outline for contrast; there are no panel backgrounds or timer labels.

Fullscreen X/Y anchors bypass safe-area insets. Overlay positions and shader widths use the normalized 640 × 480 viewport directly. Text uses a minimum font scale of 1.0. Check the upper-left timers against stock map inventory/objectives and performance overlays, and keep the upper-right service area below the Plutonium tag. Physical proportions vary with aspect ratio, so verify text fit and screen-edge clearance in-game.

The core is created once per connection and stays in place when services open, across death and respawn, and while newcomers spectate. Unavailable values use placeholders until the first-spawn callback binds the data displays. Creation does not start the match clock. Each engine retains its timer behavior; clocks, health and zombie-count displays freeze at game over. Health display fallbacks never modify gameplay max health.

Type .hud in chat to hide or show your core, including its branding, timers, zombie count, health bar and damage-only HP. The AFK countdown stays visible. The exact command is case-insensitive. Visibility defaults on and persists across death/respawn within the current connection/map; reconnecting or restarting the map restores the visible default. Data and timers continue updating while hidden, so showing the HUD restores current values or the frozen game-over values. Help, records and the stock HUD remain unaffected.

On T5 only, the two timers make room for chat lines. BO1 prints iPrintLn chat lines in the upper left, over the timers, so every private chat line the scripts print goes through common's chat_line(player, text): it prints the line and hides that player's match and round timers for five seconds, the engine's line lifetime, extended from the latest line when more arrive. The timers keep counting while hidden and come back at their stored alpha, so .hud hidden stays hidden and frozen game-over text is unchanged. Other scripts reach the helper only through level.tws_chat_line, so with an older T5 common they still load and print, just without hiding the timers. Centre-screen iPrintLnBold messages do not use that corner. BO2 prints chat lines bottom left, so T6 is unchanged.

Common owns one unboxed service area at the upper right. .help and its .commands alias show installed commands in pages of up to nine rows with command and description columns: .help, .hud, .afk, .back, .join, .leaders, .b, .d, .w, .discord, plus registered commands such as .lock and .unlock. Missing modules' commands are omitted. Bank syntax remains .d <amount|all> and .w <amount|all>, and .join identifies its newcomer restriction. Additional registered commands use pages of nine rows; a page count appears only when more than one page is needed. Each page lasts 12 seconds and the list closes after the final page. Repeating either help command restarts page one. Both engines position rows explicitly, avoiding T5's newline-rendering problem.

Records use the same service area, right aligned: Map Record | Round N, followed by every tied holder on a separate line. After a blank row, Your Best | Round N uses the same heading style as the map record, distinct from the holder names. The entire announcement is visible at once for 12 seconds; records have no pages, counter or footer. The initial Type .help for commands hint uses the same private native message area and style as unknown-command replies. Help pauses a visible record and resumes its remaining time when help ends. .leaders during help replaces the pending record with a fresh replay. Round-start reminders use just the record header and one proximity or milestone line for six seconds. They skip busy services; opening help discards a reminder instead of resuming it later. One service is visible at a time. Services remain private and work when the HUD module is omitted.

Both games allocate only the active service view and release it when idle or before switching between help and records. Pages reuse the active view's elements. The core uses 10 archived elements, plus two independent elements for AFK. A nine-row help page uses 19 nonarchived elements, or 20 with a multi-page counter; full records use one element per holder plus the map and personal headings. Hidden elements still occupy slots. Compact reminders use two nonarchived elements. The controller and pending requests are separate from display lifetime, so an idle service holds no HUD elements.

HUD 1.4.2 requires matching common 1.4.0+ and Plutonium r5334+ on both games; T5 HUD 1.4.3 marks the timers for the chat-line window and still needs only common 1.4.0+; they hide for chat lines once T5 common 1.11.0+ is installed. The centered counter uses SetTextUnlimited only when the count changes, avoiding dynamic counter strings in the text config-string pool. Numeric HP still uses SetValue. On r5334+, deploy the updated HUD script and restart the map; no full server-process restart is required. On older Plutonium revisions, update clients and server and fully restart them before deploying. Leaderboard 1.4.1 requires matching common 1.7.0+ for personal records and round-start reminders. AFK 2.0.0 requires plugin 1.4.0+, common 1.4.0+ and the EC reserve service; see the AFK guide. Existing leaderboard plugin requirements still apply. Common retains its older panel helpers for unchanged consumers; the new layout uses fullscreen overlay helpers with the same integer shader-width handling.

HUD validation

Run node tools/check_hud.mjs for portable pagination, service arbitration, reminder rendering, request replacement and cleanup checks, node tools/check_chat_lines.mjs for T5's chat-line window over the timers, and node tools/check_leaderboard.mjs for record data handling and reminder cadence. Run node tools/check_bank.mjs, node tools/check_join.mjs and node tools/check_telemetry.mjs for unchanged command/lifecycle regressions. These checks use engine shims and do not prove GSC VM behavior. Follow the T6 compiler instructions; T5 requires a live Plutonium server because gsc-tool has no T5 backend.

Before rollout, validate both engines in Plutonium:

  1. Check 16:9 and narrower/wider resolutions, safe-area settings, long match timers, stock map inventory/objectives, performance overlays, player scores, ammo and interaction prompts. Check upper-left timers, top-center branding, bottom-center zombies/health and the upper-right service area. Text must stay legible without panel backgrounds; services must clear the Plutonium tag. Verify the health-bar fill stays within its track and damage-only HP clears stock scores/ammo. Check text fit at other aspect ratios because horizontal geometry scales with viewport width. Check 0, 6, 9, 10, 99 and 100 ZOMBIES: the entire text must stay centered over the health track, including after .hud hides/shows it and after game over freezes the count.
  2. Join before spawning, join mid-match, die/respawn and reconnect. Verify one core per player, spectator placeholders, no early match-clock start, correct health/Juggernog changes, and frozen timers at game over. HP numbers must appear only while injured and disappear on full healing. Toggle AFK and back without overlapping zombies/health or changing existing protection behavior.
  3. Open .help, .HELP and .commands with all modules installed. Verify the installed commands including AFK balance/buy, full bank syntax and a page counter and automatic dismissal after 12 seconds. Add custom registered commands to exercise the nine-row page limit, page counter and repeat-to-restart behavior. Remove optional modules and restart the map to confirm filtering, including .hud disappearing without HUD, then restore them.
  4. Interrupt records with help and check that the full announcement resumes for its remaining time. Repeat .leaders while help is open; only the latest replay should start. Check long holder names, all tied holders visible at once, no records, and unavailable records. Repeat without the HUD installed.
  5. Disconnect or end the game while help/records are active, reconnect and request them again. Verify no duplicate elements, stale timeout closures or surviving service windows. Confirm .join, bank commands and lobby lock retain their existing behavior with their required modules installed.
  6. Toggle .hud and .HUD before spawning, during play, while AFK and after game over. Check private visibility, all core elements and the independently visible AFK countdown, continued updates while hidden, and unchanged help/records/stock HUD. Verify death/respawn preserves the choice and reconnect/map restart restores visibility.
  7. On T5, join and watch the welcome lines: both timers disappear while the lines are up and come back about five seconds after the last one, still counting. Repeat with .rank, with .hud off (the core stays hidden after the lines) and at game over (the frozen times come back unchanged).
  8. On T5, watch the first automatic record announcement and its dismissal, then repeat .leaders, help and interrupted/resumed records. Verify the core health bar, damage-only HP, zombie count and timers remain intact while a service is visible and after it closes. Include stock round/connection notifications and other installed HUD mods; portable allocation checks do not establish live T5 SP rendering capacity.

Chat command discovery (T5 and T6)

Common 1.7.0 replies privately to unknown messages starting with . or !: Unknown command. Type .help for the list. It compares the first word with installed modules' registered commands, so .w 2000 and .afk buy 10 are recognized without changing their existing argument handling. Ordinary chat gets no fallback reply. Bang commands are recognized only if registered with !.

.info and .command are case-insensitive aliases for .help; .commands continues to work. Leaderboard 1.4.1 adds .record as an alias for .leaders. Common 1.8.0 declares every alias once, in command_alias, and adds the names players guess most: .records and .leader for .leaders (leaderboard 1.5.0), .return for .back (AFK 2.2.0), and .bal, .balance, .bank and .money for .b (bank 2.1.0). Module listeners and the unknown-command check both read that list, so an alias never also gets the unknown-command reply. Those module versions call command_alias, so install them with common 1.8.0 or later. Aliases use the same exact-message handling as their original commands and add no duplicate help rows. Each alias works only while the module owning its command is enabled; otherwise it gets the unknown-command reply like that command. Without the enabled leaderboard module, .record and .leaders receive the unknown-command reply.

On welcome, Type .help for commands appears once through the same private iPrintLn message area and style as unknown-command replies, after readiness and the five-second welcome delay. It does not wait for record data, occupy a record HUD row, or repeat on manual replay. Install matching common 1.7.1 and leaderboard 1.4.1 scripts together and restart the map. There is no new native-plugin or backend dependency and no full process restart needed.

Common 1.10.0 declares .level, .xp and .exposure as aliases for the rank module's .rank; like the others they work only while that module registered its command.

Common 1.9.0 adds .discord, which privately shows the Discord invite and what the Discord offers, and leaderboard 1.6.0 adds a Discord line to the welcome, right after Type .help for commands and before .join's 10-second hint. Both read common's discord_invite(): tws_discord_invite, or discord.gg/5pzGSTpbv7 by default. That invite is kept apart from the HUD's discord.tws.lol so joins from each can be counted. .discord is registered by common, so it always works, and it leads help's second page. Install common and leaderboard together.

Run node tools/check_commands.mjs, node tools/check_hud.mjs and node tools/check_leaderboard.mjs for portable command and display checks. Live chat/privacy and rendering checks are in the T5 module checks and T6 notes.

Map record announcements

Install tws_t5_leaderboard.gsc for T5 or tws_t6_leaderboard.gsc for T6, along with common 1.7.0+ for that game when using leaderboard 1.4.1. Copy both scripts for each installed game and restart the map. This update adds no native-plugin or backend requirement and needs no full server-process restart when existing leaderboard dependencies are already installed. The module privately announces the current map's fleet-wide highest recorded round, every tied holder and the joining player’s personal best on that map once per connection, including spectator newcomers. Type .leaders to replay both records privately. Personal bests use the same game and exact map variant. Repeating the command restarts the announcement from its first page. It appears in .help when the leaderboard module is enabled. If no usable record is available, the service identifies the record as unavailable; this differs from a valid empty record history. Neither state adds a replay footer. It reads Electric Cherry's public /api/leaderboard endpoint without a token; only completed matches contribute. Ties may come from the same run or separate runs. Names are the API's latest player names, with players identified by GUID.

Both versions default to https://ec.thewrightserver.net/api/leaderboard. T5 discovers the map by engine identifier. T6 selects the exact variant using the active mode/location, so Town Survival, TranZit and Town Grief stay separate. See the game READMEs for plugin requirements and installation paths.

Dvar Default Purpose
tws_leaderboard_enabled enabled 0 disables announcements and requests
tws_leaderboard_url endpoint above Full HTTPS API endpoint, without query parameters
tws_leaderboard_map_key automatic Exact, decoded API map key when automatic selection is unavailable

For example, set tws_leaderboard_map_key "t6:zm_transit:town" explicitly selects Town Survival. Normally this setting is unnecessary. An override must exist in the API's map list and match the current game and engine map. Clear it when changing variants; restart the map after changing these settings. T6 leaderboard 1.7.0+ ignores the override on map-pool lobbies (any lobby with tws_mapvote_pool set) and logs that it did, so records follow the running map instead of filing every pool map under one key.

The announcement starts five seconds after player readiness and waits for the initial map and personal record fetches if necessary. It appears as right-aligned text in the common-owned upper-right service area, all at once:

Map Record | Round 25
Player 1
Player 2
Player 3
Player 4

Your Best | Round 15

Each holder has a separate line. The personal best has its own heading below a blank row and uses the map heading's brighter colour and font size. A confirmed empty personal history shows Your Best | None yet; a failed lookup shows Your Best | Unavailable. There is no background, replay footer, pagination or page counter. The whole view lasts 12 seconds. Opening .help pauses its remaining time until help closes. A .leaders request during help replaces any pending replay and starts a fresh 12-second view after help closes. All holders are included; colour/control codes are removed, and overlong individual names are abbreviated without splitting UTF-8 characters. The window closes when the announcement finishes. Both games release their view elements when idle or changing service kinds, and resize the holder list when a new record has a different number of holders. Disconnect or game end cleans up any remaining service elements.

At round start, reminders become more frequent as the current round approaches the latest usable cached record. The cadence is measured back from that record:

Rounds below the record Reminder rounds
More than 20 None
11–20 At gaps of 20 and 15 rounds
6–10 At gaps of 10, 8 and 6 rounds
1–5 Every round
Record reached Matching-round milestone
First round above the record Overtake milestone, then stop for the match

For a round 50 record, reminders appear on rounds 30, 35, 40, 42, 44 and 45–49, with milestones at 50 and 51. Each uses the existing record header and one short proximity or milestone line for six seconds, without the holder list. Milestones describe the round reached; the new result is recorded only after the match ends. The full join announcement and .leaders retain all holders in one 12-second view. .leaders remains available after the overtake.

Reminders require player readiness and skip players with a pending welcome, help or record view, or a welcome/manual record request in the last 30 seconds. Skipped reminders are not queued. Opening help discards an active reminder. Empty, unavailable and expired snapshots produce no reminders. The existing cache worker supplies all record data; round starts do not trigger HTTP requests. Both games use the same behavior, including with the optional HUD omitted.

One level worker fetches the map list and pages of three players, stopping when the highest-round tie ends. Successful snapshots refresh every five minutes. Failures retry after 30 seconds and retain the last complete snapshot for up to 15 minutes. An empty selection says “No recorded high round yet”; unavailable, malformed or ambiguous results are logged and skipped when no usable cache exists. Partial page results never replace the cache. The API has no pagination snapshot token: changed totals/record rounds reject the refresh, but concurrent renames can still move entries between pages. Refreshes deduplicate GUIDs.

Personal lookups use the existing public endpoint’s q search, scoped to the resolved map key. Search results can match names or partial GUIDs, so only an exact string GUID with matching game/map record evidence is accepted. Successful personal results cache for five minutes per connection; failures cache as unavailable for 30 seconds. Searches paginate in groups of three and stop starting further pages after 15 seconds; incomplete searches are unavailable. A valid empty map history needs no personal request. No backend or plugin update is needed. Round reminders continue to use only the map cache.

Requests have a 15-second GSC wait limit. The TWS plugins also enforce native 5-second connection and 15-second transfer limits. The leaderboard waits for native completion before starting another request. Personal lookups share this request slot with the map worker, with a 15-second queue wait limit. Disconnect, game end and a newer manual replay cancel the waiting announcement; the level collector still drains any native request already started. Responses at the plugins' 20 KiB truncation boundary are rejected. The complete JSON grammar, UTF-8, string escapes and response shape are checked before consuming data. These guards also reject HTML/error bodies. Leaderboard still uses body validation; the new native HTTP status diagnostics are consumed by telemetry.

With Electric Cherry #317 the module shows solo and co-op records instead; see Solo and co-op games.

Run the portable data/structure checks with node tools/check_leaderboard.mjs. They execute the scripts' data helpers with engine-value shims, not a game VM. Live checks: join while playing and spectating; die/respawn (no repeat); reconnect (one new announcement); compare Town/TranZit/Grief; check one holder, multiple tied holders, no records, and a slow/unavailable/malformed API. Check a personal best below the map record, a tied holder, a new player, and two players with different bests. Confirm GUID substring/name matches cannot supply someone else’s record, and unavailable lookups never claim an empty history. Disconnect or end the game mid-announcement and confirm messages stop. Verify existing HUD, .help, .join and telemetry still work. Open .help during a record announcement and check that the record resumes afterwards without overlapping it. Runtime linking and client readiness require Plutonium. Try .leaders and .LEADERS after the announcement ends and while it is visible: each should restart one complete private announcement. Repeat while help is open, then disconnect or end the game during a replay to check cleanup. Disable the leaderboard module and verify .leaders is absent from help.

For reminders, use a known record on each engine and advance through all cadence boundaries, the matching round and the first higher round. Confirm later rounds remain quiet while .leaders still works, including after a cache refresh. Check a record not divisible by five to verify the cadence follows the record. Keep help or a full record open at an eligible round, join immediately before that round, and request .leaders within 30 seconds of it; no reminder should replace those views or appear later as a queued message. Open help during a reminder and confirm it does not resume. Verify six-second dismissal, two-element cleanup on disconnect/game end, and the same behavior without HUD installed. Repeat with an empty or expired cache and compare request logs: eligible rounds must add no HTTP traffic. Live T5/T6 rendering and round-transition validation remain required even when portable checks and T6 compilation pass.

Game-over awards (T5 and T6)

tws_t5_awards.gsc and tws_t6_awards.gsc 1.0.0 tell players how the game went when it ends, in the chat message area (iPrintLn). They use only the match's own stats: no Electric Cherry request, no plugin function and no other script is needed, so they work with every other module removed.

Two or more players took part. Everyone connected sees one list, two seconds after game over:

Most kills: Alice (212)
Most revives: Alice (5)
Best headshot rate: Carol (75 of 150 kills)
Floor Inspector: Bob (9 downs)
  • A line appears only when its top value is above zero, so nobody is named for a zero stat and a lobby with nothing to show sees nothing. The headshot rate needs at least 10 kills and one headshot.

  • Ties: two tied players share the line (Alice & Bob (212 each)); three or more are a counted tie with nobody named (3-way tie (2 each)). A tied headshot rate shows the rate the players share (Alice & Bob (50 headshots per 100 kills each)).

  • The awards cover the players connected when the game ends. Someone who left earlier is not counted, even with more kills, so each line is about the players still there and none speaks for the whole match.

  • The last line is one award for laughs, decided by real stats, from a pool of seven in this order:

    Award Goes to Example
    Floor Inspector Most downs Floor Inspector: Bob (9 downs)
    Tourist Fewest kills, at least one Tourist: Dave (12 kills)
    Canary First player to go down, if still connected Canary: Bob (first to go down, round 3)
    Penny Pincher Most unspent points at game over Penny Pincher: Carol (12450 points unspent)
    Kneecapper Lowest headshot rate, among players with one Kneecapper: Dave (1 headshot in 12 kills)
    Fashionably Late Joined in the latest round, round 2 or later Fashionably Late: Dave (joined in round 9)
    Glass Cannon Most kills and most downs at once Glass Cannon: Alice (212 kills, 9 downs)

    Each game starts from the award after the previous game's and takes the first one the stats support, so the pool rotates. The previous game's award is never offered, so it cannot repeat in two consecutive games on a lobby; when nothing else qualifies there is no joke line. The previous award is kept in tws_awards_last_joke, which survives map changes and is lost only when the server process restarts. A joke needs one clear winner: a tie, a zero stat, or a winner who was on protected AFK for more than half of their time in the match means that award sits the game out. It never passes to a runner-up, which would make the line untrue. Most kills, most revives and best headshot rate are earned and ignore AFK.

One player took part. That player alone gets a summary in place of the awards: Your game: round 14, 212 kills, 88 headshots, 2 downs. A connected player who did nothing the match counted (no kills, headshots, downs or revives) takes no award and does not turn a solo game into a lobby.

Near-miss. Six seconds after the list, each player who took part and came close gets one private line, and nobody else gets anything:

So close: 2 rounds from your best on Kino Der Toten
So close: you matched your best on Kino Der Toten, round 24

It is shown only when the game ended within two rounds of the player's best on this map without beating it. With solo and co-op bests (awards 1.2.0, leaderboard T5 1.9.0 / T6 1.10.0, Electric Cherry #317) the best is the one for the category the game ended in, and the line says which (your solo best, your co-op best); see Solo and co-op games. The best is the number the leaderboard module already looked up for the welcome or .leaders (leaderboard T5 1.7.0, T6 1.8.0); with the leaderboard removed, the lookup failed, or no best on record, there is no line. A map name that is not plain ASCII reads on this map.

Awards 1.1.0 shares its private block with the rank module when that is installed (see Element 115 exposure in game): what the match earned (up to two lines), the near-miss, then any lobby announcement while the block has room. A block is never more than four lines, the player's own first. Announcements that do not fit follow six seconds later; when the map change is too close for that they are left out, with one log line. The block waits for the match result until 14 seconds after game over at the latest. The near-miss stays the best-round one, from the leaderboard's number only: how far a player is from their next rank step is for Electric Cherry to say in its own lines.

Timing. Stock leaves about 20 seconds between the end signal and the map change. The module reads every stat at the first end signal without yielding, as telemetry's game_end capture does, and then only prints: it shares no state with telemetry, sends nothing, creates no HUD element, uses no bold line and does not touch the service area or the intermission length. Each block is at most four lines and the blocks are six seconds apart. On a T6 map-pool lobby the list waits until six seconds after game over, so the vote's Vote for the next map hint has the chat area for its five seconds; the near-miss follows at twelve seconds, before the vote result at 15.5. The vote also answers each vote with a private chat line, so on a map-pool lobby the list is three lines at most: the joke stays and the earned awards give way from the end, the headshot rate first.

Dvar Default Purpose
tws_awards_enabled enabled 0 disables the module at init
tws_awards_last_joke Empty Script-owned: the previous game's joke award, so it is not repeated

Compatibility: no plugin, backend or other script is required. The near-miss needs the matching leaderboard version; older leaderboards simply give no line. Copy the awards and leaderboard scripts for each game and restart the map; no full server-process restart.

Run node tools/check_awards.mjs. It runs both actual scripts with engine shims (a four-player game, ties, a solo game, zero stats, players who left, the rotation and no-repeat rule, the AFK rule, the near-miss thresholds, the block shared with the rank module, the real T6 map vote in the same lobby, a telemetry-style capture on the same signal) and then requires 30 hand-made mutations of each script to fail. It is not a GSC VM. Live checks on a beta lobby are in the T5 and T6 notes.

Element 115 exposure in game (T5 and T6)

tws_t5_rank.gsc and tws_t6_rank.gsc 1.0.0 show a player's rank, which Electric Cherry keeps and serves (josh/electric-cherry#283). EC writes the words; the scripts show them. The scripts never work out a stage, step or tag and read no number from a reply: every rank line a player sees is a line EC sent, shown only if it follows the line rules below. The interface is the contract on that EC issue.

Where What the player sees From
On connect The card's connectLines (up to three), privately, at the top of the welcome block POST /api/rank/card
.rank, .level, .xp, .exposure The card's rankLines (up to four), privately; listed in .help as .rank A fresh card
BO2 clan tag The card's tag, for example IRR2, updated from the match result Card and match result
Game over Each player's lines (up to two) privately, then any lobbyLine to everyone connected The rank field of the game_end telemetry reply

Connect. The card is requested once per connection, in the player's own thread after the connection dispatcher has yielded. The leaderboard's welcome prints one block, about five seconds after the player is ready: the connect lines first, then Type .help for commands and the Discord line, four lines at most (with three connect lines the two hints share one line). A card that has not arrived by then shows no connect lines; the welcome is never delayed. A connect card that failed is tried once more 45 to 60 seconds later. That is the only retry: after a longer outage a player gets their card when they type .rank, or on the next map.

.rank. Fetches a fresh card and shows its rankLines. A card under ten seconds old is reused, a request already in flight is waited for, and a player gets one answer at a time however often they ask. When the fresh card fails, or a request failed for this player in the last 45 seconds, the last card received on this connection is shown; with none, nothing is shown. The command and its help entry exist only while the module can work: with the leaderboard's transport disabled or no bank credential, .rank is an unknown command like any other.

Clan tag (BO2). The tag is set once a card arrives and again when the match result names a new one. A card without a valid tag (one to four letters and digits) removes ours. The plugin overrides the tag on the server for that connection only: a tag the player set themselves is not changed on their client, is hidden while ours is set, and shows again when ours is removed, when they leave, and after a map change until the next card arrives. BO1 has no clan tag function, so it shows the chat lines only.

Game over. The scripts read the match result from the rank field of the reply to telemetry's own game_end report, so game over adds no request. They do not call POST /api/rank/match. The awards module shows the result in its private block (see Game-over awards); without that module the rank module shows the lines itself at the same time. A lobby line is shown whenever EC sends one for a player who is still connected, once per match however often EC repeats it. Players who left before game over are skipped silently. A block is never more than four lines. If no usable result has arrived 14 seconds after game over, nothing is shown; the player's next card reflects the match. Checking a reply takes time (it is read a quarter-kilobyte at a time so it cannot hold up a server frame): a reply near Electric Cherry's 12,000-byte cap takes about 4.7 seconds, so it has to arrive within about nine seconds of game over.

Line rules. A line is shown only if it is 1 to 110 printable ASCII characters, contains no double quote or backslash (the game's message command would cut the line there), and every ^ starts a ^0-^7 colour code. Counts are capped first (three connect lines, four rank lines, two match lines), then lines that break the rules are dropped; nothing else is ever printed in their place.

What counts as a card. A JSON object from an HTTP 200 with at least one field the module knows: a tag that is a string, or connectLines or rankLines that is a list. Beyond that no field is required and unknown fields are ignored. A 200 with none of them, such as an error object, is not a card: one log line, and the player keeps the card and tag they had. The booleans ok and known are not read, because T5's JSON parser drops booleans.

Requests and failures. The only request is the card. It goes through the leaderboard module's single request slot (lb_post): one native request at a time across map records, personal lookups and cards, served in the order they asked, with a 15-second queue wait, a 15-second reply wait, and the native 5-second connect and 15-second transfer deadlines. It is authenticated with the lobby's bank credential (Authorization: Bearer <tws_bank_token>) and always sent to https://ec.thewrightserver.net/api/rank/card; there is no URL dvar. Anything but HTTP 200 with a card in complete JSON (any other status, a transport failure, a slow reply, a body at the 20 KiB truncation limit, bad JSON, a reply that is not a card) means "no card": one log line, nothing shown, and play carries on.

A broken card endpoint cannot keep that slot from the leaderboard:

  • a request that was sent and failed is remembered for its player for 45 seconds, during which .rank asks nothing;
  • after three such failures in a row, across all players, no card is requested for two minutes (one log line), and requests already queued are withdrawn;
  • a request that gave up waiting in the queue was never sent, so it sets no back-off and counts toward no pause; a busy queue is logged at most once in 30 seconds;
  • at map start, when everyone connects at once, cards wait for the leaderboard's first refresh to take its place in the queue, three seconds at most;
  • the slot is a queue: a record refresh that is waiting is served before any card that asks later, keeps its place for up to two minutes, and logs once when it has waited more than 15 seconds;
  • a card is not sent once the game is over, even if it was queued before; that is logged once per map, however often .rank is typed afterwards.
Dvar Default Purpose
tws_rank_enabled enabled 0 disables the module at init
tws_server_id, tws_bank_token Set by EC The lobby's identity and bank credential; without both the module is disabled

Compatibility: rank 1.0.0 needs common 1.10.0+ (the aliases), leaderboard T5 1.8.0+ / T6 1.9.0+ enabled (the request slot, JSON checks and welcome), telemetry T5 1.2.0+ / T6 1.3.0+ (the game_end reply) and awards 1.1.0+ (the shared game-over block); the TWS plugin already deployed provides everything else, including setClanTag on T6. No plugin build. EC must serve josh/electric-cherry#283; until then every card is a non-200 and the game shows nothing. Copy the six scripts for each game and restart the map.

Telemetry T5 1.2.0 / T6 1.3.0 also names a reply it can never acknowledge: a 2xx reply at or above the plugin's 20,480-byte limit is logged with reason=reply_at_size_limit, so a game_end held in the outbox by an oversized reply is recognisable. EC caps its reply well below that.

Run node tools/check_rank.mjs. It runs the actual rank, leaderboard and awards scripts together against stand-ins for the plugin's HTTP and telemetry's reply, then requires hand-made mutations of the scripts to fail. It is not a GSC VM and does not call Electric Cherry. Design notes and live checks are in the T5 and T6 notes.

Telemetry authentication (T5 and T6)

Both reporters default to https://ec.thewrightserver.net/api/telemetry and send Authorization: Bearer <token> plus Content-Type: application/json on every POST. Authentication is also used for retried/replayed reports. An explicit tws_telemetry_url override must also use HTTPS; remove any old HTTP override.

Before upgrading the API or loading these reporters:

  1. Set the Electric Cherry service's environment variable EC_TELEMETRY_TOKEN to a separate shared secret of at least 32 characters. A missing service token disables ingestion.
  2. Both telemetry scripts embed the matching reporter secret in level.telemetry_token. No game-server token dvar or private config is needed.
  3. Keep tws_server_id set to the exact registered server name, then restart the map. Both reporters refuse to start with a short embedded token or a non-HTTPS URL. Rotating the service token requires editing the token in both scripts, deploying them to every game server, and restarting the maps.

The API also accepts X-EC-Telemetry-Token; these reporters use Bearer auth. Cookies, query parameters, and JSON fields cannot authenticate telemetry. Missing or incorrect request tokens are rejected before payload parsing or recording. Reporters that cannot set headers need a trusted relay with an HTTPS reporter-facing endpoint. The plugins used here accept a headers array.

After deployment, verify all four event types reach Electric Cherry. On a test server, also verify that a short embedded token and an HTTP URL prevent startup, that a wrong token is rejected without recording an event, and that deploying the correct token restores ingestion. Plugin transport completion alone does not prove API acceptance; inspect the API response or ingestion records.

Map-pool lobbies (T6)

Electric Cherry can give a T6 lobby a pool of maps instead of one (josh/electric-cherry#276). tws_t6_mapvote.gsc lets players vote on the next map at game over and rotates an empty lobby through the pool. It needs common 1.4.0+; telemetry 1.2.0+ is optional and reports the vote. Lobbies without tws_mapvote_pool are unaffected: no command, help entry or thread.

Dvar Set by Purpose
tws_mapvote_pool EC, pool lobbies only slug,canonicalMap,gameSettingsCfg,Friendly Name entries separated by ;; cfg may be empty
tws_mapvote_idle_minutes EC Minutes with nobody connected before moving on; default 30, 0 never, at most 1440; read live
tws_mapvote_current Script Slug of the running entry
tws_mapvote_next Script The vote's winner, promoted to tws_mapvote_current when it loads
sv_maprotationcurrent Script execgts <cfg> map <canonical> of the chosen entry, loaded by the next map change

EC writes sv_maprotation as the pool in order. Telemetry adds mapSlug to match reports on pool lobbies and sends a map_vote event for each map change. Behaviour, the switching mechanism and live checks are in the T6 README and T6 notes.

Validating T6

powershell -File t6/scripts/tools/check.ps1 -CompilerPath C:\path\to\gsc-tool.exe

Requires PowerShell and gsc-tool (T6 PC).

Player moderation (T5 and T6)

See Moderation runtime for the instance credential contract, policy persistence, command-result limits and deployment validation. New tws_t5_moderation.gsc / tws_t6_moderation.gsc 1.0.0 require the corresponding TWS plugin 1.3.0 and common script 1.2.0. Moderation is optional; without private configuration it stays disabled. Existing bank and telemetry credentials are never reused. Native plugin updates require a full game-server process restart.

Persistent AFK reserves (T5 and T6)

See AFK reserves for commands, gameplay rewards, countdown behavior, recovery, coordinated EC deployment and the required live validation. AFK 2.1.2 requires matching TWS plugin 1.4.0+, common 1.4.0+, telemetry 1.0.0+, Plutonium r5334+, EC #169 (including #151) and host agent 1.12.0+. Full server-process restart is required when installing the updated plugins. Solo and last-active-player AFK are allowed, including all players being AFK together. Upgrading only the AFK scripts from 2.0.0 requires a map restart, with no new dependencies or full server-process restart.

S
Description
No description provided
Readme
7.2 MiB
0 Stars 0 Watchers 0 Forks
Languages
C++ 43.3%
JavaScript 27.6%
GSC 26.1%
Python 1.8%
Lua 1%
Other 0.2%