Dedicated Server Guide on Windows

Find multiplayer games.
Tools/scripts to run a dedicated server.
skalibran
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sun Jul 05, 2015 1:34 pm
Contact:

Dedicated Server Guide on Windows

Post by skalibran »

Note: Some of the information in this thread is a little bit outdated, see the Wiki - Multiplayer for more up-to-date info on servers and multiplayer in general.
-- daniel34


Hey there,

I've seen some players wondering on how to set up a headless/dedicated server on Windows. For Unix, see this topic.

Setting up a Factorio server using Windows is very easy.
  • Go to your Factorio.exe folder (Probably 'C:\Program Files\Factorio\bin\x64\')
  • Create a text document and write into it: start Factorio.exe --start-server YOURSAVEGAME.zip
  • If you haven't already done, replace YOURSAVEGAME with, guess what, your save game ;)
  • Save the file as server.bat. Important: At 'Save as type:' select 'All Files'
  • Now you can use the server.bat to start your server. Isn't it easy?
  • Forward Ports: You will find detailed instructions for your specific router on the web. Sorry that I can't give detailed infos here :(
  • Now to the most important part: Enjoy your server!

Important: There is no feedback that the server is running except the factorio.exe in the task manager. That means you won't see a window or a console!
This can be changed by adding /wait to the .bat-file, for example:
start /wait Factorio.exe --start-server YOUR_SAVE.zip
Thanks to posila for this information!

If a topic like this already exists, I'm sorry. Just want to help!
Last edited by skalibran on Tue Jul 21, 2015 12:51 pm, edited 1 time in total.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Dedicated Server Guide on Windows

Post by ssilk »

I made this sticky, due to authors request, but to be honest, this doesn't make sense for me. :)

The wiki should be used for that kind of information, cause - as you already see - the old docs are not actual anymore. Or you don't see, if they are actual, cause they don't have a history and a date of last change.

So, if you want to do this board a good, please move such infos into the wiki. The right place seems to be below https://forums.factorio.com/wiki/inde ... ultiplayer
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
skalibran
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sun Jul 05, 2015 1:34 pm
Contact:

Re: Dedicated Server Guide on Windows

Post by skalibran »

Hey there,

thanks for making it sticky. I think it does make sense, because people can ask questions specifically for windows servers :D
I requested a wiki account and will - if accepted - add the server guide later this day.

Regards,

skalibran
Boogalo
Inserter
Inserter
Posts: 24
Joined: Thu Dec 04, 2014 12:42 pm
Contact:

Re: Dedicated Server Guide on Windows

Post by Boogalo »

I thought I tried that combination of command lines last night, but must not have had it quite right. Seems to be working. :D

One issue I have might be rare, but affects my setup. I have a server I run a few games on from my house, sharing a single external IP. Ports forwarded to the box running the server. External people can connect just fine, but I can't connect from another machine on my local network. I believe this is due to everything still working peer to peer. I had to set up a port forward on my router so external folks can connect, but then all traffic on that port goes to the server, and none to my client, and thus it can't talk to other players. I can't see a way around this other than a server working on one port, and clients talking port+1 or something (would need to be coded for it). I understand this is a limitation how the multiplayer works in that a headless server is just a characterless client with no GUI.
skalibran
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sun Jul 05, 2015 1:34 pm
Contact:

Re: Dedicated Server Guide on Windows

Post by skalibran »

Detnom
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sat Jul 18, 2015 8:46 pm
Contact:

Re: Dedicated Server Guide on Windows

Post by Detnom »

Boogalo wrote:I thought I tried that combination of command lines last night, but must not have had it quite right. Seems to be working. :D

One issue I have might be rare, but affects my setup. I have a server I run a few games on from my house, sharing a single external IP. Ports forwarded to the box running the server. External people can connect just fine, but I can't connect from another machine on my local network. I believe this is due to everything still working peer to peer. I had to set up a port forward on my router so external folks can connect, but then all traffic on that port goes to the server, and none to my client, and thus it can't talk to other players. I can't see a way around this other than a server working on one port, and clients talking port+1 or something (would need to be coded for it). I understand this is a limitation how the multiplayer works in that a headless server is just a characterless client with no GUI.
I'm having a similar issue as you, except I can connect just fine if nobody else is on the server. However when I'm on the server, nobody else can connect. If I logout, my friend can connect, but then I can't. It's quite a puzzler.
Boogalo
Inserter
Inserter
Posts: 24
Joined: Thu Dec 04, 2014 12:42 pm
Contact:

Re: Dedicated Server Guide on Windows

Post by Boogalo »

Detnom wrote: I'm having a similar issue as you, except I can connect just fine if nobody else is on the server. However when I'm on the server, nobody else can connect. If I logout, my friend can connect, but then I can't. It's quite a puzzler.
It makes sense that it behaves this way, since the server is just a client and everything still works peer to peer still, you get the conflicts when data through a port needs to go to both machines behind NAT, but port forwarding router can only send to one. I assume it will take a modification of the netcode to fix, which might not be feasible.

Bug report: https://forums.factorio.com/forum/vie ... =7&t=13634
There seem to be a couple duplicate threads as well.
User avatar
Teck1015
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Jul 19, 2015 12:00 am
Contact:

Re: Dedicated Server Guide on Windows

Post by Teck1015 »

Perhaps you guys can help me, I managed to get the "server" running, but how do I go about running two instances of Factorio.exe (ON THE SAME MACHINE!) so I can actually test the server??
Thanks in Advance
~Tempus Fugit
Boogalo
Inserter
Inserter
Posts: 24
Joined: Thu Dec 04, 2014 12:42 pm
Contact:

Re: Dedicated Server Guide on Windows

Post by Boogalo »

Teck1015 wrote:Perhaps you guys can help me, I managed to get the "server" running, but how do I go about running two instances of Factorio.exe (ON THE SAME MACHINE!) so I can actually test the server??
Thanks in Advance
At the moment, you can't from the same machine. Headless only seems to work in the situation where it is on a network or computer you're not trying to play from in addition to other people not on your network.
gr0mpel
Fast Inserter
Fast Inserter
Posts: 110
Joined: Fri May 03, 2013 6:23 pm
Contact:

Re: Dedicated Server Guide on Windows

Post by gr0mpel »

runnings to instances is possible with software like "sandboxie".
start the server, and then the normal game with this software. however it isnt possible to join the server.
there is a error message " local port xxxx is already used by another instance of factorio".

EDIT:
disclaimer: not tested with multiple people!
i didnt give up on this, and with a hint in another topic i found a solution.

change the port manually in the config.ini
start the server.bat in the sandbox
start factorio and join your server (with the home-ip adress)
Codec
Burner Inserter
Burner Inserter
Posts: 16
Joined: Sun Jul 19, 2015 7:50 pm
Contact:

Re: Dedicated Server Guide on Windows

Post by Codec »

Does anyone know how to set the auto-save interval or the latency setting? My server seems to be auto-saving every 2 mins and any one with a ping higher than about 100 just cant be on the server.
Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: Dedicated Server Guide on Windows

Post by Oxyd »

You can use the --autosave-interval and --latency parameters on the command line.

E.g.

Code: Select all

factorio.exe --start-server map --autosave-interval 10 --latency 12
This will set autosave interval to 10 minutes and latency to 200 ms. The --latency parameter is in ticks, so that's how you go from 12 to 200 ms. (There's 60 ticks in a second.)
posila
Factorio Staff
Factorio Staff
Posts: 5371
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Dedicated Server Guide on Windows

Post by posila »

Dev tip: if you change the command in start.bat to

Code: Select all

start /wait Factorio.exe --start-server YOUR_SAVE.zip
there will be console window and you will see some output from Factorio running (or errors if it didn't like parameters you passed in). Also I recommand to add command "pause" on the second line of the bat file, in order to keep console open even after Factorio exits. That way you will be able to see errors in console and won't need to hunt them down in log files.
kagurazaki
Burner Inserter
Burner Inserter
Posts: 15
Joined: Thu May 29, 2014 6:11 pm
Contact:

Re: Dedicated Server Guide on Windows

Post by kagurazaki »

i am having a problem with my server not saveing anything, i have set the auto save interval to 5, i make a few changes and wait for over 5 min then close and start the server, but nothing saved. can anyone help me?
Bisa
Filter Inserter
Filter Inserter
Posts: 450
Joined: Fri Jul 17, 2015 3:22 pm
Contact:

Re: Dedicated Server Guide on Windows

Post by Bisa »

ssilk wrote:So, if you want to do this board a good, please move such infos into the wiki. The right place seems to be below https://forums.factorio.com/wiki/inde ... ultiplayer
skalibran wrote:Added the guide to the wiki:
https://forums.factorio.com/wiki/inde ... ess_server
In that case, just edit the first post and point readers to the wiki? Else I suspect many will simply read the first post - and skip to the "reply" button whenever they ave a problem rather than first checking the updated source. I fully agree that keeping the topic to discuss/get help is a nice approach but then the first look on the topic kinda needs to also ensure people read the updated source.
Hosting a factorio server? Take a look at this || init script ||.
kotoroshinoto
Manual Inserter
Manual Inserter
Posts: 1
Joined: Tue Sep 29, 2015 9:34 pm
Contact:

Re: Dedicated Server Guide on Windows

Post by kotoroshinoto »

I tried to follow these instructions, but when I go to start the server, the console window opens and immediately closes. When I run the same command from the command prompt, nothing happens, no error message, no console logs, just nothing.

I'm in win10 PRO x64

(it is also not listing factorio.exe as an active process)

I have tried it without using the start command as well. I know my way around a console.
maisel16
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sun Sep 06, 2015 4:52 pm
Contact:

Re: Dedicated Server Guide on Windows

Post by maisel16 »

Thanks it works FINE :) on 0.12.15 Windows Server 2012 R2.

Anybody a idea how task Scheduler for restart setting? Factorio is not stable 24/7 it need restart all 6-12 Houers.
I try it now :S

Thanks bro.

Goldener_WolF :)
maisel16
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sun Sep 06, 2015 4:52 pm
Contact:

Re: Dedicated Server Guide on Windows

Post by maisel16 »

kotoroshinoto wrote:I tried to follow these instructions, but when I go to start the server, the console window opens and immediately closes. When I run the same command from the command prompt, nothing happens, no error message, no console logs, just nothing.

I'm in win10 PRO x64

(it is also not listing factorio.exe as an active process)

I have tried it without using the start command as well. I know my way around a console.
Have you in the right ordner? the Batch file by Factorio.exe?

and create a new savegame? For start a server?
Zimme2579
Burner Inserter
Burner Inserter
Posts: 12
Joined: Wed Apr 15, 2015 2:05 am
Contact:

Re: Dedicated Server Guide on Windows

Post by Zimme2579 »

maisel16 wrote:
kotoroshinoto wrote:I tried to follow these instructions, but when I go to start the server, the console window opens and immediately closes. When I run the same command from the command prompt, nothing happens, no error message, no console logs, just nothing.

I'm in win10 PRO x64

(it is also not listing factorio.exe as an active process)

I have tried it without using the start command as well. I know my way around a console.
Have you in the right ordner? the Batch file by Factorio.exe?

and create a new savegame? For start a server?
I am having the same problem but I don't know my way around a console and was wondering if you could help.
I have fixed this problem but encountered another. How do i host a game and play a game on the same machine?
Bisa
Filter Inserter
Filter Inserter
Posts: 450
Joined: Fri Jul 17, 2015 3:22 pm
Contact:

Re: Dedicated Server Guide on Windows

Post by Bisa »

Zimme2579 wrote:I have fixed this problem but encountered another. How do i host a game and play a game on the same machine?
Depends
- if you are hosting and running within the same environment you have to change the port on either one of the factorio instances
- if you want to also allow others on your lan to connect it should be fine, ie if you can set up a vm to run factorio you could run of the vms ip and not your local... but thats a bit overkill, just change the port =P
Hosting a factorio server? Take a look at this || init script ||.
Post Reply

Return to “Multiplayer / Dedicated Server”