Reworked lake shore mapgen for better connection with rivers #3275
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: Bugfixes "Reworked lake shore mapgen for better connection with rivers"
Purpose of change
Fixes #3185. More pics below.
Describe the solution
Original mapgen shrinks away from lakes, and then tries to adjust shore points when it see familiar patterns. Due to their amount covering of all possibly layout it's very difficult tasks.
New mapgen works differently - it doesn't care that much about lakes, instead it looks for precise positions of junctions, and attach shores to them.
This approach have its pros and cons. I always know where shoreline should be connected. But determining how to connect them between each others it's a bit more difficult task, which... i didn't solved. Currently it connect two closest valid points, it works well, but can break apart 3-way conjunction which could been connected if done right(first two pics below illustrates that, connected junctions, and disconnected). It looks tidy, no cut edges, but never the less that's wrong. Knowing all points i can tell myself where lines should ideally be after performing bunch of permutations in my head, but i didn't managed to algorithmize it(don't make me write 1000 lines of
if
's to cover all cases individually).Another issue is that overall coastline a bit more blocky. Not river-style blocky, but since it's mostly ignorant to lakes that removed one of sources of entropy.
At this point i'm running out of ideas how it can be improved, so suggestions are welcome.
Describe alternatives you've considered
I tried to make adjustment to old mapgen, but haven't got any significant result beyond fixing few layouts individually.
Another solution might be reworking place_lakes so it'll floodfill toward rivers more aggressively, washing out stray river tiles. But there still should be a river\lake border somewhere.
Testing
Teleported around, looking at mapgen.
Additional context
Left ones are original mapgen, right ones - reworked. Overmap layout is exactly same.





