Archived

This topic is now archived and is closed to further replies.

Dirple

map editor

Recommended Posts

Dirple    122
I am kinda new to game programming and I was just wondering a quick way to generate a large 2d map. I use a little program that lets me import the tiles I want and draw the map that way. the only problem is the map files are huge. is there a prog that would let me input a tileset and draw a map, but make a file with the number indexs of the tiles used, so that I could read in the file in my game a blit the correct tile in the correct spot. The only reason i ask is because the map generator I have now makes files upward of 2 megs each. I just think thats a little big......thanks for any help..

Share this post


Link to post
Share on other sites
MirekCz    132
well, as far as i understand you, you have got a map editor that is perfectly capable of doing what you want, so why to bother with someone''s else tools?
I don''t know how you save your maps, but I do it like that:
what I have:
1.a linked-list of tiles available
2.a tilemap size 128x128 tiles
btw in my linked-list I save how many times a tile is used. I know it''s a bit hard to keep calculating etc. Therefore you could simple calculate it after pressing the save button

I save it like this:
first go thru the linked-list with available tiles from front to back and if a tile is used (usetime>0) I give it a number (from 1 to 65535 - short type)
and now you start to save your file:
1.write how many different tiles you use (a number)
2.here you write all the tiles you use (so you put here tile image or tile filename so you can load it from a file)
3.after the block with tiles description I write down the whole tilemap. But in my case every tile takes only 4 bytes (2 bytes with the number of image used and 2 bytes with specific data about this tile)

If you sum it up, I end with 128*128*4bytes=64kb + some data to save tiles that are used for my map (I save tiles names, so it takes little space)

Hope it helps you a bit.


With best regards,
Mirek Czerwiñski
http://kris.top.pl/~kherin/

Share this post


Link to post
Share on other sites