# mkg789/robot_wars_game architecture

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

- Interactive diagram: https://gitdiagram.com/mkg789/robot_wars_game
- Repository: https://github.com/mkg789/robot_wars_game

## Overview

Robot Wars is a browser-based robot builder. Users choose a foundation, place compatible motors in generated mounting zones, assign wheels to motor shafts, and inspect or edit the assembled robot in a 3D viewport. The single React application coordinates the staged workflow and Zustand state; builder data and mounting calculations support it, while viewport components render the resulting parts. The README is empty, so capability coverage and relationships here rely on the supplied source excerpts and index; unsampled UI behavior is not inferred.

Main entry points: [`robot-wars/src/features/robot-builder/types/robot.types.ts`](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/types/robot.types.ts) (Robot model types), [`robot-wars/src/App.tsx`](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/App.tsx) (Build interface), [`robot-wars/src/components/viewport/RobotScene.tsx`](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/components/viewport/RobotScene.tsx) (Robot scene), [`robot-wars/src/components/viewport/RobotObject.tsx`](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/components/viewport/RobotObject.tsx) (Robot part renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Build workflow"]
  node_app["Build interface<br/>[App.tsx]"]
  node_store["Robot state<br/>[robotStore.ts]"]
end

subgraph group_builder["Robot builder"]
  node_types["Robot model types<br/>[robot.types.ts]"]
  node_foundation_models["Foundation options"]
  node_initial_robot["Initial robot<br/>[initialRobot.ts]"]
  node_mount_points["Mount points<br/>[mountingPoints.ts]"]
  node_motor_catalogue["Motor catalogue<br/>[motorCatalogue.ts]"]
  node_wheel_catalogue["Wheel catalogue<br/>[wheelCatalogue.ts]"]
  node_mounting["Shaft mounting math<br/>[mounting.ts]"]
  node_mount_zones["Motor mounting zones<br/>[mountingZones.ts]"]
  node_wheel_mounting["Wheel positioning<br/>[wheelMounting.ts]"]
end

subgraph group_viewport["3D viewport"]
  node_scene["Robot scene<br/>[RobotScene.tsx]"]
  node_robot_object["Robot part renderer<br/>[RobotObject.tsx]"]
  node_chassis_model["Chassis geometry<br/>[ChassisModel.tsx]"]
  node_motor_model["Motor geometry<br/>[MotorModel.tsx]"]
  node_wheel_model["Wheel geometry<br/>[WheelModel.tsx]"]
end

node_builder_user(("Robot builder user"))

node_builder_user -->|"configures build"| node_app
node_app -->|"reads and updates"| node_store
node_app -->|"renders scene"| node_scene
node_app -->|"generates zones"| node_mount_zones
node_store -->|"generates zones"| node_mount_zones
node_store -->|"positions motor shafts"| node_mounting
node_store -->|"positions wheels"| node_wheel_mounting
node_scene -->|"reads and updates"| node_store
node_scene -->|"renders parts"| node_robot_object
node_scene -->|"generates zones"| node_mount_zones
node_scene -->|"positions shafts"| node_mounting
node_scene -->|"positions preview wheels"| node_wheel_mounting
node_robot_object -->|"renders chassis"| node_chassis_model
node_robot_object -->|"renders motors"| node_motor_model
node_robot_object -->|"renders wheels"| node_wheel_model
node_robot_object -->|"looks up category"| node_wheel_catalogue
node_app -->|"reads choices"| node_foundation_models
node_app -->|"reads choices"| node_motor_catalogue
node_app -->|"reads choices"| node_wheel_catalogue
node_types -->|"types definitions"| node_foundation_models
node_types -->|"types robot data"| node_initial_robot
node_types -->|"types mount data"| node_mount_points
node_types -->|"types definitions"| node_motor_catalogue
node_types -->|"types definitions"| node_wheel_catalogue
node_mounting -->|"provides shaft offset"| node_wheel_mounting
node_types -->|"types parts"| node_mounting
node_types -->|"types zones"| node_mount_zones
node_types -->|"types parts"| node_wheel_mounting

click node_app "https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/App.tsx"
click node_store "https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/store/robotStore.ts"
click node_types "https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/types/robot.types.ts"
click node_foundation_models "https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/data/foundationModels.ts"
click node_initial_robot "https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/data/initialRobot.ts"
click node_mount_points "https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/data/mountingPoints.ts"
click node_motor_catalogue "https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/data/motorCatalogue.ts"
click node_wheel_catalogue "https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/data/wheelCatalogue.ts"
click node_mounting "https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/logic/mounting.ts"
click node_mount_zones "https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/logic/mountingZones.ts"
click node_wheel_mounting "https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/logic/wheelMounting.ts"
click node_scene "https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/components/viewport/RobotScene.tsx"
click node_robot_object "https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/components/viewport/RobotObject.tsx"
click node_chassis_model "https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/components/viewport/ChassisModel.tsx"
click node_motor_model "https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/components/viewport/MotorModel.tsx"
click node_wheel_model "https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/components/viewport/WheelModel.tsx"

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,node_store,node_builder_user toneBlue
class node_types,node_foundation_models,node_initial_robot,node_mount_points,node_motor_catalogue,node_wheel_catalogue,node_mounting,node_mount_zones,node_wheel_mounting toneAmber
class node_scene,node_robot_object,node_chassis_model,node_motor_model,node_wheel_model toneMint
```

## Components

### Build workflow

- [Build interface](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/App.tsx): `robot-wars/src/App.tsx`
- [Robot state](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/store/robotStore.ts): `robot-wars/src/store/robotStore.ts`

### Robot builder

- [Robot model types](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/types/robot.types.ts): `robot-wars/src/features/robot-builder/types/robot.types.ts`
- [Foundation options](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/data/foundationModels.ts): `robot-wars/src/features/robot-builder/data/foundationModels.ts`
- [Initial robot](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/data/initialRobot.ts): `robot-wars/src/features/robot-builder/data/initialRobot.ts`
- [Mount points](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/data/mountingPoints.ts): `robot-wars/src/features/robot-builder/data/mountingPoints.ts`
- [Motor catalogue](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/data/motorCatalogue.ts): `robot-wars/src/features/robot-builder/data/motorCatalogue.ts`
- [Wheel catalogue](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/data/wheelCatalogue.ts): `robot-wars/src/features/robot-builder/data/wheelCatalogue.ts`
- [Shaft mounting math](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/logic/mounting.ts): `robot-wars/src/features/robot-builder/logic/mounting.ts`
- [Motor mounting zones](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/logic/mountingZones.ts): `robot-wars/src/features/robot-builder/logic/mountingZones.ts`
- [Wheel positioning](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/features/robot-builder/logic/wheelMounting.ts): `robot-wars/src/features/robot-builder/logic/wheelMounting.ts`

### 3D viewport

- [Robot scene](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/components/viewport/RobotScene.tsx): `robot-wars/src/components/viewport/RobotScene.tsx`
- [Robot part renderer](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/components/viewport/RobotObject.tsx): `robot-wars/src/components/viewport/RobotObject.tsx`
- [Chassis geometry](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/components/viewport/ChassisModel.tsx): `robot-wars/src/components/viewport/ChassisModel.tsx`
- [Motor geometry](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/components/viewport/MotorModel.tsx): `robot-wars/src/components/viewport/MotorModel.tsx`
- [Wheel geometry](https://github.com/mkg789/robot_wars_game/blob/main/robot-wars/src/components/viewport/WheelModel.tsx): `robot-wars/src/components/viewport/WheelModel.tsx`

### Other components

- **Robot builder user**

## Connections

- Robot builder user → Build interface: configures build (evidence: `robot-wars/src/App.tsx`)
- Build interface → Robot state: reads and updates (evidence: `robot-wars/src/App.tsx`)
- Build interface → Robot scene: renders scene (evidence: `robot-wars/src/App.tsx`)
- Build interface → Motor mounting zones: generates zones (evidence: `robot-wars/src/App.tsx`)
- Robot state → Motor mounting zones: generates zones (evidence: `robot-wars/src/store/robotStore.ts`)
- Robot state → Shaft mounting math: positions motor shafts (evidence: `robot-wars/src/store/robotStore.ts`)
- Robot state → Wheel positioning: positions wheels (evidence: `robot-wars/src/store/robotStore.ts`)
- Robot scene → Robot state: reads and updates (evidence: `robot-wars/src/components/viewport/RobotScene.tsx`)
- Robot scene → Robot part renderer: renders parts (evidence: `robot-wars/src/components/viewport/RobotScene.tsx`)
- Robot scene → Motor mounting zones: generates zones (evidence: `robot-wars/src/components/viewport/RobotScene.tsx`)
- Robot scene → Shaft mounting math: positions shafts (evidence: `robot-wars/src/components/viewport/RobotScene.tsx`)
- Robot scene → Wheel positioning: positions preview wheels (evidence: `robot-wars/src/components/viewport/RobotScene.tsx`)
- Robot part renderer → Chassis geometry: renders chassis (evidence: `robot-wars/src/components/viewport/RobotObject.tsx`)
- Robot part renderer → Motor geometry: renders motors (evidence: `robot-wars/src/components/viewport/RobotObject.tsx`)
- Robot part renderer → Wheel geometry: renders wheels (evidence: `robot-wars/src/components/viewport/RobotObject.tsx`)
- Robot part renderer → Wheel catalogue: looks up category (evidence: `robot-wars/src/components/viewport/RobotObject.tsx`)
- Build interface → Foundation options: reads choices (evidence: `robot-wars/src/App.tsx`)
- Build interface → Motor catalogue: reads choices (evidence: `robot-wars/src/App.tsx`)
- Build interface → Wheel catalogue: reads choices (evidence: `robot-wars/src/App.tsx`)
- Robot model types → Foundation options: types definitions (evidence: `robot-wars/src/features/robot-builder/data/foundationModels.ts`)
- Robot model types → Initial robot: types robot data (evidence: `robot-wars/src/features/robot-builder/data/initialRobot.ts`)
- Robot model types → Mount points: types mount data (evidence: `robot-wars/src/features/robot-builder/data/mountingPoints.ts`)
- Robot model types → Motor catalogue: types definitions (evidence: `robot-wars/src/features/robot-builder/data/motorCatalogue.ts`)
- Robot model types → Wheel catalogue: types definitions (evidence: `robot-wars/src/features/robot-builder/data/wheelCatalogue.ts`)
- Shaft mounting math → Wheel positioning: provides shaft offset (evidence: `robot-wars/src/features/robot-builder/logic/wheelMounting.ts`)
- Robot model types → Shaft mounting math: types parts (evidence: `robot-wars/src/features/robot-builder/logic/mounting.ts`)
- Robot model types → Motor mounting zones: types zones (evidence: `robot-wars/src/features/robot-builder/logic/mountingZones.ts`)
- Robot model types → Wheel positioning: types parts (evidence: `robot-wars/src/features/robot-builder/logic/wheelMounting.ts`)
