diff --git a/client/src/lib.rs b/client/src/lib.rs index 7b3b33ab3c..bb0e114e88 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -4,6 +4,7 @@ pub mod addr; pub mod error; +mod revertclock; // Reexports pub use crate::error::Error; @@ -15,7 +16,7 @@ pub use specs::{ Builder, DispatcherBuilder, Entity as EcsEntity, ReadStorage, World, WorldExt, }; -use crate::addr::ConnectionArgs; +use crate::{addr::ConnectionArgs, revertclock::RevertClock}; use byteorder::{ByteOrder, LittleEndian}; use common::{ character::{CharacterId, CharacterItem}, @@ -64,7 +65,7 @@ use common_net::{ sync::WorldSyncExt, }; use common_state::State; -use common_systems::{add_local_systems, add_rewind_systems}; +use common_systems::add_local_systems; use comp::BuffKind; use hashbrown::{HashMap, HashSet}; use image::DynamicImage; @@ -237,9 +238,7 @@ pub struct Client { local_command_gen: CommandGenerator, next_control: Controller, - inter_tick_reverted_time: Option, - inter_tick_time_syncs: usize, - rewind_fluctuation_budget: f64, + revert_clock: RevertClock, network: Option, participant: Option, @@ -724,9 +723,7 @@ impl Client { local_command_gen: CommandGenerator::default(), next_control: Controller::default(), - inter_tick_reverted_time: None, - inter_tick_time_syncs: 0, - rewind_fluctuation_budget: 0.0, + revert_clock: RevertClock::default(), network: Some(network), participant: Some(participant), @@ -1705,8 +1702,7 @@ 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_reverted_time = None; - self.inter_tick_time_syncs = 0; + self.revert_clock.reset(); // Prepare for new events { @@ -1736,256 +1732,9 @@ impl Client { // Handle new messages from the server. frontend_events.append(&mut self.handle_new_messages()?); - // Simulate Ahead - - //TODO: also waro budget in non rewind workflow - //Dies hier. außerdem ist immernoch 200 als fixer wert im controler drinn - - let time = self.state.ecs().read_resource::