as far as I know you cannot really account for the roblox buffer that they add for interpolation unfortunately, as no one knows exactly how it works.
However someone could just replicate positions via remote events to the servers and it would still work, even better if anyone has any custom character controllers that rely on the custom replication behavior they could easily fork your resource to get server sided hitboxes
Using GetServerTimeNow() only accounts for a players one way trip latency, the interpolation buffer is separate from the players latency and is applied between position packets, the best estimate which I’ve come across for this buffer is a range from 80-100 ms.
Removed the discard phase, it had cases where a ray would intersect but be discarded, it has also become obsolete following the recent release of native Luau code generation which has given the system a substantial performance improvement overall (Please release native vector SIMD support soon )
Fixed an edge case in the OBB intersection test which would skip an axis if one or more of the size axes were the same (Thanks zeuxcg for pointing it out)
Switched to dynamic frame time allocation. It tracks how much time was spent between PreSimulation and PostSimulation to dynamically determine how much frame time is left in the current frame, currently the simulation is allowed to run for half of the remaining frame time.
Note: I have also included a section on performance in the post.
Is your system tailored to hit detection on players or will the OnImpact callback fire with any part? I have NPCs and destructible objects that I can be hit by projectiles.
Modifiers now take a BindableEvent for each event you want to override instead of overriding every event
Added definitions folder to the settings module which allows you to specify an alternative directory to load projectile definitions from
Added interpolation handling to the documentation (Make sure to read this as it is key to proper lag compensation) (Getting Started->Simulation->Setting up your server)
With this version I finally have this module in a pretty good place feature wise, I don’t expect to add much more other than a GetPosition() method for projectiles, I will continue to maintain it and fix any bugs as they arise but updates will come at a much more reduced rate.
this looks nice but, other than the features you already talked about, what are the benifits over fastcast?
fastcast is performant and reliable and combined with PartCache makes it better. i looked through the api documentation and saw some things missing that are pretty important to me for customization of the bullet
is there a way to detect when it hits a wall and do a penetration test like fastcast’s CanRayPierce?
am i able to change the look of the bullet, create my own update function for how the bullet moves like fastcast’s OnRayUpdate?
(i could have missed these things in the api, if they were there)
I also want to use this to control NPC interactions (NPCs shooting at players and players shooting at NPCs) I looked through the API and did not figure anything out… Can you share what you found or point me in the right direction?
Hey Axen! Great module. I have something very similar but will be planning to this if more reliable than my current solution. Currently mine is about 90% accurate with moving and jumping players (that’s with a pretty big hitbox, using slow moving projectiles).
One question:
How does this module fare with jumping players?
From reading the source code you:
Get the next frame based on the client tick/timestamp
Get the current frame based on the client tick/timestamp
Get a float value probably doing something like math.ceil(timestamp) - timestamp
Use that to lerp for a more precise position
I’ve done this exact solution before but the hitboxes differ from the client by about 0.5~~ studs while jumping, this is including compensation for the built-in replication buffer that Roblox uses.
From my own testing that buffer is about 9/60s (0.15s) - I use 60 as thats the maximum number of ticks/s that servers can output. If your solution actually doesn’t have the issues I’ve laid out, I’d really appreciate having a chat about this!
Also a suggestion: try implementing a circular queue instead of using table.insert() and table.remove(). Will probably squeeze a bit more performance out of your code.