News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

Routing bug likely caused by deleted bus stop

Started by Jando, May 21, 2019, 09:30:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jando

I see wrong routings in a game. The bug is likely caused by deleting bus stops and then creating new stops elsewhere. It seems that it's possible that a new stop kinda "inherits" the routings to the old, now deleted, stop. I vaguely seem to remember that I had and reported this bug a few years ago too. Can't remember whether it was considered solved back then, thus I thought to report the new occurrence as well.

The bug can be observed in this saved game: https://www.jschuh.eu/Shared/Routingbug.sve

Here a horse omnibus brings passengers from Monking station to a town a few hundred kms away to the football ground in Monking instead.

jamespetts

Thank you for the report. Can I ask whether the vehicles use the wrong routing consistently or only on each individual vehicle's first run to the new stop?
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.

Jando

Consistently, so far 12 vehicles with passengers to another destination arrived at that football ground. Only 2 vehicles on that line so far, 6 arrivals by each vehicle.

Jando

It seems the wrong routing goes away on it's own at or soon after the beginning of the next game day-month.

ACarlotti

I think this is known behaviour - the passenger store some portion of their route using stop ids. If a stop is deleted and a new stop is created, the new stop might reuse the old stop's id without the passengers realising.

jamespetts

Can I clarify - do you mean the routings of vehicles or the routings of passengers/mail/goods?
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.

prissi

This and the previous bug can be mended if the quickstone_tpl just continue to count on and only fills holes after reaching the maximum handle number (which is never for 32 bit). Then invalid handles will stay invalid for long times. LOnger than a month and longer than the next runway reservation ...

Jando

Quote from: jamespetts on May 22, 2019, 09:56:01 AMCan I clarify - do you mean the routings of vehicles or the routings of passengers/mail/goods?

In case this was directed at me: routing of passengers/mail (no cargo on that map). Passengers with destination A are being brought to destination B because destination B has inherited some information from a deleted stop that was close to destination A. Destinations A and B may be hundreds of kms apart but somehow are treated as being close to each other, I call it a wormhole. :)

ACarlotti

I think there are probably a couple of issues that are limiting the effectiveness of quickstone_tpl.

Firstly, if the number of objects stored is not much less than the size of the array (which is a power of two that starts at 1024), then when an object is deleted, it's id is likely to be reused fairly soon. This is only likely to be an issue on larger maps (e.g. Bridgewater Brunel, where the highest convoy id is 8191, which looks like it was probably purchased just before convoy 1)

Secondly, I think 'next' is currently reset to 1 whenever a save is loaded. This could easily result in small stop ids being reused in any size of game.

I think the simplest improvements will be to save and load 'next' (which I think can be done at any point in the save/load routine), and to implement your suggestion of cycling through all 65535 possible values instead of looping over a smaller array (this might mean slightly more space is needed in memory, but it's at most 1.5MB total on a 64 bit system, and it shouldn't increase the save size).

jamespetts

Thank you all for your thoughts on this.

I have just pushed what I believe is Prissi's solution to this, which is code to re-use quickstone IDs only when the array is full. I have not stored any additional data, but, on loading, "next" is set to one greater than the highest entry number unless the highest entry number >=65534.

This should help to prevent duplication. I should be grateful if people could re-test to see whether this resolves the issues. Those with a saved game with convoys/lines already created with the old quickstone system may have to create new convoys/lines with the new quickstone system before this fix will be effective.
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.

jamespetts

Can I check whether anyone can still reproduce the bug after the possible fix that I committed in December?
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.

Mariculous

Did anyone try to reproduce?
If so and it could not be reproduced, I will expect it solved.