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.
Across-save data transfer
Re: Across-save data transfer
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.
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.
Re: Across-save data transfer
The desync doesn't matter if all it's used is render a GUI that doesn't interact with the world
Re: Across-save data transfer
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 ...)
Re: Across-save data transfer
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.