Game Development Community

Composite Sprite BAMLs not loading correctly

by Jonathan Brockman · in Torque 2D Professional · 11/03/2014 (9:32 am) · 1 replies

Helloooo!

I have a problem. I am almost done implementing my save/load system. It involves saving the map (a composite sprite tilemap) since it is procedurally generated, along with all the game data.

The problem lays here: Saving and loading the composite sprite as an XML TAML works fine, but loading a Binary TAML composite sprite fails to produce the sprite.

Additionally, I was playing with adding the composite sprite to a simset to allow everything to be saved to a single file, but loading THAT in binary form would result in a crash. Looks like a null custom node.

Anyways, any thoughts?


EDIT: Further investigation indicates that the composite sprite is loading, its just only loading with a single sprite. This doesn't happen if it's a taml.

EDIT: Further Investigation: It appears that while the sprite is fully saved out, on read it assumes there is only a single child node (the sprite itself) per custom node (CompositeSprite.Sprites). I suppose I could simply write out the number of children, but seems like this is something that either should have been noticed, or I am missing something silly.

Final Edit: Ok, so while the subsprites are all saved, no count is saved. The reader assumes only a single sprite. Adding the subchild count and reading it, then looping, seems to resolve the issue.

#1
11/19/2014 (5:36 am)
At some point in the nearish future, maybe over the holidays, I will submit this fix as a pull request.