CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.32k stars 4.14k forks source link

New bridge terrain that allows boats. #25372

Closed tinukedaya closed 5 years ago

tinukedaya commented 6 years ago

Expected behavior

Boats are able to pass bridges to other side.

Actual behavior

There is no way thru the bridge for boats.

Suggestion: When reading thru the awesome project of @mlangsdorf , the Extended Vehicle Tune-Up I thought I'm going to share one workaround and possible short term solution for one of the points.

It was also mentioned in the comment here.

What I always do when playing a character that uses boats, I edit the terrain of on part of the bridge to shallow water. And RPing it as going bellow the bridge. That way the boat can pass as well as any vehicle/character who might want to use the bridge.

So a possible short-term workaround solution for this is to add Bridge Road terrain, that looks-like normal road but has the properties of shallow water.

The only problem I see with this is that fish can now be on the bridge... :/

Qrox commented 6 years ago

It will probably also cause boats to crash into land vehicles on the bridge... I think with z-levels enabled we can do it by adding multi-level bridges that have spaces below for boats to pass, while calling the old bridges too low to allow any boat through.

tinukedaya commented 6 years ago

It will probably also cause boats to crash into land vehicles on the bridge..

That is indeed the case and additional problem. The Z-Levels are indeed the ideal solution, but as I understand, that is quite a long-term issue. While this is not ideal it might work in the short term, before proper vehicle transfer between z-levels is solved.

Qrox commented 6 years ago

Yeah, I only realized after posting that vehicles cannot move between different z-levels at the moment. Another solution would be making rivers one z-level below the river bank, so cars can go through bridges and boats can go through them one z-level below. (And to think of it, most rivers I've seen in cities are indeed way below the river banks!)

Regularitee commented 6 years ago

Wouldn't an easier solution be to either flag every tile in a bridge region with a [BRIDGE] flag or something, and allow boats to travel through them like water? Or possibly create a unique, alternative terrain types with said flag to be used on bridges when they spawn?

It's certainly not as elegant as a Z-level solution, but I think it would be ideal to have a good solution that can be applied now, rather than a great solution that is years away.

tinukedaya commented 6 years ago

Wouldn't an easier solution be to either flag every tile in a bridge region with a [BRIDGE] flag or something, and allow boats to travel through them like water?

This! Better what I had in mind, because it'll solve the fish problem. There will still be the issue of boats colliding with vehicles on the bridge... Not sure that could be just waved away in favor of passable bridges...

Regularitee commented 6 years ago

Not sure that could be just waved away in favor of passable bridges...

Right now boats are functionally useless for long-distance travel because bridges cap their travel distance along bodies of water. I'd say it's magnitudes better to have boats that can be used to travel (especially non-inflatable boats), than the alternative.

Plus, it's not like collision with land vehicles is any more immersion-breaking than collision with bridges.

Endovior commented 6 years ago

I don't see a 'correct' fix for this happening before Z-levels are properly implemented, given that cars and zombies on bridges shouldn't be existing on the same level as boats and fish in the river. Ideally, the bridge should stay on the main Z-level, and the water should be a Z-level below that (with possible deeper water below that, Dwarf Fortress style)... but doing so under the current implementation would cause problems.

Instead, I'd suggest that boats and similar water-based features should be deprioritized for the time being. It might be possible to hack together a solution that lets boats pass over bridges (ramming anything on the bridge), but that'd have to get thrown out once a real solution came along.

mlangsdorf commented 6 years ago

Boats are way down on the priority list, because there are lots of other issues that need to be solved before a good solution for boats can be implemented. I'm frustrated by that - I liked my character who had a river boat - but I only have so much development time.

tinukedaya commented 6 years ago

Yep. I know there are other more pressing issues, that is why I made this issue, because it might give a quick and easy short-term solution to one of the most restricting issues of boat usage (at least for me). Sadly I have no idea how could the flag be implemented, otherwise I would try it myself. :(

sfsworms commented 6 years ago

Could this hacky solution fit in the boat mod?

Regularitee commented 6 years ago

Instead, I'd suggest that boats and similar water-based features should be deprioritized for the time being. It might be possible to hack together a solution that lets boats pass over bridges (ramming anything on the bridge), but that'd have to get thrown out once a real solution came along.

Is it really necessary to shelve an entire facet of the game because it cannot be implemented perfectly from the start? I mean, look at how many vehicle engine/fuel overhauls there have been. Should we remove vehicles until they're finally worked? Or how about farming, or NPC camps?

It's by far better to have a working, imperfect system than it is not to have a system at all. Otherwise half the game's content wouldn't exist. Letting boats traverse bridge terrain will at least make boats functional as a means of transport.

mlangsdorf commented 6 years ago

Boats have other issues, but if you want to make a hacky fix inside of the Boats mod, I won't object unless it's too awful.

FulcrumA commented 6 years ago

This! Better what I had in mind, because it'll solve the fish problem. There will still be the issue of boats colliding with vehicles on the bridge... Not sure that could be just waved away in favor of passable bridges...

If we talk about hacky way of doing this, maybe regular vehicles, items and creatures on the bridge tile could also be phased through? Making the bridge set vehicles coming at least partially (some tiles on the ground) from the land as "on the bridge" while letting the vehicles not coming onto a bridg efrom solid land as going under the bridge.

Still, it's something that's so makeshift that's likely to bite us in our butts down the development, so I'd be all for temporarily have it shelved till we have everything fixed so swimming under the bridge can be done right.

mlangsdorf commented 6 years ago

It is just barely possible (maybe) to make bridge tiles into "water" tiles without having also making them impassible for cars. That's a very qualified maybe because I haven't dug much into the relevant code and it might turn out to be really hard.

It is not possible, as a hack, to detect that a collision is occurring between a boat in the pseudo-water bridge tile and a car on that same bridge tile and then have that collision not occur. That would require a lot of changes to the collision code including a redefinition of the concept that two vehicle parts in the structure location can't share the same global triple point. If you know how to make that happen, there are a lot of other things that could be enabled other than a hack for boats.

Finally, such a hack would be buggy as heck and would cause all kinds of strange issues. What happens when a car is partially in the water next to the bridge and partially on the bridge? Does a boat moving through the bridge tiles phase through the car while it's on the bridge and then collide in the water tiles? And other wackiness.

For bridges to function gracefully, vehicles need to be able to transition Z-levels. Throwing in a bunch of hacks to work around that fundamental constraint is not a good solution.

mlangsdorf commented 6 years ago

Alternate proposal:

  1. define deep water as Z-level -1. Shallow water stays at Z-level 0.
  2. while in water, vehicles with FLOAT are at Z-level 0 as long as at least 1 tile occupies shallow water, otherwise they're at z-level -1.
  3. bridges stay at z-level 0.
  4. structures that descend into the water are defined on multiple z-levels: a bridge would have roadtop at z-level 0, pylons at z-level -1, and a river bed at z-level -2.

You already can't see things in deep water, so having deep water be z-level -1 won't change much. swimmers are unaffected: there's already logic to let you dive into deep water, and that could handle the Z-level transition. the only issue might be that travelers in deep water at z-level -1 can't see stuff above them on z-level 0 but I hope that's a minor issue.

mapgen would need to be changed to put deep water at z level -1, and to make sure sewers don't cut rivers. vehicle movement code would need to check if FLOAT vehicles are in shallow water or not, but that's relatively isolated. swimming code would need to handle movement from shallow to deep water, but again, that's already handled, we'd just need to do things differently.

Other comments, ideas, suggestions, critiques?

tinukedaya commented 6 years ago

I don't know, but that would give me a feeling that the water surface is not straight. You can't drop to z-level -1 just because you are on deep water. The surface level (where you FLOAT) must be on the same z-level for both shallow and deep water.

Also I do not like the fact you would not see your surroundings while travelling on deep water.

Might not be original and maybe something like this was already discussed, but lets throw it in anyway since you basically talk about vehicle transitioning z-levels now...

image

What if the bridges are made like this ^

The red part being the "transitions" area. Few (exact figure to be decided) tiles wide. Once the majority of the vehicle (or center of mass, or some kind of middle point) reaches this area it will go up or down a level. On the level 0 the transition area should be made inaccessible from other direction than the road.

sfsworms commented 6 years ago

So basically, it would need to do something to what mlangsdorf was proposing, but bumping normal vehicle up a z-level when on a bridge tile rather than bumping boat up a z-level when on shallow water.

The main downside to this is that until proper z-level transitions is achieved for vehicles, it's probably better to keep the hackiness to boats rather than force it on everyone to satisfy a mod.

tinukedaya commented 6 years ago

So basically, it would need to do something to what mlangsdorf was proposing, but bumping normal vehicle up a z-level when on a bridge tile rather than bumping boat up a z-level when on shallow water.

Yep, the opposite direction to what mlangsdorf is proposing. As I mentioned already, with his version the water surface feels uneven with deep water on Z-level -1. You kinda expect water to create a "flat" surface while bridges bow over water.

I mean it would be cool to have the deep water go into the -1 level, but things there should be under water no floating. But that is whole another story.

mlangsdorf commented 6 years ago

So there are reasons I proposed dropping boats a z-level instead of raising the bridge a z-level, which as you note is the more intuitive thing.

  1. CDDA has some support for z-level vision when looking down, but not much for z-level vision looking up. That means in the most common case for a boat, you can look down over the deep water and see any obstacles that you need to navigate around when you're entering deep water. On the other hand, when a car transitions up a z-level onto a bridge, there might be large wreckage that you suddenly see but don't have time to avoid. Yes, boats have the same issue when entering shallow water, but you'd expect a boat near shallow water to be moving slowly so hopefully less of an issue.
  2. Cars can be arbitrarily long, and while I don't want to go out of may way to support the people who build rolling mansions the size of the reality bubble, having a 7x15 vehicle isn't super crazy. It's really hard to set up a transition ramp that handles a 1x3 bicycle and a 7x15 super RV that doesn't feel deeply weird. Again, same issue happens with boats, but while some minority of players may use a boat, almost everyone is going to drive a vehicle across a bridge at some point. The other problem with transitioning on bridges is that what do you do about stationary vehicles on the bridge? A school bus straddling a transition zone is going to behave oddly: it needs to be partially on both levels to behave correctly.
  3. Water is open and spacious. Roads are narrow and crowded. Whatever issues that a forced Z-level transition are going to have, you're going to see them a lot with bridges and much less often with boats.

Like I said upthread, the correct solution to boats and bridges is proper Z-level bridge support and motor vehicles moving up ramps. But that's hard and isn't happening anytime soon. Putting deep water at z-level -1 is a somewhat unsatisfactory work-around, but it's a work-around that could be implemented before the end of the year. So the question is which unsatisfactory solution do you prefer: a not-great hack soon, or a better solution at some unknown future date but not within 6 months?

tinukedaya commented 6 years ago

Ad 1: I do not se this as an issue. You just have to drive up carefully. Afterall... it's cataclysm... Speeding onto a bridge it good recipe how to die... It can be made a little easy on players by disallowing vehicle spawn in the overlapping transition area so that your vehicle does not spawn INTO the one on top. If you crash into it, because you won't manage to brake... Not an issue.

Ad 2: thats why I was thinking about the overlap for the transitioning area. Make the area 8 tiles long, vehicle change level when midpoint enters the area and your 7x15 mobile house will spawn on other level gracefully.

Ad 3: Agree completelly.

If hacky would be the one to go, i'd say go with my original proposal, but keep it in the boats mod. Even if the boats would ram into vehicles on the bridge. You can just explain that it's a bug caused by engine limitations.

But driving my boat at -1 level, having a feeling that river surface looks like bowl -___- and not see what is on the river bank... I would never use a boat again.

mlangsdorf commented 6 years ago

There is no way to do a hack of this magnitude and keep it within the boats mod. It's going to require fundamental C++ changes that will spill over onto everything.

Let's get some pictures. First, the current situation. bridgebase Very unsatisfactory, the bridge blocks boat movement. The two pieces of ammo show the bridge transition zone.

Naive implementation of deep water at z-level -1 bridgewaterlownaive Unsatisfactory. Boats can move under the bridge, but you can't see land.

Smart implementation of deep water at at z-level -1 Kevin suggested that it would be possible to edit the vision code to detect if the player was a passenger on a boat (which is an easy change), then vision would include z-level 0 for all z-level 0 that didn't have deep water at z-level -1. He seemed to think that was also doable, I don't know. bridgewaterlowsmart

Bridge transition zones, seen from off the bridge. bridgebridgehighz0 Some idiot parked the APC on the edge of the zone, you can't see it on z-level 0.

Bridge transition zones, seen from the bridge (apologies for the crude stipling effect but there's a limit to how long I want to spend on this) bridgebridgehighz1 Now you can see the APC, but if you were approaching the bridge from the north at any speed, you suddenly rammed the APC when you transitioned to z-level 1.

The game engine currently doesn't support a single item having two different z-levels, so the APC needs to either be on z-level 0 or z-level 1. Changing the definition of a tripoint would be huge and buggy, so that's not going to happen.

Again, I don't think that deep water at z-level -1 is a particularly good solution. I do think it's an achievable short term solution, and it's fairly tolerable if Kevin can do the vision trick.

tinukedaya commented 6 years ago

I can definitely see the point with the APC parked in the transition zone. And even tho' the Idiot who parked it there would have been me, I would be pissed if I rammed into it with other vehicle.

From the above pictures Z-level -1 along with the vision trick would be the supreme solution indeed. Player would probably never notice he's on other z-level, so the weird surface perception will be gone. Perfectly acceptable. Without the trick, it's a no-go.

BUT... if it would be possible to amend the vision code this way... Maybe it would be possible the other way too. Lets say the water surface stays on z-level 0. Bridge is pushed to z-level +1 and gets a BRIDGE flag (or gets other recognition). If the player is on land, the code will also display tiles from z-level +1 with the BRIDGE flag. If he's on water, only z-level 0 is shown. Than you will see that damn APC, when approaching it from land.

kevingranade commented 6 years ago

The difference between the two approaches is lowering deep water z-level only applies to river mapgen and boats.

Whereas elevating bridges impacts bridge mapgen, vision any time you're near a bridge, driving on bridges, walking on bridges, monsters, and npcs, etc.

tinukedaya commented 6 years ago

Yeah I thought it might get a bit more complex the other way around...

As I said above... That "z-level -1 + magic" trick would work perfectly fine!

Human-Shield commented 6 years ago

Could -1 level rivers connect with -1 level sewers? That would be cool to sneak into big cities through the sewer drain on the river.

Players have also used sewer boats, but maybe vision tweak is deep water only.

mlangsdorf commented 6 years ago

yeah, the vision hack would be if you're passenger in a vehicle and the vehicle is in deep water at z-level -1. It wouldn't apply if you're not in a vehicle, if you're not over deep water, or if the deep water is not at z-level -1 (so if you test your boat in a swimming pool or whatever). It's a very targeted hack.

mlangsdorf commented 5 years ago

To heck with it, implementing amphibious vehicles turned out to be easier. See #27251.

mlangsdorf commented 5 years ago

Closing the issue because amphibious vehicles are a thing and let you move your river vehicle around bridges.

tinukedaya commented 5 years ago

I still think this should happen. Not only for immersion. But not to force players to make amphibious vehicles if they just want boat.

kevingranade commented 5 years ago

I agree, there's a workaround, but the inability to navigate a boat under a river is still a missing feature.