Skip to content

Reserve Entity ID Range #11602

@DrewRidley

Description

@DrewRidley

In networking, It's fairly common to synchronize some pieces of game state. Currently, almost all networking solutions use their own HashMap or other indirection to map entity IDs between a client and server. While this solution generally works, it adds an unnecessary layer of complexity and makes it harder to reason about networked logic.

I am proposing extending the bevy API to include a reserve_entities() method, or something to this effect. This would allow you to reserve a contiguous interval of entity IDs, and they would not be used by bevy. This would reduce indirection and complexity in writing networked games, and will likely have other non-networked benefits in other circumstances. The ability to have deterministic IDs is generally a useful pattern, and I think it has a lot of value in Bevy.

In the coming days I will begin working on a naive approach just to get some feedback, but I would love to hear other thoughts in the meantime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleX-ControversialThere is active debate or serious implications around merging this PR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions