gschup / bevy_ggrs

Bevy plugin for the GGRS P2P rollback networking library.
Other
295 stars 42 forks source link

Update entity IDs in Children/Parent components on rollback. #103

Closed clinuxrulz closed 7 months ago

clinuxrulz commented 7 months ago

Is your feature request related to a problem? Please describe.

When a SceneBundle is used in a spawned entity (using gltf models for example) Child entities are automatically created. If there is a rollback between spawn and despawn, the entity id map between old/new IDs for Parent component and Children components is not updated leaving them pointing at possibly non-existent entities.

Describe the solution you'd like On rollback use the old/new entity ID map to update Parent and Children components. Or track child/parent relationship and spawn child entities where needed.

Describe alternatives you've considered Use a player entity without a SceneBundle and create a separate non-rollback entity with the SceneBundle that follows the player Tranform.

clinuxrulz commented 7 months ago

Probably another problem is add_rollback would not of been called on the automaticly created child entities (those created by SceneBundle when using a gltf model).

And it would be had to know which components to track in the scene bundle. So the SceneBundle use case would no longer be valid. I'll just go with the alternative model following player solution.

clinuxrulz commented 7 months ago

Will close this for now.