Feat: load 3D models from card definition assets on game board

Client:
- Added ModelCache autoload (autoloads/ModelCache.gd)
  - Downloads .glb files from CDN via HTTPRequest
  - Disk cache: user://remote_model_cache/<sha256>.glb
  - Memory cache: PackedScene per URL for instant re-instantiation
  - Concurrent requests for same URL queue and share one download
  - Loads via GLTFDocument.append_from_file + generate_scene
- game_screen.gd: _add_unit_mesh now looks up cardDefinitionId
  → ContentCache.get_definition() → finds Model3D asset URL
  → calls ModelCache.load_model() to async replace placeholder geometry
  - Placeholder (sphere/cylinder/box) shown immediately
  - Real model swaps in on download completion
  - Guards against body being freed before model arrives
  - Added _unit_bodies dict for O(1) body lookup
- project.godot: registered ModelCache autoload

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-03-09 12:37:25 -04:00
co-authored by Claude Happy
parent bb0f7dae91
commit e815dd708f
3 changed files with 173 additions and 14 deletions
+1
View File
@@ -24,6 +24,7 @@ CollectionCache="*res://autoloads/CollectionCache.gd"
Chat="*res://autoloads/Chat.gd"
Settings="*res://autoloads/Settings.gd"
Game="*res://autoloads/Game.gd"
ModelCache="*res://autoloads/ModelCache.gd"
[display]