From 3eb1cd89051d053c6558d11de787c89b1aefd943 Mon Sep 17 00:00:00 2001 From: Yethe Samartaka Date: Sat, 22 Aug 2026 15:30:24 +0200 Subject: [PATCH 1/5] feat(recorder): improve automatic recording lifecycle Added: - Auto-restart and connection event buffering - New CBA settings to configure everything these changes are touching Changed: - Player counting and Steam ID handling --- addons/recorder/XEH_preInit.sqf | 105 ++++++++++++++++++ addons/recorder/XEH_prep.sqf | 4 + addons/recorder/fnc_autoRestartMonitor.sqf | 29 +++++ addons/recorder/fnc_eh_connected.sqf | 12 +- addons/recorder/fnc_eh_disconnected.sqf | 10 +- .../fnc_flushPlayerConnectionEvents.sqf | 38 +++++++ .../recorder/fnc_getAutoStartPlayerCount.sqf | 26 +++++ addons/recorder/fnc_init.sqf | 17 ++- .../fnc_recordPlayerConnectionEvent.sqf | 45 ++++++++ addons/recorder/fnc_startRecording.sqf | 5 + 10 files changed, 273 insertions(+), 18 deletions(-) create mode 100644 addons/recorder/fnc_autoRestartMonitor.sqf create mode 100644 addons/recorder/fnc_flushPlayerConnectionEvents.sqf create mode 100644 addons/recorder/fnc_getAutoStartPlayerCount.sqf create mode 100644 addons/recorder/fnc_recordPlayerConnectionEvent.sqf diff --git a/addons/recorder/XEH_preInit.sqf b/addons/recorder/XEH_preInit.sqf index 4f6616d..fe3f516 100644 --- a/addons/recorder/XEH_preInit.sqf +++ b/addons/recorder/XEH_preInit.sqf @@ -62,6 +62,86 @@ GVAR(allSettings) = [ false // requires restart to apply ], + /* + CBA Setting: OCAP_settings_excludeHeadlessClientsFromAutoStart + Description: + Exclude headless clients when counting players for automatic recording start and restart. Default: true + + Setting Name: + Exclude Headless Clients + + Value Type: + Boolean + */ + [ + QEGVAR(settings,excludeHeadlessClientsFromAutoStart), + "CHECKBOX", + [ + "Exclude Headless Clients", + "Exclude headless clients when counting players for automatic recording start and restart. Default: true" + ], + [COMPONENT_NAME, "Auto-start Settings"], + true, + true, + {}, + false + ], + + /* + CBA Setting: OCAP_settings_autoRestartAfterEmpty + Description: + Automatically start a new recording after an empty-server auto-save once the minimum player count is reached again. Default: true + + Setting Name: + Auto-Restart After Empty Server + + Value Type: + Boolean + */ + [ + QEGVAR(settings,autoRestartAfterEmpty), + "CHECKBOX", + [ + "Auto-Restart After Empty Server", + "Automatically start a new recording after an empty-server auto-save once the minimum player count is reached again. Default: true" + ], + [COMPONENT_NAME, "Auto-start Settings"], + true, + true, + {}, + false + ], + + /* + CBA Setting: OCAP_settings_bufferPlayerConnectionEvents + Description: + Buffer player connect and disconnect events before a recording starts, then replay them at frame 0. Default: true + + Setting Name: + Buffer Player Connection Events + + Value Type: + Boolean + */ + [ + QEGVAR(settings,bufferPlayerConnectionEvents), + "CHECKBOX", + [ + "Buffer Player Connection Events", + "Buffer player connect and disconnect events before a recording starts, then replay them at frame 0. Default: true" + ], + [COMPONENT_NAME, "Auto-start Settings"], + true, + true, + { + params ["_value"]; + if (!_value && {!isNil QGVAR(connectedPlayerNamesBuffer)}) then { + GVAR(connectedPlayerNamesBuffer) = []; + }; + }, + false + ], + // Section: Core @@ -216,6 +296,31 @@ GVAR(allSettings) = [ // Section: Extra Tracking + /* + CBA Setting: OCAP_settings_includeSteamIdInPlayerConnectionEvents + Description: + Include the player's Steam ID as the fourth value in connected and disconnected events. Default: true + + Setting Name: + Include Steam ID in Connection Events + + Value Type: + Boolean + */ + [ + QEGVAR(settings,includeSteamIdInPlayerConnectionEvents), + "CHECKBOX", + [ + "Include Steam ID in Connection Events", + "Include the player's Steam ID as the fourth value in connected and disconnected events: [frame, action, name, id]. Default: true" + ], + [COMPONENT_NAME, "Extra Tracking"], + true, + true, + {}, + false + ], + /* CBA Setting: OCAP_settings_trackTickets Description: diff --git a/addons/recorder/XEH_prep.sqf b/addons/recorder/XEH_prep.sqf index a967ea6..4b56d9b 100644 --- a/addons/recorder/XEH_prep.sqf +++ b/addons/recorder/XEH_prep.sqf @@ -6,6 +6,8 @@ PREP(updateTime); PREP(startRecording); PREP(stopRecording); +PREP(autoRestartMonitor); +PREP(getAutoStartPlayerCount); PREP(captureLoop); PREP(isKindOfApc); PREP(getClass); @@ -18,6 +20,8 @@ PREP(addUnitEventHandlers); PREP(eh_connected); PREP(eh_disconnected); +PREP(recordPlayerConnectionEvent); +PREP(flushPlayerConnectionEvents); PREP(eh_onUserAdminStateChanged); PREP(adminUIcontrol); diff --git a/addons/recorder/fnc_autoRestartMonitor.sqf b/addons/recorder/fnc_autoRestartMonitor.sqf new file mode 100644 index 0000000..162ea5d --- /dev/null +++ b/addons/recorder/fnc_autoRestartMonitor.sqf @@ -0,0 +1,29 @@ +/* ---------------------------------------------------------------------------- +FILE: fnc_autoRestartMonitor.sqf + +FUNCTION: OCAP_recorder_fnc_autoRestartMonitor + +Description: + Periodically checks whether a recording auto-saved because the server became + empty and starts a fresh recording after the player threshold is met again. + +Returns: + Nothing + +Public: + No +---------------------------------------------------------------------------- */ + +#include "script_component.hpp" + +if (!EGVAR(settings,autoRestartAfterEmpty)) exitWith {}; +if (!GVAR(autoRestartAfterEmptyPending)) exitWith {}; +if (GVAR(recording) || {!isNil QGVAR(startTime)}) exitWith {}; +if (getClientStateNumber <= 9) exitWith {}; + +private _playerCount = call FUNC(getAutoStartPlayerCount); +if (_playerCount < EGVAR(settings,minPlayerCount)) exitWith {}; + +GVAR(autoRestartAfterEmptyPending) = false; +INFO_1("Auto-restarting recording after empty-server save; eligible players: %1",_playerCount); +call FUNC(startRecording); diff --git a/addons/recorder/fnc_eh_connected.sqf b/addons/recorder/fnc_eh_connected.sqf index a0e8210..6669b91 100644 --- a/addons/recorder/fnc_eh_connected.sqf +++ b/addons/recorder/fnc_eh_connected.sqf @@ -31,15 +31,9 @@ params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"]; // skip for server 'connected' message if (_owner isEqualTo 2) exitWith {}; -// log to timeline -[":EVENT:GENERAL:", [ - GVAR(captureFrameNo), - "connected", - _name, - [createHashMapFromArray [ - ["playerUid", _uid] - ]] call CBA_fnc_encodeJSON -]] call EFUNC(extension,sendData); +// Log immediately during an active session, otherwise preserve the event for +// frame 0 of the next recording. +["connected", _name, _uid] call FUNC(recordPlayerConnectionEvent); // trigger admin control check for all connecting players [_idstr, "connect"] call FUNC(adminUIcontrol); diff --git a/addons/recorder/fnc_eh_disconnected.sqf b/addons/recorder/fnc_eh_disconnected.sqf index d95b48a..65c6e95 100644 --- a/addons/recorder/fnc_eh_disconnected.sqf +++ b/addons/recorder/fnc_eh_disconnected.sqf @@ -27,14 +27,7 @@ params ["_unit", "_id", "_uid", "_name"]; -[":EVENT:GENERAL:", [ - GVAR(captureFrameNo), - "disconnected", - _name, - [createHashMapFromArray [ - ["playerUid", _uid] - ]] call CBA_fnc_encodeJSON -]] call EFUNC(extension,sendData); +["disconnected", _name, _uid] call FUNC(recordPlayerConnectionEvent); if (_unit getVariable [QGVARMAIN(isInitialized), false]) then { [":SOLDIER:DELETE:", [ @@ -54,6 +47,7 @@ if ( {(call CBA_fnc_players) - [_unit] isEqualTo []} && {(GVAR(frameCaptureDelay) * GVAR(captureFrameNo)) / 60 >= GVAR(minMissionTime)} ) then { + GVAR(autoRestartAfterEmptyPending) = true; [nil, "Recording ended due to server being empty"] call FUNC(exportData); }; diff --git a/addons/recorder/fnc_flushPlayerConnectionEvents.sqf b/addons/recorder/fnc_flushPlayerConnectionEvents.sqf new file mode 100644 index 0000000..7ed0ddc --- /dev/null +++ b/addons/recorder/fnc_flushPlayerConnectionEvents.sqf @@ -0,0 +1,38 @@ +/* ---------------------------------------------------------------------------- +FILE: fnc_flushPlayerConnectionEvents.sqf + +FUNCTION: OCAP_recorder_fnc_flushPlayerConnectionEvents + +Description: + Replays buffered player connection events into the newly registered recording + at frame 0, then clears the buffer. + +Returns: + Nothing + +Public: + No +---------------------------------------------------------------------------- */ + +#include "script_component.hpp" + +{ + _x params ["_eventType", "_name", "_uid"]; + + private _extraData = createHashMap; + + if (EGVAR(settings,includeSteamIdInPlayerConnectionEvents)) then { + _extraData set ["playerUid", _uid]; + }; + + private _eventData = [ + 0, + _eventType, + _name, + [_extraData] call CBA_fnc_encodeJSON + ]; + + [":EVENT:GENERAL:", _eventData] call EFUNC(extension,sendData); +} forEach GVAR(connectedPlayerNamesBuffer); + +GVAR(connectedPlayerNamesBuffer) = []; diff --git a/addons/recorder/fnc_getAutoStartPlayerCount.sqf b/addons/recorder/fnc_getAutoStartPlayerCount.sqf new file mode 100644 index 0000000..a2a18eb --- /dev/null +++ b/addons/recorder/fnc_getAutoStartPlayerCount.sqf @@ -0,0 +1,26 @@ +/* ---------------------------------------------------------------------------- +FILE: fnc_getAutoStartPlayerCount.sqf + +FUNCTION: OCAP_recorder_fnc_getAutoStartPlayerCount + +Description: + Returns the number of players eligible for automatic recording start. The + configured headless-client exclusion is applied here for both initial start + and automatic restart checks. + +Returns: + Eligible player count [Number] + +Public: + No +---------------------------------------------------------------------------- */ + +#include "script_component.hpp" + +private _players = allPlayers; + +if (EGVAR(settings,excludeHeadlessClientsFromAutoStart)) then { + _players = _players - (entities "HeadlessClient_F"); +}; + +count _players diff --git a/addons/recorder/fnc_init.sqf b/addons/recorder/fnc_init.sqf index 44457f8..dc4081e 100644 --- a/addons/recorder/fnc_init.sqf +++ b/addons/recorder/fnc_init.sqf @@ -54,6 +54,15 @@ publicVariable QGVAR(captureFrameNo); */ GVAR(nextId) = 0; +/* + Connection events which occur before the extension is ready to receive a + recording are replayed at frame 0 when that recording starts. +*/ +GVAR(connectedPlayerNamesBuffer) = []; + +// Only an empty-server auto-save may arm the automatic restart path. +GVAR(autoRestartAfterEmptyPending) = false; + // save static setting values so changes during a mission don't interrupt timeline @@ -218,13 +227,19 @@ call EFUNC(extension,initSession); Start recording AFTER Briefing screen, so the beginning of the recording matches the start of the actual mission session. */ [ - {(getClientStateNumber > 9 && (count allPlayers) >= EGVAR(settings,minPlayerCount) && GVAR(autoStart)) || !isNil QGVAR(startTime)}, + {(getClientStateNumber > 9 && (call FUNC(getAutoStartPlayerCount)) >= EGVAR(settings,minPlayerCount) && GVAR(autoStart)) || !isNil QGVAR(startTime)}, { call FUNC(startRecording); [QGVARMAIN(customEvent), ["generalEvent", "Mission has started!"]] call CBA_fnc_serverEvent; } ] call CBA_fnc_waitUntilAndExecute; +// Periodically re-arm auto-start after an empty-server auto-save. Unlike the +// initial waiter above, this handler remains active for the whole mission. +[{ + call FUNC(autoRestartMonitor); +}, 10] call CBA_fnc_addPerFrameHandler; + if (isNil QGVAR(entityMonitorsInitialized)) then { call FUNC(entityMonitors); diff --git a/addons/recorder/fnc_recordPlayerConnectionEvent.sqf b/addons/recorder/fnc_recordPlayerConnectionEvent.sqf new file mode 100644 index 0000000..de8ba71 --- /dev/null +++ b/addons/recorder/fnc_recordPlayerConnectionEvent.sqf @@ -0,0 +1,45 @@ +/* ---------------------------------------------------------------------------- +FILE: fnc_recordPlayerConnectionEvent.sqf + +FUNCTION: OCAP_recorder_fnc_recordPlayerConnectionEvent + +Description: + Records a player connection event immediately when a recording session is + available, or buffers it for frame 0 of the next recording. + +Parameters: + _eventType - "connected" or "disconnected" [String] + _name - Player name [String] + _uid - Player UID [String] + +Returns: + Nothing + +Public: + No +---------------------------------------------------------------------------- */ + +#include "script_component.hpp" + +params ["_eventType", "_name", "_uid"]; + +if (isNil QGVAR(startTime) || {!EGVAR(extension,sessionReady)}) exitWith { + if (EGVAR(settings,bufferPlayerConnectionEvents)) then { + GVAR(connectedPlayerNamesBuffer) pushBack [_eventType, _name, _uid]; + }; +}; + +private _extraData = createHashMap; + +if (EGVAR(settings,includeSteamIdInPlayerConnectionEvents)) then { + _extraData set ["playerUid", _uid]; +}; + +private _eventData = [ + GVAR(captureFrameNo), + _eventType, + _name, + [_extraData] call CBA_fnc_encodeJSON +]; + +[":EVENT:GENERAL:", _eventData] call EFUNC(extension,sendData); diff --git a/addons/recorder/fnc_startRecording.sqf b/addons/recorder/fnc_startRecording.sqf index 975b60f..ea14f33 100644 --- a/addons/recorder/fnc_startRecording.sqf +++ b/addons/recorder/fnc_startRecording.sqf @@ -39,6 +39,9 @@ if (GVAR(recording) && GVAR(captureFrameNo) > 10) exitWith { ] remoteExecCall ["CBA_fnc_notify", [0, -2] select isDedicated]; }; +// Any explicit or automatic start consumes a pending empty-server restart. +GVAR(autoRestartAfterEmptyPending) = false; + GVAR(recording) = true; publicVariable QGVAR(recording); @@ -71,12 +74,14 @@ if (GVAR(captureFrameNo) == 0) then { call EFUNC(extension,newMission); // Wait for extension to confirm new mission before starting capture [{EGVAR(extension,sessionReady)}, { + call FUNC(flushPlayerConnectionEvents); call FUNC(captureLoop); }, [], 30, { ERROR("Timeout waiting for new mission confirmation from extension. Recording will not start."); ["OCAP failed to start recording: extension did not respond", 1, [1, 0, 0, 1]] remoteExecCall ["CBA_fnc_notify", [0, -2] select isDedicated]; }] call CBA_fnc_waitUntilAndExecute; } else { + call FUNC(flushPlayerConnectionEvents); call FUNC(captureLoop); }; }; From fdb88445f1e96c60d2f6eab7cdf369ce06aa4877 Mon Sep 17 00:00:00 2001 From: YetheSamartaka <55753928+YetheSamartaka@users.noreply.github.com> Date: Sat, 22 Aug 2026 16:58:14 +0200 Subject: [PATCH 2/5] Update addons/recorder/fnc_eh_connected.sqf Co-authored-by: thegamecracks <61257169+thegamecracks@users.noreply.github.com> --- addons/recorder/fnc_eh_connected.sqf | 3 --- 1 file changed, 3 deletions(-) diff --git a/addons/recorder/fnc_eh_connected.sqf b/addons/recorder/fnc_eh_connected.sqf index 0a074ac..d3f0d5d 100644 --- a/addons/recorder/fnc_eh_connected.sqf +++ b/addons/recorder/fnc_eh_connected.sqf @@ -32,6 +32,3 @@ if (_owner isEqualTo 2) exitWith {}; // Log immediately during an active session, otherwise preserve the event for // frame 0 of the next recording. ["connected", _name, _uid] call FUNC(recordPlayerConnectionEvent); - -// Trigger admin control check for all connecting players -[_idstr, "connect"] call FUNC(adminUIcontrol); From 23693b4eda5c95fc48b7f2ba1de473aad038bf15 Mon Sep 17 00:00:00 2001 From: Yethe Samartaka Date: Wed, 14 Oct 2026 07:17:27 +0200 Subject: [PATCH 3/5] fix(recorder): respect auto-start and discard stale connection history --- addons/recorder/XEH_preInit.sqf | 23 ++++------ addons/recorder/fnc_autoRestartMonitor.sqf | 2 +- addons/recorder/fnc_eh_connected.sqf | 3 +- .../fnc_flushPlayerConnectionEvents.sqf | 27 +++--------- addons/recorder/fnc_init.sqf | 6 --- .../fnc_recordPlayerConnectionEvent.sqf | 19 ++++---- docs/recording-lifecycle.md | 43 +++++++++++++++++++ 7 files changed, 70 insertions(+), 53 deletions(-) create mode 100644 docs/recording-lifecycle.md diff --git a/addons/recorder/XEH_preInit.sqf b/addons/recorder/XEH_preInit.sqf index 3e39b7e..a8cfe7b 100644 --- a/addons/recorder/XEH_preInit.sqf +++ b/addons/recorder/XEH_preInit.sqf @@ -65,7 +65,7 @@ GVAR(allSettings) = [ /* CBA Setting: OCAP_settings_excludeHeadlessClientsFromAutoStart Description: - Exclude headless clients when counting players for automatic recording start and restart. Default: true + Exclude headless clients when counting players for automatic recording start and restart. If disabled, headless clients alone can meet the threshold, including after an empty-server save. Default: true Setting Name: Exclude Headless Clients @@ -78,7 +78,7 @@ GVAR(allSettings) = [ "CHECKBOX", [ "Exclude Headless Clients", - "Exclude headless clients when counting players for automatic recording start and restart. Default: true" + "Exclude headless clients when counting players for automatic recording start and restart. If disabled, headless clients alone can meet the threshold, including after an empty-server save. Default: true" ], [COMPONENT_NAME, "Auto-start Settings"], true, @@ -90,7 +90,7 @@ GVAR(allSettings) = [ /* CBA Setting: OCAP_settings_autoRestartAfterEmpty Description: - Automatically start a new recording after an empty-server auto-save once the minimum player count is reached again. Default: true + With Auto Start Recording enabled at mission initialization, automatically start a new recording after an empty-server auto-save once the minimum player count is reached again. Default: true Setting Name: Auto-Restart After Empty Server @@ -103,7 +103,7 @@ GVAR(allSettings) = [ "CHECKBOX", [ "Auto-Restart After Empty Server", - "Automatically start a new recording after an empty-server auto-save once the minimum player count is reached again. Default: true" + "With Auto Start Recording enabled at mission initialization, automatically start a new recording after an empty-server auto-save once the minimum player count is reached again. Default: true" ], [COMPONENT_NAME, "Auto-start Settings"], true, @@ -115,10 +115,10 @@ GVAR(allSettings) = [ /* CBA Setting: OCAP_settings_bufferPlayerConnectionEvents Description: - Buffer player connect and disconnect events before a recording starts, then replay them at frame 0. Default: true + Include currently connected human players at the first recorded frame. Connections and disconnections before recording are not retained. Default: true Setting Name: - Buffer Player Connection Events + Include Connected Players at Recording Start Value Type: Boolean @@ -127,18 +127,13 @@ GVAR(allSettings) = [ QEGVAR(settings,bufferPlayerConnectionEvents), "CHECKBOX", [ - "Buffer Player Connection Events", - "Buffer player connect and disconnect events before a recording starts, then replay them at frame 0. Default: true" + "Include Connected Players at Recording Start", + "Include currently connected human players at the first recorded frame. Connections and disconnections before recording are not retained. Default: true" ], [COMPONENT_NAME, "Auto-start Settings"], true, true, - { - params ["_value"]; - if (!_value && {!isNil QGVAR(connectedPlayerNamesBuffer)}) then { - GVAR(connectedPlayerNamesBuffer) = []; - }; - }, + {}, false ], diff --git a/addons/recorder/fnc_autoRestartMonitor.sqf b/addons/recorder/fnc_autoRestartMonitor.sqf index 162ea5d..93a4cc0 100644 --- a/addons/recorder/fnc_autoRestartMonitor.sqf +++ b/addons/recorder/fnc_autoRestartMonitor.sqf @@ -16,7 +16,7 @@ Public: #include "script_component.hpp" -if (!EGVAR(settings,autoRestartAfterEmpty)) exitWith {}; +if (!GVAR(autoStart) || {!EGVAR(settings,autoRestartAfterEmpty)}) exitWith {}; if (!GVAR(autoRestartAfterEmptyPending)) exitWith {}; if (GVAR(recording) || {!isNil QGVAR(startTime)}) exitWith {}; if (getClientStateNumber <= 9) exitWith {}; diff --git a/addons/recorder/fnc_eh_connected.sqf b/addons/recorder/fnc_eh_connected.sqf index d3f0d5d..e16f06d 100644 --- a/addons/recorder/fnc_eh_connected.sqf +++ b/addons/recorder/fnc_eh_connected.sqf @@ -29,6 +29,5 @@ params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"]; // skip for server 'connected' message if (_owner isEqualTo 2) exitWith {}; -// Log immediately during an active session, otherwise preserve the event for -// frame 0 of the next recording. +// Log during an active session. Recording start snapshots current players. ["connected", _name, _uid] call FUNC(recordPlayerConnectionEvent); diff --git a/addons/recorder/fnc_flushPlayerConnectionEvents.sqf b/addons/recorder/fnc_flushPlayerConnectionEvents.sqf index 7ed0ddc..a668c0c 100644 --- a/addons/recorder/fnc_flushPlayerConnectionEvents.sqf +++ b/addons/recorder/fnc_flushPlayerConnectionEvents.sqf @@ -4,8 +4,8 @@ FILE: fnc_flushPlayerConnectionEvents.sqf FUNCTION: OCAP_recorder_fnc_flushPlayerConnectionEvents Description: - Replays buffered player connection events into the newly registered recording - at frame 0, then clears the buffer. + Records a snapshot of currently connected human players at the first recorded + frame. No connection history is retained between recordings. Returns: Nothing @@ -16,23 +16,8 @@ Public: #include "script_component.hpp" -{ - _x params ["_eventType", "_name", "_uid"]; - - private _extraData = createHashMap; - - if (EGVAR(settings,includeSteamIdInPlayerConnectionEvents)) then { - _extraData set ["playerUid", _uid]; - }; +if (!EGVAR(settings,bufferPlayerConnectionEvents)) exitWith {}; - private _eventData = [ - 0, - _eventType, - _name, - [_extraData] call CBA_fnc_encodeJSON - ]; - - [":EVENT:GENERAL:", _eventData] call EFUNC(extension,sendData); -} forEach GVAR(connectedPlayerNamesBuffer); - -GVAR(connectedPlayerNamesBuffer) = []; +{ + ["connected", name _x, getPlayerUID _x, 1] call FUNC(recordPlayerConnectionEvent); +} forEach (allPlayers - (entities "HeadlessClient_F")); diff --git a/addons/recorder/fnc_init.sqf b/addons/recorder/fnc_init.sqf index 3443ec9..1d8c982 100644 --- a/addons/recorder/fnc_init.sqf +++ b/addons/recorder/fnc_init.sqf @@ -54,12 +54,6 @@ publicVariable QGVAR(captureFrameNo); */ GVAR(nextId) = 0; -/* - Connection events which occur before the extension is ready to receive a - recording are replayed at frame 0 when that recording starts. -*/ -GVAR(connectedPlayerNamesBuffer) = []; - // Only an empty-server auto-save may arm the automatic restart path. GVAR(autoRestartAfterEmptyPending) = false; diff --git a/addons/recorder/fnc_recordPlayerConnectionEvent.sqf b/addons/recorder/fnc_recordPlayerConnectionEvent.sqf index de8ba71..fbdd200 100644 --- a/addons/recorder/fnc_recordPlayerConnectionEvent.sqf +++ b/addons/recorder/fnc_recordPlayerConnectionEvent.sqf @@ -4,13 +4,15 @@ FILE: fnc_recordPlayerConnectionEvent.sqf FUNCTION: OCAP_recorder_fnc_recordPlayerConnectionEvent Description: - Records a player connection event immediately when a recording session is - available, or buffers it for frame 0 of the next recording. + Records a player connection event when a recording session is available. + Events outside a recording are discarded; recording start takes a snapshot + of the players who are still connected instead. Parameters: _eventType - "connected" or "disconnected" [String] _name - Player name [String] _uid - Player UID [String] + _frame - Recording frame, defaults to the current capture frame [optional, Number] Returns: Nothing @@ -21,13 +23,12 @@ Public: #include "script_component.hpp" -params ["_eventType", "_name", "_uid"]; +params ["_eventType", "_name", "_uid", ["_frame", GVAR(captureFrameNo), [0]]]; -if (isNil QGVAR(startTime) || {!EGVAR(extension,sessionReady)}) exitWith { - if (EGVAR(settings,bufferPlayerConnectionEvents)) then { - GVAR(connectedPlayerNamesBuffer) pushBack [_eventType, _name, _uid]; - }; -}; +if (!EGVAR(extension,sessionReady)) exitWith {}; +// startRecording sets recording before the startup snapshot, while captureLoop +// sets startTime afterwards. A paused recording keeps startTime and its events. +if (isNil QGVAR(startTime) && {!GVAR(recording)}) exitWith {}; private _extraData = createHashMap; @@ -36,7 +37,7 @@ if (EGVAR(settings,includeSteamIdInPlayerConnectionEvents)) then { }; private _eventData = [ - GVAR(captureFrameNo), + _frame max 1, _eventType, _name, [_extraData] call CBA_fnc_encodeJSON diff --git a/docs/recording-lifecycle.md b/docs/recording-lifecycle.md new file mode 100644 index 0000000..99c7041 --- /dev/null +++ b/docs/recording-lifecycle.md @@ -0,0 +1,43 @@ +# Automatic recording lifecycle + +After `saveOnEmpty` exports a recording, the recorder checks the player threshold +every 10 seconds. It starts a new recording only if `autoStart` was enabled at +mission initialization and `autoRestartAfterEmpty` is enabled. Manual starts and +paused recordings keep their existing behavior. + +`excludeHeadlessClientsFromAutoStart` still controls the player count for both +initial start and restart. Disabling it allows headless clients alone to meet the +threshold, even after an empty-server save. + +The existing `OCAP_settings_bufferPlayerConnectionEvents` setting now controls +**Include Connected Players at Recording Start**. When enabled, a new recording +includes one `connected` event per currently connected human player at internal +frame 1 (the first recorded frame). Disconnected players and headless clients are +omitted. No connection history is stored while waiting for a recording, so churn +between recordings cannot accumulate or appear in a later recording. Active and +paused recordings still receive live connection events. The Steam ID setting and +`playerUid` payload format are unchanged. + +## Dedicated-server verification + +These scenarios require Arma 3 and the recorder extension; HEMTT checks and builds +do not exercise the server lifecycle. Inspect the resulting recordings as well +as the server notifications. + +1. Enable auto-start, restart and save-on-empty. Reach the player threshold, + record beyond `minMissionTime`, then disconnect everyone. Verify one export; + rejoin below the threshold and verify recording stays stopped; reach the + threshold and verify a fresh recording starts within 10 seconds. Repeat. +2. Disable auto-start before mission initialization, then start manually. Repeat + the empty-server save and rejoin flow. Verify no automatic recording starts, + even when the threshold is reached. Verify manual start still works. +3. Between recordings, connect and disconnect several players. Leave some humans + and a headless client connected, then start. Verify only the humans still + connected have startup `connected` events, at the first frame; no stale + `disconnected` events appear. Repeat before the first recording. +4. Disable the startup-player setting and verify no startup snapshot is emitted. + Check live connect/disconnect events while recording and paused. With Steam + IDs enabled, verify `playerUid`; disable the setting and verify it is omitted. +5. With headless-client exclusion enabled, verify headless clients do not help + reach the start/restart threshold. With it disabled, verify the configured + counting behavior, including the documented headless-only restart case. From c82f87b49cb5f430bde40f10e47b90a12e03031e Mon Sep 17 00:00:00 2001 From: Yethe Samartaka Date: Sun, 29 Nov 2026 12:37:35 +0100 Subject: [PATCH 4/5] Include default ace values --- addons/recorder/fnc_installPlayerTrackingClients.sqf | 11 +++++++++++ docs/player-detail-tracking.md | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/addons/recorder/fnc_installPlayerTrackingClients.sqf b/addons/recorder/fnc_installPlayerTrackingClients.sqf index cda9f63..feed06f 100644 --- a/addons/recorder/fnc_installPlayerTrackingClients.sqf +++ b/addons/recorder/fnc_installPlayerTrackingClients.sqf @@ -112,6 +112,14 @@ call GVAR(publishPlayerTrackingSettings); // fall-through to the engine trait when the ACE variable was never set, so the // recording shows the level the mod actually acted on. // + // `medicDefault` / `engineerDefault` say whether that level is the unit's + // class level, i.e. the Eden attribute was left on "Default". It cannot be + // derived from the level: ACE's Eden attributes store nothing when the chosen + // level equals the class's, and ace_repair clears the engine "engineer" trait + // on every engineer class at InitPost, storing ACE_IsEngineer = true instead. + // Eden, the Assign modules and Zeus always store a number, so a boolean `true` + // on an engineer class is ACE's own class conversion. + // // Traits ride inside the inventory snapshot: they are assigned with the // loadout, change about as often, and the server's diff then carries them only // when they change. @@ -141,13 +149,16 @@ call GVAR(publishPlayerTrackingSettings); if (_level isEqualType false) then {_level = parseNumber _level}; if (!(_level isEqualType 0)) then {_level = 0}; _ace set ["medic", _level]; + _ace set ["medicDefault", isNil {_unit getVariable "ace_medical_medicClass"}]; }; if (OCAP_recorder_client_hasAceRepair) then { // 0 none, 1 engineer, 2 advanced engineer. ACE writes `true` for 1. + private _stored = _unit getVariable "ACE_IsEngineer"; private _level = _unit getVariable ["ACE_IsEngineer", _unit getUnitTrait "engineer"]; if (_level isEqualType false) then {_level = parseNumber _level}; if (!(_level isEqualType 0)) then {_level = 0}; _ace set ["engineer", _level]; + _ace set ["engineerDefault", isNil "_stored" || {_stored isEqualTo true && {getNumber (configOf _unit >> "engineer") > 0}}]; }; if (OCAP_recorder_client_hasAceExplosives) then { _ace set ["eod", (_unit getVariable ["ACE_isEOD", _unit getUnitTrait "explosiveSpecialist"]) in [1, true]]; diff --git a/docs/player-detail-tracking.md b/docs/player-detail-tracking.md index 5e73003..4efcf8a 100644 --- a/docs/player-detail-tracking.md +++ b/docs/player-detail-tracking.md @@ -116,6 +116,18 @@ Recordings made before this change are converted by through the mods' own stringtables and keeps it exactly as recorded when they have no English for it. +## ACE training levels + +`traits.ace` holds the medic (0-2) and engineer (0-2) level ACE acts on, read the +way `ace_medical_treatment_fnc_isMedic` and `ace_repair_fnc_isEngineer` read them. +Next to each, `medicDefault` / `engineerDefault` is `true` when that level is the +unit's class level, i.e. the Eden attribute was left on "Default". The level alone +cannot tell: ACE's Eden attributes store nothing when the chosen level equals the +class's, and `ace_repair` clears the engine `engineer` trait on every engineer +class at InitPost and stores `ACE_IsEngineer = true` instead. Eden, the Assign +modules and Zeus always store a number. "None" on a class without the trait stores +nothing either, so in game and in the recording it is the same as "Default". + ## Snapshot diffs A follow-up snapshot carries only what changed. Nested HashMaps are walked, and From 476e4b727e53024ffabcdd24f5e35d57d032e810 Mon Sep 17 00:00:00 2001 From: Yethe Samartaka Date: Mon, 30 Nov 2026 22:24:47 +0100 Subject: [PATCH 5/5] Agentic development improvements --- .agents/agents/contract-reviewer.md | 6 +++++ .agents/agents/explorer.md | 6 +++++ .agents/agents/recovery-reviewer.md | 6 +++++ .agents/agents/worker.md | 6 +++++ .../ocap-addon-context-recovery/SKILL.md | 6 +++++ .../ocap-addon-contract-review/SKILL.md | 6 +++++ .../ocap-addon-local-verification/SKILL.md | 6 +++++ .agents/skills/ocap-addon-testkit/SKILL.md | 6 +++++ AGENTS.md | 20 +++++++++++++++ CLAUDE.md | 11 ++++---- CONTRIBUTING.md | 25 +++++++++++++++++++ docs/agent-workflows.md | 20 +++++++++++++++ docs/comment-hygiene.md | 9 +++++++ docs/maintainer-context.md | 13 ++++++++++ docs/testkit.md | 12 +++++++++ 15 files changed, 153 insertions(+), 5 deletions(-) create mode 100644 .agents/agents/contract-reviewer.md create mode 100644 .agents/agents/explorer.md create mode 100644 .agents/agents/recovery-reviewer.md create mode 100644 .agents/agents/worker.md create mode 100644 .agents/skills/ocap-addon-context-recovery/SKILL.md create mode 100644 .agents/skills/ocap-addon-contract-review/SKILL.md create mode 100644 .agents/skills/ocap-addon-local-verification/SKILL.md create mode 100644 .agents/skills/ocap-addon-testkit/SKILL.md create mode 100644 AGENTS.md create mode 100644 CONTRIBUTING.md create mode 100644 docs/agent-workflows.md create mode 100644 docs/comment-hygiene.md create mode 100644 docs/maintainer-context.md create mode 100644 docs/testkit.md diff --git a/.agents/agents/contract-reviewer.md b/.agents/agents/contract-reviewer.md new file mode 100644 index 0000000..9ffe572 --- /dev/null +++ b/.agents/agents/contract-reviewer.md @@ -0,0 +1,6 @@ +--- +name: contract-reviewer +description: Review OCAP addon locality, public mission APIs, and extension payload compatibility. +--- + +Read [AGENTS.md](../../AGENTS.md) and the [contract review skill](../skills/ocap-addon-contract-review/SKILL.md). Work read-only. Trace the boundary through its producers and consumers. Return severity, trigger, observable result, and source evidence for each finding. Include missing checks. diff --git a/.agents/agents/explorer.md b/.agents/agents/explorer.md new file mode 100644 index 0000000..c954fa6 --- /dev/null +++ b/.agents/agents/explorer.md @@ -0,0 +1,6 @@ +--- +name: explorer +description: Trace one OCAP addon workflow and its compatibility or recovery evidence. +--- + +Read [AGENTS.md](../../AGENTS.md) and the [handoff guide](../../docs/agent-workflows.md). Work read-only. Report the entry point, machine and scheduler context, relevant history, consumers, and case that verifies the behavior. Include file and line evidence. diff --git a/.agents/agents/recovery-reviewer.md b/.agents/agents/recovery-reviewer.md new file mode 100644 index 0000000..ab9d999 --- /dev/null +++ b/.agents/agents/recovery-reviewer.md @@ -0,0 +1,6 @@ +--- +name: recovery-reviewer +description: Review OCAP addon registration, asynchronous callbacks, save and discard, and cleanup. +--- + +Read [AGENTS.md](../../AGENTS.md) and the [handoff guide](../../docs/agent-workflows.md). Work read-only. Follow the [recording lifecycle](../../docs/recording-lifecycle.md) through delayed registration, pause, save, discard, reset, and restart. Return concrete failure sequences, remaining handlers or state, observable effects, and missing evidence. diff --git a/.agents/agents/worker.md b/.agents/agents/worker.md new file mode 100644 index 0000000..0a209f4 --- /dev/null +++ b/.agents/agents/worker.md @@ -0,0 +1,6 @@ +--- +name: worker +description: Implement one scoped OCAP addon change in assigned files. +--- + +Read [AGENTS.md](../../AGENTS.md) and the [handoff guide](../../docs/agent-workflows.md). Edit only assigned files and preserve local changes. Run the applicable HEMTT and regression checks. Return changed files, exact results, runtime gaps, and integration needs. diff --git a/.agents/skills/ocap-addon-context-recovery/SKILL.md b/.agents/skills/ocap-addon-context-recovery/SKILL.md new file mode 100644 index 0000000..0231c54 --- /dev/null +++ b/.agents/skills/ocap-addon-context-recovery/SKILL.md @@ -0,0 +1,6 @@ +--- +name: ocap-addon-context-recovery +description: Recover why an OCAP Arma 3 addon locality, recording lifecycle, or compatibility guard exists using SQF callers, history, and regression cases. +--- + +Start with [Maintainer context](../../../docs/maintainer-context.md) and record the revision and relevant working-tree changes. Search the owning SQF function and integration history for the rule. Trace the machine, scheduler, and state owner, then follow any remote or extension consumer. Report the historical reason, present behavior, and [verification case](../../../docs/testkit.md), with any remaining evidence gaps. diff --git a/.agents/skills/ocap-addon-contract-review/SKILL.md b/.agents/skills/ocap-addon-contract-review/SKILL.md new file mode 100644 index 0000000..8223df7 --- /dev/null +++ b/.agents/skills/ocap-addon-contract-review/SKILL.md @@ -0,0 +1,6 @@ +--- +name: ocap-addon-contract-review +description: Review OCAP Arma 3 addon changes that affect remote submissions, public CBA events or settings, extension commands, or playback payloads. +--- + +Use [Maintainer context](../../../docs/maintainer-context.md) to trace the changed boundary. For remote submissions, check the actual sender, object locality, join-in-progress behavior, and server or listen-host path. For public CBA or extension changes, check names, argument positions and types, defaults, callbacks, and downstream frame or event consumers. Report the triggering call, changed behavior, compatibility impact, and the [case](../../../docs/testkit.md) that verifies it. diff --git a/.agents/skills/ocap-addon-local-verification/SKILL.md b/.agents/skills/ocap-addon-local-verification/SKILL.md new file mode 100644 index 0000000..8a9f583 --- /dev/null +++ b/.agents/skills/ocap-addon-local-verification/SKILL.md @@ -0,0 +1,6 @@ +--- +name: ocap-addon-local-verification +description: Select and run HEMTT and in-game checks for OCAP Arma 3 addon changes, with CI, PBO packaging, and multiplayer topology in view. +--- + +Start with [Contributing](../../../CONTRIBUTING.md#running-checks), [build CI](../../../.github/workflows/build.yml), and the [case catalog](../../../docs/testkit.md). Run applicable HEMTT checks. Select runtime cases by the changed locality, scheduler, or extension boundary, using dedicated and listen servers when the affected paths differ. Record HEMTT results separately from runtime assertions and note known fixture limits or untested cases. diff --git a/.agents/skills/ocap-addon-testkit/SKILL.md b/.agents/skills/ocap-addon-testkit/SKILL.md new file mode 100644 index 0000000..cee37ef --- /dev/null +++ b/.agents/skills/ocap-addon-testkit/SKILL.md @@ -0,0 +1,6 @@ +--- +name: ocap-addon-testkit +description: Run the existing OCAP addon SQF regression cases for save limits, multiplayer submissions, client sampling, and same-mission restart. +--- + +Choose a case from the [local catalog](../../../docs/testkit.md). Follow the [regression README](../../../tests/README.md) for the disposable mission, test-only build, multiplayer roles, execution commands, and expected RPT markers. Check accepted and rejected behavior and the resulting recording state. Report the topology, exact result, and any sections blocked by the documented CBA final-function limitation. diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..cf38e4e --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,20 @@ +# OCAP Arma 3 addon agent guide + +Start with [Contributing](CONTRIBUTING.md). Use [Maintainer context](docs/maintainer-context.md) to trace an SQF contract, failure path, or guard and [Comment hygiene](docs/comment-hygiene.md) for comment edits. + +- Preserve server ownership of recording state. Trace client submissions and join-in-progress behavior through the actual producers and receivers. Preserve sender, object-owner, and curator checks where they apply, including on a listen server. +- Follow the [recording lifecycle](docs/recording-lifecycle.md) for extension readiness, registration, pause, save, discard, and restart. Preserve callback correlation, frame numbering, and cleanup of per-recording handlers and state. +- Preserve [extension commands](addons/extension/fnc_sendData.sqf), positional arguments, defaults, and event payloads used by existing missions, extension releases, and playback. The web server stores native v2 as protobuf and generates v1 JSON on demand for downloads. +- Follow the existing SQF and CBA conventions in [Contributing](CONTRIBUTING.md#sqf-and-cba). Use [player detail tracking](docs/player-detail-tracking.md) for settings, localization, and optional integration behavior. +- Inspect the working tree before editing and preserve local changes. Use disposable missions, synthetic player data, and isolated storage for [local cases](docs/testkit.md). Match [HEMTT CI](.github/workflows/build.yml) and aim to cover every changed success and failure path. Record which runtime cases ran and which still need Arma 3. + +## Agent workflows + +Use [roles and handoffs](docs/agent-workflows.md) for independent exploration, a disjoint implementation assignment, or a fresh review of a consequential change. The coordinator owns integration and final verification. + +| Skill | Use when | +| --- | --- | +| [ocap-addon-context-recovery](.agents/skills/ocap-addon-context-recovery/SKILL.md) | Recover why a compatibility, locality, or lifecycle rule exists | +| [ocap-addon-contract-review](.agents/skills/ocap-addon-contract-review/SKILL.md) | Review network locality, mission APIs, or extension and playback payloads | +| [ocap-addon-local-verification](.agents/skills/ocap-addon-local-verification/SKILL.md) | Select HEMTT checks and in-game acceptance cases | +| [ocap-addon-testkit](.agents/skills/ocap-addon-testkit/SKILL.md) | Run the existing SQF regression cases | diff --git a/CLAUDE.md b/CLAUDE.md index caaed33..0dd135c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,5 +1,7 @@ # CLAUDE.md +@AGENTS.md + This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview @@ -7,7 +9,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co OCAP2 (Operation Capture and Playback v2) is an Arma 3 addon that records gameplay data during missions for web-based playback analysis. It captures unit positions, vehicles, weapons, markers, and events to facilitate tactical analysis and training. **Language**: SQF (Arma 3 scripting language) -**Dependencies**: Arma 3 2.04+, CBA (Community Base Addons), optional ACE3 integration +**Dependencies**: Arma 3 2.10+, CBA (Community Base Addons), optional ACE3 integration ## Build @@ -27,8 +29,7 @@ Modular CBA-style addon structure: addons/ ├── main/ # Core settings, macros, version info ├── recorder/ # Capture loop, event handlers, export -├── database/ # Database connection, metrics, real-time data streaming -└── extension/ # Extension DLL wrapper +└── extension/ # Extension calls, callbacks, and session registration ``` Each addon follows XEH structure: @@ -43,8 +44,8 @@ Each addon follows XEH structure: - **recorder/fnc_captureLoop.sqf**: Core capture loop, tracks units and vehicles per frame - **recorder/fnc_addEventMission.sqf**: Mission event handlers setup - **recorder/fnc_eh_firedMan.sqf**: Fired event handler with projectile tracking -- **database/fnc_initDB.sqf**: Database connection and mission context initialization -- **database/fnc_metricsLoop.sqf**: Server performance metrics collection +- **extension/fnc_initSession.sqf**: Initial extension session state +- **extension/fnc_handleCallback.sqf**: Storage readiness and mission registration callbacks ### Configuration diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..8951fe5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,25 @@ +# Contributing + +- [Maintainer context](docs/maintainer-context.md) maps addon boundaries and their consumers. +- [Comment hygiene](docs/comment-hygiene.md) covers SQF comments, configuration, and preprocessor directives. +- [Agent roles and handoffs](docs/agent-workflows.md) describes source navigation and verification evidence. +- [Local test cases](docs/testkit.md) maps changes to HEMTT checks and SQF regressions. + +## SQF and CBA + +Follow the nearby code and [.editorconfig](.editorconfig). Use each component's `script_component.hpp` and existing `FUNC`, `EFUNC`, `GVAR`, and `EGVAR` macros. Register prepared functions in the component's `XEH_prep.sqf` and check its [CBA and PBO configuration](addons/recorder/config.cpp). Trace the machine and scheduler context wherever a function can be reached from both a local call and a remote event. + +Keep public CBA event and setting names, defaults, ranges, and value types compatible with existing missions. Use the existing [stringtable](addons/recorder/stringtable.xml) for localized player detail labels and tooltips, and check the matching [CBA registrations](addons/recorder/XEH_preInit.sqf). Preserve feature detection and vanilla fallbacks for optional mods such as ACE3 and TFAR. + +## Running checks + +Run the same HEMTT commands as [build CI](.github/workflows/build.yml) from the repository root. + +```sh +hemtt check +hemtt build +``` + +`hemtt build` writes testable PBOs under `.hemttout/build/`. Use `hemtt release` for release packaging checks when needed. See the [release workflow](.github/workflows/release.yml) and [build instructions](README.md#building-from-source). + +HEMTT verifies static and build behavior. For runtime changes, select a [local case](docs/testkit.md) and follow the [regression setup](tests/README.md) in a disposable Arma 3 mission. Aim to exercise every changed success and failure path and report the cases, topology, RPT results, and remaining gaps. HEMTT does not execute the SQF regression scripts or measure their coverage. diff --git a/docs/agent-workflows.md b/docs/agent-workflows.md new file mode 100644 index 0000000..5f79dbd --- /dev/null +++ b/docs/agent-workflows.md @@ -0,0 +1,20 @@ +# Agent roles and handoffs + +Delegate when separate context or independent work improves the result. Assign each agent one bounded question and give it the applicable brief. + +| Role | Scope | Return | +| --- | --- | --- | +| [Explorer](../.agents/agents/explorer.md) | Read-only caller or history trace | Entry points, execution context, consumers, and evidence gaps | +| [Worker](../.agents/agents/worker.md) | Named files for an agreed change | Changed files, checks, and integration needs | +| [Contract reviewer](../.agents/agents/contract-reviewer.md) | Read-only review of locality, caller, and payload compatibility | Concrete consequences with source links | +| [Recovery reviewer](../.agents/agents/recovery-reviewer.md) | Read-only review of lifecycle ordering and cleanup | Trigger, failure sequence, and remaining state | + +Include the revision and relevant working-tree diff, scope, compatibility constraints, checks, and a stopping point. Assign workers disjoint files. The coordinator checks the findings against source and owns final integration and verification. + +## SQF source navigation + +Use `rg` to find `PREP(name)` in `XEH_prep.sqf`, `fnc_name.sqf`, and the `FUNC`, `EFUNC`, `QFUNC`, or expanded `OCAP_*_fnc_*` spellings. Search for public CBA settings and events by both their macro form and expanded string. For a remote path, trace the target, sender validation, locality, join-in-progress installation, and removal. For extension calls, search for the exact `:RESOURCE:ACTION:` string in both repositories and verify any callback and playback consumer separately. + +## Discovery + +Keep shared instructions in [AGENTS.md](../AGENTS.md) and briefs and skills in [`.agents/`](../.agents). Claude Code imports the shared guide through [CLAUDE.md](../CLAUDE.md). Validate relative links, skill frontmatter, and `git diff --check` when editing the guidance. diff --git a/docs/comment-hygiene.md b/docs/comment-hygiene.md new file mode 100644 index 0000000..3788843 --- /dev/null +++ b/docs/comment-hygiene.md @@ -0,0 +1,9 @@ +# Comment hygiene + +Keep the reasons that a future edit could miss. Preserve public Natural Docs topics, documented examples, and setting help. Check the [documentation workflow](../.github/workflows/docs.yml) when editing generated documentation inputs. + +- Explain locality and scheduler constraints near the affected handler. Keep the reason for ordering across registration, first capture, final capture, export, and discard. +- Document positional extension arguments, payload defaults, and public CBA names at the boundary that owns them. Put longer history and operational evidence in [Maintainer context](maintainer-context.md) or the relevant runtime guide. +- Preserve `#include`, `#define`, conditional preprocessing, macro continuation lines, and HEMTT suppressions. Check token boundaries when moving inline comments in macros and configuration. + +Keep comment-only diffs focused and review the SQF and config around every changed block. Use [HEMTT check](../CONTRIBUTING.md#running-checks) when comments touch preprocessing or build inputs. diff --git a/docs/maintainer-context.md b/docs/maintainer-context.md new file mode 100644 index 0000000..4224850 --- /dev/null +++ b/docs/maintainer-context.md @@ -0,0 +1,13 @@ +# Maintainer context + +For a contract or recovery change, trace the triggering event, machine and scheduler context, state owner, consumer, and observable result. Use owning-file history to check why a guard exists and the [local case catalog](testkit.md) to find verification. + +| Boundary | Invariants to trace | +| --- | --- | +| CBA startup and settings | Follow component `config.cpp`, `XEH_preInit.sqf`, `XEH_postInit.sqf`, and `XEH_prep.sqf`. Check initialization order, persisted CBA setting names and defaults, and matching [player detail labels](../addons/recorder/stringtable.xml). | +| Recording lifecycle | Follow [start](../addons/recorder/fnc_startRecording.sqf), [registration](../addons/extension/fnc_newMission.sqf), and [callbacks](../addons/extension/fnc_handleCallback.sqf) into [capture](../addons/recorder/fnc_captureLoop.sqf). Check pause while waiting, late callbacks, duplicate starts, save limits, same-frame mission-script export, and [discard and restart](recording-lifecycle.md#save-limits-and-storage). | +| Client submissions | Follow [client bootstrap and sampling](../addons/recorder/fnc_installPlayerTrackingClients.sqf) to the server's `fnc_submit*.sqf` receivers. Track join-in-progress installation, `remoteExecutedOwner`, object ownership, curator assignment, and direct server calls where applicable. Check the listen host separately because it runs both server and client code. | +| Per-recording state | Follow [handler removal](../addons/recorder/fnc_removeCaptureHandlers.sqf), [reset](../addons/recorder/fnc_resetRecording.sqf), and [automatic restart](../addons/recorder/fnc_autoRestartMonitor.sqf). Check CBA per-frame handlers, event handlers, delayed callbacks, diff baselines, and reused entity IDs across two recordings in one mission. | +| Extension and playback | Follow [extension calls](../addons/extension/fnc_sendData.sqf) and [callback dispatch](../addons/extension/fnc_handleCallback.sqf). Check exact command names, argument slots and types, response and callback shapes, optional fields, and frame numbering at each boundary. For [player detail payloads](player-detail-tracking.md), trace the sampler, server baseline, emitted event, and playback consumer. Account for older peers explicitly where the [lifecycle protocol notes](recording-lifecycle.md#save-limits-and-storage) document them. | + +Record which extension and web revisions you checked for changes that cross repositories. Review consequential changes with the [contract or recovery roles](agent-workflows.md). diff --git a/docs/testkit.md b/docs/testkit.md new file mode 100644 index 0000000..7b3dcb5 --- /dev/null +++ b/docs/testkit.md @@ -0,0 +1,12 @@ +# Local test cases + +Run [HEMTT check and build](../CONTRIBUTING.md#running-checks) from the repository root. For in-game cases, follow the test-only compile setup, mission configuration, and RPT checks in the [regression README](../tests/README.md). + +| Case | Existing check | +| --- | --- | +| Mission registration and save limits | [Save limits script](../tests/save_limits_regressions.sqf) exercises delayed and failed registration, pause and resume, save versus discard, and same-frame mission-script export. | +| Multiplayer submission ownership | [Recorder script](../tests/recorder_regressions.sqf) exercises rejected and accepted submissions for player snapshots, Zeus, and static weapons on dedicated and listen servers. | +| Client sampler state | The recorder script invokes the [client sampler subtest](../tests/client_sampler_regressions.sqf) to cover player-object and entity-ID changes, initial inventory, cache reset, and TFAR fallback. | +| Servicing and same-mission restart | The recorder script includes servicing thresholds, export reset, and stale callbacks. Use [dedicated-server lifecycle checks](recording-lifecycle.md#dedicated-server-verification) for extension and web outcomes. | + +Use disposable missions and synthetic data. Keep test builds that disable the CBA compile cache out of release artifacts. The [regression README](../tests/README.md#test-build) documents final CBA functions that block parts of the recorder and client suites. Report what actually ran, any RPT errors, and which cases still need a working game setup. Restart the disposable mission after a suite that replaces recording state.