OpenBVE icon indicating copy to clipboard operation
OpenBVE copied to clipboard

Speed limits are not properly enforced

Open marcriera opened this issue 4 years ago • 5 comments

Description

Speed limits are apparently not being properly enforced on the user/AI driver. This applies to both track and signal limits.

  1. If currently driving on a track section with a 30 km/h speed limit, for example, no warning message is shown when the speed limit is exceeded.

  2. When a limit/signal with a lower speed requirement is passed above the required speed, a warning message is shown, as expected. However, if the driver reduces the speed (enough to make the message disappear), and then accelerates over the limit, no warning message is shown (as in case 1).

  3. The built-in AI driver respects the limits on approach/pass, but ignores them once the train is inside the limited section. This also happens when driving over the limit manually and then enabling the AI driver.

Reproduction

This issue happens generally, not a specific combination of route/train. It is very noticeable on FEVF with EM A1 (try driving with the AI from the beginning, it will happily drive over 15 km/h and 30 km/h on the first section, with no warning messages shown on screen). Link: https://fevf.altervista.org/pg008.html

marcriera avatar Nov 07 '21 16:11 marcriera

My AI appears to be working OK at the minute. Still playing.... You may sometimes see a very small (~2km/h or so) overshoot / undershoot in hitting the speed limit, which is as designed; Michelle's original code tries to implement a small amount of quasi-human randomness into stuff such as precise AI target speeds.

The speed limit message is interesting. I've just tested on FGC- We seem to miss the overspeed message for the initial limit (20km/h), but the second and subsequent limit messages definitely trigger.

Something's definitely funny, but I don't think speed limits have been touched at all recently.

leezer3 avatar Nov 08 '21 10:11 leezer3

~~Now that's seriously odd. Open the menu, and the message shows. Close it and it vanishes....~~

Time acceleration affecting timeouts, but that's another issue.

leezer3 avatar Nov 08 '21 10:11 leezer3

I think the commit above should solve the messages problem, by detecting if the train falls below the required speed and resetting the message trigger. First section issue was due to the train exceeding the speed on fast-forwards at game start, and the message being ignored as it was in minimal simulation mode.

I can't reproduce any AI issues though- This appears to be behaving exactly as expected.

leezer3 avatar Nov 08 '21 11:11 leezer3

My AI appears to be working OK at the minute. Still playing.... You may sometimes see a very small (~2km/h or so) overshoot / undershoot in hitting the speed limit, which is as designed; Michelle's original code tries to implement a small amount of quasi-human randomness into stuff such as precise AI target speeds.

The speed limit message is interesting. I've just tested on FGC- We seem to miss the overspeed message for the initial limit (20km/h), but the second and subsequent limit messages definitely trigger.

Something's definitely funny, but I don't think speed limits have been touched at all recently.

The small variation you mention is normal. In this case (FEVF), the AI is reaching up to 45 km/h on a 30 km/h section. It applies the brakes until it gets down to around 32 km/h, but then releases the brakes and lets the train speed up. I wonder if it's aggravated by the downward slope. I haven't inspected the AI code in detail, but maybe it's assuming no power = deceleration, which isn't always the case.

I haven't been able to recreate the message appearing when opening the menu. I'm using v1.8.2.0 on Linux.

marcriera avatar Nov 08 '21 11:11 marcriera

That sounds highly logical to me with regards to the AI behaviour.

I know I had to fix it so it actually stopped properly on a station with an uphill slope, and this is going to be related. Skimming the AI code, it doesn't even bother to look at the gradient.

leezer3 avatar Nov 08 '21 11:11 leezer3