The International Simutrans Forum

 

Author Topic: JPS fails on some estuaries [WAS Humber keel refuses to use Medium River]  (Read 1873 times)

0 Members and 1 Guest are viewing this topic.

Offline AP

  • Devotee
  • *
  • Posts: 1202
  • Languages: EN
On the current Bridgewater server game, I have several Humber Keels, which say they should be able to sail up "medium rivers", refusing to use the 'midstream medium river' to get to Christerhill Village Dock (2321,2998) from Bearidge Corner Dock (2335,2957).


I can't see anything that should prevent them using this river, every tile is navigable and there are no low bridges, so am inclining to think "bug"...


Could someone take a look and let me know what they think?

Moderator note: The title of this post has been changed for clarity.
« Last Edit: January 08, 2018, 01:08:01 AM by jamespetts »

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Humber keel refuses to use Medium River
« Reply #1 on: January 05, 2018, 08:06:35 PM »
Have you checked the range?

Offline AP

  • Devotee
  • *
  • Posts: 1202
  • Languages: EN
Re: Humber keel refuses to use Medium River
« Reply #2 on: January 05, 2018, 08:22:20 PM »
Have you checked the range?

I hadn't, but on checking, the Keel's range is 50km, whereas the between the co-ordinates mentioned is 14 tiles in the x and 41 in the y (simplistically), at 8 tiles/km, nowhere close to the range limit.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Humber keel refuses to use Medium River
« Reply #3 on: January 05, 2018, 09:00:11 PM »
Are there any river rapids?

Offline AP

  • Devotee
  • *
  • Posts: 1202
  • Languages: EN
Re: Humber keel refuses to use Medium River
« Reply #4 on: January 05, 2018, 10:21:34 PM »
There are sloped river tiles, but they are tagged "navigable".

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Humber keel refuses to use Medium River
« Reply #5 on: January 05, 2018, 10:42:58 PM »
Thank you for that. I have logged in and I can see where the issue occurs, although I am not sure what is causing it; I will have to look into this in more detail when I get home and have a chance to look into the code properly.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Having looked into this, I have determined that this is (so far as I can tell) a fault with the JPS routefinding system for ships when coupled with one very specific sort of estuary:



Because this code is common with Standard, I have moved this thread to the Standard bug reports section. My tests so far show that: (1) disabling the JPS search; and (2) deleting and re-building the estuary thus as the public player:





allows the boats to route past this estuary tile. Testing using breakpoints in the debugger, it seems that, with JPS enabled, the estuary tile never gets added to the list in the route finder.

I do not know the cause of or solution to this problem, since I did not write and do not fully understand the JPS system (I suspect that it is some interaction between the unusual ribis of this particular estuary and the JPS's way of not checking all directions), but I have resolved the issue on the Bridgewater-Brunel server by rebuilding the river as shown above, and confirmed that the ships do route. Incidentally, this should make the server run more responsively, since the repeated failed attempts by these boats at finding a route were taking a huge amount of CPU power.

For the purposes of Standard developers looking into fixing this: I have a saved game available (albeit an Extended saved game) showing this failure state if that would be helpful.

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2720
  • Languages: EN
This is a very old bug, even the old "experimental" server suffered from something like it, where cannel tiles would be ignored for path finding. Just it was trivial to fix back then as one still had access to terraform as one wanted. Standard never noticeably suffered from it as both Pak64 and Pak128 are not ship focused so ships are seldom used and certainly nowhere near as much as on the extended server.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4597
  • Languages: EN, DE, AT
Will look into this when I find time.

@James: In your pictures, which of the pictures shows the faulty configuration? I suppose the first one? Is this a canal or a river? Does this only happen for generated rivers? Or does this also occur for player built canals?

I am aware that there is a route finding bug in standard, but was never able to track it down.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Dwachs - the first picture shows the fault. It is an automatically generated river, not a canal. I have not seen the issue with canals, although there are not many on the server.

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2720
  • Languages: EN
Re: JPS fails on some estuaries [WAS Humber keel refuses to use Medium River]
« Reply #10 on: January 08, 2018, 05:27:22 PM »
Worth noting that Simutrans Extended has different water logic from Standard. Some ships cannot path over open water. Some rivers and cannels limit the sort of ships that can path over them, and not just the maximum speed of the ships. This adds more potential causes of the problem.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: JPS fails on some estuaries [WAS Humber keel refuses to use Medium River]
« Reply #11 on: January 08, 2018, 07:25:22 PM »
Worth noting that Simutrans Extended has different water logic from Standard. Some ships cannot path over open water. Some rivers and cannels limit the sort of ships that can path over them, and not just the maximum speed of the ships. This adds more potential causes of the problem.

I did specifically check using breakpoints whether any of the Extended specific routing restrictions were activated: they were not. Also, it could not be one of these restrictions if turning of JPS solves the problem, as there is no distinction between JPS and non-JPS searches in any of the code that provides for these restrictions.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4597
  • Languages: EN, DE, AT
Re: JPS fails on some estuaries [WAS Humber keel refuses to use Medium River]
« Reply #12 on: January 08, 2018, 08:50:03 PM »
The bug appears to be more difficult to fix than expected. Here is a supposed fix, please test it. The bug appeared also with player-built canals. The jps method was not able to turn into or behind canals.

Many thanks to James for hunting down the bug to the jps code.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18721
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: JPS fails on some estuaries [WAS Humber keel refuses to use Medium River]
« Reply #13 on: January 08, 2018, 09:19:20 PM »
Splendid, thank you for that. I have now tested it in Extended using the original case in which this issue occurs, and I confirm that the problem can no longer be reproduced.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4597
  • Languages: EN, DE, AT
Re: JPS fails on some estuaries [WAS Humber keel refuses to use Medium River]
« Reply #14 on: January 09, 2018, 10:42:59 AM »
This is not yet submitted to standard svn.... will do tonight.

Edit: Submitted, it is r8366.
« Last Edit: January 13, 2018, 09:40:54 AM by Dwachs »