core::list<SceneNode*> in CSceneManager

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
burivuh

core::list<SceneNode*> in CSceneManager

Post by burivuh »

Can anybody explain why list is used as storage? All work that I notice with it - is work by iterative enumerating or iterative searching (in getSceneNodeFromId).
So using map will be better for searching and the same for enumerating.
For example, any strategy game with huge number of interactive AI units (like in Total War, for examle) will exclude working with getSceneNodeFromId.
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

In my sceneManager, they are core::arrays. And from what I can see, they aren't search or iterated through.

The approach is similar to a bucket system, where you have multiple arrays or queues. In this case, the buckets are used to separate the render times of nodes, so they can be rendered in the proper ordering.

The order is so :
  • Lights and Camera
  • Skybox
  • Solid
  • Shadow
  • Transparent
I don't see this core::list you're talking about.
Image
burivuh
Posts: 30
Joined: Tue Nov 22, 2005 1:22 pm

Post by burivuh »

Sorry, my post wasn't correct.

Look at the list of children of any scene node.
Then, where this list is used (by getChildren method of ISceneNode)
Then, look at getSceneNodeFromId method of CSceneManager.

Version of engine: official 0.12.0.
hybrid

Post by hybrid »

I'd say that this is the usual implementation of an unbalanced and unbounded tree. But it's just used to handle the Scene tree and should not be misused for internal game state handling. Create your own objects for each entity in your world and store them in an efficient data structure. Add a pointer to the scene node in each object and you're done. For rendering it might not make sense to use different structures and using rb-trees would add additional overhead due to rebalancing.
burivuh
Posts: 30
Joined: Tue Nov 22, 2005 1:22 pm

Post by burivuh »

As I thought.
Thank you.
Post Reply