ForgeDocs
Documentation for the forge framework
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
Forge.Entities.IGameEngine Interface Reference

Manages the execution of a game. Allows for players to input commands to the game, thereby modifying how the game plays out. More...

Inheritance diagram for Forge.Entities.IGameEngine:

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...
 

Detailed Description

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.

Member Function Documentation

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.

Returns
A task that is completed when all state has been synchronized.
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.

Returns
A content database that contains all content within the engine. All data stored inside of the database is independent of the data stored inside of the engine, so changes to the engine will not be reflected inside of the database.
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.

Returns
A task that is completed when the engine has finished the update.

Property Documentation

IEventNotifier Forge.Entities.IGameEngine.EventNotifier
get

Event notifier used to notify listeners of events that have occurred inside of the engine, such as an entity being added.


The documentation for this interface was generated from the following file: