# theniteswhosay/chkdraft architecture

> Architecture diagram of the GitHub repository theniteswhosay/chkdraft, 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/theniteswhosay/chkdraft
- Repository: https://github.com/theniteswhosay/chkdraft

## Overview

Chkdraft is a Windows map editor intended as a remake of Scmdraft. Its principal workflow is editing a StarCraft map through the desktop interface and saving map data; the tree also shows dedicated editors for terrain, actors, map settings, and triggers. MappingCore contains scenario, CHK, archive, and rendering modules, while Chkdraft has UI and graphics layers. The sampled code confirms app startup, asset-change handling, and a separate map-rendering utility; wiring between most editor subsystems is not shown, so uncertain links are omitted.

Main entry points: [`src/mapping_core/mpq_asset_manager.cpp`](https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/mpq_asset_manager.cpp) (Asset changes), [`src/map_gfx_utils/gfx_util.cpp`](https://github.com/theniteswhosay/chkdraft/blob/master/src/map_gfx_utils/gfx_util.cpp) (Graphics utility), [`src/main.cpp`](https://github.com/theniteswhosay/chkdraft/blob/master/src/main.cpp) (App entry), [`src/map_gfx_utils/renderer.cpp`](https://github.com/theniteswhosay/chkdraft/blob/master/src/map_gfx_utils/renderer.cpp) (Map renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop editor"]
  node_entry["App entry<br/>[main.cpp]"]
  node_application["Chkdraft app<br/>[chkdraft.cpp]"]
  node_map_ui["Map interface<br/>[gui_map.cpp]"]
  node_editors["Map editors"]
  node_profiles["Profiles and plugins<br/>[chkd_profiles.cpp]"]
end

subgraph group_mapping["Map data"]
  node_scenario["Scenario state<br/>[scenario.cpp]"]
  node_chk["CHK map data<br/>[chk.cpp]"]
  node_map_file["Map files<br/>[map_file.cpp]"]
  node_archives["Archive access<br/>[mpq_file.cpp]"]
  node_asset_manager["Asset changes"]
  node_temporary_mpq[("Session asset store<br/>[mpq_file.cpp]")]
end

subgraph group_content["Map content"]
  node_triggers["Trigger editing<br/>[trig_editor.cpp]"]
  node_text_trig["Text triggers"]
  node_map_settings["Map settings<br/>[map_settings.cpp]"]
  node_actors["Units and sprites<br/>[map_actor.cpp]"]
end

subgraph group_rendering["Rendering"]
  node_gfx_util["Graphics utility<br/>[gfx_util.cpp]"]
  node_renderer["Map renderer<br/>[renderer.cpp]"]
  node_graphics["Map graphics<br/>[sc_gl_graphics.cpp]"]
end

node_user(("Map author"))

node_user -->|"starts"| node_entry
node_entry -->|"runs"| node_application
node_gfx_util -->|"creates map"| node_scenario
node_gfx_util -->|"creates renderer"| node_renderer
node_renderer -->|"renders"| node_scenario
node_asset_manager -->|"stores assets"| node_temporary_mpq
node_asset_manager -->|"saves changes"| node_archives

click node_entry "https://github.com/theniteswhosay/chkdraft/blob/master/src/main.cpp"
click node_application "https://github.com/theniteswhosay/chkdraft/blob/master/src/chkdraft/chkdraft.cpp"
click node_map_ui "https://github.com/theniteswhosay/chkdraft/blob/master/src/chkdraft/ui/main_windows/gui_map.cpp"
click node_editors "https://github.com/theniteswhosay/chkdraft/tree/master/src/chkdraft/ui/dialog_windows"
click node_profiles "https://github.com/theniteswhosay/chkdraft/blob/master/src/chkdraft/mapping/chkd_profiles.cpp"
click node_scenario "https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/scenario.cpp"
click node_chk "https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/chk.cpp"
click node_map_file "https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/map_file.cpp"
click node_archives "https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/mpq_file.cpp"
click node_asset_manager "https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/mpq_asset_manager.cpp"
click node_triggers "https://github.com/theniteswhosay/chkdraft/blob/master/src/chkdraft/ui/dialog_windows/trig_editor/trig_editor.cpp"
click node_text_trig "https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/text_trig_compiler.cpp"
click node_map_settings "https://github.com/theniteswhosay/chkdraft/blob/master/src/chkdraft/ui/dialog_windows/map_settings/map_settings.cpp"
click node_actors "https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/render/map_actor.cpp"
click node_gfx_util "https://github.com/theniteswhosay/chkdraft/blob/master/src/map_gfx_utils/gfx_util.cpp"
click node_renderer "https://github.com/theniteswhosay/chkdraft/blob/master/src/map_gfx_utils/renderer.cpp"
click node_graphics "https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/render/sc_gl_graphics.cpp"
click node_temporary_mpq "https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/mpq_file.cpp"

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_entry,node_application,node_map_ui,node_editors,node_profiles toneBlue
class node_scenario,node_chk,node_map_file,node_archives,node_asset_manager,node_temporary_mpq toneAmber
class node_triggers,node_text_trig,node_map_settings,node_actors toneMint
class node_gfx_util,node_renderer,node_graphics toneRose
class node_user toneIndigo
```

## Components

### Desktop editor

- [App entry](https://github.com/theniteswhosay/chkdraft/blob/master/src/main.cpp): `src/main.cpp`
- [Chkdraft app](https://github.com/theniteswhosay/chkdraft/blob/master/src/chkdraft/chkdraft.cpp): `src/chkdraft/chkdraft.cpp`
- [Map interface](https://github.com/theniteswhosay/chkdraft/blob/master/src/chkdraft/ui/main_windows/gui_map.cpp): `src/chkdraft/ui/main_windows/gui_map.cpp`
- [Map editors](https://github.com/theniteswhosay/chkdraft/tree/master/src/chkdraft/ui/dialog_windows): `src/chkdraft/ui/dialog_windows`
- [Profiles and plugins](https://github.com/theniteswhosay/chkdraft/blob/master/src/chkdraft/mapping/chkd_profiles.cpp): `src/chkdraft/mapping/chkd_profiles.cpp`

### Map data

- [Scenario state](https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/scenario.cpp): `src/mapping_core/scenario.cpp`
- [CHK map data](https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/chk.cpp): `src/mapping_core/chk.cpp`
- [Map files](https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/map_file.cpp): `src/mapping_core/map_file.cpp`
- [Archive access](https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/mpq_file.cpp): `src/mapping_core/mpq_file.cpp`
- [Asset changes](https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/mpq_asset_manager.cpp): `src/mapping_core/mpq_asset_manager.cpp`
- [Session asset store](https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/mpq_file.cpp): `src/mapping_core/mpq_file.cpp`

### Map content

- [Trigger editing](https://github.com/theniteswhosay/chkdraft/blob/master/src/chkdraft/ui/dialog_windows/trig_editor/trig_editor.cpp): `src/chkdraft/ui/dialog_windows/trig_editor/trig_editor.cpp`
- [Text triggers](https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/text_trig_compiler.cpp): `src/mapping_core/text_trig_compiler.cpp`
- [Map settings](https://github.com/theniteswhosay/chkdraft/blob/master/src/chkdraft/ui/dialog_windows/map_settings/map_settings.cpp): `src/chkdraft/ui/dialog_windows/map_settings/map_settings.cpp`
- [Units and sprites](https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/render/map_actor.cpp): `src/mapping_core/render/map_actor.cpp`

### Rendering

- [Graphics utility](https://github.com/theniteswhosay/chkdraft/blob/master/src/map_gfx_utils/gfx_util.cpp): `src/map_gfx_utils/gfx_util.cpp`
- [Map renderer](https://github.com/theniteswhosay/chkdraft/blob/master/src/map_gfx_utils/renderer.cpp): `src/map_gfx_utils/renderer.cpp`
- [Map graphics](https://github.com/theniteswhosay/chkdraft/blob/master/src/mapping_core/render/sc_gl_graphics.cpp): `src/mapping_core/render/sc_gl_graphics.cpp`

### Other components

- **Map author**

## Connections

- Map author → App entry: starts
- App entry → Chkdraft app: runs
- Graphics utility → Scenario state: creates map
- Graphics utility → Map renderer: creates renderer
- Map renderer → Scenario state: renders
- Asset changes → Session asset store: stores assets
- Asset changes → Archive access: saves changes
