Skip to main content

Player Progress

Keeps a slot's meta-progression — XP, level and achievement unlocks — as a small object the game persists itself. Browser only: it never reaches the RGS, and the RGS never verifies it.

Fire Add XP to add XP Per Add to the running total. Level Thresholds (cumulative XP) lists the total XP needed to reach each level, so the default [100, 250, 500, 1000, 2000] gives level 1 below 100 XP, level 2 at 100 and level 6 at 2000; the top level is the number of thresholds plus one. The node sorts the list, drops duplicates and values of 0 or less, and accepts a JSON or comma-separated string as well as an array.

Level is 1-based. XP Into Level counts from the current level's threshold and XP To Next Level to the next one; Progress (0..1) is their ratio, ready for a bar. At the top level XP To Next Level is 0 and Progress (0..1) is 1. Level Up fires once per Add XP that raises the level, however many thresholds it crossed. A negative XP Per Add lowers the total (never below 0) and fires only Changed; 0, the default, does nothing at all.

Set Achievement Id and fire Unlock Achievement. A new id is appended to Achievements and fires Unlocked; an empty id or one already owned is ignored, so a badge cannot be awarded twice. Changed fires after every mutation — add, unlock, load and reset — and is the one signal to refresh a HUD from.

Nothing is stored for you. State Out (persist this) is { totalXp, achievements } and changes with every mutation; wire it into Session Data on Save Game Session and save from Changed or on a timer. The object holds nothing but those two fields, so it stays small however long the player plays.

To restore, wire Session Data from Load Game Session into State In (saved stateOut) and fire Load State. A JSON string is accepted; an empty, malformed or unrelated value is ignored, so a new player without a save keeps what is on screen. Reset clears XP and achievements. The Slot Features guide shows where this node sits among the slot feature nodes.

Inputs​

Actions​

SignalDescription
Add XPAdds XP Per Add to the total; fires Level Up when a threshold is crossed and Changed always. Ignored while the amount is 0.
Unlock AchievementAdds Achievement Id to the list once; fires Unlocked and Changed for a new id, nothing for a repeat or an empty id.
Load StateReplaces XP and achievements with State In; fires Changed only, never Level Up or Unlocked. An empty or invalid state is ignored.
ResetClears the node's state and starts again. XP returns to 0, achievements empty; fires Changed.

XP​

DataDescription
XP Per Add (number)XP added per Add XP. Default 0, which makes Add XP do nothing; negative values subtract, and the total floors at 0.
Level Thresholds (cumulative XP) (array)Cumulative XP needed to reach level 2, 3, …; sorted and de-duplicated. Array, or a JSON or comma-separated string. Default [100, 250, 500, 1000, 2000].

Achievements​

DataDescription
Achievement Id (string)Identifier of the achievement to unlock; trimmed and stored as a string. Default empty.

Persistence​

DataDescription
State In (saved stateOut) (object)A saved State Out object, or its JSON string, from Load Game Session's Session Data. Read when Load State fires.

Outputs​

Progress​

DataDescription
Level (number)Current level, 1-based; the top level is the number of thresholds plus one.
Total XP (number)Total XP accumulated, never below 0.
XP Into Level (number)XP earned since the current level's threshold.
XP To Next Level (number)XP still needed for the next level; 0 at the top level.
Progress (0..1) (number)Fraction of the way to the next level, 0..1; 1 at the top level. Wire to a progress bar.

Achievements​

DataDescription
Achievements (array)Array of unlocked achievement ids, in unlock order.

Events​

SignalDescription
Level UpFires once per Add XP that raises the level, however many levels were gained at once.
UnlockedFires when Unlock Achievement adds an id that was not already owned.
ChangedFires after every mutation: add, unlock, load or reset. Not fired when the thresholds change.

Persistence​

DataDescription
State Out (persist this) (object){ totalXp, achievements } — persist this through Save Game Session's Session Data.

Usage​

  1. Add Player Progress and set Level Thresholds (cumulative XP) to your curve.
  2. Set XP Per Add to the reward and wire the signal that ends a spin or a feature into Add XP.
  3. Wire Level, Progress (0..1) and Achievements into the HUD; refresh it from Changed.
  4. Wire State Out (persist this) into Session Data on Save Game Session and save from Changed.
  5. On start, run Load Game Session; wire its Session Data into State In (saved stateOut) and fire Load State from its Done.
caution

This is client state the RGS never sees or checks. Use it for cosmetics — badges, titles, unlockable themes — never for a payout or anything with a money value.