math & physics
I'm using DX9c to create my game engine... however I'm a little confused what to do about scene management.
How should I organize all my objects in the game. Is there any good scene management software out there? What about Physics. I need something that will work with the scene management easily so that I can do collision detection and other fun stuff like that.
What are people using out there when you use DirectX?
collision detection is FUN?
Look at the open source engines source for some scene graph and scene managing implementation (OpenSceneGraph, Ogre, CrystalSpace, ..).
Basically you want something called SceneGraph, in SceneGraph you have Nodes, attached to each other. You attach anything renderable to the nodes. When you move node, every subnode and attached renderables move too. Same applies to rotation or any other transformation.
When you outline this, you can try to implement a Octree optimization. Octree will build octane tree using attached renderables.
Physics is a little tricky, because the standard culling techniques aren't applicable to physics. I solve it this way:
1) using std techniques to render (Octrees)
2) using physics scene optimizations parallel (got BruteForce - no culling, and basics of some sort of tree - scene divided into little boxes, collisions only happens from one body to bodies in neighbour boxes)
btw: I know I can collide using octree, however I think this approach is much more flexible than constraining physics to rendering scene managers ...
@karligula: I agree, collision and physics is fun, but only when it has been already implemented and you're watching the result
Do you know if there is any good documentation for OpenSceneGraph, Ogre, or CrystalSpace explaining how the scene management stuff works.
I'm not very good at taking code and trying to figure out what it's for.
Just to clairify, you are using a scene graph to store all the data in your game, and another scene graph just for your physics?
I'm a little confused with the octrees bit. Are you saying your scene graph IS an octree?
I wouldn't consider a scene graph as an octree. A scene graph describes the logical relations between objects (a chair is in a house is in a village ...) (or an axe is attached to the left hand of the player). An octree is a spatial data structure that is often used for frustum culling, like: give me all the objects that are inside the frustum.
I think I didn't made that clear, octree != scene graph, octree is created using scene graph. octree isn't used for scene management, but just for optimizations. I hope it's clearer now