Skip to content

JIP Enrollment And Client Data Delivery

rayswaynl edited this page Jun 24, 2026 · 5 revisions

JIP Enrollment And Client Data Delivery (b74.2 lessons)

How a joining player gets their team, cash, commander‑vote roster and own‑side map markers — and the hard A2‑OA limitations that made the long‑standing "join a team but have no cash / no markers / not in the vote menu = mission unplayable" bug so stubborn. Captured after it was finally fixed in b744 (June 2026) following five failed attempts. Read this before touching anything on the JIP/enrollment path.

The symptom

A player who joined a team (from the lobby or mid‑game) could end up with:

  • no funds in the HUD,
  • no own‑side map markers (team arrows / factories),
  • missing from the commander‑vote roster (only "No Commander" shows),

i.e. effectively unable to play. World/AICOM markers eventually appeared; only the player's own enrollment failed. It hit WEST and EAST (not GUER‑specific) and got worse under heavy AI load / low server FPS.

Root cause (the thing that took 5 tries to see)

The client's team roster comes from the side‑logic object variable wfbe_teams, set on the server with the broadcast flag: WFBE_L_<side> setVariable ["wfbe_teams", _teams, true] (Server/Init/Init_Server.sqf). _teams is an array of GROUP OBJECTS.

In Arma 2 OA 1.64 this has two fatal properties for a late joiner:

  1. Object setVariable [..., true] is NOT JIP‑durable. A broadcast performed before a client connected is not stored‑and‑replayed to it. Re‑setting the same value on connect (a "mark dirty" re‑broadcast) is unreliable under load — the side‑logic object itself is slow/never to fully sync to the joiner.
  2. Group objects do not survive the wire to a machine that did not create them. Even when the array eventually arrives, the group handles inside it deserialize to broken / null refs on the client. Every consumer reads through those groups — the vote menu (isPlayer leader (WFBE_Client_Teams select i), name leader …), the own‑team marker FSM (getPos/getDir/leader on each group). With broken groups the roster shows nothing and the arrows never draw.

Why the earlier fixes failed: B56 (bounded loading wait), B62/B64 (120 s reconciliation), and the B74.2.4 persistent heal (poll every 2 s for 30 min) all read the same dead channel_logik getVariable "wfbe_teams". They differ only in how long they wait. But the failure is not a timing problem you can wait out: the channel does not deliver to a late joiner and the payload type (group handles) is non‑portable. A real capture confirmed it: CLIENTTEAMS|EARLYHEAL|side=EAST|count=17|at=670s — the array "arrived" at 11 minutes, full of broken refs, player still saw nothing.

The fix (b74.2.5 / b744)

Stop fighting the un‑deliverable channel. Deliver primitives over the channel A2‑OA does guarantee to a connected client — the same one the B63 marker feeds already use successfully:

  • Server, on connect (Server/Functions/Server_OnPlayerConnected.sqf, where _id and _sideJoined are valid; gated to west/east which are the only sides with a commander vote): build a per‑side primitive roster — per player‑led team [name leader, isPlayer(0/1), funds, str group] — set it into a side‑keyed missionNamespace var WFBE_JIP_ROSTER_<SIDE> and _id publicVariableClient it. Strings/numbers replicate cleanly; no group handles go over the wire.
  • Client, EARLY (initJIPCompatible.sqf Part I, before the B56 wait and before Init_Client): an addPublicVariableEventHandler for the WEST/EAST keys stores the payload into WFBE_JIP_ROSTER_PRIMS, plus a one‑shot poll that adopts a value that landed before the EH installed (a publicVariable target persists in missionNamespace).
  • Vote menus (GUI_VoteMenu.sqf, GUI_Commander_VoteMenu.sqf): render rows from the primitive cache when no live player‑led team exists, and gate every per‑tick refresh loop behind a …_USING_PRIMS flag so they never prune/blank the primitive rows. Hand over to live groups (one lnbClear+rebuild) the moment a live player‑led team appears, so vote casting still maps to real group objects.
  • Cash was already fineGetPlayerFunds reads (group player) getVariable "wfbe_funds", the player's own (local) group, which the server stamps broadcast at connect. Don't touch it.
  • Markers keep upgrading automatically: the existing heal rebinds clientTeams to live groups when they finally replicate, and the marker FSM redraws. Marker geometry genuinely needs live objects, so it is not accelerated — that degrades gracefully (roster + cash arrive fast; arrows fill in on heal).

Outcome the player sees: cash within seconds, a stable vote roster within seconds (CLIENTROSTER|RECV|key=WFBE_JIP_ROSTER_WEST|rows=N on the client RPT is the proof), markers + casting as the live groups settle.

Reusable rules

  1. A2‑OA JIP data delivery. Object setVariable [...,true] is not replayed to a client that joined after the set, and group/object handles arrive broken on a client that did not create them. To get side/global state to a JIP client reliably, push primitives with publicVariableClient to that client on connect (onPlayerConnected, _id is the target), and rebuild UI from the primitives. Never expect a JIP client to read live group handles out of a broadcast var.
  2. count nil is 0 (safe); forEach nil THROWS. A global read with no default (missionNamespace getVariable "X") is nil when unset. for _i from 0 to count X - 1 is safe (count nil = 0), but {...} forEach X over nil is a runtime error. Default such arrays to [] (getVariable [name, []]) before any forEach.
  3. Client‑facing changes REQUIRE a new PBO filename. See the deploy note below — this is the reason four correct fixes looked like they "did nothing."
  4. Diagnose from the CLIENT RPT. Client script errors never appear in the server RPT. WFBE_CO_FNC_LogContent ([INITIALIZATION]/[WARNING]) is filtered out on public builds (WF_LOG_CONTENT off in version.sqf) — use raw diag_log for production telemetry. The markers added for this bug: server TEAMREG|side=…|registered=N, ROSTER-PUSH; client CLIENTROSTER|RECV/POLL-ADOPT, CLIENTTEAMS|atInit/EARLYHEAL/WAIT.
  5. Verify before deploy. Multi‑agent adversarial review caught two ship‑blockers in the primitive design that single‑pass authoring missed: pushing group objects (still broken on JIP) and an ungated 0.05 s vote loop that blanked the primitive names + threw nil getVariable every tick. Root‑cause + fix were both wrong on earlier passes; verification is not optional on the join path.

CRITICAL deploy lesson — bump the PBO name for client changes

The single biggest time sink: in‑place hotfixes (same PBO filename) do not reach clients. Arma 2 OA caches downloaded missions by filename in the client MPMissionsCache; when the server's PBO content changes but the filename stays the same, clients re‑download unreliably and usually reuse the stale cache. The server picked up every b74.2.x fix (verified in the deployed PBO + server RPT), but the player's client kept running the stale cached b742aicom — so every client‑side fix was invisible and the bug "persisted" through multiple deploys (the client RPT had zero of the new telemetry).

The repo's whole version history (…b55, …b56, … …b742aicom) uses a distinct filename per build for exactly this reason. The fix that finally reached the client was renaming b743aicomb744aicom.

Rule: any change touching client‑side scripts (Client/*, Init_Client.sqf, GUI, marker FSMs — anything the player's machine runs) MUST deploy under a new PBO filename and repoint the server.cfg mission template, with the PBO prefix set to match. Server‑only changes (Server/*, HC AICOM logic) do take effect in‑place on a restart. When in doubt, bump the name. Deploy mechanics that bit us:

  • Stop the service before editing server.cfg — it is file‑locked while the server runs (Set-Content fails with "being used by another process"). Stop → edit → restart.
  • The deployed PBO path contains [brackets]; use literal‑path file copy ([IO.File]::Copy), not wildcard‑expanding Copy-Item/Get-Item, or the copy silently no‑ops.
  • The restart wrapper runs a ~5‑minute headless‑client reseat dance and archives the RPT — don't race it with concurrent polls; wait for a new "RESTART DONE" marker.
  • Boot‑smoke = MISSINIT reads the new build name + ErrInExpr=0. Confirm the fix reached the player by checking the client RPT for the new telemetry, not just the server RPT.

See also: Server Ops Runbook, Developer History And Upstream Lessons, Client Marker FSM Updater Map, AI Commander Logging And AICOMSTAT Telemetry.

Sidebar

Clone this wiki locally