System addition/removal. I'm not doing topo sort (today)
This commit is contained in:
parent
9be97de885
commit
04a6555cbd
2 changed files with 119 additions and 6 deletions
|
|
@ -23,16 +23,14 @@ Components are SRFI-99 records which store data associated for a particular enti
|
|||
|
||||
** Systems
|
||||
Systems are functions which modify state and draw to the screen.
|
||||
Systems are stored in the ~systems~ list as a record containing a name (symbol), rendering (a symbol), a priority (integer), dependencies (list of symbols), entity criteria (list of symbols), and the function itself.
|
||||
Systems are stored in the ~systems~ list as a record containing a name (symbol), rendering (a symbol), a priority (integer), entity criteria (list of symbols), and the function itself.
|
||||
Each system specifies the components an entity (the entity criteria) must have for it to be processed by that system. The entities are then selected for the system from the ~component-sets~.
|
||||
Each system is applied to all entities which match its entity criteria.
|
||||
Systems have a priority which defaults to 0. Lower priority systems will be executed before higher priority systems. Systems within the same priority execute in order of addition to the ~systems~ list.
|
||||
Systems can depend on other systems, which moves them to execute after the system specified.
|
||||
If a system defines a rendering symbol of 3D, it will be wrapped in ~with-mode-3d~. If a system defines a rendering symbol of 2D, it will be wrapped in ~with-mode-2d~. All systems run in render loop, wrapped in ~with-drawing~, and can draw non-2D and non-3D elements arbitrarily. In this way ~with-mode-3d~ and ~with-mode-2d~ can be avoided in system function bodies, and non-3D/2D systems can draw in screen space.
|
||||
|
||||
The ~systems~ list is sorted on each addition and removal of a system.
|
||||
Removal of a system which has dependent systems results in an error.
|
||||
Addition of a system which creates a circular dependency loop results in an error.
|
||||
Like entities, the addition of systems is queued for the beginning of each frame. This prevents the system list from being sorted multiple times per frame.
|
||||
|
||||
Systems can access resources via free variables or by being formed as closures. Systems only ever take an entity (a component list) as input.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue