Problem with multiple instances of Factorio

Anything that prevents you play the game properly. Do you have issues with paying for the game, downloading it or properly running it on your computer? Let us know here.
Post Reply
User avatar
JaJe
Long Handed Inserter
Long Handed Inserter
Posts: 78
Joined: Wed Feb 27, 2019 6:48 pm
Contact:

Problem with multiple instances of Factorio

Post by JaJe »

Hello Guys
I have a home server that run Factorio 24/7 the game vanilla with no issue.

The moment I want to start the second server with several mods aswell I have multiple issues that I hope you can help me out.

First of all, The second server I want to start gives me the error because there's another game instance opened even after I added the following line to change the port on my .bat script:

Modded Server script

Code: Select all

start /wait factorio.exe --start-server Krastorio_MP --port 34198 --server-settings F:\Factorio\data\server-settings.json
pause
For some reason changing the port value on my second .bat script and changing the .json file is not enough.

Vanilla server script:

Code: Select all

start /wait factorio.exe --start-server PVP --port 34197 --server-settings F:\Factorio\data\server-settings2.json
pause
Now If I close the vanilla server and I start the modded server works normally BUT If I start back the vanilla server, the game loads the mods automatically that normally shouldn't and I have to manually move the mod files to not interfere with the vanilla run game.


So that being said, how can I have 2 servers opened at same time, one vanilla and one modded, each one on different ports?
Thanks.


The game is hosted on a windows server 2012 that is 24/7 active and I have the game files directly downloaded from factorio.com (non-steam version).

vjbone
Long Handed Inserter
Long Handed Inserter
Posts: 97
Joined: Sun Feb 14, 2016 10:02 am
Contact:

Re: Problem with multiple instances of Factorio

Post by vjbone »

https://wiki.factorio.com/Command_line_parameters
2 mods folders. 1 for vanilla(empty), 2 for Krastorio

Code: Select all

--mod-directory PATH

User avatar
JaJe
Long Handed Inserter
Long Handed Inserter
Posts: 78
Joined: Wed Feb 27, 2019 6:48 pm
Contact:

Re: Problem with multiple instances of Factorio

Post by JaJe »

This does not fix the instance issue.

Code: Select all

   0.000 Error Util.cpp:83: Couldn't create lock file
C:\Users\JaJe\AppData\Roaming\Factorio\.lock: 32.
Is another instance already running?

------------- Error -------------
Couldn't create lock file
C:\Users\JaJe\AppData\Roaming\Factorio\.lock: 32.
Is another instance already running?
---------------------------------
Press any key to continue . . .

Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: Problem with multiple instances of Factorio

Post by Oxyd »

Two instances cannot share the same write-data directory because they use that to write various files. Some of those are permanent, such as the log file, some are temporary, such as the map file the server creates when someone joins. If two instances tried to use the same path they'd step on each other's toes and start erroring out when a temporary file gets deleted by the other instance, or the other instance writes unexpected contents there.

To run two instances, go to the config directory and copy config.ini to another file (e.g. config-modded.ini), so you now have two copies. Open one of the copies, change the write-data line to point to a different directory from the first one, then run the server with

Code: Select all

--config config/config-modded.ini

User avatar
JaJe
Long Handed Inserter
Long Handed Inserter
Posts: 78
Joined: Wed Feb 27, 2019 6:48 pm
Contact:

Re: Problem with multiple instances of Factorio

Post by JaJe »

I used the different config.ini file before and didn't work but changing the line on the other config file fixed my issue!
write-data=C:\Users\JaJe\AppData\Roaming\Factorio\config2

Thanks! Now I have 2 servers online, both vanilla and modded :D

Post Reply

Return to “Technical Help”