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
Trains can crash through depots #8424
Comments
Do you have a save game that can reliably reproduce this? |
Depot train crashing.zip |
@UnsuspiciousGooball the "missing" track is just a drawing issue. If you set to invisible instead of transparent, they'll be drawn. |
Checking Perhaps we could instead replace |
I'm pretty sure this "bug" has been in the game since TTO. also the "missing rail" drawing "bug". |
How do you know? Did you have TTO, TTD, and/or TTDPatch and you tested them on all three? |
Well, yes. I did have TTO. and when i encountered this "bug" some 20-ish years ago, i said to myself "well, don't build like this" and didn't think of it any further. (well, actually, back then you could use a variation of this to crash the trains of competitors by sticking a rail/depot at the end of their station and run a train into them. but i think we patched that out) about the missing rail: since the depot sprite is shorter than a full tile, drawing the rail would show it sticking out the back of the depot, hence it is omitted. |
well, i think the main issue is that a train approaching the end of a tile has a "crash box" that sticks out into the next tile. when two "crash boxes" overlap, there will be a crash. we should change the rail movement that on approaching end of track (including depot) the movement stops earlier, so the "crash box" never sticks out. |
i'm pretty sure that's not what |
I checked and that seems to be true, that would explain why it can't and shouldn't be set independently of the other bits. So the purpose of that check in the collision code is probably just to dismiss train parts which are currently parked in depots, my bad. Also, what's interesting is that |
That's probably the best way to do it, because the collision logic itself does exactly what it's supposed to do in this scenario. In the provided savefile it determines the trains to be just 6 tile units apart right before the crash (the engines are 8 tile units long each), and if you turn on x-ray for the depot you can even briefly see that the trains are inside each other. |
This is because it's possible to remove a rail tile if a vehicle is partially on that tile, as the length of the vehicle is not included when seeing if it's on the file. Meanwhile collisions do check vehicle lengths. Boom. |
… correct incorrect crash circumstances. Collision sensitivity was lowered in a way that both problematic circumstances appear to be rectified while true collisions still seem to function fully. (An idea of making the trains "park in" a little less also comes to mind, but this patch seems sufficient to resolve the overall issue.)
(OpenTTD#8424 is not fixed in this particular commit.)
…o Fix Wrongful Collision This patch appears to fix the wrongful train crashing, and it changing two directions may be a good sign because it was said the bug was happening in two directions. Counting steps from 5 to 0 also match A to F in number. No process crashimg seems to be caused by this, either. However, further testing would be wise.
…o Fix Wrongful Collision This patch appears to fix the wrongful train crashing, and it changing two directions may be a good sign because it was said the bug was happening in two directions. Counting steps from 5 to 0 also match A to F in number. No process crashing seems to be caused by this, either. However, further testing would be wise.
Version of OpenTTD
1.10.3
Expected result
The train entering the depot should continue going into the depot.
Actual result
The train crashes into train on the other side of the depot.
Steps to reproduce
Make a straight line of track with depots at the end and two one-way signals facing either other in the middle. Create two trains going to the other depot. One train will wait at the signal while the other will go back and forth in the middle segment. Stop the train that's waiting for a path and delete the track in front of it. Place a depot on that square for the other train to go into. The second train will crash into the first train through the back wall of the depot.
The text was updated successfully, but these errors were encountered: