# sifrex19-blip/repel-game architecture

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

- Interactive diagram: https://gitdiagram.com/sifrex19-blip/repel-game
- Repository: https://github.com/sifrex19-blip/repel-game

## Overview

Repel is a Flutter/Flame fitness wave-defense game: the player performs pushups in view of the phone camera, on-device pose detection counts reps, and reps become attacks that defeat enemies and earn coins for upgrades and later waves. The map preserves the documented camera/pose, combat, campaign, progression, and settings capabilities, with paths taken from the tree. Source excerpts cover only native platform setup, so most Dart-level connections below are documented README flows; internal call details are not verified.

Main entry points: [`lib/m1/pose_detector_service.dart`](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m1/pose_detector_service.dart) (Pose Detection), [`lib/m2/repel_game.dart`](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/repel_game.dart) (Repel Game), [`lib/m2/levels.dart`](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/levels.dart) (Campaign Levels), [`lib/settings_panel.dart`](https://github.com/sifrex19-blip/repel-game/blob/main/lib/settings_panel.dart) (Settings Panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App Shell"]
  node_app_shell["App Shell<br/>[app_shell.dart]"]
  node_settings["App Settings<br/>[app_settings.dart]"]
  node_settings_panel["Settings Panel"]
end

subgraph group_fitness["Fitness Input"]
  node_camera_gate["Camera Gate<br/>[camera_gate.dart]"]
  node_pose_screen["Pose Screen<br/>[pose_screen.dart]"]
  node_pose_detector["Pose Detection"]
  node_frame_converter["Frame Conversion"]
  node_pose_overlay["Pose Overlay<br/>[pose_overlay.dart]"]
  node_rep_counter["Pushup Counter"]
  node_pushup_gate["Pushup Gate<br/>[pushup_gate.dart]"]
end

subgraph group_combat["Combat Campaign"]
  node_game["Repel Game<br/>[repel_game.dart]"]
  node_game_camera["Arena Camera<br/>[game_camera.dart]"]
  node_enemy["Enemies<br/>[enemy.dart]"]
  node_levels["Campaign Levels<br/>[levels.dart]"]
  node_level_ui["Level UI<br/>[level_ui.dart]"]
  node_pixel_art["Pixel Art<br/>[pixel_art.dart]"]
  node_pixel_ui["Pixel UI<br/>[pixel_ui.dart]"]
end

subgraph group_progression["Progression"]
  node_economy["Game Economy<br/>[economy.dart]"]
  node_shop["Upgrade Shop<br/>[shop_panel.dart]"]
  node_local_save[("Local Save<br/>[economy.dart]")]
end

node_player(("Player"))
node_camera_service["Device Camera"]
node_mlkit["ML Kit Pose"]

node_player -->|"performs reps for"| node_camera_gate
node_camera_service -->|"provides frames"| node_pose_detector
node_pose_detector -->|"counts reps"| node_rep_counter
node_mlkit -->|"detects landmarks"| node_pose_detector
node_rep_counter -->|"rep becomes attack"| node_game
node_game -->|"deals damage"| node_enemy
node_enemy -->|"earns coins"| node_economy
node_economy -->|"funds upgrades"| node_shop
node_shop -->|"saves progression"| node_local_save
node_levels -->|"defines campaign"| node_game
node_levels -.->|"presents levels"| node_level_ui
node_player -.->|"changes settings"| node_settings_panel
node_settings_panel -.->|"updates"| node_settings

click node_app_shell "https://github.com/sifrex19-blip/repel-game/blob/main/lib/app_shell.dart"
click node_settings "https://github.com/sifrex19-blip/repel-game/blob/main/lib/app_settings.dart"
click node_settings_panel "https://github.com/sifrex19-blip/repel-game/blob/main/lib/settings_panel.dart"
click node_camera_gate "https://github.com/sifrex19-blip/repel-game/blob/main/lib/camera_gate.dart"
click node_pose_screen "https://github.com/sifrex19-blip/repel-game/blob/main/lib/m1/pose_screen.dart"
click node_pose_detector "https://github.com/sifrex19-blip/repel-game/blob/main/lib/m1/pose_detector_service.dart"
click node_frame_converter "https://github.com/sifrex19-blip/repel-game/blob/main/lib/m1/camera_image_converter.dart"
click node_pose_overlay "https://github.com/sifrex19-blip/repel-game/blob/main/lib/m1/pose_overlay.dart"
click node_rep_counter "https://github.com/sifrex19-blip/repel-game/blob/main/lib/m1/pushup_counter.dart"
click node_pushup_gate "https://github.com/sifrex19-blip/repel-game/blob/main/lib/m1/pushup_gate.dart"
click node_game "https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/repel_game.dart"
click node_game_camera "https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/game_camera.dart"
click node_enemy "https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/enemy.dart"
click node_levels "https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/levels.dart"
click node_level_ui "https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/level_ui.dart"
click node_economy "https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/economy.dart"
click node_shop "https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/shop_panel.dart"
click node_pixel_art "https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/pixel_art.dart"
click node_pixel_ui "https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/pixel_ui.dart"
click node_local_save "https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/economy.dart"

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_app_shell,node_settings,node_settings_panel toneBlue
class node_camera_gate,node_pose_screen,node_pose_detector,node_frame_converter,node_pose_overlay,node_rep_counter,node_pushup_gate toneAmber
class node_game,node_game_camera,node_enemy,node_levels,node_level_ui,node_pixel_art,node_pixel_ui toneMint
class node_economy,node_shop,node_local_save toneRose
class node_player,node_camera_service,node_mlkit toneIndigo
```

## Components

### App Shell

- [App Shell](https://github.com/sifrex19-blip/repel-game/blob/main/lib/app_shell.dart): `lib/app_shell.dart`
- [App Settings](https://github.com/sifrex19-blip/repel-game/blob/main/lib/app_settings.dart): `lib/app_settings.dart`
- [Settings Panel](https://github.com/sifrex19-blip/repel-game/blob/main/lib/settings_panel.dart): `lib/settings_panel.dart`

### Fitness Input

- [Camera Gate](https://github.com/sifrex19-blip/repel-game/blob/main/lib/camera_gate.dart): `lib/camera_gate.dart`
- [Pose Screen](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m1/pose_screen.dart): `lib/m1/pose_screen.dart`
- [Pose Detection](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m1/pose_detector_service.dart): `lib/m1/pose_detector_service.dart`
- [Frame Conversion](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m1/camera_image_converter.dart): `lib/m1/camera_image_converter.dart`
- [Pose Overlay](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m1/pose_overlay.dart): `lib/m1/pose_overlay.dart`
- [Pushup Counter](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m1/pushup_counter.dart): `lib/m1/pushup_counter.dart`
- [Pushup Gate](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m1/pushup_gate.dart): `lib/m1/pushup_gate.dart`

### Combat Campaign

- [Repel Game](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/repel_game.dart): `lib/m2/repel_game.dart`
- [Arena Camera](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/game_camera.dart): `lib/m2/game_camera.dart`
- [Enemies](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/enemy.dart): `lib/m2/enemy.dart`
- [Campaign Levels](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/levels.dart): `lib/m2/levels.dart`
- [Level UI](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/level_ui.dart): `lib/m2/level_ui.dart`
- [Pixel Art](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/pixel_art.dart): `lib/m2/pixel_art.dart`
- [Pixel UI](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/pixel_ui.dart): `lib/m2/pixel_ui.dart`

### Progression

- [Game Economy](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/economy.dart): `lib/m2/economy.dart`
- [Upgrade Shop](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/shop_panel.dart): `lib/m2/shop_panel.dart`
- [Local Save](https://github.com/sifrex19-blip/repel-game/blob/main/lib/m2/economy.dart): `lib/m2/economy.dart`

### Other components

- **Player**
- **Device Camera**
- **ML Kit Pose**

## Connections

- Player → Camera Gate: performs reps for (evidence: `README.md`)
- Device Camera → Pose Detection: provides frames (evidence: `README.md`)
- Pose Detection → Pushup Counter: counts reps (evidence: `README.md`)
- ML Kit Pose → Pose Detection: detects landmarks (evidence: `README.md`)
- Pushup Counter → Repel Game: rep becomes attack (evidence: `README.md`)
- Repel Game → Enemies: deals damage (evidence: `README.md`)
- Enemies → Game Economy: earns coins (evidence: `README.md`)
- Game Economy → Upgrade Shop: funds upgrades (evidence: `README.md`)
- Upgrade Shop → Local Save: saves progression (evidence: `README.md`)
- Campaign Levels → Repel Game: defines campaign (evidence: `README.md`)
- Campaign Levels → Level UI: presents levels
- Player → Settings Panel: changes settings
- Settings Panel → App Settings: updates
