# ezthor/rm-battlescope architecture

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

- Interactive diagram: https://gitdiagram.com/ezthor/rm-battlescope
- Repository: https://github.com/ezthor/rm-battlescope

## Overview

RM BattleScope is a local RMUC match-data browser and tactical replay tool. Its main workflow is to select a match, read SQLite telemetry without modifying the source, clean and reconstruct tracks, infer event-linked combat and rule states, then generate interactive or static replay outputs. Separate capabilities include read-only match/event queries and batch trajectory-quality audits. The source excerpts show the replay orchestration and several inference/rendering links; less-visible subsystems are retained from README documentation without guessed internal call chains.

Main entry points: [`scripts/rmuc_trajectory.py`](https://github.com/ezthor/rm-battlescope/blob/main/scripts/rmuc_trajectory.py) (Replay CLI), [`rmuc_trajectory/render.py`](https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/render.py) (Replay rendering), [`rmuc_trajectory/pipeline.py`](https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/pipeline.py) (Track loading and cleaning), [`rmuc_trajectory/audit.py`](https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/audit.py) (Batch quality audit)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Data access"]
  node_sqlite["SQLite query CLI<br/>[rmuc_sqlite.py]"]
  node_database[("RMUC dataset")]
end

subgraph group_analysis["Trajectory analysis"]
  node_pipeline["Track loading and cleaning<br/>[pipeline.py]"]
  node_field["Field calibration<br/>[field.py]"]
  node_audit["Batch quality audit<br/>[audit.py]"]
end

subgraph group_inference["Rule inference"]
  node_combat["Attack matching<br/>[combat.py]"]
  node_buffs["Buff timelines<br/>[buffs.py]"]
  node_dart["Dart effects<br/>[dart.py]"]
  node_revival["Revival inference<br/>[revival.py]"]
  node_other_rules["Other rule states"]
end

subgraph group_presentation["Replay and review"]
  node_web["Match browser<br/>[webapp.py]"]
  node_webui["Browser UI<br/>[index.html]"]
  node_trajectory_cli["Replay CLI<br/>[rmuc_trajectory.py]"]
  node_audit_cli["Audit CLI"]
  node_render["Replay rendering<br/>[render.py]"]
  node_outputs["Replay and reports"]
end

node_user(("Analyst"))

node_user -->|"selects match"| node_webui
node_webui -.->|"submits replay"| node_web
node_user -->|"queries data"| node_sqlite
node_sqlite -->|"reads"| node_database
node_web -->|"validates match"| node_database
node_web -->|"loads tracks"| node_pipeline
node_trajectory_cli -->|"loads tracks and events"| node_pipeline
node_trajectory_cli -->|"gets canvas"| node_field
node_trajectory_cli -->|"infers attacks"| node_combat
node_trajectory_cli -->|"builds intervals"| node_buffs
node_trajectory_cli -->|"infers impacts"| node_dart
node_trajectory_cli -->|"infers revivals"| node_revival
node_pipeline -->|"reads telemetry"| node_database
node_pipeline -->|"uses geometry"| node_field
node_audit_cli -->|"runs audit"| node_audit
node_audit -->|"cleans tracks"| node_pipeline
node_audit -->|"reads match data"| node_database
node_web -.->|"generates replay"| node_render
node_trajectory_cli -->|"renders views"| node_render
node_render -->|"draws calibrated field"| node_field
node_render -->|"shows attacks"| node_combat
node_render -->|"shows buff timelines"| node_buffs
node_render -->|"shows dart effects"| node_dart
node_render -->|"shows respawns"| node_revival
node_render -->|"writes replay"| node_outputs
node_audit -->|"writes audit reports"| node_outputs
node_trajectory_cli -.->|"infers rule states"| node_other_rules

click node_sqlite "https://github.com/ezthor/rm-battlescope/blob/main/scripts/rmuc_sqlite.py"
click node_web "https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/webapp.py"
click node_webui "https://github.com/ezthor/rm-battlescope/blob/main/rmuc_web/index.html"
click node_trajectory_cli "https://github.com/ezthor/rm-battlescope/blob/main/scripts/rmuc_trajectory.py"
click node_audit_cli "https://github.com/ezthor/rm-battlescope/blob/main/scripts/rmuc_trajectory_audit.py"
click node_pipeline "https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/pipeline.py"
click node_field "https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/field.py"
click node_audit "https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/audit.py"
click node_combat "https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/combat.py"
click node_buffs "https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/buffs.py"
click node_dart "https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/dart.py"
click node_revival "https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/revival.py"
click node_other_rules "https://github.com/ezthor/rm-battlescope/tree/main/rmuc_trajectory"
click node_render "https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/render.py"

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_sqlite,node_database toneBlue
class node_pipeline,node_field,node_audit toneAmber
class node_combat,node_buffs,node_dart,node_revival,node_other_rules toneMint
class node_web,node_webui,node_trajectory_cli,node_audit_cli,node_render,node_outputs toneRose
class node_user toneIndigo
```

## Components

### Data access

- [SQLite query CLI](https://github.com/ezthor/rm-battlescope/blob/main/scripts/rmuc_sqlite.py): `scripts/rmuc_sqlite.py`
- **RMUC dataset**

### Trajectory analysis

- [Track loading and cleaning](https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/pipeline.py): `rmuc_trajectory/pipeline.py`
- [Field calibration](https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/field.py): `rmuc_trajectory/field.py`
- [Batch quality audit](https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/audit.py): `rmuc_trajectory/audit.py`

### Rule inference

- [Attack matching](https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/combat.py): `rmuc_trajectory/combat.py`
- [Buff timelines](https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/buffs.py): `rmuc_trajectory/buffs.py`
- [Dart effects](https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/dart.py): `rmuc_trajectory/dart.py`
- [Revival inference](https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/revival.py): `rmuc_trajectory/revival.py`
- [Other rule states](https://github.com/ezthor/rm-battlescope/tree/main/rmuc_trajectory): `rmuc_trajectory`

### Replay and review

- [Match browser](https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/webapp.py): `rmuc_trajectory/webapp.py`
- [Browser UI](https://github.com/ezthor/rm-battlescope/blob/main/rmuc_web/index.html): `rmuc_web/index.html`
- [Replay CLI](https://github.com/ezthor/rm-battlescope/blob/main/scripts/rmuc_trajectory.py): `scripts/rmuc_trajectory.py`
- [Audit CLI](https://github.com/ezthor/rm-battlescope/blob/main/scripts/rmuc_trajectory_audit.py): `scripts/rmuc_trajectory_audit.py`
- [Replay rendering](https://github.com/ezthor/rm-battlescope/blob/main/rmuc_trajectory/render.py): `rmuc_trajectory/render.py`
- **Replay and reports**

### Other components

- **Analyst**

## Connections

- Analyst → Browser UI: selects match (evidence: `README.md`)
- Browser UI → Match browser: submits replay
- Analyst → SQLite query CLI: queries data (evidence: `README.md`)
- SQLite query CLI → RMUC dataset: reads (evidence: `README.md`)
- Match browser → RMUC dataset: validates match (evidence: `rmuc_trajectory/webapp.py`)
- Match browser → Track loading and cleaning: loads tracks (evidence: `rmuc_trajectory/webapp.py`)
- Replay CLI → Track loading and cleaning: loads tracks and events (evidence: `scripts/rmuc_trajectory.py`)
- Replay CLI → Field calibration: gets canvas (evidence: `scripts/rmuc_trajectory.py`)
- Replay CLI → Attack matching: infers attacks (evidence: `scripts/rmuc_trajectory.py`)
- Replay CLI → Buff timelines: builds intervals (evidence: `scripts/rmuc_trajectory.py`)
- Replay CLI → Dart effects: infers impacts (evidence: `scripts/rmuc_trajectory.py`)
- Replay CLI → Revival inference: infers revivals (evidence: `scripts/rmuc_trajectory.py`)
- Track loading and cleaning → RMUC dataset: reads telemetry (evidence: `rmuc_trajectory/pipeline.py`)
- Track loading and cleaning → Field calibration: uses geometry (evidence: `rmuc_trajectory/pipeline.py`)
- Audit CLI → Batch quality audit: runs audit (evidence: `scripts/rmuc_trajectory_audit.py`)
- Batch quality audit → Track loading and cleaning: cleans tracks (evidence: `rmuc_trajectory/audit.py`)
- Batch quality audit → RMUC dataset: reads match data (evidence: `rmuc_trajectory/audit.py`)
- Match browser → Replay rendering: generates replay (evidence: `rmuc_trajectory/webapp.py`)
- Replay CLI → Replay rendering: renders views (evidence: `scripts/rmuc_trajectory.py`)
- Replay rendering → Field calibration: draws calibrated field (evidence: `rmuc_trajectory/render.py`)
- Replay rendering → Attack matching: shows attacks (evidence: `rmuc_trajectory/render.py`)
- Replay rendering → Buff timelines: shows buff timelines (evidence: `rmuc_trajectory/render.py`)
- Replay rendering → Dart effects: shows dart effects (evidence: `rmuc_trajectory/render.py`)
- Replay rendering → Revival inference: shows respawns (evidence: `rmuc_trajectory/render.py`)
- Replay rendering → Replay and reports: writes replay (evidence: `README.md`)
- Batch quality audit → Replay and reports: writes audit reports (evidence: `README.md`)
- Replay CLI → Other rule states: infers rule states (evidence: `scripts/rmuc_trajectory.py`)
