Better entities tracking issue #18719
Labels
A-ECS
Entities, components, systems, and events
C-Tracking-Issue
An issue that collects information about a broad development initiative
X-Controversial
There is active debate or serious implications around merging this PR
Objective
I've been deep in Bevy's entity code for a few weeks now, working on remote entity reservation. Having become pretty familiar with it, there's a few areas I think we can significantly improve.
This is a tracking issues for my ideas here. Each one deserves discussion, but since they are separate issues, I figured a tracking issue would be better than a discussion post with disjoint comments.
Roadmap
alloc_at
functionality. Removeinsert_or_spawn
function family #18148 . This was a performance foot gun for users and it madeEntities
overly restrictive.u32::MAX
index entity. Right now, this is a bug inEntities
. One solution is out here: Makeentity::index
non max #18704 . (But that's still up for debate).u32
in a new type. Make entity generation a new type and remove identifier #19121TableRow
,ArchetypeRow
, etc non-max. Nonmax all rows #19132insert_or_spawn_batch
. See here.u32
s as entity generation and index. We have types for these now!EntityGeneration
. Implement iterator for entity generation #19144entity
module. These have strayed a bit from their best meaning, but haven't been updated to prevent a migration guide. But I think it's worth it.Identifier
system. This is an ecs utility that is only used byEntity
. But these changes makeEntity
pretty unique as far as identifiers go, and given that the identifier system is only used by entities, I think we can safely let this go to reduce complexity.Entity::PLACEHOLDER
. The only possible reason to use this is as a replacement forMaybeUninit:: uninit
that trades UB fort a logic error. But who's doing that?Option
is better anyway for most things, and people can make their own placeholders if needed. That would make the risks more explicit.TableId
andArchetypeId
non max. If there can't beu32::MAX
entities, there cant't be that many archetypes. Let's give it a niche for the places this is used in an option.ComponentId
wrap entity information. This is the first step in components as entities.ComponentId
map that is an optimizedHashMap<ComponentId, T>
. This would be a vec index for the firstSOME_CONSTANT
entities and then a hashmap after that.The text was updated successfully, but these errors were encountered: