From 65a0c1505408f1168f42a55b0f97a3dbe4e78218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Mon, 28 Mar 2022 01:41:32 +0200 Subject: [PATCH] sync current problems: - [X] time was wiggling to much => resolved, we state.ticked twice per client.tick - [ ] Jump Reset to 0, see issue #1512 => Jump z reset to 0 after 200ms (time ahead) for 1 tick, on_ground is one tick behind JumpEvent, could be disabled by modifying common/state/src/state.rs handle_jump if condition remove on_ground check - [ ] X/Y wiggle which looks like this -/'\,/- => The error actually persists in the last 1 before we receive no data from server /''''*\ => The error exist equally in X and Y regardless of direction => The error already exsits before we apply the state.tick or state.rewind_tick, so it maybe comes from server via sync ? - [X] Cant look around when holding the admin staff => we used Dir::new() which was 0/1/0 and due to normalizing limited the final range to around 5 degree - [X] Slower when zommed in than when zoomed out => fixed by the look_dir fix above :) --- client/src/lib.rs | 308 ++++++++++++++++++----- common/src/comp/remote_controller.rs | 57 ++++- common/src/states/utils.rs | 12 + common/state/src/state.rs | 3 +- common/systems/src/phys.rs | 17 +- common/systems/src/predict_controller.rs | 16 +- 6 files changed, 341 insertions(+), 72 deletions(-) diff --git a/client/src/lib.rs b/client/src/lib.rs index f53dda3672..7b3b33ab3c 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -237,8 +237,9 @@ pub struct Client { local_command_gen: CommandGenerator, next_control: Controller, - inter_tick_rewind_time: Option, - _rewind_fluctuation_budget: f64, + inter_tick_reverted_time: Option, + inter_tick_time_syncs: usize, + rewind_fluctuation_budget: f64, network: Option, participant: Option, @@ -723,8 +724,9 @@ impl Client { local_command_gen: CommandGenerator::default(), next_control: Controller::default(), - inter_tick_rewind_time: None, - _rewind_fluctuation_budget: 0.0, + inter_tick_reverted_time: None, + inter_tick_time_syncs: 0, + rewind_fluctuation_budget: 0.0, network: Some(network), participant: Some(participant), @@ -1703,7 +1705,8 @@ impl Client { // 1) Build up a list of events for this frame, to be passed to the frontend. let mut frontend_events = Vec::new(); - self.inter_tick_rewind_time = None; + self.inter_tick_reverted_time = None; + self.inter_tick_time_syncs = 0; // Prepare for new events { @@ -1734,10 +1737,16 @@ impl Client { frontend_events.append(&mut self.handle_new_messages()?); // Simulate Ahead - common_base::plot!("recived_time_sync", 0.0); - if let Some(rewind_time) = self.inter_tick_rewind_time { - common_base::plot!("recived_time_sync", 1.0); - let _time = self.state.ecs().read_resource::