Sub topic 2
Pacing Rewards Across the Curve
This chapter assumes you know basic Python, can read dictionaries and sets, and understand the XP curve from the previous chapter.
Pacing Rewards Across the Curve
Reward pacing sets when players receive unlocks, stat boosts, and new content along the level curve. Rewards spread too evenly make progress feel flat. Rewards clustered in one place leave long stretches with nothing to earn. A common approach gives a meaningful reward every one or two levels early on, then widens the gaps as each level costs more XP.
Unlocks and Gating
A gate is a rule that keeps content locked until a player meets a condition. Gates protect discovery, and they protect balance, because a player who skips ahead may meet enemies they cannot beat.
Unlock Conditions and Prerequisites
Each unlock has a condition. Conditions usually combine three checks: a minimum level, completed content (prerequisites), and required items.
UNLOCKS = {
"forest": {"level": 1},
"caves": {"level": 5, "requires": ["forest"]},
"boss_gate": {"level": 10, "requires": ["caves"], "items": ["silver_key"]},
}
def is_unlocked(name, player):
rule = UNLOCKS[name]
if player["level"] < rule.get("level", 1):
return False
if any(r not in player["completed"] for r in rule.get("requires", [])):
return False
return all(i in player["items"] for i in rule.get("items", []))
player = {"level": 6, "completed": {"forest"}, "items": set()}
print(is_unlocked("caves", player))
print(is_unlocked("boss_gate", player))Output: True, then False.
Skill Trees and Skill Points
A skill tree is a set of abilities linked by prerequisites. Players spend skill points to learn each one. Every skill has a cost and a list of skills it requires.
SKILLS = {
"slash": {"cost": 1, "requires": []},
"whirlwind": {"cost": 2, "requires": ["slash"]},
"berserk": {"cost": 2, "requires": ["slash"]},
"execute": {"cost": 3, "requires": ["whirlwind", "berserk"]},
}
def can_learn(skill, learned, points):
node = SKILLS[skill]
return (
skill not in learned
and points >= node["cost"]
and all(r in learned for r in node["requires"])
)
def respec(learned):
refund = sum(SKILLS[s]["cost"] for s in learned)
return set(), refund
learned = {"slash"}
print(can_learn("whirlwind", learned, 2))
print(can_learn("execute", learned, 5))
print(respec({"slash", "whirlwind"}))Output: True, False, then (set(), 3).
Different tree shapes change how choices feel:
| Topology | Shape | Effect on choice |
|---|---|---|
| Linear | One path | No choice |
| Branching | Two or more paths split from a root | Players pick a direction |
| Converging | Paths merge into a capstone | Players mix branches late |
Exercise
Using the UNLOCKS rules above, is bossgate unlocked for a player at level 10 who has completed caves and owns silverkey?
Show answer
True. The level is at least 10, caves is completed, and silver_key is owned, so every check passes.