Default Project Questions.
by Scott Johnson · in Torque Game Builder · 07/24/2006 (9:15 pm) · 1 replies
Ok... Pardon the length, but I'm long winded...
I think that I have gone through most of the tutorials available, and read the vast majority of recent posts, and quite a few older posts. I've successfully made my own custom GJI, up to a point, mini-tutorials, etc..
However I'm sure that I'm missing something obvious, probably all my years as a corporate programmer blinding me. (I've primarily used strongly typed languages, with a more strict scoping rules...)
I'm basically wanting to figure out if the default new project is a good starting point for a typical production game, or is it most useful as a learning tool, to be deviated from, once you know more about the engine.
When you create a new project using the TGB Editor, it basically sets up:
./main.cs -- the starting point of the project. (execs the mainScreen.gui, and the game.cs) and calls startGame
./gui/mainScreen.gui -- basically a t2dSceneWindow(aka sceneWindow2D) wrapped up in GuiChunkedBitmapCtrl, no default code here. basically a background image and the Scene Object.
./data/levels/default.t2d (<-what I named my level when saving the project) I see that it holds the camera settings, and has no namespace? by default.
It contains the content of my first set of questions:
%levelContent = new t2dSceneGraph() {
canSaveDynamicFields = "1";
cameraPosition = "0 0";
cameraSize = "800 600";
};
What is the scope of %levelContent?
My assumption is that, it would only be in-scope within the .t2d file, and there just don't happen to be any functions here by default.
Would it be a bad idea to make this global? or something else? What kinds of functions might need to be sited in the level, or should there be? do we typically only need one per game?
I see the sceneWindow object being used a lot in the tutorials, is the sceneWindow2d automatically assigned the proper sceneGraph? or are they even associated, and that is left to do within our games?
I guess it's hard for me to put into words, what I need, but I think this information will help me along the way of greater understanding.
Thanks in Advance.
I think that I have gone through most of the tutorials available, and read the vast majority of recent posts, and quite a few older posts. I've successfully made my own custom GJI, up to a point, mini-tutorials, etc..
However I'm sure that I'm missing something obvious, probably all my years as a corporate programmer blinding me. (I've primarily used strongly typed languages, with a more strict scoping rules...)
I'm basically wanting to figure out if the default new project is a good starting point for a typical production game, or is it most useful as a learning tool, to be deviated from, once you know more about the engine.
When you create a new project using the TGB Editor, it basically sets up:
./main.cs -- the starting point of the project. (execs the mainScreen.gui, and the game.cs) and calls startGame
./gui/mainScreen.gui -- basically a t2dSceneWindow(aka sceneWindow2D) wrapped up in GuiChunkedBitmapCtrl, no default code here. basically a background image and the Scene Object.
./data/levels/default.t2d (<-what I named my level when saving the project) I see that it holds the camera settings, and has no namespace? by default.
It contains the content of my first set of questions:
%levelContent = new t2dSceneGraph() {
canSaveDynamicFields = "1";
cameraPosition = "0 0";
cameraSize = "800 600";
};
What is the scope of %levelContent?
My assumption is that, it would only be in-scope within the .t2d file, and there just don't happen to be any functions here by default.
Would it be a bad idea to make this global? or something else? What kinds of functions might need to be sited in the level, or should there be? do we typically only need one per game?
I see the sceneWindow object being used a lot in the tutorials, is the sceneWindow2d automatically assigned the proper sceneGraph? or are they even associated, and that is left to do within our games?
I guess it's hard for me to put into words, what I need, but I think this information will help me along the way of greater understanding.
Thanks in Advance.
About the author
Torque Owner Ben R Vesco
If you take a look in levelManagement.cs you can see the t2dSceneWindow::loadLevel function. In that function the scenegraph is added to the scenewindow.
Variables scoped with % are local to the scope they're defined in, and vars scoped with $ have global scope.