Game Development Community

Saving Tilemaps

by Matthew Klundt · in iTorque 2D · 01/05/2010 (11:56 pm) · 15 replies

I'm trying to create a simple prototype with 1.3 and when I save a tilemap, it erases the whole thing and appears empty when reloading the project.

Any one else have this problem?

#1
01/06/2010 (12:28 am)
Just tested it.
Seems like I get the same on OSX 10.6

the log mentions:
Quote:
t2dTileMap::saveTileLayer() - Could not Save to Stream '/Users/dreamora/GayaSoft/Torque2D iPhone/T2D iPhone 1.3/MyProjects/BehaviorShooter/projectFiles/game/data/tilemaps/layer5.lyr' for Tile-Layer Save.
t2dTileMap::loadTileLayer() - Could not Read from Stream '/Users/dreamora/GayaSoft/Torque2D iPhone/T2D iPhone 1.3/MyProjects/BehaviorShooter/projectFiles/game/data/tilemaps/layer5.lyr' for Tile-Layer Load.

afterwards.
Although I don't know how saveStream could fail after openFile succeeded.
the file afterwards contains 2DSO, newline and then a few ^^^^ and is otherwise blank.
#2
01/06/2010 (3:31 am)
I have noted this to look into as well, openFile does succeed so it seems quite mysterious.
#3
01/06/2010 (3:28 pm)
The problem actually seems to be worse than just that.

Its not only tilemap layers, but basically any kind of save functionality that goes to a distinct file from the editor that fails.
Just tested it on effects and they are just as trashed after that operation.


The only thing that seems to work is gui saving, which is outside the T2D serialization
#4
01/13/2010 (4:34 pm)
Use iTGB 1.2 to edit tilemaps. They can still be loaded (just not saved) by 1.3.
#5
01/13/2010 (5:16 pm)
thats the "fake around" yeah :)
#6
01/13/2010 (5:33 pm)
I just upgraded to iTGB 1.3, and I am also having this issue. I'm using Mac OS X v10.5.8. Saving Tilemaps appears to be completely broken. I can create the Tilemap just fine, but if I click "Save Layer", all the images from the layer disappear.

I see the problem is known, and I'm assuming being worked on: http://www.torquepowered.com/community/forums/viewthread/108645
#7
01/18/2010 (1:42 pm)
Any ETA on the fix for this?
#8
01/20/2010 (9:03 pm)
This is very frustrating and starting to sour my perception of this product.

I don't mean to be rude, but this is unusable to me in its current state.
#9
01/20/2010 (9:14 pm)
The easy solution at the time is just to put T2Di 1.2 next to it and use that to generate the tilemaps and particle effects.
As neither of these has changed in the file structure and editor behavior, you shouldn't have problems at all with that approach

none the less the broken serialization must be fixed, as doing gamesaves is basically impossible at the time

Sadly i've not been able to find the root.
I compared the whole editor cs files and the source of both projects and didn't find anything that seems to cause it, so I'm kind of forced to believe that modifications in relation to the new defines / project build targets must have messed it
#10
02/24/2010 (3:00 am)
I am also having the same issue with the tilemaps disappearing.

I also noticed when it tries to save the layer it saves it in the format "<filename>.lyr.lyr" and if I load the tilemap after it disappears the iTGB crashes. I have tried changing the name to "<filename>.lyr" and load the tilemap but it does not displayed as a valid file in the dialog box. Is the file extension suppose to be "<filename>.lyr.lyr"?

Is there any idea when this issue may be fixed?

Also maybe a little off topic but the drag and drop feature for images into torque does not seem to work for Mac? Is there a configuration option or setting which needs to be turned on? this functionality works in nearly every other mac application.


#11
02/24/2010 (8:36 am)
Drag-and-drop does not work on the Mac version and has not for years, if ever.
#12
04/15/2010 (2:34 pm)
I think I found this issue. At least I made the correction and the tiles maps and effects are saving and loading properly now. It was merely a line that was commented out between 1.2 and 1.3. Here is the fix:

In t2dSceneObject IMPLEMENT_T2D_SAVE_METHOD( t2dSceneObject, 11 )

Uncomment the return false; here:

//if ( object->mUsesPhysics )
	{
		if ( !object->getParentPhysics().saveStream( T2D_SERIALISE_SAVE_ARGS_PASS ) )
			// Error.
		{
			Con::printf("Luma :: t2dSceneObject :: No physics to save?");
-->>>		return false;
		}
	}

You'll have to recreate your 1.3 saved tile maps though. The old ones will be corrupt.
#13
02/21/2011 (9:53 pm)
Does this need to be recompiled? And if so, how?
#14
02/22/2011 (6:22 am)
yes any source change requires a recompile.

you would open the project (regular xcode, not xcode iphone in the compilers folder of the engine folder) and build it
#15
02/23/2011 (11:07 am)
@Robby - Which version of the engine are you using? 1.4 or 1.4.1 Preview?