Skip to content

Add reflection-driven scene serialization (v3 format)#151

Merged
stainlu merged 1 commit intomainfrom
worktree-agent-a92cd49d
Apr 8, 2026
Merged

Add reflection-driven scene serialization (v3 format)#151
stainlu merged 1 commit intomainfrom
worktree-agent-a92cd49d

Conversation

@stainlu
Copy link
Copy Markdown
Owner

@stainlu stainlu commented Apr 8, 2026

Summary

  • Adds ReflectComponentRegistry to ECS World for type-erased component get/insert via Reflect trait
  • New SceneFileV3 format stores components as HashMap<String, serde_json::Value> — any Reflect component is automatically serializable
  • Adds Reflect impls for u8, u16, and gameplay types (Health, Team)
  • v2 scenes auto-migrate on load; backward compatibility preserved
  • Smart number coercion (JSON f64f32/u8/u32 etc.) during deserialization

Test plan

  • Round-trip custom #[derive(Reflect)] components through v3 format
  • v2 scene JSON loads correctly (backward compat)
  • All workspace tests pass
  • cargo clippy --workspace -- -D warnings clean

🤖 Generated with Claude Code

Replaces hardcoded SceneEntity with a reflection-based approach where
any component deriving Reflect is automatically saved/loaded.

- Add ReflectComponentRegistry to World for type-erased component access
- Add SceneFileV3 with HashMap<String, serde_json::Value> per entity
- Add Reflect impls for u8, u16, and gameplay components (Health, Team)
- Keep v2 format for backward compatibility with auto-migration
- Coerce JSON number types to match field types during deserialization

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying euca-engine with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4fd261a
Status: ✅  Deploy successful!
Preview URL: https://9348057b.euca-engine.pages.dev
Branch Preview URL: https://worktree-agent-a92cd49d.euca-engine.pages.dev

View logs

@stainlu stainlu merged commit dd31897 into main Apr 8, 2026
5 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant