Sub topic 11
Mapping verbs to controls
This chapter assumes you have read the earlier chapters on verb specification and on affordances and feedback. You should be able to write a verb as a name, a precondition, a cost, and an outcome. The Python examples need only basic reading skills.
A verb is a decision the player can make. A control is the physical thing the player does to communicate that decision. Mapping is the design work that connects them. A well-chosen verb set can still play badly if the mapping makes the right action slow, awkward, or easy to trigger by accident.
What a mapping has to achieve
A mapping succeeds when the player can express an intention without thinking about the hardware. Three properties matter most.
- Reach. Every verb the player needs has a control, and the player can reach it in time.
- Distinctness. Two verbs the player might want in the same moment do not share a control without a clear rule for which one wins.
- Predictability. The same input does the same kind of thing every time, or changes meaning in a way the player can see.
Each verb you add costs something in all three. The verb economy chapter argued for a small set. Mapping is where that argument becomes physical, because a controller has a fixed number of buttons and a player has a fixed number of fingers.
Count the input budget first
Before assigning anything, count what the device offers. A typical gamepad has four face buttons, two sticks (which also click), a directional pad, two bumpers, and two triggers. A mouse and keyboard has many more keys but fewer that can be pressed together while aiming. A touchscreen has almost no fixed buttons, and fingers cover the view.
Then count your verbs and note which must work at the same time. Movement usually runs continuously while other verbs fire. That pairing decides a lot: if the player must hold the stick to move and press a button to act, the buttons for time-critical verbs should be under the thumb or finger that is free.
| Verb frequency | Placement | Reason |
|---|---|---|
| Constant (move, look) | Sticks or WASD and mouse | The player never releases these |
| Frequent and urgent (jump, attack) | Primary buttons, easiest reach | Delay is felt immediately |
| Occasional (grab, interact) | Secondary buttons | Used in calm moments |
| Rare (inventory, map) | Menu or chorded input | Slowness is acceptable |
Frequency here comes from your core loop. If grabbing is how the player gets through most of the level, it is not occasional, whatever the verb list suggests.
Input patterns and what they cost
One button can carry more than one verb if you vary how it is pressed. Each pattern has a price in learnability and error.
| Pattern | Example | Benefit | Risk |
|---|---|---|---|
| Tap | Press to jump | Fast, simple | Uses one button per verb |
| Hold | Hold to charge a throw | Adds a continuous dimension to one verb | Needs feedback so the player knows the hold is registering |
| Double tap | Tap twice to dash | Saves a button | Delays the single tap, and is easy to trigger by mistake |
| Chord | Hold a bumper and press a face button | Many verbs from few buttons | Hard to reach under pressure |
| Context | Same button means grab or pull depending on target | Matches the verb-object table | Hidden meaning if the player cannot tell what is targeted |
Context is the most useful pattern for the design in this tutorial. In the verb-object table, grab on a crate and grab on a lever are different outcomes, but the player makes one decision with one button. The player does not need a separate "pull" control. This only works if the affordance and feedback chapter has done its job: the player must see which target is selected before pressing.
Contexts and conflicts
When one control serves several verbs, the game state decides which verb it triggers. In the earlier examples, grab and throw both act on a crate. A common design maps grab to a button when the player's hands are empty and throw to the same button when the player is carrying something. The state ("carrying") picks the verb, and the player's mental model stays simple: "the action button does the obvious thing with my hands."
The risk is a conflict: two verbs that are valid in the same context on the same control. It is easy to introduce one by accident as the verb set grows. Write the mapping as data, as you did for the verbs, and check it automatically.
from collections import defaultdict
# (verb, contexts where it is valid, control)
BINDINGS = [
("move", ("ground", "air", "carrying"), "left_stick"),
("jump", ("ground", "carrying"), "south"),
("grab", ("ground",), "west"),
("throw", ("carrying",), "west"),
]
def find_conflicts(bindings):
"""Return {(context, control): verbs} where several verbs share a slot."""
by_slot = defaultdict(set)
for verb, contexts, control in bindings:
for context in contexts:
by_slot[(context, control)].add(verb)
return {slot: verbs for slot, verbs in by_slot.items() if len(verbs) > 1}
print(find_conflicts(BINDINGS)) # {}
# A new verb is added that reuses the same button in the same context.
BINDINGS.append(("push", ("ground",), "west"))
for slot, verbs in find_conflicts(BINDINGS).items():
print(slot, sorted(verbs)) # ('ground', 'west') ['grab', 'push']The first call prints an empty dictionary, so grab and throw share the west button without trouble: they never apply in the same context. After push is added, the checker reports that grab and push both claim west on the ground. The fix is a design decision, not a code change. You might merge them into one context-sensitive verb, give push its own control, or make it a verb-object outcome of grab.
The checker finds only literal overlap. It cannot tell you that two verbs are valid at once in a context you forgot to list, so keep the context list honest.
Responsiveness: buffering and timing
Mapping also includes how forgiving the game is about timing. A player who presses jump 50 milliseconds before landing meant to jump. If the game ignores the press because the verb's precondition failed at that instant, the player experiences the controls as unreliable.
An input buffer remembers a recent press for a short window and applies it as soon as the precondition passes. It works alongside the can_use check from the specification chapter. The cooldown and the stamina cost still apply, but a press that was slightly early is not discarded.
class InputBuffer:
def __init__(self, window=0.15):
self.window = window # seconds a press stays valid
self.pressed_at = {}
def press(self, verb_name, now):
self.pressed_at[verb_name] = now
def consume(self, verb_name, now):
"""True once if a recent press is waiting; then clear it."""
t = self.pressed_at.get(verb_name)
if t is not None and now - t <= self.window:
del self.pressed_at[verb_name]
return True
return False
buf = InputBuffer(window=0.15)
buf.press("jump", now=1.00) # player presses slightly early
print(buf.consume("jump", 1.10)) # True: still inside the window
print(buf.consume("jump", 1.12)) # False: already used
buf.press("jump", now=2.00)
print(buf.consume("jump", 2.40)) # False: too oldEach frame, the game checks buf.consume("jump", now) only when can_use(...) is true. A window of about 100 to 200 milliseconds is a common starting point, but treat it as a value to tune in playtests. Too long and the character acts on a press the player has forgotten. Too short and the buffer is not felt.
Choosing a mapping: a workflow
The loop at the end matters. Mapping is rarely right the first time, because you only learn which verbs are urgent by watching people play.
Consistency, conventions, and accessibility
Players bring habits from other games. If your genre has a convention, such as the south face button for jump on a gamepad, following it lowers the learning cost at no price to you. Break a convention only when you gain something specific and you plan to teach the change.
Keep each verb on the same control across modes and menus wherever you can. If interact is west in the world, avoid making west mean "cancel" in the next screen over.
Support remapping. Players differ in hand size, dexterity, and device. A remapping screen is easiest to build when bindings are already data, as in the table above. It also exposes your conflict checker to player input, so run it on any custom mapping and show the player what clashes.
Offer alternatives to holds and rapid repeated presses where the verb allows it. A toggle option for a held verb costs little and makes the game playable for more people.
Common errors
- Mapping by arrangement, not by frequency. Verbs get placed in a tidy layout instead of by how the core loop uses them. The urgent verb ends up on the hardest-to-reach button.
- Overloading one button without visible state. The player cannot tell what the button will do, so they press it and get a surprise.
- Hidden hold or chord verbs. The verb exists in the table but most players never find it.
- No buffering. Early presses are dropped, and players blame the game for "eating" inputs.
- Treating mapping as final. Bindings that felt fine in a calm test room often fail during combat or timed sections.
Exercise
A platformer has these verbs: move, jump, grab, throw, and open_map. The player uses a gamepad. Grab and throw never apply in the same state, since throw requires carrying an object. Propose a mapping that gives each verb a control, say which verbs can share a button and why, and name one problem you would check for in a playtest.
Show answer
Put move on the left stick, since it is constant. Put jump on the south face button, since it is frequent and urgent. Put grab and throw on the same button, for example west, because grab applies only with empty hands and throw only while carrying, so the "carrying" state selects the verb and the two never conflict in the same context. Put open_map on a rarely used input such as the select or back button, since it is occasional and slowness is acceptable. In a playtest, check whether players press west expecting to grab while still carrying something, which suggests the carrying state is not visible enough. You can also check for dropped early jump presses, which would show that a buffer is needed.