More on terrain generation

The map needs to be long on the horizontal axis, and have mountain ranges that cut across laterally to restrict the player's movement. Mapgen works by creating an initial hightmap so we can use libtcod's convenient heightmap functions, and then assigning terrain based on that. Some details are from memory of what I started on for 7DRL last year, but the basic terrain generation is quite different.

  1. Start with some FBM noise (heightmap_add_fbm).
  2. Carve mountain ranges: Choose equally spaced x-axis positions for the ranges. For each, path find from the top of the map to the bottom over the existing noise height to make a spine that cuts roughly vertically across the map. Go along the spine path, generating circular hills (heightmap_dig_hill) at random x-offsets from the spine. Hill radius is larger closer to the spine.
  3. Carve lake basins: Similar to mountain ranges, but as a spine we choose two points close to each other and pathfind between them, and we dig out circular pits (heightmap_dig_hill).
  4. Smooth the map with some averaging (heightmap_kernel_transform) and then simulating erosion (heightmap_rain_erosion).
  5. Assign basic terrain of water/flat/mountains based on heights.
  6. Add river terrain: Pathfind from lake basin pit centres to random points. Draw water along path, stopping on various conditions for plausibility. To avoid circular rivers, do pathfinding on a copy of of the hightmap and add hills along rivers as we make them.
  7. Make some guaranteed paths from start to end: Pathfind from start to end through some random midpoints, removing mountains and water on the way.
  8. Add cities at random points.
  9. Add patchy roads between random cities.

Get Wastrl

Leave a comment

Log in with your account to leave a comment.