I’m working[1] on building a save game system and have run into the difficulty of determining what exactly needs to be saved from the AbilitySystemComponent.
Ideally, I’d save just enough data to restore the game to the precise state it was in when the player saved the game. There are a lot of moving parts in the AbilitySystemComponent though, and I’m not entirely sure what the most minimal set of data would be.
My current list is:
- The base values of all the Gameplay Attributes that the ASC initially possesses that differ from their initial value.
- Any attribute sets that were granted that the ASC did not initially possess – the base value for each, if it differs from the default.
- All Gameplay Effects that are currently active – just their class and level.
- All granted Gameplay Abilities that were not granted by a Gameplay Effect. I think each of these need to include the ability instance or class, the source object (as a reference), the level, the input data, any granted tags, and any set-by-caller magnitudes.
- Loose Gameplay Tags, if any
I’m not at all confident that that’s everything, nor that I haven’t included something unnecessary. In particular, it seems like the above list won’t take into account the possibility that some abilities are currently ongoing.
This seems like something that others surely must have figured out before. Does anyone else have their own list of what must be saved?
I’m explicitly excluding granted abilities that were granted by an effect, because the effect will automatically re-grant them. But I’m not completely sure that this is always right – if the ability is instanced, I might need to save it anyway and somehow relink it to its granting effect on load?
I’m also a little unsure about serializing the base values of the attribute sets, as I’m pretty sure I remember that Gameplay Effects can modify the base value… so it could become very messy trying to figure out the base state that everything else is going to build on.
I think it mostly doesn’t matter for this question, but just for the record, I’m currently working in UE 5.0. ↩︎