I’m fairly certain that teleporting it to the other side isn’t nearly “simple” to do codewise, but that’s actually probably the most intuitive implementation I’ve seen so far.
Can’t this be done by labelling bridges as passable (and possible to gain traction in) by watergoing vehicles?
Like, for regular vehicles, road is passable, so is grass etcetera, but water is no good for wheels, and for boats, it’s water.
So what if ‘bridge’ is added as valid for both? The car can drive over it but not into water, and the boat can drive under it but not follow it into land.
I’ve made a mod that does pretty much what Aabbcc said and tags the bridge tiles as shallow water. This is an ugly workaround and has the side effect of running over fish while driving your car.
Hmm, and I suppose a boat would be running over zombies on the bridge as well, which is not desirable.
A bit of code to differentiate between a boat driving underneath and a car over it would also need to handle zombies trying to attack the boat as it passes under, for example. Can they do that? can they jump on top of the boat?
There’s two ways I can see this being solved:
a lot of coded exeptions to make it behave correctly.
z-levels, either by effectively treating one or the other to be at a different z-level, or by just shoving bridges up 1 z-level and adding ‘ramps’ that allow vehicles to be driven a z-level up or down (which, incidentally, would allow for underground parking garages and multi-level parking lots).
The second option isn’t too different from being able to teleport the vehicle from one side of the bridge to the other, after all, it effectively does the same just on land. You still have to deal with making sure the vehicle fits and handling any collisions after teleporting, be it with terrain or critters.
I like it more than the bridge teleport option tho, since it allows quite a few nifty things, like the aforementioned underground parking, as well as fulfilling a request I’ve seen rolled around from time to time for the ability to move cargo between z-levels, not just by dragging/driving the cargo up the ramp, but once you have the code to teleport vehicles, implementing an elevator is not too far behind if you handle it like one.
You could also swim under bridges, or create ‘pillars’ for the bridge, or creating stairs to get up on the bridge from said pillar, even build your own dock right there under the bridge.
That’s a viable abstraction to grabbing some stairs or rope to climb up the bridge tho. Which, granted, could be handled better. I think the ‘driving over fish’ and ‘boating over zombies’ issues are more problematic.
what if boats treat the edge of bridges…like… a portal to the other side? So every tile that would “bump” the bridge instead moves to the other side as though there is no space inbetween the two sides of the bridge? In such a way that your boat can be half on one side and half on the other?
Wait… no thats seeming more complicated then just teleporting the whole thing to the other side now that I think about it. Though it should make not teleporting onto land easier? eh… no simple teleport or some hacky bridge is road, and (only for boats) water seems easier. especially If a no exiting the boat on bridge were implemented… still be boating over bridge zoms though ughh bad problem.
Driveable ramps would essentially be the same thing as my half baked idea, except involving z-levels, would have more veritility though…
Apart from the problem of implementing the vehicle being split like that, there’s the issue of enemies on the bridge while the vehicle is halfway through:
Ranged enemies would be able to attack into the inside of the vehicle, grabber zombies would be able to grab you from your seat ignoring your roof and walls, or just walk into your boat, etcetera.
Teleporting into land (or into a wall with ramps) is easy to check, just see if the vehicle fits. The implementation can go from easy (the vehicle crashes into the ramp as if it were a wall) to complicated (trying to emulate how it would crash on the other side) depending on how fancy you want to make it.
check if the vehicle fits, if it does, teleport, if it doesn’t, crash it.
Yeah, it seemed simpler in my head until I started to type it out, which is why I quickly dismissed the idea myself, but left it in for brainstorming material.
Ramps aren’t easy to implement: they’re basically teleporters and have all the issues of teleporters.
For instance, say you’ve got a security van (5 tiles wide, 7 tiles long) that you’re driving west at 20 mph on a road on the 0 z-level. Ahead of you is a bridge of the 1 z-level. The ramp is a line of N-S tiles that teleport the entirety of a vehicle that enters them from the east side such that the entirety of the vehicle is just past the west side of the matching ramp tiles on the bridge.
However, there’s also another security van 4 tiles west of the ramp on the bridge. How do your vehicle and the motorcycle interact? Naively putting your vehicle on the second security van is going to cause an immediate vehicle crash - and people are going to complain that they should have had time to stop. Stopping short of the second security van means half your vehicle is still on the ramp tiles - which does what? - and half of it is hanging in the air over the z-level.
There’s a bunch of interactions like that. Solutions for them need to be designed before ramps can be implemented, and a lot of the solutions are not obvious or cause additional interactions that are hard to solve, like grabbers suddenly being able to attack you because half your vehicle isn’t on the right z-level.
long term the hacky split in half vehichle on two different z levels is probably the most doable practical, and intuitive on a player level.
Short term, hacks like teleport the whole vehichle and is both water and road are the best ways to get around things, and make sections navigateable. These are just going to have to come with some kind of- look this is how it is for now, check ahead before you cross the threshold with a crashable vehicle.
tl;dr: ramps are a long term goal in my eyes, not something to just ‘pop’ into the game.
One way of handling this is implementing some sort of incoming crash warning message, which pops up on the message box if you’re going to crash, say, next turn.
There’s still issues, of course, like what happens when you enter from the wrong side, or what happens when you enter at an angle, or if the vehicle is too broad.
An elevator-like teleporter wouldn’t suffer from these problems, of course, since you can just enforce that the ‘elevator tiles’ only exist on one z-level at a time and just move everything in them when the elevator moves. Sadly, elevators wouldn’t really fit for bridges. Some parking garages, yes, regular buildings, yes, bridges or boats, no.
Vehicle portions being able to move up or down in z-levels is probably the option that best adapts to problems naturally. There’s still issues like entering from the wrong direction or grabbers that it doesn’t solve, tho the later are a problem the current vehicle system doesn’t solve when driving diagonally.
Why not do the same thing with z-level buildings for vehicle parking areas? Ignore the entire vehicle sticking partially outside when the bumper enters the first part of the building, the entire vehicle teleports inside the new space area.
Once the system is done, it could, indeed, be used for parking garages and the like. The problem is that there’s issues in how to implement it in the first place that need to be plotted out first.
I understood that z-level parking garages already teleport the entire vehicle already? As I don’t play with Z-levels I was guessing this was implemented. Guess I wrong incorrect.
But teleporting the entire vehicle to a new z lev…hmmm new idea I just had.
Using Z-levels. Instead of UNDER the bridge. It would solve the problem if we have the vehicle teleport under the bridge in a new map like area similar to the way we use sewers and subway stations. Have the space under every bridge be a tunnel and keep every bridge at normal standard level. This would alleviate the bloat of programming ramps and other stuff to force a bridge to work.
Not really, you’d need to do the same amount of work, since instead of a ‘ramp’ on land moving the vehicle a z-level up you have a ‘ramp’ on sea moving the vehicle a z-level down, the code would be pretty much identical.
There may be monsters down there, the boat may not fit inside, the player may have left a boat inside and is now trying to drive a new one in, etc.
Basically, it’s the same problems than in the land ramp implementation, the only difference is that it is less likely that the player will encounter them since the water tends to be emtpier, but this only means that there’ll be less bug testing from the player side of the equation.