Advise on handling player stats with permanent buffs, temporary buffs and save state

Godot Version

Godot 4.6

Question

Continuing work on my zelda-like ARPG, I’m looking at how to handle player stats and unlocks. My initial take (which worked) was using autoload scripts. So there was a max_health and current_health stored in a PlayerStats.gd that the player script could pull from on spawn and change the values on when they took damage or healed, and the player signaled the UI that their health had updated and the UI would read the autoload.

I’m doing a bit of an overhaul, because I’m going to start working on buffs and debuffs, as well as item unlocks that can modify those stats, as well as prepping for save game functionality down the road. I’m doing some research and there’s a lot online that says to use custom resources for stats and then dupe the data and runtime and modify as needed, exporting the variable you want to save.

So, lets say player_speed is a variable read by my move state. The player can get hit with a debuff that slows them (player_speed/2) or a buff that hastes them (player_speed*2) and they can also unlock a permanent upgrade that changes the base value (finding the Wind Boots, or whatever).

  1. Should the temporary effects change the Resource, or should I have maybe a stat_manager autoload that keeps an active copy of the resource data that I pull from on player spawn, and only updates the Resource with things that should stick around through a scene/level transition (where I spawn a new player scene). This would be the thing all the UI and stuff would read as well.

  2. I was going to track the permanent unlocks that grant stat increases, or other ability unlocks as a separate autoload with a bunch of dictionaries for each type of unlock with a string and a bool (wind_boots: true), but should I also permanently save the stat increase, or should I check the bool at runtime and modify the instanced stat in the manager? (or should I just dump all the unlocks and stats in the same resource so there’s only one thing to save?)

I get that this isn’t a proper question and the answer will prob be “do what works best for your game” but wanted to throw this out into the aether to see if anyone had any advise or big gotchas.

:victory_hand: