Author Topic: Road convoys depart at irregular times despite "wait for time" setting  (Read 703 times)

0 Members and 1 Guest are viewing this topic.

Offline zhaop

http://simutrans-germany.com/files/upload/256x256_Greystone_-_1829_bug.sve (282 KB, expires 31 May 2018)

This save opens in 1829 on the beautiful almost-seaside city of Chiselwich. The Chiselwich-Beghurst stagecoach line, which has "Wait for time" set at 24 departures/month (15:59 between departures), serves the Monument Stop at (123, 60), next to the city hall.

I would expect to see convoys depart from this stop every 15:59, i.e. at the in-game times of 15:59, 31:58, 47:57, 1:03:56, 1:19:55, 1:35:54, and so on.

Instead, I see my carriages (coming in from the lower-left) arrive at the stop, display "Waiting for schedule", then depart the stop at 41:57, 44:41, 46:49, 1:14:24, 1:19:47, 1:29:29, and so on. Sometimes convoys don't even "wait for schedule", showing instead "Schedule changing!" for a split second before immediately departing.

This also happens at almost all of the other stops. It may help to know that these convoys have all served under various other lines in the game's history, and have all been "replaced" for vehicle upgrades at various times in their own history.

I recommend turning on "Full convoy tooltips" under "Display settings" to see the messages more easily.

Is my understanding of the scheduling mechanism incorrect, or is this a bug?

EDIT: Tested on latest Simutrans-Extended master (commit ef8b2e7f, Monday May 29); pak128.britain-ex-nightly from some time last week

« Last Edit: May 31, 2017, 09:21:39 PM by zhaop »
I'm working on an AI for Simutrans that can make lots of money, and I'm currently learning the squirrel API for AI players.
https://github.com/zhaop/simutrans/tree/marmot

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15350
  • Total likes: 368
  • Helpful: 165
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Thank you for your report, and sorry that you are having trouble. I am currently staying away from home and am using my secondary computer, so it is hard for me to do serious debugging until the week-end. Can I check whether your other lines are working as expected? At first glance, this does appear to be incorrect behaviour.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline zhaop

Thank you James for your quick reply! This also happens with most of the other lines I checked.

For example, the Peteringlow-Narchester line is set to a frequency of 12 minutes, but my carriages leave Peteringlow Brewery & Slaughter-house dock tile (56, 104) at 42:00, 44:25, 46:53, and so on.

Similarly, the shorter Jarstoke-Swinston line, set to a frequency of 15:59, sometimes also shows this. My carriages leave Jarstoke Draught Lane Stop tile (178, 192) around 47:29, 1:03:29, 1:19:28, 1:41:51, 1:51:48. You might notice the spacing between the first 3 departures is roughly 15:59, but it breaks down after that.

Good to know this might not be expected behavior. I can also look into the code when I have time.
I'm working on an AI for Simutrans that can make lots of money, and I'm currently learning the squirrel API for AI players.
https://github.com/zhaop/simutrans/tree/marmot

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15350
  • Total likes: 368
  • Helpful: 165
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Thank you James for your quick reply! This also happens with most of the other lines I checked.

For example, the Peteringlow-Narchester line is set to a frequency of 12 minutes, but my carriages leave Peteringlow Brewery & Slaughter-house dock tile (56, 104) at 42:00, 44:25, 46:53, and so on.

Similarly, the shorter Jarstoke-Swinston line, set to a frequency of 15:59, sometimes also shows this. My carriages leave Jarstoke Draught Lane Stop tile (178, 192) around 47:29, 1:03:29, 1:19:28, 1:41:51, 1:51:48. You might notice the spacing between the first 3 departures is roughly 15:59, but it breaks down after that.

Good to know this might not be expected behavior. I can also look into the code when I have time.

Thank you for checking. Please do look into the code if you have time: I have so many coding projects and bug reports lined up that my Simutrans time is very stretched, so any help would be very much appreciated.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline Ves

Isnt there a feature that makes a convoy depart immediately if it is running "late"? I think I have run into  schedule spacing ignorant vehicles when I run schedules very tight, i.e it's scheduled departure is just minutes or seconds after arrival to the stop.

Offline zhaop

That is interesting Ves. Do you know how "lateness" would be defined? What I had understood from Carl's convoy spacing guide was that vehicles that miss a departure slot would have to take the next slot, and so the delay would propagate down the entire line.
I'm working on an AI for Simutrans that can make lots of money, and I'm currently learning the squirrel API for AI players.
https://github.com/zhaop/simutrans/tree/marmot

Offline Ves

I'm not sure it is that way at all, also I think it would be the new version only (extended) where Carls guide applies to the old version (experimental). If this is the case, it would be nice if this could somehow be displayed to the player, so one know what is happening :)

Offline Vladki

I think that the problem is that the game has no definition of being late. It doesn't distinguish if you are half of the period late or early...

Hmm, what about this: showing in the line/convoy management average round trip stripped of all waiting for schedule, and separately the waiting times on stops. Also info about missed slots, when there was no convoy ready to depart.

Hmm, lateness could be defined as arrival within x% (or minutes) of period after a slot without departure occurs.




Offline Ves

What I meant was that the vehicle would depart only if it late within a very short timeframe. If it is several minutes late, I think it is waiting for the next slot.

I was actually thinking of changing the "departure board" to show the actual calculated departure and arrival times instead of this count down timer it currently is. Or possibly make it able to be toggled between the current timer and the estimated times.
I think it would be easier to predict the schedule timings then, and also look better, since a real departure board usually shows the departure times.

If I manage to do it, I could look into the line management and see if there is a way to extract the spacing information and combine it with the actual departures.

Offline Jando

This is likely the same bug as has been reported for other stations where convoys reverse. I see the same on my maps - but so far only on stops where convoys reverse. And yes, the line spacing feature sometimes does not work on these stops.

Here is a saved game where this can be easily observed: http://files.simutrans.com/index.php/s/moJVtAiih3UzjSk

You see a train pulling into Broad Murdton Station from the East, soon after another train will pull into the same station from the West, both trains are on identical schedules (6 departures per day, no line shift) but they will not depart at the same time.

Offline zhaop

I'm not familiar with the reversing concept, having mainly played with road so far. Do road vehicles, especially horse-drawn carriages, also have to reverse?
I'm working on an AI for Simutrans that can make lots of money, and I'm currently learning the squirrel API for AI players.
https://github.com/zhaop/simutrans/tree/marmot

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15350
  • Total likes: 368
  • Helpful: 165
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Road vehicles do indeed reverse directions in some cases; however, this does not have the timing significance that it has for rail vehicles (although this might be changed in the future).
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline zhaop

I haven't looked at the code in great detail yet, but one quick hack that made my house-drawn carriages properly follow their wait-for-time schedules again was to hard-code reversing_time to 0 inside convoi_t::hat_gehalten() in simconvoi.cc.

It appears my horse-drawn carriages are "reversable" and calc_reverse_delay() returns 65560, which is about 6 in-game minutes.

Quick code question: why is reversing_time subtracted in both of these calculations:
departure_time = arrival_time + current_loading_time - reversing_time
go_on_ticks_spacing = (wait_from_ticks + spacing * queue_pos) - reversing_time
« Last Edit: June 04, 2017, 02:14:25 PM by zhaop »
I'm working on an AI for Simutrans that can make lots of money, and I'm currently learning the squirrel API for AI players.
https://github.com/zhaop/simutrans/tree/marmot

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15350
  • Total likes: 368
  • Helpful: 165
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Thank you very much, that is actually very helpful. I think that the problem is caused by inconsistent behaviour between road and rail vehicles on reversing: I have now made their behaviour consistent (which is actually a new feature), so hopefully this problem will no longer occur. I have not tested this fully, however; would you be able to re-test with the latest code? I should be most grateful.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.