Core registers a Component Schema from a description (#75) #76

Closed
opened 2026-09-06 01:23:25 +00:00 by crowmaki · 0 comments
Owner

Parent

#75

What to build

An engine developer can register a Component Schema from a plain description rather than from an Odin type, and can do so after startup. The description is a Boundary Type: a name, an array of field descriptions, and optional on_add and on_remove Hooks. A field description is a name and a Component_Field_Kind; the Kind enum covers only F64, Bool and GameObject_Reference. Odin-derived Schemas keep their typeid inside Core and report no Kind, respecting ADR-0022's deferral.

The new boundary proc, engine_register_component_schema, maps each Kind to the Odin type Core already serializes, computes layout, and opens storage. It becomes the boundary route the Scene ABI test currently records as missing. A Schema registered this way is a first-class Schema: the serializer, both Scene Encodings and Play Mode capture see it exactly as they see an Odin Component.

The Odin-type route and the description route should share their tail (name ownership, Schema append, storage open); factor that out first so the two cannot drift. The debug-only "called after startup" panic must apply only to Odin-type registration.

Acceptance criteria

  • Component_Schema_Desc, Component_Field_Desc and Component_Field_Kind are declared in the ABI Surface and closed over Boundary Types
  • engine_register_component_schema registers a Schema from a description during register/init and returns a usable Component_Type
  • Registration from a description after startup (in .Frame phase) succeeds; Odin-type registration after startup still panics under ODIN_DEBUG
  • A name collision after startup fails the call with a logged error and leaves the running Scene untouched
  • GameObject_Reference fields carry the .Reference flag and work with component_reference / component_set_reference
  • A Component of a description-registered Schema round-trips through the text encoding, the binary encoding, and Play Mode capture/restore with its field values intact
  • The Scene ABI test places the new proc and types in its tables and the "no boundary route" entry for engine_register_component is retired
  • Core tests cover every criterion above with no Luau involved

Blocked by

  • None (can start immediately)
## Parent #75 ## What to build An engine developer can register a Component Schema from a plain description rather than from an Odin type, and can do so after startup. The description is a Boundary Type: a name, an array of field descriptions, and optional `on_add` and `on_remove` Hooks. A field description is a name and a `Component_Field_Kind`; the Kind enum covers only `F64`, `Bool` and `GameObject_Reference`. Odin-derived Schemas keep their `typeid` inside Core and report no Kind, respecting ADR-0022's deferral. The new boundary proc, `engine_register_component_schema`, maps each Kind to the Odin type Core already serializes, computes layout, and opens storage. It becomes the boundary route the Scene ABI test currently records as missing. A Schema registered this way is a first-class Schema: the serializer, both Scene Encodings and Play Mode capture see it exactly as they see an Odin Component. The Odin-type route and the description route should share their tail (name ownership, Schema append, storage open); factor that out first so the two cannot drift. The debug-only "called after startup" panic must apply only to Odin-type registration. ## Acceptance criteria - [ ] `Component_Schema_Desc`, `Component_Field_Desc` and `Component_Field_Kind` are declared in the ABI Surface and closed over Boundary Types - [ ] `engine_register_component_schema` registers a Schema from a description during `register`/`init` and returns a usable `Component_Type` - [ ] Registration from a description after startup (in `.Frame` phase) succeeds; Odin-type registration after startup still panics under `ODIN_DEBUG` - [ ] A name collision after startup fails the call with a logged error and leaves the running Scene untouched - [ ] `GameObject_Reference` fields carry the `.Reference` flag and work with `component_reference` / `component_set_reference` - [ ] A Component of a description-registered Schema round-trips through the text encoding, the binary encoding, and Play Mode capture/restore with its field values intact - [ ] The Scene ABI test places the new proc and types in its tables and the "no boundary route" entry for `engine_register_component` is retired - [ ] Core tests cover every criterion above with no Luau involved ## Blocked by - None (can start immediately)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
crowmaki/cinnabar#76
No description provided.