Game Development Community

dev|Pro Game Development Curriculum

Things Learnt from 3D Game Programming All in one

by Amr Bekhit · 06/10/2006 (10:42 am) · 5 comments

Recently bought the TGE and TSE lisences and bought the 3DGPAI1 book to get started. I thought it might be useful to write down key things I learn as I go along and posting them here may help others.

-To loads up scripts that you want the program to use, you use EXEC. When the scripts are loaded using exec, the inline code is called. The main body of the script is where you place the inline code and can be considered the main() function of the class. When the module is exec'd, the main code is run and can make calls to any of the functions present in the script

-In the 3Dgpai1 book, I noticed that he used the function Main in his classes. A bit of experimentation showed that removing the function Main and putting the code inline has exactly the same effect.

-Switch seems to work fine with strings...perhaps switch$ isn't really necessary?

-Datablocks are used to group properties together in an easy to use variable. The syntax is as follows:

Datablock Datablocktype(datablockname)

Datablocktype defines the properties that this datablock has.

-Use GetWord and SetWord to change values withing strings

-SetTransform is used to set the position and rotation of an object:

SetTransform("px py pz rx ry rz rd")
Px py pz; XYZ coordinates of the rotation

Rx ry rz rd define a quaternion: the rx ry rz define the axis of rotration and the rd defines the angle in degrees.

In the rotation example in chapter 3, it seems that the TGE uses radians? However, messing around with the world editor in the TGE 1.4 demos shows that it is using degrees! Perhaps the author has modified the engine?

#1
06/10/2006 (1:25 pm)
The engine uses Raidians, but i believe in 1.4 the world editor was modified so it uses degrees. It does the needed conversions for you there. I guess too many people had issues dealing with PI.
#2
06/10/2006 (1:35 pm)
And as far as I know, the world editor/.rotation property of objects has always been displayed in degrees, while the get/setTranform methods always used radians. In general, the world editor property should be irrelevant, as you'll never need to use it in code.
#3
06/10/2006 (3:51 pm)
Quote:I guess too many people had issues dealing with PI.
All those Grade Six classes gone to waste...
#4
06/11/2006 (3:38 am)
Good to see you using this Amr! :)
#5
06/11/2006 (8:58 am)
Cheers for the comments people. It's helped clear my the radians/degrees confusion.