Idea:
an Entity Manager that got a map/vector/tree of entitys (maybe somewhat organised as a Quadtree or stuff). via manager->register(MyEntity) one can add an (derivated class) Entity to this map. The manager now will call certain events for this all the entitys. (Collision, update, interaktion etc) Those events are virtual Functions one can modify.
Disatvantage: every event will be passed to every Entity -_-
There might be some ways around this (having a list of all entitys that are interested in a special event or something, delegates etc)
(I'd allways would like to have suggestions)
Each entity need to have a way to comunicate with the others entitys propertys -> for example calling members or modifying some variables.
Example: We got a explosion entity that will damage every other entity that will collide with it. So we have the collision callback collided(Centity *other)
now assume this callback is triggered for the spaceship -> whatever
No we need to figure out what kind of collision did happen. The class Centity will simply have some ID (either a String or a Int) now we are able to access this value of the xplosion entity since its part of Centity and thus other->ID works. Now we determin other->ID=="explosion"
*Edit* maybe using RTTI? ->dammit slow??
The next step would be to figure out some internal value (lets say the strength.) So we got a few ways to make this values accessable:
1) We make some public values available in Centity. For example lets say 20 public floats (lets call 'em skills) -> this is the method used by the A6 engine. I guess this is the most retarded way of handeling this.
2) We create some virtual functions in Centity that will take a variable name and return its value. ->suxx since one always would have to build this function and returnvalues have to be a fixed type -_-
3) we have to cast Centity* other to CentityExplosion* to access its internal values. (I think this is the best version.. but still suxx)
4) another better way
![Wink ;)](./images/smilies/icon_wink.gif)
which way would you say might be the best?
Everytime I get a new Idea I will find a whole bunch of disatvantages so I was not able to come to some kind of conclusion ^^
Is there any good litrature/papers around regarding entity Managment etc. ??
greetz TGM