In a new game
/toggle-heavy-mode
/c game.difficulty_settings.technology_price_multiplier = 0.5
Heavy mode check should fail.
[1.1.110] Desync when using technology_price_multiplier
Re: [1.1.110] Desync when using technology_price_multiplier
Thanks for the report.
In this specific case it is not a real desync, its a false-positive because technology_price_multiplier uses quite ugly coding pattern (a per-process global variable because it influences some values obtained from prototypes while prototypes are not created per-scenario-instance) that interfers with how heavy-mode works (two game instances within the same process): in this specific case, when price multiplier is changed in server's scenario instance, the client's scenario instance sees the change even before lua command was performed. This only triggers under heavy mode when there are 2 active scenario instances which means it is a false-positive.
That being said, i already changed this for 2.0 some time ago by not having this value stored in a per-process global variable which means this reproduction will trigger nothing in 2.0 so it is "fixed for 2.0"
In this specific case it is not a real desync, its a false-positive because technology_price_multiplier uses quite ugly coding pattern (a per-process global variable because it influences some values obtained from prototypes while prototypes are not created per-scenario-instance) that interfers with how heavy-mode works (two game instances within the same process): in this specific case, when price multiplier is changed in server's scenario instance, the client's scenario instance sees the change even before lua command was performed. This only triggers under heavy mode when there are 2 active scenario instances which means it is a false-positive.
That being said, i already changed this for 2.0 some time ago by not having this value stored in a per-process global variable which means this reproduction will trigger nothing in 2.0 so it is "fixed for 2.0"
Re: [1.1.110] Desync when using technology_price_multiplier
The heavy mode false positive tricked me. Getting a real desync is more complicated.
-Host multiplayer game with attached save
-Start research logistic science pack until research progress is greater than 85%
-Cancel research logistic science pack (it must not complete)
-Start research steel
-Queue research logistic science pack
-Join game with another instance before steel research completes
-When steel research completes a desync should occur
The following has been added to freeplay.lua in the save.
-Host multiplayer game with attached save
-Start research logistic science pack until research progress is greater than 85%
-Cancel research logistic science pack (it must not complete)
-Start research steel
-Queue research logistic science pack
-Join game with another instance before steel research completes
-When steel research completes a desync should occur
The following has been added to freeplay.lua in the save.
Code: Select all
script.on_event(defines.events.on_research_started,
function(event)
if (event.research.name == "steel-processing") then
game.difficulty_settings.technology_price_multiplier = 0.5
end
end
)
script.on_event(defines.events.on_research_finished,
function(event)
game.difficulty_settings.technology_price_multiplier = 1
end
)
script.on_event(defines.events.on_research_cancelled,
function(event)
game.difficulty_settings.technology_price_multiplier = 1
end
)
- Attachments
-
- technology_price_multiplier.zip
- (203.8 KiB) Downloaded 8 times
-
- desync-report-2024-09-03_17-24-48.zip
- (671.97 KiB) Downloaded 8 times