Original Post
So, in my game I have a list of every object in the game world. This list is simply a std::list containing CEntity pointers, Entity being the base class for all objects in the game. I have different derived classes, like CInfantry, CVehicle, CAircraft, CStructure, etc. Now let's say I direct a CInfantry unit to attack, I'll want it to have a different animation when it's attacking another infantry unit versus attacking an aircraft unit. That is only an example demonstrating how varied interaction between different types of entities is desired, I'm not asking for solutions to that specific animation problem. The main problem is that I want varied interaction between the different types of units. I don't want a unit's behavior towards a tank to be the same as it is towards a foot soldier. This issue is easily solved using RTTI, but the general sentiment towards RTTI is that it's bad/slow/too much overhead, etc. So, my questions: Is using RTTI that bad? Is it so slow that, in a game world with lots of collision detection going on (and thus lots of type identification happening) it will cause massive slowdown? This problem that I have seems like something that would come up a lot in game developement, is there an industry standard alternative to RTTI? Is my design just bad in general, is there a way I could design my game such that this problem doesn't arise? I've heard a lot about multimethods as a way around RTTI, but are multimethods that much better? They aren't natively supported in C++, so I don't know if they are something I should seriously consider (I would like my code to be portable, but it's portability is not essential). There, that's a lot of questions, any help is appreciated! Thanks in advance.