43 · Saves · 2D and 3D

Save and load

Keep progress, and survive your own updates.

Saving means turning the game state into data (usually JSON) and writing it somewhere. Loading means reading it back. The part that bites later is updates: rename a field or add a new one and old saves load as garbage or crash. Putting a version number in every save and upgrading old ones fixes that.

←→ moveS saveL loadU ship an updateUse the buttons

Try this: Grab some coins, Save, then Ship update v2 and Load. With versioning off, your coins are lost. Turn versioning on and repeat.

Game version v1Coins 0

Collect coins, then save. The save is stored in this browser only.

Prompt bit

Works for 2D or 3D in any engine (Unity, Unreal, Godot, web). Paste the short one for a quick fix, or the detailed one when you want it done properly.

Add versioned saves: serialize only game data to JSON with a version number, write to a temp file then rename, autosave at most every 30 s, and run migration functions on load so saves from older versions upgrade instead of crashing or losing progress.

44 words · one sentence to paste as is

Where it's used

Common mistakes

No version number (every update risks breaking saves), saving engine objects instead of plain data, writing directly over the only save file, and autosaving at dangerous moments such as mid-fall.

Writing this with an AI assistant? See our best AI coding assistants for game developers.

Missing a concept? Request one.

Related concepts

New concepts, in your inbox.

One short email when we add new concepts, plus our weekly roundup of AI tools for game devs. Unsubscribe any time.