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§
- Frame
Pacer - Derives display-cadence frame deltas from presented-frame feedback.
- Frame
Plan - Work scheduled for one rendered frame.
- Frame
Schedule - One frame’s pacing decision: how much time the frame advances and how that was derived.
- Input
Snapshot - Held controls and transitions accumulated for the next simulation-bearing frame.
- Interval
Summary - Distribution of the retained recent presented intervals.
- Pacing
Diagnostics - Accumulates presented-frame timestamps into cadence diagnostics.
- Pacing
Report - A point-in-time summary of presentation pacing.
- Runtime
- Coordinates simulation-latched input, a fixed-rate simulation clock, and presentation pacing.
- Runtime
Config - Configuration for fixed simulation and variable-rate rendering.
- Runtime
Frame - One scoped runtime frame containing its timing plan and immutable input snapshot.
- Scroll
Sample - One scroll transition retained in the frame input snapshot.
Enums§
- Runtime
Config Error - An invalid runtime timing configuration.