Sign in to follow this  
sipickles

Dealing with objects in a game

Recommended Posts

sipickles    240
Hi, I am expanding my prototype engine to now include many areas, with many objects,eg buildings, rocks, mobiles. I am using C++, and have developed a class to manage objects. This cObjectManager has vector lists of pointers to objects. One list is globalObjects, one is localObjects, etc As mobiles objects move around the terrain the engine shifts the entry for the object from the localObject list for one sector and into the new sector. This way, only the objects in the present terrain sector, or adjacent ones, are checked against my frustrum for visibility. Does this system seem to make sense to people? How do others manage many objects, especially mobile ones Thanks in advance Simon

Share this post


Link to post
Share on other sites
pi_equals_3    517
Actually that sounds like a great approach, and I've read several articles in the past describing similar or identical methods.

You'll just need to make sure you really draw all of the objects which are visible. It might not necessarily be just the current and adjacent sectors. You might be able to see far away in one direction several sectors away. This really depends on how you're managing your scene though.

I'm assuming that every frame you go through a tree or some structure containing the terrain sectors. Once you do this, you'll know which sectors are completely culled, which are partly visible, and which are completely in view. The objects contained in these sectors would be the ones to draw, or to further check for visibility.

Where this really helps is with object collisions. In that case, yes, you would only need to check an object against adjacent sectors.

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