One, Two Quesstions regarding Peformance

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
User avatar
blackwinged
Gnoblar
Posts: 6
Joined: Sat May 07, 2005 11:16 am
Contact:

One, Two Quesstions regarding Peformance

Post by blackwinged »

Hi!

I recently wondered if Ogre is performant and when Ogre will break down.

1) Ogre uses a lot of Listeners and User-Defined events. Is this really performanf when developing a game? What is a number of registered Listeners Ogre easily can handle ?

2) A lot of game logic is handled with casting Rays! Walking on Terrain for characters and the player uses it, Mouse Picking uses it, and when u want to determine if a NPC spots the player, one has to cast a ray as well. When you sum it up, there is a lot of ray casting every frame. How much rays in one frame can ogre handl before breaking down?

Thanks!

(Maybe I'll have some other performance issues at a later time)
][strange are the ways of the wolfhearted][
User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 2
Contact:

Post by Kencho »

About the first question, the number of listeners in use is up to you. It has been discussed many times in these forums about why using one listener per object (for example) is a horrible thing for performance. If your design is good enough, you can speed up things a lot. Ogre just does its work, and does it perfectly ;)

About the second question, well, again, the amount of rays casted is up to you. Terrain height is done each frame, I agree. But target spotting can be done once each 0.5-1 seconds, and mouse picking is done under demand (just in the frame a click is done), so performance shouldn't suffer from that. Again, a problem of design and performance tunning by your side, not Ogre's ;)

Hope that helps
Image
User avatar
blackwinged
Gnoblar
Posts: 6
Joined: Sat May 07, 2005 11:16 am
Contact:

Post by blackwinged »

hmm but how performant is a Listener System per se compared to other technologies ? And how performant is the implementation in Ogre ?

thanks :D
][strange are the ways of the wolfhearted][
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Post by haffax »

There is no performance penalty when using listeners. They are just a way to implement the observer pattern, hence notification about some events.
There is really few that one can do wrong with implementing listeners really. They are stored mostly in std::sets iirc. So insert/remove are both O(log n) instead of O(1)/O(n) for some other containers, but this is absolutly irrelevant since you do this only in setup and cleanup mostly. Calling the observers is a method call for each observer.

I don't know what you want it to be compared against. The other "technology" (looked at too many ads? ;)) would be using callback functions probably. The performance is more or less equal, but it is not an OO way and rather ugly.

Compared to everything other that has to be done in an application, the listener "overhead" is neglegtable.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
alphageek
Gnome
Posts: 365
Joined: Mon Jan 03, 2005 11:56 am

Post by alphageek »

Ogre performance can be excellent or it can be bad, depending on whether you use the most appropriate features.

A more interesting question might be: "I want to do X, what's the best way to go about it?"
Post Reply