View Full Version : Isometric map data
darnpunk
July 15th, 2009, 11:43 AM
Hi,
I've read some articles and tutorials on the different file formats to store isometric map data. They are usually XML or text file. I am wondering what is the best way to store map data in an online game? I am working on a project where the players are able to customize their own maps and the stage area probably has a few hundred tiles.
Using a 2d array, the data may be quite large depending on complexity. I expect the players to customize their maps regularly and wonder how heavy that will be on the bandwidth. Is there a preferred way to store/compress these data so that it will be faster to load/save? Maybe only saving a particular change?
I can probably handle the loading/saving time with a waiting screen but I am hoping for speed. I am wondering how games like Restaurant City does it. It looks as if there is much to load and save but it does it all pretty fast.
Hope there's some valuable advice someone could share.
Thanks!
therobot
July 15th, 2009, 11:51 AM
probably the most inefficient way to store your map data (in terms of file size) would be xml, but as a point of reference, even a relatively big map represented in xml should only be a handful of kilobytes at most, so the load times for this should be relatively short.
Gnoll
July 15th, 2009, 07:30 PM
Well if you could be bothered you could store it all in a ByteArray, for compression, but bandwidth-wise only save updates for modified tiles I guess. How many tiles are you thinking of having on a map?
Gnoll
therobot
July 15th, 2009, 09:30 PM
only save updates for modified tiles
How would you do this, exactly? Just curious :)
store your map data in smaller, separate sections/files?
Gnoll
July 15th, 2009, 11:59 PM
Well if you have the original tilemap, then you change a tile, mark that tile as "dirty" or something, then you loop through and update all the "dirty" tiles, in theory.
This could be larger if many tiles are changed though, lets say you use a full save every time method, you send every tile in a 100*100 map, each a byte (You just need to send the tileType or whatever, 10,000 bytes) or update a single tile (You need x,y,newTileType) this will be 5 bytes per updated tile roughly. If every tile is changed it will be 50,000 bytes.
In truth using a full save method should hardly use any data anyway (as therobot said), depending on the size of your maps.
Gnoll
TOdorus
July 16th, 2009, 05:01 AM
A bit on the technical side: http://board.flashkit.com/board/showthread.php?t=755614
Combined with Gnolls suggestion that should keep it down quite a lot. Oh, you could actually save a standard tile (Grass in a grassworld, water at a island world) at the beginning of your map data and then add the deviant tiles.
darnpunk
July 16th, 2009, 12:43 PM
Hi guys,
Thanks for the input. Saving the "dirty" tile sounds like a good idea. Maybe there can be a condition to save tiles in two different manner. If there are too many tiles being saved, the game can request for a full save. A couple of tiles should be requesting for a modify for certain tile types.
By the way TOdorus, what do you mean on the saving a standard tile at the beginning?
BoppreH
July 16th, 2009, 12:59 PM
darnpunk, if I understood well, TOdorus meant to leave empty spaces in the map and let the game fill the automatically based on the map type.
Ex: you save a map containing only some trees:
___________
| T T |
| T |
| T |
| T |
-------------
And the game engine automatically fills it with grass because the level is a jungle one:
___________
|GGGGTGGGGTG|
|GGGGGGTGGGG|
|GGTGGGGGGGG|
|GGGGGGGGGGG|
-------------
This way you can save only the trees and still have a perfectly complete map when the player runs it.
TOdorus
July 16th, 2009, 01:33 PM
Exactly. Like for some maps (like a jungle map) it's best to have the map filled up with grass. But say you have a map with islands, which wil be mainly filled with water, it's best to fill it with watertiles. That's what I meant by the standard tile. The rest of the data stores the deviantions.
BoppreH
July 16th, 2009, 01:45 PM
Problem is, you either store a "0" for the default title or have to specify the x and y for every deviation.
For an island maps, for example, it wouldn't be a good idea, because there will be a lot of deviations and it'll probably take more space.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.