Game Development Community

Player and player.cs file linkage question

by AllynMcelrath · in Torque Game Engine · 10/23/2007 (10:14 am) · 5 replies

I am getting some odd issues coming up in regards to the player dts and related cs file. Specifically, it seems as if my animations are not linking to the model at run time.

Now, for sake of clarity i will explain my current set up. Currently, i have the CS file one folder above the DTS it belongs to, additionally, i have the various animations i have created for the shape in folders under both the DTS and the CS file. I do this for organization, and to manage the animations files. I intend to add more "Sets" (The sets are relevant to my game mechanic) at a later date, so i separated the animation files in folders for easy navigation of the files. (Alls scripts, and exec's are working and throw no errors)

Currently, when i export the DTS with no animations, and each DSQ file... The animations are NOT availble to the mesh when i run the engine. From what i can tell, all file path refrences are correct, and do point to the animation sequence they point to.

After reading the limited documents about animations, i noticed that it kept referring (or at least hinting) to having the CS file, and animations, and mesh in the same directory, so, while not directly saying that this is required.. I am beginning to think it is necessary.

So, my questions this : Are the DTS, CS, and DSQ's REQUIRED to all be in the same directory?

I am hoping the answer is no, if it isn't, then i have some asset restructuring to do, and it may become problematic with the large number of animations i have, and the dynamic nature of the scripts that call them.

The reason i had never seen this before, is because my animator was exporting the DSQ's , and also exporting the animations in side the DTS, causing a redundancy. I would like to fix this problem now, before i continue.

Thank you ahead of time for any help, if more info is needed i am willing to explain further.
~Allyn.

#1
10/23/2007 (12:25 pm)
You need them all in one file make sure you have a player.cs in your shapes player
#2
10/23/2007 (2:59 pm)
You could also look into changing the player.cc or subclass code or TSShapeInstance class that I believe does the standard animation loading. (Start by searching for "jump" : include the quotes. What this finds is the player.cc code that hardcodes certain required animations that do the "action" stuff that transitions between the walking animations.)

You could spend your whole life trying to come up with a general animation system for objects. Any halfway complicated object is likely to need some customization. In my last project, to get done on time we did some special mounting modifications to get around small errors in the animations (rather than redoing a lot of them) and special weapons-with-arms switching code and no doubt other things I have repressed from my memory ;)

It is a good idea to figure this out early as the original poster mentioned. I wasted some time on my first project trying to do things the "quick and easy" way, that of course ended up slower ;)
#3
10/23/2007 (4:50 pm)
I believe (I was very briefly looking in that code recently) that the .cs file has to be in the same folder as the dts (and named the same).

However, I am pretty sure that the .dsq's referenced in the .cs file can be located elsewhere as long as the paths are set up correctly in the .cs.

For example, I could have 3 folders: /bob, /dan, and /animations

In /bob I would have bob.cs and bob.dts and in /dan I would have dan.cs and dan.dts.

Both bob.cs and dan.cs would be nearly identical files where only the name of the file, the name of the TSShapeConstructor, and the baseShape would be different.

So dan.cs would be something like:

datablock TSShapeConstructor(DanDts)
{
   baseShape = "./dan.dts";
   sequence0 = "~/data/shapes/animations/player_root.dsq root";
   sequence1 = "~/data/shapes/animations/player_forward.dsq run";
};

and bob.cs would look something like:

datablock TSShapeConstructor(BobDts)
{
   baseShape = "./bob.dts";
   sequence0 = "~/data/shapes/animations/player_root.dsq root";
   sequence1 = "~/data/shapes/animations/player_forward.dsq run";
};

I *think* it is even smart enough to handle having a player.cs and player.dts both in the /bob and /dan folders as long as the TSShapeConstructor is named differently. You could possibly even get away with not having the TSShapeConstructor not be named and have both .cs file be totally identical.

As far as I was able to tell in my quick peek at the code (didn't have time to test it any), the only requirements are that:

1) The .cs is in the same folder as the .dts
2) The .cs has to have the same name as the .dts
3) The TSShapeConstructor can not be named the same as any other TSShapeConstructor (or not named?)

I am pretty sure it doesn't have any requirements about the location of .dsq's
#4
10/23/2007 (5:22 pm)
ACK just spent an hour or two moving things and correcting references! lol

Thanks ill look into that, but dumping everything in one folder works (Not all animations are working however, and nothing works with the show tool load DTS + CS).

The only thing i was doing differently then what you have outlined is the locations of my CS file.

In my version, the base shape line, i had extended the path to point to the shape, and it never threw an error, but this could have been covered up by the DTS also including the animations in the previous versions.

Thank you for your help.
#5
10/24/2007 (7:40 pm)
Well moving my files all into one spot worked. But now i am having issues with any blend animations. For some reason, the areas that the blend animations (Such as "head.dsq") the geometry disappears, what i can describe is there is just a stump where all vertices seem to have merged into one point.

Not sure whats going wrong here. The DSQ's all match up, and only the bones it affects are set to export on the position, rotation, and scale and the reference frame is 0 and its set to blend animations. Im using lightwave.

I'm going to try to turn off the scale of the bones and see if that fixes it.

On another note, when using show tool pro, load DTS and CS spits out an odd error the engine does not.
Executing c:\documents and settings\trucegore\desktop\dco_10_23_07\dco\data\shapes\player/female.cs.
c:\documents and settings\trucegore\desktop\dco_10_23_07\dco\data\shapes\player/female.cs (0): preload failed for Female.dts: Missing sequence c:\documents and settings\trucegore\desktop\dco_10_23_07\dco\data\shapes\player/Emote_heelclick.dsq Emote_heelclick for c:\documents and settings\trucegore\desktop\dco_10_23_07\dco\data\shapes\player/Female.dts.

Any more help or input is welcome. Definitely going to write a TDN if i get this all figured out.