How wumblecat/naruto-handsigns-battle works
Jutsu Duel is a desktop webcam/keyboard hand-sign fighting game. A player chooses an input mode, registers signs to cast jutsu, and fights a bot; the battle controller coordinates detection, sign stabilization, the deterministic engine and opponent, then results can be saved and viewed in history. The repository also documents practice, a jutsu reference, settings, account support, and a Python model-training workflow. Relationships are limited to README statements and shown source/index references; unsampled implementation details are represented at their documented subsystem paths.
Main entry points: router.tsx Routes and pages · BattlePage.tsx Battle screen · BattleController.ts Battle controller · PlayPage.tsx Play setup
Components 27
App and play
- Routes and pages
src/app/router.tsx - Play setup
src/pages/PlayPage.tsx - Practice
src/pages/PracticePage.tsx - Jutsu book
src/pages/JutsuBookPage.tsx - Settings
src/pages/SettingsPage.tsx - Battle screen
src/pages/BattlePage.tsx - Match results
src/pages/ResultsPage.tsx
Sign input
- Camera access
src/features/camera/useCamera.ts - Hand tracking
src/detection/mediapipe.ts - Sign recognition
src/detection/model.ts - Keyboard detector
src/detection/keyboard.ts - Training recorder
src/pages/dev/RecorderPage.tsx
Battle runtime
- Game content
src/content/content.config.ts - Game balance
src/content/balance.config.ts - Battle controller
src/features/battle/BattleController.ts - Sign stabilizer
src/engine/stabilizer.ts - Battle engine
src/engine/engine.ts - Bot opponent
src/opponent/bot.ts
Accounts and records
- Save match
src/features/results/useSaveMatch.ts - Match history
src/features/history/useMatchHistory.ts - Authentication
src/features/auth/AuthProvider.tsx - Settings sync
src/features/settings/useSettingsSync.ts - Local settings
src/lib/settings/store.ts
Model training
- Model trainer
ml/jutsu_ml/train.py - Recognition model
src/detection/model.ts
Other components
- Player
- Supabase
Connections 29
- Player → Routes and pages: opens game
src/app/router.tsx - Routes and pages → Play setup: routes to
src/app/router.tsx - Routes and pages → Practice: routes to
src/app/router.tsx - Routes and pages → Jutsu book: routes to
src/app/router.tsx - Routes and pages → Settings: routes to
src/app/router.tsx - Routes and pages → Battle screen: routes to
src/app/router.tsx - Routes and pages → Match results: routes to
src/app/router.tsx - Play setup → Camera access: selects webcam
- Camera access → Hand tracking: provides video
- Hand tracking → Sign recognition: feeds landmarks
src/detection/mediapipe.ts - Play setup → Keyboard detector: selects keyboard
- Battle screen → Battle controller: creates battle
src/pages/BattlePage.tsx - Battle screen → Sign recognition: checks model
src/pages/BattlePage.tsx - Battle controller → Sign stabilizer: stabilizes signs
src/features/battle/BattleController.ts - Battle controller → Battle engine: registers signs
src/features/battle/BattleController.ts - Battle controller → Bot opponent: starts opponent
src/features/battle/BattleController.ts - Battle engine → Game balance: uses rules
src/engine/engine.ts - Battle screen → Game content: renders themed UI
src/pages/BattlePage.tsx - Battle engine → Battle screen: emits battle events
src/pages/BattlePage.tsx - Match results → Save match: saves outcome
src/features/results/useSaveMatch.ts - Save match → Supabase: writes match
src/features/results/useSaveMatch.ts - Match history → Supabase: loads matches
src/features/history/useMatchHistory.ts - Authentication → Supabase: uses auth service
- Settings → Settings sync: syncs preferences
src/features/settings/useSettingsSync.ts - Settings sync → Local settings: reads and writes
src/features/settings/useSettingsSync.ts - Settings sync → Supabase: syncs account settings
src/features/settings/useSettingsSync.ts - Training recorder → Hand tracking: captures hand data
src/pages/dev/RecorderPage.tsx - Model trainer → Recognition model: exports model
README.md - Recognition model → Sign recognition: provides inference model
src/detection/model.ts