Factorio v0.12 Factorio v0.18
A concept of a factory for the trailer in v0.12 A concept of a factory for the trailer in v0.18

Screenshots of factory concepts for the Factorio 1.0 launch trailer, showcasing the evolution of the game. The Factorio blog covers the process in detail.

factorio-save-upgrader

Tool to upgrade old Factorio game save files to the newest version. Bring on the map nostalgia!

Use this tool at your own risk. Backup your saves first.
The save file format in Factorio is pretty stable. Each Factorio “major” version supports loading save games from one or more previous save file formats. The game will tell you if your save file is too old, otherwise you don’t need to do anything.

The stepwise load/upgrade concept used in factorio-save-upgrader:

  1. Loads (a copy of) the save file in the most recent Factorio version possible, stepwise trying older versions until one works.
  2. Upgrades the saved map step-by-step to the most recent version available.
  3. The upgraded save file is copied to the output directory.
Loading
v2.0   v1.1   v1.0   v0.17  v0.16
❌ ---> ❌ ---> ❌ ---> ✅ ... ❓ ...
                       |
Upgrading              |
v2.0   v1.1   v1.0     |
✅ <--- ✅ <--- ✅ <-----
  • Leaves up-to-date save files alone. Output is written with the same filename but to a different directory. Does not overwrite existing files.
  • Can upgrade all save files in the ./saves directory at once, or one by one.
  • Does not require the full game to be installed. Save file can be transferred to a separate computer where upgrades are performed.
  • Built using Factorio Docker (factoriotools/factorio-docker), originally intented for running dedicated game servers.

Version compatibility

Not all Factorio versions in the official archive have (working) container images. Check the issues for this tool as well as issues for Factorio Docker for possible solutions.

Here is a table of last known status (although it is presumably constantly outdated) for the available Factorio Docker container image versions. Major game versions can also load some older save file formats. For example, Factorio v0.17 also supports upgrading from v0.16 and v0.15.

Version Running Upgrading from Space Age
v2.0
v1.1
v1.0
v0.17
v0.16
v0.15
v0.14
v0.13
v0.12

Upgrading save files to Factorio v2.0+ requires the Factorio: Space Age expansion on the client. The expansion is automatically supported and enable in the save file “server-side” upgrade process, without any additional purchase.

Limitations

  • Factorio has evolved over the years, which may or may not require manual factory fixes.
    • The “vanilla” base game Factorio v2.0 included new rails, train control improvements, circuit network improvements, new fluid system, and much more.
    • Recipes, such as oil processing, may change between versions.
  • Requires Factorio: Space Age for v2.0+.
    • Factorio v2.0 uses mods for Factorio: Space Age (also for elevated rails, qualities) which are available in Factorio Docker.
    • The space age mods are enabled by default, thus all save files upgraded to v2.0+ become space age save files.
    • Loading an upgraded v2.0+ save in “vanilla” base game Factorio may work, but with warnings regarding missing mods — and possibly factory issues.
    • Set FACTORIO_VERSIONS='1.1 1.0' and below to avoid upgrading to v2.0+.
  • Mods configuration is not (yet) supported.
    • Require editing ./mods/mod-list.json inside Factorio Docker.
    • May be used to upgrade “vanilla” base game Factorio 2.0 by disabling space age.
    • Can perhaps be used to upgrade save files with third-party mods; may require additional mod files.
    • Pull requests, including documentation etcetera, welcome.
  • Replay support is untested. Presumably doesn’t upgrade replays, since they are more tightly coupled to the version used for recording. Loading the map may still work, but replaying is not possible.
  • The save preview (screenshot) is lost during automated upgrades. When saving using the full game it is regenerated.
  • This tool doesn’t inspect the savegame.zip files to try to figure out which upgrades might be necessary. Instead it brute-forces the solution by testing the save file against several major versions of Factorio until loading succeeds. The save file is then upgraded step-by-step through each subsequent major version.
  • This tool doesn’t detect when the save file has been successfully upgraded. Instead it waits for 60 seconds (by default) during each step, and then assumes everything went well. Upgrading a large/complex map on a slow machine may take even longer, potentially interrupting the process prematurely. Upgrading a small/simple map on a reasonably fast machine only takes seconds though, so the extra wait may seem unneccessary. Adjust to your liking; see usage.

Requirements

  • Creating backups of your save files before attempting to upgrade them. You don’t want to lose your precious factory, do you?
  • A Unix/Linux system with common programs such as bash, sed, find, sort, mktemp, realpath.
  • Podman (in rootless mode) to run the Factorio Docker container images.

Installation

There’s no real installation step. Just download the code somewhere and execute it in your terminal.

# NOTE: clone the git repository.
git clone https://github.com/joelpurra/factorio-save-upgrader.git

cd factorio-save-upgrader

# NOTE: either run directly from this directory...
./factorio-save-upgrader

# NOTE: ...or optionally symlink to your $PATH for ease of use.
ln --symbolic "${PWD}/factorio-save-upgrader" ~/bin/

factorio-save-upgrader

Usage

Only successfully upgraded files are put in the output directory.

factorio-save-upgrader <output directory> <input directory or file(s)>

Examples assume loading saves from Factorio’s default user data directory location on a Linux system.

Basic examples **Simple backup** You can do better. ```shell cp --recursive ~/.factorio/saves ~/factorio-saves-backup-$(date +%F) ``` **Upgrade all saves to another directory** Afterwards, manually copy the upgraded save files from `~/factorio-upgraded-saves` to `~/.factorio/saves`. ```shell mkdir --parents ~/factorio-upgraded-saves factorio-save-upgrader ~/factorio-upgraded-saves ~/.factorio/saves ```
Advanced examples Use one or more environment variables to change some settings; see the source code for details. **Show verbose output** ```shell FACTORIO_SAVE_UPGRADER_DEBUG_LEVEL='1' factorio-save-upgrader ~/factorio-upgraded-saves ~/.factorio/saves ``` **Shorter map upgrade timeout** A shorter timeout can speed things up if you have many save files, but if your map is too complex or your machine too slow it might fail. You can also increase the timeout, and connect to the game server to verify that the upgrade worked. Start Factorio and connect to address `localhost` from the multiplayer menu. ```shell FACTORIO_TIMEOUT='15s' factorio-save-upgrader ~/factorio-upgraded-saves ~/.factorio/saves ``` **Limit Factorio versions** Ensure versions are listed in descending order, with a single space between. ```shell FACTORIO_VERSIONS='0.13 0.12' factorio-save-upgrader ~/factorio-upgraded-saves ~/.factorio/saves ```
Updating the Factorio Docker container images Because this tool executes images in a loop, it doesn't spend time checking if there are any [updated images on Docker Hub](https://hub.docker.com/r/factoriotools/factorio/). You should perform updates manually if you haven't in a couple of weeks. Advanced users may use custom images; see the source code for details. **Pull updates for all local Factorio images** ```shell podman image ls --format '{{.Repository}}:{{.Tag}}' --filter 'reference=factoriotools/factorio' | xargs --no-run-if-empty --max-lines='1' podman image pull ``` **Delete all local Factorio images to force re-download** This tool does not keep data in images or persistent volumes. Be more careful if you use the images for anything else, such as actually running a game server. ```shell podman image ls --format '{{.Repository}}:{{.Tag}}' --filter 'reference=factoriotools/factorio' | xargs --no-run-if-empty podman image rm ```

factorio-save-upgrader Copyright © 2022, 2023, 2024 Joel Purra. Released under GNU General Public License version 3.0 (GPL-3.0). Your donations are appreciated!