Sub topic 12
Respecs and Commitment
This chapter covers the respec: a feature that lets players undo skill choices and spend their points again. It assumes you know how a skill tree stores costs and prerequisites, and that you have seen the idea of a meaningful choice. You should be comfortable reading short Python samples.
Why Respecs Exist
A skill tree asks players to commit. Points spent on one branch are not spent on another, and that cost is what gives the choice weight. Commitment creates a tension, though. Players pick skills before they understand the game. They may also pick skills that the designers later change.
A respec (short for "re-specialization") resolves the tension. It removes some or all learned skills and returns the points that were spent on them. The player can then build again.
Respecs touch three design goals at once:
- Experimentation. Players try builds without fear of ruining a character.
- Recovery. A player who made a poor choice, or who was misled by unclear skill text, can fix it.
- Meaning. If undoing a choice costs nothing, the choice stops mattering.
The design question is how much friction to add. Too little friction removes commitment. Too much makes mistakes permanent and punishes players for learning.
The Commitment Spectrum
Games sit at different points between "permanent" and "free." The table shows common positions and what each one trades away.
| Policy | Typical cost | Effect on choices | Main risk |
|---|---|---|---|
| No respec | None, but choices are permanent | Strong commitment, strong identity | Players feel trapped, and they restart or quit after a mistake |
| Rare or paid respec | Scarce currency or a consumable item | Choices matter, mistakes are fixable | Players avoid experimenting because it feels wasteful |
| Escalating cost | Price rises with each use | Discourages constant swapping | Can feel punishing late in the game |
| Free respec outside combat | Time only | Encourages experimentation | Players optimize per encounter, so builds lose identity |
| Free, instant, anywhere | None | Choices become a menu | The tree stops being a decision |
No row is correct for every game. A short roguelike where each run is a fresh character needs no respec, because the next run is the respec. A 100-hour role-playing game with hidden late-game requirements usually needs a generous one.
What a Respec Must Do Correctly
A respec looks simple, but it has to preserve several invariants (conditions that must always hold). A bug in any of them can corrupt a save file.
- Points are conserved. The refund must equal the points spent. The player must not gain or lose points.
- The tree stays valid. No learned skill may remain without its prerequisites.
- Dependent state is cleaned up. Skills may be bound to hotbar slots, passive modifiers, or equipped gear requirements. These must update too.
- The operation is atomic. It either happens fully or not at all, even if the game crashes midway.
The sample from the topic spine handles the simplest case, a full respec:
SKILLS = {
"slash": {"cost": 1, "requires": []},
"whirlwind": {"cost": 2, "requires": ["slash"]},
"berserk": {"cost": 2, "requires": ["slash"]},
"execute": {"cost": 3, "requires": ["whirlwind", "berserk"]},
}
def respec(learned):
"""Forget all skills and return the refunded points."""
refund = sum(SKILLS[s]["cost"] for s in learned)
return set(), refund
print(respec({"slash", "whirlwind"}))Running this prints an empty set and a refund of 3. A full respec is easy to get right because nothing remains that could be invalid. The set is emptied, and the refund is computed from the same cost table that was used to spend the points.
Reading the refund from the cost table
The refund is computed from the current cost table. That is a subtle choice. Suppose a patch raises the cost of whirlwind from 2 to 3. A player who bought it at the old price would now be refunded 3 points. They gain a point they never had.
There are two ways to avoid this:
- Store points spent. Save a running total,
points_spent, with the character, and refund that number. This is safe against any later change to costs. - Store the purchase price per skill. This is more detailed and allows partial refunds, at the cost of a larger save format.
For a full respec, storing one number is enough. For anything finer, store per-skill data.
Partial Respecs and Dependency Safety
Full respecs are blunt. Many games let players remove a single skill, which is friendlier but harder to implement. Removing slash from a build that also has whirlwind would leave whirlwind without its prerequisite.
There are three common ways to handle this:
- Block it. Refuse to remove a skill if another learned skill depends on it. The player must remove the dependents first.
- Cascade. Remove the skill and everything that depends on it, and refund all of them.
- Orphan allowed. Let the dependent stay. This is rare, and it usually breaks the tree's logic.
The following code implements the first two.
SKILLS = {
"slash": {"cost": 1, "requires": []},
"whirlwind": {"cost": 2, "requires": ["slash"]},
"berserk": {"cost": 2, "requires": ["slash"]},
"execute": {"cost": 3, "requires": ["whirlwind", "berserk"]},
}
def dependents(skill, learned):
"""Learned skills that directly require `skill`."""
return {s for s in learned if skill in SKILLS[s]["requires"]}
def unlearn_blocking(skill, learned):
"""Remove one skill, or refuse if something depends on it."""
if skill not in learned:
return learned, 0
if dependents(skill, learned):
raise ValueError(f"{skill} is required by another learned skill")
return learned - {skill}, SKILLS[skill]["cost"]
def unlearn_cascade(skill, learned):
"""Remove a skill and every learned skill that depends on it."""
removed = set()
pending = [skill]
while pending:
current = pending.pop()
if current in learned and current not in removed:
removed.add(current)
pending.extend(dependents(current, learned))
refund = sum(SKILLS[s]["cost"] for s in removed)
return learned - removed, refund
learned = {"slash", "whirlwind", "berserk", "execute"}
print(unlearn_cascade("whirlwind", learned))
try:
unlearn_blocking("slash", learned)
except ValueError as error:
print(error)Cascading whirlwind removes whirlwind and execute, because execute requires it. The refund is 5. Blocking slash raises an error because whirlwind and berserk depend on it.
The cascade uses a work list instead of recursion. This avoids a deep call stack in large trees and handles the shared-dependent case, where execute could be reached through two paths, because the removed set stops it from being counted twice.
Blocking is predictable, and the player always knows what will happen. Cascading is faster but can surprise someone who clicks one node and loses a whole branch. If you cascade, show a confirmation that lists everything that will be removed and the points that will come back.
Designing the Cost
When a respec costs something, the cost should match the commitment the game wants to create. These are the usual choices:
- Gold or soft currency. It is easy to balance, but it can become trivial late in the game, when players have plenty of gold. Scaling the price with character level keeps it relevant.
- A rare consumable. It makes each respec a decision, but it can feel arbitrary, and it creates frustration for players who run out.
- Time or location. The player must visit a specific trainer or rest at a shrine. This adds a small cost without a currency.
- Escalating price. Each use costs more than the last, often with a cap. It allows a few corrections and discourages constant swapping.
- A free window. Full respecs are free for the first hours of play or until a certain level, then cost something. This protects new players, who understand the game least.
A cost works only when players know about it before they commit. If a skill description is vague and the respec is expensive, the player is punished for a failure of the interface.
Respecs and Meaningful Choice
Respecs do not simply weaken meaningful choice. They shift where the meaning lives.
When respecs are rare, the meaning is in the long-term plan. The player researches and commits. When respecs are cheap, the meaning moves to the moment: the player reads the next encounter and reconfigures. Both are valid, but they favor different games. Games with single hard fights and visible enemy weaknesses, such as boss encounters, tend to push players toward constant respeccing when it is cheap. If you do not want that, either make swaps costly or let some choices lock for a period, such as a cooldown after each respec.
A related technique is a loadout system. Players unlock many skills permanently but equip only a few. Swapping the equipped set is free or nearly so. This keeps the commitment to what you can use at once, without making the unlocking itself reversible.
Handling Game Updates
Respecs are also a tool for live games. When a balance patch changes a skill, players who built around it may feel cheated. Many studios grant a one-time free respec after major changes. To support this, store a per-character flag or a "last respec version" number. Compare it with the current patch version when the character loads, and offer the free respec if the version is older.
Test this path. A save loaded after a patch must still pass the invariants listed above, including when a skill has been removed from the tree entirely. In that case, refund from the stored points_spent number, since the cost table no longer has an entry to read.
Common Mistakes
- Refunding from a changed cost table. This lets patches create or destroy points. Store what was spent.
- Forgetting dependent state. A removed skill may still sit on the action bar, or still grant a passive bonus. Clear every reference.
- Respeccing during a fight without limits. A player can swap into an immunity and swap out again. Restrict respecs in combat or add a cooldown.
- Hiding the cost. Show the price on the respec button, not after the click.
- Making mistakes permanent without warning. If a game has no respec, say so before the first choice, and make the early choices low-stakes.
Exercises
Exercise
A patch raises the cost of "whirlwind" from 2 to 3. A player bought it before the patch. The respec function computes the refund from the current SKILLS table. What goes wrong, and what is a simple fix?
Show answer
The player is refunded 3 points for a skill that cost them 2, so they gain a point they never earned. Store the total points the character has spent (or the price paid per skill) in the save data and refund that value, instead of reading the current cost table.
Exercise
Using the skill tree in this chapter, a player has learned slash, whirlwind, berserk, and execute. They remove "berserk" with the cascade policy. Which skills are removed and how many points are refunded?
Show answer
Berserk and execute are removed, because execute requires berserk. The refund is 2 + 3 = 5 points. Slash and whirlwind remain learned.
Exercise
Your game has short, 20-minute runs where each run starts a new character with a fresh tree. Does it need a respec feature? Give the reasoning.
Show answer
Probably not. Each new run already lets the player choose again, so a respec would add little and could weaken the commitment that makes in-run choices matter. A different design would call for a respec if characters persisted across many hours.