mechanic
Add a game mechanic by implementing a puzzle class with world objects and interaction wiring
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Add a game mechanic by implementing a puzzle class with world objects and interaction wiring
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
Create a Three.js + WebXR game from scratch starting from a concept description
Run build verification — checks compilation, validates level configs, finds missing imports
Create or modify a game level with environment, decorations, and props
Run semantic validation on a generated game — checks level configs, puzzle wiring, level transitions, decoration types, and model references
استنادا إلى تصنيف SOC المهني
| name | mechanic |
| description | Add a game mechanic by implementing a puzzle class with world objects and interaction wiring |
| argument-hint | [games/<slug>] "description of the mechanic" |
| user-invocable | true |
| allowed-tools | Read, Bash, Glob, Grep, Write, Edit |
| agent | gameplay-dev |
| context | fork |
You implement game mechanics for Three.js + WebXR games.
Complete ALL steps in a SINGLE run. NEVER use AskUserQuestion. NEVER stop early.
Read the CLAUDE.md file in the repo root to understand project structure, conventions, and paths.
/mechanic [games/<slug>] "<description of the mechanic>"
The first argument may be a game path (starts with games/):
/mechanic games/my-game "collect 4 gems and place them on pedestals"/mechanic "collect 4 gems" → auto-detect by finding the most recently modified games/*/GAME_DESIGN.mdAfter resolving the game directory, all file paths are relative to it.
/mechanic games/crystal-forest "collect 4 colored gems and place them on matching pedestals"/mechanic "activate 5 rune stones in the correct order"/mechanic games/haunted-mansion "pull a lever to raise a bridge"/mechanic "find 3 keys hidden in the scene to unlock the exit door"Always read GAME_DESIGN.md inside the game directory for:
Always read existing puzzle files to avoid conflicts with registered puzzle IDs.
Parse the description. Determine:
Write to <game-dir>/src/puzzle/puzzles/YourPuzzleName.js:
PuzzleBaseonActivate(), onSolved(), update(dt), init()ObjectFactory for procedural objectsInteractionSystemEdit <game-dir>/src/engine/Engine.js to:
puzzle.dependencies = ['dep_id1', 'dep_id2']puzzleManager.register(puzzle)puzzleManager.init() is called after registrationPuzzle dependencies: PuzzleManager supports two modes:
dependencies set → sequential chaindependencies → activates only when ALL deps are solved. Root puzzles (empty deps) activate on init.If the mechanic needs dedicated world geometry (a puzzle room, a special area):
<game-dir>/src/world/YourArea.js or inline in the puzzle classPrint:
Mechanic "name" implemented!
- Puzzle class: <game-dir>/src/puzzle/puzzles/YourPuzzle.js
- Pattern: collect-and-place (or sequence, trigger, custom)
- Registered in Engine.js with PuzzleManager
Player finds objects scattered in the world, grabs them (grip), carries them to target locations, and releases them. If released close enough to the target, the object snaps into place.
Key systems: InteractionSystem (grab/release), proximity check on release, EventBus for feedback.
Player must activate a series of objects in a specific order. Activation can be by trigger (VR controller ray), proximity (walking close), or A-button press.
Key systems: InteractionSystem (activate), sequence tracking, visual feedback (glow/color change).
Player activates a single trigger (lever, button, pressure plate) which causes an environmental animation (bridge rises, door opens, wall moves). Often gated behind completing other puzzles.
Key systems: InteractionSystem or proximity, tween animation in update(dt), CollisionSystem updates after animation.
See framework/docs/MECHANIC-PATTERNS.md for complete code examples of each pattern.