1

I just started to look into libGDX and I really enjoyed it. Loading a tile map I generated with an editor was really simple. But I have in mind to work on a game where the player can modify and extend the map.

So here is my question: Is it somehow possible to add/delete/change fields in a com.badlogic.gdx.maps.tiled.TiledMap and save the result to disc?

Jens Piegsa
  • 7,399
  • 5
  • 58
  • 106
anhoppe
  • 4,287
  • 3
  • 46
  • 58

1 Answers1

2

Unfortunately, right now there is no built-in feature to store TiledMaps.

I know only the .tmx format of TilEd, but this is a pretty easy and straight-forward XML format, which is very similar to the structure of a TiledMap. Check out how TmxMapLoader loads the TiledMap and then use an XmlWriter to write your altered maps to a file in a similar way.

noone
  • 19,520
  • 5
  • 61
  • 76
  • I just saw that a lib called 'kryo' can be used for serialization. Maybe that is another possibility. Otherwise I'll have to write the writer... – anhoppe Nov 16 '13 at 20:22
  • 1
    Okay, in case you do not want to open your modified maps in the editor, binary serialization might of course be an option. – noone Nov 16 '13 at 20:24