Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

How to handle spawn-despawn for Prespawned entities before we receive the server entity? #818

Closed
cBournhonesque opened this issue Jan 13, 2025 · 0 comments · Fixed by #819

Comments

@cBournhonesque
Copy link
Owner

Scenario:

  • client C spawns entity E that is Prespawned
  • C despawns E (with prediction_despawn())
  • Server message containing E' arrives.

How do we handle the despawn?

Option 1: we really despawn E, and we clear out the prespawn hash map

  • when client receives E', it tries to match it with E using the prespawned hash. It sees that E is missing so it just spawns a new predicted entity. The predicted entity has no history for that tick so a rollback happens for that entity

Option 2: we do a fake despawn for E, and update its history immediately.

  • client receives E', we match it with E using the prespawned hash. There is no rollback because we kept the PredictionHistory on the Predicted entity even though we removed all other components.

Problem:

  • if the entity is spawned/despawned within a replication interval on the server (because it is very short-lived), then the server won't ever send a message for that entity. This is fine because the entity will be cleaned up by pre_spawned_player_object_cleanup anyway
  • the non-networked components on the PreSpawned entity are not removed (same problem as Move PredictionHistory to the Confirmed entity? #793)

It seems like we should just do the same thing as we do for Predicted entities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant