Chapter 05

Architecting Around GameState & Manager Systems

Why GameState is a bulletin board and not a brain, where manager systems actually belong, and the one case where hanging them off GameState is right.

In this chapter

  1. The Instinct, and Why It's Usually Wrong
  2. Where Managers Actually Live
  3. The One Legitimate Exception
  4. Applying It — A Worked Example
1

The Instinct, and Why It's Usually Wrong

A common instinct is to make GameState the owner of your manager systems — an AI Manager, an Activity Manager — on the reasoning that they "dictate the game state."

Usually this is the wrong call. It:

GameState is a shared-truth holder, not a logic hub. The server writes to it; clients read from it. Think bulletin board, not brain.

2

Where Managers Actually Live

The modern idiomatic home for manager-style systems is Subsystems (Chapter 14): automatic lifecycle, singleton-per-scope access, no manual spawning or wiring.

The layered model most games converge on

LayerResponsibilityExists on
GameModeRules; boots the game; kicks off the managersServer only
Manager subsystemsThe actual AI / Activity logic; server-authoritative decisionsServer + client instances, independent of each other
GameStateThe replicated result of what managers decideServer + replicated to all clients
PlayerStatePer-player replicated stateServer + replicated

The managers read from and write to GameState. They are not owned by it.


3

The One Legitimate Exception

If a manager's state is itself shared, replicated data, then an ActorComponent on GameState is clean — because both GameState and its components replicate, the component gets networking for free.

Epic does exactly this in Lyra. ALyraGameState hosts a ULyraExperienceManagerComponent managing which "experience" (mode config) is loaded, because the loaded experience is shared state every client needs. Lyra's GameState also carries a global AbilitySystemComponent for game-wide effects and cues. Meanwhile Lyra uses subsystems heavily for service infrastructure that isn't shared match state.

The dividing heuristic. Does this data need to replicate to all clients? Yes → GameState, often via a component. No, it's server-side decision logic or a cross-map service → GameMode or a subsystem.

4

Applying It — A Worked Example

AI Manager vs. Activity Manager

The concrete server → client flow

  1. GameMode starts the match and tells the ActivityManager subsystem to begin.
  2. ActivityManager (server) picks an activity, asks the AIManager to spawn the encounter, and writes CurrentActivity and EnemiesRemaining onto the GameState, which replicates.
  3. AIManager (server) handles AI budget, pooling, spawning and coordination — none of which touches GameState.
  4. Every client reads GameState->CurrentActivity to drive its HUD. No client runs manager logic; they just read the board.
  5. On completion, ActivityManager updates GameState and the completion replicates out automatically.

GameState never does anything in that flow. It's the shared board, and the managers are what write to it.

Caveat. For a small or single-player game the subsystem ceremony can be overkill, and hanging a couple of manager components off GameState is fine. The decoupled approach earns its keep as the game grows, gets networked, or needs systems to persist across level travel.
← Chapter 4 ↑ Index Chapter 6 →