Steam Dedicated Server

Arrange meetings with other people to play MP, announce your servers.
Lucrin
Burner Inserter
Burner Inserter
Posts: 11
Joined: Thu Mar 03, 2016 8:33 pm
Contact:

Steam Dedicated Server

Post by Lucrin »

Hi all, hoping someone can help me get a server going. I want to run a dedicated server for some friends and I. I am running windows and have purchased the game through steam. I have tried creating the bat file in the bin directory and also using the --start-server parameter within steam. I think the server is starting and running but then if I try to launch the game to play it steam just keeps saying the game is already running so it won't launch. Can anyone tell me how to run a dedicated server 24/7 in the background but also be able to launch the game and play on the server when I want? Thanks.

EDIT: Or is it possible for people who bought the game through steam to download and install it standalone so I can run the server without steam interfering?

Bisa
Filter Inserter
Filter Inserter
Posts: 450
Joined: Fri Jul 17, 2015 3:22 pm
Contact:

Re: Steam Dedicated Server

Post by Bisa »

did this help you in any way? viewtopic.php?f=53&t=20594

(if not, and if you find a solution - please update the wiki https://wiki.factorio.com/index.php?title=Multiplayer )
Hosting a factorio server? Take a look at this || init script ||.

Koub
Global Moderator
Global Moderator
Posts: 7199
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Steam Dedicated Server

Post by Koub »

http://www.factorio.com/download-headless
Where to find the link
:)
Koub - Please consider English is not my native language.

Lucrin
Burner Inserter
Burner Inserter
Posts: 11
Joined: Thu Mar 03, 2016 8:33 pm
Contact:

Re: Steam Dedicated Server

Post by Lucrin »

No unfortunately that link didn't help. As for Koubs response that download is for linux specifically but I am on a windows machine so that doesn't help either. Any other ideas?

Busterguy
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon May 25, 2015 8:12 pm
Contact:

Re: Steam Dedicated Server

Post by Busterguy »

Go to your Factorio.exe folder (Probably 'C:\Program Files\Factorio\bin\x64\')
Create a text document and write into it 'Factorio.exe --start-server YOURSAVEGAME.zip'
If you haven't already done, replace YOURSAVEGAME with your savegame name
Save the file as server.bat. Important: At 'Save as type:' select 'All Files'
Use the server.bat to start your server.
The console log will be shown in the window.
To close the server, select the console window press Control+C. If you just close it without pressing this, it will not save your game.
Forward Ports: You will find detailed instructions for your specific router on the web


If you cant port forward just use somthing like hamachi and then go on LAN.

Lucrin
Burner Inserter
Burner Inserter
Posts: 11
Joined: Thu Mar 03, 2016 8:33 pm
Contact:

Re: Steam Dedicated Server

Post by Lucrin »

Busterguy wrote:Go to your Factorio.exe folder (Probably 'C:\Program Files\Factorio\bin\x64\')
Create a text document and write into it 'Factorio.exe --start-server YOURSAVEGAME.zip'
If you haven't already done, replace YOURSAVEGAME with your savegame name
Save the file as server.bat. Important: At 'Save as type:' select 'All Files'
Use the server.bat to start your server.
The console log will be shown in the window.
To close the server, select the console window press Control+C. If you just close it without pressing this, it will not save your game.
Forward Ports: You will find detailed instructions for your specific router on the web


If you cant port forward just use somthing like hamachi and then go on LAN.
Yes, this is what I tried to do and it seems to work but the problem is that when I run it, it launches the game in steam and it looks like nothing is running but if I go into the windows task manager I can see that Factorio.exe is running in the background. Then if I try to launch the game to play on the server steam gives me an error saying that the game is already running and won't let me launch another copy. This is why I was asking is there a way to download and install the client separately so I can use the standalone installation to run the server, and then the steam version to actually play on the server.

theradman221
Inserter
Inserter
Posts: 40
Joined: Sun Feb 22, 2015 7:54 pm
Contact:

Re: Steam Dedicated Server

Post by theradman221 »

I set up an overheadless server and this is what i have found by using it.
1 It takes up the entire instance of factorio. This basically means that there is no other way (that i have found) of launching the game.
This is because it uses all the same saves and mods, just starts it as a black box that auto loads and pauses a predetermined world. So i think that if you had two hard drives and installed a new instance of Factorio on the other driver you might be able to get it to work.
As far as working with steam, i do not know if that is possible since steam manages downloads and where things are installed to.

Note- if the server works then you should see see just a black box that looks like the command prompt that will update based on what is happening on the server.

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Steam Dedicated Server

Post by prg »

No need for a second Factorio installation, you can just use two config files that specify different write-data paths and ports so things don't clash. A nonstandard config file to use can be passed with -c of --config to the executable. (This probably still won't work with Steam since it doesn't allow you to run the same executable twice)
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

Lucrin
Burner Inserter
Burner Inserter
Posts: 11
Joined: Thu Mar 03, 2016 8:33 pm
Contact:

Re: Steam Dedicated Server

Post by Lucrin »

So it looks like the most recent patch on steam (.12.25 I think) is supposed to fix this issue by not requiring steam to run for the server but now I am getting a different error. If I run the server using a bat file as listed above when I try to launch the game in steam I get the following error: "The process cannot access the file because it is being used by another process." Thanks for the help guys, slowly making progress.

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Steam Dedicated Server

Post by posila »

The error "The process cannot access the file because it is being used by another process." is Factorio complaining it cannot rewrite log file because it is used by different instance of Factorio.

You need to copy config.ini either to some other location or with different name (ie. config-server.ini) and edit write-data in copied config to point to different directory.
Let's say I have

Code: Select all

## %appdata%\Factorio\config\config.ini
write-data=__PATH__system-write-data__

Code: Select all

## %appdata%\Factorio\config\config-server.ini
write-data=__PATH__system-write-data__/server
Then start server with parameter

Code: Select all

-c %appdata%\Factorio\config\config-server.ini
Then server will expect mods and saves folders as subdirectories of %appdata%\Factorio\server\. If you don't want to have keep 2 copies of mods in sync, it is kind of save to make a symlink for mods folder, but it is highly discuraged to do the same for saves folder.

Also change port number in config.ini, otherwise you won't be able to connect to your own server. Do it in the original config.ini (the one used by client), so that server has default port number.

Lucrin
Burner Inserter
Burner Inserter
Posts: 11
Joined: Thu Mar 03, 2016 8:33 pm
Contact:

Re: Steam Dedicated Server

Post by Lucrin »

Thanks Posila, I will try that when I get home. Where are the saves and mods folders kept for the steam version by default? I don't remember seeing them in the bin directory with Factorio.exe. Once I figure out where that is I will create a server folder and place everything in there. Thanks again.

NoPantsMcDance
Filter Inserter
Filter Inserter
Posts: 478
Joined: Fri Jul 17, 2015 6:56 pm
Contact:

Re: Steam Dedicated Server

Post by NoPantsMcDance »

Lucrin wrote:Thanks Posila, I will try that when I get home. Where are the saves and mods folders kept for the steam version by default? I don't remember seeing them in the bin directory with Factorio.exe. Once I figure out where that is I will create a server folder and place everything in there. Thanks again.
<username>\AppData\Roaming\Factorio\mods

if you use the search feature you can type %appdata% and it should take you into the appdata folder. Then just go to roaming>factorio then profit?
Looking for a multiplayer server? Check out my servers Vanilla Server

mileylol12
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Mar 04, 2016 9:22 pm
Contact:

Re: Steam Dedicated Server

Post by mileylol12 »

i'm haveing the same problem but i did as the staff said
and now I got the sever up and running but now i can't open the game
i'm getting an error message "process cannot f"
2nd day trying to get it to work soon abandon hope

dictatorkara
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Mar 05, 2016 1:45 am
Contact:

Re: Steam Dedicated Server

Post by dictatorkara »

I can't get a server to work using the Steam version either. I have the port forwarded and the batch file set up correctly but when I launch the bat it just closes after 3 seconds and doesn't open the game or anything. If I could find a log I would know what was wrong.

Lucrin
Burner Inserter
Burner Inserter
Posts: 11
Joined: Thu Mar 03, 2016 8:33 pm
Contact:

Re: Steam Dedicated Server

Post by Lucrin »

dictatorkara wrote:I can't get a server to work using the Steam version either. I have the port forwarded and the batch file set up correctly but when I launch the bat it just closes after 3 seconds and doesn't open the game or anything. If I could find a log I would know what was wrong.
Open the task manager and see if Factorio.exe is running. Sounds like it is working. the steam version disappears after it loads.

NapsterAT
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sat Mar 05, 2016 3:32 pm
Contact:

Re: Steam Dedicated Server

Post by NapsterAT »

posila´s "solution" does not work, if you want the dedi running on the same pc youre playing, but....

if you log in to your steam account from a different pc ( like a notebook you may have ) and install factorio there again , close steam and start the dedi on the notebook

then try to connect with your regular gaming rig, that should work then cause the dedi on the notebook doest not require steam to be running


( maybe more luck with steam cmd, if you want to run the server on the same rig on where youre gaming )

Lucrin
Burner Inserter
Burner Inserter
Posts: 11
Joined: Thu Mar 03, 2016 8:33 pm
Contact:

Re: Steam Dedicated Server

Post by Lucrin »

NapsterAT wrote:posila´s "solution" does not work, if you want the dedi running on the same pc youre playing, but....

if you log in to your steam account from a different pc ( like a notebook you may have ) and install factorio there again , close steam and start the dedi on the notebook

then try to connect with your regular gaming rig, that should work then cause the dedi on the notebook doest not require steam to be running


( maybe more luck with steam cmd, if you want to run the server on the same rig on where youre gaming )
As a matter of fact Posila's solution does work and I am now hosting a server and playing from the same machine without a problem. If you need more detailed instruction to get it working let me know and I can try to assist you.

TwerkBot
Manual Inserter
Manual Inserter
Posts: 1
Joined: Tue Mar 08, 2016 2:49 am
Contact:

Re: Steam Dedicated Server

Post by TwerkBot »

Hey Lucrin,

I followed the steps in posila's post, but it's still not working for me. I think i'm experiencing a disconnect. Could you go over the steps you used to get this to work? To clarify, i've found the config.ini file, set up a config-server.ini file, and then editied my server.bat file to reflect this.

Thanks for the help!

MADMEYN
Manual Inserter
Manual Inserter
Posts: 3
Joined: Wed Mar 09, 2016 9:47 pm
Contact:

Re: Steam Dedicated Server

Post by MADMEYN »

I have tried following the steps posted by posila, but need some clarification:

I would like to run the headless server as well as play on the same machine, as Lucrin said he can do.

I made another config.ini file and named it config-server.ini. Do I keep both of .ini files in the config folder? Or do I need to move one?

Within the newly created config-server.ini, I changed the line "write-data=__PATH__system-write-data__" to "write-data=__PATH__system-write-data__/server" as suggested by posila.

Then posila says to start the server with the parameter: "-c %appdata%\Factorio\config\config-server.ini"
Where does this parameter go? I'm assuming this is the step that tells the server.bat file to use the config-server.ini instead of the default config.ini. I tried pasting that code before the 'Factorio.exe' code in the server.bat, but that doesn't work.

What am I doing wrong?

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Steam Dedicated Server

Post by posila »

MADMEYN wrote:I made another config.ini file and named it config-server.ini. Do I keep both of .ini files in the config folder? Or do I need to move one?
They can stay in the same folder. Don't forget to change port number in one of the configs otherwise you won't be able to connect to multiplayer while server is running.
MADMEYN wrote:Then posila says to start the server with the parameter: "-c %appdata%\Factorio\config\config-server.ini"
You put this parameter behind Factorio.exe on the same line. I also recommand to use command start /wait to launch Factorio, unless you want it to run entirely as background process.

Code: Select all

start /wait Factorio.exe --start-server YOURSAVEGAME.zip -c "%appdata%"\Factorio\config\config-server.ini
Note: I have put %appdata% into quotes just in case the expanded path contains spaces.

Post Reply

Return to “Multiplayer”