New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Wide rivers #9628
Feature: Wide rivers #9628
Conversation
7e53db1
to
f94d105
Compare
Fixed pointer format to follow code style, since apparently my VS2019 has been configured to auto-correct it to the wrong format for months... 😕 |
f94d105
to
38146ef
Compare
I like this idea in principle, even if somebody™️ will declare it the end of the world. One thing that sometimes looks a bit ugly is the way larger rivers meet the coast due to the fact that river tiles can't be on all slopes. I've seen it quite often that the final tile on the coast is just one tile wide due to the slopes. Ideally, some spot terraforming could create a proper wider slope. Code wise it looks fine. One could remove the globals in favour of using the AyStar user data (like e.g. https://gist.github.com/michicc/91ac9d01052605150e6d31ba781ff01d), but this is definitely a bikeshed thing. |
I'll see if I can figure out some slope terraforming. |
Thanks for the gist; I've adopted it and also added slope terraforming. Everyone: please try and break this! I've generated and inspected a lot of maps and haven't seen any graphical glitches, but earlier versions of my terraforming did undermine river tiles without deleting the water, leading to holes in the world like this: |
Marked as draft due to these bugs reported on Discord: It appears that the sloped tile had 3/4 corners raised and was terraformed to a slope, undermining the glitched tile which had previously been a flat tile river. This line should prevent this, but clearly it has not. In fact, I think this line isn't working properly at all, since almost every slope has a flat river tile adjacent — this is an error in my logic which has been bypassed by my code not working... Any insights into what I'm missing? Something about water class, perhaps? |
@2TallTyler In River_FoundEndNode you are interleaving calls to MakeRiver along the tiles found by the A-star path with calls to RiverMakeWider which modify the landscape. This is likely to result in your found river path no longer having tiles of the correct slope. Also, as written widening won't be done where the path is shared with an existing narrower river. |
Thanks for the insight. It took me a while to understand what you meant, but that (and a fix for the broken line of code mentioned above) seems to have solved the issue. Additional testing appreciated! |
Needs a rebase. |
3ae9fdf
to
5352a33
Compare
You know, it would be better if an option is added instead of replacing. |
Motivation / Problem
Real-life rivers and watersheds are shaped like enormous trees: thin branches gathering together into a wide trunk which flows to the sea.
OpenTTD rivers often follow the same branching structure, but don't get any wider.
Description
This started as a JGRPP patch by @VacuumBreather (a.k.a. Lt. Joker).
It makes 10% of rivers longer and has them get wider as they get further from the source.
I added Doxygen, changed some code style items and added terraforming to keep rivers wide as they flow down slopes.
Limitations
I've tested map generation pretty thoroughly for odd generation or possible terraforming under existing water tiles (which is pretty glitchy) but it's possible I could have missed a corner case.
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.