Game Development Community

Is Torque X DTS Different from TGE(A) ?

by John Kanalakis · in Torque X 2D · 12/05/2007 (8:36 pm) · 6 replies

I'm having no problem loading and rendering the DTS shapes bundled with Torque X. However, when I try to load DTS shapes pulled from TGE and TGEA, I encounter an IndexOutOfRangeException in the ShapeInstance._RenderMesh() method. The DTS models work for TGE(A) and appear normal in the Torque Show Tool, as does the new Torque X shapes.

Has the DTS format changed?

John K.

About the author

John Kanalakis is the owner of EnvyGames, an independent game development studio in Silicon Valley that produces games and tools for Xbox 360, Windows, and the Web.


#1
12/05/2007 (9:35 pm)
I noticed this as well with the DTS's I was using. I think though it had something to do with one of the meshes having a period in it, like base.body.jpg. It just truncated it to base, and couldnt find it, then tossed a -1 into the nodeindex and blew up in the rendermesh function :| I would be curious to the answer for this as well.
#2
12/05/2007 (10:20 pm)
So, digging through the ShapeInstance code, it looks like the GarageGames.Torque.TS.Object.NodeIndex is set to -1 for some reason. When I set the value to 1, the classic TGE Orc character loads and renders normally. So, it can work... just need to figure out what's wrong. It could be a bug in the shape loading code.

John K.
#3
12/05/2007 (11:41 pm)
Further digging is pointing to the ShapeReader._AssembleShape() method returning different results between the Boombot shape (23 objects with valid NodeIndex values) and the TGE Orc shape (1 object with -1 NodeIndex). It seems like there could be a difference between the DTS shapes, the Boombot character seems to have a lot of Subshapes defined within the DTS, whereas the Orc shape does not.

John K.
#4
12/25/2007 (4:25 am)
I've spent some more time looking into this without much luck. It would be great to get some input from one of the GarageGames engineers. The simple question is: has the DTS format/requirements changed for Torque X?

I was expecting the Torque X DTS structure to be consistent with the TGEA DTS Structure. However, TGEA models DO NOT LOAD properly into Torque X. Specifically, any TGEA model with animaton nodes don't load (simple mesh shapes load and render just fine). The problem (mentioned in my last post) is the following code from tsShapeReader.cs:

// Read in objects
_shape.Objects = new Object[numObjects];
for (i = 0; i < numObjects; i++)
{
    _shape.Objects[ i ].NameIndex = shapeStream.ReadS32();
    _shape.Objects[ i ].MeshCount = shapeStream.ReadS32();
    _shape.Objects[ i ].FirstMesh = shapeStream.ReadS32();
    _shape.Objects[ i ].NodeIndex = shapeStream.ReadS32();
    _shape.Objects[ i ].NextSibling = shapeStream.ReadS32();
    shapeStream.ReadS32(); // decals are deprecated
}

Whereby _shape.Objects[ i ].NodeIndex is always -1 when in fact there are as many as 28 nodes. Here are some screen captures from Torque Show Tool that compare the DTS structure of a player from Torque X, TGE, and TGEA.

Snapshot of the Torque X player (Boombot)
www.envygames.com/share/player_torquex.jpg
Snapshot of the TGE player (Orc)
www.envygames.com/share/player_tge.jpg
Snapshot of the TGEA player (Space Orc)
www.envygames.com/share/player_tgea.jpg
As far as I can tell... The main difference between TGE and TGEA DTS is that TGE does not have meshes as Sub-shapes, just as node, and TGEA does have mesh sub-shapes (in addition to skinned meshes). Torque X seems to resemble TGEA in that it also has mesh sub-shapes and absolutely no skinned meshes. Is this by chance, or by design? If anyone has some thoughts on this, please share them. At this point though, it seems to me that Torque X has a serious bug somewhere in the shape loading code.

John K.
#5
01/07/2008 (2:07 am)
Still trying to figure this out... I've tried many character DTS shapes and the only ones that work are those which come with Torque X itself. The_shape.Objects[i].FirstMesh is stll being set to -1 all of the time. I've added some code that manually sets this value to 0 when it is -1 and the player model renders with the skin mesh off to the side... Since it's consistently a problem for SkinnedMeshes, I'm slowly tracing into the ShapeReader class, looking into the _AssembleSkinMesh() method. Since the Torque X (Boombot) player model doesn't have a "Mesh.MeshEnum.SkinMeshType" skinned mesh, this could be the problem.

www.envygames.com/share/tgea_dts_torquex.jpg
If anyone has any ideas, please send them along. If anyone at GG is tuning in, would it be possible to get the original 3DS Max Boombot model for study? Also, what DTS exporter was used?

John K.
#6
01/07/2008 (10:06 am)
Hey John,

I will try to dig up the model for the boombot that was exported for the demo. It is somewhere on my hardrive, I just need to find the correct one. it would help if you would email me directly to remind me.

In terms of differences from the orc.. the orc has a 'skin' mesh that is deformed by the bones, with a few mesh shapes linked to the bones (the head and shoulder pads).. the boombot is mostly articulated shapes.. as in, the mesh parts themselves are parts of the skeleton.. and there are a bunch of other nodes in there to link it together and to link things to.