bevyengine / bevyengine/bevy

Reserve Entity ID Range

Open
#11,602 5 comments 0 reactions 0 assignees View on GitHub
A-ECS C-Feature X-Needs-SME
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.