-
Notifications
You must be signed in to change notification settings - Fork 172
WIP: Allow bridgeable water type that is both swimmable and walkable #6900
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
base: master
Are you sure you want to change the base?
Conversation
|
Assigned to |
|
I reused the original water animation frames, but reordered them to give the back and forth look. If accepted, I'd consider swapping the 2 for all climates to match the intended uses better: unwalkable water for large water bodies with standing waves, and bridgeable water with flowing look for rivers. |
|
I forgot the glitch that waterways should not be allowed to connect to flags in the middle of bridgeable water. |
|
While the idea seems interesting in principle, I'm not sold on whether this is not too much a stretch on realism. Especially if walkers are allowed to walk on nodes not directly connected by an actual bridge. Several tribes' ships are pretty large and appear to require a certain amount of water under their keel, so I question whether the depth of the water required for the ships to safely pass doesn't altogether exceed the depth of what workers can comfortably (or at least safely) walk in. A quick search claimed that 1.5 to 3 meters is a reasonable estimate for a medieval tradeship's flotation depth. For context, in my homeland Northern Frisia it used to be very common for people to drown while trying to walk or ride from one island to another, which is possible under good conditions across tideways that are also sailable. (These days, they are usually rescued by helicopter, and this happens quite frequently actually, but unfortunately help does not always arrive in time.) So in my personal experience the idea of walking on foot across terrain where small ships can also sail is connoted as extremely unsafe unless you have an experienced local guide and fair weather and an accurate tide calendar and set out at just the right time of day; and even then, the definition of "walkable" includes fording hip-deep tideways (while watching out for any ships that might cross your path); and naturally walking through deep water is very slow, even when you avoid getting stuck entirely in the invisible mudholes. So, while I accept that a small ferry can share a coastal area with workers, I am not convinced that workers can walk where full-size ships can sail. What depth would you say the water has, and what the ships would at least require? If the walkability is restricted to bridges only, this does not really simplify things, since the point remains that each bridge segment is just one edge long with the nodes as connector points, where the workers still have to ford a channel of deep water. And how can the broad ships fit through these extremely narrow straights between two directly adjacent bridge segments? Widelands is not always highly realistic, but to me this sounds like a too-major suspension of disbelief. However, I think this feature would be a superb addition for map design, and I am quite open to being convinced that this is not as unrealistic as it at first impression appears to me :) |
|
Well, I take it as you want me to do it the other way:
That's fine. Although I have to throw out most of what I've written so far, but that's not a problem as writing it helped me understand a lot about these parts, that will help implementing the new terrain type. The only thing I'm afraid of is that it very likely needs extra code in the AI... |
|
I was able to reproduce the bug with the carrier not being able to occupy the bridge, but it's not always repeatable, so there's some special condition that triggers it. When I just replicated your setup with the flag in the middle of the water, my carrier got there without a problem and the stonecutter was able to reach the other side despite the missing last segment. (so your stonecutter's problem was very likely the same) However, later when I built a shortcut parallel to an existing bridge, it got stuck, but when I removed and rebuilt it at the exact same place, it worked. That waterways cannot connect to the middle of bridges is by design because it doesn't make sense to me. But I'm not strongly attached to that decision if it's voted down, and it actually required extra code to prevent. I guess there's a real-world example for something similar though: A pier extending into the water with the ferry stop at the end. So yes, you could then create a map with some water body that's wider than the ferry range, and with some bridgeable water to narrow it down to the ferry range... but that's a rather special case and most players wouldn't recognise it, so I'd consider it a dirty trick... |
|
Sorry, forgot about the lost carrier in the middle of water: Indeed, that's a bug I didn't think about, and it's probably quite tricky to solve properly... the easiest solution seems to be a new |
|
I am still not convinced that this pr provides a good approach to solve "bridgeable rivers". In theory one can just connect Europe with Amerika with bridges, e.g by accidentally (or on purpose) using the wrong water terrain 😄 A river is two, three, max. four nodes wide, in widelands terms, imho. It shouldn't be possible to span more than this with a bridge, or several bridges, imho. I would prefer something like a "big bridge" which spans those two or three nodes. The visual glitch with ships crossing will still remain, though. But i am not a c++ developer and unfamiliar with the road mechanics. So i can't judge how difficult it will be to implement something like that. |
|
I tested the lost carrier issue, and it's like the unable to occupy issue: normally it just works (I actually didn't expect it), but sometimes he gets stuck. It'll be real fun to debug both... :/ I've found an inconsistency with waterways: it is possible to start from a flag in the middle of water, just not to finish at such a node. I'll have to fix that. (or just allow waterways to connect to bridges or not allow flags on bridgeable water at all) Re width of bridgeable water: I think we can leave it to the map designers to use it responsibly. After all it's already possible to create bad maps with the existing terrain types. |
|
I decided to not allow flags after all. There are much fewer problem cases, so the code is much simpler. And I made nice graphics too that I get to use this way... 😄 The bugs should be fixed. I hope there are no regressions... |
|
BTW, here are the sources for the graphics. (the terrain type icon is its own source, I did it by hand, pixel by pixel) |
|
And some screenshots: |
|
Two remarks:
|
|
We have working 3D models of the bridges, so I can try making them longer/bigger. There's one possible problem though: the apparent height of bridge segments along their length is hardcoded in the worker movement code, so it may not look right with the bigger bridges. The other option is to add some more flat padding at the ends (or update the code too). I was able to reproduce the slowdown with your save. Then I tried in a new game without bridgeable water, and there I couldn't reproduce it, neither with master, nor with this branch. I'll investigate it.
Thank you! :) |
|
I've investigated the slowdown. It happens with master too. (you can test with the above attached savegame by creating a new normal water terrain with the name It is caused by the enemy sentries on the other side of the river, which are close in direct map distance, but are too far in walking distance:
IOW in about every 3rd clock tick most invasion soldiers spend a lot of time doing expensive calculations that normally should only be done once. The time of route calculations is about the same with master and this branch, though it doesn't mean much because only one bridgeable node is present in the affected area. |
Created on Sun Oct 19 12:29:52 CEST 2025 by Tóth András (tothxa)
Type of Change
New feature
Issue(s) Closed
https://www.widelands.org/forum/post/43680/
Re: #2020
Fixes: #5853
New Behavior
It is possible to create areas where both ships and workers can pass. This allows navigable rivers that don't separate the land, as well as straits between large water bodies where land crossing is possible without blocking ship traffic. (just 2 sides of the same coin actually :)
How it Works
The new
is=bridgeableterrain type is bothkWaterand new typekBridgeable, which allows building roads and becomes walkable where there is a road.Possible Regressions
Pathfinding, road building
Screenshots
oops, should've created some... coming soon
Additional context
Currently flags can be placed anywhere on bridgeable water, and thus bridges can join and cross each other, because that happens IRL too, and because I liked it this way.
If the consensus is that they shouldn't be allowed, then we also have to decide whether to: