Sign in to follow this  

Scene Graph Automated creation/destruction

This topic is 4310 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay, so I finally have a couple scene graph nodes that can work together to create a scene. I can create nodes, destroy them, do rotations and translations, have depth of field, etc etc.. I could probably have a pretty decent scene if I wanted to. The problem is this, right now I am in the situation where I would have to hard code the scene graph to create it, I.E-> create every node individually and link them together myself. Now I'm not 100% sure, but I think that is a big big problem. It seems to me that I should have some type of manager that accepts requests like, SoldierA.create dof/geometry for each part of the soldier is created.. and trucka.create, which creates a dof for the body and the 4 wheels and everything a truck needs, links them together, etc.. How do I go about doing this? Do I need to start defining a game entity class? How does this work?

Share this post


Link to post
Share on other sites
From a speed-of-development standpoint, you are right that your current, hard-code scheme is a problem (unfortunately, I had to learn this the hard way...). However, your proposed solution of having a manager class to setup the scene is a little off. I say this because it is virtually impossible to anticipate every scene setup you want to create and therefore automate its creation in code. This was initially an error of thought for me too; I am an extremely object-oriented thinker and there comes a time when object-oriented practices fail.

My recommendation is to try to create a scene editor that will allow you to interactively modify a scene. I realize this is no small task (this is what I have been working on for quite some time), but I think the benefits will be enormous.

Share this post


Link to post
Share on other sites
So maybe...

Start programming a scene management library? With functions that manipulate the graph, add a gui perhaps to simplify usage while working.

Functions like, create object, you fill out a few boxes (where do you want him, some other things i'm sure)

But what about for things that we know will always be true..

For instance, we know that the race car will always have 4 wheels with dof nodes and geometry for each, is there a way we can say Create race car at location x/y/z automatically? Or do I have to individually add wheels too?

Share this post


Link to post
Share on other sites
You might want to load data like this from a file, just like you load meshes from a file. For example, the car is made up of a chassis, which uses mesh x, and is located at offset y. Then you have a wheel, which uses a wheel mesh, and it has offset point z with this and that rotation and is connected to the chassis... something along those lines. Then you load a car, and your loader or manager creates all required nodes, meshes and textures.

Though I have never done anything like this before I think I'd do it like that. And surely, a scene editor would be a very nice tool to quickly create scenes.

Share this post


Link to post
Share on other sites
Yeah, a scene editor still needs things that it can create, like, a tree, a car, terrain, etc etc..

I think these types of things need to be either hard coded or modulated into the engine in some way, via a file or something like that...

Just what to do, not quite sure...

Share this post


Link to post
Share on other sites
It is a good point when you say:

Quote:
But what about for things that we know will always be true..

For instance, we know that the race car will always have 4 wheels with dof nodes and geometry for each, is there a way we can say Create race car at location x/y/z automatically? Or do I have to individually add wheels too?


There will be certain things that are constant, such as 4 wheels on a vehicle. But in any case I can think of, it makes perfect sense to have that data organized by file as Structural said. You have the right idea about making a scene management library, but instead of making a method "LoadCar()" or "LoadTerrain()", make it more general purpose by writing a method "LoadModel(string file)". This should take care of a 4-wheeled vehicle, a tree, a terrain, a whatever.

Share this post


Link to post
Share on other sites
So I can create an interface to the scene graph, like a scene management library....

I can create an object, something like


struct SceneObject
{
numdofnodes;
numgeonodes;
//numblahblablah
}

I can use a file type to fill this information out, and I can pass these objects into the graph as I need them.

Something like:


SceneObject RaceCar;
RaceCar.Load(string filename)
SceneManager.create(RaceCar)


And bam, just like that, I have a DOF for the car body, a dof for each wheel, and 4 wheel nodes...


One thing is itchin at me though, I'm thinking real hard about how to link these together, maybe arrange them in order in the file from top to bottom? Hmm...

Any thoughts?

Share this post


Link to post
Share on other sites

This topic is 4310 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this