Skip to main content
gamedev.net
🔒 Locked

RTTI

Started by jacksonh 2 replies 1k views
Original Post
jacksonh
jacksonh
Does anyone use RTTI in their game engines? It would be so perfect for what I am working on right now (Cvars), but I am kinda afraid of taking a performance hit.
Kippesoep
Kippesoep
I use it quite a bit in the game I''m working on. The scripting engine allows storing a pointer with script-objects. I use RTTI to determine what kind of game-object this corresponds to. There can be quite a few RTTI calls in that area and I haven''t measured any performance drop. That doesn''t mean there isn''t any, but compared to the rest of the processing necessary for the game, it''s negligable. (Using MSVC6Pro, BTW)

But if you need RTTI a lot to determine actions in your program, I''d say you need to rework your design instead.
Kippesoep
Sneftel
Sneftel
With processors as fast and as underworked as they are nowadays, the extra redirection that RTTI requires should in most cases have a negligible effect on your game''s performance. If you are using RTTI in an inner loop that needs to be aggressively optimized, however, you might want to worry about it a little bit.

You won''t now for sure what effect RTTI has on performace until you actually do it, and profile it; there are far too many variables for a generalized answer to be useful. Give it a try.... tell us how it works out.
jacksonh
jacksonh
The only place I would like to use it is in the handling of my console arguements, so I guess it will be OK. Thanks.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.