Some Basic Questions
by Marc Ilgen · in Torque Game Builder · 03/28/2005 (8:24 pm) · 6 replies
I have a few questions about how T2D programming, and I couldn't find the answers in the docs. Here they are:
- It appears that the main script in Toque 2D (called main.cs) defines a package, and that package defines 3 functions:
onStart(), onExit(), and quitApp(). Are there any circumstances in which any other functions must be
declared or specified here? Which parts of these are boilerplate and which parts must be changed for each new game?
- All the script files (*.cs) can be created with a text editor or IDE. What about the *.gui files? It looks like there is some sort of GUI editor in T2D. How do I start the GUI editor? How do I load an existing GUI file into the editor so that I can edit it?
- I want to create a game that launches in full screen mode, not inside a window. How do I make the game do that?
- It looks like the main.cs script executes something called client.cs. Is the name "client" somehow a magical name that must be used? Or can I use any other name I want?
- At what point in T2D does an actual game loop get launched? All the functions seem to set stuff up, and somehow the game loop magically runs, but I don't see how. Can someone explain what is happening here?
- Do we as the programmer have any control over the frame rate? Or is it the case that we just must use schedule() to specify how often game dynamics are run but T2D itself decides what the rendering frame rate is?
Thanks
- It appears that the main script in Toque 2D (called main.cs) defines a package, and that package defines 3 functions:
onStart(), onExit(), and quitApp(). Are there any circumstances in which any other functions must be
declared or specified here? Which parts of these are boilerplate and which parts must be changed for each new game?
- All the script files (*.cs) can be created with a text editor or IDE. What about the *.gui files? It looks like there is some sort of GUI editor in T2D. How do I start the GUI editor? How do I load an existing GUI file into the editor so that I can edit it?
- I want to create a game that launches in full screen mode, not inside a window. How do I make the game do that?
- It looks like the main.cs script executes something called client.cs. Is the name "client" somehow a magical name that must be used? Or can I use any other name I want?
- At what point in T2D does an actual game loop get launched? All the functions seem to set stuff up, and somehow the game loop magically runs, but I don't see how. Can someone explain what is happening here?
- Do we as the programmer have any control over the frame rate? Or is it the case that we just must use schedule() to specify how often game dynamics are run but T2D itself decides what the rendering frame rate is?
Thanks
#2
But I still have a question regarding windowed apps versus full screen. Any commercial game is going to be a full screen game, not windowed. How can I do this in T2D? Also, what is the typical resolution used, 800x600?
Thanks
03/29/2005 (7:31 pm)
Thanks for the help, very much appreciated. But I still have a question regarding windowed apps versus full screen. Any commercial game is going to be a full screen game, not windowed. How can I do this in T2D? Also, what is the typical resolution used, 800x600?
Thanks
#3
And just as an observation, actually many 2D games, especially casual ones, do get used in windowed mode :)
03/29/2005 (8:40 pm)
I'll try to look it up if no one else jumps in, but it's a very basic setting that gets stored in one of the prefs.cs files to have the application start up in full screen.And just as an observation, actually many 2D games, especially casual ones, do get used in windowed mode :)
#4
$pref::Video::fullScreen = "0";
to
$pref::Video::fullScreen = "1";
That doesn't work - running the code actually changes this line in this file back to
$pref::Video::fullScreen = "0";
I also tried doing the same thing in T2D/client/prefs.cs, and that didn't work either.
So I'm not so sure it is quite that simple.
Also, you should take a look at the casual games on realarcade.com. Every single one of the games that actually sells is done in full screen mode. The only casual games that are done in windowed mode are the free web games that someone can throw together in a couple weeks. The need for full screen for commercial games is also mentioned in a number of game development books, eg the Tricks of the 3D Game Programming Gurus book by A LaMothe. Anyway, I would never consider commercially releasing any game that did not operate in full screen mode.
Please let me know if you find any info on how to do this. Thanks.
03/29/2005 (9:30 pm)
Actually I have tried looking in common/client/prefs.cs and changing$pref::Video::fullScreen = "0";
to
$pref::Video::fullScreen = "1";
That doesn't work - running the code actually changes this line in this file back to
$pref::Video::fullScreen = "0";
I also tried doing the same thing in T2D/client/prefs.cs, and that didn't work either.
So I'm not so sure it is quite that simple.
Also, you should take a look at the casual games on realarcade.com. Every single one of the games that actually sells is done in full screen mode. The only casual games that are done in windowed mode are the free web games that someone can throw together in a couple weeks. The need for full screen for commercial games is also mentioned in a number of game development books, eg the Tricks of the 3D Game Programming Gurus book by A LaMothe. Anyway, I would never consider commercially releasing any game that did not operate in full screen mode.
Please let me know if you find any info on how to do this. Thanks.
#5
main.cs, function parseArgs in the Common module:
Find in files is your friend for sure!
03/29/2005 (9:48 pm)
A very quick "find in files" shows that $pref::Video::fullScreen is in all of the pref.cs files (there are 4 I think), and can be overridden with the -fullscreen command line argument to the executable.main.cs, function parseArgs in the Common module:
//--------------------
case "-fullscreen":
$pref::Video::fullScreen = 1;
$argUsed[%i]++;
//--------------------
case "-windowed":
$pref::Video::fullScreen = 0;
$argUsed[%i]++;Find in files is your friend for sure!
#6
03/29/2005 (11:56 pm)
Marc, Stephen is right, you'll want to either use the -fullscreen commandline option, or change the appropriate prefs.cs files for your mod / game.
Torque Owner Josh Williams
Default Studio Name
Re: "client", no, as the tutorial states, it's not magical at all. Good question, I can see how people might think that. But this is just a holdover from TGE. You can rename all instances of "client" to anything you want. When we get full-on real-time networking up and running, we'll likely restructure the way things are laid out a bit (not making it any more complicated though).
Re: frame-rate control... you can enable or disable vsync. You could also set a blocking schedule if you want. But in general, the idea of controlling the framerate explicitly isn't usually a good idea. You can set the dynamics "frame rate", but T2D does rendering for you. If I were you, I'd probably leave this area of code / functionality alone until you get further into a game. If you really need to touch this stuff for some reason, go ahead. But know that we'll be doing updates to some of this code in the future, as we bring full networking online, and the way physics "ticking" and render rate are handled will change slightly. So, might end up with conflicts if you change stuff in these areas yourself too.
Sorry this reply is a little short, it's very late and I'm tired! Hope this was somewhat helpful though. And many thanks to Robert for answering questions too.