# wacxv/fh6-automation architecture

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

- Interactive diagram: https://gitdiagram.com/wacxv/fh6-automation
- Repository: https://github.com/wacxv/fh6-automation

## Overview

This is a single-file Forza desktop automation demo. The user starts, pauses, resumes, stops, or debugs it through the CustomTkinter interface or global hotkeys. A background automation engine runs race cycles: it captures the screen, matches templates to detect stages, then uses Windows input to interact with the game. Detection events and per-cycle timing data are surfaced in separate UI panels. The README documents the full stage and control capabilities; because the source excerpt omits much of the implementation, the graph leaves uncertain internal stage wiring out.

Main entry points: [`fh6-asp.py`](https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py) (Automation UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Desktop interface"]
  node_ui["Automation UI<br/>[fh6-asp.py]"]
  node_controls["Hotkeys and controls<br/>[fh6-asp.py]"]
  node_status["Runtime status<br/>[fh6-asp.py]"]
end

subgraph group_automation["Automation workflow"]
  node_engine["Automation engine<br/>[fh6-asp.py]"]
  node_race_stages["Race stages<br/>[fh6-asp.py]"]
end

subgraph group_vision_input["Vision and input"]
  node_capture["Screen capture<br/>[fh6-asp.py]"]
  node_templates["Stage templates<br/>[fh6-asp.py]"]
  node_matching["Template matching<br/>[fh6-asp.py]"]
  node_game_input["Game input<br/>[fh6-asp.py]"]
end

subgraph group_diagnostics["Diagnostics"]
  node_event_queue["Event queue<br/>[fh6-asp.py]"]
  node_timing_queue["Timing queue<br/>[fh6-asp.py]"]
  node_detection_log["Detection log<br/>[fh6-asp.py]"]
  node_timing_summary["Cycle timing<br/>[fh6-asp.py]"]
  node_debug["Debug capture<br/>[fh6-asp.py]"]
end

node_user(("User"))
node_game["Forza game"]
node_desktop["Desktop screen"]

node_user -->|"invokes"| node_controls
node_controls -->|"dispatches actions"| node_ui
node_ui -->|"starts and signals"| node_engine
node_engine -->|"runs cycles"| node_race_stages
node_race_stages -->|"requests frames"| node_capture
node_capture -->|"captures screen"| node_desktop
node_race_stages -->|"checks stages"| node_matching
node_matching -->|"matches against"| node_templates
node_matching -->|"returns detections"| node_race_stages
node_race_stages -->|"issues game actions"| node_game_input
node_game_input -->|"sends input"| node_game
node_race_stages -->|"queues events"| node_event_queue
node_engine -->|"queues timings"| node_timing_queue
node_ui -->|"reads events"| node_event_queue
node_ui -->|"reads timings"| node_timing_queue
node_ui -->|"updates log"| node_detection_log
node_ui -->|"updates summary"| node_timing_summary
node_ui -->|"updates status"| node_status
node_user -->|"requests capture"| node_debug
node_debug -->|"requests frame"| node_capture
node_debug -->|"tests templates"| node_matching

click node_ui "https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py"
click node_controls "https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py"
click node_status "https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py"
click node_engine "https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py"
click node_race_stages "https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py"
click node_capture "https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py"
click node_templates "https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py"
click node_matching "https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py"
click node_game_input "https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py"
click node_event_queue "https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py"
click node_timing_queue "https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py"
click node_detection_log "https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py"
click node_timing_summary "https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py"
click node_debug "https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.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_ui,node_controls,node_status,node_user,node_desktop toneBlue
class node_engine,node_race_stages toneAmber
class node_capture,node_templates,node_matching,node_game_input toneMint
class node_event_queue,node_timing_queue,node_detection_log,node_timing_summary,node_debug toneRose
class node_game toneIndigo
```

## Components

### Desktop interface

- [Automation UI](https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py): `fh6-asp.py`
- [Hotkeys and controls](https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py): `fh6-asp.py`
- [Runtime status](https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py): `fh6-asp.py`

### Automation workflow

- [Automation engine](https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py): `fh6-asp.py`
- [Race stages](https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py): `fh6-asp.py`

### Vision and input

- [Screen capture](https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py): `fh6-asp.py`
- [Stage templates](https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py): `fh6-asp.py`
- [Template matching](https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py): `fh6-asp.py`
- [Game input](https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py): `fh6-asp.py`

### Diagnostics

- [Event queue](https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py): `fh6-asp.py`
- [Timing queue](https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py): `fh6-asp.py`
- [Detection log](https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py): `fh6-asp.py`
- [Cycle timing](https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py): `fh6-asp.py`
- [Debug capture](https://github.com/wacxv/fh6-automation/blob/main/fh6-asp.py): `fh6-asp.py`

### Other components

- **User**
- **Forza game**
- **Desktop screen**

## Connections

- User → Hotkeys and controls: invokes
- Hotkeys and controls → Automation UI: dispatches actions
- Automation UI → Automation engine: starts and signals
- Automation engine → Race stages: runs cycles
- Race stages → Screen capture: requests frames
- Screen capture → Desktop screen: captures screen
- Race stages → Template matching: checks stages
- Template matching → Stage templates: matches against
- Template matching → Race stages: returns detections
- Race stages → Game input: issues game actions
- Game input → Forza game: sends input
- Race stages → Event queue: queues events
- Automation engine → Timing queue: queues timings
- Automation UI → Event queue: reads events
- Automation UI → Timing queue: reads timings
- Automation UI → Detection log: updates log
- Automation UI → Cycle timing: updates summary
- Automation UI → Runtime status: updates status
- User → Debug capture: requests capture
- Debug capture → Screen capture: requests frame
- Debug capture → Template matching: tests templates
