Santa's Toy Factory Player Persistence
Santa's Toy Factory — Player Persistence
The full persistence model for a tycoon save: a class<final><persistable> holding gold, every factory element's state, the current order, and gift/harvest timestamps, kept in a weak_map(player, player_info) with copy-constructors for safe updates. The canonical pattern for persisting player progress across sessions in UEFN.
From the Santa's Toy Factory Epic starter project (SampleVerse/SantaToyFactory/Persistence/player_info.verse). Epic Games reference Verse, shown for study.
-
# This file defines player_info, the collection of persistable information stored for each player. # It also contains functions for creating, updating and returning information about a player. using { /Verse.org/Simulation } using { Config } using { Verse.Scripts.TimeSystem } # Maps each player to their persisted information. var PlayerInfoMap:weak_map(player, player_info) = map{} #var PlayerInfoMap:weak_map(session, player_info) = map{} # This tracks all persistable information for a player. player_info := class<final><persistable>: # The version of the current player info. Version:int = 0 # Latest harvest times of all candy CandyCanes. CandyCaneHarvestTimes:[]Verse.Scripts.TimeSystem.date_and_time = array{Verse.Scripts.TimeSystem.date_and_time{}, Verse.Scripts.TimeSystem.date_and_time{}, Verse.Scripts.TimeSystem.date_and_time{}, Verse.Scripts.TimeSystem.date_and_time{}, Verse.Scripts.TimeSystem.date_and_time{}, Verse.Scripts.TimeSystem.date_and_time{}, Verse.Scripts.TimeSystem.date_and_time{}, Verse.Scripts.TimeSystem.date_and_time{}, Verse.Scripts.TimeSystem.date_and_time{}, Verse.Scripts.TimeSystem.date_and_time{}}
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.