[1.1.110] Desync when using technology_price_multiplier

This subforum contains all the issues which we already resolved.
Atraps003
Long Handed Inserter
Long Handed Inserter
Posts: 93
Joined: Thu Jan 04, 2018 6:34 am
Contact:

[1.1.110] Desync when using technology_price_multiplier

Post by Atraps003 »

In a new game

/toggle-heavy-mode
/c game.difficulty_settings.technology_price_multiplier = 0.5

Heavy mode check should fail.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3272
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.1.110] Desync when using technology_price_multiplier

Post by boskid »

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"
Atraps003
Long Handed Inserter
Long Handed Inserter
Posts: 93
Joined: Thu Jan 04, 2018 6:34 am
Contact:

Re: [1.1.110] Desync when using technology_price_multiplier

Post by Atraps003 »

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.

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 29 times
desync-report-2024-09-03_17-24-48.zip
(671.97 KiB) Downloaded 24 times
Atraps003
Long Handed Inserter
Long Handed Inserter
Posts: 93
Joined: Thu Jan 04, 2018 6:34 am
Contact:

Re: [1.1.110] Desync when using technology_price_multiplier

Post by Atraps003 »

Getting a crash is also possible.

-Host multiplayer game with technology_price_multiplier.zip save above
-Join game with another instance
-Disable research queue /c game.forces["player"].research_queue_enabled = false
-Repeatedly change the research between steel processing and logistic science pack
Attachments
factorio-dump-current.dmp
(1.12 MiB) Downloaded 27 times
factorio-current.log
(19.82 KiB) Downloaded 19 times
2024-09-15 19-56-53.mp4
(10.39 MiB) Downloaded 23 times
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3272
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.1.110] Desync when using technology_price_multiplier

Post by boskid »

Whatever, the underlying code was changed and we are right now all hands on making sure 2.0 release will be as smooth as possible. Please wait until 2.0 release and if its not fixed there then please create new report.
Post Reply

Return to “Resolved Problems and Bugs”