-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Open
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-Tracking-IssueAn issue that collects information about a broad development initiativeAn issue that collects information about a broad development initiativeX-BlessedHas a large architectural impact or tradeoffs, but the design has been endorsed by decision makersHas a large architectural impact or tradeoffs, but the design has been endorsed by decision makers
Description
This issue does not exist to argue the merits of Resources as Components, for some of the rationale we refer to this HackMD (this really should've been an RFC, huh?). This issue exists to track the progress on implementation and to reference in code when it is only partially working. If there are steps you feel like should be added, or if there are problems with this approach, please let me know.
Implementation Plan
This is a tracking issue for the Resources as Components. This outline is roughly copied from #17485.
- Introduce Internal Entities, entities that are difficult to query, with the intend to make resource entities internal (Internal Entities #20204).
- Test robustness, to be less reliant on specific entity counts (Improve test robustness #20248, Adjust benches to be more robust #20207) . We deprecate
world.iter_entities()
andworld._iter_entities_mut()
as part of that effort Deprecateiter_entities
anditer_entities_mut
#20260. - Define marker components
IsResource
andResourceEntity
and spawn them alongside resources. (in progress: Add entities alongside resources #19711) - Add a cache that links Resources to their respective entities (in progress: Add entities alongside resources #19711)
- Change the API of
world.clear_entities()
and assorted other methods to ignore resource entities. - Make Resource a Component, and change the derive macro to derive a Component also.
- Remove or shrink ReflectResource
- Store the actual resource data on the resource entities. Note that at this point, the usual resource infrastructure exists alongside the entities, which are spawned and respawned alongside Resources.
- Make sure the caller information can be passed into entity spawning.
- Move resource access over from the old storage to the entities. Think
Query<Res<Example>>
,world.iter_resources()
, and so on. - Remove all of the resource internals (before this, they're marked with expect(dead_code)).
I'm guessing that I could split out several of these items into smaller things, but this suffices as a rough outline for now.
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-Tracking-IssueAn issue that collects information about a broad development initiativeAn issue that collects information about a broad development initiativeX-BlessedHas a large architectural impact or tradeoffs, but the design has been endorsed by decision makersHas a large architectural impact or tradeoffs, but the design has been endorsed by decision makers