GarageGames / Torque2D

MIT Licensed Open Source version of Torque 2D game engine from GarageGames
MIT License
1.67k stars 1.56k forks source link

TAML Write/Read Crash #345

Open Juason opened 8 years ago

Juason commented 8 years ago

Using latest T2D head with Visual Studio 2015 on Windows 10.

TamlWrite in binary format, and then reading it will cause a crash with some objects. It appears to error on line 339, with the AssertFatal of "field object cannot be NULL."

TamlWrite with XML or JSON does not crash, but exhibits unusual behavior. When writing and then reading the object via XML or JSON, I experience the occasional dynamic field not being setup properly from the same saved files. This leads me to believe there is a problem with the reading. Loading it 10 times I get 10 different problems being exhibited among the different NPCs in my game.

Example Code for Save and then Load:

TamlWrite($ACTORS, %saveActors, "binary", false); $ACTORS = TamlRead(%loadActors, "binary");

Below is a link to a zip with saves of the simplest game scenario I could engineer, with just a single Imp character present. Imps are CompositeSprites with a Behavior and many dynamic fields. I've tried to include the Binary, JSON and XML versions of the start of a game in hopes someone can identify the problem.

Thank you!

https://drive.google.com/file/d/0B9EYwAWdSUu2SU03WWFpMnVNMUU/view?usp=sharing

greenfire27 commented 8 years ago

Did this start just after the release or did you just recently start using binary files?

Juason commented 8 years ago

This has existed for the past several releases. I've only just now had time to do a deep dive into it.

camporter commented 8 years ago

Do you see a message similar to "Taml: Failed to create type '' as such a registered type could not be found."?

The curious thing I'm noticing is that reading the binary file yields a type named "StarActor", but "aStarActor" in the JSON and XML TAML. Which is the correct type? When looking at the previous bytes in the binary file, the character 'a' exists, even though it is not considered part of the type when loaded...