Files
siege_deck/Docs/SiegeDeck/Engine/Assets.md
T
darman 45b246c1d7 docs: Initialize comprehensive project documentation
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.
2026-09-24 23:55:48 +02:00

1.7 KiB

tags
tags
engine
assets

Assets

Handles, not shared pointers

  • Every asset is referenced by a typed Handle<T> (index plus generation), not Ref<T> / shared_ptr.
  • Ownership stays with the AssetManager, so it's always clear when an asset is freed.
  • Hot reload swaps the resource behind a handle, and every holder sees the new version automatically.

Asset types

Type Source Loader
Texture PNG, JPG SDL_image → GPU upload
Model glTF 2.0 (.glb/.gltf) cgltf or fastgltf (TBD)
AnimationClip glTF node animations same as Model
Material parameters + textures glTF material or script data
Shader / Pipeline SPIR-V built from Assets/Shaders see Rendering#Shaders
Font TTF SDL_ttf
Sound, Music WAV, OGG SDL_mixer
Script modules see Scripting script backend

Paths

  • Assets resolve relative to SDL_GetBasePath()/Assets, which matches the existing post-build copy step.
  • Saves and settings go to SDL_GetPrefPath().

Hot reload (debug builds only)

  • Poll file modification times about twice a second; reload textures, models, shaders, sounds and scripts.
  • Failed reloads keep the previous version and report the error in the debug UI.

Definition databases

  • DefinitionDB<T> maps a StringId to a definition (CardDef, TowerDef, EnemyDef, …).
  • Definitions are filled by the script loader (see Scripting).
  • Instances store only the ID, so reloaded definitions take effect immediately.

[!question] Open glTF loader choice: cgltf (a single C header, simple) or fastgltf (C++20, faster, needs simdjson). Check nixpkgs availability under the same-version rule. See Open Questions.