# chorae05/crazy_arcade11 architecture

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

- Interactive diagram: https://gitdiagram.com/chorae05/crazy_arcade11
- Repository: https://github.com/chorae05/crazy_arcade11

## Overview

1. **Project shape**
   - This is a single Windows C++ desktop game project (`ConsoleBnB`) built as a **console-subsystem** app in Visual Studio 2022.
   - Despite the console subsystem, the actual gameplay is rendered in a separate **Win32 window** created at runtime.

2. **Top-level runtime**
   - `src/main.cpp` is the startup boundary.
   - It likely initializes the window, game objects, and enters the main loop.
   - The console stays open for debugging output, while gameplay happens in the 1000x800 game window.

3. **Core game orchestration**
   - `include/Game.h` / `src/Game.cpp` are the central coordinator.
   - This subsystem likely owns the high-level game states: start screen, “how to play”, countdown, active match, and post-match return-to-menu flow.
   - It mediates between input, world state, and rendering.

4. **Input subsystem**
   - `include/Input.h` / `src/Input.cpp` handle keyboard and mouse interaction.
   - The README indicates menu navigation via mouse or keyboard, plus separate player controls:
     - Player 1: WASD, Shift/Ctrl
     - Player 2: Arrow keys, Space
     - Special “needle escape” action on `N`
   - This suggests input is abstracted away from the game logic and translated into game actions.

5. **World / map subsystem**
   - `include/Map.h` / `src/Map.cpp` represent the game board and its rules.
   - This is likely where tile layout, obstacles, item placement, player collisions, and trap/escape mechanics live.
   - For an architecture diagram, treat this as the authoritative game-world state.

6. **Rendering subsystem**
   - `include/Renderer.h` / `src/Renderer.cpp` are responsible for drawing the game frame into the Win32 window.
   - The README explicitly calls out **GDI double buffering**, so rendering is implemented with a back buffer to reduce flicker.
   - This subsystem is separate from game logic and is the presentation layer.

7. **Shared types**
   - `include/Types.h` likely contains common structs/enums used across Game, Map, Input, and Renderer.
   - Typical use would be coordinates, directions, player state, menu/game-state enums, or simple geometry types.
   - This file is the shared data contract between subsystems.

8. **Game loop / data flow**
   - The main flow is: **Windows messages and timing → Input → Game update → Map/world mutation → Renderer draw → GDI present**.
   - Menu and in-game states are part of the same loop, with state transitions controlled by `Game`.
   - The console is not part of the gameplay loop; it is an auxiliary logging channel.

9. **Windowing boundary**
   - The project uses raw Win32 APIs rather than a higher-level engine.
   - The separate game window is created with `CreateWindow`, and the render target is the window client area.
   - This is an important architectural boundary: OS/window handling is distinct from game mechanics.

10. **Assets**
   - The `assets/` directory likely stores images, sprites, or other runtime resources used by rendering.
   - Since the game is a console-windowed Win32 app, assets are probably loaded directly by the renderer or game initialization path rather than through an asset pipeline.

11. **Build and deployment context**
   - The solution is organized around `ConsoleBnB.sln` and a single Visual Studio project file (`.vcxproj`).
   - That means architecture is currently monolithic and native Windows-only, with no separate service, backend, or client/server split.

12. **What to emphasize in a diagram**
   - Draw four main internal boxes: **Input**, **Game**, **Map**, **Renderer**.
   - Show `main.cpp` as the bootstrapper feeding the Win32 window and main loop.
   - Show `Game` as the orchestrator between `Input` and `Map`, and `Renderer` as the consumer of current game/map state.
   - Show the **console** as a side-channel for logs, not as the primary UI.

Main entry points: [`ConsoleBnB/include/Game.h`](https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/include/Game.h) (Game), [`ConsoleBnB/src/main.cpp`](https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/src/main.cpp) (main), [`ConsoleBnB/src/Renderer.cpp`](https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/src/Renderer.cpp) (Renderer impl), [`ConsoleBnB/include/Input.h`](https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/include/Input.h) (Input)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g1["Runtime"]
  node_n1["main<br/>startup<br/>[main.cpp]"]
  node_n2["Win32 window<br/>platform UI"]
  node_n3["Console log<br/>debug output"]
  node_n14["Solution<br/>[ConsoleBnB.sln]"]
  node_n15["Project<br/>vcxproj<br/>[ConsoleBnB.vcxproj]"]
end

subgraph group_g2["Game Core"]
  node_n4["Game<br/>orchestrator<br/>[Game.h]"]
  node_n5["Game impl<br/>orchestrator impl<br/>[Game.cpp]"]
  node_n6["Input<br/>[Input.h]"]
  node_n7["Input impl<br/>input handling<br/>[Input.cpp]"]
end

subgraph group_g3["Shared Model"]
  node_n8[("Map<br/>world state<br/>[Map.h]")]
  node_n9[("Map impl<br/>world rules<br/>[Map.cpp]")]
  node_n10["Types<br/>[Types.h]"]
end

subgraph group_g4["Presentation"]
  node_n11["Renderer<br/>[Renderer.h]"]
  node_n12["Renderer impl<br/>GDI double buffer<br/>[Renderer.cpp]"]
  node_n13["Assets<br/>runtime resources"]
end

node_n1 -->|"creates"| node_n2
node_n1 -->|"boots"| node_n4
node_n1 -->|"initializes"| node_n6
node_n1 -->|"initializes"| node_n11
node_n4 -->|"implements"| node_n5
node_n4 -->|"consumes"| node_n6
node_n4 -->|"updates"| node_n8
node_n4 -->|"drives"| node_n11
node_n6 -->|"implements"| node_n7
node_n7 -->|"uses"| node_n10
node_n8 -->|"implements"| node_n9
node_n9 -->|"uses"| node_n10
node_n11 -->|"implements"| node_n12
node_n12 -->|"loads"| node_n13
node_n12 -->|"presents to"| node_n2
node_n3 -.->|"side channel"| node_n1
node_n14 -->|"contains"| node_n15

click node_n1 "https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/src/main.cpp"
click node_n4 "https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/include/Game.h"
click node_n5 "https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/src/Game.cpp"
click node_n6 "https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/include/Input.h"
click node_n7 "https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/src/Input.cpp"
click node_n8 "https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/include/Map.h"
click node_n9 "https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/src/Map.cpp"
click node_n10 "https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/include/Types.h"
click node_n11 "https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/include/Renderer.h"
click node_n12 "https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/src/Renderer.cpp"
click node_n13 "https://github.com/chorae05/crazy_arcade11/tree/master/ConsoleBnB/assets"
click node_n14 "https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB.sln"
click node_n15 "https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/ConsoleBnB.vcxproj"

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_n1,node_n2,node_n3,node_n14,node_n15 toneBlue
class node_n4,node_n5,node_n6,node_n7 toneAmber
class node_n8,node_n9,node_n10 toneMint
class node_n11,node_n12,node_n13 toneRose
```

## Components

### Runtime

Process startup, Win32 windowing, and the main execution loop

- [main](https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/src/main.cpp): startup · Program entry point and loop bootstrap · `ConsoleBnB/src/main.cpp`
- **Win32 window**: platform UI · Runtime windowing boundary and client-area host
- **Console log**: debug output · Auxiliary console subsystem used for logging
- [Solution](https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB.sln): VS solution · Visual Studio solution entry for the monolithic native app · `ConsoleBnB.sln`
- [Project](https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/ConsoleBnB.vcxproj): vcxproj · Single native Windows C++ project configuration · `ConsoleBnB/ConsoleBnB.vcxproj`

### Game Core

Central gameplay coordination and state

- [Game](https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/include/Game.h): orchestrator · Owns top-level game states and coordinates subsystems · `ConsoleBnB/include/Game.h`
- [Game impl](https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/src/Game.cpp): orchestrator impl · Implements state transitions, update flow, and match control · `ConsoleBnB/src/Game.cpp`
- [Input](https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/include/Input.h): input mapper · Translates keyboard and mouse events into game actions · `ConsoleBnB/include/Input.h`
- [Input impl](https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/src/Input.cpp): input handling · Processes raw input and control bindings · `ConsoleBnB/src/Input.cpp`

### Shared Model

Common types and world state shared across subsystems

- [Map](https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/include/Map.h): world state · Authoritative board, collisions, items, and trap rules · `ConsoleBnB/include/Map.h`
- [Map impl](https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/src/Map.cpp): world rules · Implements board updates and gameplay mechanics · `ConsoleBnB/src/Map.cpp`
- [Types](https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/include/Types.h): shared types · Common enums, structs, and simple data contracts · `ConsoleBnB/include/Types.h`

### Presentation

Frame rendering and present path

- [Renderer](https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/include/Renderer.h): renderer · Draws the current frame into the Win32 window · `ConsoleBnB/include/Renderer.h`
- [Renderer impl](https://github.com/chorae05/crazy_arcade11/blob/master/ConsoleBnB/src/Renderer.cpp): GDI double buffer · Implements buffered drawing and present logic · `ConsoleBnB/src/Renderer.cpp`
- [Assets](https://github.com/chorae05/crazy_arcade11/tree/master/ConsoleBnB/assets): runtime resources · Images and other resources consumed at runtime · `ConsoleBnB/assets`

## Connections

- main → Win32 window: creates · Startup initializes the Win32 game window
- main → Game: boots · Entry point constructs the game coordinator
- main → Input: initializes · Startup wires input handling into the app loop
- main → Renderer: initializes · Startup prepares the renderer for the window
- Game → Game impl: implements · Header/implementation pair for the game coordinator
- Game → Input: consumes · Game reads abstracted user input
- Game → Map: updates · Game mutates or queries world state
- Game → Renderer: drives · Game passes current state to rendering
- Input → Input impl: implements · Header/implementation pair for input handling
- Input impl → Types: uses · Input uses shared enums and action/state types
- Map → Map impl: implements · Header/implementation pair for world logic
- Map impl → Types: uses · Map logic relies on shared data contracts
- Renderer → Renderer impl: implements · Header/implementation pair for rendering
- Renderer impl → Assets: loads · Renderer consumes runtime assets
- Renderer impl → Win32 window: presents to · Buffered output is drawn into the Win32 window
- Console log → main: side channel · Console output supports debugging during the loop
- Solution → Project: contains · Solution organizes the single native project
