Skip to content
This repository was archived by the owner on Mar 25, 2020. It is now read-only.

Initialization

pointcache edited this page Jan 15, 2017 · 4 revisions

URSA is built around Global and Local controlled initialization sequences. Initialization sequence is the backbone of URSA, it is very important. InitializerSystem provides public events to which you can hook up to customize initialization.

Sequences are implemented in InitializerSystem that resides on Global Systems stack.

#Global start sequence

When we start the game and GlobalSystems start working this is what happens:

IEnumeratorGlobalInitializationSequence(){for(;;){OnGlobalLoadConfigs();yieldreturnnull;OnApplicationConfiguration();yieldreturnnull;OnInitialLoadPersistentData();yieldreturnnull;OnGlobalSystemsEnabled();globalInitialized=true;yieldbreak;}}

OnGlobalLoadConfigs is where we deserialize configuration files from disk.

OnApplicationConfiguration - use those configs to setup our app, resolution, input etc.

OnInitialLoadPersistentData - load whatever you need from disk here

OnGlobalSystemsEnabled - activate the rest of global systems that rely on configs

#Local Start Sequence

IEnumeratorLocalInitializationSequence(){for(;;){while(!globalInitialized)yieldreturnnull;yieldreturnnull;OnLoadLocalData();yieldreturnnull;OnLoadersEnabled();yieldreturnnull;OnSystemsEnabled();//Launch game loop Pool<InternalConfig>.First.UpdateAllowed.Value=true;FullyInitialized=true;OnUiEnabled();yieldbreak;}}

OnLoadLocalData - Load Save files

OnLoadersEnabled - activate Loaders and let them rebuild the scene from data

OnSystemsEnabled - activate Systems

Clone this wiki locally