How spaghettifunk/anima works
Main Components
• Game Engine Core: Represented by the central engine code (files in engine/core, engine/application.go, engine/game.go).
• Asset Management: Covering asset loading and management (engine/assets, its loaders for fonts, images, models, shaders, etc.). This also relates to the external “assets” folder that holds fonts, models, materials, shaders, and textures.
• Renderer: A major component with two sub-layers:
– Rendering Abstractions and Metadata: (engine/renderer/components and engine/renderer/metadata).
– Vulkan Backend: (engine/renderer/vulkan) including command buffers, pipelines, framebuffers, descriptor sets, swapchain management, and shader compilation.
• Systems: Game and engine systems (engine/systems) for camera, font rendering, geometry, materials, shaders, textures, etc.
• Supporting Modules:
– Math Library: (engine/math) handling transformations, geometry, and other mathematical operations.
– Platform Abstraction: (engine/platform) for interfacing with the underlying system.
– Containers: (engine/containers) such as the ring queue used for event/message management.
– Vendors: External libraries (engine/vendors) for third-party tools like stb_image and stb_truetype.
• Build & Run Infrastructure: Magefiles (magefiles) and Go modules (go.mod, go.sum) facilitating the build and run processes.
• Testbed/Application Entrypoints: The main executable (main.go) and sample/testbed (testbed/game.go) to run and test your engine.
Relationships and Interactions
• The Main Executable/Application (main.go, testbed) is the entry point that initializes the Engine Core.
• The Engine Core orchestrates the game loop, processes events (engine/core/events.go), manages input, logging, and error handling.
• Asset Management actively loads resources from the “assets” directory through dedicated loaders and makes them available to both the Renderer and various Systems.
• Systems (camera, font, etc.) interface with both the Core and Renderer to update game state and render frames.
• Helper libraries (Math, Platform, Containers) support computations, abstraction layers, or data management that are used across almost every subsystem.
• The build system (magefiles) is logically separate from runtime but is essential for compiling shaders (using glslc) and wiring up the engine.
Architectural Patterns & Design Principles
• Modularity: The separation into core, assets, renderer, and systems reflects a modular design. Each major responsibility is isolated in its own directory and interfaced with clearly.
• Abstraction Layers: There’s an explicit separation between general engine functionality (core, math, systems) and platform-specific or graphics-specific code (renderer/vulkan).
• Data Driven Design: The “assets” folder with fonts, materials, models, shaders, and textures suggests that much of the engine’s behavior is parameterized by external resources.
• Build and Deployment: Using Magefiles indicates an automated build and run scheme that complements continuous integration practices.
• Components: Each major module (Core, Asset Management, Renderer – with submodules for Metadata and Vulkan Backend, Systems, Math, Platform, etc.) should be clearly labeled. Optionally, also include the external “assets” as a resource repository.
• Optional Build Pipeline: Consider adding an element for the magefiles/build scripts that leads from source files to a built application.
Final Remarks
Happy diagramming!