Item List and Info... In Scene Graph/Node or Seperate List?

Started by
4 comments, last by Telastyn 18 years, 7 months ago
I need to store a list of game objects that exist in my world and their positions and data such as attributes (health, strength etc.). I currently have a scene graph which holds the meshes and nodes, but should I really have a seperate world inventory so to speak, or should I just subclass a scene graph node and put the information in there? Is the scene graph best left for rendering purposes and have a seperate game object list and game object class that points to the correct rendering node? Thanks
Advertisement
Seperate is much better. You might inherit from the same tree structures to orginize them the same way, but the trees themselves should be seperate instances.

Why? Because objects should be seperate from their representation. It makes for a cleaner use of the object by themselves. It makes for an easier time to change/upgrade either the object or its representation without breaking the other half. It eases moving objects to a place where they're not rendered [AI/network server]...
Quote:Original post by Telastyn
Why? Because objects should be seperate from their representation. It makes for a cleaner use of the object by themselves. It makes for an easier time to change/upgrade either the object or its representation without breaking the other half. It eases moving objects to a place where they're not rendered [AI/network server]...


Interesting you mention moving them to somewhere they are not being rendered, as that is another thought I was having. Won't they still need access to a lot of the same information as in the scene graph such as bounding boxes and vertex information to do collision detection if they are on a server?
Quote:Original post by Raeldor
Is the scene graph best left for rendering purposes and have a seperate game object list and game object class that points to the correct rendering node?


This seems to be a common approach, one which i agree is better over the former. You might be interested in reading this:

The GDC 2003 Game Object Structure Roundtable check the Scene Graph section.

Slightly related to:

Game Object Structure: Scene Graphs
Game Object Structure: Scene Graphs Revisited

Take what is said in those articles with a fine grain of salt as the guy writing those articles is just as confused as anyone else.
Quote:Original post by snk_kid
Take what is said in those articles with a fine grain of salt as the guy writing those articles is just as confused as anyone else.


Wow, great site... never seen that one before. You are right about the confusion, but in a way it's strangely reassuring :P. The articles helped a lot though, as did your advice. Thank you.
Quote:Original post by Raeldor
Quote:Original post by Telastyn
Why? Because objects should be seperate from their representation. It makes for a cleaner use of the object by themselves. It makes for an easier time to change/upgrade either the object or its representation without breaking the other half. It eases moving objects to a place where they're not rendered [AI/network server]...


Interesting you mention moving them to somewhere they are not being rendered, as that is another thought I was having. Won't they still need access to a lot of the same information as in the scene graph such as bounding boxes and vertex information to do collision detection if they are on a server?


[IMO]

Well, ideally, no. Ideally, game objects exist in the game world, which has no concept of vertexes. There you have game world position, size, weight... things that matter to the game. The representation builds off that, with added stuff [camera, images, models]. It's simple hierarchal object design on a massive scale. Making game coordinates equate to rendering coordinates leads to these sort of design issues when you need to run a server or use AI.

[/IMO]

This topic is closed to new replies.

Advertisement