Game Development Community

TamlWrite not saving Controllers properly?

by Chase Webb · in Torque 2D Beginner · 05/30/2014 (8:23 am) · 3 replies

Hey all, it's been a while but I'm back with a new bug that I need some input on. Basically, I've discovered a problem where the TamlWrite() function does not include all the information necessary for certain controllers to allow them to be loaded back properly at a later point. I'll stick to the buoyancy controller today, and if we get it fixed and it doesn't help with the other thing I spotted I'll post that later.

First, replace your Sandbox's BuoyancyControllerToy with this:
http://pastebin.com/t6Xru5iK

While the toy is loaded if you press F2 on your keyboard it will save an xml-based Taml file of the current scene to your Documents folder. Pressing F4 should load the toy back to the moment you previously saved the scene. If this does not work, I believe practicing01 will post how he replicated the error just after this post.

Here's the bug: When you press F4, it will attempt to load the scene but crash when it reaches the Buoyancy Controllers' FluidArea fields. This is because only the first two numbers (out of the four required for the X Y X Y coordinates system) are saved to the taml file.

Here is an example of how the taml is saved versus the original script creating the controller:
Taml File excerpt:
<BuoyancyController
            TamlId="1"
            FluidArea="-50 20"
            FluidDensity="2.5"
            FlowVelocity="13 0"
            LinearDrag="3"
            AngularDrag="3"
            FluidGravity="0 -29.8"
            UseShapeDensity="0" />

Original code:
%this.createFluid( "-50 20 30 30", "1 0", Navy );

As I said before, I believe I have found another place where the controller information was not saving correctly (that one was on a PointForceController), but I'll wait and see if a fix for this fixes the other thing.

#1
05/30/2014 (11:26 am)
@Chase : Nice find! Fixed in this pull request

It should fix all of the issues with Controllers as it affects every item of type Typeb2AABB.

I leave it to your care to submit the bug and link to the pull request.
#2
05/30/2014 (10:24 pm)
Thank you! Unfortunately, it didn't solve the second bug I found, so I'm going to make another new thread on that. ;)

P.S. I hope I reported the issue correctly and linked to your pull request in the right way. ( https://github.com/GarageGames/Torque2D/issues/202 )
#3
05/31/2014 (5:12 am)
The issue was reported nicely. As long as it's clear, really.