Height Terrain or Tiles

Started by
8 comments, last by Jiia 21 years, 7 months ago
I've been trying to figure out ways to create "height maps" for my medieval side scroller, so I can have really cool hills. In the process, I accidently created some really weird effects. With a little creativity, you could probably create some really neat looking forests or neon crystal castles. Check it out, it's only 56kb. Slowly drag your mouse with the left mouse button down. Press Left or Right to change your brush shape. It runs in 320x240x32. http://www.geocities.com/jiiqs/Test.zip http://www.geocities.com/jiiqs/Test.gif (snap shot) By the way, does anyone have any good pointers for creating height maps for 2D games? Thanks, Jiia [edited by - Jiia on August 31, 2002 11:37:41 PM]
Advertisement
Spiffy!
If it is a 2d side scroller(linear), why not generate it algorythmically?(sp?)(is that even a word?) Create an array equal to your target screen width (640X480, you would of course use 640) and then fill it with Random Numbers limited to a maximum target height. Then iterate through your array and assign the Y coordinate the value of of the item, offset one pixel and repeat. i guess to do a regular landscape(on the ground if you will, you would actually take the inverse product of the random number so it would be **pseudocode** 480 - (Random * 480 + 1) step (onepixel) loop.

**edit** you would probably want to average the product so it's not hideously jagged and really should either limit the valid derivation from pixel to pixel, or group a subset of the array and do a median value so the hills would be rolling instead of like stalagtites.


Dreddnafious Maelstrom

"If i saw farther, it was because I stood on the shoulders of giants."

Sir Isaac Newton

[edited by - Dreddnafious Maelstrom on August 30, 2002 5:13:41 PM]
"Let Us Now Try Liberty"-- Frederick Bastiat
My game is currently using tiles of 32x16. The tiles (and other graphics) are at a 45 degree angle (there is a Z, simular to Final Fight), and can have heights, but are all flat surfaces. I've set up a lot of routines like climbing and such, but a medieval game like this is just not going to work without hills. Do you think it would be difficult to mix landscape with the tiles? I've figured out ways to lay a texture over the height pixels in the program above (it's not included in that one though), and added brightness so that it gets slightly brighter as it gets higher, and it looks really cool.

I was thinking about creating height sections, each one for a certain type of hill section, then generating a tile image by using the same texture technique (because the texture technique is pretty slow). But creating the cut-out sections of hills to fit tiles sounds pretty rough. On the other hand, if I just make the entire map one big landscape, my texture trick will melt my framerate. I'm kind of lossed.

Thanks much for the help, Maelstrom

[edited by - Jiia on August 30, 2002 10:13:45 PM]
quote:Original post by Jiia
My game is currently using tiles of 32x16. The tiles (and other graphics) are at a 45 degree angle (there is a Z, simular to Final Fight)


This is called Isometric. And there''s a forum for it, I believe.
I''ve done a similar thing 2 years ago...
source code is also available on flipcode
http://www.flipcode.com/iotd/02-01-2001.jpg
It's not isometric. Or at least it's not diamond tiles. Either way, I'm not asking isometric questions. Like I said, the view is simular to Final Fight, or Tekken Force. The camera is on the exact right, but raised 'up' 45 degrees. But characters walk on the entire tile, meaning 32x16 pixels of 32x32 points to walk on (with z cut in half to create the perspective). But the tiles can also have heights, meaning it has more pixels below it to push the 32x16 part into the air.

noVum -> Is that tiles based? That's exactly what I'm trying to do, just with a closer look at the landscape, and very action oriented characters. My characters will be jumping and flipping and climbing and beating and cutting the crap out of each other at any given moment. So there are a lot details that RTS or such engines would not need to worry about.

I'm still curious as to how big of a pain it will be to add a grayscale height map to the top surface of each tile. And not only add it, but how difficult it would be to use it. I guess I can only try and see.

Thanks again,
Jiia

[edited by - Jiia on August 31, 2002 10:47:43 AM]
It shouldn''t be too bad... I would think all you have to do is have a greyscale hight map, and when you draw the characters, you just check the map at the character''s spot, and raise or lower it by that amount... or I could be wrong... I dunno...
Well I hope you''re not wrong, because that was my plan from the start, and I''ll be failing soon if you are

Seriously though, I''ve been thinking about doing some crazy stuff. Like making the entire map one big height map, then generating a big memory hogging texture over it. I''m starting to think the dramatic effect of it could be worth it, if I add all of the little tricks that would be possible: like someone rolling down a hill if they fall, or someone ramming into a cliff so hard that the edge gives out and chunks of earth fall on top of them. Even magic spells causing crators in the ground, or fires that could burn a pile of flamable junk to flatten it. I would only need to regenerate the terrian texture in specific sections when the landscape changes.

What do you think? Would the memory be too much for it?
I''ve been recoding some datafile routines, but I will try this all out soon.

Thanks again for the replies.
Jiia
I''m pretty sure (if I understand what you''re trying to do) all you have to do is raise each tile by a certain amount when drawing it based on it''s height attribute. Of course, you''ll probably want some sort of ''cliff data'' to draw in the visual gap that this would produce.

This topic is closed to new replies.

Advertisement