Skip to main content
gamedev.net
🔒 Locked

tile-based heightmap idea

Started by Programmer16 5 replies 1.8k views
Original Post
Programmer16
Programmer16
I was thinking of a tile-based idea. Similiar to a heightmap, the data is contained in a bitmap, but instead of a grayscale, I was thinking of keeping each colors value. Then, each color could represent a layer: red = base layer (grass, sand, dirt, etc) green = lower layer (top of a tree, top of a wall, top of whatever, etc) blue = object layer Of course, this would limit the map to 255 base tiles, 255 lower tiles, and 255 objects. I'm just looking for comments on this idea (i.e. has it been tried, enhancements, etc)?
Mercury
Mercury
What most people do is place the type of tile by the height of it. When it gets higher, it tends to become rockier, about mid-level it's grassy, then to dirt, then to water.

At least that's how I think most people do it. [smile] Indoor > Outdoor
streamer
streamer
I think that this is not much usefull [smile] simply define map as:

BYTE map[256][256][256];

and you have same effect, and if you save this map as binary file (16MB) , compress it and you will have 50kb file.
Heightmap with gray scales (or any other) are usefull for defining as it name said heightmap because you can define easily smooth hills and walleys with interpolation of gray (or R, G, or B value).
If you want to store map data as backgrounds, layers and objects simply use above method. For example you don't need 255 layers :) I don't know that any game use so much layers.
A little memory saving ;):

#define MAX_LAYERS (16)
#define MAP_WIDTH (256)
#define MAP_HEIGHT (256)

BYTE map[MA_WIDTH][MAP_HEIGHT][MAX_LAYERS];

and if you need more than 255 tiles, simply use int instead of BYTE.

Also extracting an writing data to BMP file is not so much faster than

map[10][10][1] = 5;


Programmer16
Programmer16
I didn't have 255 layers, I have 3 layers: base, lower, and objects. Each color then represents a layer, and the 'brightness' of that color represents a tile (0-255)

And my iso isn't height based, so that idea wouldn't work.

[Edited by - Programmer16 on August 13, 2005 2:58:33 PM]
captainmikey
captainmikey
I'm curious how it would be any better to have say a 50x50 bitmap than a 50x50x3 byte array. Perhaps if some bitmap operations had meaningful analogues in map manipulation, but I can't imagine how.
streamer
streamer
Quote:
Original post by streamer

Also extracting an writing data to BMP file is not so much faster than
map[10][10][1] = 5;



I still stick to my opinion that extracting and writing data from/to bmp file is much slower AND if you want to manipulate bitmap(gameworld) from your game you need to make procs for that (for example if you have movable objects in game: boulders, doors etc.). Still one line of code is much more simplier, isn't it?
Anyway why do you need bitmap oriented map?
Lost
Lost
Quote:
Original post by captainmikey
I'm curious how it would be any better to have say a 50x50 bitmap than a 50x50x3 byte array. Perhaps if some bitmap operations had meaningful analogues in map manipulation, but I can't imagine how.

I'm with captainmikey. Personally I see real advantages to a 50x50x3, no messy color filtering/blending when you want to see/work on only one layer of the map.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.