Closed w43322 closed 3 years ago
timetable.waitingRequired() only processes a train when TimeUntilDeparture < 2. Under circumstances with a high number of lines and vehicles to traverse through and when the coroutine is not being run frequently enough, timetableCoroutine() might not be able to assume control the train in this period of time.
Hi,
unfortunately traversing all vehicles has a huge performance impact on maps with many vehicles.
We were already discussing in https://github.com/IncredibleHannes/TPF2-Timetables/pull/8 a potential dynamic solution.
Maybe for now, it is sufficient enough to increase the condition to TimeUntilDeparture < 5
Hi,
If the coroutine is now traversing through timetabled vehicles only, the performance impact should be minimal.
On maps with many vehicles, it is even more likely for the mod to miss a stopped vehicle. This is exactly the case with our testing environment.
I don't want to get rid of the co-routine mechanic completely, as this would affect the performance on big maps. As a compromise, I increased the iterations from 8 to 20 in #43 It might be worth making this parameter configurable in the future so the player can decide themself how much of a performance impact they are willing to pay for higher timetable accuracy
force traverse through all vehicles before yielding, to fix the issue of trains not being controlled by the mod under certain circumstances