Jump to content
  • Advertisement
Sign in to follow this  

sanity check

This topic is 3965 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just wanted to get a sanity check on how I'm handling updating and drawing objects in my game. The high level process I have in place currently is 1) loop through the hierarchal storage of objects and update positions, check for collisions, and update AI 2) create a sorted render list of visible objects, this is done by traversing the octree and adding all objects that are within the currently active camera's view frustrum to a sorted linked list, this may possibly change to a priority queue in the future. 3) draw all objects in the render list I'm currently using an octree to store all object, but was thinking of implementing either a hierarchal grid, or k-d tree for dynamic objects if the octree proves too slow while dealing with dynamic objects. If anyone has any suggestions or can think of anything incorrect with this approach I'd really appreciate your input.

Share this post

Link to post
Share on other sites
It really depends on the type of level geometry you use. For example, human architectures are considered to be most efficient with a BSP tree, whereas octrees are more efficient for terrain. So, your map when loaded can consist of more than one kind of model, .bsp's for buildings and octrees for terrain.

Personally, I use a tree structure with a small polygon soup as each leaf node. I then use frustum culling with Axis aligned bounding boxes. Branch nodes have an axis aligned bounding box encompassing all its child nodes, allowing me to determine if I need to run frustum tests against the children of that node. I try to ensure that less than 64 polygons are in each leaf node, and each leaf node is a display list rather than rendered on the fly.

[edit] oh, and dynamic objects use the same system, with a tree for the geometry. the collision mesh is either a box, a cylinder, a sphere, or a trimesh, based on some conditions I set in my 3d drawing app.

This seems an effective system. My game involves a large city full of monsters, and not all of it will be in memory at once. I plan at some time to replace my current, home made renderer with Ogre. (its only for debugging the game, with nothing more advanced than textures).

If your just making a game for fun and self education, do it with brute force, or try structures one by one for learning purposes.

My game loop looks like this:

while(nobody sends an exit event)
gather events
update physics
update characters
update AI players logic
update human players stats
update character locations based on what human and Ai players want to happen
possibly post more events
update game logic
update sound system

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!