Auto-save a BPVerse farm at dawn with a versioned Unreal SaveGame
Section titled “Auto-save a BPVerse farm at dawn with a versioned Unreal SaveGame”- Status: current.
- Engine: ue6-main
61e2877e, Linux x86_64, Epic clang 23.1.5 (v27 SDK). - Context: Standalone UE6, native farm actors with BPVerse callbacks, Linux Development package.
- Prerequisites: A native game mode, native farm state, stable actor IDs and the fixed-step dawn order.
Symptom
Section titled “Symptom”The same farm needs to restore its day, coin jar and flock when a new packaged process starts. Runtime actors, sleeping chickens and hatch state must be reconstructed against the initialized map. A save written with optional content absent should keep its unloaded records.
Smallest example / reproduction
Section titled “Smallest example / reproduction”In Coop Zero Step 10, use the three fixture processes in Scripts/prove_night_save.sh. The closed-door process gets an independent user directory. The remaining two share a fresh -UserDir. Acquire enough coins for the second feeder with the Development console, buy it via normal interaction, let night arrive, then go to bed with the door open. Start a second process using the same user directory.
Solution
Section titled “Solution”Wrap a reflected farm struct in a USaveGame subclass. Assign the current version explicitly and snapshot the native farm after both the normal clock and bed skip reach the same dawn handler. Let dawn apply mutations such as chick growth before writing slot 0 with UGameplayStatics::SaveGameToSlot. Load with UGameplayStatics::LoadGameFromSlot after Super::StartPlay() in the native game mode, before farm ticks. Restore records by stable actor ID and look up species and items by string IDs. Keep unrecognized records in memory and copy them into the next snapshot. Decline to overwrite a slot whose format version cannot be read.
Why it works
Section titled “Why it works”The map stations and animal templates are initialized before reconstruction. The farm writes its snapshot after the clock’s phase boundary and chick callbacks. The snapshot owns values and stable identifiers, so it can restore actors created in a previous process and carry records for content that has no active actor.
Verified
Section titled “Verified”- Evidence level: runs in packaged build.
- How:
bash Scripts/prove_night_save.shloggedSAVED slot=0 day=2 coins=8 flock=4 hidden=1 items=6in the open-door process andLOADED slot=0 day=2 coins=8 flock=4 hidden=1 items=6after restart.bash Saved/step10-extra-save.shrestored a paused egg at 240 seconds and retained an unknown animal record through another dawn. Exact output and the BuildCookRun command are in Coop Zero commit155ed14,REPORT.md. - Date / by: 2026-11-25, Coop Zero Step 10.
Limits and assumptions
Section titled “Limits and assumptions”The farm is single player and the packaged fixture uses Development console commands. Only save format 1 is implemented. Clock snapshots occur at dawn. Controller play and a shipped optional pack need separate checks.