Spielerando

Save and load the game while an item is still being crafted

The autosave fires while the forge is working. After loading, the ingredients are gone and the sword never arrives, or the sword arrives twice. This entry stores the running job with the bag in one piece, finishes a job exactly once, and refuses damaged save data without crashing.

Why this works

A save is only trustworthy if every possible moment of it makes sense by itself. Paying and starting in one step, and finishing and delivering in one step, leaves no gap in which materials can vanish or an item appear twice. Checking what a file contains guards against damaged saves.

When not to use it

Do not store a running job when crafting is instant or the game saves only at calm points, such as between levels. Then there is nothing to keep, and a simpler save is safer. It also does not suit jobs meant to run on in real time while the game is closed.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 4 common mistakes and the fix
  • 42 lines of example code with 4 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "Save and load the game while an item is still being crafted" (read_entry craft-in-progress-survives-save-and-load) in my game. Build it step by step, and show me how you checked that it works.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP