Game Mechanic Spec: Decide the Details Before AI Codes It
Turn one game feature, like throwing a rock, into a spec of controls, timing, physics, and feedback, so your AI agent builds the game feel you imagined.
Added · Updated
"Add throwing a rock" hides a dozen design decisions. If you don't make them, the AI makes them for you, usually the bland default. Fill this in for ONE mechanic, then paste it into Claude Code, Cursor, Codex, or ChatGPT. Game: [TITLE, GENRE, 2D/3D] · Engine: [Canvas/WebGL single file / Phaser / Godot / Unity] Mechanic: [e.g. throw a rock, dash, grapple, double jump, parry] Why it exists (the player's goal it serves): [e.g. stun guards so you can sneak past] ## 1. Input - Button/key: [KEY / BUTTON / TOUCH]; press, hold, or release triggers it? [CHOICE] - Hold to charge? [no / yes: min [0.2]s, max [1.0]s, what charging changes] - Aiming: [facing direction / mouse / auto-aim nearest / arc preview] - Input buffer and coyote time: [e.g. accept the press up to 100 ms early] ## 2. Timing (in milliseconds or frames at 60 fps) - Wind-up: [ms] · Active: [ms] · Recovery: [ms] · Cooldown: [ms] - Can it be cancelled? Into what? [jump / dodge / nothing] - Can the player move while doing it? [no / slowed to [50]% / yes] ## 3. Physics and numbers - Speed/range: [units/s, max distance]; gravity/arc: [none / arc with gravity [X]] - What it collides with: [walls, enemies, water, the player] - On hit: [damage, stun [ms], knockback [units], destroyed / bounces [N] times / sticks] - Limits: [ammo count, pickup to reload, max [N] on screen] ## 4. Game feel (feedback for every phase) - Wind-up: [animation squash, sound] - Release: [sound, small camera kick, particle trail] - Hit: [hit-pause [40-80] ms, screen shake [strength, ms], flash, impact sound] - Miss: [what tells the player it missed] - UI: [cooldown indicator, ammo counter, aim line] ## 5. Rules and interactions - What enemies do when hit / when they hear it land: [REACTION] - Interactions with other mechanics: [e.g. throw while jumping? while hiding?] - Can it break the game? [infinite stun-lock, sequence skips]: prevent by [RULE] ## 6. Edge cases - Thrown point-blank into a wall; thrown off-screen; target dies mid-flight - Pressed during pause, cutscene, or death; spammed every frame; two inputs at once ## 7. Acceptance test (how I'll know it feels right) - [ ] I can hit a still target [3/3] times from [distance] without practice - [ ] A hit is obvious with the sound OFF - [ ] Spamming the button can't break [enemy AI / physics / score] - [ ] [YOUR FEEL TEST, e.g. "throwing feels snappy, not floaty"] ## Instructions to the AI Implement ONLY this mechanic in the existing project. Put every number above in one CONFIG/tuning block with comments so I can tweak them without reading code. Add a debug overlay toggled with [F1] that shows hitboxes, phase timers, and the last hit result. List anything in this spec you had to guess, then stop and wait for my playtest notes. --- EXAMPLE (filled in): throw a rock in a 2D stealth game Input: tap J throws toward facing direction; hold J up to 0.8 s to throw farther; arc preview while holding; 100 ms buffer. Timing: wind-up 120 ms, active until it lands, recovery 150 ms, cooldown 400 ms; dodge cancels the wind-up; player slowed to 40% while aiming. Physics: 600 units/s, gravity arc, max 12 tiles; collides with walls, guards, and glass; bounces once off walls; 3 rocks max, refilled from rock piles. Feel: soft grunt + whoosh on release; on guard hit: 60 ms hit-pause, small shake, stars over head; on landing: dust puff + clack sound that guards within 6 tiles can hear. Rules: hit guard is stunned 1.5 s, then alerted; guards who hear the landing walk to the sound for 4 s. Can't throw while hidden in a locker. Same guard can't be re-stunned for 3 s. Acceptance: hit a still guard 3/3 from 5 tiles; spam can't keep a guard stunned forever.
How to use it
- Click Copy template.
- Paste into ChatGPT, Claude, Grok, Cursor, or your agent framework.
- Replace the [BRACKETED] parts with your details.
FAQ
Why does my AI-made game feel floaty or bland?
Because a one-line feature request leaves the feel decisions to the model: timing, hit-pause, shake, sounds, and cancel rules. When those are unspecified, AI tends to pick safe defaults. Writing the numbers and feedback for each phase gives you the snappy feel you had in mind, and a tuning block lets you adjust it after playtesting.
How many mechanics should I put in one prompt?
One. Spec and build a single mechanic, playtest it, tune the numbers, then move to the next. Stuffing several mechanics into one prompt makes bugs hard to trace and the feel hard to judge.
Does this work with Godot, Unity, Phaser, or a single HTML file?
Yes. The spec is engine-neutral. Name your engine at the top and the agent will map timings, collisions, and feedback onto that engine's nodes, components, or game loop. For a brand-new single-file browser game, start with the one-prompt game builder and then add mechanics with this spec.
What numbers should I start with if I have no idea?
Use the worked example as a baseline and tune by feel: wind-ups of 80 to 150 ms feel responsive, hit-pause of 40 to 80 ms makes hits land, and cooldowns of 300 to 600 ms stop spam. Ask the AI to expose them in a CONFIG block and change one number at a time.
How do I get the AI to set up sprites, animations, and hitboxes for this mechanic?
Keep the art rules in a separate ASSETS.md: sprite sheet layout, pivots, import settings, animation fps, and collision layers. The mechanic spec says when the hitbox is active; ASSETS.md says which frame and which shape, so the agent wires both up without guessing.