ADR-256: Static Entities

More details about this document
Latest published version:
https://adr.decentraland.org/adr/ADR-256
Authors:
nearnshaw
Feedback:
GitHub decentraland/adr (pull requests, new issue, open issues)
Edit this documentation:
GitHub View commits View commits on githistory.xyz

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:

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.

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.

License

Copyright and related rights waived via CC0-1.0. DRAFT Draft