# justinnova0915/winhacks10 architecture

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

- Interactive diagram: https://gitdiagram.com/justinnova0915/winhacks10
- Repository: https://github.com/justinnova0915/winhacks10

## Overview

1. **What this repo is**
This is a single-player C++ desktop simulation/game with a strong factory-building shape: a tile/grid world, resource nodes, transport belts, and processing buildings. The content naming makes the domain clear: extractors, conveyors, crafters, refinery, storage, and ore types like coal, copper, gold, and iron.

2. **Top-level execution path**
The runtime entry point is `src/main.cpp`, with most project-specific logic likely centralized in `src/Project.hpp`. `Reference/main.cpp` appears to be an alternate or sample entry point, probably useful for comparison or a prior version of the app.

3. **Core simulation boundary**
The main architectural boundary is the simulation core versus rendering/assets. The simulation side likely owns the world state, building placement, machine behavior, resource movement, and crafting rules. The rendering side displays the state using bitmap sprites and animated frames.

4. **World model**
The file structure suggests a tile-based map built from ground tiles plus interactable placed objects. Ground art includes grass and rock variants, which likely define terrain/background, while machine sprites represent entities placed on top of the map.

5. **Factory subsystem**
The machine set is small but distinct:
- **Extractors** pull resources from ore nodes.
- **Conveyors** move items across the grid, including straight and corner variants.
- **Crafters** transform inputs into outputs.
- **Refinery** appears to be a higher-tier processing step with its own activation/deactivation animation.
- **Storage** is the sink or buffer for produced items.
This is the main data-flow loop of the application.

6. **Resource flow**
Raw materials are represented separately from processed ingots. The tree shows both source-node art and output ingots for iron, copper, gold, and coal. That implies a pipeline like: resource tile → extractor → conveyor network → crafter/refinery → storage.

7. **Asset pipeline**
There are two parallel asset trees: `assets/` contains source artwork, including `.aseprite` files and `.bmp` frames, while `converted/` contains the runtime-ready bitmaps. This indicates an offline conversion step rather than loading editable source art directly in the game.

8. **Converter tool**
`converter.cpp` is a separate build artifact or utility for transforming the source asset set into the `converted/` structure. Architecturally, this is a pre-runtime content pipeline: art authoring happens in Aseprite, conversion happens in the utility, and the game consumes the converted bitmap output.

9. **Configuration**
`config/config.json` is the only explicit config file in the tree, so runtime settings are likely externalized there. This may include window, resolution, gameplay tuning, or asset paths, but the architecture point is that the app is not hardcoding all settings in code.

10. **Libraries and platform layer**
The repo bundles `libs/TXLib`, which provides graphics, JSON, math, map, and utility support. That means the app likely uses TXLib as its lightweight platform/rendering layer instead of a full engine. `CMakeLists.txt` and `libs/CMake/optimization.cmake` show a CMake-based native build pipeline.

11. **How the pieces fit together**
At startup, the app likely loads config, initializes TXLib, loads converted bitmap assets, and builds the world. During the main loop, the simulation updates machine/resource state, then renders the current map and entities. The asset converter and source art stay outside this runtime loop as build-time/content-authoring infrastructure.

12. **Diagram guidance**
If you draw the architecture, the key boxes are: **CMake build + TXLib runtime**, **game core in `src`**, **tile/world simulation**, **factory entities and resource flow**, **asset conversion pipeline**, and **config file**. The most important arrows are from `converted/` into rendering, and from machine/resource logic through conveyors into crafting/storage.

Main entry points: [`src/Project.hpp`](https://github.com/justinnova0915/winhacks10/blob/master/src/Project.hpp) (Project), [`assets/conveyor`](https://github.com/justinnova0915/winhacks10/tree/master/assets/conveyor) (Conveyors), [`assets/crafter`](https://github.com/justinnova0915/winhacks10/tree/master/assets/crafter) (Crafters), [`assets/Refinery`](https://github.com/justinnova0915/winhacks10/tree/master/assets/Refinery) (Refinery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_build["Build & Runtime"]
  node_n_cmake["CMake<br/>build system<br/>[CMakeLists.txt]"]
  node_n_txlib["TXLib<br/>platform lib<br/>[txlib.hpp]"]
end

subgraph group_group_src["Game Core"]
  node_n_main["Main<br/>entry point<br/>[main.cpp]"]
  node_n_project["Project<br/>app core<br/>[Project.hpp]"]
  node_n_ref_main["Reference Main<br/>alt entry<br/>[main.cpp]"]
end

subgraph group_group_sim["Simulation"]
  node_n_world{{"World<br/>tile map"}}
  node_n_resources{{"Ore Nodes<br/>resource sources"}}
  node_n_extractors{{"Extractors<br/>machine"}}
  node_n_conveyors{{"Conveyors<br/>transport"}}
  node_n_crafters{{"Crafters<br/>machine"}}
  node_n_refinery{{"Refinery<br/>processor"}}
  node_n_storage{{"Storage<br/>buffer"}}
  node_n_items{{"Materials<br/>item types"}}
end

subgraph group_group_assets["Assets"]
  node_n_ground["Ground Tiles<br/>terrain art"]
  node_n_render_assets["Converted Art<br/>runtime assets"]
  node_n_source_art["Source Art<br/>authoring assets"]
  node_n_converter["Converter<br/>content tool<br/>[converter.cpp]"]
  node_n_config["Config<br/>settings<br/>[config.json]"]
end

node_n_cmake -->|"builds"| node_n_main
node_n_cmake -->|"builds"| node_n_converter
node_n_main -->|"starts"| node_n_project
node_n_ref_main -.->|"mirrors"| node_n_project
node_n_project -->|"uses"| node_n_txlib
node_n_project -->|"loads"| node_n_config
node_n_project -->|"owns"| node_n_world
node_n_world -->|"renders"| node_n_ground
node_n_world -->|"contains"| node_n_resources
node_n_resources -->|"feeds"| node_n_extractors
node_n_extractors -->|"outputs to"| node_n_conveyors
node_n_conveyors -->|"supplies"| node_n_crafters
node_n_conveyors -->|"supplies"| node_n_refinery
node_n_crafters -->|"outputs to"| node_n_storage
node_n_refinery -->|"outputs to"| node_n_storage
node_n_items -.->|"inputs"| node_n_crafters
node_n_items -.->|"inputs"| node_n_refinery
node_n_source_art -->|"feeds"| node_n_converter
node_n_converter -->|"produces"| node_n_render_assets
node_n_render_assets -->|"consumed by"| node_n_project

click node_n_cmake "https://github.com/justinnova0915/winhacks10/blob/master/CMakeLists.txt"
click node_n_txlib "https://github.com/justinnova0915/winhacks10/blob/master/libs/TXLib/txlib.hpp"
click node_n_main "https://github.com/justinnova0915/winhacks10/blob/master/src/main.cpp"
click node_n_project "https://github.com/justinnova0915/winhacks10/blob/master/src/Project.hpp"
click node_n_ref_main "https://github.com/justinnova0915/winhacks10/blob/master/Reference/main.cpp"
click node_n_ground "https://github.com/justinnova0915/winhacks10/tree/master/assets/ground"
click node_n_extractors "https://github.com/justinnova0915/winhacks10/tree/master/assets/extractor"
click node_n_conveyors "https://github.com/justinnova0915/winhacks10/tree/master/assets/conveyor"
click node_n_crafters "https://github.com/justinnova0915/winhacks10/tree/master/assets/crafter"
click node_n_refinery "https://github.com/justinnova0915/winhacks10/tree/master/assets/Refinery"
click node_n_storage "https://github.com/justinnova0915/winhacks10/tree/master/assets/storage"
click node_n_items "https://github.com/justinnova0915/winhacks10/tree/master/assets/iron"
click node_n_render_assets "https://github.com/justinnova0915/winhacks10/tree/master/converted"
click node_n_source_art "https://github.com/justinnova0915/winhacks10/tree/master/assets"
click node_n_converter "https://github.com/justinnova0915/winhacks10/blob/master/converter.cpp"
click node_n_config "https://github.com/justinnova0915/winhacks10/blob/master/config/config.json"

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_n_cmake,node_n_txlib toneBlue
class node_n_main,node_n_project,node_n_ref_main toneAmber
class node_n_world,node_n_resources,node_n_extractors,node_n_conveyors,node_n_crafters,node_n_refinery,node_n_storage,node_n_items toneMint
class node_n_ground,node_n_render_assets,node_n_source_art,node_n_converter,node_n_config toneRose
```

## Components

### Build & Runtime

Native build setup and embedded library layer.

- [CMake](https://github.com/justinnova0915/winhacks10/blob/master/CMakeLists.txt): build system · Top-level native build configuration. · `CMakeLists.txt`
- [TXLib](https://github.com/justinnova0915/winhacks10/blob/master/libs/TXLib/txlib.hpp): platform lib · Bundled graphics, JSON, math, and utility support. · `libs/TXLib/txlib.hpp`

### Game Core

Application entry and project-level game logic.

- [Main](https://github.com/justinnova0915/winhacks10/blob/master/src/main.cpp): entry point · Primary application entry. · `src/main.cpp`
- [Project](https://github.com/justinnova0915/winhacks10/blob/master/src/Project.hpp): app core · Central game/application wiring and orchestration. · `src/Project.hpp`
- [Reference Main](https://github.com/justinnova0915/winhacks10/blob/master/Reference/main.cpp): alt entry · Alternate or reference entry point. · `Reference/main.cpp`

### Simulation

World state, machines, and item flow.

- **World**: tile map · Grid-based terrain and placement space.
- **Ore Nodes**: resource sources · Raw coal, copper, gold, and iron sources.
- [Extractors](https://github.com/justinnova0915/winhacks10/tree/master/assets/extractor): machine · Pulls resources from ore nodes. · `assets/extractor`
- [Conveyors](https://github.com/justinnova0915/winhacks10/tree/master/assets/conveyor): transport · Moves items across the grid, including straight and corner pieces. · `assets/conveyor`
- [Crafters](https://github.com/justinnova0915/winhacks10/tree/master/assets/crafter): machine · Transforms inputs into processed outputs. · `assets/crafter`
- [Refinery](https://github.com/justinnova0915/winhacks10/tree/master/assets/Refinery): processor · Higher-tier processing stage with activation states. · `assets/Refinery`
- [Storage](https://github.com/justinnova0915/winhacks10/tree/master/assets/storage): buffer · Final sink and inventory buffer for produced items. · `assets/storage`
- [Materials](https://github.com/justinnova0915/winhacks10/tree/master/assets/iron): item types · Raw and refined resource variants such as ingots. · `assets/iron`

### Assets

Authoring sources and runtime-ready bitmaps.

- [Ground Tiles](https://github.com/justinnova0915/winhacks10/tree/master/assets/ground): terrain art · Grass and rock tile variants for the map base. · `assets/ground`
- [Converted Art](https://github.com/justinnova0915/winhacks10/tree/master/converted): runtime assets · Bitmap set consumed by the game at runtime. · `converted`
- [Source Art](https://github.com/justinnova0915/winhacks10/tree/master/assets): authoring assets · Aseprite source files and original bitmap frames. · `assets`
- [Converter](https://github.com/justinnova0915/winhacks10/blob/master/converter.cpp): content tool · Transforms source artwork into runtime-ready bitmaps. · `converter.cpp`
- [Config](https://github.com/justinnova0915/winhacks10/blob/master/config/config.json): settings · External runtime configuration. · `config/config.json`

## Connections

- CMake → Main: builds · Compiles the application entry and core code.
- CMake → Converter: builds · Builds the asset conversion utility.
- Main → Project: starts · Delegates runtime setup and main loop orchestration.
- Reference Main → Project: mirrors · Alternative entry path into the same app core.
- Project → TXLib: uses · Relies on TXLib for graphics and support utilities.
- Project → Config: loads · Reads external settings at startup.
- Project → World: owns · Creates and updates the tile-based simulation world.
- World → Ground Tiles: renders · Uses terrain tiles as the map base.
- World → Ore Nodes: contains · Hosts ore/resource source tiles.
- Ore Nodes → Extractors: feeds · Extractors pull from raw resource nodes.
- Extractors → Conveyors: outputs to · Moves extracted items into transport lines.
- Conveyors → Crafters: supplies · Carries inputs to crafting buildings.
- Conveyors → Refinery: supplies · Carries inputs to refinery processing.
- Crafters → Storage: outputs to · Sends finished goods to storage.
- Refinery → Storage: outputs to · Sends processed products to storage.
- Materials → Crafters: inputs · Represents craftable material inputs and outputs.
- Materials → Refinery: inputs · Represents refined material progression.
- Source Art → Converter: feeds · Authoring files are transformed by the converter.
- Converter → Converted Art: produces · Generates runtime bitmap assets.
- Converted Art → Project: consumed by · Loaded by the game during rendering and animation.
