Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Spaceships predicted despawn behaviour #808

Merged
merged 4 commits into from
Jan 13, 2025
Merged

Conversation

cBournhonesque
Copy link
Owner

In the spaceships example, I notice this behaviour:

  • we call EntityMut::remove::<server.Replicate>().despawn() on the server
  • we call EntityMut::despawn() on the client.

I don't think this behavior is correct

  1. EntityMut.remove::<server.Replicate>().despawn() would still send a ReplicateDespawn message. To avoid sending the message you need do to EntityMut::remove<Replicating>().despawn(). It's best to use the provided command commands.despawn_without_replication()

  2. Also we want the despawn to be replicated from the server to guarantee that the client/server behavior stay in sync!
    So what we actually want is to do a normal despawn on the server, and to do a predicted_despawn on the client.

(For a predicted_despawn, I remove all components on the entity but I still keep the entity and the PredictionHistory, in case the predicted_despawn gets reverted and I need to re-add all the components again. It might be possible to avoid special casing the prediction despawn: #793)

@cBournhonesque cBournhonesque added A-Prediction C-Example A change/addition to an example labels Jan 13, 2025
@cBournhonesque cBournhonesque merged commit 6920b23 into main Jan 13, 2025
2 of 4 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-Prediction C-Example A change/addition to an example
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant