Game Development Community

Save tile layer bug?

by Johan Stenqvist (neochrome) · in Torque Game Builder · 06/07/2005 (12:47 am) · 4 replies

Hi,

I've tried to create a tile layer with the tile editor and save it as a stand alone tile layer (not a complete map).
When I then try to load it back in script I get an error telling me something in the lines of "invalid stream header" or something.

It's really easy to reproduce this behaviour:
1) Create a tilemap with the tileeditor (I tried a 5x5 tiles, one layer of 64x64 pixels tilemap)
2) Draw some tiles
3) Save as layer
4) Create layer object
5) Call layer.loadTileLayer() <-- gives you the error.

Saving loading whole tilemaps works though.
I work around this by loading complete tilemaps (containing only one layer).

Best regards,
Johan

#1
06/07/2005 (2:16 am)
Can you successfully reload the layer from within the tile editor?
#2
06/07/2005 (3:02 am)
Hmm, yes - that was strange - I thought the same functions were used by the editor?

I'll have to check the editorsource to be sure.
#3
06/07/2005 (3:41 am)
It may be that the fxTileLayer2D object is designed only to be created through an fxTileMap2D since there don't seem to be any functions to add a layer to a map but there is the createTileLayer() function.

I tested the following code and it will load a layer called 'test', previously saved out from the tile editor.

$map = new fxTileMap2D() { scenegraph = t2dSceneGraph; };
$layer = $map.createTileLayer( "1 1 1 1" );
$layer.loadTileLayer( "T2D/client/test" );
echo( "Tile counts:" SPC $layer.getTileCount() );
echo( "Tile sizes:" SPC $layer.getTileSize() );
#4
06/07/2005 (4:03 am)
Ok, that might be the case.

I wonder if there is any difference performance wise between loading the layer via a created tile layer in a tile map, or as loading a complete map (although only with one layer) and then use getLayer() ??