Mission Replay Module
Flowgraph module that manages mission replay recording and playback. Handles automatic recording during mission attempts, replay file management (deletion by count or size), metadata generation, and c
Flowgraph module that manages mission replay recording and playback. Handles automatic recording during mission attempts, replay file management (deletion by count or size), metadata generation, and camera state restoration during playback.
Module Properties
| Property | Value | Description |
|---|---|---|
moduleOrder | 0 | Early initialization order |
hooks | onReplayStateChanged, onReplayRecordingValueRequested, onMissionAutoReplayRecordingSettingChanged, onMissionAttemptAggregated | Engine hooks consumed |
Class Methods
Lifecycle
| Method | Description |
|---|---|
C:init() | Sets replayRecording = false, currentReplayFile = nil |
C:executionStarted() | Caches replay directory from core_replay.getMissionReplaysPath() |
C:executionStopped() | Stops recording if active; stops AI replay if aiRecording module exists |
Recording Control
| Method | Description |
|---|---|
C:startNewRec() | Stops existing recording, deletes older replays per settings, starts new recording if enabled |
C:stopIfRec() | Stops recording if currently in "recording" state |
C:deleteOlderReplays() | Dispatches to deleteByMaxSize() or deleteByCount() based on enableMissionReplayCapModes setting |
C:deleteByCount() | Removes oldest replays when count exceeds countReplayCapMode setting |
C:deleteByMaxSize() | Removes oldest replays until total size is under maxSizeReplayCapMode MB |
C:deleteReplayFile(file) | Deletes a single replay file via FS:removeFile |
File Management
| Method | Description |
|---|---|
C:getMissionReplayFiles() | Returns replay .rpl files sorted by creation time (oldest first) |
C:buildMetaInfo(attempt, mission, progressKey) | Writes .rplMeta.json alongside replay with mission ID, name, timestamp, career context, and attempt info |
C:saveMetaInfoWithoutAttempt() | Calls buildMetaInfo() with no attempt data, then clears currentReplayFile |
Playback
| Method | Description |
|---|---|
C:missionPlaybackStarted() | Saves current camera mode/path, switches to orbit camera, unpauses sim |
C:missionPlaybackEnded() | Restores original camera mode (including camera path if applicable) |
Hook Handlers
| Method | Description |
|---|---|
C:onMissionAttemptAggregated(attempt, mission, progressKey) | Saves meta info with attempt data after aggregation |
C:onReplayRecordingValueRequested() | Triggers UI hook with current recording state |
C:onMissionAutoReplayRecordingSettingChanged(newValue) | Updates replayRecording flag from user setting |
C:onReplayStateChanged(state) | Detects playback start/stop transitions for mission replays |
Usage Example
-- Module is auto-managed by the flowgraph manager
-- Recording starts automatically when mission begins (if enabled)
local replayMod = mgr.modules.missionReplay
-- Manual recording control
replayMod.replayRecording = true
replayMod:startNewRec()
-- After attempt completes, meta info is auto-saved via hook
-- onMissionAttemptAggregated writes .rplMeta.json with:
-- { missionId, missionName, time, humanTime, context = { isInCareer, saveSlot }, attempt = { progressKey, attemptNumber } }
-- Replay playback camera handling is automatic:
-- saves original camera → switches to orbit → restores on endInternal Details
- Replay files stored at path from
core_replay.getMissionReplaysPath() - Meta files use
.rplMeta.jsonextension appended to replay filename - Camera path restoration supported via
mgr.modules.camerareference - Uses
core_jobsystemcoroutine with 0.1s sleep to unpause sim after playback start invertListhelper reverses a list in-place (defined but used internally)
See Also
- Flowgraph Action Module - Related reference
- Flowgraph AI Recording Module - Related reference
- Flowgraph Button Module - Related reference
- FlowGraph Guide - Guide
Flowgraph Mission Module
Manages mission-specific vehicle handling, traffic control, and mission lifecycle events for flowgraph projects. Coordinates between the flowgraph execution and the mission system.
Prefab Module
Flowgraph module that manages prefab lifecycle-spawning, tracking, collision/navgraph reloading, vehicle extraction, and cleanup. Ensures all spawned prefabs are properly deleted when the flowgraph st