Game Development Community

Replace character in FPS example

by Chris Caswell · in Artist Corner · 05/03/2006 (3:45 pm) · 2 replies

Hey, i just want to replace the character in the FPS example right now, how do i do this? i am able to put a new character but he doesn't animate.. even when i replace the animation files too.. is there a decent tutorial on this sort of thing?

#1
05/03/2006 (3:50 pm)
Chris:

I do not know of a tutorial.
but really its not that complex.

what you need to do is locate the scripts defined to instantiate this object.

there is one im sure you have already found.
it resides beside the actual dts and dsq files.
this is a simple descriptor file.
stage 1 of the process.
the next step is to locate the player datablock script.
im sure if you browse the script directory you will have no trouble identifying this script.
(logical names applied)
once you locate the appropriate script, it is a matter of analyzing the file's referenced by the script that define the model used. (if memory serves me it is as the top of the player script file)

I recommend once you find this directory with these scripts that you spend some time analyzing them and getting to know thier contents a bit.
It will give you a lot more flexibility in your customizations.
#2
06/05/2006 (9:57 am)
If you are using the maya2dts exporter... make sure you have copied over the animations from the maya2dts_filepack to the character's shape directory. The default animation dsq files use a space in the bone names so you must use the ones provided withe the filepack since they use the no spaces (underscore separators) convention in maya. If you don't use these dsq files then they will just not be compatible and your character will float around like mine did without animation. The names of the bones must match the dsq files, so if you make your own bone names you would have to create your own animations and export them and of course put the names of the exported animations in your .cs file.
When I discovered the problem ShowTools pro was showing an error in the console when you load the dts and cs files together saying that it doesn't like one of the bones and was not loading the animations automatically. This confused me because when I loaded the dts by itself and different dsq animations individually they would load and play okay. I must have been accessing the correct dsq files that were in a different directory than the ones that were being attempted to load automatically. Other lessons I have learned from the forums were to make sure the player.cs file in your characters shape directory is being sourced by editing the OTHER player.cs script that is located in your games server/scripts directory.
These 2 lines need to be changed to have the relative path and name of your character's cs file.
// Load dts shapes and merge animations
exec("~/data/shapes/player/player.cs");
...
shapeFile = "~/data/shapes/player/player.dts";

//changed to
exec("~/data/shapes/myGuy/myGuy.cs");
...
shapeFile = "~/data/shapes/myGuy/myGuy.dts";

Should usually be named after your character. So in this example. The player is called myguy in a myGuy directory under shapes dir..and assuming your cs file is named after your character's dts file is sharing that same directory and the cs file contains the TSShapeConstructor function that has all your animation dsq files named properly. Also, makesure that the baseShape line has the name of your character in it.
Example
baseShape = "./myGuy.dts";

Other things that can cause problems are when the hierarchy of the nodes in maya are not correct. Check the docs to verify this and look at the console to get hints about any errors either in ShowToolsPro or in the game itself after it has loaded or attempted to load the character. Pay attention to the naming conventions and how numbers are suffixed for detail nodes ect..

When exporting from maya make sure the dtsNode's extra attributes have the paths to your projects dts and dsq directories and file names are named after your player. example
shapeName
player.dts
shapeLocation
C:\Projects\TorquePlay\dts
sequenceName
player.dsq
sequenceLocation
C:\Projects\TorquePlay\dsq

I noticed that creating a Projects directory (like mine above, that had no spaces in the full path, unlike the following example in Windows
"C:\Documents and Settings\Owner\My Documents\maya\projects\torqueTest"
helped the exporter avoid being confused.

Of course when you implement this in the starter.fps you'll need to make sure to copy the cs dts and dsq files to your shape directory from your maya projects directory.
Hope this helps you or anybody else hunting the forums for similar problems. Good Luck with your character.