I created an experimental anticheat system that heavily curtails common movement cheats like speeding, teleporting, noclipping, flying, and ludicrously-fast spinning.
It does this by using a set of “heatsinks”, which quickly gain heat while a player is displaying anomalous behavior, as well as a set of assumptions, such as players only being able to jump a certain height off the ground.
Upon determining a player is cheating, it teleports that player back to where they were last time they were not acting suspicious, and then takes away physics control for a few seconds. This immediately nullifies their cheating attempt.
And best part: It runs entirely on the server, so there’s not much exploiters can do about it aside from pushing the limits!
If you’re lazy like me, you can watch this video.
Will I open-source this? Yes. But it’s my first attempt at an anticheat of its kind. I also discovered a bug that threw me off mid-development, so it’s spaghetti code. You may want to look at the techniques I listed below instead. Perhaps you can come up with a better implementation than mine.
Here’s the demo place. It’s uncopylocked if you want to play with it.
https://www.roblox.com/games/4562741079/FJs-Anticheat-Demo
Note: I’ve given an option to disable the anticheat on yourself in this demo, though you’ll have to wear the name-tag of shame (Anticheat Disabled) while it’s off. lol.
Methods
Anti-speed and Anti-teleport
The anti-cheat uses a Speed Heat value to gauge how fast a player is going while giving some room in case that player is a bit laggy.
Moving horizontally at normal speed does add heat, but it is cooling down fast enough to cover that speed. Moving much faster begins to heat up the gauge, and if it overheats, the player is punished.
Though as long as the player moves at normal speed, it won’t overheat.
Teleporting a distance will overheat it instantly, so it is also blocked.
Being near an object that’s moving at some velocity will increase the tolerance to cover the extra velocity, in case the player gets on top of a conveyor belt for example.
Anti-flight
The anti-cheat determines whether the player is standing on a solid object, and if they’re not, heats up the Flight Heat gauge. The only ways to cool this down are to fall down really fast or land on something solid again.
In addition, it has a hard jump height limit, so if a player somehow gets above that, they are instantly punished.
It makes this ground determination by firing 4 sets of raycasts, each set attempting to cover a different class of shapes and situations.
Raycasting method details
-
Scatter raycasting.
It first fires a raycast straight down, and then it fires four other raycasts to the sides.
This will get a ground the majority of the time, and will often get huge objects like hill-sides.
-
Raycast straight to each nearby object’s center.
This gets somewhat weird shapes like your average ball, as well as small rods.
-
Raycast sideways, then downwards towards each nearby object’s center.
Works well for detecting tiny cubes or really tall blocks, plus it makes detecting trusses and ladders easier.
-
Raycast on each XYZ plane aligned with each object.
This works well for detecting thin rods that are long, no matter which end the player is closest to.
Anti-noclip
A raycast is made each frame between the player’s last position and the position they are at. If it hits a solid object (with some exceptions), it’ll teleport them back and take away physics control.
This is very basic though. Because it has a lot of false-positives around objects that move, I need some better method.
Anti-fling-attack
There’s a script going around where exploiters can spin ludicrously fast and knock other players into oblivion (or the sky). This is detected with HumanoidRootPart.RotVelocity.Magnitude
, which often reaches over 1,000 when the exploit is in use.