Update 'Scene Actor Component model'

~keith 2022-02-23 23:42:32 +00:00
parent 21e20033d0
commit 227e9bb882

@ -8,10 +8,21 @@ In general, scenes (and the actors within them) *should not* reference other sce
# Actors
Actors represent the game entities within a scene. They have a transform (location, rotation, and scale), may be a child of another actor, and contain a set of components which define their behaviour. They also store a set of tags, which can be used to classify and filter for specific types of objects (e.g. terrain, enemies, players, UI).
Newly created actors should be initialized using the `(initialize-actors-in)` function, like so:
```common-lisp
(initialize-actors-in my-scene
(new! actor :name "Example"
:component (new! sprite :texture my-texture)
(new! actor :name "Another example"
:location (vec2 4.20 -6.9)
:component (new! sprite :texture another-texture))
```
# Components
Components define a group of behaviours and properties for the actor they're attached to. They can interact with other components and actors.
If a component needs to automatically establish a reference to another component or actor, it should do this during late-stage initialization, eg. in `[component (activate)]`. Otherwise, the other object may not have been instantiated yet.
If a component needs to automatically establish a reference to another component or actor, it should do this during late-stage initialization, eg. in `(activate)`. Otherwise, the other object may not have been instantiated yet.
## Lifecycle
![Component lifecycle diagram](https://bytes.keithhacks.cyou/keith/wh-engine/raw/branch/master/doc/component-lifecycle.svg)