How cmpgamedevs/supercold works
Main Components
• Game/Application Core:
– Represents the main loop (located in source/main.cpp and source/common/application.cpp/hpp) that initializes and manages the game states and overall flow.
– Includes game states (e.g., play-state, menu-state, entity-test-state, etc.) found in the source/states directory.
• Asset & Configuration Management:
– Asset Loader: In source/common/asset-loader.*; responsible for loading shaders, models (.obj files in assets/models), textures (assets/textures), and other assets.
– Configuration Manager: Uses JSONC files located in the config/ directory to set up various tests and default parameters, including pipelines, materials, and renderer configurations.
• ECS (Entity Component System):
– Constitutes the world, entities, components (e.g., camera, movement, mesh-renderer) and systems (e.g., forward renderer, free-camera-controller) found in source/common/ecs, source/common/components, and source/common/systems.
• Rendering & Graphics Pipeline:
– Shader System: A suite of shader programs found in assets/shaders along with a shader loader in source/common/shader.
– Pipeline State, Material, and Texture Subsystems: Modules for pipeline configurations, material management, texture handling, samplers (source/common/material, source/common/texture).
– Postprocessing: Special effects managed through additional shaders in the assets/shaders/postprocess directory.
• Input Handling:
– Input management (source/common/input) that captures keyboard and mouse events, crucial for the “time only moves when you move” gameplay.
• Testing and Validation:
– A suite of test configuration files (in config/ and expected/ folders) and scripts (in scripts/) that ensure various components (entity, mesh, shader, pipeline, etc.) work as expected.
Relationships and Interactions
• The Application Core initializes the engine, loads configurations, and sets up the essential subsystems.
• The Asset Loader fetches models, textures, and shaders from the assets/ directory based on configuration details in the config/ files.
• The Renderer uses the Shader System to compile and manage graphical effects while applying materials and pipeline states.
• The Input Handler observes player inputs, influencing game state transitions and triggering updates in the ECS, which in turn affect rendering.
• Testing components are external but interact with nearly every piece to validate the proper configuration of entities, materials, pipelines, and shaders.
Architectural Patterns and Design Principles
• Separation of Concerns: Each major subsystem (asset management, ECS, rendering, input) is isolated in its own module or folder.
• Modular Design: The project’s clear separation between shader programs, configuration settings, and core engine code allows for extensibility and easier maintenance.
• Data-Driven Design: Utilization of JSONC configuration files to drive the behavior of materials, pipelines, and test scenarios.
• ECS Pattern: Decoupling game object behavior from data to allow flexible and scalable game logic.
• Architecture’s modular design and the fact that it’s driven by external configuration, which is essential for a project that frequently tests different engine parts.
• Notes on important files and directories (e.g., source/common for engine code, assets and config directories for data), so that other engineers can trace how components are implemented.