Skip to content

Replace cereal snapshots with sealed component JSON serialization - #187

Merged
BenjaFriend merged 3 commits into
feature/169-engine-modulesfrom
cursor/component-json-serialization-6e8e
Aug 16, 2026
Merged

Replace cereal snapshots with sealed component JSON serialization#187
BenjaFriend merged 3 commits into
feature/169-engine-modulesfrom
cursor/component-json-serialization-6e8e

Conversation

@BenjaFriend

@BenjaFriend BenjaFriend commented Aug 16, 2026

Copy link
Copy Markdown
Member

Summary

  • Replace cereal world snapshots with a sealed ComponentTypeRegistry and entity-centric JSON so levels are human-readable and Gameplay no longer lists Graphics types (unblocks the issue 169 module split).
  • Load Transform first, iterate meshes with EnTT views instead of owning groups, and list named entities in the world outline so JSON levels and Play-spawned grids keep their authored pose.
  • Related: issue 171 (null-check MeshRenderer model/material on save).

Implementation

  • Fling::Json (PIMPL) wraps nlohmann privately. Public headers no longer include <nlohmann/json.hpp>.
  • JsonArchive is a single bidirectional Serialize (Unreal FArchive style) with MakeNVP / FLING_FIELD.
  • ComponentTypeRegistry: explicit Register<T> then Seal(). LoadLevelFile / OutputLevelFile require sealed. No FLING_COMPONENT static auto-registration.
  • Startup: Engine registers gameplay + graphics components, World::Init runs Game::RegisterComponents(), external registrars, Game::Init(), Seal(), then loads StartLevel.
  • Renderer uses view<Transform, MeshRenderer, tag> so assign<Transform>() references stay valid. World still loads Transform before other JSON keys so PointLight / mesh hooks see the authored pose.

Test plan

  • FlingTests — 172 assertions in 17 test cases, all passed (JSON round-trip, registry Seal, unknown keys skipped, distinct Transform positions, view vs owning-group assign)
  • Launch Sandbox, confirm Level_1 entities (Floor / Sun / Sphere) appear in the world outline with names
  • Press Play and confirm the LightingTest grid is spaced out, not stacked at the origin
  • Save/load a level and confirm git-diffable JSON

cursoragent and others added 2 commits August 16, 2026 00:19
…so levels are human-readable and Gameplay no longer lists Graphics types.

Co-authored-by: Ben Hoffman <BenjaFriend@users.noreply.github.com>
…ored pose.

Owning EnTT groups swapped Transform out from under assign() once a level was already loaded; views plus Transform-first world load keep gameplay spawn order-agnostic. Also list named entities in the world outline and quiet expected JSON test logs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@BenjaFriend

Copy link
Copy Markdown
Member Author

look mom AI slop

@BenjaFriend
BenjaFriend marked this pull request as ready for review August 16, 2026 01:49
@BenjaFriend
BenjaFriend merged commit 3671abe into feature/169-engine-modules Aug 16, 2026
6 checks passed
@BenjaFriend
BenjaFriend deleted the cursor/component-json-serialization-6e8e branch August 16, 2026 01:49
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.

2 participants