Persistent progression should preserve what the player earned without turning every moment of a survival run into permanent state. In a base-defense game, that distinction matters: an unlocked valley or a camp upgrade may belong to the world, while the enemies currently attacking the gate usually belong only to tonight's run.

If an AI assistant edits an existing project, start by describing what already works and what must remain unchanged. Then add a narrow save boundary around the permanent outcomes. This guide uses an invented pine-valley prototype to explain the design; it does not report a real implementation or playtest.
Separate world progress from tonight's run
Write down which state should survive a restart before asking for code. A useful first pass is to sort every variable into three groups: permanent world progress, session settings, and temporary run state. Do not let the word “progression” silently expand into a full mid-run save feature.
| State | Possible examples | Default save decision |
|---|---|---|
| Permanent world | Region unlocks, researched defenses, permanent camp tiers, banked resources | Persist after a clear checkpoint |
| Player preferences | Audio level, control choice, accessibility option | Persist separately from world progression |
| Current run | Enemy positions, active projectiles, temporary shield, unfinished night | Reset unless mid-run resume is an existing feature |
In the fictional example, clearing a night can unlock the signal tower and bank a reward. The active enemy wave, remaining health of a temporary barricade, and location of each creature reset when a new run starts. That keeps the feature request narrow: retain the world reward while preserving the current day-gathering and night-defense loop.
Use the game's existing terms and identifiers. If the project already has a region ID or upgrade ID, reuse it instead of inventing a second naming system. A save file should record stable meaning, not fragile scene-node paths or display labels that may change with localization.
Inventory the existing project before changing it
Make a baseline from a copy of the project. Note the engine and version, the current save behavior, the main scene, the day-to-night transition, the reward calculation, and the files that own those systems. Capture a short screen recording or screenshots for your own comparison if available. Do not imply that an AI-generated illustration is evidence of that baseline.
Ask the assistant to inspect first and propose a file-level plan. A bounded request might say: preserve the day/night clock, gathering, enemy spawns, controls, and combat; add persistence only for banked materials, unlocked region IDs, and permanent camp upgrade IDs; do not save active enemies or temporary effects; list every file to change before editing. Request a small diff and a rollback note.
Review the plan against the actual project before accepting it. If the current game stores rewards at the end of a night, put the save call at that established boundary rather than in every resource pickup. If the feature introduces a new “complete night” event, verify that the event is not fired twice during a scene transition or restart.
Design a versioned save boundary
Keep serialization details behind one small interface such as load_world_progress() and save_world_progress(snapshot). Gameplay systems should request a value or submit an outcome; they should not independently write pieces of a shared file. This makes it easier to inspect, test, and replace storage code without rewriting combat.
A simple conceptual model might look like this. It is a design example, not a tested save file format:
{
"schema_version": 1,
"world_id": "pine_valley",
"completed_nights": 3,
"banked_materials": {"wood": 42, "ore": 8},
"unlocked_regions": ["pine_valley", "old_quarry"],
"camp_upgrade_ids": ["signal_tower_t1"]
}
Use a schema version from the first release. When the format changes, migration can distinguish an older record from a current one. Prefer stable IDs for region and upgrade records; if an item is renamed for the UI, its save identity can remain the same. Validate values as they are read: reject unknown IDs safely, clamp numbers only where the game rules define a valid range, and fall back to a clean profile if the record cannot be recovered.
Pick storage through the engine's supported user-data mechanism for the export target. Godot's stable documentation recommends user:// for persistent data because packaged project resources may be read-only and the user path is writable. Unity documents Application.persistentDataPath for data retained between runs and notes that its actual location depends on platform. Neither path choice by itself provides cloud synchronization, backups, encryption, or conflict resolution; treat those as separate requirements.

Save at a consistent checkpoint
A reliable checkpoint is a point where rewards and world changes are already settled. For the example, the sequence could be: finish the night, resolve defeat or victory, award banked materials once, unlock any earned permanent upgrade, write one coherent snapshot, then begin the next gathering day. The exact order depends on the existing project; preserve its current behavior and make the sequence explicit.
Consider an interrupted write. A conservative design can write a new temporary file, validate that it can be read, and then replace the prior save, keeping one recoverable copy if the platform permits. Avoid promising perfect safety across every device or storage failure. Decide how the game should behave if the save directory is missing, a write fails, or the file is malformed: show a clear message, preserve the old data when possible, and avoid silently granting rewards twice.
Keep the checkpoint idempotent where possible. If the scene reloads after the save, the same completed-night event should not add the reward again. One approach is to store the completed run identifier or checkpoint marker with the snapshot, then clear it only after the next state is established. Fit this to the project's architecture rather than adding a new event system for one feature.
Ask AI for a small and reversible change
Give the assistant a clear contract: files allowed to change, state that must persist, state that must reset, save timing, existing systems to preserve, and the exact checks you expect. Ask it to explain any assumptions before it edits. Afterward, compare the diff with the plan, inspect the serialization code, and search for writes outside the intended save boundary.
Keep the old project copy and a sample old save. Do not let a new build overwrite your only known-good save during early checks. If the assistant proposes replacing the game loop, changing resource balance, or rewriting combat to simplify persistence, narrow the request and ask for a smaller patch.
Verify fresh, returning, and recovery cases
A successful launch is only one check. Use a small matrix and record the build, platform, steps, expected result, observed result, and whether the profile was fresh or migrated. The example below is a test plan template, not a report of tests already run.
| Case | Setup | Expected observation |
|---|---|---|
| Fresh profile | Remove or rename the test save | Game starts with the documented default camp and no stale unlocks |
| Completed night | Earn one permanent reward and reach the checkpoint | Reward is banked once; the existing loop transitions as before |
| Returning profile | Quit cleanly and relaunch | Permanent unlock returns; temporary wave and buffs do not |
| Older schema | Load a copied save from the prior version | Migration preserves known progress and records the new schema version |
| Bad or interrupted file | Use a disposable malformed copy or interrupt a test write safely | Recovery behavior is understandable and does not duplicate rewards |
Also compare the original project and changed build side by side. Confirm that gathering controls, enemy timing, night transitions, and upgrade costs remain unchanged unless a change was explicitly part of the feature. Repeat on each target platform because writable paths and export behavior differ. Keep the test notes with the patch; do not turn a plan into a claim that it passed.

Frequently asked questions
What should persist between sessions in a base-defense survival game?
Persist deliberate world outcomes such as unlocked regions, permanent camp upgrades, and banked resources. Keep current enemy positions, temporary effects, and an unfinished night run out of the save unless the game already supports mid-run saves. This keeps rewards intentional and makes the next session easy to explain.
Where should a Godot game store player progression?
Godot's stable documentation recommends the user:// path for persistent player data because project resources may be read-only in a running export and user:// is writable. Check the current documentation and target platform before choosing a storage design. The selected storage path does not choose or validate the save format.
How can I avoid breaking existing saves when adding progression?
Add a schema version, assign stable IDs to unlocks and upgrades, and make migration explicit. Preserve a copy of the old save, load it with the new build, and verify known progress before overwriting the original. Test the migration on a disposable copy before opening the player's only save.
When should the game save a completed night?
Save at a deliberate checkpoint after the night outcome is finalized and before the next day begins. Avoid writing partial rewards in several unrelated systems; commit one consistent progression snapshot and keep a recoverable prior file. Choose a boundary that the existing game can reach exactly once.
Does a successful load prove the save system is safe?
No. Also test a new profile, a completed-night save, a missing or malformed file, an older schema, and an interrupted write. Verify the day-night loop and rewards after each case on the target platform. Keep each result in notes; the plan alone is not proof of a passing test.
Keep persistence small enough to trust
Start with the smallest permanent state that makes the world feel like it moved forward. A versioned snapshot, one deliberate checkpoint, a migration plan, and a few repeatable cases are easier to review than a save system tied to every combat event. Once that slice is stable in the real project, extend it deliberately.
If you want to explore a separate browser-playable game idea, try SEELE AI Game Maker. This is a separate prototype path; it is not presented as a tool for editing or repairing an existing project.


