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.

This a a weird question.

I'm making a game in unity. I have a grid of columns and the height of the columns is changing (lerping) randomly (just cus it looks cool!) I was wondering could I procedurally generate some sort of 2d contour map, then each column would take its height from the contour map, that way nearby columns would be similar in height. Also how would I then get this contour map to fluctuate and change randomly?

If my grid of columns is 10x10 that means this contour map can also be just a 10x10 array with only 100 data points. Can anyone think of a cheap way of achieving something like this?

share|improve this question
3  
Welcome to gamedev.stackexchange. This site's format prefers that you attempt to create the thing you are describing, and ask a question if you are having a specific technical problem. It is discouraged to ask questions that essentially ask other people to write your code for you. So, edit your question to include what you have already tried. –  Seth Battin Apr 22 '13 at 1:18
add comment

1 Answer

up vote 0 down vote accepted

Overlay a grid on every n'th cell horizontally and vertically, and initially assign each of theses a random value. Interpolate the remaining cells to get the smoothness you are after. On every m'th cycle assign a new random height to each overlay cell, but migrate to it over the full m cycles.

A refinement would be to "roll" the timing of assigning new target heights across the map, one row (or column) at a time.

This should give you a nice smooth "rolling" effect for your terrain. By tuning the parameters a bit the effect would give your characters time to react to changes, while having to remain alert

share|improve this answer
add comment

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.