Game Development Reference
on the level to which such an aspect is developed, it could vary in functionality
from a simple debugging tool displaying attribute values as formatted strings to
an in-game editor capable of manipulating the structure of the scene graph and
rendering complex widgets for editing node attributes.
1.5.4 File Aspect
Notable by its absence from the engine core is any ability to load data from files
into the engine. That is because this functionality also is supplied by an aspect.
The loading of the scene data into the core is controlled by the file aspect, an
aspect that looks for nodes with attributes that reference filenames. Once found
these names are submitted to a factory system.
Factories. This factory system itself follows a modular structure. Each file type is
associated with a factory module that processes the file, constructing a subgraph
from its contents. This subgraph is then passed back to the factory aspect, which
can then replace the file-referencing node with the subgraph that it represented.
Once inserted into the scene, the new subgraph will be parsed by all the aspects,
including the file aspect, ensuring that any file references contained within the
subgraph will also be processed.
As such factory modules exist above the aspects in the dependency rules, it
is possible for them to have knowledge of individual aspects. If a file contains
resources only pertinent to a single aspect, then the factory can communicate
directly with the aspect or even be a part of the aspect itself, bypassing the need
to insert this data into the scene graph.
Scene conditioners. When a scene is constructed from a variety of file types and
by recursively dereferencing nodes, in this fashion it can result in a structure
with many redundant nodes and various other ine ciencies. To counteract this,
a further system of modules is used to iterate over sections of the scene graph,
analyzing and optimizing its structure. These conditioning modules can also be
used to add further attributes to entities required by an aspect, thus acting as a
preprocessing stage for the aspects.
When a subgraph is constructed by the factory system, it is processed by pre-
insertion conditioners. Then, once it has been inserted into the scene graph, it can
be processed by a set of post-insertion conditioners to perform further operations
based on the context of its position within the graph. The tasks carried out by
these conditioners are specific to the engine, the design of the aspects, and the
types of files being loaded. Their modular nature makes it simple to construct a
small, highly specialized conditioner for each task.
Pre-insertion conditioners are often used to optimize scene data that may
be needed during the authoring of the assets but not required in the specific
game. Doing so in the conditioning stages reduces the complexity of the factories,
allowing for a finer grained control. These might include tasks such as