SecureCast, server-authoritative projectiles with lag compensation, multi-threading and more!

Version 1.0.0

  • Improved types
  • Re-structured the documentation
  • Added setup guide to the documentation page
  • 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.

8 Likes

Why use this over fastcast? Does it have more features or something?

Read the post. He explained everything

1 Like

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?

Thanks

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:

  1. Get the next frame based on the client tick/timestamp
  2. Get the current frame based on the client tick/timestamp
  3. Get a float value probably doing something like math.ceil(timestamp) - timestamp
  4. 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.

Can add some example code in the documentation pls.

There is example code in the documentation
Getting Started → Simulation
You can also find example code on the GitHub repository

1 Like

Not really what i meant. I mean like a real “world?” example such as filling out all the parameters and vars.

please change the name convention to anything other than kebab case, it breaks imports

image

Any plans to support Shapecasts with this?

yeah i need shapecasts for larger projectiles, especially when fastcast isnt being maintained anymore

The intersection function isn’t working at all for me.

1 Like

Is there anyway to do stuff like rockets/grenades onto it?

Yes, for grenades set a projectile’s Angle to 360 and for rockets you can use the example bullet projectile with reduced velocity. The explosion will have to be handled by you as that is out of scope for the module, but you can still take advantage of the lag compensation using the Snapshots API.

3 Likes

Ogh I noticed that you can do it with OnImpact statement, so I used it when it’s not client to do some damage activiation. Enjoy this as a pure dopamine of explosives.

(Fixed some things up like lag compensation after the video).

3 Likes

Hi, love the idea of this module - making lag compensation with snapshots is so unbelievably difficult so I’m really hoping to get this working!

Player Hit Detection doesn’t work, even if I use the most stripped down example version you provided.

As you can see, the client registers the OnImpact event, but the server doesn’t fire the OnIntersection which I’m pretty sure would be the section handling player collision?
Infact, the TraverseVoxelGrid function isn’t returning any Player objects at all.

I’m using every default setting. The characters are on seperate teams and within a Characters folder. My only conclusion is that the voxels section isn’t working properly, but I’m confused why nobody else is having any issues so it’s probably something I’ve done haha.

Am I missing something?
Thanks.

Hello! Looks like you’re using R6, you will have to modify the Parts and PartSizes arrays in the Settings module to correctly account for this. Here’s what they should look like:

Parts = {
    "Head",
    "Torso",
    "Left Arm",
    "Right Arm",
    "Left Leg",
    "Right Leg"
},
PartsSizes = {
    Vector3.new(1.161, 1.181, 1.161) / 2, -- Head
    Vector3.new(2, 2, 1) / 2, -- Torso
    Vector3.new(1, 2, 1) / 2, -- Left Arm
    Vector3.new(1, 2, 1) / 2, -- Right Arm
    Vector3.new(1, 2, 1) / 2, -- Left Leg
    Vector3.new(1, 2, 1) / 2 -- Right Leg
},
3 Likes

Brilliant, that works - thanks for the quick reply!

1 Like

Does this support shapecasts? I’m planning to make a boomerang and these are flat cylinders. Need to take into account the shape.