How nemodev42/slots-of-vampires works
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: slot_machine.cpp Slot machine stage · engine_core.cpp Engine lifecycle · CMakeLists.txt Root CMake project · game_engine.cpp Game coordinator
Components 18
Build & delivery
- Root CMake project · Composes engine and game targets.
CMakeLists.txt - CMake presets
CMakePresets.json - Engine target
nemogine/CMakeLists.txt - Game target
slots/CMakeLists.txt - Web build script
scripts/build_web.sh - Web entry page
html/index.html
Nemogine engine
- Engine public API · Public headers used by the game.
nemogine/include/ng - Engine lifecycle · Coordinates frame lifecycle and engine subsystems.
nemogine/src/engine_core.cpp - Graphics pipeline · Window resources, composition, sprites, and bitmap-font rendering.
nemogine/src/graphics/graphics.cpp - Input subsystem
nemogine/src/input/input.cpp - Audio subsystem
nemogine/src/audio/audio.cpp
Slots game
- Application entry
slots/src/main.cpp - Game coordinator · Owns frame-level transitions across game screens.
slots/src/game_engine.cpp - Game screens · Menu, tutorial, active machine, and game-over stages.
slots/src/main_menu.cpp - Slot machine stage · Consumes input, spins slots, scores results, and triggers effects.
slots/src/slot_machine.cpp - Slots & scoring
slots/src/slot.cpp - Particle effects
slots/src/particle_system.cpp
Runtime assets
- Game assets · Sprites, XML fonts, music, and sound effects.
slots/assets
Connections 22
- 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