Game Development Reference
In-Depth Information
Aspects
(Rendering, Physics, Logic, Audio, ...)
Core Engine
Shared Libraries
Base Engine Libraries
(Memory management, debugging, File IO, ...)
Figure 1.6. Dependency layers.
Aspects should be designed to keep this kind of sharing to a minimum. Static
resources like the current graphics device/context or window handle should not
be shared between aspects, though where sharing is unavoidable, these should
provide a mutex to control access.
By maintaining these rules, aspects will operate independently and be much
easier to maintain and replace. An audio aspect using one API will be inter-
changeable with an aspect using another API. Each aspect can therefore be de-
veloped and tested independently, interacting with each other by manipulating
the engine core.
The engine manages all aspects through a single interface, initializing, updat-
ing, and shutting down aspects in an order specified by the user of the engine.
This could in theory be performed through data, allowing the engine to construct
itself from dynamically linked libraries at runtime.
1.4.1
Scene Interpretation
Each aspect should maintain an internal structure of references to nodes in which
it is interested. Interest is determined by querying the node's attributes looking
for specific patterns. For instance, a node with an identifier matching a rigid
body would be of interest to the physics aspect, whereas one that referenced a
geometry and material instance would be of interest to the render aspect. The
nature of this structure and the way it references the nodes can be tailored to
the aspect, allowing the most ecient solution for the functionality it provides.
This could be a spatial tree for operations based on the relative position of nodes,
such as frustum culling visible nodes against a camera node, or a simple linked
list of nodes that can be iterated over once per frame ( Figure 1.7 ) .
When an aspect is registered with the engine core, it parses the whole of
the existing scene graph and registers interest in any nodes. From then on it will
receive events regarding changes to nodes and to the structure of the scene graph,
allowing it to synchronize its own internal structures.
 
 
Search Nedrilad ::




Custom Search