# abhisheksiloiya/ar-games architecture

> Architecture diagram of the GitHub repository abhisheksiloiya/ar-games, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abhisheksiloiya/ar-games
- Repository: https://github.com/abhisheksiloiya/ar-games

## Overview

Romp is a browser-based, camera-tracked motion-game suite: players choose a game, allow camera access, and use tracked body movement to play rounds rendered on a connected display. The main runtime path is the React shell and stage, camera/pose tracking, game logic, shared game and rendering services, then round results and progression. The README documents additional game families and presentation modes. Some connections below rely on README statements or the SOURCE INDEX; unsampled implementation details are not inferred.

Main entry points: [`src/main.tsx`](https://github.com/abhisheksiloiya/ar-games/blob/master/src/main.tsx) (Game selection), [`src/kit.ts`](https://github.com/abhisheksiloiya/ar-games/blob/master/src/kit.ts) (Shared game kit), [`src/games/freeze.ts`](https://github.com/abhisheksiloiya/ar-games/blob/master/src/games/freeze.ts) (Freeze Dance), [`src/games/pulse.ts`](https://github.com/abhisheksiloiya/ar-games/blob/master/src/games/pulse.ts) (Pulse rhythm)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and Sessions"]
  node_shell["React shell<br/>[main.tsx]"]
  node_stage["Session stage<br/>[stage.tsx]"]
  node_gamecatalog["Game selection<br/>[main.tsx]"]
end

subgraph group_tracking["Camera and Tracking"]
  node_setup["Camera setup<br/>[setup.tsx]"]
  node_calibration["Pose calibration<br/>[calibration.ts]"]
  node_pose["Pose tracking<br/>[pose.ts]"]
  node_worker["Pose worker<br/>[pose.worker.ts]"]
  node_trackeruntime["Tracking runtime"]
end

subgraph group_play["Games and Rendering"]
  node_freeze["Freeze Dance<br/>[freeze.ts]"]
  node_pulse["Pulse rhythm<br/>[pulse.ts]"]
  node_slice["Slice game<br/>[slice.ts]"]
  node_fitness["Fitness games<br/>[run.ts]"]
  node_othergames["Other game modules"]
  node_kit["Shared game kit<br/>[kit.ts]"]
  node_engine["PlayCanvas engine<br/>[engine.ts]"]
  node_cut["Camera cutout<br/>[cut.ts]"]
  node_reps["Exercise detectors<br/>[reps.ts]"]
  node_freezerules["Freeze rules<br/>[freeze-rules.ts]"]
  node_modelplayer["Player models<br/>[model-player.ts]"]
  node_pace["Render pacing<br/>[pace.ts]"]
end

subgraph group_results["Sound and Progression"]
  node_audio["Audio engine<br/>[audio.ts]"]
  node_song["Song synthesis<br/>[song.ts]"]
  node_chart["Rhythm charts<br/>[chart.ts]"]
  node_stats["Session records<br/>[stats.ts]"]
  node_meta["Progression<br/>[meta.ts]"]
  node_catalog["Moon game catalog<br/>[moon-catalog.ts]"]
  node_freezesession["Freeze results<br/>[freeze-session.ts]"]
end

node_player(("Player"))

node_player -->|"chooses game"| node_shell
node_shell -->|"offers games"| node_gamecatalog
node_shell -->|"shows setup"| node_setup
node_shell -->|"mounts session"| node_stage
node_player -->|"allows camera"| node_setup
node_setup -->|"measures pose"| node_calibration
node_pose -->|"uses runtime"| node_trackeruntime
node_worker -->|"uses runtime"| node_trackeruntime
node_setup -.->|"starts tracking"| node_pose
node_stage -->|"reads player poses"| node_pose
node_stage -.->|"loads round game"| node_gamecatalog
node_gamecatalog -->|"offers game"| node_freeze
node_gamecatalog -->|"offers game"| node_pulse
node_gamecatalog -->|"offers game"| node_slice
node_gamecatalog -->|"offers games"| node_fitness
node_gamecatalog -->|"offers games"| node_othergames
node_freeze -->|"uses rules"| node_freezerules
node_freeze -->|"builds result"| node_freezesession
node_pulse -->|"builds chart"| node_chart
node_pulse -->|"plays song"| node_song
node_chart -->|"reads events"| node_song
node_fitness -->|"uses detectors"| node_reps
node_freeze -->|"uses shared kit"| node_kit
node_pulse -->|"uses shared kit"| node_kit
node_slice -->|"uses shared kit"| node_kit
node_fitness -->|"uses shared kit"| node_kit
node_kit -->|"reads tracking"| node_pose
node_kit -->|"uses rendering"| node_engine
node_kit -->|"uses sound"| node_audio
node_engine -->|"profiles pacing"| node_pace
node_engine -->|"uses cutout"| node_cut
node_song -->|"uses audio clock"| node_audio
node_shell -.->|"records sessions"| node_stats
node_meta -->|"derives progress"| node_stats
node_meta -->|"reads game IDs"| node_catalog
node_meta -->|"validates results"| node_freezesession
node_fitness -->|"uses player models"| node_modelplayer

click node_shell "https://github.com/abhisheksiloiya/ar-games/blob/master/src/main.tsx"
click node_stage "https://github.com/abhisheksiloiya/ar-games/blob/master/src/stage.tsx"
click node_setup "https://github.com/abhisheksiloiya/ar-games/blob/master/src/setup.tsx"
click node_calibration "https://github.com/abhisheksiloiya/ar-games/blob/master/src/calibration.ts"
click node_pose "https://github.com/abhisheksiloiya/ar-games/blob/master/src/pose.ts"
click node_worker "https://github.com/abhisheksiloiya/ar-games/blob/master/src/pose.worker.ts"
click node_trackeruntime "https://github.com/abhisheksiloiya/ar-games/blob/master/src/tracking-runtime.ts"
click node_gamecatalog "https://github.com/abhisheksiloiya/ar-games/blob/master/src/main.tsx"
click node_freeze "https://github.com/abhisheksiloiya/ar-games/blob/master/src/games/freeze.ts"
click node_pulse "https://github.com/abhisheksiloiya/ar-games/blob/master/src/games/pulse.ts"
click node_slice "https://github.com/abhisheksiloiya/ar-games/blob/master/src/games/slice.ts"
click node_fitness "https://github.com/abhisheksiloiya/ar-games/blob/master/src/games/run.ts"
click node_othergames "https://github.com/abhisheksiloiya/ar-games/tree/master/src/games"
click node_kit "https://github.com/abhisheksiloiya/ar-games/blob/master/src/kit.ts"
click node_engine "https://github.com/abhisheksiloiya/ar-games/blob/master/src/engine.ts"
click node_cut "https://github.com/abhisheksiloiya/ar-games/blob/master/src/cut.ts"
click node_audio "https://github.com/abhisheksiloiya/ar-games/blob/master/src/audio.ts"
click node_song "https://github.com/abhisheksiloiya/ar-games/blob/master/src/song.ts"
click node_chart "https://github.com/abhisheksiloiya/ar-games/blob/master/src/chart.ts"
click node_stats "https://github.com/abhisheksiloiya/ar-games/blob/master/src/stats.ts"
click node_meta "https://github.com/abhisheksiloiya/ar-games/blob/master/src/meta.ts"
click node_catalog "https://github.com/abhisheksiloiya/ar-games/blob/master/src/moon-catalog.ts"
click node_reps "https://github.com/abhisheksiloiya/ar-games/blob/master/src/reps.ts"
click node_freezerules "https://github.com/abhisheksiloiya/ar-games/blob/master/src/freeze-rules.ts"
click node_freezesession "https://github.com/abhisheksiloiya/ar-games/blob/master/src/freeze-session.ts"
click node_modelplayer "https://github.com/abhisheksiloiya/ar-games/blob/master/src/model-player.ts"
click node_pace "https://github.com/abhisheksiloiya/ar-games/blob/master/src/pace.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_shell,node_stage,node_gamecatalog toneBlue
class node_setup,node_calibration,node_pose,node_worker,node_trackeruntime toneAmber
class node_freeze,node_pulse,node_slice,node_fitness,node_othergames,node_kit,node_engine,node_cut,node_reps,node_freezerules,node_modelplayer,node_pace toneMint
class node_audio,node_song,node_chart,node_stats,node_meta,node_catalog,node_freezesession toneRose
class node_player toneIndigo
```

## Components

### App and Sessions

- [React shell](https://github.com/abhisheksiloiya/ar-games/blob/master/src/main.tsx): `src/main.tsx`
- [Session stage](https://github.com/abhisheksiloiya/ar-games/blob/master/src/stage.tsx): `src/stage.tsx`
- [Game selection](https://github.com/abhisheksiloiya/ar-games/blob/master/src/main.tsx): `src/main.tsx`

### Camera and Tracking

- [Camera setup](https://github.com/abhisheksiloiya/ar-games/blob/master/src/setup.tsx): `src/setup.tsx`
- [Pose calibration](https://github.com/abhisheksiloiya/ar-games/blob/master/src/calibration.ts): `src/calibration.ts`
- [Pose tracking](https://github.com/abhisheksiloiya/ar-games/blob/master/src/pose.ts): `src/pose.ts`
- [Pose worker](https://github.com/abhisheksiloiya/ar-games/blob/master/src/pose.worker.ts): `src/pose.worker.ts`
- [Tracking runtime](https://github.com/abhisheksiloiya/ar-games/blob/master/src/tracking-runtime.ts): `src/tracking-runtime.ts`

### Games and Rendering

- [Freeze Dance](https://github.com/abhisheksiloiya/ar-games/blob/master/src/games/freeze.ts): `src/games/freeze.ts`
- [Pulse rhythm](https://github.com/abhisheksiloiya/ar-games/blob/master/src/games/pulse.ts): `src/games/pulse.ts`
- [Slice game](https://github.com/abhisheksiloiya/ar-games/blob/master/src/games/slice.ts): `src/games/slice.ts`
- [Fitness games](https://github.com/abhisheksiloiya/ar-games/blob/master/src/games/run.ts): `src/games/run.ts`
- [Other game modules](https://github.com/abhisheksiloiya/ar-games/tree/master/src/games): `src/games`
- [Shared game kit](https://github.com/abhisheksiloiya/ar-games/blob/master/src/kit.ts): `src/kit.ts`
- [PlayCanvas engine](https://github.com/abhisheksiloiya/ar-games/blob/master/src/engine.ts): `src/engine.ts`
- [Camera cutout](https://github.com/abhisheksiloiya/ar-games/blob/master/src/cut.ts): `src/cut.ts`
- [Exercise detectors](https://github.com/abhisheksiloiya/ar-games/blob/master/src/reps.ts): `src/reps.ts`
- [Freeze rules](https://github.com/abhisheksiloiya/ar-games/blob/master/src/freeze-rules.ts): `src/freeze-rules.ts`
- [Player models](https://github.com/abhisheksiloiya/ar-games/blob/master/src/model-player.ts): `src/model-player.ts`
- [Render pacing](https://github.com/abhisheksiloiya/ar-games/blob/master/src/pace.ts): `src/pace.ts`

### Sound and Progression

- [Audio engine](https://github.com/abhisheksiloiya/ar-games/blob/master/src/audio.ts): `src/audio.ts`
- [Song synthesis](https://github.com/abhisheksiloiya/ar-games/blob/master/src/song.ts): `src/song.ts`
- [Rhythm charts](https://github.com/abhisheksiloiya/ar-games/blob/master/src/chart.ts): `src/chart.ts`
- [Session records](https://github.com/abhisheksiloiya/ar-games/blob/master/src/stats.ts): `src/stats.ts`
- [Progression](https://github.com/abhisheksiloiya/ar-games/blob/master/src/meta.ts): `src/meta.ts`
- [Moon game catalog](https://github.com/abhisheksiloiya/ar-games/blob/master/src/moon-catalog.ts): `src/moon-catalog.ts`
- [Freeze results](https://github.com/abhisheksiloiya/ar-games/blob/master/src/freeze-session.ts): `src/freeze-session.ts`

### Other components

- **Player**

## Connections

- Player → React shell: chooses game
- React shell → Game selection: offers games (evidence: `src/main.tsx`)
- React shell → Camera setup: shows setup (evidence: `src/main.tsx`)
- React shell → Session stage: mounts session (evidence: `src/main.tsx`)
- Player → Camera setup: allows camera
- Camera setup → Pose calibration: measures pose (evidence: `src/main.tsx`)
- Pose tracking → Tracking runtime: uses runtime (evidence: `src/pose.ts`)
- Pose worker → Tracking runtime: uses runtime (evidence: `src/pose.worker.ts`)
- Camera setup → Pose tracking: starts tracking
- Session stage → Pose tracking: reads player poses
- Session stage → Game selection: loads round game (evidence: `src/main.tsx`)
- Game selection → Freeze Dance: offers game (evidence: `src/main.tsx`)
- Game selection → Pulse rhythm: offers game (evidence: `src/main.tsx`)
- Game selection → Slice game: offers game (evidence: `src/main.tsx`)
- Game selection → Fitness games: offers games (evidence: `src/main.tsx`)
- Game selection → Other game modules: offers games (evidence: `src/main.tsx`)
- Freeze Dance → Freeze rules: uses rules (evidence: `src/games/freeze.ts`)
- Freeze Dance → Freeze results: builds result (evidence: `src/freeze-session.ts`)
- Pulse rhythm → Rhythm charts: builds chart (evidence: `src/games/pulse.ts`)
- Pulse rhythm → Song synthesis: plays song (evidence: `src/games/pulse.ts`)
- Rhythm charts → Song synthesis: reads events (evidence: `src/chart.ts`)
- Fitness games → Exercise detectors: uses detectors (evidence: `src/games/run.ts`)
- Freeze Dance → Shared game kit: uses shared kit (evidence: `src/games/freeze.ts`)
- Pulse rhythm → Shared game kit: uses shared kit (evidence: `src/games/pulse.ts`)
- Slice game → Shared game kit: uses shared kit (evidence: `src/games/slice.ts`)
- Fitness games → Shared game kit: uses shared kit (evidence: `src/games/run.ts`)
- Shared game kit → Pose tracking: reads tracking (evidence: `src/kit.ts`)
- Shared game kit → PlayCanvas engine: uses rendering (evidence: `src/kit.ts`)
- Shared game kit → Audio engine: uses sound (evidence: `src/kit.ts`)
- PlayCanvas engine → Render pacing: profiles pacing (evidence: `src/engine.ts`)
- PlayCanvas engine → Camera cutout: uses cutout (evidence: `src/engine.ts`)
- Song synthesis → Audio engine: uses audio clock (evidence: `src/song.ts`)
- React shell → Session records: records sessions (evidence: `src/main.tsx`)
- Progression → Session records: derives progress (evidence: `src/meta.ts`)
- Progression → Moon game catalog: reads game IDs (evidence: `src/meta.ts`)
- Progression → Freeze results: validates results (evidence: `src/meta.ts`)
- Fitness games → Player models: uses player models (evidence: `src/games/run.ts`)
