Last hope: blueprint library recovery from save file. (v1.1.9+)

Post all other topics which do not belong to any other category.
Post Reply
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 1567
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Last hope: blueprint library recovery from save file. (v1.1.9+)

Post by boskid »

Introduction
Recently v453000 asked me about options to recover blueprints of a player that lost his blueprint library (viewtopic.php?p=530872#p530872). I looked at possible options and there were not many, however thinking a little more lead me to the simple conclusion: when blueprints from library are used in game, they are transferred so all the players have a copy of imported blueprint so it has to be part of a game state and be included inside of the save file. They are there and should be possible to be extracted. Only reason why they were not possible to be extracted was that when a player joins with an empty blueprint library, there is a blueprint library synchronization happening which removes all the blueprints that player does not have. From this a simple idea started to grow: if the synchronization would be bypassed (would not happen), it would be possible to get hands on the blueprints inside of a save file and take them out.
Limitations
This approach has some limitations. When player joins the game, synchronization is able to delete blueprints but it does not transfer new ones: it only creates a preview of a blueprint because blueprints contain entity data which can take a lot of space. Blueprints that are in the preview state are not part of the game state yet so they cannot be recovered using this approach.
The way
In the main menu, click "Settings" while holding both Ctrl and Alt. Modifiers are required to expose "The rest" part with all the hidden switches.
bprec-main-menu.png
bprec-main-menu.png (32.13 KiB) Viewed 2155 times
In settings go to "The rest"
bprec-settings.png
bprec-settings.png (81.6 KiB) Viewed 2155 times
Inside of the "Other settings" enable the "bypass-library-sync" option
bprec-bypass-on.png
bprec-bypass-on.png (2.88 KiB) Viewed 2155 times
Go back to the main menu and open a save file from which you want to extract blueprints.
bprec-load.png
bprec-load.png (6.26 KiB) Viewed 2155 times
While in game, open the blueprint library. There will be a warning "Blueprint library is not synchronized" to inform that the blueprint library here is not synchronized with player's own blueprint storage so none of the blueprints from player's blueprint storage are shown here. This also works in opposite direction: changes here will not get saved to the player's own blueprint storage.
bprec-library.png
bprec-library.png (90.39 KiB) Viewed 2155 times
From this point you can take a look at the blueprints and transfer them out. Simplest way is to empty the inventory, Control+Left click on empty slot in the library to transfer all blueprints to the inventory, create an empty blueprint book inside of the Game Blueprints, open that book, transfer all the blueprints from inventory to the book (Control+Left click on empty inventory slot) and then export that book to the string.

Alternative approach is to transfer blueprints to the inventory or to the Game Blueprints and save the game at that state. After disabling "bypass-library-sync" hidden option you can then load that save file and transfer those blueprints back to the "My Blueprints" which at this point will be synchronized (there should be no "Blueprint library is not synchronized" warning)

Cleanup: do not forget to disable "bypass-library-sync" option (first 3 steps).
Final notes
This way is intended to be only a last resort because it does not help with recovery of blueprints that were not transferred to the game state. Keep in mind that blueprint library uses binary format that is evolving with the game itself so older game versions are unable to read blueprint library made by newer versions. Every time you want to downgrade the game, the blueprint library will be lost (however there should be a backup made which may require manual file renaming to make backup to be the active one). When there are preview-only blueprints in the library, there may be some unintended behaviors happening when those blueprints are requested to be transferred: starting from importing a blueprint from the player's own blueprint library ending on the crashes because blueprint with the given ID does not exist in the player's own blueprint library.

Diablo
Inserter
Inserter
Posts: 42
Joined: Thu Apr 21, 2016 12:35 pm
Contact:

Re: Last hope: blueprint library recovery from save file. (v1.1.9+)

Post by Diablo »

I just wanted to say here again, thank you so much for helping me out with this.
It means more then I can express here.

THANK YOU!

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12265
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Last hope: blueprint library recovery from save file. (v1.1.9+)

Post by ssilk »

Would/should have been a nearly perfect FFF.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
NotRexButCaesar
Smart Inserter
Smart Inserter
Posts: 1046
Joined: Sun Feb 16, 2020 12:47 am
Contact:

Re: Last hope: blueprint library recovery from save file. (v1.1.9+)

Post by NotRexButCaesar »

ssilk wrote:
Sat Jan 16, 2021 8:37 am
Would/should have been a nearly perfect FFF.
No gif means no FFF. (Devs are never sarcastic and always tell the 100% truth with no jokes)
talk on discord
: Alea jacta est. Determine what you intend to accomplish with an action before execution.
Have you ever heard the gospel? Most have not.

quinor
Filter Inserter
Filter Inserter
Posts: 401
Joined: Thu Mar 07, 2013 3:07 pm
Contact:

Re: Last hope: blueprint library recovery from save file. (v1.1.9+)

Post by quinor »

That's the most factorio devs' thing I've seen in a long time. Come on, can you set the standarts any higher...?! Absolutely love the attention.

Marco3104
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Sep 05, 2019 4:03 pm
Contact:

Re: Last hope: blueprint library recovery from save file. (v1.1.9+)

Post by Marco3104 »

This Post literally saved me many hours of work. Thank you very much!

mrfox113
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sat May 08, 2021 4:17 pm
Contact:

Re: Last hope: blueprint library recovery from save file. (v1.1.9+)

Post by mrfox113 »

Hello,

i tryd this, but after 5 bps into my inventory, the game crash.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12265
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Last hope: blueprint library recovery from save file. (v1.1.9+)

Post by ssilk »

You can make a bug report, please.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 1567
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Last hope: blueprint library recovery from save file. (v1.1.9+)

Post by boskid »

mrfox113 wrote:
Sat May 08, 2021 4:24 pm
Hello,

i tryd this, but after 5 bps into my inventory, the game crash.
You are most likely trying to transfer a preview-only blueprint for which this method does not work. This was mentioned in the "limitations" part and in the "final notes" part. This is highly experimental "feature" and in case of a crash happening because of a misuse of it and following bug reports, i would rather remove this feature entirely rather than fixing it.

Ambaire
Fast Inserter
Fast Inserter
Posts: 157
Joined: Fri Jun 26, 2015 11:37 pm
Contact:

Re: Last hope: blueprint library recovery from save file. (v1.1.9+)

Post by Ambaire »

boskid wrote:
Fri Jan 15, 2021 11:00 am
Only reason why they were not possible to be extracted was that when a player joins with an empty blueprint library, there is a blueprint library synchronization happening which removes all the blueprints that player does not have.
But why remove them?

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 1567
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Last hope: blueprint library recovery from save file. (v1.1.9+)

Post by boskid »

Ambaire wrote:
Fri Jun 04, 2021 3:36 pm
boskid wrote:
Fri Jan 15, 2021 11:00 am
Only reason why they were not possible to be extracted was that when a player joins with an empty blueprint library, there is a blueprint library synchronization happening which removes all the blueprints that player does not have.
But why remove them?
Because player does not have them in local storage so they must have been removed intentionally.

Ambaire
Fast Inserter
Fast Inserter
Posts: 157
Joined: Fri Jun 26, 2015 11:37 pm
Contact:

Re: Last hope: blueprint library recovery from save file. (v1.1.9+)

Post by Ambaire »

boskid wrote:
Fri Jun 04, 2021 6:16 pm
Ambaire wrote:
Fri Jun 04, 2021 3:36 pm
boskid wrote:
Fri Jan 15, 2021 11:00 am
Only reason why they were not possible to be extracted was that when a player joins with an empty blueprint library, there is a blueprint library synchronization happening which removes all the blueprints that player does not have.
But why remove them?
Because player does not have them in local storage so they must have been removed intentionally.
Or the save was shared with another who would naturally not have those blueprints in local storage.

Post Reply

Return to “General discussion”