Campaign progression: standard progress schema and shared campaign Lua boilerplate
Author: penev92Created Sep 3, 2026Updated Sep 3, 2026
LabelsScripting
Part 2 of #22600, depends on #22601. The state store holds arbitrary data; this milestone defines the small standard schema on top of it that engine UI and unlock logic can rely on, plus the shared Lua boilerplate that writes it — so every campaign records progress the same way without every mission reinventing it.
Design
- Standard keys in each mission document, written at mission end: at minimum
completed(bool),difficulty,time,score,attempts. Everything else stays free-form alongside them. - OPEN TO DISCUSSION - The defeat path records too (attempts, per-mission stats) — not just victory. Lua
OnPlayerWon/OnPlayerLosttriggers run before the world stops, so no engine changes are needed to record outcomes. - A shared helper in the common campaign Lua (loaded before map scripts since #19968) does the recording, so a mission opts in with one call.
- Custom score metrics (e.g. "Commando died and respawned X times") remain possible as free-form keys next to the standard ones.
Work items
- Document the standard schema (key names, types, units — e.g. is
timeticks or seconds) - Shared Lua helper that records mission outcome (victory and defeat) into the store
- Wire it into one reference campaign's missions
- Decide and implement replay-from-browser semantics: proposal — re-playing an already-completed mission only ever improves the stored result (better time/score, higher difficulty), never regresses it
- Decide where difficulty is recorded, coordinating with #21698 (which proposes sharing the campaign save file for remembered lobby options)
Out of scope
Displaying any of this (milestone 3), the score screen itself (milestone 4).
Source: OpenRA/OpenRA