VerseIsland
FeedLearnLeaderboardGuidesReferenceExploreSearchDocsVerse Library
Sign in
Feed Learn 📖 Codex Leaderboard Guides Reference Explore Search Docs Verse Library
Browse Community Snippets›Player·Up to Community Snippets · Player·16 of 26 in Player

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 Discord — free for members Read the original at Epic Games documentation

Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.

Guided course

Add this to your free study plan — we’ll suggest related material and stitch it into one compile-checked lesson.

Keep exploring
More in Player · 16 of 26
Prev
fortnite quick simple script send players to lobby
Next
mandeep versemaxxing base team

Source

Epic Games documentation

View original
VerseIsland· an archipelago of Verse & UEFN knowledge
🗺️ Island atlasLearnGuidesHistoryAbout & PressSources & LicensingPrivacy PolicyTermsStatus

Not affiliated with Epic Games. Fortnite, UEFN, Unreal Engine, and Verse are trademarks of Epic Games, Inc. Content is attributed to its source — see Sources & Licensing.

🦜

Scout · your island guide

The Isle of Verse