Recommended data structure to use for player stats

In my game prototype various player stats change as the player progresses. I plan to use the SaveGame Blueprint to handle game saves. However, what is the recommended data structure to use for storing player stats using Blueprint?

The Data Table is appealing but this is read only. A dictionary would also work but I don’t think this is supported in Blueprint. I would be grateful for any advice.

Hey @TheCosmicAC0!

So what I personally like to use is a custom struct, with each stat listed out with it’s value. Pretty simple, you can just use floats for stats, integers for level, and so on and so forth, just keeping all of the player stats in one neat little container. Also dictionaries exist, they’re just called maps. :slight_smile:

1 Like

Hey @Mind-Brain thanks for the great response. I just added a Custom Struct and it’s exactly what I needed. Here is a nice example from the Unreal docs for anyone else who sees this thread.

What approach do you use to update a single value in the struct? I could break the struct, and then make the struct again with one value changed, but this would require a lot of wiring between the make and break nodes.

Hey again @TheCosmicAC0!

So you’ll want to drag off of the struct GET and search for “Set Members in struct” and I believe it needs the individual struct name. Then you show/hide members through the details panel with the node selected :slight_smile: Make sure to save it afterwards or it will go back to defaults! I think it would reset on reload of the actor.

1 Like