Game Development Community

Why two Player.cs files?

by Infinitum3D · in Torque Game Engine · 06/13/2008 (8:41 am) · 2 replies

There is a Player.cs file in server/scripts that lists the datablock, etc.

There is a second found in data/shapes/player that lists the animations.

Can they be combined into a single file, or do they have to be separate?

For clarity, I changed the name of the second to playerAnim.cs with no problems in compiling (changed exec also)

Just curious why they were separated but given same name.

Tony

#1
06/13/2008 (9:19 am)
My best guess was purely for organization. There's a player.dts, so it would make sense to name the file that contains the code for building the shape and animations player.cs.

If you want one player.cs, it's quite feasible to combine the two scripts into one file. I would check to see which of the two gets exec first, and combine them in that order.

Just my opinion.
#2
06/13/2008 (12:14 pm)
The examples provided with Torque established a "convention" of putting the TSShapeConstructor definition as a script with the same name as the DTS file, in the same folder as the DTS and DSQ files. You can change the name of either script without seriously affecting the engine (as long as you also change the exec statements of course).