Kestrel bird logo # Blyx Kestrel Run a bounded number of simulation ticks per rendered frame, carry fractional frame time and interpolate a moving object between updates. 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](https://docs.godotengine.org/en/stable/tutorials/physics/interpolation/physics_interpolation_introduction.html) ## Install and run Install the Blyx 0.2.1 compiler and a Rust toolchain with a host linker. Clone the versioned release, then run its small example and regression suite. ```sh cargo install --locked --version 0.2.1 blyxc git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-kestrel.git cd blyx-kestrel blyxc native-run example.blyx blyxc native-run tests.blyx ``` Expected output from the small example ```text 3 5 20 0.5 ``` ## 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. ```sh blyxc native-run project.blyx ``` Project output ```text frame 0 x=2 frame 1 x=4.2 frame 2 x=5.1 frame 3 x=7.9 frame 4 x=6.4 dropped ms=70 ``` [Run the portable example in the browser](https://www.blyx-lang.space/play?example=package-kestrel) · [Follow the handbook exercise](https://doc.blyx-lang.space/guide/kestrel) · [Download the release](https://github.com/Rahulchaube1/blyx-kestrel/releases/tag/v0.1.0) ## Use the framework in your own project From the folder containing your entry file, clone the release into `vendor/kestrel`. ```sh git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-kestrel.git vendor/kestrel ``` ```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)); } ``` Run `blyxc native-run main.blyx`. 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 | Behavior | | --- | --- | | `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. | ## Contribute When opening an issue, include the smallest reproducing Blyx input, the compiler version and the output you expected. [Source and issues](https://github.com/Rahulchaube1/blyx-kestrel/issues) · [Blyx community](https://www.blyx-lang.space/community) Dual-licensed under [MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE). ## Connect with Rahul Chaube [Portfolio](https://www.rahulchaube1.com/) · [GitHub](https://github.com/Rahulchaube1) · [LinkedIn](https://www.linkedin.com/in/rahulchaube1) · [Hugging Face](https://huggingface.co/oncody) · [X](https://x.com/RahulChaube_) · [EverestQ](https://www.everestqai.com/) · [Contact](https://www.rahulchaube1.com/contact) [Blyx website](https://www.blyx-lang.space/) · [BlyxTorch](https://www.blyx-lang.space/packages/blyxtorch) · [Handbook](https://doc.blyx-lang.space/) · [Community](https://www.blyx-lang.space/community) Support Rahul’s open-source work through [GitHub Sponsors](https://github.com/sponsors/Rahulchaube1) or [Buy Me a Coffee](https://buymeacoffee.com/rahulchaube).