- Minimal entities
- Behaviours as Tags/labels
- Behaviour containers
Behaviour containers contain a message handler which takes all the standard arguments, plus the ID of the entity that this behaviour is acting for. If the behaviour requires per entity unique data, the behaviour container will also have a pool of entity states. For memory's sake, only entities that have differences from their creation prototype get their behaviour state instanced.
Obviously, there is also the immediate speed benefit of using pools of entity states too, but that may be counterbalanced by the inherent slowdown of such a dynamic system.
Some behaviours have prerequisites of other behaviours, such as "IsCollidable" requires "HasWorldPresence".
All entities get around their game world via messages, and all messages can be simple, but for complex message sequences, it might be better to "strike up a conversation", when i mentioned this to someone they said that ratchet and clank(tm) used this system, so even though i think i thought of it alone, i can't claim "new idea". The system is straightforward enough, you create a reference counted conversation object, you send it along with your message, elements get filled in, and you get messaged back with "done filling it in" messages which allows you to carry on with the rest of the complex sequence you started.
For the system to be fully dynamic, the tags (after the compiled in ones) are stored in the tag manager, and you can forward and reverse search the tags (tag->string->tag).
So, you have a behaviour container registry that lets you get the correct behaviour container by tag (which you can get by name from the tag manager, or from the entity you are talking about just by getting one of the tags in the member taglist), and the functionality of that behaviour is either uniform across all entities that have that tag, or is unique per entity by getting the behaviour struct contained in the behaviour container. Scripted logical tick functions can be written easily by having the Tick tag call a script once a tick, or alternatively call a standard format tick function in C++.