Game Development Community

sceneWindow2D definition

by rennie moffat · in Torque Game Builder · 08/22/2009 (11:51 am) · 29 replies

What it is the definition of a sceneWindow2D. Looking in ref material and can't find a clear definition. I think it is the seeable window (what is currently "on screen"), but not 100%. Thanks.

About the author

My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.

Page«First 1 2 Next»
#21
08/26/2009 (7:32 pm)
Let's go back to the movie set analogy...

First, I want to really clarify the following 2 bits:

* A t2dSceneWindow is an abstract concept of a camera/monitor. In the engine, we make an instance called sceneWindow2D which actually is the camera.

* A t2dSceneGraph is an abstract concept of a movie set. In the engine, we make instances, but they each get their own name. The last one loaded is called $lastLoadedScene.

Let's have 3 movie sets. They are huge... one might be an entire countryside, another is in a house, and the last is in a cellphone.

You create a t2dSceneGraph (typically using the TGB editor). This is the movie set. You load up the first scene: the countryside. It's so big that the camera (t2dSceneWindow) cannot show it all. You move the camera around to show all the parts. You might also have a second camera looking at that exact same countryside. A lot of it will be offscreen.

The camera (t2dSceneWindow) points at the scene (and in C++, I think it actually holds a pointer).

Then you take that camera, and take it to the second scene: a house. You call "sceneWindow2D.loadLevel(theHouseLevel);". But that's just a convenience function that the guys at GG wrote for you. It really builds the set (t2dSceneGraph) and then points the camera at it.

Finally, you take that camera, and take it to the final scene: a cellphone. The camera can point to the entire cellphone and you'd see it all at once.

I mention the last case because that defines a lot of iPhone, casual, and puzzle games. The programmer makes a set that will fit within the entire camera's view.
#22
08/26/2009 (10:16 pm)
so what if I have multiple sets (t2dSceneGraph)?
would these "sets" be levels?
so I loadLevelA, B C?

I see how it works, or at least, I think I do. The sceneWindow2D, will film (show) which ever section of the set (t2dSceneGraph) that is currently in view via the sceneWindow2D.

The t2dSceneWindow, I am still trying to wrap my head around. What is t2dSceneWindow vs SceneWindow2D? Are these the same things, just different terminology?




quote:
Then you take that camera, and take it to the second scene: a house. You call "sceneWindow2D.loadLevel(theHouseLevel);". But that's just a convenience function that the guys at GG wrote for you. It really builds the set (t2dSceneGraph) and then points the camera at it.


me:
with this, I am wondering, is there only one camera for every level? is this related? this seems moot or not good as what if for level say slotMachine, my player/camera, must look flat, directly at the machine, no movement. But with level parkingLot, the camera must follow our hero as he tries to find his car and dodge security guards.


:?






#23
08/26/2009 (10:50 pm)
Yep! Each "set" is a level. And your sceneWindow2D will show whatever it's pointing at (anything from a small section all the way up to the entire scene).

I'd guess that for a lot of TGB games, especially smaller puzzle games and like, everybody has just the one camera.

In the case of your casino, you might have do the following:
* Load a scene of the casino. The camera would track the player overhead.
* As you approach a slot machine, you load another level which has the slot machine.
* When you finish the slot game, you re-load the casino level and continue on.

(It's not as simple as that, as you'd need to save off where you were when you played the slot game. As with all of programming, there are about a dozen ways you could do this, but this is one of those examples.)

I'll stress it again. A t2dSceneWindow is a concept (called a "class" in C++). It has the concept of a camera and an output region. We create an instance of a t2dSceneWindow and give it a name: sceneWindow2D. We could have called it GameCamera or MagicPixelBlasterRegion. We just happened to call it "sceneWindow2D". That's the camera and output region's name.
#24
08/26/2009 (11:26 pm)
awesome,
you are the man.

I have to work on something else right now, so I may be positing more questions regarding this later.



ps.
do you have a home? Are you pocket size? because if you are, I would like to keep you as my online tutor, tho, if i could fit you in my pocket that would be swell. That way I would just pull you out... or maybe, we could do like a Star Wars thing, where we have holographic communications. Soon I bet.

Easy,
Ren


#25
09/11/2009 (12:39 pm)
Hi William, or anyone else,
A quick question, Do I need to declare the sceneWndow2D as a class in my game builder console?


I think this maybe a no, but just want to double check.
#26
11/25/2009 (3:30 pm)
@William and or @all. I was just going thru this thread I was trying to better understand a scenegraph.

Specifically I was looking at a "fireMissle" function where the missle has a scenegraph which is %this.scenegraph. From the following code, does it just mean that the missle is placed in the current scenegraph (level)?

function PlayerShip::fireMissile(%this)
{
   %this.playerMissile = new t2dStaticSprite()
   {
      scenegraph = %this.scenegraph;
      class = PlayerMissile;
      missileSpeed = %this.missileSpeed;
      player = %this;
   };
   
   %this.playerMissile.fire();
}
#27
12/22/2009 (8:17 pm)
HI I am posting this again as I have ran into the same problem. Better understanding the scenegraph.




In my editor, under the Project section a t2dScenegraph is declared at the top and all objects in the scene fall with in this t2dScenegraph.

William had described as a movie set, and one might have many sets to accommodate the scene's needs. However if you look at the code same as above

function PlayerShip::fireMissile(%this)  
{  
   %this.playerMissile = new t2dStaticSprite()  
   {  
      scenegraph = %this.scenegraph;  
      class = PlayerMissile;  
      missileSpeed = %this.missileSpeed;  
      player = %this;  
   };  
     
   %this.playerMissile.fire();  
}


a scenegraph is declared for every new missile.
So What I am wondering is, and this could clear up a lot. The t2d prefix is like a super class to anything. IE t2dsceneWindow, t2dscenegraph. and as such a scenegraph can occur an infinite amount of time in a t2dscenegraph?



#28
12/22/2009 (10:30 pm)
More accurately, your missile is added to a particular scene graph each time. You can have any number of scene graphs and add objects to each one. I pesonally use three overlapping scene graphs (background, middleground and foreground) and add objects to each as needed.

You're right, "t2d" is the prefix for things defined in the engine that we use, scene graphs, objects, scene windows.
#29
12/22/2009 (10:32 pm)
so a scenegraph is an all encompassing thing? It can contain many objects.

do you have one t2dscenegraph and many(possibly) scenegraphs or are they one in the same?
Page«First 1 2 Next»