generate lock-friendly rivers patch

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
xarick
Transport Coordinator
Transport Coordinator
Posts: 336
Joined: 26 Feb 2015 00:52

generate lock-friendly rivers patch

Post by xarick »

This patch is intended to ease water construction, especially locks on rivers. The changes might be too subtle to notice, but I think they're helpful if you're familiar to the constraints of water-based transportation inland.

With this patch applied, and while on map generation, rivers are generated in a way that facilitate construction of locks on river rapids. It assures that the river source can be connected to its mouth, without the need to terraform land for locks. The player only needs to place locks on rapid tiles to connect each lock to the rest of the stream. In this manner, as long as ships can make 90 degree turns, ships can traverse the entire river.

Other features:
- Towns will not build bridges over rivers if a lock could be built under it, while growing during a game and/or during map generation.
- Town growth will not block ship paths, by denying them to grow on tiles where ships could traverse. see viewtopic.php?p=1176101#p1176101

v7
download here: viewtopic.php?p=1202268#p1202268

screenshot valid for v6:
Image

screenshot valid for v5:
Image

screenshot valid for v5:
Image
[+] Spoiler
Older versions (v4, v3, v2, v1):
v4
Also made towns generate lock-friendly bridges over rivers on new game creation or while growing during game.

Screenshot valid for v4, v3, v2:
Image


v3
Not posted.
generate lock-friendly rivers v2 r27826.patch
(4.59 KiB) Downloaded 128 times
v2
On this version, the rivers are wider which means, in contrast with v1, it is no longer needed to build canal tiles. All that is needed is building locks on the correct inclined slopes.
generate lock-friendly rivers v1 r27816.patch
(2.3 KiB) Downloaded 122 times
v1
With this patch applied, and while on map generation, rivers are generated in a way that facilitate construction of locks on river rapids. It assures that the river source can be connected to its mouth, without the need to terraform land for locks. The player only needs to place locks on rapid tiles and occasionaly a few canal tiles (usually 1 or 2) to connect each lock to the rest of the stream. In this manner, as long as ships can make 90 degree turns, ships can traverse the entire river.
Screenshots valid for v1
Image
This is how the rivers became after starting a new game...

Image
Players just need to place a few locks and canal tiles to have the entire rivers traversable by ships. PS: I missed 3 locks in this image, can you spot where?
Last edited by xarick on 04 Feb 2018 14:31, edited 13 times in total.
Formerly known as Samu
LabUser
Engineer
Engineer
Posts: 38
Joined: 21 Feb 2016 12:10

Re: generate lock-friendly rivers patch

Post by LabUser »

That would be these ones(?):

Image
Attachments
Lock.png
(576.63 KiB) Not downloaded yet
User avatar
Pyoro
Tycoon
Tycoon
Posts: 2558
Joined: 17 Oct 2008 12:17
Location: Virgo Supercluster

Re: generate lock-friendly rivers patch

Post by Pyoro »

Hmmm, if going that far, have you considered creating it in such a way that those "tight curves" (that require extra canal tiles) are eliminated as well? Or is that too restrictive?
xarick
Transport Coordinator
Transport Coordinator
Posts: 336
Joined: 26 Feb 2015 00:52

Re: generate lock-friendly rivers patch

Post by xarick »

generate lock-friendly rivers v4 r27854.patch
(6.45 KiB) Downloaded 121 times
v4

Also made towns generate lock-friendly bridges over rivers on new game creation or while growing during game.
Formerly known as Samu
xarick
Transport Coordinator
Transport Coordinator
Posts: 336
Joined: 26 Feb 2015 00:52

Re: generate lock-friendly rivers patch

Post by xarick »

generate lock-friendly rivers v6 r27932.patch
(8.9 KiB) Downloaded 142 times
v6
- Be less strict with lock checking when towns are expanding roads with bridges: allow bridges parallel to locks with the same direction as the bridge, and allow bridge construction on suitable lock locations if it is not a location with water.

[+] Spoiler
previous version (v5)
generate lock-friendly rivers v5 r27932.patch
(8.33 KiB) Downloaded 139 times
v5
- Reverted fat rivers to thin rivers, akin to the original goal I had in mind on v1.
- The addition of river tiles is now done past river generation process, instead of being done while during river generation.
- Improved lock checking near the edges of the map, to allow more possible lock locations.
- Added more lock combinations for deciding whether the river can flow down.
- Prevent town growth from blocking ships
Formerly known as Samu
xarick
Transport Coordinator
Transport Coordinator
Posts: 336
Joined: 26 Feb 2015 00:52

Re: generate lock-friendly rivers patch

Post by xarick »

generate lock-friendly rivers v7 r27967.patch
(8.47 KiB) Downloaded 128 times
v7
- Fixed an issue which was preventing towns from attempting to grow with a road or bridge. Checking for traversable water tracks was being done too early in the code.
Formerly known as Samu
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 8 guests