-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
When moving, rotating, and watching a number tick up over time (when a component is using the replicate plugin), there is a jitter on the client. Numbers wont increment smoothly, rotation and movement will take a few frames to 'settle'. I've isolated some of this issue to the rewind function
sabi/sabi/src/protocol/resim.rs
Lines 66 to 86 in 676659b
| pub fn rewind<C>( | |
| mut commands: Commands, | |
| entities: &Entities, | |
| tick: Res<NetworkTick>, | |
| snapshots: Res<SnapshotBuffer<C>>, | |
| ) where | |
| C: 'static + Component + Clone, | |
| { | |
| if let Some(snapshot) = snapshots.snapshots.get(&*tick) { | |
| for (entity, component) in snapshot.0.iter() { | |
| if entities.contains(*entity) { | |
| commands.entity(*entity).insert(component.clone()); | |
| } | |
| } | |
| } else { | |
| error!( | |
| "no snapshot for component: {:?}", | |
| std::any::type_name::<C>() | |
| ); | |
| } | |
| } |
Commenting that function out fixes the number jitter, so I'm thinking a lot of it is in here, but the movement jitter only get's half fixed. Perhaps it is this function potentially setting the 'Owned' player's input back to the previous frame is the other part?
sabi/sabi/src/protocol/input.rs
Lines 306 to 329 in 676659b
| pub fn client_apply_input_buffer<I>( | |
| tick: Res<NetworkTick>, | |
| mut player_input: ResMut<I>, | |
| input_buffer: Res<QueuedInputs<I>>, | |
| ) where | |
| I: 'static | |
| + Send | |
| + Sync | |
| + Resource | |
| + Component | |
| + Clone | |
| + Default | |
| + Serialize | |
| + for<'de> Deserialize<'de> | |
| + Debug | |
| + Resource, | |
| { | |
| if let Some(input) = input_buffer.get(&*tick) { | |
| //info!("{}: {:?}", tick.tick(), input); | |
| *player_input = input.clone(); | |
| } else { | |
| //error!("no input: {}", tick.tick()); | |
| } | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels