Advertisement Jump to content
Sign in to follow this  

Diamond Square algorithm

This topic is 3822 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

So I've been looking all over the internet trying to find straightforward C code for the diamond square algorithm. I would settle for an explanation that goes into enough depth. Here's what I am trying to do. I have a height map of floats float heightMap[33][33]; I also have a boolean array bool mustBeZero[33][33]; I want to run the diamond square algorithm (also known as the midpoint displacement algorithm) where the height map at every true mustBeZero location is seeded to zero (and thus zero will be used in averaging). Most of the code out there is unreadable, and the tutorial pages don't go into enough detail for me to follow through with my idea. Please help!

Share this post

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

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!