Replay a bouncing ball across a stalled frame
Feed the same five frame times into a fixed-step ball simulation. One 100 ms stall exceeds the catch-up limit. The replay reports positions and the number of milliseconds discarded.
Download the standalone example
Extract the archive and run kestrel-demo.exe on Windows or ./kestrel-demo on Linux and macOS. Each archive includes the Blyx source and tests.
Build from source
With Blyx 0.2.1, Rust and a host linker installed, run these commands to edit and rebuild the example.
git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-kestrel.git cd blyx-kestrel blyxc native-run project.blyx
Why this framework exists
Rendering at a changing frame rate can change simulation speed. A long pause can also produce a burst of catch-up work. Godot’s physics interpolation guide explains the separate clocks. Kestrel makes the carry, interpolation fraction and discarded time visible to the application. Godot Engine, Introduction to physics interpolation
Install Kestrel in your editor
Extension RahulChaube.blyx-kestrel · 0.1.0
The extension includes a runnable Blyx example, function completions and the framework source. For the modular project, extract the starter, open its folder and run blyxc native-run main.blyx with the native toolchain installed.
Create an empty .blyx file, type blyx-kestrel-demo and accept the completion. Choose Blyx: Run File to run the example.
For an offline installation, choose Extensions: Install from VSIX for Blyx Language first, then for Kestrel.
Download the companion Blyx Language VSIXInstall with Conda
Create an environment containing Kestrel 0.1.0, its Blyx source and a runnable example. Run the second command with Blyx 0.2.1, Rust and a host linker installed.
conda create -y --prefix ./blyx-env --override-channels -c https://rahulchaube1.github.io/blyx-packages blyx-kestrel=0.1.0=0 blyxc native-run ./blyx-env/share/blyx/kestrel/main.blyx
To use this package in your application, copy share/blyx/kestrel/vendor/kestrel from the environment into your project's vendor directory.
Import into a Blyx project
Install Blyx 0.2.1, Rust 1.85 or newer and a host linker. From the directory containing your entry file, clone this tagged release.
git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-kestrel.git vendor/kestrel
Save this as main.blyx beside vendor and run blyxc native-run main.blyx.
use vendor::kestrel::kestrel;
fn main() {
let frame = ke_clock(5.0, 50.0, 10.0, 3);
println!(at(frame, 0));
println!(at(frame, 1));
println!(at(frame, 2));
println!(at(frame, 3));
}Expected output
3 5 20 0.5
API and input requirements
Use whole milliseconds from 0 to 1,000,000,000, a positive step and a remainder smaller than that step. max_steps is 1–1,000,000. The clock returns an empty vector for invalid input. A frame cap discards whole ticks only. The simulation takes frame durations from the caller so a replay needs no wall clock.
| API | Use |
|---|---|
ke_clock(carry, elapsed, step, max_steps) | Return [updates, remainder_ms, discarded_ms, interpolation_fraction]. Feed remainder_ms into the next frame. |
ke_lerp(previous, current, fraction) | Interpolate a render position between the last two simulated positions. |
ke_bounce(position, velocity, dt, low, high) | Advance one object on a bounded 1D track. The result holds position and velocity, including repeated wall crossings. |
Develop and contribute
Open the tagged source to read the implementation and examples. Include the smallest reproducible Blyx program, compiler version and expected result when reporting an issue.
