#### Archived

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

# A great temporary map loader

This topic is 5981 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

gggggggrrr
ggggrrrrrr
gggrrrbbbb
gggrrrbbbb
gggrrbbbbb
ggggrrrbbb
gggggrrrbb
ggggggrrrb
ggggggggrr
gggggggggg

(To draw these things, use any graphics program -- I use PSP -- just make sure to turn off anti-aliasing for whatever tool you're using so that the colors are pure. Keep in mind that you will and should see jaggies in your bitmap file). Anyway, to load make the map from this, all you would need to do is load the bitmap, and scan each pixel to see which tile it represents. The problem with this system is that it would require you to program the pixel colors. So, this is where TANSTAAFL's stuff comes in. You need to add one more column to the bitmap to hold the "tileset" information. Basically, this last column contains the color->tile mappings. This allows it to remain dynamic so that you don't have to recompile every time you use a new map color or add a new tile to your tileset. The last column contains the following: - The first pixel is a "NULL" color. This is a color not located in your map. This is used to tell your "reading" routine the number of colors in the map. - The next pixels in this column are the color mappings. The colors here match the colors in the map. They should be placed in the order in which the tile they represent are in the tile set (did that make any sense? hopefully) - The remainer of the column is filled with the NULL color. So, say that my tileset is arranged in the following order: grass - water - dirt Here is the map image with template using this ordering ("w" represents "white", the NULL color in this case):
gggggggrrrw
ggggrrrrrrg
gggrrrbbbbb
gggrrrbbbbr
gggrrbbbbbw
ggggrrrbbbw
gggggrrrbbw
ggggggrrrbw
ggggggggrrw
ggggggggggw

Now, if I add a "rock" tile to the tileset (as the fourth tile), and represent it with grey ("y") in the map, the map simply needs to be edited as follows (the bottom-left corner now has a rocky area, and the template column now has grey representing the fourth tile in the set):
gggggggrrrw
ggggrrrrrrg
gggrrrbbbbb
gggrrrbbbbr
gggrrbbbbby
ggggrrrbbbw
gggggrrrbbw
ggggggrrrbw
gyygggggrrw
yyygggggggw


##### Share on other sites
Hi

Not the best way, but easy:

My engine writes the rought binary data from the arrays to a file, ~ 8MB. After that I compress it with zlib.dll, ~0.5 - 1MB

The steps:

save Data > tempfile > zlib compress > |Savegame|
|Savegame| > zlib decompress > tempfile > read Data

cu

##### Share on other sites
No doubt this is something like what I''ll implement in the long run (I already have some file format stuff I''m working on -- although I admit I never thought about using the zip library to compress it), but the nice thing about using the bitmap map is that you get instant visual without having to load your map into another program.

-Chris

##### Share on other sites
I had hoped that this was one of the areas where The Scrolling Game Development Kit would come in handy: as a map editor for a work in progress; one that gives a WYSIWYG interface to the map and offers features like tile matching so you don''t get jagged graphics. The map can be saved in the proprietary format (which includes an easy-to-find big chunk where 1 byte = 1 tile all in one consecutive block) or in XML format. Other formats could be output by writing a VBScript to create a file from the currently loaded map.

I''m not aware of anybody using it this way right now though. Too much overhead?

"All you need to do to learn circular logic is learn circular logic"

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 14
• 12
• 9
• 12
• 37
• ### Forum Statistics

• Total Topics
631434
• Total Posts
3000051
×