Sub topic 10
Choosing a Skill Tree Topology
This chapter assumes you know what a skill point is, how a prerequisite blocks a skill, and how to read short Python programs. It builds on the earlier chapters on skill trees and unlock conditions. The question here is which shape of prerequisite graph fits your game.
What Topology Means
A skill tree's topology is the pattern of prerequisite links between its skills. Two trees can hold the same skills at the same costs and still play very differently, because the links decide three things:
- Which skills a player can reach first.
- How many different builds are legal at a given point budget.
- How much one early choice limits later ones.
Most "skill trees" are not trees in the strict sense. A skill that needs two parents, such as execute in the earlier example, makes the structure a directed acyclic graph (DAG). In a DAG every link points from prerequisite to dependent, and following the links can never return you to where you started. Designers still say "tree" for any such structure.
Common Topologies
| Topology | Shape | Strength | Risk |
|---|---|---|---|
| Linear chain | Each skill needs the one before it | Clear power curve, easy to teach | No choice at all |
| Flat list | No prerequisites, only costs | Maximum freedom, simple UI | Players converge on one best pick |
| Branching tree | A root splits into separate branches | Strong build identity, such as "fire path" or "stealth path" | Players may feel locked out of a branch they never chose |
| Convergent DAG | Branches merge at capstone skills | Rewards combining branches | A capstone can force a fixed set of earlier skills |
| Web or grid | Skills connect to neighbors, and any neighbor unlocks a node | Many routes to each skill, big builds | Hard to read and hard to balance |
Measuring a Topology Instead of Guessing
Two numbers describe a topology well. Depth is the longest prerequisite chain ending at a skill, and it tells you the minimum number of purchases before that skill. Build count is how many different legal skill sets a player can have at a given budget, and it tells you how much choice the tree really offers.
The first program computes depth for every skill. It also rejects two data errors that are easy to introduce when you edit trees by hand: a prerequisite that names a skill that does not exist, and a cycle. A cycle makes skills unreachable, because each one waits for the other.
def tree_depths(skills):
"""Return {skill: depth}. Depth 1 means no prerequisites."""
depths = {}
def visit(name, path):
if name not in skills:
raise ValueError(f"unknown skill: {name}")
if name in path:
raise ValueError("cycle: " + " -> ".join(path + [name]))
if name not in depths:
reqs = skills[name]["requires"]
depths[name] = 1 + max(
(visit(r, path + [name]) for r in reqs), default=0
)
return depths[name]
for name in skills:
visit(name, [])
return depths
SKILLS = {
"slash": {"cost": 1, "requires": []},
"whirlwind": {"cost": 2, "requires": ["slash"]},
"berserk": {"cost": 2, "requires": ["slash"]},
"execute": {"cost": 3, "requires": ["whirlwind", "berserk"]},
}
print(tree_depths(SKILLS))
broken = {
"a": {"cost": 1, "requires": ["b"]},
"b": {"cost": 1, "requires": ["a"]},
}
try:
tree_depths(broken)
except ValueError as err:
print(err)The first call prints depths of 1, 2, 2, and 3 for slash, whirlwind, berserk, and execute. The second prints cycle: a -> b -> a.
Counting Builds
A build is legal when every skill in it has all its prerequisites in the same build and the total cost fits the budget. For small trees you can count legal builds by brute force. The program below compares four shapes that each use unit-cost skills, so only the links differ.
from itertools import combinations
def unit_tree(**requires):
"""Build a tree where every skill costs 1 point."""
return {n: {"cost": 1, "requires": r} for n, r in requires.items()}
def is_closed(build, skills):
return all(r in build for s in build for r in skills[s]["requires"])
def count_builds(skills, budget):
"""Count non-empty legal builds that cost at most `budget`."""
names = list(skills)
count = 0
for size in range(1, len(names) + 1):
for combo in combinations(names, size):
build = set(combo)
cost = sum(skills[s]["cost"] for s in build)
if cost <= budget and is_closed(build, skills):
count += 1
return count
TREES = {
"linear": unit_tree(a=[], b=["a"], c=["b"], d=["c"]),
"flat": unit_tree(a=[], b=[], c=[], d=[]),
"diamond": unit_tree(a=[], b=["a"], c=["a"], d=["b", "c"]),
"branching": unit_tree(a=[], b=["a"], c=["a"], d=["b"], e=["c"]),
}
for name, tree in TREES.items():
print(name, count_builds(tree, 3))With a budget of 3 points, the output is linear 3, flat 14, diamond 4, and branching 6. The flat list offers far more combinations than the linear chain, but that does not mean it offers more meaningful choices. Fourteen builds where one skill is clearly strongest is worse than six builds that each feel different. Build count is a ceiling on choice, not a measure of its quality.
The brute-force loop checks every subset, so it doubles in cost with each added skill. Use it for prototypes with about 20 skills or fewer. For larger trees, count with dynamic programming over the graph or sample random legal builds.
Matching Topology to Design Goals
Decide the goal first and let it select the shape.
- Teach the game gradually. Use a linear chain or a short trunk at the start. A new player gets one obvious next purchase and learns the systems one at a time.
- Create distinct character identities. Use a branching tree with a sharp split. Each branch needs its own playstyle and its own payoff, not just a bigger number.
- Reward mixing styles. Add convergent capstones. A capstone that needs two branches pays the player for committing to both, and its cost should reflect that.
- Support long play with many options. Use a web. Any-of unlock rules make this possible, but they need a different rule from the all-of
requireslist used so far. A web node stores a list of neighbors and unlocks when the player owns any one of them. - Keep it cheap to ship. A flat list is the cheapest to build and present. It works when skills are few, roughly equal in strength, and differ in kind rather than in power.
Failure Modes
Forced tax nodes
A tax node is a skill that the player must buy to reach what they want but would never choose for itself. A few are acceptable as small stat boosts. If more than a third of a path is tax, players will see the tree as a chore and search for the shortest route, which makes the choices feel predetermined.
Budget larger than the tree
If the total cost of all skills is below the points a player earns, the tree stops being a choice and becomes a checklist. Players get every skill, only in a different order. Compare the sum of all skill costs with the points available at the level cap. Leave a gap on purpose, often 40 to 60 percent of the tree unaffordable, so that every purchase excludes something.
Dead-end branches
A branch whose final skill is weak makes the whole branch a trap. Players will feel punished for exploring it. Check that each branch's end point is competitive with the others, and that early skills in the branch are useful on their own, not only as steps.
Early lock-in
In a deep branching tree, the first choice may cut off half the tree for most of the game. That is fine when each branch is a full playstyle. It is harmful when the player cannot yet judge what the choice means. Delay the split until the player understands the basics, or lower the cost of changing course (see the chapter on respecs and commitment).
Unreachable skills
The depth check above finds cycles and unknown names, but not every reachability problem. A skill can also be unreachable when its level requirement is higher than the level cap, or when it needs an item no source provides. Validate level and item requirements against the rest of the game data as well.
Choosing in Practice
Start from the experience you want, then pick the simplest shape that supports it. Run the depth and build-count checks on a prototype, play it, and look for builds that dominate or branches nobody takes. Then change the links before you change the numbers, since the shape of the tree decides which numbers are worth tuning.
Exercise
A tree has 6 skills that each cost 1 point, with no prerequisites. Players earn 10 skill points by the level cap. Name the problem, and describe one change to the tree or the budget that restores meaningful choice.
Show answer
The total cost of the tree (6) is below the points available (10), so every player ends up with every skill and the tree offers no real choice. Fix it by adding more skills so that total cost exceeds the budget, by raising skill costs, or by reducing the points awarded. Adding prerequisite links alone does not help, since the player can still afford everything.
Exercise
Using the count_builds function, what does it return for the four-skill diamond tree (a, then b and c, then d needing both) with a budget of 4, and why is it different from the result at budget 3?
Show answer
It returns 5. At budget 3 the legal builds are {a}, {a,b}, {a,c}, and {a,b,c}, which is 4. A budget of 4 allows the full tree {a,b,c,d} as well, giving 5. The capstone d requires both branches, so it only becomes legal once the player can afford all four skills.