How ryuu3160/directx11_base works
1. What this repo is
This is a Windows C++ DirectX 11 game framework, not a single game. The codebase is organized as an engine plus reusable gameplay/system layers, with assets and generated binaries checked in alongside source.
2. Top-level build and project structure
The solution DirectX11_Base.sln builds the engine project DirectX11_Base.vcxproj. A separate ProjectSetUp.exe and template project under Engine/Templates/ProjectTemplate indicate the framework is intended to spawn or rename game projects from a standard skeleton.
3. Runtime entry path
Execution starts in Engine/EntryPoint/Main.cpp and EntryPoint.cpp, which hand off into the engine/project layer. The project-facing abstraction lives under Engine/Core/System/Project, where GameProject and NuGetRestore suggest project initialization, dependency setup, and launch orchestration happen before the actual scene loop.
4. Core engine boundary
The main engine boundary is Engine/Core/DirectX11. This contains the DirectX 11 device/core layer, render context, render manager, shader/resource abstractions, and concrete renderer classes. Everything here is responsible for translating engine objects into GPU work.
5. Rendering pipeline
Rendering is split into specialized render components and renderer implementations:
- ModelRenderer, SpriteRenderer, SkyBoxRenderer, RTSpriteRenderer, LineRenderer, InstancedModelRenderer
- RenderComponent acts as the common bridge between scene objects and the renderer layer
- RenderManager and RenderContext coordinate frame-level draw submission
The checked-in HLSL shaders and compiled .cso binaries show a data flow from source shader files to precompiled runtime assets.
6. Resource and asset management
The engine centralizes asset loading through managers for models, textures, shaders, materials, instanced models, and render targets. Resource types live in Engine/Core/DirectX11/Resource, while loader/cache orchestration is in ResourceManager. This boundary keeps file parsing and GPU resource creation separate from scene logic.
7. Scene, object, and component model
Gameplay state is organized with SceneRoot/SceneBase at the scene layer, Object/GameObject/specialized objects at the entity layer, and Component subclasses for behavior. Key components include Transform, Camera, MovementComponent, PlayerController, and colliders. ComponentRegistry and the Generated folder suggest a code-generated registration system for attaching components dynamically.
8. Simulation systems
Several cross-cutting systems operate on the scene graph:
- InputSystem and Input handle player/device input
- CollisionManager with OctreeCell/TreeData provides spatial collision management
- CameraManager manages active camera selection/control
- FadeManager handles transition effects
- SoundManager drives BGM/SE playback from the Assets/Sound tree
These systems are separate from rendering and are likely updated each frame before draw submission.
9. Editor and debug tooling
The framework includes built-in editor/debug support:
- DebugManager with ImGui windows, modals, popups, and item abstractions
- SpriteManager with hierarchy, inspector, loader, scene selector, and window classes
- imgui.ini, DebugManagerData.csv, and sprite JSON/CSV files show UI/editor state is data-driven
The readme’s hotkey note indicates the sprite manager is runtime-accessible, not a separate tool.
10. Data-driven content formats
Several asset formats define behavior without code changes:
- Scenes: Assets/Data/Scene/Root.cpon
- Sprite editor data: Sprites.json, Scenes.csv, scene-specific sprite JSON files
- Model material bindings: *_MaterialShaderInfo.csv
- Debug configuration: DebugManagerData.csv
These files are the main content/config boundary between artists/designers and engine code.
11. Shader/material binding rules
The readme documents a strict contract between CPU-side shader parameter packing and HLSL registers. Material-specific shader selection is driven by *_MaterialShaderInfo.csv, and pixel shader constant buffers must align with ShaderInfo slot numbers. This means the engine’s material system is not just a file loader; it is the mechanism for per-material GPU binding.
12. Assets and compiled outputs
The asset tree contains source models (.fbx, .obj, .blend), compiled shader objects (.cso), fonts/icons, and audio. Runtime code appears to prefer preprocessed binaries for shaders and content files for models/textures/sounds. The presence of DirectXTex, ImGui, NlohmannJson, bundled Python, and NuGet indicates the repo is self-contained for asset processing and editor functionality.
13. Generated and scripted build support
BuildScripts/GenerateComponentRegistry.py, ProjectPreBuild.bat, and RunCodeGeneration.bat show the build is augmented by generation steps. The engine also includes templates and helper utilities for Visual Studio/project file management, which reinforces that repository architecture includes both runtime code and project scaffolding.
14. Useful diagram boundaries
If you draw this architecture, the key boxes are:
- Project bootstrap / template setup
- Engine core and DirectX11 backend
- Scene/object/component gameplay layer
- Resource loading and GPU resource management
- Debug/editor UI subsystems
- Asset/data files and generated binaries
- External libs and build-time tooling
The main data flow is: content files and generated metadata → resource managers / scene loaders → runtime components and systems → render submission through DirectX 11 → shaders/GPU output.
Main entry points: SceneRoot.cpp Scene Root · GameProject.cpp Project Setup · ModelManager.cpp Resource Managers · DebugManager.cpp Debug UI
Components 24
Bootstrap
Solution, entrypoint, and project/template setup.
- Solution · Top-level Visual Studio solution that builds the engine project.
DirectX11_Base.sln - Entry Point · Process start and handoff into engine initialization.
DirectX11_Base/Engine/EntryPoint/Main.cpp - Project Setup · Project bootstrap, NuGet restore, and template-based game project creation.
DirectX11_Base/Engine/Core/System/Project/GameProject.cpp - Project Template · Reusable skeleton used to spawn or rename game projects.
DirectX11_Base/Engine/Templates/ProjectTemplate/GameProject.vcxproj
Engine Core
DirectX 11 runtime core and frame orchestration.
- DX11 Core · DirectX 11 device/core boundary and low-level engine backend.
DirectX11_Base/Engine/Core/DirectX11/DX11_Core.cpp - Render Context · Per-frame render state and draw submission coordination.
DirectX11_Base/Engine/Core/DirectX11/System/RenderContext.cpp - Render Manager · Coordinates renderer execution across the frame.
DirectX11_Base/Engine/Core/DirectX11/System/RenderManager.cpp
Gameplay Model
Scene, objects, components, and cross-cutting gameplay systems.
- Scene Root · Scene lifecycle and root scene ownership.
DirectX11_Base/Engine/Core/System/Scene/SceneRoot.cpp - Game Objects · Base object hierarchy for gameplay entities and specialized scene objects.
DirectX11_Base/Engine/Core/System/Object/GameObject.cpp - Components · Attachable behavior and state modules for objects.
DirectX11_Base/Engine/Core/System/Component/Component.cpp - Component Registry · Generated component registration and dynamic attachment support.
DirectX11_Base/Engine/Core/System/Component/ComponentRegistry.cpp - Input · Input state capture and per-frame input processing.
DirectX11_Base/Engine/Core/System/Input/InputSystem.cpp - Collision · Collision management and octree-based spatial partitioning.
DirectX11_Base/Engine/Core/System/Managers/CollisionManager/CollisionManager.cpp - Camera Manager · Tracks and selects active camera control.
DirectX11_Base/Engine/Core/System/Managers/CameraManager.cpp - Sound Manager · BGM and sound effect playback orchestration.
DirectX11_Base/Engine/Core/System/Managers/SoundManager.cpp
Rendering
GPU-facing renderers, resources, and shader pipeline.
- Resource Managers · Model, texture, shader, material, instanced model, and render target caching.
DirectX11_Base/Engine/Core/DirectX11/ResourceManager/ModelManager.cpp - GPU Resources · Meshes, textures, materials, shaders, and shader parameters.
DirectX11_Base/Engine/Core/DirectX11/Resource/ShaderResource/Shader.cpp - Renderers · Specialized renderers for models, sprites, skyboxes, lines, instancing, and render-target sprites.
DirectX11_Base/Engine/Core/DirectX11/Renderer/ModelRenderer.cpp - Shaders · Source HLSL and precompiled shader binaries used by the renderers.
DirectX11_Base/Engine/Shaders/VertexShader/VS_Model.hlsl
Tools
Editor/debug UI and content authoring helpers.
- Debug UI · ImGui-based debug windows, modals, popups, and item controls.
DirectX11_Base/Engine/Core/System/Managers/DebugManager/DebugManager.cpp - Sprite Manager · Runtime-accessible sprite/editor management and scene selection UI.
DirectX11_Base/Engine/Core/System/SpriteManager/SpriteManager.cpp
Content
Checked-in assets, prebuilt binaries, and data-driven config.
- Assets · Checked-in models, textures, sounds, debug data, and scene data.
DirectX11_Base/Engine/Assets/Data/Scene/Root.cpon - Third Party · Bundled libraries and runtimes such as ImGui, DirectXTex, NlohmannJson, NuGet, and Python.
DirectX11_Base/Engine/ThirdParty/ImGui/imgui.cpp - Build Scripts · Prebuild, registry generation, and code-generation helpers.
DirectX11_Base/Engine/BuildScripts/GenerateComponentRegistry.py
Connections 26
- Solution → Entry Point: builds · The solution builds the executable entry path.
- Solution → Project Setup: includes · Engine project and setup code are part of the solution.
- Project Setup → Project Template: spawns · Template project files define the reusable game-project skeleton.
- Entry Point → Project Setup: launches · Entrypoint hands off into project initialization.
- Project Setup → DX11 Core: initializes · Project bootstrap leads into the engine backend.
- DX11 Core → Render Context: creates · Backend creates and feeds the render context.
- Render Context → Render Manager: drives · Frame context is consumed by the render manager.
- Render Manager → Renderers: dispatches · Manager dispatches work to specialized renderers.
- Renderers → GPU Resources: uses · Renderers consume GPU resources and shader bindings.
- Resource Managers → GPU Resources: loads · Resource managers build and cache GPU-facing resources.
- Assets → Resource Managers: feeds · Checked-in content is the source for runtime loading.
- Shaders → GPU Resources: compiles to · HLSL source is compiled into runtime shader binaries and consumed as resources.
- Scene Root → Game Objects: contains · Scenes own the object hierarchy.
- Game Objects → Components: composes · Objects are extended by attachable components.
- Components → Component Registry: registers via · Generated registry supports dynamic component creation and attachment.
- Scene Root → Input: updates · Scene update loop consumes input state.
- Scene Root → Collision: updates · Scene state feeds spatial collision management.
- Scene Root → Camera Manager: updates · Scene state drives active camera selection and control.
- Scene Root → Sound Manager: updates · Scene loop advances audio playback and events.
- Scene Root → Debug UI: exposes · Runtime scene state is surfaced to the debug UI.
- Debug UI → Sprite Manager: shares ui · Debug and sprite managers work together for runtime editor workflows.
- Assets → Scene Root: defines · Scene and editor data are loaded from data files.
- Build Scripts → Component Registry: generates · Build scripts generate component registry code and related artifacts.
- Build Scripts → Project Template: supports · Build and scaffolding scripts support project/template setup.
- Third Party → Debug UI: powers · ImGui and related libs power debug/editor windows.
- Third Party → Resource Managers: supports · Vendor libraries support asset loading and serialization.