-
Notifications
You must be signed in to change notification settings - Fork 1
Victory And Endgame Atlas
Canonical developer map for match end detection, winner/loser semantics, client outro flow, win-stat persistence and the patch-ready victory correctness risks. This page turns Deep-review findings DR-11, DR-12, DR-13 and DR-36 into a practical source-backed implementation guide.
All source paths below are relative to Missions/[55-2hc]warfarev2_073v48co.chernarus/.
Victory is a small script with huge consequences. It ends the mission, broadcasts the outro, stops long-running loops, stores AntiStack score deltas, flushes player lists and optionally increments persistent side win counters. A one-line logic mistake here can announce the wrong side, double-fire the endgame, overwrite winner state or permanently skew profileNamespace win statistics.
The important split:
-
Server/FSM/server_victory_threeway.sqfowns default server-side detection and mission shutdown. -
Client/Functions/Client_FNC_Special.sqfreceives the endgame special message and starts the client outro. -
Client/Client_EndGame.sqftreats its input as the losing side and flips it to display winner stats/camera focus. -
Server/Functions/Server_LogGameEnd.sqfis the live win-stat logger. -
Server/PVFunctions/LogGameEnd.sqfis a stale, buggy duplicate that is not registered in the current PVF list.
| Role | Files |
|---|---|
| Global initial state | initJIPCompatible.sqf:84-85 |
| Victory mode fallback constant | Common/Init/Init_CommonConstants.sqf:400-402 |
| Server compile/startup | Server/Init/Init_Server.sqf:64,89,526-529 |
| Victory loop | Server/FSM/server_victory_threeway.sqf:1-88 |
| Live win-stat logger | Server/Functions/Server_LogGameEnd.sqf:7-44 |
| Stale duplicate logger | Server/PVFunctions/LogGameEnd.sqf:7-43 |
| Client special receiver |
Client/PVFunctions/HandleSpecial.sqf:16, Client/Functions/Client_FNC_Special.sqf:61-68
|
| Client outro/camera/failMission | Client/Client_EndGame.sqf:3-89 |
| Common loop stop flags |
gameOver, WFBE_GameOver used across client/server FSMs |
| AntiStack final persistence |
Server/FSM/server_victory_threeway.sqf:51-84, AntiStack database extension audit
|
initJIPCompatible.sqf initializes both gameOver and WFBE_GameOver to false (initJIPCompatible.sqf:84-85). Many client and server loops use one or the other as their stop condition.
Init_Server.sqf compiles the live logger twice, both times to the same file (Init_Server.sqf:64,89). This is harmless today because the second bind overwrites the same code, but it is a maintenance trap and is tracked separately as the DR-43 duplicate-bind cleanup.
After town initialization, the server starts the victory loop:
[] Spawn {
waitUntil {townInit};
[] execVM "Server\FSM\server_victory_threeway.sqf";
["INITIALIZATION", "Init_Server.sqf: Victory Condition FSM is initialized."] Call WFBE_CO_FNC_LogContent;
[] ExecVM "Server\FSM\updateresources.sqf";
};The victory loop is therefore separate from town capture, economy/resources and HQ construction. Town ownership and HQ/factory state feed it, but they do not end the match directly.
server_victory_threeway.sqf reads:
-
_victory = missionNamespace getVariable "WFBE_C_VICTORY_THREEWAY"(:3); -
_total = totalTowns(:4); -
_loopTimer = 80(:6).
Every 80 seconds, when _victory == 0, it checks each present side except WFBE_DEFENDER (server_victory_threeway.sqf:9-46).
For each side _x, it computes:
| Value | Meaning | Source |
|---|---|---|
_hq |
Side HQ/MHQ object from side logic. | server_victory_threeway.sqf:14 |
_structures |
Side base structures. | :15 |
_towns |
Count of towns held by side. | :16 |
_factories |
Count of barracks, light, heavy and aircraft factories found from side structures. | :18-21 |
The current condition is:
if (!(alive _hq) && _factories == 0 || _towns == _total && !WFBE_GameOver) then {Because SQF && binds tighter than ||, this behaves like:
((!alive _hq) && (_factories == 0)) || ((_towns == _total) && !WFBE_GameOver)That means !WFBE_GameOver guards only the all-towns clause, not the HQ/factory elimination clause.
When the condition fires, the server broadcasts:
[nil, "HandleSpecial", ["endgame", (_x) Call WFBE_CO_FNC_GetSideID]] Call WFBE_CO_FNC_SendToClients;The client receives HandleSpecial tag "endgame" and spawns WFBE_CL_FNC_EndGame (Client/PVFunctions/HandleSpecial.sqf:16). That function sets local gameOver = true, WFBE_GameOver = true, converts the side id to a side value and executes Client\Client_EndGame.sqf (Client_FNC_Special.sqf:61-68).
Client_EndGame.sqf then flips the side it receives:
//todo improve that script, _side is the looser.
if (_side == west) then {
_side = east;
} else {
if (_side == east) then {_side = west};
};So the current client payload is semantically "loser side id", not "winner side id." This is easy to misread because the server also writes WF_Winner in the same block. Any patch must pick a single explicit semantic and keep the client, logger and messages consistent.
The client outro:
- runs end-of-game stats for the flipped side (
Client_EndGame.sqf:13); - plays
wf_outro(:14-16); - builds a camera target list from the winner and opponent HQ/structures (
:18-30); - ejects and moves the player near friendly HQ as a safety position (
:40-45); - terminates death camera effects if needed (
:47-52); - runs a camera tour (
:54-86); - calls
failMission "END1"after a short delay (:88-89).
Inside the server victory block, the code writes:
WF_Logic setVariable ["WF_Winner", _x];
...
_side = west;
if (_x == west) then {
_side = east;
};
[_side] call WFBE_CO_FNC_LogGameEnd;The live logger expects its first argument to be the winning side (Server_LogGameEnd.sqf:9-12). It increments profileNamespace key "%1_WIN_CHERNARUS" for that side when WFBE_Server_LogMatchWin is enabled (Server_LogGameEnd.sqf:21-44).
This is correct for a side being eliminated: if _x is the loser, the opposite side should be logged as winner. It is wrong for an all-towns victory: if _x holds all towns, _x is the winner, but the current block still logs the opposite side.
Deep Review DR-11 owns this impact, and DR-36 owns the exact guard/precedence/no-break mechanism.
After gameOver becomes true, the while {!gameOver} loop exits and the tail runs.
If AntiStack is disabled, the script logs that final DB persistence is skipped, sleeps 5 seconds, writes a final RPT line and calls failMission "END1" (server_victory_threeway.sqf:51-57). This disabled-mode shortcut is intentional because the sampling loop is not running; see AntiStack database extension audit.
If AntiStack is enabled, the script:
- iterates
allUnits(server_victory_threeway.sqf:59-82); - for player units, reads current and old score variables by UID (
:61-77); - stores score delta through
WFBE_SE_FNC_CallDatabaseStore(:78); - sleeps
_miniSleep = 0.05per player (:7,79); - calls
WFBE_SE_FNC_CallDatabaseFlushPlayerList(:84); - sleeps 5 seconds, logs and calls
failMission "END1"(:86-88).
DR-36 found the loop cadence/performance posture clean: the victory check itself runs every 80 seconds and the final persistence tail is bounded by player count. The JIP gap is narrow: endgame broadcast and WFBE_GameOver are not replayed to a player who joins in the few seconds before failMission, but the mission is already ending.
Server/PVFunctions/LogGameEnd.sqf is present but is not registered by Common/Init/Init_PublicVariables.sqf. SQF-Code-Atlas already notes the live compile uses Server/Functions/Server_LogGameEnd.sqf.
The duplicate is dangerous archaeology:
- it treats
_thisdirectly as_winnerTeaminstead of_this select 0(PVFunctions/LogGameEnd.sqf:9); - it uses a
profileNamespace getVariableresult as thesetVariablekey (:31); - it reads
WEST_WIN_CHERNARUSandEAST_WIN_CHERNARUSas bare globals instead of string keys (:40-41).
Do not wire this PVF copy. Delete it or mark it retired when doing the victory cleanup.
| Status | Risk | Evidence | Patch direction |
|---|---|---|---|
| P1 correctness | All-towns victory logs the opposite side as winner. |
server_victory_threeway.sqf:23-41, Server_LogGameEnd.sqf:9-44, DR-11. |
Split elimination and all-towns branches or compute winnerSide explicitly per branch. |
| P1 correctness |
!WFBE_GameOver only guards the all-towns clause. HQ/factory elimination can fire again after gameOver within the same side loop. |
server_victory_threeway.sqf:23, DR-36. |
Parenthesize the full condition or compute booleans, then guard the combined result with !WFBE_GameOver. |
| P1 correctness | Side loop has no break after a winner is recorded. Same-tick eliminations can double-broadcast and double-log. |
server_victory_threeway.sqf:12-43, DR-36. |
Exit the side loop and/or outer loop once gameOver is set. |
| Owner decision | Non-zero WFBE_C_VICTORY_THREEWAY skips the only detection block. |
CommonConstants.sqf:401, server_victory_threeway.sqf:3,11, DR-12. |
Implement non-default mode or keep it undocumented/disabled with a clear guardrail. |
| Cleanup | Stale Server/PVFunctions/LogGameEnd.sqf is buggy if ever wired. |
PVFunctions/LogGameEnd.sqf:9-43, DR-13. |
Delete/retire the duplicate and keep the live Server/Functions/Server_LogGameEnd.sqf. |
| Cleanup |
WFBE_CO_FNC_LogGameEnd is compiled twice in server init. |
Init_Server.sqf:64,89, DR-43. |
De-duplicate live binds after or alongside the victory cleanup. |
| Semantics risk | Client endgame script expects loser side, while server variable name WF_Winner implies winner. |
Client_EndGame.sqf:3-13, server_victory_threeway.sqf:24,31-41. |
Pick explicit payload naming and keep server broadcast, client stats/camera and logger aligned. |
Keep the first code patch small and source-first:
- Compute two named booleans:
-
_sideEliminated = !(alive _hq) && _factories == 0; -
_sideWonByTowns = _towns == _total.
-
- Guard both with
!WFBE_GameOver. - Compute
_loserSideand_winnerSideexplicitly:- if eliminated, loser is
_x, winner is the opposite active side; - if won by towns, winner is
_x, loser is the opposite active side.
- if eliminated, loser is
- Send the current client payload as loser side id unless you intentionally update
Client_EndGame.sqfat the same time. - Set
WF_Winnerto_winnerSideif keeping that variable. - Call
WFBE_CO_FNC_LogGameEndwith[_winnerSide]. -
exitWithafter one accepted endgame path so only one endgame broadcast/log can happen per match. - Leave AntiStack final persistence and
failMission "END1"tail unchanged.
Do not combine this with PVF dispatcher hardening or AntiStack DB wrapper hardening unless the branch is explicitly an endgame persistence branch. The match-outcome fix is valuable by itself and easier to smoke.
| Scenario | Expected result |
|---|---|
| West eliminated by dead HQ plus zero barracks/light/heavy/air factories | One endgame broadcast with west as loser; east logged as winner once. |
| East eliminated | One endgame broadcast with east as loser; west logged as winner once. |
| West holds all towns | West logged as winner, not east; client outro still shows correct winning side. |
| East holds all towns | East logged as winner, not west. |
| Same-tick mutual elimination | One winner decision only; no double HandleSpecial ["endgame", ...], no double LogGameEnd, no overwritten WF_Winner. |
| AntiStack disabled | Final DB persistence is skipped cleanly and mission still ends. |
| AntiStack enabled | Player score deltas store/flush once, then mission ends. |
Non-zero WFBE_C_VICTORY_THREEWAY
|
Either implemented and smoked, or explicitly guarded as unsupported so admins do not expect auto-end behavior. |
| Generated propagation | Chernarus source patch reaches Vanilla Takistan through LoadoutManager; modded forks are separately owned. |
Previous: Towns, camps and capture atlas | Next: Server gameplay runtime atlas
Main map: Home | Evidence log: Deep-review findings | Patch order: Hardening roadmap
Home | Agent Guide | Current live state | Release 1.2.2 (B91) | Quickstart | Progress | Lifecycle wait-chain | Join/disconnect | Parameters/build | Assets/config | SQF atlas | PV index | Modules | Support/specials | Commander/HQ | Commander vote/reassign | Construction/CoIn | Construction cleanup | WDDM compositions | Factory/purchase | Upgrades/research | Towns/camps/capture | Victory/endgame | Markers/cleanup | Server runtime | AI runtime/HC | AI commander audit | HC delegation | Town AI safety | Commander reassignment | Resistance supply | Player UI workflow | UI atlas | Respawn/death | Gear template filter | Vehicle cargo loop | Service guards | UI IDD repair | UI design inspiration | WASP overlay | Feature status | Source propagation | release readiness | Tooling readiness | Integration trust | AntiStack DB | Owner decisions | Shelved registry | Abandoned feature revival | Hardening roadmap | PVF dispatch | Server authority | ICBM authority | Attack-wave authority | Telemetry families | AICOM V2 cutover | Consumer port map | Testing workflow | Server ops | Web tools | Ecosystem repos | Arma 2 OA refs | A2 traps | OA compatibility audit | Coverage ledger | Navigation inventory | Pruning ledger | Knowledge roadmap | Agent context | Collab protocol | Worklog | Audit archive 2026-07 | Briefing reference | Utes invasion concept
- Shelved AICOM concepts - revivable someday ideas (owner-shelved 2026-07-03)
Docs rule: source-backed claims only; Arma 2 OA scripting docs only; gameplay edits start in Missions/[55-2hc]warfarev2_073v48co.chernarus.
- Getting started
- Status and coordination
- Agent context
- Agent collaboration protocol
- Agent worklog
- Agent worklog archive
- Progress dashboard
- PR cleanup and integration lab
- Shelved PR #169: gear price double-count
- Shelved PR #194: Chernarus no-trees
- Coordination board
- Codebase coverage ledger
- Bottleneck removal queue
- Current source status
- Wiki mirror reconciliation
- Navigation inventory
- Registers
- Agent orchestration
- Architecture
- Architecture overview
- Mission entrypoints and lifecycle
- Lifecycle wait chain
- Player join/disconnect and AntiStack lifecycle
- Mission parameters/localization/build inputs
- Stringtable localization key-family catalog
- Source inventory
- Content structure and maps
- Assets/config/localization/parameters
- Mission start parameters index
- Code and networking
- Gameplay systems
- Content, reference and catalogs
- Faction unit/vehicle roster catalog
- Auxiliary/SF/civilian unit catalog
- Gear store loadout route catalog
- Upgrade research (cross-faction)
- Gear store price and upgrade catalog
- Gear store catalog (complete, per faction)
- Defense structures catalog
- Artillery reference per faction
- AI squad team templates catalog
- Town AI lifecycle reference
- Town AI group composition catalog
- Class-skill system reference
- Player skill abilities reference
- Default gear template content catalog
- Chernarus map content reference
- Takistan map content reference
- Takistan features
- Takistan parity reference
- Takistan oilfields objective reference
- IRS IR-smoke countermeasure
- Arty module special munitions
- Zeta cargo sling-load reference
- Spawn primitive function reference
- Kill and score pipeline
- Waypoint helper function reference
- Position and proximity function reference
- Side/team state function reference
- Player AI watchdog and recovery
- AICOM stuck-recovery v2
- LoadoutManager data-model contributor guide
- Discord status bot setup and reference
- GLOBALGAMESTATS extension reference
- New player quickstart (player guide)
- Optional client mods (player guide)
- Earning funds and score (player guide)
- Vehicle service and logistics (player guide)
- Commander's handbook (player guide)
- Tactical support menu
- Paradrop player experience
- Supply missions (player guide)
- In-game briefing & Diary field manual
- Playable maps catalog
- Faction root variables reference
- Faction base structures catalog
- Counter-battery radar system
- Bank, Reserve and Artillery Radar structures
- Map ruleset model and object config
- Countermeasures module reference
- Vehicle countermeasure (flares/spoofing)
- UAV terminal and spotter system
- Artillery firing function reference
- Service Point pricing model
- Medic redeployment truck (forward spawn)
- Side-patrol runtime and convoy mechanics
- Day/night cycle and weather system
- Config lookup helper reference
- CIPHER sort utilities reference
- Modded maps status and content
- BattlEye filter setup and OA taxonomy
- Player squad/group join protocol
- AutoFlip vehicle recovery
- Engine stealth fuel toggle
- Valhalla vehicle climbing-assist
- Missile and ordnance Fired-EH reference
- Vehicle equip and rearm reference
- Array and collection utilities
- Server composition spawner reference
- Upgrade queue server loop
- Map boundaries and off-map enforcement
- Namespace/profile/diagnostic utilities
- Group bool getVariable A2-OA trap
- Vehicle weapon balance init
- View distance auto-throttle
- Camp & respawn-camp getters
- Performance audit writer
- Site clearance (bulldozer)
- Factory queue cancel & refund
- AI commander tunable constants
- Experimental feature-flag constants
- Flag system quick reference
- Mission tunable constants catalog
- Gear parsing & cargo capacity
- Structure dressing function
- Paradrop delivery functions
- ICBM nuke client VFX & radiation
- Server HandleSpecial router
- LocalizeMessage chat router
- Gear buy-menu render & price functions
- Server broadcast & telemetry loops
- Per-unit client init pipeline
- Vehicle marking & texture pipeline
- Defense category & budget
- Legacy AI order primitives
- Commander-team driver
- AICOM command verbs
- AICOM behavior fix taxonomy
- AI commander wildcard deck reference
- AICOM aircraft and airfield system
- Static-defense manning
- End-of-game stats screen
- AI commander execution loop
- Deployable bipod / weapon resting
- Town-economy getters
- Server-init deadspawn & airfield probe
- GUER VBIED detonate action
- Resource income-tick engine
- AI commander treasury accessors
- PVF send-helper contracts
- AICOM logging & AICOMSTAT telemetry
- AICOMSTAT v2 event census
- WASPSCALE v2 telemetry
- WASPSCALE v2-ext coverage audit
- Telemetry families reference
- Group lifecycle & entity reaping
- Batch AI spawner orchestrator
- Client funds/income HUD readout
- Server group GC & cap warning
- Town runtime tuning constants
- Client input/hotkey handler
- WASP base-repair system
- WASP DropRPG launcher/ordnance
- CoIn construction-interface client engine
- Town-capture garrison & airfield rebuild
- Map-control & minimap templates
- Client FPS & state telemetry
- Client service-proximity getters
- Airfield-exclusive roster & unit hints
- Unit-camera spectator system
- Town-garrison patrol/defense worker
- RequestTeamUpdate squad-discipline
- Arma2Warfare GPT assistant
- LoadoutManager build configs & defines
- GLOBALGAMESTATS extension logging
- Discord bot instrumented logging
- Eden/Everon & Taviana map content
- Cruise missile strike asset
- AI / HC
- AI headless and performance
- AI mods and pathfinding reference
- Headless client scaling and topology
- AI runtime/HC loop map
- Headless client init and stat loop
- HC delegation target selection
- Player AI caps and role balance
- Old WarfareBE FPS comparison
- AI commander autonomy audit
- Upstream BE 2073 AICOM delta
- Parent 2.073 divergence audit
- AI commander capture & fun plan
- AI commander B69 improvement roadmap
- AI commander B69 implementation sketches
- AICOM V2 cutover status
- Headless delegation and failover
- Commander reassignment call shape
- GUER Director living-resistance pitch
- Quality and operations
- Foundation perf findings & Tier-3 dead-ends
- Dead/stale code register
- Commander vote/reassignment
- Attack-wave authority
- Server runtime and operations
- Server ops runbook
- JIP enrollment & client data delivery (b74.2 lessons)
- Server gameplay runtime atlas
- PerformanceAuditAnalyzer
- Performance opportunity sweep
- Documentation plan
- Knowledge platform roadmap
- Wiki quality audit
- Wiki pruning and relevance ledger
- Audit findings queue (2026-06-03)
- Deep review findings
- Client UI / server-loop perf findings
- Performance gain simulation
- Self-host testing field notes
- Cleanup and work lanes
- Hardening and authority
- UI / player workflows
- Client UI, HUD and menus
- UI HUD and dialogs
- Player UI workflow map
- Client UI systems atlas
- UI IDD collision repair
- UI control class library reference
- UI theme palette and style macros
- UI design inspiration 2026-07
- Available-actions client gate FSM
- Gear/loadout/EASA atlas
- Gear template profile filter
- Vehicle cargo equip loop bounds
- Factory and purchase systems atlas
- Service menu affordability guards
- WASP overlay
- Class-skill system reference
- Skin selector and class swap
- Earplugs audio toggle
- Mission audio catalog
- HQ radio knowledge-base catalog
- QoL trio player hints
- Player vehicle/travel actions
- Tooling / release / integrations
- Tools and build workflow
- Warfare web tools
- Ecosystem & companion repos
- Zargabad tooling parity
- July 2026 release readiness
- Operator monitor and CPU affinity tools
- Tooling release readiness audit
- Source fix propagation queue
- Agent release readiness ledger
- Release source intake map
- Testing/debugging/release workflow
- Current RPT release gate
- RPT telemetry consumer port map
- External integrations
- Integration trust boundary audit
- AntiStack database extension audit
- Community & Dev
- Community & Dev
- Miksuu upstream wiki import / archive index
- Upstream changelog feature leads
- Developer history and upstream lessons
- Upstream Miksuu commit intel
- Upstream mining ledger
- Archive script mining v2
- Upstream BE 2073 AICOM delta
- Parent 2.073 divergence audit
- PR8 and Drone upstream lesson match
- Development lessons learned
- External research reports
- Audit archive 2026-07
- Briefing reference
- Utes invasion concept
- Miksuu archive: Home
- Miksuu archive: Welcome
- Miksuu archive: Big announcements
- Miksuu archive: Changelog
- Miksuu archive: Development process
- Miksuu archive: Discord bot
- Miksuu archive: Gameplay videos
- Miksuu archive: LoadoutManager
- Miksuu archive: Chernarus script architecture
- Base-game visual catalogs
- Compatibility and references
- HC upstream history and lessons
- Player stats branch audit
- BuyMenu EASA QoL branch audit
- Perf quick wins branch audit
- Commander positions branch audit
- Zargabad branch audit
- Quad AI Commander concept
- Arma 2 OA external reference guide
- Base-game config & image reference
- Arma 2 OA compatibility audit
- Arma 2 OA agent traps reference
- Arma 2 OA command versions
- Wiki source consistency
- External Arma 2 OA reference index