Jump to content
  • Advertisement
Sign in to follow this  
Programmer16

tile-based heightmap idea

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

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)?

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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;


Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!