Skip to main content
gamedev.net
🔒 Locked

Different 'scenegraphs'

Started by rick_appleton Jul 4, 2004 at 8:25 AM 2 replies 550+ views
Original Post
rick_appleton
rick_appleton
I currently have my game world in a flat scenegraph. Objects are at the highest level, with only a few items beneath that. An actor only describes how an object should act, and its position and speed etc. Below that I insert a model object on the client program, and nothing on the server, since nobody will be viewing the gameworld on the server. When rendering, I go through the entire tree, and concatenate the position/attitude matrices to get the final position/attitude of models and such. However, I'm running into a problem if I want to use this structure for collisiondetection as well. First of all, I'll be concatenating those matrices more than once each frame, which seems a bit overkill. And second, I can't just pick the position/attitude of each model easily to do the collisiondetection with. I'm thinking of creating an additional container object of some kind just for the collision (binary tree/ octtree or something similar). What options have I overlooked?
Nemesis2k2
Nemesis2k2
Well, if you're making a game that's a "standard" kind of free roaming game (eg, FPS), you're best option is to go with something like an octree. If you're making something different though, describe it. If the camera or the levels obey a more fixed set of rules, you might be able to build a scene graph that'll be a lot more efficient than a more general system like an octree.
rick_appleton
rick_appleton
Thanks for your reply Nemesis. Currently the game I'm planning is a top down shooter on which _all_ objects are located on the surface of a sphere. So I can easily divide the sphere into seperate nodes (probably using an octtree).

Any comments on the question on the concatenation of matrices multiple times per frame? Should I just do it once in the update cycle, and then store the result for each object?
PaulCunningham
PaulCunningham
That's what I do.

In my scene tree in SceneNode::update I calculate the real world location of an object.

//SIMPLIFIED...SceneNode::update(float delta_time){    this->setWorldTranform();    this->onUpdate(time_delta);        SceneNodeList::iterator iter = this->child_list.begin();    SceneNodeList::iterator end = this->child_list.end();    for (;iter != end; ++iter)     {        (*iter)->update(time_delta);    }}


Cheers,Paul CunninghamPumpkin Games

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.