Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Built a tool to upgrade old Factorio game save files to the newest version, using factoriotools/factorio #440

Open
joelpurra opened this issue Jul 11, 2022 · 0 comments

Comments

@joelpurra
Copy link

Soooo, during the weekend I thought of continuing playing this one amazing (not really) map I worked on a couple of years ago. Already knew that the save file was outdated and could not be loaded in Factorio 1.1. While I only wanted to upgrade a single save file, I ended up hacking together a small tool for it. (Please don't tell me there's a well-known tool which already does this...)

https://github.com/joelpurra/factorio-save-upgrader

It's basically a single Bash script; Linux support only. Much more convenient than manual steps, including simply switching versions in Steam, for batch upgrading everything in (for example) ~/.factorio/saves/

Here's the concept:

Loading
1.1   1.0   0.18   0.17   0.16
❌ --> ❌ --> ❌ --> ✅ ... ❓ ...
                    |
Upgrading           |
1.1   1.0   0.18    |
✅ <-- ✅ <-- ✅ <----
Sample log output
2022-07-11T18:14:42+02:00 factorio-save-upgrader INFO: Upgrading save file: '/home/user/.factorio/saves/map.zip'
2022-07-11T18:14:42+02:00 factorio-save-upgrader INFO: Attempting to load save in Factorio docker image 'factoriotools/factorio:1.1' (timeout 10s)
2022-07-11T18:14:44+02:00 factorio-save-upgrader INFO: Failed when using 'factoriotools/factorio:1.1'
2022-07-11T18:14:44+02:00 factorio-save-upgrader INFO: Attempting to load save in Factorio docker image 'factoriotools/factorio:1.0' (timeout 10s)
2022-07-11T18:14:46+02:00 factorio-save-upgrader INFO: Failed when using 'factoriotools/factorio:1.0'
2022-07-11T18:14:46+02:00 factorio-save-upgrader INFO: Attempting to load save in Factorio docker image 'factoriotools/factorio:0.18' (timeout 10s)
2022-07-11T18:14:48+02:00 factorio-save-upgrader INFO: Failed when using 'factoriotools/factorio:0.18'
2022-07-11T18:14:49+02:00 factorio-save-upgrader INFO: Attempting to load save in Factorio docker image 'factoriotools/factorio:0.17' (timeout 10s)
2022-07-11T18:15:00+02:00 factorio-save-upgrader INFO: Succeeded when using 'factoriotools/factorio:0.17'
2022-07-11T18:15:00+02:00 factorio-save-upgrader INFO: Attempting to load save in Factorio docker image 'factoriotools/factorio:0.18' (timeout 10s)
2022-07-11T18:15:11+02:00 factorio-save-upgrader INFO: Succeeded when using 'factoriotools/factorio:0.18'
2022-07-11T18:15:12+02:00 factorio-save-upgrader INFO: Attempting to load save in Factorio docker image 'factoriotools/factorio:1.0' (timeout 10s)
2022-07-11T18:15:23+02:00 factorio-save-upgrader INFO: Succeeded when using 'factoriotools/factorio:1.0'
2022-07-11T18:15:23+02:00 factorio-save-upgrader INFO: Attempting to load save in Factorio docker image 'factoriotools/factorio:1.1' (timeout 10s)
2022-07-11T18:15:34+02:00 factorio-save-upgrader INFO: Succeeded when using 'factoriotools/factorio:1.1'
2022-07-11T18:15:35+02:00 factorio-save-upgrader INFO: Loaded the save file in version 0.17, then upgraded it to version 1.1: '/home/user/saves-upgraded/map.zip'

The tool uses the factoriotools/factorio images and iterates over the major Factorio versions by tag. First it loads (a copy of) the save in the most recent version possible, then upgrades it stepwise to the most recent version available. After shutting down the last instance the map is fully upgraded, and the modified file is put in the output directory.

Seems to work well enough, at least for medium-sized maps down to 0.16. Only tested on a tiny map for 0.15, and nothing older. There are crashes in entrypoint.sh in some older versions (#430) but looks fixable. Who can confirm if 0.15 (or older) works for complex maps?

Thanks for dockerizing Factorio, it is very useful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant