How committeeofzero/impacto works
This project – impacto – is an open‐source reimplementation of the "MAGES" visual novel engine. In essence, it is a cross-platform game engine written in C++ that supports multiple graphics backends (OpenGL, DirectX 9, experimental Vulkan) and audio systems, and it is designed to run original visual novel game data on a variety of platforms (Windows, Linux, Android, Switch, and even WebAssembly via Emscripten).
Main Project Components
• Engine Core: At the heart is the core engine found in the “src” directory (main.cpp, game.cpp, and various utility modules). This is where key game loop logic, memory management, and engine control routines are implemented.
• Subsystems:
– Rendering: Multiple rendering backends are provided in “src/renderer” (with directories for OpenGL, DirectX 9, Vulkan) along with shader programs in “src/shaders”. This subsystem handles 2D/3D graphics, scene management, and windowing.
– Audio: Located primarily in “src/audio”, with support for various audio backends such as OpenAL, FFMPEG-based players, and others (e.g., atrac9, vorbis). It manages audio streams, channels, and system integration.
– Input: The “src/inputsystem” and “src/vm/interface/input.cpp” modules capture device input and user interactions.
– Virtual Machine: The “src/vm” directory contains the VM engine responsible for interpreting or executing script instructions (control flow, dialogue, graphics-related operations, etc.).
– I/O and Data Management: The “src/io” folder and “src/data” provide file/archive management (such as reading game archives, asset data, manifests, etc.).
– Profiles: The “profiles” directory holds data and scripts (in Lua and other config files) that define game-specific behaviors, HUD elements, and dialogue for different supported titles.
• Platform-Specific Code:
– Android: The “android” subdirectory contains Android-specific project files and Java/C++ interface code, indicating that the engine’s cross-platform strategy includes native Android support.
– Docker / CI: Configuration files under “.github/workflows” and the “docker” folder indicate the use of containerized builds and CI pipelines.
• Build System: With CMake files (CMakeLists.txt, CMakePresets.json, and toolchain files like HorizonNX.toolchain) and vcpkg.json for dependency management, the build architecture is central to the development strategy.
Out Relationships and Interactions
• How the Engine Core communicates with each subsystem. For instance:
– The Core delegates rendering calls to the appropriate backend (e.g., OpenGL, DX9, or Vulkan) as selected by configuration or runtime parameters.
– Input events (from windowing or mobile-specific Android code) are routed into the engine’s input processor and then interpreted by the VM for game logic.
– Audio management involves pushing streams from the engine down to audio backends (OpenAL or FFMPEG) and back for user interactions.
– The UI/HUD layer interacts with both the rendering system and control flow managed by the VM.
– Data loading (from archives with CPK, AFS, or other formats) directly feeds into game assets used by rendering, audio, and profiles.
• Cross-platform abstraction layers, such as platform-specific initialization code (e.g., Android, Windows) and how these layered components call into the engine’s core library.
Architectural Patterns and Design Principles
• Modular Design: The file tree reflects a modular decomposition with clear separations between subsystems (audio, renderer, input, UI, VM, etc.).
• Cross-Platform Abstraction: Multiple toolchains and platform-specific directories (android, triplets, docker environments) demonstrate a design that abstracts low-level platform differences.
• Extensibility: The “profiles” directory, with many game-specific configuration and script files, illustrates a design intent that supports extensibility and easy adaptation for multiple games.
• Separation of Concerns: By splitting rendering, audio, data I/O, and user interface into distinct components, each module can evolve independently yet interact with the engine core through well-defined interfaces.
Technologies and Frameworks
• Languages and Core Libraries: C++ is used throughout. OpenGL is the primary graphics API (with experimental support for Vulkan and DirectX 9).
• Build Tools: CMake is used for project configuration and build management, supported by toolchain files and CI pipelines.
• Scripting: Lua files under various “profiles” directories for configuring game behaviors indicate scripting integration.
• Audio: OpenAL (in src/audio/openal), FFMPEG components, and specialized libraries for handling specific audio formats.
• CI/CD: GitHub Actions workflows and Docker files are central to the build/test infrastructure.