Game Development Community

T3D shapeeditor only support 32 animations?

by Steven Chiu · in Torque 3D Professional · 08/31/2009 (1:14 am) · 5 replies

During my testing the melee resource and trying to add new animations using shapeeditor, engine crashed when I added the 33th animation and save. Is there any limit for current animations that the player class can handle? In my old TGEA project, I can use over 32 animations for one character without problems. So I think if that limit exists then it would be quite a bother.

#1
08/31/2009 (4:02 am)
platformNet.h
...
#define MAXPACKETSIZE 1500

try to increase the value
a sequence name stores up to 40-60 characters (bytes) that must fit in one update.
you will see it is around 30-35 animations, depending on their names.

if it doesn't work i believe somewhere in code are reserved 5 bits for animation and you should tweak this.
#2
08/31/2009 (4:40 am)
If 32 is the currently set limit, I would like to say: "It is no longer 2003, please use modernistic limits".

Thank you and good night. :P
#3
08/31/2009 (10:35 am)
@Picasso: AFAIK TSShapeConstructors aren't datablocks anymore and thus aren't networked either. Just like materials, they must be created locally (this means both the client and the server must execute the .cs that creates them). So, there should be no no longer any network-related limits on the number of animations.

Also, changing the MAXPACKETSIZE define is a *bad* idea. It is not honored in a variety of places, where "1500" is hardcoded. And even if you get around to modify all code points that deal with packets to hold a larger size, forget about multiplayer since your packet will be bigger than the MTU used by LAN (1500) and WAN (~1490), which means the network card or router will break your packets.

Now, it could be a bug in the shape editor interface itself. The animations are stored in a vector, so it shouldn't have any limits.
#4
08/31/2009 (8:51 pm)
@Steven: Was the model you were editing currently in use as the Player object? I can only reproduce this issue when that is the case.

There is no limit to the number of animations you can add or edit in the Shape Editor. Here's what I think is happening:

TSShape maintains a vector (resizable array) of sequences. As you add sequences to the TSShape, it increases the size of the vector accordingly, which may involve re-allocating the memory for that vector. All well and good.

However, the TSThread class stores a pointer to the sequence data in the vector. If the memory for the sequence vector is re-allocated, this pointer may become invalid, causing a crash if it is dereferenced. The '32' likely comes from the size of the memory block allocated by the Vector class.

Note that this can only happen if an object using the model being edited is currently playing animations.

It's possible to fix this (by having TSThread store an index into the vector instead of a pointer), but in the meantime, you can work around this issue by only adding sequences for models not currently in use in the scene.
#5
09/01/2009 (3:48 am)
The problem seems gone now after using the characters and animations of my previous project. I doubt that the animations of old melee resource may not be compatible with the forgesolider model. Anyway thanks you guys for the help.