Game Development Community

Scenegraph/Scenewindows in Script & other newbie Qs

by Rob Caporetto · in Torque Game Builder · 12/25/2009 (9:38 am) · 6 replies

Hi all,

I'm a bit confused with setting up scenegraphs/scenewindows in order to build a HUD/background.

I've got a simple project running which is just using a single scene, with the player moving freely about the playfield (ie. I don't have any world limits defined on the player or other entities in the level), and a scroller object (sitting in the background), which is presently anchored onto the player for simulating a scrolling space.

Part of what I want to do is to introduce a proper HUD - and from what I understand by searching the boards, the right way to do that is to setup a second level in the editor & load that into another scenewindow/scenegraph.

There's just a few which I'm confused with - first off, is it possible to structure the levels so I'm only loading 2 - one being the gameplay level (with all the sprites there positioned around the middle of the layer stack), and the other being the HUD & the background (with the HUD at the front, and the background at the rear) - instead of having a background level, a gameplay level & a HUD level.

My other query - is what's the best way to structure this in script? Should I create a container level that has an empty SceneObject to load the other levels in? Or should I just place an empty scene object in one of the existing levels?

Also - are there any gotcha's with using this on a project which I'm considering publishing with iTGB (memory, performance or the likes)?

#1
04/04/2010 (12:26 pm)
Bumping this old question because I was about to ask the same thing!
#2
04/04/2010 (3:15 pm)
i really have no idea why you would want to do it that way im sure thats fine to do. only thing i have used a second scene window for is a minimap. you can easily just create your hud with out gui objects and just run an up date to lock it in the camera space, and place behaviors on the sprites for mouse down etc to simulate buttons. i really dont gui this is how most of my huds are done. an easy way to also do this is attach a transparent object to your player if your camera is centered on the player and just record the off sets for your hud items as that object being a reference.
#3
04/04/2010 (3:17 pm)
i really have no idea why you would want to do it that way im sure thats fine to do. only thing i have used a second scene window for is a minimap. you can easily just create your hud with out gui objects and just run an up date to lock it in the camera space, and place behaviors on the sprites for mouse down etc to simulate buttons. i really dont gui this is how most of my huds are done. an easy way to also do this is attach a transparent object to your player if your camera is centered on the player and just record the off sets for your hud items as that object being a reference.
#4
04/05/2010 (7:06 am)
Hey all...

I think there can be benefit in doing gui's in a scene window. The GUI builder is not great and if you're already comfortable in manipulating t2dSceneObjects and such, there's nothing new to learn. Michael's right though in that there's no need for an additional scene window but I think this just comes down to preference and housekeeping...

So to answer the original question, yes just create a new scene that contains all your HUD objects and and that scene as an additional scene window to your game scene. I don't like this method because you can't really see the HUD over your game unless you run it.

#5
06/08/2010 (12:48 pm)
I'm thinking about doing this for my game because I want to mount the camera to the ship. Without another scenewindow, how else do you keep gui elements fixed in place?
#6
06/11/2010 (8:38 am)
Using an additional scene window as a GUI window using TGB objects can definitely be a strong way to go. People have been doing this sort of thing for quite a while and even have used TGB as their GUI systems for their 3D games. This allows you create complex GUIs that can animate fairly easy and even use things such as scrollers and particles, some GUI behaviors are given in the Behavior Playground demo. In fact in Rack Em' Up Roadtrip (http://www.torquepowered.com/products/rackemup) we did that ourselves, using TGB objects as a GUI system which gave us some nice animated GUIs.