pub struct TickScheduler { /* private fields */ }Expand description
Manages the fixed-timestep execution of the game loop.
Implementations§
Source§impl TickScheduler
impl TickScheduler
Sourcepub fn new(
tick_rate: u64,
auth_service: Arc<dyn AuthSessionVerifier>,
encode_pool: Arc<ThreadPool>,
) -> Self
pub fn new( tick_rate: u64, auth_service: Arc<dyn AuthSessionVerifier>, encode_pool: Arc<ThreadPool>, ) -> Self
Creates a new scheduler with the specified tick rate.
Sourcepub fn with_spawn_at_zero(self, v: bool) -> Self
pub fn with_spawn_at_zero(self, v: bool) -> Self
Enables spawning 100 stress-test entities after advance_tick() at tick 0.
This matches the server recording setup and must be used by the determinism replay
test so that entity origin_tick values are identical to those in the golden file.
Sourcepub fn set_outbound_tx(&mut self, tx: Sender<OutboundMessage>)
pub fn set_outbound_tx(&mut self, tx: Sender<OutboundMessage>)
Sets the outbound channel for messages. Used in tests or custom loops.
Sourcepub async fn run(
&mut self,
transport: Box<dyn PlatformTransport>,
world: Box<dyn WorldState>,
encoder: Box<dyn Encoder>,
shutdown: Receiver<()>,
)
pub async fn run( &mut self, transport: Box<dyn PlatformTransport>, world: Box<dyn WorldState>, encoder: Box<dyn Encoder>, shutdown: Receiver<()>, )
Runs the infinite game loop until the shutdown token is cancelled.
Sourcepub async fn tick_step(
&mut self,
transport_lock: &RwLock<Box<dyn PlatformTransport>>,
world: &mut dyn WorldState,
encoder: &dyn Encoder,
)
pub async fn tick_step( &mut self, transport_lock: &RwLock<Box<dyn PlatformTransport>>, world: &mut dyn WorldState, encoder: &dyn Encoder, )
Executes a single 5-stage tick pipeline.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TickScheduler
impl !RefUnwindSafe for TickScheduler
impl Send for TickScheduler
impl Sync for TickScheduler
impl Unpin for TickScheduler
impl UnsafeUnpin for TickScheduler
impl !UnwindSafe for TickScheduler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.