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 GameTransport>,
world: Box<dyn WorldState>,
encoder: Box<dyn Encoder>,
shutdown: Receiver<()>,
)
pub async fn run( &mut self, transport: Box<dyn GameTransport>, 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 GameTransport>>,
world: &mut dyn WorldState,
encoder: &dyn Encoder,
)
pub async fn tick_step( &mut self, transport_lock: &RwLock<Box<dyn GameTransport>>, 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> 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::Request