If you haven’t yet played Factorio, I think you should. Especially if you have any interest in logistics problems, circuit design, or coding. Sure, you don’t do any coding or circuit design in Factorio, but the main gameplay loop will have you tackling similar problems.
Enter DigitalOcean1. For ~$5 a month, you can have your own self-hosted Factorio server that can handle around ~5 concurrent players without and problems.
Let’s get started.
Setting up your Droplet
- Make an account on DigitalOcean and add your payment details to be able to create droplets2.
- Go to your “Droplets” page and click
Create a New Droplet. - Select
Ubuntu 14.04as your Droplet image. - Select the
$5 / monthtier for your Droplet size. - Select the closest datacenter region to where the majority of your players will be located.
- Enter a sensible name in the
hostnamebox, and click create. - Give DigitalOcean a few minutes to setup and configure your Droplet.
- Once configured, go into your Droplet and copy/record your
IPv4address.
- Now you’ll need to SSH into your droplet:
-
Mac (& Linux): Open Terminal (it’s in your Utilities folder) and run
ssh root@YOUR_IP_ADDRESS -
Windows: Download and install PuTTY and follow this guide for setting up an SSH session at
root@YOUR_IP_ADDRESS
-
- Check your email for the root
password. DigitalOcean sends you an email with the default root password. - Create a sensibly secure password when you are prompted to do so.
Setting up your Server
-
Go to the Factorio Download Page for the headless server package and download the
.tar.gzto your local machine. -
Now you’ll use SFTP to upload the server files to your Droplet.
- Mac: Open a new Terminal. Run
sftp root@YOUR_IP_ADDRESS. - Windows: Follow this guide to get a PSFTP shell running at
root@YOUR_IP_ADDRESS. Login with your password.
After getting into your Droplet with SFTP, run
put /path/to/your/server/download/factorio_headless_x64_.X.X.X.tar.gzafter filling in the correct file path and name for the server
tar.gzthat you downloaded in step 1. (This will be a local path on your computer, something like/Users/<YOUR_USERNAME>/Downloads/factorio_headless_x64_X.X.X.tar.gzif you’re on a Mac)
- Mac: Open a new Terminal. Run
-
Go back to your SSH shell. If you run
lsyou’ll see that the servertar.gzis in you’re root directory! -
Run
tar -zxvf factorio_headless_x64_.X.X.X.tar.gzto unzip the server files. -
Run
cd factorioto enter your server folder. -
Run
./bin/x64/factorio --create MAPto create a map namedMAP3. -
Run
nano start.shand copy in the following code:#!/bin/sh ./bin/x64/factorio --latency-ms 150 --autosave-interval 2 --autosave-slots 10 --disallow-commands --start-server MAP(Of course, these settings can be customized to your liking. You can see all the available settings by running
./bin/x64/factorio --help) -
Type
Ctrl-XthenYto save and exitnano. -
Run
chmod +x start.shto makestart.shexecutable.
Running your server
- Run
./start.shto start your server. (Remember: When you first connect to your Droplet, you’ll need to docd factorioto get into your server folder) - Launch Factorio on your PC. Click
Play -> Multiplayer -> Connect to Game. - Paste in your newly minted IP (the same one as you used for
SSHandSFTP), and you’re good to go!
Good luck, and have fun. Factorio is a super addicting, afternoon-consuming type of game, so get ready to spend a lot of time in this new server.
-
Though I write about how to do this with DigitalOcean, you could easily run these same settings on AWS, or perhaps even a RaspberryPi with similar results. ↩︎
-
‘Droplets’ are DigitalOcean’s naming convention for server instances. ↩︎
-
You can customize your map name, or upload a custom map to the
/factorio/saves/folder if you wish. ↩︎