Sign in to follow this  
wcmccullough

2D Scene Graphs Capacity

Recommended Posts

I already realize that a full blown scene graph is not incredibly useful for 2d, but I am going to implement a basic one for the project that I am working on. When storing nodes for a scene graph in a 2D game, is it preferable to only hold items in the graph that can actually be seen? or the entire world? Depending on the answer to the above, what should be a proper limit? Should I develop this out until I notice a significant performance drop? Any and all advice would be appreciated. Thanks in Advance!!!

Share this post


Link to post
Share on other sites
As with 3D, a scenegraph holds the "relational structure" of the scene. So they usually hold all objects regardless of visibility.

However, other structures can be used that allow fast visibility queries (in 3D: octrees, for example) and they might resemble a scenegraph (like a bounding box hierarchy) or not... but they coexist with a scenegraph anyway.

So for 2D, i´d use a scenegraph that holds the entire world, and then just activate/deactivate each object´s draw/update calls using any other method (ie. distance to the edge of the screen). The scenegraph usually exists to make things easier, not to make them faster.

EDIT: note all the "usually" i used :P. Sometimes things are different.
EDIT2: I don´t think i answered your "capacity" question properly. Any scenegraph is limited by the amount of memory you have (and stack size for recursive operations). You could use a plain list of objects and things would be exactly the same in terms of "capacity". If you are going to have thousands of objects in your game, then you should not worry that much about the scenegraph, but about culling and level of detail.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this