[boskid][1.1.73] Desync when changing pathfinder settings mid path searching

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
Muppet9010
Filter Inserter
Filter Inserter
Posts: 278
Joined: Sat Dec 09, 2017 6:01 pm
Contact:

[boskid][1.1.73] Desync when changing pathfinder settings mid path searching

Post by Muppet9010 »

If you change some pathfinder settings while the game is doing a pathfind it will desync. Encountered in an MP game, but reproduced in SP with heavy mode enabled.

This was encountered in an MP game as we had a long queue of path requests due to many layers of wall around the base and artillery triggering biter. I tried to use the command to make the pathfinder more forwards moving as in SP testing this significantly sped up the time for it to find a path through the walls (as it can't go around them). Logged under Performance optimisation save thread: viewtopic.php?p=578064#p578064

The save is paused in editor mode. An artillery shell has just hit some biters to the north east and they will shortly pathfind to the artillery. There is a lot of wall between them just to slow the pathfinder down enough so that the pathfinder setting can be changed mid path search.

Reproduction steps:
  1. Be in Factorio with no mods and have heavy mode enabled. Start a new game and do `/toggle-heavy-mode` in console.
  2. Load save:
    path finder desync test.zip
    (1.99 MiB) Downloaded 49 times
  3. The game should be paused and from editor mode and in heavy mode still.
  4. Enable the debug layer `show-pathfinder-fringe`.
  5. Be in map view so you can see the pathfind fringe when the path request is being processed.
  6. Unpause the game and wait for the biters to make a path request to the artillery. This is when the path request fringe overlay will light up.
  7. Run the command to change some pathfinder settings:

    Code: Select all

    /sc
    game.map_settings.path_finder.fwd2bwd_ratio = 20
    game.map_settings.path_finder.goal_pressure_ratio = 5
  8. The heavy mode should start reporting desyncs.
    issue occuring.PNG
    issue occuring.PNG (362.39 KiB) Viewed 1795 times
If you don't change the settings via command then the path finder works without raising any desyncs in heavy mode in this test save. So it's not that I've made a scenario where the pathfinder desyncs if unchanged.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2247
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [boskid][1.1.73] Desync when changing pathfinder settings mid path searching

Post by boskid »

Thanks for the report. Issue is now fixed for 1.1.78.

Issue here was related to goal_pressure_ratio setting which is used by one of the node heuristics. When a value of that setting was changing the heuristic would compare nodes differently and that was causing a server to have a heap that was not following the heap property due to comparator results change. Client would rebuild that heap on load and as such the desync happened.

My fix here is that the goalPressureRation value is captured when task starts (or is migrated) and then the heap uses that value. That means if you change the value of goalPressureRation while the task is already running, it will not be affected by the new value and will use old value instead.

Post Reply

Return to “Resolved Problems and Bugs”