Game Development Community

Multiple Scenegraphs?

by Jacob Wagner · in Torque Game Builder · 05/28/2006 (9:54 pm) · 1 replies

I did some searching for posts discussing how to implement this but I didn't find any details.

Here is what I want:

I want 2 scenegraphs: the regular one to hold the sprites and what not, and a second scenegraph to
hold a tilemap. The tilemap scenegraph should be drawn below the main
scenegraph.

My actual goal is to create a real time strategy spaceship game with a scrolling star tilemap in the background. I think I've got the tilemap scrolling part down, though. I'll just move the camera coordinates as the user puts the mouse on the edge of the screen and scroll the tilemap at the same speed (if i can figure out the math for that).

#1
05/28/2006 (10:10 pm)
Really pretty simple. Just define a new GUI, create the two scenewindows from the controls, name them appropriately, and place htem where you would like on the gui. Then make sure your canvas is loading the GUI you just created, load your level data into each as appropriate and rip. Remember anything tied to specifc sceneWindows will have to be managed seperately.

Canvas.setContent(myCustomGUI);
sceneWindow1.loadLevel($currentProject @"/data/levels/level1.t2d");
sceneWindow2.loadLevel($currentProject @"/data/levels/level2.t2d");

An example GUI
//--- OBJECT WRITE BEGIN ---
new GuiControl(myCustomGUI) {
   canSaveDynamicFields = "0";
   Profile = "GuiDefaultProfile";
   HorizSizing = "right";
   VertSizing = "bottom";
   position = "0 0";
   Extent = "800 600";
   MinExtent = "8 2";
   canSave = "1";
   Visible = "1";
   hovertime = "1000";

   new t2dSceneWindow(sceneWindow1) {
      canSaveDynamicFields = "0";
      Profile = "GuiDefaultProfile";
      HorizSizing = "right";
      VertSizing = "bottom";
      position = "0 0";
      Extent = "797 335";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "1";
      hovertime = "1000";
      lockMouse = "0";
      useWindowMouseEvents = "1";
      useObjectMouseEvents = "0";
   };
   new t2dSceneWindow(sceneWindow2) {
      canSaveDynamicFields = "0";
      Profile = "GuiDefaultProfile";
      HorizSizing = "right";
      VertSizing = "bottom";
      position = "5 316";
      Extent = "792 181";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "1";
      hovertime = "1000";
      lockMouse = "0";
      useWindowMouseEvents = "1";
      useObjectMouseEvents = "0";
   };
};
//--- OBJECT WRITE END ---


Others may know a better way as well. But I find this gives me granular control over what I'm displaying and where ,when, etc. without alot of custom handler code.

HTH,
Rodney