-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ADR 256: static entities #281
Open
nearnshaw
wants to merge
3
commits into
main
Choose a base branch
from
static-entities
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 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. | ||
|
||
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. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd choose Static component rather than an extra bool in Transform.