0.19.0
Visualizer
The visualizer
features uses the excellent bevy_metrics_dashboard to display graphs for every metrics registered in lightyear. There are metrics related to rollbacks, replication, messages, latency, etc. which can be used to more easily inspect what lightyear is doing.
![image](https://private-user-images.githubusercontent.com/8112632/407146596-14dbacf3-7b4a-4bea-9b7e-277542ea054a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5OTI2NzMsIm5iZiI6MTczODk5MjM3MywicGF0aCI6Ii84MTEyNjMyLzQwNzE0NjU5Ni0xNGRiYWNmMy03YjRhLTRiZWEtOWI3ZS0yNzc1NDJlYTA1NGEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDhUMDUyNjEzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OWUzYzhhNWI5MWQ2NTM3ZTQ5ZDdhMjRkMDI3MTk3YzZjYTBlNzMxMTMwMzI5ZWUxNzFlMTliNGQ0MWEwZTkyMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.vTyh3fecGpLRHOLazobg6XqnLbnD5WOMa3BygzB7fcM)
Lag Compensation
Lag compensation is the notion of the server 'rewinding time' to process certain user actions like bullets fired, so that client actions in the predictive timeline can impact replicated entities in the interpolated timeline. This is usually used in FPS games.
The fps
example (previously bullet_prespawn
) showcases how to enable lag compensation for hit detection.
Screen.Recording.2025-01-27.at.5.49.39.PM.mov
In this example, the red player and the blue enemy are predicted, and the green enemy is interpolated.
Bullets are pre-spawned on the client directly in the predicted timeline so they can interact normally with the blue predicted enemy.
To handle collisions with the green enemy we have to use the new LagCompensationPlugin. You can see that the server maintains a history (white bounding box) of the past positions of the green enemy to perform lag compensation (rewind time when computing the collision).
Bug fixes
- Variable input delay had been added but didn't work correctly in some situations. This should now be fixed.
- DeltaCompression, where replication updates are sent as a diff from a previous update, should now work in all situations
- Fixed a lot of cases that were causing extra rollbacks, especially related to PrePrediction and PreSpawning
- Fixed bugs related to transferring authority between client and server (in particular using prediction/interpolation in combination with authority transfer)
- Fixed some edge cases related to visibility management via the Room api
- Fixed issues related to hierarchy, in particular the Confirmed hierarchy is now correctly synced to the Predicted/Interpolated entities
What's Changed
- Fix input delay configuration by @cBournhonesque in #736
- update bevy gap version by @cBournhonesque in #738
- Fix delta-compression by storing ack_tick for each (entity, component) by @cBournhonesque in #741
- add delta compression example by @cBournhonesque in #742
- Simplify examples by removing settings file by @cBournhonesque in #744
- Fix track_change_detection by @cBournhonesque in #746
- Fix example prediction settings by @cBournhonesque in #747
- Remove DisabledComponent in favor of DisabledComponents by @cBournhonesque in #748
- Simplify wasm certificate for examples by @cBournhonesque in #749
- Add event replication by @cBournhonesque in #754
- Re-add serde to examples by @cBournhonesque in #755
- fix auth example by @cBournhonesque in #756
- add unit test for despawning an entity after authority transfer by @cBournhonesque in #757
- Fix prediction/interpolation interaction with authority transfer by @cBournhonesque in #759
- fix pre-prediction by @cBournhonesque in #761
- Make sure ChannelDirection is respected by @cBournhonesque in #764
- Improvements to room logic by @cBournhonesque in #766
- Add interest management unit test by @cBournhonesque in #767
- Add unit test for entity-despawns with interest-management by @cBournhonesque in #768
- Improve the server stop logic by @cBournhonesque in #769
- Fix replicate propagation through hierarchy by @cBournhonesque in #771
- Update Docs, closes #386 by @Jieiku in #770
- Make sure that hierarchy is propagated correctly to Predicted/Interpolated entities by @cBournhonesque in #772
- add unit test for adding a child to ReplicateHierarchy.recursive=true by @cBournhonesque in #773
- add benchmark to measure compilation times by @cBournhonesque in #774
- Type erase the receive-message and receive-event systems by @cBournhonesque in #775
- Improve flow to disconnect client by @cBournhonesque in #778
- fix: register prespawned entity in predicted_entity_map during server… by @OlivierCoue in #776
- Use ComponentHooks to maintain the prediction/confirmed map in sync by @cBournhonesque in #780
- update entity map to return Entity::PLACEHOLDER if the mapping fails by @cBournhonesque in #781
- Fix hierarchy-related system ambiguity by @cBournhonesque in #783
- Avoid entity-mapping error log on preprediction by @cBournhonesque in #787
- Fix rollback for pre-predicted entities by @cBournhonesque in #788
- Add method to get client_addr from client_id by @cBournhonesque in #794
- add missing dependencies, add avian3d simple gamepad support by @Jieiku in #792
- Add system order for avian by @cBournhonesque in #796
- Update HistoryBuffers during client TickEvents by @cBournhonesque in #798
- Rollback improvements by @cBournhonesque in #799
- Add metrics visualizer by @cBournhonesque in #802
- Fix lints by @cBournhonesque in #803
- Fix ServerConnection::client_addr by @cBournhonesque in #804
- Refactor examples to build a single binary by @cBournhonesque in #805
- Update metrics-util requirement from 0.18 to 0.19 by @dependabot in #807
- Fix duplicate entities in PrePrediction by @cBournhonesque in #806
- Spaceships predicted despawn behaviour by @cBournhonesque in #808
- Add metrics for rollback by @cBournhonesque in #810
- add unit test for prespawn despawn by @cBournhonesque in #811
- add unit tests for predicted despawn by @cBournhonesque in #812
- Add non-networked component to despawned predicted entity test by @cBournhonesque in #813
- Create FUNDING.yml by @cBournhonesque in #814
- Fix extra rollbacks on pre-spawned entities by @cBournhonesque in #815
- Fix despawn for pre-spawned entities by @cBournhonesque in #819
- Fix leafwing ActionState staying stuck in JustPressed or JustReleased by @cBournhonesque in #820
- Fix hashing in bullet-prespawn example by @cBournhonesque in #821
- Add alias for Replicate by @cBournhonesque in #822
- add metrics for inputs by @cBournhonesque in #823
- Allow not replicating hierarchy by @cBournhonesque in #824
- Improve visual interpolation for examples by @cBournhonesque in #825
- Move UpdateVisualInterpolation to FixedLast by @cBournhonesque in #826
- Make history buffer pub by @cBournhonesque in #831
- add intoiterator for historybuffer by @cBournhonesque in #832
- Update metrics-tracing-context requirement from 0.17 to 0.18 by @dependabot in #833
- Use a varint to serialize the fragment id and num_fragments for fragment messages by @cBournhonesque in #838
- Fix simple setup example by @cBournhonesque in #843
- Separate new() and new_with_app_id() by @NathanTaylorHunt in #841
- Emit disconnect event on connection failure by @cBournhonesque in #844
- fixup disconnect events firing, adapt steam disconnections to ConnectionError by @Piefayth in #845
- perform state transition on certain disconnects by @Piefayth in #846
- Update getrandom requirement from 0.2.11 to 0.3.0 by @dependabot in #848
- Add lag compensation by @cBournhonesque in #849
- Add video for fps example by @cBournhonesque in #850
New Contributors
- @Jieiku made their first contribution in #770
- @OlivierCoue made their first contribution in #776
- @NathanTaylorHunt made their first contribution in #841
- @Piefayth made their first contribution in #845
Full Changelog: 0.18.0...0.19.0