More on terrain generation
Wastrl » Devlog
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.
- Start with some FBM noise (heightmap_add_fbm).
- 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.
- 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).
- Smooth the map with some averaging (heightmap_kernel_transform) and then simulating erosion (heightmap_rain_erosion).
- Assign basic terrain of water/flat/mountains based on heights.
- 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.
- Make some guaranteed paths from start to end: Pathfind from start to end through some random midpoints, removing mountains and water on the way.
- Add cities at random points.
- Add patchy roads between random cities.
Get Wastrl
Wastrl
A 7 day roguelike for 7DRL 2018
Status | Released |
Author | theq629 |
Genre | Strategy |
Tags | Roguelike, Turn-based Strategy |
More posts
- 7DRL Day 7 qualified successMar 11, 2018
- 7DRL Day 6Mar 10, 2018
- 7DRL Day 5Mar 09, 2018
- 7DRL Day 4Mar 08, 2018
- 7DRL Day 3Mar 07, 2018
- 7DRL Day 2Mar 06, 2018
- 7DRL Day 1Mar 05, 2018
Leave a comment
Log in with itch.io to leave a comment.