# nemodev42/slots-of-vampires architecture

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

- Interactive diagram: https://gitdiagram.com/nemodev42/slots-of-vampires
- Repository: https://github.com/nemodev42/slots-of-vampires

## Overview

#### Purpose and Entry Points
This is a C++ slot-machine game, “Slots of Vampires,” built on the in-repo Nemogine engine. Native build orchestration begins at `CMakeLists.txt`; the playable application starts at `slots/src/main.cpp`. A browser-oriented build path is provided by `scripts/build_web.sh`, with static web hosting content in `html/index.html`.

#### Build and Deployment Boundary
The root CMake project composes two major targets: reusable engine code under `nemogine/CMakeLists.txt` and game code under `slots/CMakeLists.txt`. CMake presets in `CMakePresets.json` likely select platform/toolchain variants. The web script is the boundary for browser packaging, while the game’s assets remain local runtime resources under `slots/assets`.

#### Nemogine Engine Core
`nemogine/src/engine_core.cpp` and `nemogine/include/ng/engine_core.h` provide the engine-facing lifecycle and coordinate graphics, input, audio, timing, and debugging subsystems. The game should depend on these public headers rather than engine implementation files, establishing `nemogine/include/ng` as the engine/application boundary.

#### Graphics and Resource Pipeline
Graphics is organized around window/rendering resources, canvas composition, sprites, and bitmap-font printing:
- `nemogine/src/graphics/graphics.cpp`
- `nemogine/src/graphics/resources/window.cpp`
- `nemogine/src/graphics/sprite_manager.cpp`

Game UI and slot visuals are expected to flow through graphics resource objects such as textures, canvases, renderers, and fonts. Art is consolidated primarily in `slots/assets/images/spritesheet.aseprite`; font definitions are XML assets in `slots/assets/fonts`.

#### Runtime Input and Audio
Input is centralized in `nemogine/src/input/input.cpp`, allowing game states and gameplay logic to consume a common input abstraction. Audio loading/playback is centralized in `nemogine/src/audio/audio.cpp`; the game supplies music and sound-effect files under `slots/assets/audio`. This separates platform/media handling from game-triggered events such as lever pulls, wins, ambience, and UI clicks.

#### Game State and Gameplay Flow
`slots/src/game_engine.cpp` with `slots/include/game_engine.h` is the application-level coordinator. It likely owns the frame-level transition between menu, tutorial, active machine, scoring, and terminal screens. The state-oriented source layout defines the main control flow:
- `slots/src/main_menu.cpp`
- `slots/src/tutorial.cpp`
- `slots/src/slot_machine.cpp`
- `slots/src/game_over.cpp`

Shared state categories and modes are defined through `slots/include/global_enums.h`.

#### Slot Simulation, Scoring, and Effects
Core game mechanics are split into slot representation/spinning, scoring, and visual effects:
- `slots/src/slot.cpp` and `slots/include/slot.h`
- `slots/src/scoring.cpp`
- `slots/src/particle_system.cpp` and `slots/include/particle_system.h`

The active slot-machine stage consumes player input, updates slots and particles, evaluates results through scoring, and emits rendering/audio effects. Supporting presentation events such as thunder and low-score handling are isolated in `slots/src/thunder.cpp` and `slots/src/lowscore.cpp`.

#### Assets and External Runtime
The project has no indicated backend or network service dependency. Its material external/runtime targets are native C++ platforms and a browser build, likely via a WebAssembly-compatible CMake toolchain invoked by `scripts/build_web.sh`. Runtime content is file-based: audio, XML fonts, and sprite artwork under `slots/assets`.

Main entry points: [`slots/src/slot_machine.cpp`](https://github.com/nemodev42/slots-of-vampires/blob/main/slots/src/slot_machine.cpp) (Slot machine stage), [`nemogine/src/engine_core.cpp`](https://github.com/nemodev42/slots-of-vampires/blob/main/nemogine/src/engine_core.cpp) (Engine lifecycle), [`CMakeLists.txt`](https://github.com/nemodev42/slots-of-vampires/blob/main/CMakeLists.txt) (Root CMake project), [`slots/src/game_engine.cpp`](https://github.com/nemodev42/slots-of-vampires/blob/main/slots/src/game_engine.cpp) (Game coordinator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Build &amp; delivery"]
  node_cmake_root["Root CMake project<br/>build orchestration<br/>[CMakeLists.txt]"]
  node_presets["CMake presets<br/>toolchain selection<br/>[CMakePresets.json]"]
  node_engine_build["Engine target<br/>CMake target<br/>[CMakeLists.txt]"]
  node_game_build["Game target<br/>CMake target<br/>[CMakeLists.txt]"]
  node_web_build["Web build script<br/>browser packaging<br/>[build_web.sh]"]
  node_web_host["Web entry page<br/>static host content<br/>[index.html]"]
end

subgraph group_engine["Nemogine engine"]
  node_engine_api["Engine public API<br/>application boundary"]
  node_engine_core["Engine lifecycle<br/>engine coordinator<br/>[engine_core.cpp]"]
  node_graphics["Graphics pipeline<br/>rendering subsystem<br/>[graphics.cpp]"]
  node_input["Input subsystem<br/>input abstraction<br/>[input.cpp]"]
  node_audio["Audio subsystem<br/>media playback<br/>[audio.cpp]"]
end

subgraph group_game["Slots game"]
  node_app_main(("Application entry<br/>native entry point<br/>[main.cpp]"))
  node_game_engine["Game coordinator<br/>state coordinator<br/>[game_engine.cpp]"]
  node_game_states["Game screens<br/>state flow<br/>[main_menu.cpp]"]
  node_slot_machine["Slot machine stage<br/>gameplay loop<br/>[slot_machine.cpp]"]
  node_slot_logic["Slots &amp; scoring<br/>simulation rules<br/>[slot.cpp]"]
  node_particles["Particle effects<br/>visual effects"]
end

subgraph group_assets["Runtime assets"]
  node_game_assets[("Game assets<br/>file-based content")]
end

node_presets -.->|"selects variants"| node_cmake_root
node_cmake_root -->|"builds"| node_engine_build
node_cmake_root -->|"builds"| node_game_build
node_web_build -->|"invokes"| node_cmake_root
node_web_build -->|"packages for"| node_web_host
node_engine_build -->|"contains"| node_engine_core
node_engine_core -->|"exposes lifecycle through"| node_engine_api
node_engine_core -->|"coordinates"| node_graphics
node_engine_core -->|"coordinates"| node_input
node_engine_core -->|"coordinates"| node_audio
node_game_build -->|"builds"| node_app_main
node_app_main -->|"starts"| node_game_engine
node_game_engine -->|"uses"| node_engine_api
node_game_engine -->|"transitions between"| node_game_states
node_game_states -->|"runs active state"| node_slot_machine
node_slot_machine -->|"reads"| node_input
node_slot_machine -->|"updates and evaluates"| node_slot_logic
node_slot_machine -->|"triggers"| node_particles
node_slot_machine -->|"renders through"| node_graphics
node_slot_machine -->|"triggers playback"| node_audio
node_game_assets -->|"supplies art and fonts"| node_graphics
node_game_assets -->|"supplies media"| node_audio

click node_cmake_root "https://github.com/nemodev42/slots-of-vampires/blob/main/CMakeLists.txt"
click node_presets "https://github.com/nemodev42/slots-of-vampires/blob/main/CMakePresets.json"
click node_engine_build "https://github.com/nemodev42/slots-of-vampires/blob/main/nemogine/CMakeLists.txt"
click node_game_build "https://github.com/nemodev42/slots-of-vampires/blob/main/slots/CMakeLists.txt"
click node_web_build "https://github.com/nemodev42/slots-of-vampires/blob/main/scripts/build_web.sh"
click node_web_host "https://github.com/nemodev42/slots-of-vampires/blob/main/html/index.html"
click node_engine_api "https://github.com/nemodev42/slots-of-vampires/tree/main/nemogine/include/ng"
click node_engine_core "https://github.com/nemodev42/slots-of-vampires/blob/main/nemogine/src/engine_core.cpp"
click node_graphics "https://github.com/nemodev42/slots-of-vampires/blob/main/nemogine/src/graphics/graphics.cpp"
click node_input "https://github.com/nemodev42/slots-of-vampires/blob/main/nemogine/src/input/input.cpp"
click node_audio "https://github.com/nemodev42/slots-of-vampires/blob/main/nemogine/src/audio/audio.cpp"
click node_app_main "https://github.com/nemodev42/slots-of-vampires/blob/main/slots/src/main.cpp"
click node_game_engine "https://github.com/nemodev42/slots-of-vampires/blob/main/slots/src/game_engine.cpp"
click node_game_states "https://github.com/nemodev42/slots-of-vampires/blob/main/slots/src/main_menu.cpp"
click node_slot_machine "https://github.com/nemodev42/slots-of-vampires/blob/main/slots/src/slot_machine.cpp"
click node_slot_logic "https://github.com/nemodev42/slots-of-vampires/blob/main/slots/src/slot.cpp"
click node_particles "https://github.com/nemodev42/slots-of-vampires/blob/main/slots/src/particle_system.cpp"
click node_game_assets "https://github.com/nemodev42/slots-of-vampires/tree/main/slots/assets"

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_cmake_root,node_presets,node_engine_build,node_game_build,node_web_build,node_web_host toneBlue
class node_engine_api,node_engine_core,node_graphics,node_input,node_audio toneAmber
class node_app_main,node_game_engine,node_game_states,node_slot_machine,node_slot_logic,node_particles toneMint
class node_game_assets toneRose
```

## Components

### Build & delivery

- [Root CMake project](https://github.com/nemodev42/slots-of-vampires/blob/main/CMakeLists.txt): build orchestration · Composes engine and game targets. · `CMakeLists.txt`
- [CMake presets](https://github.com/nemodev42/slots-of-vampires/blob/main/CMakePresets.json): toolchain selection · `CMakePresets.json`
- [Engine target](https://github.com/nemodev42/slots-of-vampires/blob/main/nemogine/CMakeLists.txt): CMake target · `nemogine/CMakeLists.txt`
- [Game target](https://github.com/nemodev42/slots-of-vampires/blob/main/slots/CMakeLists.txt): CMake target · `slots/CMakeLists.txt`
- [Web build script](https://github.com/nemodev42/slots-of-vampires/blob/main/scripts/build_web.sh): browser packaging · `scripts/build_web.sh`
- [Web entry page](https://github.com/nemodev42/slots-of-vampires/blob/main/html/index.html): static host content · `html/index.html`

### Nemogine engine

- [Engine public API](https://github.com/nemodev42/slots-of-vampires/tree/main/nemogine/include/ng): application boundary · Public headers used by the game. · `nemogine/include/ng`
- [Engine lifecycle](https://github.com/nemodev42/slots-of-vampires/blob/main/nemogine/src/engine_core.cpp): engine coordinator · Coordinates frame lifecycle and engine subsystems. · `nemogine/src/engine_core.cpp`
- [Graphics pipeline](https://github.com/nemodev42/slots-of-vampires/blob/main/nemogine/src/graphics/graphics.cpp): rendering subsystem · Window resources, composition, sprites, and bitmap-font rendering. · `nemogine/src/graphics/graphics.cpp`
- [Input subsystem](https://github.com/nemodev42/slots-of-vampires/blob/main/nemogine/src/input/input.cpp): input abstraction · `nemogine/src/input/input.cpp`
- [Audio subsystem](https://github.com/nemodev42/slots-of-vampires/blob/main/nemogine/src/audio/audio.cpp): media playback · `nemogine/src/audio/audio.cpp`

### Slots game

- [Application entry](https://github.com/nemodev42/slots-of-vampires/blob/main/slots/src/main.cpp): native entry point · `slots/src/main.cpp`
- [Game coordinator](https://github.com/nemodev42/slots-of-vampires/blob/main/slots/src/game_engine.cpp): state coordinator · Owns frame-level transitions across game screens. · `slots/src/game_engine.cpp`
- [Game screens](https://github.com/nemodev42/slots-of-vampires/blob/main/slots/src/main_menu.cpp): state flow · Menu, tutorial, active machine, and game-over stages. · `slots/src/main_menu.cpp`
- [Slot machine stage](https://github.com/nemodev42/slots-of-vampires/blob/main/slots/src/slot_machine.cpp): gameplay loop · Consumes input, spins slots, scores results, and triggers effects. · `slots/src/slot_machine.cpp`
- [Slots & scoring](https://github.com/nemodev42/slots-of-vampires/blob/main/slots/src/slot.cpp): simulation rules · `slots/src/slot.cpp`
- [Particle effects](https://github.com/nemodev42/slots-of-vampires/blob/main/slots/src/particle_system.cpp): visual effects · `slots/src/particle_system.cpp`

### Runtime assets

- [Game assets](https://github.com/nemodev42/slots-of-vampires/tree/main/slots/assets): file-based content · Sprites, XML fonts, music, and sound effects. · `slots/assets`

## Connections

- CMake presets → Root CMake project: selects variants
- Root CMake project → Engine target: builds
- Root CMake project → Game target: builds
- Web build script → Root CMake project: invokes
- Web build script → Web entry page: packages for
- Engine target → Engine lifecycle: contains
- Engine lifecycle → Engine public API: exposes lifecycle through
- Engine lifecycle → Graphics pipeline: coordinates
- Engine lifecycle → Input subsystem: coordinates
- Engine lifecycle → Audio subsystem: coordinates
- Game target → Application entry: builds
- Application entry → Game coordinator: starts
- Game coordinator → Engine public API: uses
- Game coordinator → Game screens: transitions between
- Game screens → Slot machine stage: runs active state
- Slot machine stage → Input subsystem: reads
- Slot machine stage → Slots & scoring: updates and evaluates
- Slot machine stage → Particle effects: triggers
- Slot machine stage → Graphics pipeline: renders through
- Slot machine stage → Audio subsystem: triggers playback
- Game assets → Graphics pipeline: supplies art and fonts
- Game assets → Audio subsystem: supplies media
