Developers Guide to Knightmare Anti-Cheat Service [Speed Cheating][Fly Cheating][Teleport Cheating][Jump Cheating]

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.
Knightmare_AntiCheat_SpeedCheat1

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. :wink:

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. :melting_face:

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. :face_exhaling:

:tada:
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. :grinning:

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:

1 Like

This tutorial covers configuration and tuning of the Flying 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 flying in your game.

You’ll find the settings for this near the top of the configuration section for Flying Anti-Cheat. To enable the detection, simply change the values to this:

--[[
Set this to false if you want to turn off all Fly Cheat Detection Server Wide
Default = true
--]]
flyCheatDetectionEnabled = 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 Fly Cheat Detection.
This is helpful when trying to fine tune settings for your game through testing.
Default = false
--]]
debugFlyCheatDetection = true

With this enabled, cheat detection for fly 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. This shows what the server thinks the player is standing on, game object wise.
Knightmare_AntiCheat_FlyCheat1

ignoreClimbing
Setting this to true will have the anti-cheat service ignore the player climbing state when monitoring the player.

  • Why would I want to enable this?
    If your game has no places for a player to climb objects via ladders, there is no need for these additional checks on the player. Otherwise, players can attempt to cheat by having their client report that their player is constantly in a climbing state in an attempt to bypass the service monitoring.
  • Why would I want to disable this?
    If your game uses ladders for players to climb, then you want the service to perform some additional checks to make sure the player is actually climbing an object. Otherwise, the player could hack their client to report that their player is in a constant state of climbing while flying around in an attempt to bypass the system monitoring.

ignoreSwimming
Setting this to true will have the anti-cheat service ignore the player swimming state when monitoring the player.

  • Why would I want to enable this?
    If your game has no places for a player to swim via terrain water, there is no need for these additional checks on the player. Otherwise, players can attempt to cheat by having their client report that their player is constantly in a swimming state in an attempt to bypass the service monitoring.
  • Why would I want to disable this?
    If your game uses terrain water for players to swim in, then you want the service to perform some additional checks to make sure the player is actually swimming in a terrain water cell. Otherwise, the player could hack their client to report that their player is in a constant state of swimming while flying around in an attempt to bypass the system monitoring.

maxGroundDistance
The anti-cheat service uses raycasting from the players body (feet or legs) to determine if the player is standing on a collide-able object. The raycast are very short to make sure the player is actually standing on something and not just floating above it.

  • What happens if I decrease the raycast distance?
    Then it will require the player to be closer to the object they are standing on, which can be an issue if the object is slanted at an angle or if your ground has a lot of small gaps or holes that the raycast can miss. This also has an effect on players using models where the feet or legs don’t stand straight up, but point out at odd angles for example. Normally the default works pretty well, but it’s tunable should the developer need to make this distance check more strict.
  • What happens if I increase the raycast distance?
    The player can “float” higher above the ground and not be considering flying or floating. Normally, there is no need to increase this distance for typical player models. The increased raycast distance might be necessary if you are developing a racing game where the player models are always seated in a vehicle which makes them float higher above the ground than normal. This would allow you to apply the anti-cheat service to vehicles and prevent a player from flying around.

maxRadiusToObjectDistance
When the anti-cheat service is unable to find any collide-able objects under the player feet or legs, it falls back on checking for any collide-able objects when the radius of the feet or legs. This way, if a player is standing on a slanted surface, it can determine that the player is not flying or floating. This check is also used during any climbing state checks. If a player reports to be in the climbing state, the anti-cheat service will check for any climbable objects near the feet or legs that the player should be using to climb with. When running debug mode, radius detected objects show up with a circle and raycast objects show up as an arrow pointing down like the screen-shot above.

  • What happens if I decrease the radius distance?
    This will reduce the chance that being on a slanted surface can be detected. It could also affect the climbing state checks if the players hands or feet are not close enough to the ladder object they are suppose to be climbing.
  • What happens if I increase the radius distance?
    This makes being near collide-able objects less strict. This might be necessary for ladders that are so skinny that the players hands and feet don’t even touch it during the climbing animation for example. It might also be necessary if your map contains near vertical surfaces to walk on or platforms so small that the feet don’t touch them.

boostFloatingDistanceScan
When a player is floating, this will boost the scan distance to help find a collide-able object underneath in case they are riding down a falling object at the same rate that the object is falling. Lag can make this appear to float to the anti-cheat service and cause false detection events.

  • Demonstrated via these pictures below:
    Here, my player model is riding down a platform that is falling at the same rate as the gravity set in the map. From my client perspective, my player model appears to be standing on it just fine.
    Anti-cheat update1_compressed
    But, from the server perspective, because of Internet latency, my player appears to be floating on the way down. This can trigger false detection events against the player.
    Anti-cheat update2_compressed
    This is where the scan boost comes into play, it’s a final attempt to determine if the player is standing on the ground or in the air some reason, flying or floating.
  • What if I increase the boost floating distance?
    Then you allow the player float higher than normal while riding down a falling object. This might be necessary if your game contains a lot of falling objects of various shapes and sizes that the player must ride on while falling at the same time. It also helps players that have a high latency in your game.
  • What if I decrease the boost floating distance?
    You make the following distance of the player more strict towards the falling object they are riding on. Depending on how fast your falling objects are moving relative to the players, slower falling objects might not need such a big boost compared to faster falling objects that the player is riding on.

maxMovingFloatTime
If the anti-cheat system is unable to find any collide-able objects under the player, it assumes they are “in the air” and thus are flying/floating. The anti-cheat system then measures how fast the player is falling. If the player is falling fast enough to exceed the “minimumLinearVelocity” set elsewhere, it begins counting time every 0.25 seconds. As long as the player remains in this dual state of not being on the ground and also moving down faster than the minimum set linear velocity, the timer continues counting until it reaches the set limit. When the limit is reached, if the player remains in this dual state, it will start to trigger flying cheat detection events on the player.

  • What happens if the player is not falling fast enough to exceed the minimum linear velocity?
    The anti-cheat service assumes the player is floating in the air and no counting of time takes place. Flying cheat detection events happen immediately on the player, there is no grace period of time.
  • What happens if I increase max moving floating time?
    The player can “fall” longer before flying cheat detection events happen on the player. Developers might need to increase this time if they have very tall objects for the player to fall off. Increasing the time basically increase the grace period for the player to be up in the air without any penalty.
  • What happens if I decrease the max moving floating time?
    The player has a shorter grace period of penalty free falling. This grace time can be shorter for maps where the player does not fall long distances to provide more strict control of your players and how long they can remain up in the air.

iDownDirection
This is the letter axis (X, Y, or Z) that raycast scans are performed relative to the player model. If your game world is using some custom gravity where the Y axis is not up or down, this where you can change that.

minimumLinearVelocity
The minimum linear velocity speed that the player should be falling when no ground is detected underneath them. Anything less and the anti-cheat service assumes they are floating in place instead of falling. This is useful when combating cheating players who change the gravity on their client to fall really slow.

  • What happens if I increase the minimum linear velocity?
    The player will have to be falling faster to make use of the grace period timer set elsewhere under “maxMovingFloatTime”. Developers might need to increase the velocity to match the gravity settings used in their map to avoid false detection events.
  • What happens if I decrease the minimum linear velocity?
    Players can fall slower and still make use of the grace timer. It can also help if players are experiencing slow device issues where the client is not “falling” the player fast enough. It might also be changed if the gravity settings in the map are set very low.

maxFlyCheatDetects
The number of times the flying cheat detection events can happen before acting on the player. When a player is not fly cheating, this number will increment back down to zero. The player is scanned 4 times per second.

  • What if I increase the max fly cheats detected?
    You allow a player to trigger the flying cheat detection more often before the player is acted upon by the server.
    NOTE: Increasing this number can make it easier for cheaters to game your detection limit for being less strict.
  • What if I decrease the max fly cheats detected?
    You make flying 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 flying during certain parts of your game.
  • Why not just set the max fly cheats detected 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 fly cheating.

recordFlyGroundPosition
This records where the player was last standing on a solid object before the next scan determined the player was in the air. This will be used by the soft punishment to send the player back to the last ground position instead of straight down to the solid object underneath when enabled with a true setting. This will also be passed to the custom punishment file if enabled.

  • Why should I enable this?
    You want a player caught fly-cheating to be force teleported to the last place they were recorded standing on the ground. This can be useful for large gaps that a player is not suppose to be about to cross. Instead of being teleported to the ground underneath, they are teleported back to where they left the ground while flying.
  • Why should I disable this?
    You want a player caught fly-cheating to be force teleported to the ground underneath them. You are not concerned about a player crossing a long gap, you just don’t want them flying around your map. Especially if your map is closed off like the inside of a building with tall ceilings. There was no benefit of flying except to remain out of reach of the other players and enemies or to get on top of objects that players were not meant to be on top of.

sendFlyCheaterToGround
Depending on your “recordFlyGroundPosition” settings, a flying cheater will either be forced teleported to the ground underneath them or to the last place they were standing on the ground before they took to the air. Setting this to false will ignore this punishment and you can 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. :melting_face:

Common Questions & Answers:

  • What if I want my Admins or Developers to be immune from any Flying Cheat Checks?
    You simply set an attribute on the player object from the server with the name “KM_IGNORE_PLAYER_FLY_CHEAT” and set the value to true.
  • What if a cheater just pops back up in the air the moment they are forced down?
    Because the flying cheat counter has to count back down while they are on the ground, they will activate the fly cheating punishment immediately. This can cause a rubber-banding effect where the cheater is basically fighting the server the entire time. Depending on how you have the other anti-cheat modules configured, the cheater might end up activating punishments from multiple modules at the same time making the game very unplayable for them. :rofl:
  • Why doesn’t Fly Cheating have Exceptions like the other anti-cheat modules?
    Mainly because no one has really asked. :thinking: It can added to the system, but the nature of fly cheating isn’t usually something developers have to create one-time exceptions for.

:tada:
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 flying cheaters but also prevent good players from being punished by accident. :grinning:

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:

3 Likes

This tutorial covers configuration and tuning of the Teleport 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 teleportation in your game.

You’ll find the settings for this near the middle of the configuration section for Teleport Anti-Cheat. To enable the detection, simply change the values to this:

--[[
Set this to false if you want to turn off all Teleport Cheat Detection Server Wide
Default = true
--]]
teleportCheatDetectionEnabled = 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 Teleport Cheat Detection.
This is helpful when trying to fine tune settings for your game through testing.
Default = false
--]]
debugTeleportCheatDetection = true

With this enabled, cheat detection for teleport 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.
Knightmare_AntiCheat_TeleportCheat1

maxLongRangeTeleport
This is the maximum distance your players should ever be about to move on their own in 0.25 seconds. It does not matter if they move through an open space or through a wall, once this distance limit is reached, it results in immediate punishment to the player.

  • What is the best way to use this configuration setting?
    This serves as a last resort to various forms of teleport cheating. It’s easy for developers to test via the debug window what the normal, highest value that could occur within their own game. It’s basically like where can a player fall the fastest or run the fastest or drive a vehicle the fastest?
    Example: Your game contains a fall that accelerates the player to a terminal velocity of 500 studs per 0.25 seconds. You could safely use a setting like 550 and know that no player can ever move more than 550 studs distance in 0.25 no matter what they do; knowing that no player would normally activate this cheat detection by accident. :wink:

maxShortRangeTeleport
The maximum range that a player can push through a collide-able object without setting off a cheat detection event.

  • Why would I want to have a way for players to push through thin objects without setting off the cheat detection?
    This is really more of a convenience for players and false detection events. If one player walks by another player close enough to graze a body part or accessory sticking out that was collide-able, this can cause a false detection. If a wall was thinner than the developers’ setting, a cheater could teleport right through it without penalty. If all of your walls or doors or any collide-able objects that you don’t want a cheater to pass through are larger than this size, they won’t be about to teleport cheat through it normally. :face_with_raised_eyebrow:
  • When would a cheater be about to exploit this range setting?
    A cheater can exploit this by moving really slow through a wall or door. Slow enough that they are not breaking the limit set by the developer every 0.25 seconds. If you want to slow down cheaters, you can use lower and lower values like 0.5 studs or 0.25 studs if moving through solid objects is more about fairness and less about keeping those cheaters out of rooms or parts of your map that they should not be allowed to enter. A race game or fighting game would put this kind of cheating at a disadvantage if they are a slow/barely moving target while trying to perform the cheat.
  • What if I want to be very strict and make sure it’s impossible to teleport to my restricted areas of the map?
    Simply set this value to 0 and basically anything a raycast can hit will count as a cheat detection followed up by punishment. Keep in mind, depending on your map design, your players might get a false detection when rounding sharp corners while running or small parts of your map stick out that the player might hang on.

ignoreTeleportOtherPlayers
Ignore teleport detection through other players. If your game allows players to walk through each other, it can set off false teleport detection events. Enable this with a true setting and anything on the player model will be ignored when moving through another player.

  • Why would I want to enable this?
    If your game allows players to walk through each other, this can set off false teleport detection events. Enabling this allows any part of a player model to be ignored when players are walking around each other. There is a range limit of double the player models size in the X,Y,Z extents that another player is walking through. This helps to stop cheaters from using other player models to teleport through other solid objects next to them :wink:
  • Why would I want to disable this?
    If your players have to walk around each other as solid obstacles already in your game, this is just an extra check to avoid cheaters using other player models as a means to teleport through other solid objects. This is also useful if your game has some type of race where players have to more around each other rather than walk through or cheat through the other players.

sendTeleportCheaterBack
This will send the Teleporting Cheater Back to their Last Location before the Teleport Cheating threshold was reached. If a player was standing behind a locked door and teleported through it, this would force teleport them back to the previous side of the door. Setting this to false will ignore this punishment and you can 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. :melting_face:

Common Questions & Answers:

  • What if I want my Admins or Developers to be immune from any Teleport Cheat Checks?
    You simply set an attribute on the player object from the server with the name “KM_IGNORE_PLAYER_TELEPORT_CHEAT” and set the value to true.
  • What if I want to give a player a temporary exception to teleport cheat scanning?
    You simply set an attribute on the player object from the server with the name “KM_TELEPORT_TEMPORARY_EXCEPTION” and set the value to true. This will give the player one freebie exception if the player is detected as teleport 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 teleport a player in your game such as player re-spawning, player teleporting to new areas, or even a teleport power for the player, etc.
    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. :face_exhaling:

:tada:
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 teleport cheaters but also prevent good players from being punished by accident. :grinning:

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:

1 Like

This tutorial covers configuration and tuning of the Jump 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 jumping in your game.

You’ll find the settings for this near the middle of the configuration section for Jump Anti-Cheat. To enable the detection, simply change the values to this:

--[[
Set this to false if you want to turn off all Jump Cheat Detection Server Wide
Default = true
--]]
jumpCheatDetectionEnabled = 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 Jump Cheat Detection.
This is helpful when trying to fine tune settings for your game through testing.
Default = false
--]]
debugJumpCheatDetection = true

With this enabled, cheat detection for jump 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. This shows what the server thinks the player is standing on, game object wise.
Knightmare_AntiCheat_JumpCheat1

iJumpDownDirection
This is the letter axis (X, Y, or Z) that raycast scans are performed relative to the player model. If your game world is using some custom gravity where the Y axis is not up or down, this where you can change that.

iJumpMovement
Which way is jump movement? Usually Positive Numbers, but in case you have a different type of game world where players are falling towards the ceiling instead of the ground for example.

maxPlayerJumpPower
This will be the “jump power” limit on the player that when exceeded, the server will act on the player. It will often just mirror what your default jump power setting is for all your players.

  • What if I want to give different players different jump power limits such as power-ups or abilities?
    Each player has an attribute loaded on the player object named “KM_MAX_JUMP_POWER”. This is where your maxPlayerJumpPower is copied to when they enter your game. You can adjust the max jump power of each player individually by changing this on the server. So if you wanted to create a power-up that doubled your player jump power 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 jump power. You have to do that on your own. :wink:

maxJumpGroundDistance
The anti-cheat service uses raycasting from the players body (feet or legs) to determine if the player is standing on a collide-able object. The raycast are very short to make sure the player is actually standing on something. This is how it determines if the player jumped by calculating the distance from where the player was standing to where the player is in the air while performing a jump. This removes dependence on the client telling the server when the player jumped as this could be hacked by cheaters to simply not report jump events.

  • What happens if I decrease the raycast distance?
    Then it will require the player to be closer to the object they are standing on, which can be an issue if the object is slanted at an angle or if your ground has a lot of small gaps or holes that the raycast can miss. This also has an effect on players using models where the feet or legs don’t stand straight up, but point out at odd angles for example. Normally the default works pretty well, but it’s tunable should the developer need to make this distance check more strict.
  • What happens if I increase the raycast distance?
    The player can “float” higher above the ground and still be considered standing on the ground. Normally, there is no need to increase this distance for typical player models. The increased raycast distance might be necessary if you are developing game has the player floating above the ground all the time.
  • Does the Jump Cheat scanning perform Radius scans around the feet similar to the Fly Cheat scanning?
    It does if no ground can be found under the player, those scans use the same distance setting that the raycast system was using via the maxJumpGroundDistance. So both raycasting and radius scanning use the same distance setting.

ignoreJumpClimbing
Setting this to true will have the anti-cheat service ignore the player climbing state when monitoring the player.

  • Why would I want to enable this?
    If your game has no places for a player to climb objects via ladders, there is no need for these additional checks on the player. Otherwise, players can attempt to cheat by having their client report that their player is constantly in a climbing state in an attempt to bypass the service monitoring.
  • Why would I want to disable this?
    If your game uses ladders for players to climb, then you want the service to perform some additional checks to make sure the player is actually climbing an object. Otherwise, the player could hack their client to report that their player is in a constant state of climbing in an attempt to bypass the service monitoring.

ignoreJumpSwimming
Setting this to true will have the anti-cheat service ignore the player swimming state when monitoring the player.

  • Why would I want to enable this?
    If your game has no places for a player to swim via terrain water, there is no need for these additional checks on the player. Otherwise, players can attempt to cheat by having their client report that their player is constantly in a swimming state in an attempt to bypass the service monitoring.
  • Why would I want to disable this?
    If your game uses terrain water for players to swim in, then you want the service to perform some additional checks to make sure the player is actually swimming in a terrain water cell. Otherwise, the player could hack their client to report that their player is in a constant state of swimming in an attempt to bypass the system monitoring.

stopJumpCheater
This will stop the player in mid-air by resetting their Jump velocity back to 0 so they fall back down to the ground. Setting this to false will ignore this punishment and you can 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. :melting_face:

Common Questions & Answers:

  • What if I want my Admins or Developers to be immune from any Jump Cheat Checks?
    You simply set an attribute on the player object from the server with the name “KM_IGNORE_PLAYER_JUMP_CHEAT” and set the value to true.
  • What if I want to give a player a temporary exception to jump cheat scanning?
    You simply set an attribute on the player object from the server with the name “KM_JUMP_TEMPORARY_EXCEPTION” and set the value to true. This will give the player one freebie exception if the player is detected as jump cheating. Afterwards, the anti-cheat service removes this attribute from the player object so it can’t be abused. This can be used for power-ups or abilities granted to the player without having to constantly change the players max jump power used for scanning.
    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. :face_exhaling:
  • What are the limits of this Jump Cheat detection?
    The more powerful the cheating of the player in terms of jump power, the further they are able to travel up in the air before being caught. This is due to the fact that the player is only being scanned 4 times per second. If the player has the jump power of their client hacked to 1000, they will be about to cover a lot of vertical distance in that 0.25 seconds between the scans. To combat this, usually the Teleport Cheat detection will catch this because using jump powers that high are almost like a vertical teleport. :sweat_smile:

:tada:
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 jump cheaters but also prevent good players from being punished by accident. :grinning:

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:

2 Likes