# ackermanngue/rusty-ballistics architecture

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

- Interactive diagram: https://gitdiagram.com/ackermanngue/rusty-ballistics
- Repository: https://github.com/ackermanngue/rusty-ballistics

## Overview

Rusty Ballistic is a Bevy-based 2D ballistic and rigid-body sandbox. Users configure and spawn polygonal projectiles, then observe their motion, collisions, and optional interceptor defense in the simulation. The graph follows the app’s explicit system scheduling and the README’s documented collision stages; several internal system implementations were not sampled, so uncertain connections are omitted.

Main entry points: [`src/main.rs`](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/main.rs) (App setup), [`src/systems/defense.rs`](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/systems/defense.rs) (Defense systems), [`src/systems/input.rs`](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/systems/input.rs) (Input systems), [`src/systems/simulation.rs`](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/systems/simulation.rs) (Simulation systems)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and controls"]
  node_main["App setup<br/>[main.rs]"]
  node_input["Input systems<br/>[input.rs]"]
  node_ui["Simulation UI<br/>[ui.rs]"]
  node_camera["Camera control"]
end

subgraph group_projectiles["Projectiles and shapes"]
  node_spawnsettings["Spawn settings"]
  node_shapechoice["Selected shape<br/>[selected_shape.rs]"]
  node_shapelibrary["Shape library<br/>[shape_library.rs]"]
  node_shapeloader["Shape loader<br/>[shape_loader.rs]"]
  node_factory["Bullet factory<br/>[bullet_factory.rs]"]
  node_bullet["Bullet model<br/>[bullet.rs]"]
  node_geometry["Polygon geometry<br/>[mod.rs]"]
end

subgraph group_physics["Physics and collision"]
  node_simulation["Simulation systems<br/>[simulation.rs]"]
  node_physicsmodel["Physics state<br/>[physics.rs]"]
  node_wind["Wind model<br/>[wind.rs]"]
  node_broad["Broad phase<br/>[broad_phase.rs]"]
  node_narrow["Narrow phase<br/>[narrow_phase.rs]"]
  node_sat["SAT collision"]
  node_manifold["Contact manifolds"]
  node_solver["Impulse solver<br/>[solver.rs]"]
end

subgraph group_defense["Interceptor defense"]
  node_defensesystems["Defense systems<br/>[defense.rs]"]
  node_defense["Defense system<br/>[defense_system.rs]"]
  node_threat["Threat detection"]
  node_interceptor["Interceptor<br/>[interceptor.rs]"]
end

subgraph group_presentation["Rendering and debug"]
  node_renderer["Bullet renderer<br/>[bullet_renderer.rs]"]
  node_debugrenderer["Debug renderer<br/>[debug_renderer.rs]"]
  node_defenserenderer["Defense renderer"]
  node_debugvisibility["Debug visibility"]
end

node_user(("User"))

node_user -->|"provides input"| node_input
node_user -->|"adjusts controls"| node_ui
node_main -->|"schedules"| node_input
node_main -->|"schedules"| node_ui
node_main -->|"schedules"| node_camera
node_main -->|"schedules"| node_simulation
node_main -->|"schedules"| node_defensesystems
node_main -->|"schedules"| node_renderer
node_main -->|"schedules"| node_debugrenderer
node_main -->|"schedules"| node_defenserenderer
node_main -->|"loads"| node_shapelibrary
node_main -->|"initializes"| node_spawnsettings
node_main -->|"initializes"| node_shapechoice
node_main -->|"initializes"| node_debugvisibility
node_input -->|"updates"| node_spawnsettings
node_input -->|"updates"| node_shapechoice
node_shapelibrary -->|"loads shapes"| node_shapeloader
node_factory -->|"creates"| node_bullet
node_factory -->|"uses shape data"| node_geometry
node_simulation -->|"updates"| node_physicsmodel
node_simulation -->|"uses"| node_wind
node_broad -->|"candidate pairs"| node_narrow
node_narrow -->|"tests axes"| node_sat
node_narrow -->|"generates contacts"| node_manifold
node_solver -->|"solves contacts"| node_manifold
node_defensesystems -->|"updates"| node_defense
node_defensesystems -->|"detects threats"| node_threat
node_defensesystems -->|"guides interceptors"| node_interceptor
node_debugrenderer -->|"checks visibility"| node_debugvisibility

click node_main "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/main.rs"
click node_input "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/systems/input.rs"
click node_ui "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/systems/ui.rs"
click node_camera "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/systems/camera_controller.rs"
click node_spawnsettings "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/resources/bullet_spawn_settings.rs"
click node_shapechoice "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/resources/selected_shape.rs"
click node_shapelibrary "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/resources/shape_library.rs"
click node_shapeloader "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/loaders/shape_loader.rs"
click node_factory "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/factories/bullet_factory.rs"
click node_bullet "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/models/bullet.rs"
click node_geometry "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/geometry/mod.rs"
click node_simulation "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/systems/simulation.rs"
click node_physicsmodel "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/models/physics.rs"
click node_wind "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/models/wind.rs"
click node_broad "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/collision/broad_phase.rs"
click node_narrow "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/collision/narrow_phase.rs"
click node_sat "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/collision/separating_axis_theorem.rs"
click node_manifold "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/collision/contact_manifold.rs"
click node_solver "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/collision/solver.rs"
click node_defensesystems "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/systems/defense.rs"
click node_defense "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/defense/defense_system.rs"
click node_threat "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/defense/threat_detection.rs"
click node_interceptor "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/defense/interceptor.rs"
click node_renderer "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/rendering/bullet_renderer.rs"
click node_debugrenderer "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/rendering/debug_renderer.rs"
click node_defenserenderer "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/rendering/defense_renderer.rs"
click node_debugvisibility "https://github.com/ackermanngue/rusty-ballistics/blob/main/src/resources/debug_visibility.rs"

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_main,node_input,node_ui,node_camera,node_user toneBlue
class node_spawnsettings,node_shapechoice,node_shapelibrary,node_shapeloader,node_factory,node_bullet,node_geometry toneAmber
class node_simulation,node_physicsmodel,node_wind,node_broad,node_narrow,node_sat,node_manifold,node_solver toneMint
class node_defensesystems,node_defense,node_threat,node_interceptor toneRose
class node_renderer,node_debugrenderer,node_defenserenderer,node_debugvisibility toneIndigo
```

## Components

### App and controls

- [App setup](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/main.rs): `src/main.rs`
- [Input systems](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/systems/input.rs): `src/systems/input.rs`
- [Simulation UI](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/systems/ui.rs): `src/systems/ui.rs`
- [Camera control](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/systems/camera_controller.rs): `src/systems/camera_controller.rs`

### Projectiles and shapes

- [Spawn settings](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/resources/bullet_spawn_settings.rs): `src/resources/bullet_spawn_settings.rs`
- [Selected shape](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/resources/selected_shape.rs): `src/resources/selected_shape.rs`
- [Shape library](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/resources/shape_library.rs): `src/resources/shape_library.rs`
- [Shape loader](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/loaders/shape_loader.rs): `src/loaders/shape_loader.rs`
- [Bullet factory](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/factories/bullet_factory.rs): `src/factories/bullet_factory.rs`
- [Bullet model](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/models/bullet.rs): `src/models/bullet.rs`
- [Polygon geometry](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/geometry/mod.rs): `src/geometry/mod.rs`

### Physics and collision

- [Simulation systems](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/systems/simulation.rs): `src/systems/simulation.rs`
- [Physics state](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/models/physics.rs): `src/models/physics.rs`
- [Wind model](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/models/wind.rs): `src/models/wind.rs`
- [Broad phase](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/collision/broad_phase.rs): `src/collision/broad_phase.rs`
- [Narrow phase](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/collision/narrow_phase.rs): `src/collision/narrow_phase.rs`
- [SAT collision](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/collision/separating_axis_theorem.rs): `src/collision/separating_axis_theorem.rs`
- [Contact manifolds](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/collision/contact_manifold.rs): `src/collision/contact_manifold.rs`
- [Impulse solver](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/collision/solver.rs): `src/collision/solver.rs`

### Interceptor defense

- [Defense systems](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/systems/defense.rs): `src/systems/defense.rs`
- [Defense system](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/defense/defense_system.rs): `src/defense/defense_system.rs`
- [Threat detection](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/defense/threat_detection.rs): `src/defense/threat_detection.rs`
- [Interceptor](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/defense/interceptor.rs): `src/defense/interceptor.rs`

### Rendering and debug

- [Bullet renderer](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/rendering/bullet_renderer.rs): `src/rendering/bullet_renderer.rs`
- [Debug renderer](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/rendering/debug_renderer.rs): `src/rendering/debug_renderer.rs`
- [Defense renderer](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/rendering/defense_renderer.rs): `src/rendering/defense_renderer.rs`
- [Debug visibility](https://github.com/ackermanngue/rusty-ballistics/blob/main/src/resources/debug_visibility.rs): `src/resources/debug_visibility.rs`

### Other components

- **User**

## Connections

- User → Input systems: provides input
- User → Simulation UI: adjusts controls
- App setup → Input systems: schedules
- App setup → Simulation UI: schedules
- App setup → Camera control: schedules
- App setup → Simulation systems: schedules
- App setup → Defense systems: schedules
- App setup → Bullet renderer: schedules
- App setup → Debug renderer: schedules
- App setup → Defense renderer: schedules
- App setup → Shape library: loads
- App setup → Spawn settings: initializes
- App setup → Selected shape: initializes
- App setup → Debug visibility: initializes
- Input systems → Spawn settings: updates
- Input systems → Selected shape: updates
- Shape library → Shape loader: loads shapes
- Bullet factory → Bullet model: creates
- Bullet factory → Polygon geometry: uses shape data
- Simulation systems → Physics state: updates
- Simulation systems → Wind model: uses
- Broad phase → Narrow phase: candidate pairs
- Narrow phase → SAT collision: tests axes
- Narrow phase → Contact manifolds: generates contacts
- Impulse solver → Contact manifolds: solves contacts
- Defense systems → Defense system: updates
- Defense systems → Threat detection: detects threats
- Defense systems → Interceptor: guides interceptors
- Debug renderer → Debug visibility: checks visibility
