Game Development Reference
Figure 1.9. Aspect update loop.
releasing the lock. It must now wait for a period of time until the next update
step can be performed.
1.7.2 Example: Entity Changing Color Upon Taking Damage
This simple example describes a possible set of operations that might occur in an
aspect-driven engine when a bullet strikes a character in the game causing the
target's material values to change.
1. During the update of the physics aspect, a bullet object intersects the col-
lision hull of a character. This generates an internal event in the physics
API. Upon synchronizing with the core at the end of its update, the physics
aspect pushes a collision event referencing the bullet and the character onto
the event queue.
2. When the logic aspect next updates, it retrieves the collision event from the
queue. It recognizes the event type “Collision” and is observing both of the
referenced nodes. It calls the collision handler script functions for both the
bullet and the character. The collision handler for the bullet requests that
the subgraph representing the bullet be removed from the scene. That of
the character changes the character's internal state to “damaged,” subtracts
the bullet's damage attribute from the character's health attribute, and
modifies the character's color attribute from white to red.
3. Once the logic aspect releases its lock on the core, the render aspect is
able to start updating. It notices the pending removal state change on the