Skip to main content

Crate mulciber_runtime

Crate mulciber_runtime 

Source
Expand description

Game-loop timing and input snapshots for Mulciber.

The first runtime slice decouples a fixed-rate simulation from variable-rate rendering. It owns the accumulator and bounded catch-up policy while leaving previous/current game state and its interpolation with the application.

The runtime also owns the display-interval frame pacer. Drain the graphics surface’s presentation feedback into Runtime::record_presented every frame and Runtime::begin_frame advances simulation time by whole display intervals of the observed cadence instead of by wall-clock gaps between build starts — wall-clock gaps reintroduce visible judder on a steadily presenting display even with fixed simulation steps. Skipping the feedback drain observably degrades every frame to the wall-clock fallback; check RuntimeFrame::schedule or Runtime::pacing_report rather than assuming pacing engaged.

The canonical loop, with presented instants standing in for a drained Surface::take_present_feedback:

use std::time::Instant;
use mulciber_runtime::{Runtime, RuntimeConfig};

let mut runtime = Runtime::new(RuntimeConfig::fixed_hz(120)?, Instant::now());
// Every frame, before beginning it: drain presentation feedback into the runtime.
runtime.record_presented(Instant::now());
// Then begin the frame; once a cadence is estimated, deltas follow the display.
let frame = runtime.begin_frame(Instant::now());
let plan = frame.plan();
for _ in 0..plan.fixed_steps() {
    // fixed_update(plan.fixed_step());
}
// render(previous, current, plan.interpolation());

Structs§

FramePacer
Derives display-cadence frame deltas from presented-frame feedback.
FramePlan
Work scheduled for one rendered frame.
FrameSchedule
One frame’s pacing decision: how much time the frame advances and how that was derived.
InputSnapshot
Held controls and transitions accumulated for the next simulation-bearing frame.
IntervalSummary
Distribution of the retained recent presented intervals.
PacingDiagnostics
Accumulates presented-frame timestamps into cadence diagnostics.
PacingReport
A point-in-time summary of presentation pacing.
Runtime
Coordinates simulation-latched input, a fixed-rate simulation clock, and presentation pacing.
RuntimeConfig
Configuration for fixed simulation and variable-rate rendering.
RuntimeFrame
One scoped runtime frame containing its timing plan and immutable input snapshot.
ScrollSample
One scroll transition retained in the frame input snapshot.

Enums§

RuntimeConfigError
An invalid runtime timing configuration.