Lag Compensated Gun System with Server Authority

From a quick search, I saw nobody has decided to make this yet so I’ve gone ahead and made a quick demo.

For those with access to Server Authority, the uncopylocked game can be found here

As the title implies, this uses the new API provided by Server Authority to provide accurate shooting while also eliminating most aimbot cheats you see in front page games such as Arsenal (silent aim (depends), shooting through walls, etc)

Green Part: Server HumanoidRootPart
Yellow Tracer: Server Simulated
Smaller Yellow Part: Client HumanoidRootPart
Red Tracer: Client Simulated

Lag Compensation Showcase: 1000ms Roundtrip with 49 WalkSpeed
Gray: Client
Yellow: Server

13 Likes

Did you happen to use JECS with Typescript and React plus Rojo? If not, don’t bother sharing – too optimized for our divine intellects.

8 Likes

are you just throwing buzzwords around what does react have to do with this

12 Likes

(post deleted by author)

As a scripter who’s scripted with server authority & lag compensation raycasting, I’d say this is pretty cool!

Only issue is that when I was scripting it - there’s an issue where you can’t actually get the accurate ping from the player - how did you work around this?

How exactly does the lag compensation work? Mine rewinds everyone’s positions back based on the client ping(local tick) but its not incredibly accurate unfortunately

1 Like

The lag compensation part is sort of a lie as I haven’t gotten around to implementing rollback for other players :sweat_smile:

For the shooter I simply create snapshots of their HumanoidRootPart’s CFrame when AuroraService.FixedRateTick is fired

Ah no worries, makes sense :stuck_out_tongue:

limit aaaaaaaaaaa

I’ve been working on the actual lag compensation part for a bit, I’d say it’s almost ready

Tested with 1600ms roundtrip latency (0.8 incoming replication lag)
Gray: Client
Blue/Purple: Server

Edit: got it pretty consistent …if you don’t increase the WalkSpeed, it gets pretty wonky if you do but with the limited API there’s not much I can do

Gray: Client
Blue: Server

With WalkSpeed set to 50:

1 Like

How do you reliably get the ping though?

Try increasing replication lag

Client sends the difference of remote step id and client step id, this is then subtracted from Tick

-- Client
local ClientWorldStep = AuroraService:GetWorldStepId()
local ServerWorldStep = AuroraService:GetRemoteWorldStepId()
local Latency = (ClientWorldStep - ServerWorldStep) / 4

local Tick = RunService.FrameNumber

-- Server
VisualizeEnemy(Player, (QueuedShot.Tick - QueuedShot.Latency) - 1, Color3.fromRGB(255, 183, 1))

I also added interpolation if the gun wasn’t shot at the beginning of a frame. You can see it here
Gray = Client, Yellow = Server

1 Like

1000ms roundtrip latency with 49 WalkSpeed :grin:

Hello Daily3014TheGod,

Can you make this open source so we can help test it and check it out? Perhaps via an editable game? I have been looking forward to checking out a shooter system using Roblox’s new server shizzle.

Thanks a bunch

I’ll look into making the game uncopylocked once I’m happy with the lag compensation system

After fiddling around with the lag compensation for a bit, I think it’s good enough for me to release it.

The game is uncopylocked and I added a few comments to explain stuff

2 Likes

I’ve never seen AuroraService, by the looks of it it’s deprecated?

this is interesting!

new service that comes with server authority

1 Like

It’s an internal service that is going to be restricted again soon, which is why I am trying to find alternatives

2 Likes

excellent, thanks I am going to check it out!

Edit, I checked it out.

can you add so it does damage to health when you shoot and hit a player (or dummy)

thanks

Hello, quick update! I implemented a very WIP very POC hit registration system which can be seen here:

There are some problems with the lag compensation and stuff since I’m using an internal service after all, I have plans to rework it once again to stop relying as much on them

The place is updated for those who want to see what has changed

1 Like

what is POC? Player on crash , play ouch control ?