How to store objects in player persistence efficiently?

What is the best way to store a lot of stuff in player persistence?

I’m working on a game where I save a bunch of objects in player persistence. Is there a better way to save an object (or anything other than a string or numbers) in player persistence?

I’ve seen some developers working on serialization algorithms. Is this really necessary?

Right now I’m thinking of just creating a string or integer value for each object and getting the object when the player comes back to the game based on those string or integer values!

do you mean SaveGames?

this is often to automate the process, it really just depends on the complexity of your save.

sounds like you could just use a SoftClassReference

1 Like

a little more context,for example, if i create a game where the player can have a hundred of pets, see pets as a class, with a prop, speed settings, damage settings & etc

it would be better just save the entire class in player persistence?

btw, what you mean with SoftClassReference?

well assuming the pets are static (stats dont change) you can just save an Array of unlocked Pets of type ActorClass

but an actor class reference loads the entire asset which is why i recommened the SoftClassRef

You can store whatever class you’d like with many different types as long as you don’t exceed 128kb per player (pretty hard to do). What do you mean by objects?

Here’s what my simple storage class looks like, I then load using the methods in the documentation for persistent data, for unlocks I have a map that reads the player’s array and finds matching functions to run.

#THE PERSISTENT DATA THAT GETS STORED ON SERVER
player_profile<public> := class<final><persistable>:
    #Version is important! When players log in and there are new stats, check if their version is current. If not, do stuff
    Version<public> : int = 0
    Level<public>: int = 0
    XP<public>: int = 0
    Unlocks<public>: []int = array{}

#THE MAP OF PROFILES
var PlayerProfilesMap : weak_map(player, player_profile) = map{}