Game Development Community

Basic Tutorial

by Bobby Skinner · in Torque Game Builder · 03/24/2006 (8:38 am) · 7 replies

Can some one who knows what they are doing run through the Basic tutorial (Mac OS X) through about page six and post corrections. I just purchased TGB and have no clue how things work. When I follow the tutorial the code that I am supposed to modify is not there.

To make things worse, i introduce errors in game.cs and it still runs (displaying a banner) so it must not be using my modified script. Because I do not even know how to use the environment, i can't figure out what i am doing wrong. How do you tell what scripts will be used when you run game?

I am editing Games/T2D/gameScripts/game.cs

It contains this:
//---------------------------------------------------------------------------------------------
// startGame
// All game logic should be set up here. This will be called by the level builder when you
// select "Run Game" or by the startup process of your game to load the first level.
//---------------------------------------------------------------------------------------------
function startGame(%level)
{
// Set The GUI.
Canvas.setContent(mainScreenGui);
Canvas.setCursor(DefaultCursor);

moveMap.push();
sceneWindow2D.loadLevel(%level);
}

The tutorial says it is supposed to have this:

function setupT2DScene()
{
// Create our scenegraph
new t2dSceneGraph(t2dScene);
// Associate Scenegraph with Window.
sceneWindow2D.setSceneGraph( t2dScene );
// Add custom game code here...
}

Can someone please help? I need to get through the basics so that I can have the understanding to begin to really experiment. Right now I do not even believe it is running my code. I think that the tutorial was written for an earlier release and things have changed but the tutorial has not been updated.

Thanks,
Bobby

#1
03/25/2006 (12:17 pm)
This isn't an issue with just the Mac OS X version. I am having the exact same problem with Windows. This tutorial looks great, I wish that it was some what up to date. If this tutorial could be updated it would be a GREAT help.

Thanks
#2
03/25/2006 (12:21 pm)
A new version of T2D was just made available last night after the GDC, probably they had not time to update the tutorial

I guess they will try to update all the documentation ASAP, hopefully :)
#3
03/25/2006 (1:07 pm)
I certainly hope that it gets done soon. I would hate to see all of the documentation stay outdated. That would lead to all of the documentation problems that TGE had.
#4
03/25/2006 (2:16 pm)
The documentation is no problem I think, the reference.pdf seems to be up to date normally.

Updating the tutorial at the moment would not be of much use somehow as the editor are changing. Only script tutorials have a chance to hold (although even these commands changed in the last 2-3 alpha / beta).
And rewriting them every few weeks won't be of much help somehow ...

Thats the "price" of beeing EA / Beta user :-)
#5
03/26/2006 (4:15 pm)
Well, I don't necessarily know what I'm doing since I just purchased T2D a couple of days ago myself. ;)

However, I did run into the exact problem you're describing here and I was able to get it resolved. The key element here is that you're creating a new function called setupT2DScene() but it's not being called anywhere and therefore, it's not being exectuted. So you just need to include the function call like so (I'm pasting in the complete first half of game.cs so you can compare it directly to yours):


//---------------------------------------------------------------------------------------------
// Torque 2D.
// Copyright (C) GarageGames.com, Inc.
//---------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------
// startGame
// All game logic should be set up here. This will be called by the level builder when you
// select "Run Game" or by the startup process of your game to load the first level.
//---------------------------------------------------------------------------------------------
function startGame(%level)
{
// Set The GUI.
Canvas.setContent(mainScreenGui);
Canvas.setCursor(DefaultCursor);

moveMap.push();
sceneWindow2D.loadLevel(%level);
setupT2DScene(); // This is the call that needs to be added and isn't specified in the PDF
}
function setupT2DScene()
{
// Create our scenegraph
new t2dSceneGraph(t2dScene);

// Associate Scenegraph with Window.
sceneWindow2D.setSceneGraph( t2dScene );

// Add custom game code here...

}


Assuming the problem you're having is what I think it is, this will get you up and running on the tutorial. Learning T2D right now is definitely a rocky path since the documentation is not up to date with the app. After 4 days of study and going through the tutorials, I'm just now getting my head around the concepts and inner workings of the tool. BUT, it's SO worth the trouble. T2D is going to make my life SO MUCH EASIER!
#6
03/26/2006 (6:37 pm)
Thanks, I made a very similar discovery myself earlier today. However I do hope that they will correct the document in the near future because it is the way people learn how things work. There are many things that are not simply intuitive, for instance It took me a long time to realize that it only compiles the script on the first run. This hindered me finding the solution quickly. I realize that it is hard to keep the documentation up to date while in beta, but the begininning tutorial should probably be kept up to date
#7
03/26/2006 (7:19 pm)
Can I say as "Johny Dangerously" would - Farging good Tutorial and great engine (at least as far as ease is concerned!