3
\$\begingroup\$

I have a client side speed hack detection that initiates a timer on both the client and server on connection. When the difference becomes too much the client gets detected as using speed hack.

But I have one problem, they found a way to run a speed hack program and close it but keeping the speed hack activated on the game client (odd) which made the counter on the client run normally even with speed hack enabled.

So I added detection to the server by using the movement packets and checking the time difference between 2 different movement packets come in. The design was okay, it did detect the speed hack by checking that the difference is not less than 50ms but when someone was lagging (queued movement packets) it also detected it as speed hack.

So I improved this by considering a factor of how fast it would process each packet that arrived in bulk which means microseconds. Now I adjusted the detection to less than 50ms but greater than 1ms. This was better it didn't detect lagging too much but it still did.

Now my problem is how can I implement this in a way that I can still check how fast the packets are coming in but not detect the people that are experiencing lag falsely. Or should I just keep adjusting the parameters for detection until I get to the sweet spot?

\$\endgroup\$
1
\$\begingroup\$

With a proper netcode design, speedhack detection shouldn't be necessary in the first place, because the server only receives requests to perform a given action, calculates all game mechanics itself and then sends the clients a response whether or not they can do that right now. The client sends a "I start moving into direction X:Y" message and the server then calculates the movement and keeps the clients updated about the progress until the client sends a "I stop moving" message.

But when you still want to go for a netcode design where the client can do whatever it wants to do without supervision (bad idea, because it allows a lot more ways to cheat), you could try to detect speedhacking by taking the average of many measurements over a longer timeframe.

You could take a measurement of how far their position changed each second, and then calculate the average movement speed over several seconds. When the player is supposed to have a movement speed of 5 m/s and after 5 seconds they have traveled over 100m, they are obviously speedhacking more than could be explained with lag...

...or are using some legitimate game mechanic which allows them to travel faster than usual (teleporters, jump pads, vehicles, rocket jumping etc.) - when you have something like this, remember to account for it by adjusting or ignoring any speed measurements which were made while the player-character was affected by one of these features.

\$\endgroup\$
  • \$\begingroup\$ For the first part: This would be a really huge rewrite of the code which isn't possible at the moment. Thanks though :) \$\endgroup\$ – majidarif Mar 20 '15 at 13:53
  • \$\begingroup\$ One question though, when lagging the packets accumulate then gets sent to the server it will make it look like they travelled a huge distance in just a few microsecs because the packets got sent in bulk. right? \$\endgroup\$ – majidarif Mar 22 '15 at 8:28
  • \$\begingroup\$ @majidarif You could avoid that by time-stamping each message. \$\endgroup\$ – Philipp Mar 22 '15 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.