You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having issues handling relations between entities properly.
As an example; I have a 'Head' entity and a 'Segment' entity.
In the segment entity, I want to add a HasHead(EntityProperty) component that contains the head's entity.
If I just use naia's replication channel, i often get panics because the HasHead component gets sent to the server before the client has spawned the corresponding Head entity. The client cannot read the net_entity_id corresponding to the Head because it doesn't exist, and Naia panics.
Potential solutions
Naia has a mechanism where it waits for confirmation that the client has spawned the entity before sending the corresponding EntityProperty. This seems to work for messages, but not for components that get automatically replicated.
also, it's not ideal, because this adds a certain amount of latency before the HasHead component gets replicated between client and server
Add some kind of ordering system, where I can replicate a group of components from client to server, and the client will handle them in the same order?
Pre-reserve a set of entities on client/server so that we avoid panics when an net_entity doesn't match an entity in the Bevy world?
See how other networking libraries handle this issue
The text was updated successfully, but these errors were encountered:
I've also run into this difficulty, am curious if there's already a proper way to deal with it that i can't find.
Similar to your proposed second solution I was thinking maybe have a way to create related entities in a batch. Such that consistency of the relations only needs to be valid once the full batch is committed.
Also could have an eventual consistency thing where instead of panic when net_entity doesn't match, it just adds the net->bevy entity mapping of the missing entity and then hopefully in the future that entity will end up existing.
Refactors related to EntityProperty and Entity Relations:
- Host no longer waits for remote Entities to spawn before sending Message EntityProperties containing a reference to them, they are just sent right away
- Remote will keep Messages & Components buffered separately from the world until their required Entities are spawned
- Addresses #119 ?
Other small changes:
- The Bevy demo now uses default Bevy, which may resolve#156
- Certain warning logs have been suppressed, which were only previously used for testing purposes. Their removal should give some peace of mind for people having issues like #160
Context
I am having issues handling relations between entities properly.
As an example; I have a 'Head' entity and a 'Segment' entity.
In the segment entity, I want to add a
HasHead(EntityProperty)
component that contains the head's entity.If I just use naia's replication channel, i often get panics because the
HasHead
component gets sent to the server before the client has spawned the correspondingHead
entity. The client cannot read thenet_entity_id
corresponding to the Head because it doesn't exist, and Naia panics.Potential solutions
Naia has a mechanism where it waits for confirmation that the client has spawned the entity before sending the corresponding
EntityProperty
. This seems to work for messages, but not for components that get automatically replicated.HasHead
component gets replicated between client and serverAdd some kind of ordering system, where I can replicate a group of components from client to server, and the client will handle them in the same order?
Pre-reserve a set of entities on client/server so that we avoid panics when an net_entity doesn't match an entity in the Bevy world?
See how other networking libraries handle this issue
The text was updated successfully, but these errors were encountered: