A campaign is a sequence of missions linked together in the Campaign Editor. The campaign file controls which mission plays next, branches the story based on outcomes, and carries state between missions through goals and variables.
A mission ends when the player reaches the debrief screen. There are two distinct end conditions that affect what state is saved:
| Condition | When it occurs | What is saved |
|---|---|---|
| Mission completed | The player accepts the debriefing after flying the mission. | Variables with Save on Mission Completed persistence, plus all goal states. |
| Mission closed | The player exits the mission by any means, including failure or replaying. | Variables with Save on Mission Close persistence. |
Every mission goal ends in one of three states: complete, failed, or
incomplete. The campaign SEXP tree reads these states using
goal-true and goal-false operators to decide which
mission to branch to next. This is how outcomes carry forward; whether an
important ship survived, whether a bonus objective was met, and so on.
Goals do not automatically determine success or failure. The campaign SEXPs are what interpret goal states and produce outcomes. A mission where all primary goals are complete can still branch to a "defeat" mission if the campaign logic is written that way.
Variables set during a mission only persist into subsequent missions if their persistence is configured accordingly. See the Variables & Containers dialog for the persistence options. Variables saved to the player file (Eternal) persist for the lifetime of the player profile, even across different campaigns.
The campaign editor arranges missions as nodes connected by branches. Each
branch has a SEXP condition. After a mission completes, the engine evaluates the
outgoing branches in order and follows the first one whose condition is true. If
no branch condition is met, the player is returned to the main menu. To end the
campaign properly (playing the end cutscene and triggering campaign completion)
use the end-campaign SEXP.
Common branching patterns include: