Generating Exhumed River Channel

Nathaniel Inman walks through the exhumed river channel procedural content generation technique for random maps in 2d top-down video games.

Generating Exhumed River Channel

I recently did some work in generating rivers in a 2d game. Revisiting this work to create an exhumed river channel, I decided it might be fun to revisit how to generate it to make the channel look more realistic. Instead of using a drunken walker, this is a more expensive but interesting map generator:

  • Start by generating 2d simplex noise where
  • less <0.6 is floor
  • rest is walls
  • Generate terminal lines at each map exit (north, south, east, west). Shuffle those lines and randomly choose a start and end location for the river based on two of those lines.
    • Later you can add another line with terminal point to allow a split river channel
  • Using a* pathfinding, acquire the most optimal point between the terminal points. Fill the path with water while allowing the water to spill outwards randomly if the terrain allows it.
  • Turn all area too far away from water to wall
  • turn water into special dirt (exhumed river channel)
  • carve out area around water and set all non-special dirt to regular dirt in this area