GameGraph

Game state serialization, scene loading and flow visualization toolkit for Unity

Asset store API Readme

GameGraph is a game state management system that constructs a graph visualization said states.

It contains

Just create scene sets, containing addressable references to the wanted scenes (base scene, additive scenes, conditionally loaded additive scenes) and within those scenes, trigger modifications to the game state and react to the current game state.

The graph is calculated based on the modifications linked with specific scene sets and traversed through those to find all the variants.

The scene sets are used as the main nodes in the graph and then contain the variants of all the variable mutations available therein.

SceneSets in GameGraph contain addressable references to the base scene, optional additive scenes and optional dynamic additive scenes which will be loaded as a, well, set.
Dynamic additive scenes have conditions for loading, e.g. variable A has been set to true and variable B has been set to false.

Variables are used on top of the scene set, for the dynamic changes within. These are used by the representations and scene sets for the dynamic additive scenes.
If there is anything that can't be depicted by just the currently loaded scene set, they are depicted with variables.
Variable are modified through modification lists, ensuring that they're known ahead of the time for graph visualization purposes. This means that their changes can be tracked for testing.

Sometimes, often even, it's not enough to load a varying scene set but the scenes have to contain some modifications based on the graph state. For this purpose, representations can be used to react to variable changes and trigger things to happen.
Representations, well, represent the dynamic changes within the scenes based on the graph system state, for example, where to spawn the player from based on the previous scene set or if a certain Game Object should be active or disabled.

State modifiers, embedded in the scenes and linked to the specific scene sets contain a reference to a modification list, which in turn contains modifications to the graph state.
These modifiers are then triggered based on whatever is needed, e.g. by OnTriggerEnter, by code...

As all state transition logic is decoupled from the scenes, it's possible to calculate a graph of all available potential states in the system. This is then visualized as a graph where the states can be examined or loaded for testing in play mode.