Use case · Game server

A Factorio dedicated server on bare metal

A Factorio dedicated server is the free headless build for Linux x64 from factorio.com, run as its own user, listening on UDP 34197. Factorio multiplayer is lockstep: every instance, server and clients alike, simulates the entire world and only player actions cross the network, so the server needs the same single-thread speed a player's PC needs for that factory, and very little bandwidth.

See game servers

What lockstep means for the hardware

The official wiki describes the engine as a lockstep architecture in which all instances run full simulations of the entire world and only player actions travel over the network. Two consequences follow. The server does not do the heavy lifting for weak clients: a factory too big for a player's PC is too big for that player, wherever the server runs. And the server is as CPU-bound as any client, so single-thread speed decides how large a factory it holds at full speed.

Memory follows the save size and the mods loaded. The wiki publishes no server-specific figures, so test with your actual save: start it headless and watch CPU and resident memory as the factory runs.

Installing the headless server

  1. Create a dedicated factorio user; the wiki suggests a separate user to harden the setup.
  2. Download the headless package from factorio.com and extract it to /opt/factorio. It contains no graphics or sounds.
  3. Copy data/server-settings.example.json to data/server-settings.json and edit it.
  4. Create a save with --create, then start the server on it and allow UDP 34197.
sudo useradd -r -m -d /opt/factorio factorio
wget -O /tmp/factorio.tar.xz https://factorio.com/get-download/stable/headless/linux64
sudo tar -xJf /tmp/factorio.tar.xz -C /opt
sudo chown -R factorio:factorio /opt/factorio

cd /opt/factorio
sudo -u factorio cp data/server-settings.example.json data/server-settings.json
sudo -u factorio ./bin/x64/factorio --create ./saves/world.zip
sudo ufw allow 22/tcp && sudo ufw allow 34197/udp && sudo ufw enable
sudo -u factorio ./bin/x64/factorio --start-server-load-latest --server-settings ./data/server-settings.json

--start-server-load-latest picks up the newest save in saves, autosaves included, which is what a service unit should run after a restart. Put that line in a systemd unit as the factorio user with Restart=on-failure.

server-settings.json

  • name, description, tags: what the server browser shows.
  • visibility: public, LAN, or neither. Public listing needs a factorio.com username plus a password or, preferably, an authentication token.
  • game_password: required to join.
  • max_players: 0 means no limit.
  • User verification: whether players' factorio.com identities are checked.

By default the game pauses while nobody is connected ("auto_pause": true). Set "auto_pause": false to keep the factory running while everyone is away, so biters, trains and production carry on.

Admins and saves

Admin rights come from server-adminlist.json, a list of usernames in the same directory as factorio-current.log. The file is also written when an admin promotes a player from the console. Saves are plain zip files in saves/; copy them off the machine on a schedule, with the mod set beside them.

Why a whole machine

Lockstep makes the server's per-tick time everyone's per-tick time: if the server falls behind, the game slows for all. On our bare metal game servers no hypervisor or neighbour takes cycles from the simulation. Pick the machine by single-thread performance; the Intel Xeon range lists every processor by generation and clock. Machines are HPE enterprise hardware in New York, Miami, San Francisco, Amsterdam or Bucharest.

A racked machine is live about 30 minutes after the order is approved; a build to order takes 4-24 hours. The port is unmetered and support is staffed 24/7.

When hosting from the game is enough

Players can host from the game client, and for a group that always plays together that is simpler. Run it dedicated when the world must stay joinable with the host offline, for a group spread over several time zones, or for a public server that has its own admin list. See also our Satisfactory page for the other factory game.

Questions

Which port does a Factorio server use?

UDP 34197. The official wiki states that Factorio uses UDP only, so a TCP rule does nothing.

Do I need to own Factorio to run the headless server?

No. The headless Linux build is a free download from factorio.com. Players still need the game, and a public listing needs a factorio.com account's username and token.

Why does my factory freeze when everyone leaves?

The server pauses while no players are connected, by default. Set "auto_pause": false in server-settings.json if it should keep running.

How do I make myself an admin?

Create server-adminlist.json with your username, in the same directory as factorio-current.log. Existing admins can promote players from the console, which writes the same file.

Will a faster server fix lag for a slow client?

No. Every instance simulates the whole world, so a client whose PC cannot keep up with the factory falls behind regardless of the server.

How do I restart on the latest save?

Start with --start-server-load-latest and --server-settings, which loads the newest save in the saves folder, autosaves included.

Give the factory its own machine

Bare metal in five cities, the whole CPU to yourself, unmetered port, month to month.

See game servers

Related on Server Room

Other use cases