Managing 3D Game Worlds

Started by
2 comments, last by Jason Z 12 years, 8 months ago
Hi, I have been searching on Google and looking over these forums for a while and haven't found what I am looking for, I think I am wording it wrong for any search engine so maybe someone can help me grasp these concepts.

I am a c++ programmer and have worked with OpenGL and I understand how to do things like, render primitives, load models, get input from devices, etc. what I am struggling with, is putting it all together. Nor can I find information about this or maybe what I am looking for is not the way it is done.

How do I manage a 3d scene, ie. Load Game World Objects into a scene and manage them, the way I visualize it and which may be my shortcoming, is like a hierarchy of
objects, all with parents and children. but maybe this is way to complicated for a simple game. Should I use a basic container like vector and iterate through it every frame?

I have tried project after project, attempting to use this hierarchy idea, and have alway's come to a dead end. I have read several books, and they go as far as telling me how to draw objects, and control them, but what If my Game World is per say, a large Solar System with Planets, Asteroids, Ships, and a Star, how do I manage them all?
Advertisement

Hi, I have been searching on Google and looking over these forums for a while and haven't found what I am looking for, I think I am wording it wrong for any search engine so maybe someone can help me grasp these concepts.

I am a c++ programmer and have worked with OpenGL and I understand how to do things like, render primitives, load models, get input from devices, etc. what I am struggling with, is putting it all together. Nor can I find information about this or maybe what I am looking for is not the way it is done.

How do I manage a 3d scene, ie. Load Game World Objects into a scene and manage them, the way I visualize it and which may be my shortcoming, is like a hierarchy of
objects, all with parents and children. but maybe this is way to complicated for a simple game. Should I use a basic container like vector and iterate through it every frame?

I have tried project after project, attempting to use this hierarchy idea, and have alway's come to a dead end. I have read several books, and they go as far as telling me how to draw objects, and control them, but what If my Game World is per say, a large Solar System with Planets, Asteroids, Ships, and a Star, how do I manage them all?

My two cents:
First you should divide your engine in different parts, like render-engine, physics-engine, game-logic, AI. The reason is, that you often need special or optimized representation of your world objects in different contexts. This already lead to the necessarity, that you will not be happy with only one representation.

The hierarchy is a good starting point, it will help you to organise your objects in a game-logic way (have different squads, with mulitple members , who got different equipment etc.) and is often useful for updating objects.

The next step should be a "random access" structure, where you can query your world according to some parameters, i.e. "give me all objects at position X of type Z". Sweep'n'prune would be a good start, because of its good performance and handling of dynamic objects. Or an oct-tree. You could combine them (static object => oct-tree, moving object =>SnP).
Your hierachy must be synchronised with this structure.

The next step depends on your rendering/physics engine etc. External libs for physics(recommended to use one !!) often have their own specialised structures, renderer engines too. When writing your own rendering engine you could start to use your game-logic query structure first, but certain rendering techniques could perform better with spezialised structures.
I've been looking into Bullet recently and that's what it is about.

SAP has proven to be not good enough IMO. With more than 5% moving entities (410) it becomes almost 3 times slower than btDbvt, which I understand to be an AABB tree. See CDTestFramework.

I've been playing with BVH for a while and recently moved to an array of AABB as well. They always provided good perf to me so far, although I wish I would have just used AABB since start as I spent so many time on this it's hard to believe.

Previously "Krohm"

I use a spatial scene graph as my hierarchy, which I think is what you are describing. If you are looking for some information about building a scene graph in a rendering system, then the Dave Eberly books are about as good as they get (Geometric Tools). This will not show you how to manage a solar system, but does go into detailed design decisions about how and why he used a spatial scene graph in the Wild Magic engine. His engine is also a good reference for lots of algorithms, so it will be worth your while to check it out.

This topic is closed to new replies.

Advertisement