News:

Want to praise Simutrans?
Your feedback is important for us ;D.

Departures per month depends on map rotation

Started by TurfIt, July 25, 2017, 01:45:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TurfIt

or actually the facing of the stop which changes upon map rotation.
Attached example. Both lines are set for 15 min spacing, one waits at the north station, one at the south. In steady state, the north waiters end up with 30 min spacing.

Observe the first two convois arriving at the north station have the correct waiting times. Once a line into the station forms, the waiting time doubles. The reversing convoi is still counted as being in the station for the purposes of  halt->get_queue_pos(self) in the waiting time calc. For the south station waiters, the queue_pos remains 1 since the reversing completes before the next convoi makes it in all the way.

Rotate the map once so the north station becomes east. Now the waiting times return to the correct 15 min spacing. But the formerly south, now west, line ends up with the 30 min waits...


jamespetts

Thank you very much for reporting this, and apologies for not reverting on this or the other bugs any sooner: I have been rather busy with work in the past few days.

I am having some difficulty in working out quite what is happening here (albeit I have only looked at this relatively cursorily so far): normally, errors caused by rotation are caused by a koord or koord3d value being stored somewhere and not being rotated when the map is rotated. Here, the only koord(3d) values that I can find are vehicle_t::last_stop_pos, which is rotated, and haltestelle_t::get_basis_pos(). May I ask - is the latter rotationally consistent? In other words, would the following evaluate to true:


koord3d k = get_basis_pos();
[Rotate the world]
koord3d k2 = get_basis_pos();
k == k2


It would help me to know the position before I start looking into this in detail as this might save me some time. Thank you again for all of your very helpful testing and detailed reports of late.
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.

Dwachs

basis_pos is rotated as well: it is the position of the first tile of the station.
Parsley, sage, rosemary, and maggikraut.

TurfIt

Don't confuse the method to expose the bug with the bug itself...

Rotating map changes station orientation. Station orientation determines convois stop position - half tile in for N/W, full tile for E/S. Combine with unfortunate coincidence of timings - convois reversing time, and other convois speed/accel  (time it takes to go a half and full tile), and you end up with a wrong waiting time.

The problem is  haltestelle_t::get_queue_pos is including the reversing convoi as being in the queue waiting for a full time slot even though its in the process of departing. Hence when the second convoi arrives while the first is in the reversing stage, the second convoi gets given a departure slot two out. The go_on_ticks calculations in convoi_t::hat_gehalten are faulty.

The map rotation simply makes it so the second convoi has to travel farther before arriving at the stop, and hence the arrival is after the reversing convoi departs.

jamespetts

Thank you both for your help: that is much appreciated. It seems that the difference in the waiting time is caused, as TurfIt has helpfully deduced, from the stop position inconsistency (which is ultimately from Standard), leading some vehicles to reach the stop at different times than others. This difference would, if I have understood this correctly, be the same whether or not reversing were taken into account in the determination of the queue position, albeit the difference would occur at slightly different times.

Reversing vehicles being counted as loading for the purposes of the queue position, however, is deliberate: vehicles with a waiting time start reversing in time so that they finish reversing just before they are due to depart, as reversing takes time. Vehicles can load and unload whilst reversing in a station/stop, so vehicles reversing ought to be accounted for in the queue position.

Thus, I am not sure that this is, properly understood, an error in the code relating to determining the queue position or the calculation of the waiting/reversing time. Does this make sense, or have I misunderstood something?
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.