Return-To-The-Roots / s25client

Return To The Roots (Settlers II(R) Clone)
http://www.rttr.info
GNU General Public License v2.0
476 stars 75 forks source link

Reduce size of free (green land) area for random maps #1530

Open vader1986 opened 2 years ago

vader1986 commented 2 years ago

It's been a while! I've been thinking about an improvement for the in-game random maps based on the feedback of my last PR (from last year or two years ago?). Hopefully, next year I'll have a bit free time I can spend on the project again :-)

So this is the issue I would like to attack: Currently (especially for larger maps) there's a lot of more or less empty space (green land with trees/granite piles) and some mountains around the centre of the map (depending on the type of map).

My idea how to improve this:

  1. Calculate distance to mountain or water (“inner land”)
  2. If highest value > CONST [minimum free green land to keep]
    • Add tile for highest value to queue
    • While collected tiles < CONST [tiles per mountain] * FUNC [decrease mountain size with increasing iterations] AND queue not empty
      • Collect tiles (via “brush”) around current tile
        • Distance to highest value tile
        • Distance to mountain or water
      • Add new tiles to collected tiles
      • Add new tiles to queue
    • Add collected tiles to new mountains list
    • Continue with 1.
  3. Apply height values to collected tiles in new mountains list

Let me know what you think! There's plenty of time to discuss before I start - intentionally ;)

vader1986 commented 2 years ago

The CONST values do not need to be real constants but could be random to add more variation to random maps.