XNA Game Development Forums
2012/05/21 19:28:15 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Calendar Login Register  
Pages: [1] 2
  Print  
Author Topic: Tutorial 2 :: Scene Graph and Object Framework  (Read 10053 times)
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« on: 2006/09/06 22:49:11 »

Discussion thread for the tutorial on putting together the basic scene graph and object classes
« Last Edit: 2006/11/30 05:52:31 by mikeschuld » Logged
Chr0n1x
Global Moderator
Sr. Member
*****
Offline Offline

Posts: 307


View Profile WWW
« Reply #1 on: 2006/09/07 04:22:13 »

I see you are using interfaces here, nice. Similar to the scene graph implementation I am using currently, but mine is developed to be used over a wide reange of applications, I can show you if you want, it uses generics. Cheesy
Anyway I will throw together this tutorial tonight, thanks! Cheesy
Logged

chris
Newbie
*
Offline Offline

Posts: 1


View Profile
« Reply #2 on: 2006/09/12 08:17:31 »

Hi,

Love your article - especially your coding style (use of interfaces etc.)

Some comments on the readability of the article:

The Object Manager code (scene_graph page) Doesn't specify the using's - not a big deal - but all the other code does specify them.

It looks like your blogging tool doesn't like the < and > signs - as the only "errors" in the code you show are both missing these bits.

Code:
HMNodeCollection : Collection<HMNode> is missing the <HMNode> part

HMSceneGraph.Draw definition
should be:
Code:
myRoot.Draw(
Game.GameServices.GetService<Microsoft.Xna.Framework.Graphics.IGraphicsDeviceService>().GraphicsDevice
);
Logged
frW
Newbie
*
Offline Offline

Posts: 2


View Profile
« Reply #3 on: 2006/09/12 16:55:21 »

First of all, very nice tutorials!

However, i have some major problems. ( I have done a little renaming, but following the same idea as you are ).

This:

Code:
myRoot.Draw(
                Game.GameServices.GetService<Microsoft.Xna.Framework.Graphics.IGraphicsDeviceService>().GraphicsDevice
          );

Is not working, gives me "Object reference not set to an instance of an object."

And the last private FEScene.FESceneGraph myScene = new FEEngine.FEScene.FESceneGraph();  is not said where to put it, i dont have myScene.. I searched the tutorial but didnt find where to put it.

And my SceneGraph is not a component.. Is it me that is just tired or something?

Is it possible to get the full solution from you so i can compare it and run?

Thank you man!
Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #4 on: 2006/09/12 20:32:52 »

The scene object should be handled by the IDE when you drag the component over to the game itself. There is a bug in the XNA Game Studio though that will sometimes remove the members when you go to the graphical view (I have had to add them back in by hand many times). You should be able to just go into the top of the Game class and add it. Also, for initializing the instance of the object, you ould normally place the code in the InitializeComponent function (which is where the IDE is supposed to do it for you) Good Luck!
Logged
frW
Newbie
*
Offline Offline

Posts: 2


View Profile
« Reply #5 on: 2006/09/14 13:52:05 »

Oh i see, but there is a problem. I dont have it in my components..
Logged
Mikhel
Newbie
*
Offline Offline

Posts: 2


View Profile
« Reply #6 on: 2006/09/18 17:02:42 »

Mike
Great tutorials.  I like that they structured in such a way that I could build off of them after I gain more experience.  For the new XNA tutorials, could you post the source code like you did in the previous tutorials? 
Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #7 on: 2006/09/18 23:03:37 »

I am working on a new layout for the site that should be easier to navigate around and have an overall more intuitive feel to it, and have included easy access to the source for the tutorials in the new design. At the moment I will need to go back through the first couple and pull out my other half done experiments to put them up as zips like I did before. Give me a couple days and I'll see what I can pull together. School and side jobs are taxing my time a bit heavily the next couple weeks so it may be a bit before I get completely over to the new site design. I'll try to have some source up before that time though.
Logged
nevek
Newbie
*
Offline Offline

Posts: 1


View Profile
« Reply #8 on: 2006/10/11 20:10:56 »

Hi Mike,

Thanks for your excellent tutorials,,

I have some fuzzy questions though..

For the second part of the Scene and Graph section.. I'm a bit unclear on new files to create - and where the functions should go

I've got Game.Cs and Graphics.cs but I'm not sure how many new files to create to support the rest of the fuctions

Thanks again for the great tutorial.. Smiley

`Kev
Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #9 on: 2006/10/15 20:52:11 »

The files are really not important as long as the classes and functions are in the same namespace (i.e. namespace HMEngine.HMObjects etc.) The tutorials should be putting those where necessary if I haven't missed anything (which I don't think I have... yet) I will be putting up zipped versions of the tutorial code when I have time to move the site over to the new layout/design. Hopefully, not too far in the future.
Logged
kch_86
Newbie
*
Offline Offline

Posts: 5


View Profile
« Reply #10 on: 2006/10/20 17:58:47 »

I just want to say thanks for these tutorials, I have been following them since the MDX1.1 tutorials, and they have helped me out alot. I really like these, I've been wanting to implement component based objects ever since I read an article about this technique in GPG:5.

Why have two different ways to add to the scene graph ( SceneGraph.AddObject() and SceneGraph.Root.AddNode() )? Will one of these be extended to handle different objects?

For example for the engine demo class, we have:

HMTestObject test = new HMTestObject();
HMObjectNode node = new HMObjectNode(test);
game.MyScene.SceneRoot.AddNode(node);

why not just have:
HMTestObject test = new HMTestObject();
game.MyScene.AddObject(test);

There doesn't seem to be any difference between these calls except that the HMObjectNode is created in MyScene.AddObject instead of in Main().
« Last Edit: 2006/10/20 18:01:25 by kch_86 » Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #11 on: 2006/10/20 21:14:03 »

Most of these functions are there right now for my own convenience when putting together the demo classes to test the new functionalities. Also, the AddNode can be used to actually add multiple tree nodes for better scene organization. Mostly, this function will be called by the scene editor tool that we will put together the same way as the 1.1 app.
« Last Edit: 2007/01/07 03:35:26 by mikeschuld » Logged
Robin Sarac
Newbie
*
Offline Offline

Posts: 9


View Profile
« Reply #12 on: 2007/01/16 12:11:21 »

Mike,

This scene graph is great stuff!  I've never gotten as far as implementing any sort of scene graph, so please excuse my ignorance. Smiley

Why did you choose to implement Draw and Update in HMNode?  Why not implement them in HMSceneGraph?

I guess in my mind, it makes more sense to have the scene graph iterate through the nodes in the root node, calling Update and Draw.  I'm having trouble understanding your choice putting these in the generic HMNode class from which HMSceneNode and HMObjectNode are derived.

I hope my question makes sense.  The whole point of your tutorials is to learn, so I want to make sure I really get this before moving on.  I'm learning more than XNA with your tutorials. Wink
Logged
Robin Sarac
Newbie
*
Offline Offline

Posts: 9


View Profile
« Reply #13 on: 2007/01/16 12:15:21 »

I think I might understand this.  Is it implemented in the base node class so that calling Draw will traverse the tree and draw everything down to the leaf level?  If it were implemented in the scene graph class, only the root level Draws() would be called?
Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #14 on: 2007/01/16 17:46:26 »

True, only the root level draws would be called at first, but they would have to be passed to the child nodes anyway. To save us that one extra call every frame, I thought to leave it out of the main class for now. We will be changing the scene graph greatly very soon btw Wink So it will all become even clearer very soon!
Logged
Pages: [1] 2
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Hazy Mind Scene Editor Hazy Mind Scene Editor mikeschuld 5 4607 Last post 2006/11/10 23:34:51
by AndroiD
Saving scene Hazy Mind Scene Editor Requests « 1 2 » Hunefalk 27 11617 Last post 2011/04/30 10:06:26
by gunther6616
Tutorial 1 :: Introduction to the XNA Framework Tutorial Discussion « 1 2 3 » mikeschuld 32 12695 Last post 2007/08/14 21:46:09
by mikeschuld
Tutorial 8 :: Post Processing Framework Tutorial Discussion « 1 2 3 4 » Chr0n1x 59 18079 Last post 2007/06/15 03:41:52
by Chr0n1x
Tutorial 10 :: Preparing for Object Culling, a Simple Octree Tutorial Discussion « 1 2 » mikeschuld 17 7381 Last post 2010/11/23 09:07:20
by Neil_Knight
Check if an object is facing another object..? General Discussion DaphydTheBard 4 1904 Last post 2007/03/08 22:41:54
by mikeschuld
Scene graph Hazy Mind XNA Engine EclipsE 3 1812 Last post 2007/03/13 18:24:26
by mikeschuld
Powered by MySQL Powered by PHP Powered by SMF 1.1.12 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.357 seconds with 20 queries.