跳到正文
Casually coded· 来源· @casuallycoded · X·· 4 天前精选AI 评分78
推荐理由

原文拆解了从Three.js搭建到MediaPipe手势识别的完整开发链路,提供了可直接复用的Prompt与工具组合。

正文 · 原文

Want to create a game like Small Magic by @BlendiByl yourself?

Here's the stack and the workflow, from an empty folder to casting spells with your hands.

The engine: Three.js. It renders full 3D scenes in the browser through WebGL, so the game runs on any device with a link and nothing to install. Add Rapier if you want real physics for projectiles and collisions.

The builder: an AI coding agent like Claude Code or Grok. The way to work with it is to build in layers. Start with the core loop: "First-person Three.js scene with pointer-lock controls, terrain, a few buildings, and a fireball that spawns from the camera on click, travels forward and explodes on collision."
Once that feels good, add the spell bar, then enemies, then effects. One feature per prompt keeps every change easy to test and easy to roll back.

The feel: this is what separates a demo from a game. Ask for particle explosions, camera shake on impact, a short cooldown on each spell and a sound on every cast. Small changes here make the biggest difference to how the game plays.

The platform: Patch (patch(.)gg). It has a CLI and an MCP server, so your agent can build, publish and update the game directly. It also has about 50,000 open-source assets with license info attached, which means models, textures and sounds are ready from day one. You end up with a link anyone can play instantly.

Now the bonus: casting spells with your bare hands, using only a webcam.

Blendi built this with MediaPipe, Google's open-source hand-tracking library. It runs entirely in the browser on the GPU and returns 21 3D landmarks per hand in real time: wrist, knuckles and every fingertip.

From there, the controls are geometry:
Palm position goes through a raycaster into the 3D world and becomes your aim.
Fingertip distance from the palm tells an open hand from a fist, so an open hand charges a spell and a fist releases it.
Wrist velocity between frames detects a swipe, and its direction sets the angle of a slash.
MediaPipe's Gesture Recognizer also classifies common hand shapes out of the box, like Open_Palm, Closed_Fist, Pointing_Up and Victory, so you can map each one to a different spell.

The prompt:
"Add webcam hand controls using MediaPipe's Gesture Recognizer. Show a small webcam preview in the corner. Raycast the palm position into the scene for aiming. Open_Palm charges the selected spell, Closed_Fist casts it, and a fast horizontal wrist movement triggers a slash in that direction. Smooth the landmarks with a One Euro filter so aiming stays steady."

That last line is the key detail. Raw landmarks jitter slightly from frame to frame, and the filter makes aiming feel precise.

A few years ago this setup needed a VR headset and a game studio. Now it takes a browser, a webcam and a weekend.

Bookmark this to replicate this with your coding agent later

引用Blendi@BlendiByl
found a way to use my spell WITH MY OWN HANDS without VR! never have i felt such wizardly power 🧙‍♂️ very experimental right now, let me know if you'd like to try and i'll polish and release it!
在 X 查看被引用的帖子

来源:Casually coded · x.com