Sub topic 7
One verb, many targets: verb-object interactions
A verb gets its variety from the objects it can act on. This chapter covers how to design that relationship: how one verb produces different outcomes on different targets, how to store those outcomes in a table, and where the design goes wrong.
It assumes you have read the earlier chapters on specifying a verb and on verb-set size. You should know that a verb has a precondition, a cost, a cooldown, and an outcome. You should also be able to read short Python examples.
Why verbs need targets
A verb on its own is a request: "grab", "throw", "jump". The game answers that request only when it knows what the verb is aimed at. Grabbing a crate, a lever, and an enemy are three different events, even though the player presses the same button.
This is how a small verb set stays interesting. If a game has four verbs and ten kinds of object, it has up to forty verb-object pairs. Each pair can have its own result, and the player only has to learn four verbs and recognize ten objects.
The same idea explains why adding a new object type is usually cheaper than adding a new verb. A new verb needs a control, a tutorial, feedback, and balance work across the whole game. A new object only needs a row or two in a table, plus a recognizable look.
The verb-object table
The simplest way to design these interactions is a table with verbs as rows, objects as columns, and the outcome in each cell. Design it on paper before writing code.
| Verb | Crate | Lever | Enemy | Water |
|---|---|---|---|---|
| grab | pick up | pull | hold | no effect |
| throw | launch | no effect | knock back | splash |
| jump | climb on | no effect | stomp | swim up |
Each cell is a design decision, and the table makes three kinds of problem visible:
- Empty cells. Cells reading "no effect" are not always wrong, but each one should be deliberate. If the player can grab a crate, they will try to grab a barrel. A silent failure feels like a bug.
- Duplicate outcomes. If every cell in a row reads the same, the verb adds no variety. "Grab" that always means "pick up" is a weak verb.
- Orphan objects. A column that is mostly empty means the object does little. Either give it more interactions or remove it.
The same table is a data structure. Here is the version from the specification chapter, written in code:
INTERACTIONS = {
("grab", "crate"): "pick_up",
("throw", "crate"): "launch",
("jump", "crate"): "climb_on",
("grab", "lever"): "pull",
}
def resolve(verb_name, target):
return INTERACTIONS.get((verb_name, target), "no_effect")
print(resolve("grab", "crate")) # pick_up
print(resolve("grab", "lever")) # pull
print(resolve("throw", "lever")) # no_effectUsing a dictionary keyed by the pair keeps the rules in one place. A designer can read the whole set of interactions without searching through branching code.
Finding the gaps automatically
Because the table is data, you can check it by program. This script lists every verb-object pair that has no entry, so you can decide for each one whether the gap is intended.
INTERACTIONS = {
("grab", "crate"): "pick_up",
("throw", "crate"): "launch",
("jump", "crate"): "climb_on",
("grab", "lever"): "pull",
}
VERBS = ["grab", "throw", "jump"]
OBJECTS = ["crate", "lever"]
def missing_pairs(interactions, verbs, objects):
return [
(v, o)
for v in verbs
for o in objects
if (v, o) not in interactions
]
for verb, obj in missing_pairs(INTERACTIONS, VERBS, OBJECTS):
print(f"No rule for {verb} on {obj}")This prints two lines: throw on lever, and jump on lever. Neither is necessarily a mistake. A lever is fixed to the wall, so throwing it makes no sense. The point is that you now decide this on purpose instead of discovering it during playtesting.
Where the outcome comes from
A table keyed only by verb and object name is a good start, but real games decide outcomes using more than two names. There are three common ways to organize the lookup.
- Per-pair table. Every pair is listed explicitly, as above. It is easy to read and easy to audit. It grows quickly: with 10 verbs and 50 objects there are 500 possible cells.
- Per-property rules. Objects have properties such as
heavy,fragile, orflammable, and the verb reacts to the property. "Throw" on anyfragileobject breaks it. This scales well and produces consistent behavior across many objects. - Hybrid. Properties provide the default, and the table holds explicit overrides for special cases.
The hybrid is the most common choice in shipped games. Here is a small version:
from dataclasses import dataclass
@dataclass(frozen=True)
class Thing:
name: str
heavy: bool = False
fragile: bool = False
OVERRIDES = {
("grab", "lever"): "pull",
}
def resolve(verb_name, thing):
override = OVERRIDES.get((verb_name, thing.name))
if override:
return override
if verb_name == "grab":
return "too_heavy" if thing.heavy else "pick_up"
if verb_name == "throw":
return "shatter" if thing.fragile else "launch"
return "no_effect"
crate = Thing("crate")
anvil = Thing("anvil", heavy=True)
vase = Thing("vase", fragile=True)
print(resolve("grab", anvil)) # too_heavy
print(resolve("throw", vase)) # shatter
print(resolve("grab", crate)) # pick_upAdding a new fragile object needs no new rule. The vase behaves correctly the moment it is marked fragile. The cost is that behavior is now spread across rules and properties, so you need documentation, and a playtest, to confirm that a property combination does not produce a surprising result. An object that is both heavy and fragile is an example.
Checking preconditions first
An interaction has two stages, and they should not be confused. The verb's own precondition (cooldown and stamina, from the earlier chapters) decides whether the player may use the verb at all. The verb-object table then decides what happens.
def can_use(verb, stamina, now, last_used):
last = last_used.get(verb.name, float("-inf"))
off_cooldown = now - last >= verb.cooldown
return off_cooldown and stamina >= verb.stamina_costKeep the order consistent: check whether the verb can be used, then look up the outcome. There is one design choice here. Should a "no effect" result still spend stamina and start the cooldown? Charging the player for a pointless action punishes experimentation. Most games refund the cost or never charge it when the outcome is no_effect. Whichever you choose, apply it everywhere.
Making outcomes distinct
Different outcomes only add variety if the player can feel the difference. Check each cell against three questions:
- Does the result change the game state differently from the other cells in its row?
- Does the player see or hear a different response?
- Does the result lead to a different next decision?
If the answer to all three is no, two cells are the same outcome with different names, and one of them is wasted effort.
Common errors
- Exception-heavy design. Writing a special case for each object until the table has no pattern. Players cannot predict a result they cannot infer. Prefer property rules and keep overrides rare.
- Inconsistent rules. "Grab" picks up a crate but not an identical-looking box. The player concludes the game is arbitrary. Objects that look alike should behave alike.
- Hidden interactions. A valuable interaction that nothing hints at. Affordances and feedback, covered later, exist to solve this.
- Silent failure. Returning
no_effectwith no sound, animation, or message. At minimum, tell the player the verb was understood but did nothing. - Table explosion. Adding objects without checking whether each one earns its column. Every object needs at least two interesting verb outcomes.
A worked review
Suppose you have the verbs grab, throw, and jump, and a new object called a barrel. You decide it is heavy and can explode.
- Add the property:
explosive=True. - Fill the column. Grab gives
too_heavy. Throw givestoo_heavyas well, since the player cannot lift it. Jump givesclimb_on. - Notice that grab and throw now give the same result, so that part of the column is weak.
- Fix it by giving the barrel a different interaction elsewhere, for example a
pushverb that rolls it, or by lettingthrowon a smaller explosive object detonate it. - Re-run the gap check and play the interaction once.
The review exposed a weak column before any art or level work depended on it. That is the main value of the table: it moves problems from late playtesting to early design.
Exercise
A game has the verbs grab, throw, and jump, and the objects crate, lever, and enemy. Its table has 9 cells, and 4 of them read "no effect". Name two checks you would run before deciding whether this is a problem, and say what a "yes" answer would mean for each.
Show answer
First, check whether each "no effect" cell is intentional, for example throwing a wall-mounted lever. Unintentional gaps are bugs or missed design opportunities, and the player will expect a response. Second, check whether any row or column is mostly empty. A column that is mostly empty means the object offers few decisions and may not earn its place. A row that is mostly empty means the verb is narrow and could be merged into another verb. If every empty cell is deliberate and each row and column has at least two distinct outcomes, the table is fine.
Exercise
In the hybrid resolver, an object is marked both heavy and fragile, and the player throws it. Following the code above, what is the result, and is that a good design?
Show answer
The result is "shatter". The throw rule checks fragile and never looks at heavy, so the heavy flag has no effect on a throw. Whether it is good depends on intent. If a heavy object should be impossible to throw, the rule is wrong, and the fix is to check heavy first. The lesson is that property combinations need explicit tests, because rules written separately can interact in ways nobody planned.