How justinnova0915/winhacks10 works
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: Project.hpp Project · conveyor Conveyors · crafter Crafters · Refinery Refinery
Components 18
Build & Runtime
Native build setup and embedded library layer.
Game Core
Application entry and project-level game logic.
- Main · Primary application entry.
src/main.cpp - Project · Central game/application wiring and orchestration.
src/Project.hpp - Reference Main · Alternate or reference entry point.
Reference/main.cpp
Simulation
World state, machines, and item flow.
- World · Grid-based terrain and placement space.
- Ore Nodes · Raw coal, copper, gold, and iron sources.
- Extractors · Pulls resources from ore nodes.
assets/extractor - Conveyors · Moves items across the grid, including straight and corner pieces.
assets/conveyor - Crafters · Transforms inputs into processed outputs.
assets/crafter - Refinery · Higher-tier processing stage with activation states.
assets/Refinery - Storage · Final sink and inventory buffer for produced items.
assets/storage - Materials · Raw and refined resource variants such as ingots.
assets/iron
Assets
Authoring sources and runtime-ready bitmaps.
- Ground Tiles · Grass and rock tile variants for the map base.
assets/ground - Converted Art · Bitmap set consumed by the game at runtime.
converted - Source Art · Aseprite source files and original bitmap frames.
assets - Converter · Transforms source artwork into runtime-ready bitmaps.
converter.cpp - Config · External runtime configuration.
config/config.json
Connections 20
- 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.