Lag compensated raycasting?

One of the issues I’ve had with FilteringEnabled is figuring out what the player is actually shooting at in a reliable manner. I’m not sure what the best solution would be in this case, but it would be awesome if we could do raycasting on the server that predicts what the client was seeing based on their ping and the data that was last sent to them.

3 Likes

I think this shouldn’t be a part of just rays per se, but instead a system that let you get the predicted position of a networked physics object. This way you could take advantage of it in every scenario, instead of just raycasting purposes.

Either way, I believe this is something huge in terms of work, but I also believe that this could help a lot of games improve their “feel” of consistency, such as hit registration and physics simulation.

So big yes.

1 Like

Clarification: This is not an issue with FilteringEnabled – your problem is doing ray hit detection on the server. The reason it seemed to magically work without FE is because typically it was done clientside through a tool’s local script.

Even with filtering turned on, you should still be doing ray hit detection on the client, with added sanity checks on the server. I recommend watching this GDC presentation on netcode the developers of Overwatch did:

12 Likes

I get that.
What I’m more concerned about is how much I can trust clients not to hack in an aimbot.

The way the Source engine handles this is interesting.

They effectively rewind time based on the user’s ping to make a reasonable estimate of what the client is currently seeing based on the ping and character interpolation, and they do hull traces using that. This picture is a bit exaggerated, but it goes to show how they can make the experience for players smooth even with a bad network connection.

That’s the premise of what I’m interested in seeing. It would be a method of raycasting that takes an estimated consideration into what the player is probably seeing at the given moment, without having to worry about the user trying to hack an aimbot in.

4 Likes

Some shooters are able to roll back time and make casts on the server. This does not bode well with dynamic engines, with potentially hundreds of moving objects. It’s really not necessary though, because you can set up sanity checks, where the server checks to make sure that the events and data sent by the client are not absurd.

9 Likes

I don’t think fixing aimbot is as easy as doing things on the server. Tons of AAA titles have issues with aimbotting such as overwatch.

Also, storing rollback information would mean storing an insane amount of data since you’d need rollback history for every client. It would be a better idea to do this yourself and store only history for a few bricks per client, rather than the entire game.

1 Like

I do 2 things:

  1. Create a Ray client & serverside
  2. invoke server upon hitting a player
  3. use Ray:ClosestPoint() serverside to compare hit to ray
  4. If close enough, damage
17 Likes

In the case where the client raycast hits a moving character, the server cast will miss. The moving target character will not be in the same place on the server and client.

2 Likes

FYI that’s not what he wrote, he’s just saying that you can find the distance (error) between the hit position and shooting look-vector that the client submits, and then check if that is below a certain threshold. (You were probably confused because he mentioned “Ray” and “serverside” in the same sentence, but he didn’t say raycasting)

It’s not a very strong check, though, because you can easily construct a look-vector such that the hit position is valid. (But you can still do a raycast on the server just to find out if static scenery is blocking the ray with that info.)

5 Likes

Ahyes. I did misinterpret what VR_Service was saying. That would be a good sanity check, along with other sanity checks aswell.

1 Like

Interesting.

:wink:
It’s very effective and I haven’t seen anyone fooling around with the system I have yet - generally every exploiter in my game uses pre-made teleport & kill exploits that revolve around ROBLOX issues (which are thankfully being patched) over issues in RF/RM Security.

1 Like

And yeah - I do a sanity check to ensure that the origin is within 7 studs of the character - if not, Kick (either they’re a hacker or a really laggy person - both of who I don’t want on my game!)

what if they just lag spike once in a 10 minute round

1 Like

kick with the message “You have lost connection” and let them assume it came from Roblox

#Finding new ways to be evil everyday

(joking)

10 Likes