Skip to content

0.30.0

Latest

Choose a tag to compare

@cBournhonesque cBournhonesque released this 14 Sep 03:16
· 22 commits to main since this release

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. CorrectionEase provides Linear, Smoothstep, EaseOutCubic, EaseInOutCubic and Exponential (the default), selected on a CorrectionPolicy.
  • 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

  • LinearVelocity and AngularVelocity are corrected alongside Position/Rotation to ensure smooth corrections now that hermitian interpolation uses velocities.

Migration guide

  • PeerMetadata no longer exists. The peer to entity mapping was moved inside Res<NetworkingMetadata> at NetworkingMetadata::peer_map.
  • PacketBuilder::nack_rtt_multiple is gone; configure PacketNackSettings on the Transport instead.
  • InputBuffer internals were reworked to use a ring buffer instead of a VecDeque. It doesn't have a public buffer field anymore. Predicted inputs are not stored in the buffer anymore; you can call InputBuffer::predict instead to directly get the value of a predicted input.
  • ServerInputConfig<S> was removed. Client and server now share a single InputConfig<A>.

What's Changed

New Contributors

Full Changelog: 0.29.0...0.30.0