News:

SimuTranslator
Make Simutrans speak your language.

Routing bug seen

Started by Jando, July 05, 2017, 02:17:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jando

Awfully sorry to report another bug, but alas. :)

I see what seems like a pretty ugly routing bug. Luckily I can also reproduce the bug, that makes it probably easier to fix.

Here's a screenshot explaining the situation: http://files.simutrans.com/index.php/s/E5aMESzzWgu8cOV
Here's a saved game to reproduce the bug: http://files.simutrans.com/index.php/s/rteAIuk20tmE8GO

Situation as shown on screenshot: You see the small town Swainesmouth. Only connection of this small town to other parts of the network is by the bus line Curlingsea-Swainesmouth served by 4 Leyland Tiger buses. One of these buses has just arrived (passengers still transferring) and a few waiting passengers will soon board the bus for their journey. I also just built 2 new bus stops at Swainesmouth near football ground and pub to get the number of "too slow" passengers down, a local line has been created but no buses yet assigned to that new local line. A new road garage is at the western edge of the town.

How to reproduce the bug:
1. Load saved game. Hit pause.
2. Please open information window for stop Swainesmouth Town Hall like seen on screenshot. Verify that the waiting 8 passengers are to be routed through Curlingsea Monument.
3. Locate road garage at western edge of town, buy a Leyland Cub bus and assign it to line L5 Swainesmouth, the only line without any vehicles. My local lines all start with the letter L indicating that the line will make a loss. :)
4. Start the new bus.
5. Watch the information window for stop Swainesmouth Town Hall. Unpause the game. As soon as the new bus has left the garage routing of passengers to St. Peter Wetwell (a completely unrelated town in the north of the island) will change. Routing of passengers to stops at St. Peter Wetwell will have changed for passengers at other towns as well.

jamespetts

Thank you for the report for this. This is a very odd issue. I have been able to reproduce this, but it is extremely hard for me to understand what is happening because the error occurs in very complex code, the path explorer, which I did not write.

However, I do observe that the problem appears to correct itself after a few minutes.

If you or anyone else could lend any more insight into what might be happening here, 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.

Jando

Quote from: jamespetts on July 05, 2017, 08:12:46 PM
... However, I do observe that the problem appears to correct itself after a few minutes. ...

Hello James! Thanks for your answer. The problem goes away at the start of the next game month, it just so happens that is a few minutes in the saved game on fast forward.

Jando

Quote from: jamespetts on July 05, 2017, 08:12:46 PM
... If you or anyone else could lend any more insight into what might be happening here, I should be most grateful.

After a bit more thinking and testing I can offer a wild guess. Feel free to disregard it because it might be entirely coincidence, but I thought I should mention it.

I found it odd that only some passengers seem to be affected by this routing bug, notably passengers to any stop in St Peter Wetwell, a seemingly unrelated town in the north. But before I added the new bus stops and the new local line in Swainesmouth I had changed the existing local network in exactly that town, in St. Peter Wetwell in the north of the island. Thus it may be that not adding the new stops is the reason for the problem but changing routes and stops before that.

Because that rework of the local line in St Peter Wetwell included deleting a bus stop - and at Swainesmouth we now see a newly created bus stop that seems to have some "hidden connection" to exactly that town where I deleted a bus stop before. May it be that not this path explorer is the problem, but that a newly created stop can somehow retain some information from another bus stop that was just deleted before creating the new one?

jamespetts

That is actually very helpful. I am not sure whether this is the problem (as this would be very hard to test), but I can see how this might have arisen if you deleted a halt at just the wrong moment during the path explorer's run, and I have pushed a fix that will hopefully prevent this from recurring if your idea about this is correct.

Because the problem will be in stored data, it will not fix the existing saved game, but may prevent this from arising in future.

Thank you again for your efforts with this.
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

After some more testing I got new evidence that the "wild guess" about deleting the bus stop at that northern town might not be that wild at all, haha.

What I did was to go back to a saved game I had made after deleting the bus stop in the north but before adding any new stops. And then I made different new stops and lines from that saved game and watched the routing. And here's the interesting bit: passengers would always wrongly route via the first new bus stop placed. Thus in that Swainesmouth example:

  • New stop at Football ground, new stop at Pub, new line Football ground-Town Hall-Pub and passengers would wrongly route via Football ground. Then reload saved game and switch the order of stops placed with everything else being equal.
  • New stop at Pub, new stop at Football ground, new line Football ground-Town Hall-Pub and passengers would wrongly route via Pub.

jamespetts

Yes, this does make sense, as stops are identified by an numerical index assigned in ascending order. If the path explorer refresh is part way completed when placing a new stop, the new stop, which shares the number of the deleted stop, will be assumed to be the same stop until the path explorer has re-run the refresh of stops and their connexions.
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.