I’m starting to build a network multi-player game with Legion. I want to synchronize changes in entities on the server with their counterparts in connected clients.
I don’t know how to uniquely identify an entity in a way that is consistent across server and client and allows for random access to the entity.
I see that entities have an opaque ID, and I also see that the
Canon produces a serialized “name” for entities, but I’m not sure if I am supposed to rely on these constructs to synchronize entity changes over time.
I thought to add a
UniqueID(value) component to my entities, but I couldn’t figure out a way to access an entity by component value without iterating over all entities (and with hindsight, perhaps it doesn’t make sense to do that anyway).
What approach would you recommend for this kind of scenario?