Sign in to follow this  
  • entries
    67
  • comments
    89
  • views
    51527

Elaborate?

Sign in to follow this  
LachlanL

305 views

Directed Randomness


Okay, so as I mentioned previously, I'm using the diamond-square algorithm (similar to "midpoint displacement") to generate the terrain heightfield. Instead of starting with a single square and subdividing as needed, I start with a "seed" field of whatever dimensions I desire. I then perform diamond-square as many times as needed to get the desired level of detail. Currently I just have the seed field being randomly-generated, but what I plan to do is allow the user of my editor to set those heights so they can have control over the rough layout of the map. If further control is needed, they can edit some of the values further down the iteration chain. Here's a pic of one three-iteration run (the seed values are iterated three times):

Here I started with 20 x 20 cells (21 x 21 height values) and finished with 160 x 160. Note that the map does not need to be square in shape. The amplitude and falloff of amplitude of the random values can be set by the user. I can imagine that I'll be doing lots of tweaking these values to get the desired result.

Next on the list is to generate and display the heightfield in 3D. Shouldn't be too difficult. SlimDX has been quite nice to use so far, btw. [smile]
Sign in to follow this  


2 Comments


Recommended Comments

Looks pretty interesting. Have you considered adding different techniques to your tool - i.e. perlin, fBm and so on?

It would be cool to see a screen shot of the interface as well if you want to throw one up there. I'm always interested in seeing how others approach the whole 'useability' issue.

Keep up the good work!

Share this comment


Link to comment
Hey Jason. Yeah, I originally considered using libnoise for my terrain generation, but it's a cpp library and I wanted more control over the layout of my maps. I could add more techniques, but I'd probably only bother doing that if diamond-square doesn't give me the results I'm after. This is meant to be a level-editor for a game after all, not a general heightmap editor.

As for the UI, one does not exist yet. The image is just a collage of bitmaps that I output from my program for debugging purposes. Just to check that the algorithm is working correctly. However, the editor functionality is next of my list of "things to do".

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now