Handle Question
by Roto · in Torque Game Engine · 05/11/2006 (4:38 pm) · 3 replies
1.) Double click on gpgt.exe
2.) Click "Start Mission"
3.) Select "3d Lessons"
4.) Click "Launch Mission"
5.) Hit F11
6.) Get into 3rd person view by holding the right mouse button down and pressing the TAB button.
7.) Get into camera view by pressing ALT + C
8.) Zoom into your blue guy and notice the handel number on him. On my screen it is 2682
9.) Expand the Inspector tree in the upper right of your screen.
I do not see this guy or his handel listed in the inspector. Why not? He is a shape and a very important shape too.
2.) Click "Start Mission"
3.) Select "3d Lessons"
4.) Click "Launch Mission"
5.) Hit F11
6.) Get into 3rd person view by holding the right mouse button down and pressing the TAB button.
7.) Get into camera view by pressing ALT + C
8.) Zoom into your blue guy and notice the handel number on him. On my screen it is 2682
9.) Expand the Inspector tree in the upper right of your screen.
I do not see this guy or his handel listed in the inspector. Why not? He is a shape and a very important shape too.
About the author
#2
@Roto - another useful tool is the Tree browser. open up a console and type "tree();". it will give you a browser view covering many of the groups Ed mentioned.
Also, the GPGT covers single-player games. If you're making a multiplayer game, bear in mind that most objects such as Players are created twice - once in the server portion of the game, and once in the client portion.
05/11/2006 (10:25 pm)
@Ed - great explanation, thanks. I'd had a vague grasp of this stuff, and this really helps lock it down.@Roto - another useful tool is the Tree browser. open up a console and type "tree();". it will give you a browser view covering many of the groups Ed mentioned.
Also, the GPGT covers single-player games. If you're making a multiplayer game, bear in mind that most objects such as Players are created twice - once in the server portion of the game, and once in the client portion.
#3
05/12/2006 (5:55 am)
Great info, thanks guys.
Associate Edward F. Maurina III
Roaming Gamer LLC
Before answering...
1. When an object is created in the game world it is automatically added to the current 'instant group'.
2. To determine the current instant group you can open the console and type:
echo("$InstantGroup == ", $InstantGroup );
3. Some important groups to know about are: RootGroup, DatablockGroup, MissionCleanup, and MissionGroup. This last group is the one that you see in the inspector.
So, why isn't player in MissionGroup?
Well, while the mission is being created (loaded), the instant group is missionCleanup, but since all items are created in the brackets{} of MissionGroup, they are added to that group instead. After the mission load is done, the instant group continues to be MissionCleanup. Furthermore, in ~/server/scripts/game.cs you will find the function:
function GameConnection::createPlayer(%clientConn, %spawnPoint , %playerDB)
{
// ...
}
This function creates your player and adds it to the MissionCleanup group.
Then I can change the code right?
Yes, you could change the code, but I don't suggest it. At least I don't suggest adding the player to MissionGroup. The reason is, if you later save your mission, the player will be saved too. Then, when you reload the mission later, you will have two player models. The current 'active' one and the one you saved last time.
Instead, if you want to inspect your player do this:
1. Open game.cs and find the function I mentioned above.
2. Change it so the code looks similar to this:
// Create the player object %player = new Player() { dataBlock = %localDB; client = %clientConn; }; $Game::Player = %player;Notice that the last line places the player handle in global variable.
Now, if you want to inspect the player in a single-player game, you can do this:
1. Start your mission.
2. Open the console and type: inspect( $Game::Player );
3. Close the console.
Viola! You have started the free-floating inspector and you can now examine and modify player attributes.
I hope this helps.
EdM|GPGT