ForgeDocs
Documentation for the forge framework
|
Manages the execution of a game. Allows for players to input commands to the game, thereby modifying how the game plays out. More...
Public Member Functions | |
Task | Update (IEnumerable< IGameInput > input) |
Runs a game update tick using the given input. This means that systems get executed based on the current game state and the given input. More... | |
Task | SynchronizeState () |
Synchronizes the state of game. No systems are executed in this method. More... | |
void | DispatchEvents () |
Dispatches all of the events that have accumulated from updates since the last call to DispatchEvents(). This method operates on the calling thread, so ensure that the event handlers don't consume lots of processing time. More... | |
IGameSnapshot | TakeSnapshot () |
Iterates through all data inside of the engine and returns a a snapshot of the game that reflects everything contained within the engine. More... | |
int | GetVerificationHash () |
Returns a hash code of all data inside of the engine. The hash code is computed via reflection and can be used to attempt to determine if two game engines are out of sync. More... | |
Properties | |
IEventNotifier | EventNotifier [get] |
Event notifier used to notify listeners of events that have occurred inside of the engine, such as an entity being added. More... | |
Manages the execution of a game. Allows for players to input commands to the game, thereby modifying how the game plays out.
Instances of this class are allocated when loading levels.
void Forge.Entities.IGameEngine.DispatchEvents | ( | ) |
Dispatches all of the events that have accumulated from updates since the last call to DispatchEvents(). This method operates on the calling thread, so ensure that the event handlers don't consume lots of processing time.
int Forge.Entities.IGameEngine.GetVerificationHash | ( | ) |
Returns a hash code of all data inside of the engine. The hash code is computed via reflection and can be used to attempt to determine if two game engines are out of sync.
Task Forge.Entities.IGameEngine.SynchronizeState | ( | ) |
Synchronizes the state of game. No systems are executed in this method.
The game manager will typically run in a multithreaded context, with the rendering thread pulling data from the game. If the shared state between the game and the renderer suddenly changes half-way through a render, then tearing and generally bad things will happen. Because of this, when updating the game, no shared state between the renderer and the engine is modified. Instead, it will be modified after this method has been called.
IGameSnapshot Forge.Entities.IGameEngine.TakeSnapshot | ( | ) |
Iterates through all data inside of the engine and returns a a snapshot of the game that reflects everything contained within the engine.
Be wary of calling this method too often; it requires that no update is occurring (it will block until the update is done) and can take a decent amount of time to calculate. It additionally performs a large number of allocations.
Task Forge.Entities.IGameEngine.Update | ( | IEnumerable< IGameInput > | input | ) |
Runs a game update tick using the given input. This means that systems get executed based on the current game state and the given input.
|
get |
Event notifier used to notify listeners of events that have occurred inside of the engine, such as an entity being added.