Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I want to implement something like this to create a heightmap: 'Place a group of coordinates evenly across a map, and give them height values within a certain range. Repeatedly create coordinates between all of those coordinates, setting their height by deriving a value that was a mean value of all the surrounding coordinates.'

However, I'm not sure how I would go about it - I'm not sure how I could code the part where I place the coordinates in between the existing coordinates. Can anyone give any help/advice?

share|improve this question
1  
I can give you my own experience: gamedev.stackexchange.com/questions/12449/… –  Daniel Jun 25 '11 at 14:41
2  
That is literally the midpoint displacement algorithm. The other option is perlin noise. –  The Communist Duck Jun 25 '11 at 16:30

1 Answer 1

up vote 3 down vote accepted

Although it seems others also gave some answer (i don't know why in comments), here's my experience:

there is a physics simulation problem known as heat flow/heat equation. That link gives you the whole idea about what you are going to simulate in that problem. and there are many ways to create an optimized version of that simulation (just need a little google search). In my experience if you just give a constance heat value to some points and then leave the surface to rest for a while, you can get a very good height map based on the temperature of each point (just set each point height as it's temperature). There also some algorithm that generate the final result directly from the input values, but in your case I wouldn't recommend them unless you want to generate maps runtime. there are also some algorithms that gives you the ability to modify normal heat flow to get more complex heightmaps with less effort.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.