Across-save data transfer

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Moterius
Burner Inserter
Burner Inserter
Posts: 12
Joined: Wed Jun 07, 2023 7:39 am
Contact:

Across-save data transfer

Post by Moterius »

I'm in the process of designing a mod where some elements are heavily knowledge-dependant. I want to make a GUI where the already discovered elements are shown, and would like for those elements to be transferrable between saves so you don't constantly load save A, then save B.

I'm aware I can easily do this using map settings and strings to transfer the data, but this requires user interaction, and is not something I imagine people would enjoy being forced to do or be aware of. I'm also not too sure of the limitations strings have (do they have a character limit?).

My request is a table like the current global table, with the simple difference that it is saved on the factorio install, not the world itself. It would be the responsibility of modders to write code that doesn't break with different versions, but that's not too different from how global works, either.
Nidan
Filter Inserter
Filter Inserter
Posts: 267
Joined: Sat Nov 21, 2015 1:40 am
Contact:

Re: Across-save data transfer

Post by Nidan »

Generally this is difficult due to factorios deterministic nature. In multiplayer game, map, mods and startup settings have to be identical for all players. As consequence, the easier methods of passing data around are simply not available. (While a mod can for example write files to the script-output directory, there's no method for reading them back in.)

That said, it looks like you can change a players mod settings at runtime: https://lua-api.factorio.com/latest/cla ... d_settings
But think about how your mechanics should behave in multiplayer. If you simply set things up according to the "knowledge" of the local player, the game is almost guaranteed to desync.
Moterius
Burner Inserter
Burner Inserter
Posts: 12
Joined: Wed Jun 07, 2023 7:39 am
Contact:

Re: Across-save data transfer

Post by Moterius »

The desync doesn't matter if all it's used is render a GUI that doesn't interact with the world
curiosity
Filter Inserter
Filter Inserter
Posts: 469
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Across-save data transfer

Post by curiosity »

Moterius wrote: Sun Sep 15, 2024 4:01 pm The desync doesn't matter if all it's used is render a GUI that doesn't interact with the world
Modded GUI is part of the game state.
sparr
Smart Inserter
Smart Inserter
Posts: 1444
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Across-save data transfer

Post by sparr »

How about you store the progression in a mod setting? Any save/game could write to the setting, and then others could read from it. And players could just edit it themselves if they want to lock or unlock parts of the progression manually (to start over, or cheat, or share with a friend, or try a weird combination, or ...)
Gweneph
Inserter
Inserter
Posts: 44
Joined: Thu Nov 14, 2019 11:51 pm
Contact:

Re: Across-save data transfer

Post by Gweneph »

I think that should be possible if users unchecked the "Use different mod settings per save". But that may have unintended consequences for other mods/ this mod. I wish there was an option to specify that the setting should always be synchronized for things like user interface preferences that make sense to always synchronize. Especially since the checkbox is checked by default.
Post Reply

Return to “Modding interface requests”