Smooth mob interpolation with jump-style steps and predictable bandwidth knobs#131
Smooth mob interpolation with jump-style steps and predictable bandwidth knobs#131
Conversation
Adds packed coordinate encoding for mob positions and movement deltas, and introduces a multi-step interpolation system for mob movement. Mob positions are now updated smoothly between ticks, improving client-side rendering and reducing visual stutter. Related functions and usage are updated across main logic and procedures.
Implements interpolation for mob vertical movement and yaw, improving smoothness of mob movement and orientation updates. Refactors mob yaw calculation and exposes pending vertical delta and yaw via new API functions. Increases interpolation steps for finer movement and adds fallback logic for panic movement.
Introduced mobClearHorizontalDelta to reset mob x and z deltas. Updated processMobInterpolation to call this function and reset mob_interp_yaw when interpolation completes, ensuring proper mob state after movement.
Introduces mobVerticalProfile for improved vertical movement interpolation and exposes getMobInterpolationPhase and sampleMobVerticalPosition APIs. Updates mob interpolation logic in main.c and procedures.c to use the new sampling function for more accurate mob Y position calculation.
|
I'm not really a fan of how this is implemented. I touched on a much simpler opt-in interpolation approach in #78, and I'll probably be doing that one myself at some point. Primarily, I want any change that measurably impacts memory usage or bandwidth to be opt-in. This has way too many direct changes to mob behavior for that (including some that seem outside the scope of this feature). |
|
I also don't think you need 11 new global functions for interpolated movement. |
Readded mob interpolation logic and replaced it with an optional midpoint interpolation system, controlled by ENABLE_OPTIN_MOB_INTERPOLATION. Updated mob movement broadcasting to simplify position and yaw calculation, and cleaned up related code in main.c, globals.h, procedures.h, and procedures.c. This improves code clarity and allows for more efficient mob movement updates, especially on constrained targets.
But we do need 11 global functions...just kidding a lot can be cleaned up as my implementation is very rough. I looked at what you said in #78. Obviously the interpolation idea is pretty hard to get to a decent state without large memory requirements. My idea was to capture a mobs start/end position for every tick, stash that in a tiny opt-in buffer, and feed a midpoint "teleportation" before each tick. This is so we don't have to mess with the existing integer pathing. If I am wrong, if you have any thoughts that you want to add, or if you have any specification requirements for this feature I am open to discussion. I understand you said you wanted to implement this in the future yourself, but if you don't mind I would like to try to get this working. |
Video:
20.09.2025_01.17.49_REC.mp4
This is a completely unneeded cosmetic change and I understand if it's too heavy for the purposes of this project. Also I saw in another PR that you wanted issues created before PRs that is completely my bad I missed that in the readme.
Summary
Goal: mimic Minecraft’s block-step feel with minimal RAM/CPU so an ESP32-hosted server stays responsive.
Memory impact
Bandwidth impact
Config / tuning