Skip to main content
GameDev.net gamedev.net
🔒 Locked

Component based object management + Scene graph question

Started by Valor Knight Sep 12, 2006 at 5:39 PM 3 replies 2.7k views
Original Post
Valor Knight
Valor Knight
I am creating an component based object management class/library and am having a couple problems. Say I have a component based object management working, which has a position component, and a render component. Now I want to create a scene graph and add a new object which contains both components in. How should I get the position data from the parents? At first I was thinking create a scene graph componet which tracks the children and parents of the object, but now that seems redundant. Basically the question is how do you setup a scenegraph for objects that are component based and will be render batched together? Removed question about GPG article.. [Edited by - Valor Knight on September 14, 2006 6:29:42 PM]
There is no life without honor
darkelf2k5
darkelf2k5
Well one thing is sure. In GPG they dont't talk crap. If someone can publice an article there, then you can be sure it's not BS.
Every time you implement a singleton, God kills a kitten. Please, think of the kittens!
Valor Knight
Valor Knight
True. That was my secondary question while I thought about how to word my original question. Updated original post to what the question really was.
There is no life without honor
James Sutherland
James Sutherland
I didn't see your post before it was edited, but if the question was about the article by Bjarne Rene in GPG5, then I did a fair chunk of the design and implementation of that system so I can probably answer any questions you have. And if not, Bjarne's sat opposite me :)

I'm not totally clear on what you're asking in your main question, but if I understand right, what we used in our implementation was a hierarchy component which was used to track parent/child relationships between objects. Also, for the sake of performance, we kept a pointer to the position component in all the other components of each object. As just about everything needs quick access to the position information, it seemed a reasonable tradeoff to add a few bytes to each component to cache a pointer, and save the cost of multiple lookups each frame.
Valor Knight
Valor Knight
Quote:
Original post by James Sutherland
I'm not totally clear on what you're asking in your main question, but if I understand right, what we used in our implementation was a hierarchy component which was used to track parent/child relationships between objects. Also, for the sake of performance, we kept a pointer to the position component in all the other components of each object. As just about everything needs quick access to the position information, it seemed a reasonable tradeoff to add a few bytes to each component to cache a pointer, and save the cost of multiple lookups each frame.

Ok, that is what I was thinking at first and then over thought it.

My main concern with the gpg article was really answered by writing the question out and figuring it out myself. the only thing that bohers me is the messages, components, and interfaces have to be known at compile time. I guess it could be worked around if it needed to be dynamic.

Thanks

There is no life without honor

Topic Locked

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

Sign in to reply to this topic.