How to do multiple (2 player+) camera views...
by Leroy Frederick · in Torque Game Builder · 06/14/2006 (5:42 am) · 10 replies
I looked around the forums, played around with camera settings and finally the mainScreen.gui (i think thats around the right track). So how do you make multiple camera views (e.g. 2 player window side by side). Knownledge & Code snippet would be well apreciated!
On top of that, where's the documentation for this canvas command as i don't know where people have learnt (other then forums) what .commands work for it and what don't (e.g. Canvas.setContent, SetCanvasTitle, canvas.pushDialog etc, where the documentation for these?)
Thanks in advance! :)
On top of that, where's the documentation for this canvas command as i don't know where people have learnt (other then forums) what .commands work for it and what don't (e.g. Canvas.setContent, SetCanvasTitle, canvas.pushDialog etc, where the documentation for these?)
Thanks in advance! :)
#2
06/14/2006 (6:49 am)
In mainScreen.gui there is one t2dSceneWindow. Make it two and let them view the same scenegraph.
#3
@Michael: Thanks, i'll give it a try and probably post the snippet if i get it to work!
06/14/2006 (9:55 am)
@Alex: Thanks Alex, if your refering to tdn.garagegames.com/wiki/GUI regarding GUI & canvas information, i've already been there (as well as pretty much everywhere else) but i've yet to find any canvas command info apart from searching in the forums (which are just code snippets of it being used). Is there any specific info for canvas. it doesn't seem to take the t2dSceneObject commands. I've figuered i might need to know these in order to dynamically do the multi screen thing (could be wrong :S)@Michael: Thanks, i'll give it a try and probably post the snippet if i get it to work!
#4
You name them independantly, and you can load two different sceneGraphs to them, or load the same scenegraph.
example GUI file.
then when you load up your scenegraphs, you still push your content as mainscreengui
but you do independant level loads.
this is all psuedo code, i haven't tested it, but it should put you on the right path.
enjoy!
06/14/2006 (11:32 am)
@Leroy, you can define a custom GUI with two different t2dSceneWindows, the layout of the windows are dependant of how you define this custom GUI. You name them independantly, and you can load two different sceneGraphs to them, or load the same scenegraph.
example GUI file.
//--- OBJECT WRITE BEGIN ---
new GuiChunkedBitmapCtrl(mainScreenGui) {
canSaveDynamicFields = "0";
Profile = "GuiContentProfile";
HorizSizing = "width";
VertSizing = "height";
position = "0 0";
Extent = "800 600";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
bitmap = "blank/data/images/logoblack";
useVariable = "0";
tile = "0";
new t2dSceneWindow(sceneWindow1) {
canSaveDynamicFields = "0";
Profile = "GuiContentProfile";
HorizSizing = "width";
VertSizing = "height";
position = "0 0";
Extent = "400 600";
MinExtent = "8 8";
canSave = "1";
Visible = "1";
hovertime = "1000";
lockMouse = "0";
useWindowMouseEvents = "1";
useObjectMouseEvents = "0";
};
new t2dSceneWindow(sceneWindow2) {
canSaveDynamicFields = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "400 0";
Extent = "400 600";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
lockMouse = "0";
useWindowMouseEvents = "1";
useObjectMouseEvents = "0";
};
};
//--- OBJECT WRITE END ---then when you load up your scenegraphs, you still push your content as mainscreengui
but you do independant level loads.
canvas.setContent(mainScreenGui);
sceneWindow1.loadLevel("./data/level/level1.t2d");
sceneWindow2.loadLevel("./data/level/level2.t2d");
sceneWindow1.mount(player1);
scenewindow2.mount(player2);this is all psuedo code, i haven't tested it, but it should put you on the right path.
enjoy!
#5
What you will want to do is load it into one window and then set the scenegraph of the second window to the scenegraph of the first window.
Edit: unless of course you want two seperate level instances running.
06/14/2006 (11:37 am)
You wouldn't want to load the level on both windows if you plan on both windows playing inside the same "world". When you call loadLevel it will load the level file into each window, which will create two scenegraphs ( you can think of the scenegraph as the "world" object)...What you will want to do is load it into one window and then set the scenegraph of the second window to the scenegraph of the first window.
Edit: unless of course you want two seperate level instances running.
#6
06/14/2006 (11:40 am)
That would be an awesome way to preview/select levels on a Start screen. Unless memory use got out of hand, running 12 levels at the same time :-)
#7
if you want an example, check out this post of mine from about a month ago..
www.garagegames.com/mg/forums/result.thread.php?qt=44373
06/14/2006 (11:44 am)
Yeah, sorry about that if its the same level you would. if you want an example, check out this post of mine from about a month ago..
www.garagegames.com/mg/forums/result.thread.php?qt=44373
#8
meanwhile, if any of you could help with saving and loading levels/scenes that would be great, please post here: www.garagegames.com/mg/forums/result.thread.php?qt=46246
06/19/2006 (3:50 pm)
Thanks guys, i'll update you when i get back to this, first i'm solidifying some main game (1 player) elements...meanwhile, if any of you could help with saving and loading levels/scenes that would be great, please post here: www.garagegames.com/mg/forums/result.thread.php?qt=46246
#9
I loaded the scenes with the same level file but all this achieves is a dead first screen with a non moving Player 1 with player one having effect only the camera in the first scene as it is mounted to it but there is no sign visual/effect of player 1!? Although the second window works as intended?
Hope the above makes sense, sorry it's pretty late! I'm about to hit the sack ZZZZzzZzzzzzzZzzZzzzz
Thanks in advance! :)
EDIT: Oh, while i'm here if any1 can get pad input working with pro 1.1.0, please share info here www.garagegames.com/mg/forums/result.thread.php?qt=46682
06/26/2006 (7:07 pm)
Hi all, thanks for already provided solutions but i've come a little short in the execution. I'm having trouble knowing how to have the 2 sceneGraphs share the same level (2 differents levels is easy enough)I loaded the scenes with the same level file but all this achieves is a dead first screen with a non moving Player 1 with player one having effect only the camera in the first scene as it is mounted to it but there is no sign visual/effect of player 1!? Although the second window works as intended?
sceneWindow2D.loadLevel(%level); sceneWindow2D2.loadLevel(%level);
Hope the above makes sense, sorry it's pretty late! I'm about to hit the sack ZZZZzzZzzzzzzZzzZzzzz
Thanks in advance! :)
EDIT: Oh, while i'm here if any1 can get pad input working with pro 1.1.0, please share info here www.garagegames.com/mg/forums/result.thread.php?qt=46682
#10
Sorted! Once more, thanks for all the help! Again, any solutions/info to getting pads working in v1.1.0 is more then welcomed: www.garagegames.com/mg/forums/result.thread.php?qt=46682
06/27/2006 (2:42 am)
Hallelujah, I figuered it out! What a difference a sleep makes ;) You have to use the setSceneGraph() command to attach the same scene to a new sceneGraph...sceneWindow2D2.setSceneGraph(yourScene);
Sorted! Once more, thanks for all the help! Again, any solutions/info to getting pads working in v1.1.0 is more then welcomed: www.garagegames.com/mg/forums/result.thread.php?qt=46682
Torque Owner Alex Rice
Default Studio Name
For GUI documentation, check TDN. Torquescript language and Torque Core including the GUI system is documented there. TGB docs only include TGB specific stuff (t2d* classes and functions).