Rihards
Rihards

Reputation: 10339

What would be the right way to keep map data in AS3?

I need to keep a map data for rendering a map somehow in as3. I was thinking about keeping the tile types of the map in XML or nesting (multidimensional) arrays, but as I've like 60 different maps, then storing the map's tile data in those arrays in classes doesn't seem right?! Is there any other ways how to keep such data or I should go by XML?

P.S. If I go by XML, it would mean I would need to store and load the correct XML file from server when it's needed right? As it it's for a online game.

Upvotes: 0

Views: 129

Answers (1)

Daniel
Daniel

Reputation: 35724

you could convert your object to a bytearray and save as file.

you wouldn't get a nice looking file like xml, but you would have a lot smaller file size.

another object is using json, which is lot like xml, but a bit less syntax heavy, but still pretty big compared to the byteArray method.

look at AS3 Custom Object to ByteArray then to Custom Object for some more info on writing to ByteArray

additionally Thibault at bytearray.org has a lot of information http://www.bytearray.org/?p=711

Upvotes: 1

Related Questions