How-To: Save Player Progression

Goal: persist per-player progression (stat tags, and your own attributes) using the CrimsonCore player-state integration.

Prerequisites
Your player state derives from ACrimsonPlayerState. It already implements ICrimsonSaveableSystem, registers itself server-side, and saves as a player-scoped fragment CrimsonPlayerState__<PlayerKey>.

1. Stat tags persist automatically

Anything you store via AddStatTagStack on the player state is captured and restored per player with no extra code - it rides in the fragment's SavedStatTags.

Verify
Add a stat tag, save, reload - the count is restored on the correct player key. In split saves, each player's tags stay separate.

2. Add your own data (e.g. attributes)

Subclass the fragment (UCrimsonPlayerStateSaveFragment) to add fields, then write and read them in the player-state hooks Gather Player Save Data / Restore Player Save Data. See How-To: Custom Fragments & Versioning for how the fragment subclass is created.

In a BP child of `ACrimsonPlayerState`, override `Gather Player Save Data` (write into the fragment) and `Restore Player Save Data` (apply it).
Server authority
The player state registers and saves only on the server. GAS attribute values must be applied server-side; they replicate to the owning client normally.

See also

  • How-To: Custom Fragments & Versioning - subclass the fragment for structured data
  • Concept: Multiplayer & Player Scoping - how player keys work