From ca15ec5e2aa52b5e5d48ec0ac0f272f01603b056 Mon Sep 17 00:00:00 2001 From: nearnshaw Date: Fri, 3 Jan 2025 16:55:47 -0300 Subject: [PATCH 1/3] static entities --- content/ADR-256-static-entities.md | 50 ++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 content/ADR-256-static-entities.md diff --git a/content/ADR-256-static-entities.md b/content/ADR-256-static-entities.md new file mode 100644 index 00000000..573f59d1 --- /dev/null +++ b/content/ADR-256-static-entities.md @@ -0,0 +1,50 @@ +--- +layout: adr +adr: 256 +title: Static Entities +date: 2025-01-03 +status: Draft +type: RFC +spdx-license: CC0-1.0 +authors: + - nearnshaw +--- + +# Abstract + +Make it possible for creators to mark an entity as **Static**. Static entities are expected to not change position, perform animations, etc. + +Each engine can handle this as they see best, but there are surely many opportunities for optimizing in all cases. + +# Context + +All game engines have some equivalent concept. Knowing which entities are certain to not move or change over time can enable many engine-side optimizations, these can involve lighting, colliders, etc. + +In most scenes, it's common for most of the environment to not need to change over time, and often the environment contains most of the triangles and textures in the scene. For example on Genesis Plaza, we mostly only need to make the NPCs, doors, and elevators non-static. + +# Proposal + +Add an additional field to the `Transform` component, a `static` boolean. This should be _false_ by default. + +If an entity is marked as static, we expect to not see any of the following: + +- Any change in the Transform +- Any change in `Material`, or if the material has a `VideoTexture` +- Any change in `GltfContainer` or `MeshRenderer` +- Any instruction from `Animator` +- Any instruction from `Tween` or `TweenSequence` +- Any instruction from `Billboard` +- Any change in `Visibility` + +If a creator makes the mistake of marking an entity as static but then also does one of the forbidden things listed above, each engine is free to handle that as it wishes. Ideally instructions should be ignored by the engine, to potentially avoid glitchy-looking effects. When this happens, the SDK should print an error message to console. + +All static entities should be instanced on the scene's first frame, either as part of a `.composite` file (that is created by interacting with the Creator Hub UI) or instanced on the `main()` function. A static entity should remain static for all of the scene's lifecycle, it can't be removed or switched back to non-static, since several engine optimizations might be relying on this state being permanent. + +Note: As an alternative approach, we also discussed handling this via a separate new `Static` component instead of a new field on the `Transform` component. There are pros and cons to each approach. + +- On one hand, an extra field on the Transform adds a slight overhead to each update message regarding any transform. (Although if the value of its corresponding protobuff digit is 1, then there should be no Transform updates beyond the initial creation) +- On the other hand, it's easier to creators to find where to add this property if it exists on the Transform. Any object that makes sense to make static will always have a Transform anyway. + +# Conclusion + +The change to the protocol required is minimal, just one boolean to the already existing Transform. There are however many corner cases to be mindful of. From 8fa65051802293cef260f78f53c2dcd8874ed4fa Mon Sep 17 00:00:00 2001 From: nearnshaw Date: Fri, 3 Jan 2025 17:01:13 -0300 Subject: [PATCH 2/3] retouch --- content/ADR-256-static-entities.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/ADR-256-static-entities.md b/content/ADR-256-static-entities.md index 573f59d1..bb82b22b 100644 --- a/content/ADR-256-static-entities.md +++ b/content/ADR-256-static-entities.md @@ -28,7 +28,7 @@ Add an additional field to the `Transform` component, a `static` boolean. This s If an entity is marked as static, we expect to not see any of the following: -- Any change in the Transform +- Any change in the `Transform` - Any change in `Material`, or if the material has a `VideoTexture` - Any change in `GltfContainer` or `MeshRenderer` - Any instruction from `Animator` From 327393979a1ebc0cb1ffd83ac9d390c648f38d5c Mon Sep 17 00:00:00 2001 From: nearnshaw Date: Fri, 3 Jan 2025 17:03:54 -0300 Subject: [PATCH 3/3] retouches --- content/ADR-256-static-entities.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/ADR-256-static-entities.md b/content/ADR-256-static-entities.md index bb82b22b..60ac6adf 100644 --- a/content/ADR-256-static-entities.md +++ b/content/ADR-256-static-entities.md @@ -31,10 +31,10 @@ If an entity is marked as static, we expect to not see any of the following: - Any change in the `Transform` - Any change in `Material`, or if the material has a `VideoTexture` - Any change in `GltfContainer` or `MeshRenderer` -- Any instruction from `Animator` -- Any instruction from `Tween` or `TweenSequence` -- Any instruction from `Billboard` - Any change in `Visibility` +- An `Animator` +- A `Tween` or `TweenSequence` +- A `Billboard` If a creator makes the mistake of marking an entity as static but then also does one of the forbidden things listed above, each engine is free to handle that as it wishes. Ideally instructions should be ignored by the engine, to potentially avoid glitchy-looking effects. When this happens, the SDK should print an error message to console.