This tutorial covers configuration and tuning of the Speed Cheating detection module for the service. When setting up the service for your game, the long configuration file can be a little daunting. Here, I will break down each section with explanations and practical examples of how to use it and code samples for usage.
When setting up the anti-cheat service for the first time, it’s best to enable debug mode for testing. This way you can see what the anti-cheat service is observing from the player. This can help you tune how strict you want to control the player speed in your game.
You’ll find the settings for this near the top of the configuration section for Speed Anti-Cheat. To enable the detection, simply change the values to this:
--[[
Set this to false if you want to turn off all Speed Cheat Detection Server Wide
Default = true
--]]
speedCheatDetectionEnabled = true
To enable the in-game Debug Window, simply change the values to this:
--[[
Set this to true if you want the server to output Debug info for Speed Cheat Detection.
This is helpful when trying to fine tune settings for your game through testing.
Default = false
--]]
debugSpeedCheatDetection = true
With this enabled, cheat detection for speed cheating will be enabled server wide for every player and an in-game debug window will display real-time info about the players in your server similar to this below.
maxPlayerSpeed
This is the default maximum speed that all players enter your game with. It will often just mirror what your default walk speed settings are for all your players.
-
What if my players speed is variable or changing such as running?
Usually, an easy setting is just to set the max speed to what the player max run speed should be. For example, if your walk speed was 16 but your run speed is 32, set the max to 32 instead. -
What if I want to give different players different speeds, such as power-ups or abilities?
Each player has an attribute loaded on the player object named “KM_MAX_PLAYER_SPEED”. This is where your maxPlayerSpeed is copied to when they enter your game. You can adjust the max speed of each player individually by changing this on the server. So if you wanted to create a power-up that doubled your player speed but don’t want the anti-cheat to keep punishing the player, this is where you change that. This only changes how the anti-cheat scans your player, it does not actually increase or decrease your player movement speed. You have to do that on your own.
clientPredictionFudge
This is a percentage based margin of error for speed cheat scans. This number is actually recommended by Roblox to account for client prediction of different speed devices and Internet latency during gameplay on public servers.
- Example: You have your max speed set for 16. The actual max player speed the service will scan for is this number; 16 x 0.2 (20%) = 3.2, then add it to your original setting for 16+3.2 = 19.2
- If you decrease this percentage, you make your speed detection more strict, but players on higher latency connections might suffer from repeated false detections.
- If you increase this percentage, you make your speed detection more forgiving, but cheaters might exploit this to increase their speed as close to the limit as possible to get an unfair edge against the other players.
ignoreFreeFalling
Setting this to true will have the anti-cheat service ignore the player free-fall state.
-
Why would I want to enable this?
If your game doesn’t allow the players to jump or walk off very tall objects, this can serve as another way to prevent speed cheating by players abusing the free-fall state. -
Why would I want to disable this?
When a player jumps off the edge of another object, they begin free falling as fast as you have your gravity set. If a player runs off the edge of a very tall object, their falling speed might greatly exceed your “speed limit”, producing false cheat detection events. With this disabled, you have further tuning options to control how long players can free-fall before scans are preformed again to help protect against abuse.
excludeYDimension
Normally speed is checked in 3 dimensions. If you enable this by setting it to true then speed is only calculated in 2 dimensions. Similar to a direct over-head view of your character while running.
-
Why would I want to enable this?
If a player is running up stairs or a steep hill, their calculated speed might exceed your speed limit causing a lot of false detection events. By removing the Y dimension of the speed calculation, you get a speed reading that is strictly based on the player direction on a flat, 2D plane. -
Why would I want to disable this?
If your game does have hills or stairs, but not be long enough to cause enough false detection events to punish a player, you can keep your speed cheat detection more strict.
maxFreeFallTime
When a player is free-falling, the speed cheat scanner ignores the player until they reach the ground or the time is exceeded. If you have “ignoreFreeFalling” enabled, this value is ignored.
-
What if I increase the max free-fall time?
The player can be “falling” longer without creating speed detection events. This can be useful if you have a large obby world where the player is often falling long distances.
NOTE: Increasing the free-fall time can open up the free-fall state to more abuse by cheaters. -
What if I decrease the max free-fall time?
The player can only free-fall for very short amounts of time before the speed cheat scanner resumes monitoring the player speed. For worlds where falling distances are very short, lowering this value can help make your speed limits more strict without punishing good players with false cheat detection events.
maxBunnyHops
When a player is moving and jumping at the same time, it creates very short instances of free-fall time. If you have your service configured to ignore player free-fall time, this can be abused by cheaters to break your speed limit by just hopping all the time. To combat this, the system will monitor for bunny hopping players and players that exceed this limit will be scanned regardless of their free-fall state.
-
What if I increase the max number of bunny hops?
This will allow the players to bunny hop more often before their speed is monitored again. This is useful for developers when they need players to be able to hop around more often without producing false cheat detection events.
NOTE: Increasing this could allow cheaters to abuse the less strict speed monitoring. -
What if I decrease the max number of bunny hops?
If players doing bunny hops is not really necessary in your game, reducing this will make your speed monitoring more strict and less open to exploiting by cheaters.
maxBunnyHopTimeout
If a player exceeds the maximum number of bunny hops, how long do they need to stop hoping before the player is allowed to use the max again. If the “maxBunnyHops” is set to 0, then this value is ignored.
-
What if I increase the timeout?
The player must wait longer for the max values to set on that player again. This is useful if you want to allow the player to bunny hop more, but if they abuse the increase, you want them to wait longer as a penalty. -
What if I decrease the timeout?
The player can resume bunny hopping sooner. This is useful if you have a need for players to bunny hop more, but don’t want to give them more max hops due to cheaters.
maxSpeedCheatDetects
The number of times the speed limit can be broken before acting on the player. When a player is not speed cheating, this number will increment back down to zero. The player is scanned 4 times per second.
-
What if I increase the max speed cheats detected?
You allow a player to create more cheat detection events before the player is acted upon by the server.
NOTE: Increasing this number makes it easier for cheaters to game your detection limit for being less strict. -
What if I decrease the max speed cheats detected?
You make speed cheat detection more strict. Not all cheat detection events are from a cheating player, often they can be produced by Internet latency or slow player devices. False detection events can also be produced by your own game design where a player is suppose to be moving faster than your speed limit. -
Why not just set the max speed cheats to 1 and call it a day?
At the strictest setting, it leaves no room for error. This can often confuse developers because when setting this value to 1 and testing on your own device, everything appears to be fine. That is because you have a latency so low that false detection events are not likely to happen. Developers must keep in mind that public servers are a whole different beast. Players are also using various devices of various speeds across a public Internet with latency that is often fluctuating all the time. This can result in many of your players being unfairly punished for speed cheating.
sendSpeedCheaterBack
This will send the Speed Cheater Back to their Last Location before the Speed Cheating max threshold was reached. Set this to false if you want to implement your own form of punishment. If you want both soft punishment and custom punishment, this is possible by setting this option to “both” using full quotation marks. All custom punishments are stored in the “KnightmareCustomPunishment” script file that comes with the service. How to create your own custom punishments will have to be for another tutorial as it is beyond the scope of this one.
Common Questions & Answers:
-
What if I want to ignore a player getting speed cheat scans, such as an Admin or Developer?
Just like the max speed setting above, you simply set an attribute on the player object from the server with the name “KM_IGNORE_PLAYER_SPEED_CHEAT” and set the value to true. Then this player can move around as fast they want and will be ignored by the anti-cheat service until either this value is removed or set false for example. -
What if I want to give a player a temporary exception to speed cheat scanning?
Just like the max speed setting above, you simply set an attribute on the player object from the server with the name “KM_SPEED_TEMPORARY_EXCEPTION” and set the value to true. This will give the player one freebie exception if the player is detected as speed cheating. Afterwards, the anti-cheat service removes this attribute from the player object so it can’t be abused. This is often useful when you need to rapidly move a player for a cut-scene and don’t want to be fighting the anti-cheat service to do it.
NOTE: This exception remains active until used, so if you set this and it’s possible that it won’t be used, consider removing it later to avoid a case where a cheater could find a way to exploit this.
This concludes the developers guide, hopefully the in-depth exploration and explanation of the settings can help developers tune their own games to be as strict as possible against speed cheaters but also prevent good players from being punished by accident.
Other developer guides to explore the other modules within the anti-cheat service will be written in the future and posted in the tutorial section as well, I just wanted to make sure I focused on each module in detail.
You can find the software for the Knightmare Anti-Cheat Service located here: