Migrates existing GDD and engine design notes from HacknPlan into a new Obsidian vault. This establishes a centralized, version-controlled knowledge base covering engine architecture, game constraints, design decisions, and open questions.
2.3 KiB
2.3 KiB
tags
| tags | ||
|---|---|---|
|
Rendering
The target is rigid-part 3D on SDL_GPU, with a 2D overlay for the card hand and HUD. See Decision Log#Rigid-part 3D on SDL_GPU.
Layers
flowchart TD
Scene[Scene::Render] --> S3D[SceneRenderer3D]
Scene --> R2D[Renderer2D]
S3D --> Dev[RenderDevice]
R2D --> Dev
Dev --> GPU[SDL_GPU → Vulkan / D3D12 / Metal]
RenderDevice
A thin wrapper over SDL_GPU: buffers, textures, samplers, pipelines, command buffers, upload staging and per-frame uniform data. Nothing outside Render/ calls SDL_GPU directly.
SceneRenderer3D
- Instanced meshes are required. The render queue batches by (pipeline, material, mesh) and draws instances.
- Lighting: one directional sun with a single shadow map, plus a few point lights.
- Materials: PBR-lite or toon (art direction open, see Open Questions).
- Opaque objects are sorted by pipeline and material; transparent objects back to front.
Renderer2D
- A command-and-sort-key sprite batch:
DrawSprite,DrawQuad,DrawText,DrawLine. - Used for the card hand, HUD, menus, health bars, range indicators and damage numbers.
- Draws after the 3D pass in screen space.
Shaders
SDL_GPU consumes precompiled bytecode per backend.
- Write GLSL or HLSL in
Assets/Shaders. - Compile to SPIR-V at build time with
glslang. - Use the Vulkan backend on both Linux and Windows.
- Add SDL_shadercross (for DXIL and MSL) only if D3D12 or macOS becomes a target.
Shaders are hot-reloadable in debug builds (see Assets).
Text and ImGui
- Text: SDL_ttf 3's GPU text engine (
TTF_CreateGPUTextEngine), with cached text objects for numbers that change constantly. - ImGui: the
imgui_impl_sdlgpu3backend.
Camera
- A fixed-pitch perspective camera (about 50°) with limited zoom and optional 90° rotation steps. No free orbit: a tower defense must stay readable.
- The alternative, an orthographic isometric camera, is noted in Open Questions.
Picking
- Tiles: cast a ray from the mouse onto the ground plane (y = 0) and convert the hit to a tile. No physics engine.
- Enemies (for targeted cards): a ray test against bounding spheres.
- World-space UI (health bars, range circles): project world positions to the screen and draw them with
Renderer2D.
Related: Rigid-Part Animation, Assets