Systems
Last updated
Last updated
Systems handles the data manipulation and storage within the game.
All core modules reference system to get its data.
Almost all classes in Systems are pure C# class. This reduces unnecessary complexity in the project, as well as enables the class for Unit Testing.
There are 3 main elements that are inside Systems :
Configurations are immutable data of the game.
It contains all the database needed for the game, such as balancing, exp table, etc.
Most of the data is exported from this sheet, and transformed into JSON or ScriptableObject.
AppState stores data related to player's progress.
This is the data that will be saved into disk & backed up into cloud
AppState will try to load the data from disk when it is constructed
AppStateSaver
AppStateSaver is responsible in saving the data to disk.
It listens to any changes in data or event in AppState, and saves it accordingly
Blackboard is the collection of "managers" in the game, e.g. Inventory, Settings, etc.
It is constructed by supplying Config and State to it.
Typically Blackboard will contain three types of variables :
Config : immutable data (obtained from Configurations)
State : progress data (obtained from AppState)
Bookkeeping : aggregate variable that can be calculated from the class itself.
Blackboard is essentially a singleton, and the game can access them by calling Blackboard.Inventory
, Blackboard.Settings
, etc.
Note: even though it's a singleton, it's strongly advisable to only use it from outside the Systems module (for example UI).
If you need to access other System from a System, just inject it in dependency when it's constructed.