game.bin: one format for a built game's scenes #48

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

Why

A built game loads its scenes from a binary file the editor writes. The fork went through five versions of it; here it's designed once, versioned from v1.

Decided

  • Holds plain entities, prefabs, actors with their attachments and fields; not the editor's viewport cameras.
  • Written by the editor from the scene model; read by load_game(), which returns std::expected with a reason.
  • A version field; an older file is refused with "build the game again".

Read first

  • Actors, sections 10 and 21; Ecs, section 10.

Steps

  • 1. Write round-trip tests (scene model to game.bin to world).
  • 2. Write the writer and the loader.
  • 3. Run a test game from a written file.

Done when

  • The test game runs from a game.bin the editor wrote; tests pass; 0 warnings; tidy 0.

Claude can help with

  • Fixtures and the loader's error paths.

Learn

  • What a binary format needs to stay readable later (versions, sizes, alignment).
## Why A built game loads its scenes from a binary file the editor writes. The fork went through five versions of it; here it's designed once, versioned from v1. ## Decided - Holds plain entities, prefabs, actors with their attachments and fields; not the editor's viewport cameras. - Written by the editor from the scene model; read by `load_game()`, which returns `std::expected` with a reason. - A version field; an older file is refused with "build the game again". ## Read first - [Actors](https://forgejo.unflavoredmeson.com/UnflavoredMeson/Primal_Plus_Plus/wiki/Actors), sections 10 and 21; [Ecs](https://forgejo.unflavoredmeson.com/UnflavoredMeson/Primal_Plus_Plus/wiki/Ecs), section 10. ## Steps - [ ] 1. Write round-trip tests (scene model to game.bin to world). - [ ] 2. Write the writer and the loader. - [ ] 3. Run a test game from a written file. ## Done when - [ ] The test game runs from a game.bin the editor wrote; tests pass; 0 warnings; tidy 0. ## Claude can help with - Fixtures and the loader's error paths. ## Learn - What a binary format needs to stay readable later (versions, sizes, alignment).
Sign in to join this conversation.
No assignees
No project
Blocks
#52 Meshes and materials in built games
UnflavoredMeson/Primal_Plus_Plus
Depends on
#47 Prefabs
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#48
No description provided.