Cataclysm-DDA icon indicating copy to clipboard operation
Cataclysm-DDA copied to clipboard

Multi z-level vehicles exist

Open Procyonae opened this issue 2 years ago • 9 comments

Describe the bug

So while messing with debug I saw an open sewer and figured I'd drive over it knowing non straight ramps are buggy and lost half my vehicle which while weird seemed fair enough.

image

Then I checked the level below to see the wreck it had left in the sewer... except instead it was still directly next to my vehicle, driving along with me despite being in solid ground

image

Attach save file

Tyringham-trimmed.tar.gz

Steps to reproduce

Drive over an open sewer diagonally shearing your vehicle Keep driving Check the level below with clairvoyance and discover the rest of your vehicle still thinks it's attached

Expected behavior

Idk not this

Screenshots

No response

Versions and configuration

  • OS: Windows
    • OS Version: 10.0.19045.3324 (22H2)
  • Game Version: 24b09f4 [64-bit]
  • Graphics Version: Tiles
  • Game Language: System language []
  • Mods loaded: [ Dark Days Ahead [dda], Disable NPC Needs [no_npc_food], Portal Storms Ignore NPCs [personal_portal_storms], Slowdown Fungal Growth [no_fungal_growth], No Rail Stations [No_Rail_Stations] ]

Additional context

No response

Procyonae avatar Aug 16 '23 22:08 Procyonae

If you examine the vehicle it still shows the whole thing as being one btw image

It has the collision of the half left above ground though image image

The bottom half has no collision at all as far as I can tell image

You can also fix it by driving across the ramps in a similar way which makes it as though nothing happened

image

Procyonae avatar Aug 16 '23 22:08 Procyonae

I think "multi-z-level" would work better than multitile here? Almost all vehicles are multitile, I think what you're working with here is multi-z-level

Karol1223 avatar Aug 17 '23 08:08 Karol1223

I think "multi-z-level" would work better than multitile here? Almost all vehicles are multitile, I think what you're working with here is multi-z-level

🤦

Procyonae avatar Aug 17 '23 09:08 Procyonae

Yeah, I am pretty sure while vehicles are 1 tile high, vehicle parts can be positioned on different z-levels.

ZhilkinSerg avatar Aug 17 '23 11:08 ZhilkinSerg

Is that possible to get like a two-levels bus in the future?

rtxyd avatar Aug 19 '23 06:08 rtxyd

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

github-actions[bot] avatar Sep 18 '23 08:09 github-actions[bot]

/confirm

Milopetilo avatar Nov 29 '24 22:11 Milopetilo

Possible "what should happen": Have center of mass needing to be within the ramp support:

Vehicle V with center of mass C going this way -> over Ramps R
VVVV R
VVCV
VVVV R

In this picture, the Center of mass will pass in between or over a ramp R. Since vehicles cannot turn on ramps, calculate it by projecting where the vehicle would go, if it went in a straight line. In case that does not happen, the vehicle would "tip over".

Tipping over sounds complicated, so let's just stop the player from being able to do that. By crashing into the ramp(s) (colliding with them).

This doesn't consider wheel position. That said, vehicles need only one tile under them to not fall and can drive over tips of trees when placed there [cannot find the bug report].

In case there are enough ramps for support, draw a line between the ramps, that is your imaginary ramp the vehicle should rise on.

A problem is that you need to detect disconnected ramps and treat them all in this algorithm at once. Otherwise, the vehicle would want to "tip over" both ways and collide with both ramps.

Solving that: We can do convex hull over the ramps https://en.m.wikipedia.org/wiki/Convex_hull . But we need the lenghts in this hull to be at most as big as the vehicle is wide. I don't know the simple way to solve this yet.


Another solution I considered: Check all vehicle tiles in the front. If some are on the ramp and some not, treat it as colliding with the ramp instead of driving on it.

Brambor avatar Nov 30 '24 08:11 Brambor

What happens IRL when vehicle goes onto a ramp partially: https://youtu.be/nvlU5c0D87s?t=10

Flip over from the same vid: https://youtu.be/nvlU5c0D87s?t=114

Brambor avatar Nov 30 '24 09:11 Brambor