Jump to content

3 Screenshots

About This File

Several years ago I wrote a terrain generator for SimCity 3000. It was later used to create terrains for Auran Trainz simulator. The code was never part of either of these software packages, but users could save the grey-scale output from my program and import it as terrain inside these other programs.

 

Internally, the program uses a random mid-point displacement algorithm to generate the grey-scale bitmap you see in the middle of the program. A color-map bitmap in the same folder acts as a palette to render the grey-scale bitmap to the right-hand side of the program. The right-hand map is what you should save for your adventures. The size of bitmap (in pixels) is always a power of 2, plus 1. It's not multi-threaded, so the larger the output, the longer you wait.

 

You can do whatever you want with the color output in any graphics editor. You can add cities, hide-outs, political boundaries, rivers, points of interest, and label the seas, bays, mountain ranges, beaches, and forests, all with simple graphic editing programs like Microsoft Paint.




User Feedback

Recommended Comments

I no longer have the code, but it was last written in Delphi 7.  The algorithm is fractal in nature, using Brownian motion calculations, and uses recursion.  The output of the file has to have dimensions which are a power of 2, plus 1.  The first time through the function, the "altitudes" of the main 9 points are calculated.  The main 9 are upper-left, upper-center, upper-right, left-center, center, right-center, lower-left, lower-center, and lower-right.  The map is then divided into four quadrants and each of those is sent into the recursive function.  The function randomly calculates the "altitudes" of any unassigned points of the main 9 within the quadrant.  The recursive function divides the quadrant into four smaller quadrants, and once again sends those into the recursive algorithm.  The further away two points are, the larger the variance in "altitude" at the midpoints.  At the smallest level, a 9-pixel box is submitted to the algorithm.  Since there is no more to subdivide, the function exits.  It did not use threads, so it's kind of slow, but computers are getting faster.  The "altitude" is a value between 1 and 255, I believe, which is a color of grey.  A color map then maps these values into RGB values.  The download includes sample color maps, which are customizeable and you can add more.

Share this comment


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...