Ranked deployment
=================

Use the standard x86 IW4x package from this repository's installer. The Ranked
extension is a source patch against official iw4x-client revision
d1b175da1a25d31043246de103a702b206269e5a. It must be installed on BOTH players'
clients and dedicated servers. This is not an x64 IW4x(MM) build.
Windows is the primary player platform. Linux through Wine is optional and
also used for running multiple background QA clients.

Players
-------
Run the new installer, or back up iw4x.dll and userraw/z_cordite_menu.iwd and
copy the corresponding files from the test build. Start iw4x.exe directly.
The stock updater may overwrite the patched DLL; reapply this build afterward.
Do not copy server scripts, bridge secrets or databases into player packages.

Register (between Options and Quit) opens https://zeal.family with a short-lived
proof of the client's IW4x identity. Choose a username once. Registered accounts
are required for Ranked, and registered names are authoritative in parties and
on the game server. A local nickname or a copied GUID cannot register or join
on behalf of another identity. See ACCOUNTS.txt for deployment and recovery.

After account verification, Ranked opens the installed game's original party pre-lobby: Find Match,
Create a Class, Callsign & Killstreaks, Barracks and Invite. The two-slot
party stays here until its leader selects Find Match. Inside Invite, use the
friend list or share the eight-character code for JOIN BY CODE. Steam is
optional for the code flow. Searching assigns both clients to the same
configured server. A duo that cannot obtain two seats waits. A partial duo
cannot start as a solo.

The Obsidian badge below the party menu shows the local player's earned rank.
Until five rated results are committed, it shows the neutral question-mark
badge and "N/5 placement matches completed". Warmups and cancelled matches do
not count. The fifth result replaces it with the earned Bronze-Diamond badge
and Elo. Division III is lowest; I is highest. Each duo member sees their own
profile. The panel refreshes with lobby polls, including after returning from
a match. An unavailable service shows "Rank unavailable", never a false 0/5.

The server runs its existing FFA warmup while the Ranked queue fills. Players
initially see the original game search lobby with eight slots and the upcoming map
and mode. RB + RT toggles playable warmup and this search view; F6 does the same
on keyboard. The shortcut appears at the bottom in both views. Neither view
change disconnects, cancels search, changes the roster or splits the party.
The chord is consumed before controller weapon/grenade dispatch and requires
both controls to be released before reuse. Ranked disables the old grenade
double-tap queue action. The rated map automatically closes the search view
and disables the warmup shortcut. Select a class to become match-ready.

Only whole, verified parties count. At eight ready players a 15-second countdown
starts and resets if readiness falls. Teams are automatic, four per side,
with every duo intact. The match map also waits for all eight to load onto
their assigned teams. A timeout returns to the waiting lobby without starting
a short match; the admin !go command cannot bypass this requirement.

Captains and all pre-match votes are bypassed. The active modes are HQ,
Domination, regular two-flag CTF and Sabotage. One-Flag CTF code remains, disabled
for now. The existing _map_define_folders() list supplies maps; missing maps
are excluded. comp_ranked_maps may explicitly restrict that existing pool.

Services and servers
--------------------
Python 3.10+ with the account and voice dependencies. From the repo root:

  python3 -m pip install -r zeal_accounts/requirements.txt -r ranked_lobby/requirements-voice.txt
  python3 -m zeal_accounts.service --config /private/accounts.json
  python3 -m rating_service.service --config /private/rating.json
  python3 -m ranked_lobby.service --config /private/lobby.json

Copy the respective service.example.json files into private storage. Initialize
the rating database deliberately as described in RATINGS.txt. Give each server
a stable ID and separate random authentication secrets using the enrollment
command in CENTRAL-OPERATIONS.txt. The client receives the current server pool
from MS-02 over HTTPS; servers.json contains the service URL and no fixed hosts.
The lobby's registration.database must point to the account service's local
SQLite file. Start the account service first; a missing account database or
failed account proof prevents new Ranked admission. Never share SQLite across
machines or expose it to clients. The game VPSs only need their existing bridges.

Set the private lobby config's "ratings" object to the central rating API's
origin ("url") and its separate read-only credential ("token"). The
lobby reads /v1/profile; credentials remain only on the service host. It does
not write ratings or advance placement counters. This works with the same
central API when game servers move to separate VPSs. Missing/failed profile
configuration leaves matchmaking operational and displays rank unavailable.

For EACH game process, use separate game/userraw/scriptdata and configs:

  python3 -m rating_service.bridge --config /private/rating-bridge.json
  python3 -m ranked_lobby.bridge --config /private/lobby-bridge.json

The lobby bridge sends authenticated presence and writes party-membership
caches. The dedicated server matches each connection's actual IW4x GUID AND
its opaque lobby token before trusting a duo. A stale bridge stops queue
admission. Lobby state is ephemeral; a service restart requires affected
frontend parties to recreate/rejoin their lobby. Ratings remain persistent.

Deploy all scripts/mp together and the native DLL. Retain the original package's
Bot Warfare dependencies because the repository loads them; Ranked disables
bot filling and bots never count toward eight. Do not deploy tests/native.
Use the server_configs templates, own RCON credentials, comp_ranked_auto 1,
comp_elo_backend service, and separate ports per game process. Supervise both
services, both bridges, and the game process with systemd or equivalent.

MS-02 and public Psychz instances
--------------------------------
Accounts, friends, parties, matchmaking, shared ratings, moderation, the website
and the voice relay remain on MS-02. Cloudflare Tunnel serves zeal.family,
ranked.zeal.family and results.zeal.family over HTTPS. Lobby/results origins
also use validated TLS and bind only to loopback. Configs are /etc/zeal;
account/registry data is /var/lib/zeal/accounts.sqlite3, and ratings are in
/var/lib/zeal-ratings/ratings.sqlite3. Sources/venv are /opt/zeal-ranked.
The existing unit names retain iw4x-qa- inside the iw4x-qa Incus container.

Game endpoints are 108.181.132.237:28960/28961 and 108.181.132.159:28960/28961.
The old MS-02 LAN game is offline in the registry. Public voice uses
108.181.132.237:29901, forwarded over a restricted WireGuard link to the relay
on MS-02. The game, bridges, lobby, ratings, website and tunnel run as limited
users. No central database or staff credential lives on a game host.

Psychz hosts run game instances and their two bridges. Enroll one ID per
instance centrally, transfer its private bridge configs, and start it. The
pool refreshes automatically on clients. No menu/installer rebuild is needed.
An instance is unavailable until its bridge reports fresh actual game presence;
stale instances stop receiving new reservations after five seconds. Staff can
drain an instance while its existing match finishes. See CENTRAL-OPERATIONS.txt
for enrollment and credential rotation, and PSYCHZ-HOSTING.txt for the public
host layout, adding instances, voice forwarding and maintenance.

Discovery uses the stock getInfo challenge/reply and Party::Connect transport,
restricted to the configured pool. It prefers a waiting lobby with more
queued players, then lower ping. The service atomically reserves one or two
seats. It is a custom pool service, not a redirection of the public IW4x(MM)
matchmaking backend. Existing map/round/respawn rules are reused.

Discord is not required for joining, invites, queueing, ratings, leaderboards
or installation. Optional !link remains off unless an operator separately
configures its responder. No Discord account or promotion is required. The Zeal
GUID registration gate is mandatory and independent of Discord.

Ranked Voice v2
---------------
Follow VOICE.txt for the added Python dependency, UDP relay port, HTTPS/TLS
configuration and coordinated client/server/bridge update. Voice activation
is the default. Both the player DLL and menu must be updated together.
