Sub topic 7
Unlocks and Gating
This chapter covers how games restrict access to content and why. It assumes you have read the earlier chapters on progression axes and XP curves. You should be able to read short Python samples and use basic algebra.
What Gating Is
An unlock is a change in a player's state that makes something available: an area, a skill, a weapon, a game mode. A gate is the rule that withholds that thing until the player meets a condition. Gating is how a designer controls the order in which a player sees the game.
Gates serve four purposes:
- Teaching order. A player who meets the dodge mechanic before the boss that requires it has a fair chance of learning it.
- Pacing. Gates spread content over time, so a 30-hour game does not hand over its best material in hour one.
- Difficulty control. Locking a hard area behind a level keeps under-prepared players out of it.
- Reward structure. An unlock is a reward in itself. A newly opened door is often more motivating than a number going up.
Gates also cost something. Every gate is a place where a player can be stopped, so a badly built gate is a place where players quit. Most of the work in this chapter is about getting that trade-off right.
Types of Gates
Gates differ in what they measure. Choosing the type means choosing what you want the player to have done.
| Gate type | What it checks | Typical example | Main risk |
|---|---|---|---|
| Level gate | A power number | "Requires level 5" | Forces grinding if the player is short |
| Progress gate | Completed content | "Clear the forest first" | Linear feel, backtracking |
| Item gate | An owned object | "Needs the silver key" | Player cannot find or has lost the item |
| Skill gate | Demonstrated ability | A boss that must be beaten | Frustration, no way around it |
| Time gate | Elapsed real or play time | "Opens in 24 hours" | Feels like a wait, often tied to monetization |
| Currency gate | A spendable amount | "Costs 500 gold" | Player spent the gold elsewhere |
Level gates and skill gates differ in an important way. A level gate checks a number the player has accumulated, so it can always be passed by spending more time. A skill gate checks what the player can do, so time alone does not pass it. Most games mix both. The level gate keeps weak characters out, and the skill gate in the area itself tests whether the player has learned to play.
Hard Gates and Soft Gates
A hard gate blocks access completely. A locked door stays locked until the condition is true. A soft gate allows access but makes it unwise. An area full of enemies four levels above the player is open, but entering it is risky.
The two have different effects:
- Hard gates are predictable and easy to test. They also remove player agency, since the player cannot try anyway.
- Soft gates give experienced players room to take a risk and skip ahead. They are harder to balance because you must make the under-leveled experience hard but not broken.
A common design uses both. A hard gate protects content that would break the game or its story if reached early, such as a final boss. A soft gate guards everything else and lets skilled players push their luck.
Visible and Hidden Gates
Players respond better when they can see what is locked. A grayed-out skill with its requirement printed on it tells the player what to work toward. A hidden gate offers no such help, but it can create surprise, as with a secret room that appears after an unusual action.
A reasonable rule is to show gates for core progression and hide gates for optional discoveries. Core content should never be locked by a rule the player cannot learn about.
How Gates Interact With Pacing
The previous chapters described the level curve as a way to pace power. Gates pace content on top of that curve. Think of the curve as a road and gates as checkpoints along it. When a gate sits at level 5, and level 5 takes about 40 minutes to reach, the gate effectively places the new content at the 40 minute mark.
This gives you a practical tool. If playtests show players reach a gate far earlier than you intended, they are gaining XP faster than planned, and you can either move the gate or reshape the curve. If players pile up in front of a gate, the gate is too far ahead of the curve.
Unlock Conditions as Data
Hard-coding each gate as an if statement scatters design decisions through the code. A better approach stores each rule as data and uses one function to evaluate any rule. Designers can then change a requirement without touching logic, and you can test every rule in one place.
The rules below combine a level requirement, required completed content, 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))This prints True and then False. The player is level 6 and has cleared the forest, so the caves are open. The boss gate fails on three counts: the level is below 10, the caves are not completed, and there is no silver key.
Three details of this function matter:
- All conditions combine with AND. A rule passes only if every part passes. If you need OR (for example, "silver key or lockpicking skill"), the data format needs an extension, such as a list of alternative rule sets.
- Missing keys have defaults.
rule.get("level", 1)treats a rule with no level as level 1, andget("requires", [])treats a missing list as empty. This keeps simple rules short. - The function only reads state. It does not change the player. Keeping the check separate from the action of unlocking makes it safe to call from a menu that only wants to show a lock icon.
Prerequisites and Dependency Problems
Once content requires other content, you have a dependency graph. Each node is a piece of content, and each edge says "this needs that". Two failures are common.
Circular dependencies. If A requires B and B requires A, neither can ever open. With three or four items the cycle can be hard to spot by eye. A check at load time catches it.
Unreachable content. A node can be reachable on paper but impossible in practice, for example when its required item is only found inside the area it unlocks. This is a softlock of the design itself.
The function below walks the rules and reports any cycle.
def find_cycle(unlocks):
visiting, done = set(), set()
def visit(name, path):
if name in done:
return None
if name in visiting:
return path + [name]
visiting.add(name)
for dep in unlocks[name].get("requires", []):
found = visit(dep, path + [name])
if found:
return found
visiting.remove(name)
done.add(name)
return None
for name in unlocks:
found = visit(name, [])
if found:
return found
return None
print(find_cycle(UNLOCKS))
broken = {"a": {"requires": ["b"]}, "b": {"requires": ["a"]}}
print(find_cycle(broken))The first call prints None. The second prints ['a', 'b', 'a']. Run a check like this when the game data loads, or in your build tests, so a typo in a rule fails early instead of in a player's save file.
Designing Gates That Are Fair
Several edge cases decide whether a gate feels fair.
- Never gate on something the player can lose. If a gate needs a key and the key can be sold or consumed, a player can lock themselves out. Make required items permanent, or give a way to get them again.
- Do not gate on random drops alone. A gate that needs an item with a 2 percent drop chance sets an unbounded wait. Add a guaranteed source or a pity mechanism, where repeated failures raise the chance.
- Provide more than one way to catch up. A level gate means a player below the level needs XP. Offer side content, repeatable activities, or catch-up bonuses so the shortfall can be closed without dull grinding.
- Check the gate against the whole population. A level gate that suits the average player may take a careful, thorough player twice as long as a rushing player. Test both extremes.
- Avoid stacking many gates at one point. A door that needs level 10, three completed quests, and two items turns into a checklist. Keep the number of conditions per gate small.
- Make the check consistent. The menu, the door, and the save loader should all ask the same function. When each has its own copy of the rule, they drift apart.
Gating and Player Motivation
Gates work with motivation, and they can also work against it. A well placed gate builds anticipation. The player sees the locked caves, knows they need level 5, and has a clear short-term goal. A badly placed gate removes momentum: the player is ready and willing, but the game says wait.
A useful test is to ask what the player does when they hit the gate. If they have a clear path, such as more quests or optional areas to explore, the gate guides them. If the only option is repeating the same activity, the gate is a wall. The first is called a pull and the second a push through, and good gates give a pull.
Summary of Decision Criteria
When adding a gate, ask these questions in order:
- What should the player have learned or gained before this point?
- Which gate type measures that directly?
- Should it be hard or soft?
- Will the player be able to see the requirement?
- Can the requirement always be met from every reachable state?
- What will the player do while they work toward it?
Exercise
A designer writes this rule: "The temple requires the templekey, and the templekey is found in a chest inside the temple." The game data also has "temple_key" as a consumable item. Name two separate problems with this design and one fix for each.
Show answer
First, the key is only available inside the area it unlocks, so the temple is unreachable and the content is a design softlock. Fix: place the key (or an alternative way to get it) somewhere outside the temple. Second, the key is consumable, so a player who uses it and then needs to return, or who loses it, can be locked out. Fix: make the key permanent, or flag the temple as unlocked in the player's state once opened so the key is no longer checked.
Exercise
Using the is_unlocked function from this chapter and the UNLOCKS table, a player has level 12, completed = {"forest", "caves"}, and no items. Is the boss gate unlocked? What single change to the player makes it unlocked?
Show answer
It is not unlocked, because the rule requires the item "silverkey" and the player has none. Adding "silverkey" to the player's items set makes is_unlocked("boss_gate", player) return True, since the level (12 >= 10) and the completed requirement ("caves") are already satisfied.