Repository navigation
Lightyear 0.30.0
Runtime timeline switching
Entities can now smoothly move between the predicted and interpolated timelines at runtime, so you can predict only what matters (the objects near the local player) instead of predicting the whole world.
// Switch an entity to predicted (this client will simulate it), with a smooth blend.
commands.entity(entity).insert(
TimelineSwitch::to_predicted()
.with_transition_secs(0.3)
.with_ease(CorrectionEase::EaseOutCubic),
);
// ...and back to interpolated when it is no longer relevant.
commands.entity(entity).insert(TimelineSwitch::to_interpolated());This is similar to this unity feature: https://docs.unity3d.com/Packages/com.unity.netcode@1.3/manual/prediction-switching.html
See the new timeline_switch example: nearby free blocks are predicted, blocks carried by another player stay interpolated.
Replication
- Correction now supports easing curves.
CorrectionEaseprovidesLinear,Smoothstep,EaseOutCubic,EaseInOutCubicandExponential(the default), selected on aCorrectionPolicy. - Hierarchy propagation fix Replication config (rooms, visibility, targets, etc.) now propagate correctly through a hierarchy.
- Rollback improvements: rollback checks were simplified and some edge cases (e.g. if a client is running behind the server) are now handled correctly
Avian
LinearVelocityandAngularVelocityare corrected alongsidePosition/Rotationto ensure smooth corrections now that hermitian interpolation uses velocities.
Migration guide
PeerMetadatano longer exists. The peer to entity mapping was moved insideRes<NetworkingMetadata>atNetworkingMetadata::peer_map.PacketBuilder::nack_rtt_multipleis gone; configurePacketNackSettingson theTransportinstead.InputBufferinternals were reworked to use a ring buffer instead of a VecDeque. It doesn't have a publicbufferfield anymore. Predicted inputs are not stored in the buffer anymore; you can callInputBuffer::predictinstead to directly get the value of a predicted input.ServerInputConfig<S>was removed. Client and server now share a singleInputConfig<A>.
What's Changed
- Document component visibility scopes by @cBournhonesque in #1674
- fix(examples): rebuild the projectiles example by @cBournhonesque in #1669
- fix(prediction): bound P2P input rollbacks to session start by @cBournhonesque in #1675
- feat(p2p): add explicit session start lifecycle by @cBournhonesque in #1676
- chore: merge PeerMetadata with NetworkingMetadata by @cBournhonesque in #1679
- fix(interpolation): hide entities until materialized by @cBournhonesque in #1681
- fix: refactor projectiles example by @cBournhonesque in #1680
- fix(replication): separate target and lifecycle markers by @cBournhonesque in #1682
- Make
MAX_CLIENTSconfigurable by @tidely in #1688 - Fix ACK processing and make NACK timing configurable by @Deniskore in #1685
- feat(bei): automatically propagate Replicate on BEI Action entities by @cBournhonesque in #1690
- fix(prediction): deliver server inserts of never-predicted components to Predicted entities by @pauldemarco in #1696
- Revert "fix(interpolation): hide entities until materialized" by @cBournhonesque in #1699
- fix(transport): use u16 wrapping IDs by @cBournhonesque in #1698
- feat(netcode): emit errors as bevy messages by @cBournhonesque in #1700
- fix(prediction): simplify rollback logic by @cBournhonesque in #1702
- fix(p2p): synchronize example session startup by @cBournhonesque in #1706
- refactor(spaceships): select firing behavior by topology by @cBournhonesque in #1707
- Fix #1705 by @cBournhonesque in #1708
- fix(replication): handle initial prediction markers in receive paths by @cBournhonesque in #1709
- fix(prediction): check confirmations at current tick by @cBournhonesque in #1711
- test(prediction): move integration cases to lightyear tests by @cBournhonesque in #1712
- refactor(interpolation): improve bundle rule resolution by @cBournhonesque in #1713
- perf: fix interpolatio archetype key computation by @cBournhonesque in #1714
- Simplify rollback checking by @cBournhonesque in #1717
- feat(prediction): type-erase prediction systems by @cBournhonesque in #1718
- chore(interpolation): tighten interp timeline by @cBournhonesque in #1720
- refactor(transport): Refactor
MessageRegistryby @tidely in #1722 - fix(prediction): prune confirmed history on prediction by @cBournhonesque in #1724
- chore: update replicon to 0.44 by @cBournhonesque in #1728
- nit(input): drain receiver channel if timeline is not synced by @cBournhonesque in #1727
- chore(book): update book by @cBournhonesque in #1731
- fix(avian): add correction for velocities by @cBournhonesque in #1730
- feat(hierarchy): better handle hierarchy propagation by @cBournhonesque in #1733
- feat(messages): allow parallel message sends via shared borrows by @cBournhonesque in #1735
- feat(replicate): simplify ReplicationTarget implementation by @cBournhonesque in #1734
- feat(messages): resolve entity mappings through replicon's shared map by @cBournhonesque in #1736
- feat(inputs): simplify input handling by @cBournhonesque in #1738
- chore(examples): simplify simple_setup example by @cBournhonesque in #1739
- feat: enable timeline switching by @cBournhonesque in #1740
New Contributors
- @tidely made their first contribution in #1688
- @Deniskore made their first contribution in #1685
- @pauldemarco made their first contribution in #1696
Full Changelog: 0.29.0...0.30.0