0

I'm making a map editor for my game and I'm at the point where I need to save the map to a file. My Maps contain multiple layers though, which will be stacked on eachother for display. I know I could save each file seperately but I wanted these to be contained in a single file.

Is there an easy way to do this that I'm not thinking about? TIA

4
Contributors
3
Replies
24
Views
2 Years
Discussion Span
Last Post by ~s.o.s~
0

Yup
XMLEncode and XMLDecode will convert anything bean-like to XML dead easily. Also works for beans-within-beans, so you can encode/decode an entire List, or arbitrary top-level container object in just one method call.

You could also create a zip file with all your files in it (java.util.zip.*)

Edited by JamesCherrill

0

"Real" game maps are almost always stored as binary to reduce load time and to prevent easy editing using a text editor (some sort of obfuscation).

http://gamedev.stackexchange.com/questions/35893/custom-extensible-file-format-for-2d-tiled-maps

Also, if you have got simplistic sort of data you can use existing binary formats like protocol buffer for encoding your data.

https://github.com/bjorn/tiled/wiki/TMX-Map-Format

The obvious disadvantage being requiring more work and not being human readable. It really depends though, go with XML/JSON if you are not going to have crazy big maps...

If you want to have fun with "from scratch development", try implementing binary maps, if not, just go with the simplest possible XML representation.

Edited by ~s.o.s~

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.