You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(scene): stable-schema binary scene artifact #716
Implement the validated stable-schema binary scene artifact used by the runtime
cook path. It is a portable cooked representation of the authoring document,
not a raw-memory dump and not a zero-parse promise.
Scope
Define a binary header with magic, version, endian/feature compatibility, and
integrity checks.
Encode bounded offsets/lengths, stable component schema keys and versions,
scene UUID/settings, and UUID mappings required for references.
Validate every header, table, count, offset, length, version, and component
payload before constructing runtime data.
Valid cooked data loads on a fresh process with preserved durable identity and
component semantics.
Truncated, oversized, malformed, unsupported-version, and incompatible data
fails safely without partial publication.
Binary assets remain independent of process-local type allocation and native
ABI/layout differences.
References
ZEngine/docs/future-plan/scene-serialization.md sections 8, 9, and 11.
Implementation API contract
The binary header is a logical wire layout, not a packed C++ structure. The
implementation writes and reads every integer in the declared byte order; sizeof, alignment, and a memcpy of BinarySceneHeader are never part of
the format contract.
namespaceZEngine::ECS
{
classSceneComponentSchemaRegistry;
classSceneCompatibilityService;
classSceneValue;
structSceneDocument;
structSceneDiagnostics;
structSceneSerializationLimits;
namespaceSceneBinaryFormat
{
inlineconstexpruint32_t Magic = ZESCENE_MAGIC;
inlineconstexpruint32_t CurrentVersion = 1;
inlineconstexpruint32_t LittleEndianMark = 0x01020304;
}
// A component codec receives a reader bounded to its one payload table// entry, so it cannot consume the next component's data.classSceneBinaryReader;
classSceneBinaryWriter;
classBinarySceneCodec
{
public:voidInitialize(const SceneComponentSchemaRegistry* schemas,
const SceneCompatibilityService* compatibility);
Core::VFS::VFSResult<void> Encode(const SceneDocument& document,
Core::Memory::ArenaAllocator* output_arena,
Core::Containers::Array<uint8_t>* out_bytes,
SceneDiagnostics* diagnostics) const;
Core::VFS::VFSResult<void> Decode(Core::Containers::ArrayView<constuint8_t> bytes,
const SceneSerializationLimits& limits,
Core::Memory::ArenaAllocator* document_arena,
SceneDocument* out_document,
SceneDiagnostics* diagnostics) const;
};
}
Encode initializes out_bytes from output_arena and emits the current
document version, feature flags, stable schema keys/versions, bounded tables,
and an integrity value. Decode validates the complete header and every count,
offset, length, version, key, and checksum before allocating an unbounded
collection or returning a document. It routes supported version changes through #830 and reports all content failures through SceneDiagnostics.
The codec owns bounded format conversion only. It neither opens files nor
publishes a live scene; #718 owns artifact I/O/asset validation and #829 owns
runtime construction. Unknown components may be represented in a decoded
document for editor compatibility, but a shipping cook is rejected according to
the policy in #830.
Summary
Implement the validated stable-schema binary scene artifact used by the runtime
cook path. It is a portable cooked representation of the authoring document,
not a raw-memory dump and not a zero-parse promise.
Scope
integrity checks.
scene UUID/settings, and UUID mappings required for references.
payload before constructing runtime data.
runtime
ComponentTypeID,EntityID, pointers, alignment-dependent structs,or raw component bytes as the durable contract.
reconstruction or cook output.
Non-goals
a structured validation failure.
Dependencies
Acceptance criteria
component semantics.
fails safely without partial publication.
ABI/layout differences.
References
ZEngine/docs/future-plan/scene-serialization.mdsections 8, 9, and 11.Implementation API contract
The binary header is a logical wire layout, not a packed C++ structure. The
implementation writes and reads every integer in the declared byte order;
sizeof, alignment, and amemcpyofBinarySceneHeaderare never part ofthe format contract.
Encodeinitializesout_bytesfromoutput_arenaand emits the currentdocument version, feature flags, stable schema keys/versions, bounded tables,
and an integrity value.
Decodevalidates the complete header and every count,offset, length, version, key, and checksum before allocating an unbounded
collection or returning a document. It routes supported version changes through
#830 and reports all content failures through
SceneDiagnostics.The codec owns bounded format conversion only. It neither opens files nor
publishes a live scene; #718 owns artifact I/O/asset validation and #829 owns
runtime construction. Unknown components may be represented in a decoded
document for editor compatibility, but a shipping cook is rejected according to
the policy in #830.