Game Development Community

Mod madness; T2D vs. fishdemo vs. spacescroller

by Alex Rice · in Torque Game Builder · 09/11/2005 (3:07 pm) · 2 replies

There are significant differences in layout and initialization between the mods T2D, fishdemo and spacescroller. This is the kind of stuff beginners like me spend hours puzzling over. For example

Take a freshly installed copy of the T2D SDK 1.0.2
Double click on T2D.exe- play around
Do the same with runfish.bat and runshooter.bat.
OK all is well.
The logical next step, perhaps would be to start modifying the fishdemo for my game
Go into SDK/example/main.cs and change
$defaultGame = "T2D";
to
$defaultGame = "fishdemo";
Now double click on T2D.exe
CRASH!
Console.log ends with
--------- Initializing MOD: FishDemo ---------
Compiling fishdemo/client/splashScreen.gui...
Loading compiled script fishdemo/client/splashScreen.gui.
Compiling fishdemo/client/t2d_launchMenu_fishDemo.gui...
Loading compiled script fishdemo/client/t2d_launchMenu_fishDemo.gui.
Compiling fishdemo/client/t2d_exitScreen.gui...
Loading compiled script fishdemo/client/t2d_exitScreen.gui.
Compiling fishdemo/client/client.cs...
Loading compiled script fishdemo/client/client.cs.
fishdemo/client/splashScreen.gui (22): Unable to find object: 'Canvas' attempting to call function 'setContent'

--------- Initializing MOD: T2D_TILE_EDITOR ---------
Compiling tileeditor/client/client.cs...
Loading compiled script tileeditor/client/client.cs.
Compiling tileeditor/client/datablocks.cs...


In the TGE distro, as I recall, you CAN change the default mod/game between racing, shooter, etc. and it works, because all the mods are setup consistently.

Also all the TGE mods have all the in-game editors bound to consistent hotkeys- does T2D ?

how do you add a splashscreen and exit screen to the T2D mod?

how do you add the particle editor, gui editor, and tile map editor to the fish or space mods?

Sorry if this sounds nitpicky for those of you who have already mastered all the initialization and bootstrapping of T2D games.

#1
09/12/2005 (12:26 am)
Alex,

Quote:In the TGE distro, as I recall, you CAN change the default mod/game between racing, shooter, etc. and it works, because all the mods are setup consistently.
You can't just run a MOD as a GAME.

It seems you understand some of this stuff though but I'll clarify for others that may not. There are basically two different types of "app" you can run, GAME or MOD and you can select these from the command-line using "T2D -game myApp" or "T2D -mod myMod" or even "T2D -mod myMod1 -mod myMod2".

So how does the "GAME" and "MOD" differ? Well, they only differ by how the root "main.cs" handles them and you can roll your own if you wanted to. The big difference though is that the "common" scripts are initialised in "GAME" as well as a "Canvas" being created. It's the fact that you've not created a canvas that's causing the crash. A "MOD" never creates a "Canvas" so just putting it into the role of a "GAME" fails. Don't forget that it's the canvas that creates the window and initialises D3D/OpenGL and without this, you can't do anything graphical or define datablocks (as they work on textures). In release-mode, you'll get a crash whereas in debug-mode, you'll get an assert.

The "fishdemo" is setup as a "MOD", not a "GAME" although you can easily change it to do so by adding the call run the "common" scripts and created a "Canvas" which amounts to a few calls. I believe it was changed to a "GAME" for the released demos though. Minor work.

So to summarise...

"GAME" ($defaultGame) = Common scripts + Create Canvas + setup script framework.
"MOD" - override/add-to script framework.

As you can see above, if you were to set a MOD to be a GAME, you'd be missing calls to the common scripts and you'd have no canvas or the script-framework. A big problem with not having a canvas is that you can't execute ANY graphical commands or initialise datablocks.

GAME = Bread / MOD(s) = Different Fillings! ;)

Quote:Also all the TGE mods have all the in-game editors bound to consistent hotkeys- does T2D ?
Not sure what you mean by consistent really. The editors (more in v1.1.0) are on specific function keys. F9/F10/F11/F12.

Quote:how do you add the particle editor, gui editor, and tile map editor to the fish or space mods?
As above, you just add the few calls needed to call the "common" stuff and create a canvas.

Quote:Sorry if this sounds nitpicky
Not nitpicky at all; it's all a learning process! :)

Hope this helps a little,

- Melv.
#2
09/12/2005 (12:32 am)
Thanks Melv that's real helpful stuff! Interesting metaphor about the bread/fillings. Makes me want to go eat a calzone for lunch tomorrow :-)