Page 1 of 1
Multiple instances - are there any side effects if I delete .lock?
Posted: Tue May 17, 2022 9:09 am
by XaLpHa89
I've successfully started multiple servers with and without mods, just deleting the ".lock" file. Are there any side effects I'm missing?
Code: Select all
screen -dmSU "screen.window.factorio.instance_1"; \
screen -S "screen.window.factorio.instance_1" -p 0 -X stuff "
/opt/factorio/bin/x64/factorio
--start-server /opt/factorio/saves/load.zip
--bind 0.0.0.0:34197 + 1 per INSTANCE
--server-settings /opt/factorio/config/server-settings.instance_1.json
--server-adminlist /opt/factorio/config/server-adminlist.json
--mod-directory /opt/factorio/mods
--rcon-port 27015 + 1 per INSTANCE
--rcon-password YOUR_PASSWORD
^M"; \
screen -r "screen.window.factorio.instance_1";
[CTRL] + [D] = minimize the screen and keep it running in the background
Re: Multiple instances - are there any side effects if I delete .lock?
Posted: Tue May 17, 2022 11:01 am
by Bilka
Re: Multiple instances - are there any side effects if I delete .lock?
Posted: Wed May 18, 2022 6:01 am
by XaLpHa89
I have now added the parameter "--no-log-rotation". It would be better to switch off the log completely, is that possible? How much is the content in "factorio\temp\currently-playing" affected? Can the path be changed?
Re: Multiple instances - are there any side effects if I delete .lock?
Posted: Wed May 18, 2022 6:27 am
by boskid
XaLpHa89 wrote: ↑Wed May 18, 2022 6:01 am
I have now added the parameter "--no-log-rotation". It would be better to switch off the log completely, is that possible? How much is the content in "factorio\temp\currently-playing" affected? Can the path be changed?
You can create a separate config.ini inside of which you can set `write-data` from the paths secion to point to some other directory for every game instance. There are some inner paths that can be overriden separately by the `path` section, those are "saves", "scenarios", "mods", "archive" and "script-output" which by default are just a path to a directory inside of `write-data`. For example my config when running second instance of the game for testing looks like this so i have a shared directory for save files while keeping temp directory separate.
Code: Select all
[path]
read-data=__PATH__executable__\..\..\data
write-data=__PATH__executable__\..\..\bin\second_instance
saves=C:\Users\boskid\AppData\Roaming\Factorio\saves
If you have 2 game instances running on the same temp directory by using --no-log-rotate and removing .lock file or any other combination of actions, this is just not supported and is your fault in case anything goes wrong. What can go wrong? if one instance is hosting the game, the files inside of `currently-playing` directory may be deleted by the second instance of the game, and this will make the server to send corrupted save files to joining clients, they may not have the control.lua in them, scenario script may stop working, they may even desync, just do not share the temp directory between multiple instances. You really need a separate config with separate write-data path for this.
Re: Multiple instances - are there any side effects if I delete .lock?
Posted: Wed May 18, 2022 5:05 pm
by XaLpHa89
Thank you for your detailed reply. I have now created a second config. Just as there is a --mod-directory parameter, I would like a --server-directory parameter. Does that make sense, would it be possible? Or for all a separate parameter?
- --script-output-directory
- --currently-playing-directory
Re: Multiple instances - are there any side effects if I delete .lock?
Posted: Wed May 18, 2022 8:21 pm
by boskid
I am mostly in favor of using a config file since you have to allocate a separate directory anyway, there are no strong reasons preventing you from having multiple config files anyway.
The ability to specify separately some of the paths was added in 0.18.29, while the --mod-directory is an override which was implemented back in 0.13.10 when it was not possible to have extra paths specified through a config file.
I have no idea what you mean by "--server-directory", it does not make any sense.
Override for "--currently-playing-directory" i would say is too specific, it is just one of multiple paths for temporary stuff, and having "temp" (which needs to be separate per game instance due to currently-playing, currently-playing-tutorial, currently-playing-background, downloading updates, importing save file through editor, downloading mods, creating desync reports etc) tightly binding to the write-data path (which also needs to be separate per game instance due to log file) makes the most sense.
Other overrides are doable but i am not going to implement them, i would rather remove the "--mod-directory" as it seems deprecated now when it is possible to specify paths by config file.
Re: Multiple instances - are there any side effects if I delete .lock?
Posted: Thu May 19, 2022 8:42 am
by XaLpHa89
boskid wrote: ↑Wed May 18, 2022 8:21 pm
I am mostly in favor of using a config file since you have to allocate a separate directory anyway, there are no strong reasons preventing you from having multiple config files anyway.
The ability to specify separately some of the paths was added in 0.18.29, while the --mod-directory is an override which was implemented back in 0.13.10 when it was not possible to have extra paths specified through a config file.
I have no idea what you mean by "--server-directory", it does not make any sense.
Override for "--currently-playing-directory" i would say is too specific, it is just one of multiple paths for temporary stuff, and having "temp" (which needs to be separate per game instance due to currently-playing, currently-playing-tutorial, currently-playing-background, downloading updates, importing save file through editor, downloading mods, creating desync reports etc) tightly binding to the write-data path (which also needs to be separate per game instance due to log file) makes the most sense.
Other overrides are doable but i am not going to implement them, i would rather remove the "--mod-directory" as it seems deprecated now when it is possible to specify paths by config file.
You're right of course, using config files is better because a lot of other things can be set there. But then I find that all things should be defined in the config file, so that I only need the one parameter "factorio --start-server --config FILE_PATH", which then says where the other .json files are located.
"--server-directory" or "--instance-directory" simply meant "write-data=__PATH__executable__/../..".