Sub topic 6
Limiting verbs with costs and cooldowns
A verb with no limit is usually a verb with one best use: the player repeats it all the time. This chapter covers the two most common limits, costs and cooldowns. It shows how to implement them and how to choose values for them. It also covers the errors that make limits feel unfair. You should already be able to read a verb specification (preconditions, cost, outcome) and read short Python examples.
Why limit a verb
A verb creates a decision only when using it has a price. If throw is free and instant, the player throws every time. The verb then stops being a choice and becomes a habit.
Limits do three jobs:
- They create trade-offs. Spending stamina on a jump means not having it for a throw.
- They shape pacing. A cooldown forces a pause, and the pause is where the player reads the situation.
- They keep verbs distinct. Two verbs with similar effects stay separate if one is cheap and slow and the other is expensive and fast.
Limits belong to the verb specification, not to the level. The verb carries its own cost and cooldown, so you can read and compare every limit in one table.
Kinds of limits
| Limit | What it restricts | Typical use | Main risk |
|---|---|---|---|
| Resource cost | Total use over time | Stamina, mana, ammo | Players hoard the resource and never use the verb |
| Cooldown | Frequency of use | Dash, heal, special attacks | Dead time where the player has nothing to do |
| Charges | Bursts of use, then recovery | Two dashes, then wait | Hard to read without a visible counter |
| Windup and recovery | Vulnerability around the action | Heavy swing, reload | Feels unresponsive if too long |
| Precondition | Where and when the verb works | Must stand on ground, must hold an item | Player cannot tell why the verb failed |
Most games combine two or three of these on different verbs. A cheap verb may have only a cooldown. A powerful one may have a cost and a cooldown together.
Costs: what they teach the player
A cost can be paid from a pool that refills (stamina), from a pool that does not (ammunition), or from an exposed risk (a slow recovery during which you can be hit). Each teaches something different.
- A refilling pool teaches rhythm. The player learns to act, then rest.
- A non-refilling pool teaches rationing. Every use is a commitment.
- A risk cost teaches timing. The player waits for a safe window.
When you set a cost, compare it with the pool size. A cost of 10 against a pool of 100 allows ten uses before the player is stuck. Against a pool of 30, it allows three. Express costs as a fraction of the pool when you tune.
Cooldowns: what they teach the player
A cooldown is a minimum gap between two uses of the same verb. Short cooldowns (a fraction of a second) mainly prevent input spam and animation overlap. Long cooldowns (many seconds) turn a verb into a decision about when to spend it.
Decide these points explicitly, because each changes the feel:
- Where the clock starts. The timer can start when the verb begins or when its animation ends. Starting at the end makes long animations stack onto the cooldown.
- Whether cooldowns are shared. A global cooldown blocks all verbs for a moment after any use. A per-verb cooldown blocks only that verb.
- What units the clock uses. Real-time games count seconds. Turn-based games count turns.
- What happens during a pause. The cooldown clock must stop when the game pauses.
Implementing the checks
This code builds on the verb table from the specification chapter. The refusal function returns the reason a verb is blocked, or None if it can be used. Returning a reason, not just False, lets the game tell the player what went wrong. The simulation below regenerates stamina over time, as many games do.
from dataclasses import dataclass
@dataclass(frozen=True)
class Verb:
name: str
stamina_cost: int
cooldown: float # seconds
VERBS = {
"move": Verb("move", 0, 0.0),
"jump": Verb("jump", 10, 0.2),
"grab": Verb("grab", 5, 0.5),
"throw": Verb("throw", 15, 1.0),
}
MAX_STAMINA = 30.0
REGEN_PER_SECOND = 10.0
def refusal(verb, stamina, now, last_used):
last = last_used.get(verb.name, float("-inf"))
if now - last < verb.cooldown:
return "cooldown"
if stamina < verb.stamina_cost:
return "stamina"
return None
def simulate(events):
stamina = MAX_STAMINA
last_used = {}
previous = 0.0
for now, name in events:
stamina = min(MAX_STAMINA, stamina + REGEN_PER_SECOND * (now - previous))
previous = now
verb = VERBS[name]
reason = refusal(verb, stamina, now, last_used)
if reason is None:
stamina -= verb.stamina_cost
last_used[name] = now
result = "ok"
else:
result = "refused: " + reason
print(f"{now:.1f}s {name:<5} -> {result} (stamina {stamina:.0f})")
simulate([(0.0, "throw"), (0.5, "throw"), (1.0, "jump"),
(1.1, "jump"), (1.5, "grab")])
# 0.0s throw -> ok (stamina 15)
# 0.5s throw -> refused: cooldown (stamina 20)
# 1.0s jump -> ok (stamina 15)
# 1.1s jump -> refused: cooldown (stamina 16)
# 1.5s grab -> ok (stamina 15)Notice three things in the trace. The second throw fails on cooldown even though stamina (20) would cover it. The second jump fails on cooldown, not stamina. The cooldown is checked first, so the reason reported is the first constraint that fails. If both constraints fail, the player sees only one reason. Pick the order deliberately, because it decides which problem the player fixes first.
The pattern for every use is the same: check, then spend, then record the time. Spending before the check, or recording the time on a refused attempt, are both common bugs.
Tuning values
Start from the intended rhythm, then derive the numbers.
- Pick how often you want the player to use the verb in a typical fight or room. If you want a throw about every 4 seconds, a 1 second cooldown is only a floor. The cost and regeneration rate must do the rest.
- With regeneration, the sustained rate is regen divided by cost. At 10 stamina per second, a verb costing 15 can be sustained about once per 1.5 seconds. Raising the cooldown above that changes nothing, because the cooldown is already the tighter limit.
- Check which limit is binding for each verb. If the cooldown is always the one that blocks, the cost is decoration. If stamina always blocks, the cooldown is decoration. Remove or change the one that never matters.
- Keep one verb free. In the table above,
movecosts nothing. A player who has run out of everything should still be able to act, or the game stalls.
Common errors
Silent refusal. The player presses a button and nothing happens. Without a reason, they assume a bug. Show a cooldown ring, a grayed icon, or a short sound for each refusal type. Feedback is covered in a later chapter.
Dead time. A long cooldown on the verb the player needs most leaves them waiting. Give them another useful verb to use while the first recovers.
Cost never binds. If stamina regenerates faster than it is spent, it never limits anything. Simulate a player who uses the verb as often as allowed, and check the pool actually drops.
Cost always binds. The opposite problem: the player is always empty and the optimal play is to wait. Hoarding also appears here, where players avoid a costly verb to keep the resource "just in case."
Cooldown tied to frame rate. Counting frames makes cooldowns shorter on fast machines. Use elapsed time from a clock that stops during pause.
Input lost to a near miss. If the player presses a verb 0.05 seconds before the cooldown ends, a strict check discards the input. Many games buffer the press for a short window (about 0.1 to 0.2 seconds) and fire it when the verb becomes available.
Edge cases to decide up front
- Refunds. If a verb is interrupted before its outcome, does the player get the cost back? State the rule and apply it to every verb.
- Cost paid on attempt or on success. Paying on attempt discourages spamming a verb that has no valid target. Paying on success feels fairer but allows free probing. For example,
grabon an object that cannot be grabbed should usually cost nothing. - Cooldown reduction and cost reduction. Upgrades that lower these values can drive them to zero and remove the verb's limit. Set a floor in the data.
- Pool cap. Regeneration into a pool with no cap rewards waiting. The cap in the example (30) bounds how much the player can bank.
Exercise
Using the VERBS table and the simulation above (max stamina 30, regeneration 10 per second), a player starts with full stamina and requests "throw" at 0.0 s, then "throw" again at 1.0 s. Is the second throw allowed? Which limit decides it, and what is the stamina just before the second request is checked?
Show answer
It is allowed. After the first throw, stamina is 15. Over the next 1.0 s it regenerates by 10, giving 25 before the second request. The cooldown check passes because 1.0 - 0.0 = 1.0 is not less than the 1.0 s cooldown. The stamina check passes because 25 is at least the cost of 15. After the second throw, stamina is 10.
Exercise
A designer sets the cooldown of a verb to 0.5 s and its cost to 5 stamina, with regeneration of 20 per second. Testing shows players can use the verb every 0.5 s forever. Which limit is binding, and what is one change that would make the cost matter?
Show answer
The cooldown is binding. Regeneration over 0.5 s is 10 stamina, which is more than the cost of 5, so the pool never drops. To make the cost matter, raise it above 10 (for example 15) or lower regeneration below 10 per second. The verb is then limited by stamina in sustained use instead of by the cooldown alone.