Prefabs #47

Open
UnflavoredMeson/Primal_Plus_Plus
opened 2026-11-24 20:16:02 +00:00 by UnflavoredMeson · 0 comments
Owner

Why

Prefabs are the unit of reuse: an actor set up once in the editor and placed many times.

Decided

  • Actor records, capture(), building with default-part matching (a constructor's default parts are matched to the prefab's by name), a prefab registry, actor::spawn_prefab()/PrefabRef in the game API.
  • Instance overrides: transform, name, and the actor's and behaviors' fields. Nested prefabs later.
  • Edit Prefab opens it as a temporary scene; saving a prefab rebuilds open instances.
  • Prefab files are JSON (S7-04).

Read first

  • Actors, sections 6, 21 and 22.

Steps

  • 1. Write tests for capture, build and overrides.
  • 2. Write the engine side until they pass.
  • 3. Add Save as Prefab, Edit Prefab and instances in the editor.

Done when

  • A prefab edit updates its instances and keeps their overrides; tests pass; 0 warnings; tidy 0.

Claude can help with

  • The override diffing.

Learn

  • Why overrides are stored as differences, not copies.
## Why Prefabs are the unit of reuse: an actor set up once in the editor and placed many times. ## Decided - Actor records, `capture()`, building with default-part matching (a constructor's default parts are matched to the prefab's by name), a prefab registry, `actor::spawn_prefab()`/`PrefabRef` in the game API. - Instance overrides: transform, name, and the actor's and behaviors' fields. Nested prefabs later. - Edit Prefab opens it as a temporary scene; saving a prefab rebuilds open instances. - Prefab files are JSON (S7-04). ## Read first - [Actors](https://forgejo.unflavoredmeson.com/UnflavoredMeson/Primal_Plus_Plus/wiki/Actors), sections 6, 21 and 22. ## Steps - [ ] 1. Write tests for capture, build and overrides. - [ ] 2. Write the engine side until they pass. - [ ] 3. Add Save as Prefab, Edit Prefab and instances in the editor. ## Done when - [ ] A prefab edit updates its instances and keeps their overrides; tests pass; 0 warnings; tidy 0. ## Claude can help with - The override diffing. ## Learn - Why overrides are stored as differences, not copies.
Sign in to join this conversation.
No assignees
No project
Blocks Depends on
#46 Outliner, details, gizmos, undo and redo
UnflavoredMeson/Primal_Plus_Plus
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
UnflavoredMeson/Primal_Plus_Plus#47
No description provided.