Game Events
Union defines several Game Events that are dispatched when a specific event occurs in-game. Handlers are defined in Plugin.cpp
and we can use them to execute our code during specific moments of the application lifetime.
Events
Initialization
Game_Entry
Executes at the entry point of the Gothic executable. During this time the engine classes are not yet initialized, so using them may cause an access violation. The entry point be used to execute some logic before Gothic loads itself.
Game_DefineExternals
Executes before the Daedalus parser starts loading scripts. It's meant to define custom external functions.
Game_Init
Executes right after DAT files are loaded and just before the main menu shows up.
Level Change
Game_LoadBegin
Executes when we initiate a level change by one of the possible actions. The default plugin template uses a common LoadBegin()
function to handle all events but we also can write different logic for different cases.
Game_LoadEnd
Executes when the level loading finishes. The default plugin template uses a common LoadEnd()
function to handle all events but we also can write different logic for different cases.
Game_LoadBegin_Trigger
Executes when the player enters a trigger that initiates ZEN change.
Game_LoadEnd_Trigger
Executes after the player has entered a trigger that initiates ZEN change.
Game_ApplyOptions
Executes after Game_LoadEnd
, when we save the game, and also when we exit the game. It's meant to be used to apply options from INI files.
Game Loop
Game_PreLoop
Executes at the start of every frame.
Game_Loop
Executes at every frame.
Game_PostLoop
Executes at the end of every frame.
Game_MenuLoop
Executes at every frame when the game menu is active.
Game_SaveBegin
Executes when the player started saving a game.
Game_SaveEnd
Executes when the game save finishes.
Game_Pause
Executes when the player opens the in-game menu.
Game_Unpause
Executes when the player leaves the in-game menu and also when the player loads a saved game.
Shutdown
Game_Exit
Executes when the player exits the game.