top of page

Game flow - System Breackdown

In this section I will explain how the system that manages the game flow works, which is based on a custom node-based graphics editor.

Fundamental Concept: World State as a Living ​Entity

 

The system treats the game world as an entity with memory and the ability to transform. Each "moment" of the game is defined as a specific state where certain elements are present, others are absent, and certain conditions are met.

Directed Graph Architecture

 

Game progression is modeled as a state graph where:

 

- Each node represents a specific configuration of the world

- Edges define valid transitions between states

- Advancement is only allowed along predefined paths, avoiding narrative inconsistencies

Multi-Dimensional Synchronization

 

The system simultaneously coordinates:

 

- Physical states (which objects are present)

- Narrative states (which missions are active)

- Logical states (which conditions have been met)

- Temporal states (sequencing of events)

System flow

image.png

1. Graph-Based State Architecture

 

The system models game progression as a directed graph where each node represents a specific world configuration and edges define valid transitions between states.

 

2. Validation-First Transition Protocol

 

Before any state change, the system validates adjacency in the graph, checks preconditions, and ensures the transition maintains narrative coherence.

 

3. Cascading Reactive Updates

 

State changes trigger automatic, hierarchical updates across all dependent systems - from object visibility to mission activation - without manual intervention.

 

4. Multi-Scene State Synchronization

 

The framework manages state consistency across multiple loaded scenes and queues changes for unloaded scenes to apply when they become active.

 

5. Persistent Memory Management

 

All state changes are permanently tracked, allowing consequences of player actions to persist across sessions and scene transitions.

 

6. Mission-State Bidirectional Integration

 

World states automatically trigger associated missions, while mission completion can drive state transitions, maintaining tight narrative coupling.

 

7. Intelligent Object Lifecycle Control

 

Objects throughout the game world automatically activate, deactivate, or modify their behavior based on current state without explicit programming per object.

 

8. Temporal Coordination System

 

The framework handles time-sensitive events, delayed activations, and grace periods to prevent false detections during transitions.

 

9. Robust Error Recovery

 

Multiple fallback mechanisms including state rollback, corruption detection, and graceful degradation ensure system stability under failure conditions.

 

10. Declarative Configuration Model

 

Developers define what should happen in each state rather than how, allowing the system to autonomously orchestrate complex world changes and narrative progression.

Unity Implementation

image.png

2. Configuring active objects

We configure the objects that we want to activate and deactivate when that node is active (Active Objects & Inactive Objects)

1. Configure Mission

We configure the mission that will start when the node is active

3. Game Objects are configured to receive orders from the system

We add the Unique ID and World State Listener components, which will be responsible for receiving and transferring orders from the system to the object.

image.png
image.png
image.png
image.png

With this, we would have all the necessary implementation for a specific node to manage the game logic, activating and deactivating objects according to our needs.

Now we just need to connect our node to other nodes and define the flow of our game. When we call ActivateNextState, it will automatically move to the next state. 

Since we can call through different public events (Unity Events) present in other parts of the code, a stack trace is added to know at all times from where the call was made.

In case the node we are working on has 2 possible branches, the ChangeGameState function is used, where the change is made to a specific node, instead of the next node.

​It is a system that is not complex to implement and is easy to maintain, allowing for very flexible and optimal use.

Hugo Rufete - Game Designer

bottom of page