Originally posted by Verrigan
Difficulty Easy 1/5
Many of you are aware of applications out there that cause programs to speed up.. You will find that people using these programs will actually move faster in some online games. In most cases, this causes a server to 'cater' to the faster individuals because they are sending more frequent data, which will effectively lag other players.
I could go into why these types of programs have this kind of effect on application performance, but I would be speculating.. All I know is that when you call GetTickCount or QueryPerformanceCounter functions, they will give you a higher number than the actual value on the system.. So if you do:
If GetTickCount - BeginTick > 500 it could happen in 1/10 of a second instead of 1/2 of a second. (1000 ticks from GetTickCount = 1 Second)
Well.. I have some good news for you guys. :) These applications do not have an effect on the VB Timer() function. :)
What does this mean?
This means you can check for a speed hack application, and abort your client if the user is using one. :)
How? Check your tickcounts against a timer.. First set a variable = to Timer. Then set a variable = to GetTickCount. Here is an example:
Public SpeedHackTestTimer As Long Public SpeedHackTestTickCount As Long
Public Sub SetSpeedHackTestStart() SpeedHackTestTimer = Timer SpeedHackTestTickCount = GetTickCount End Sub
Next, you will need a procedure to check the values against each other.. This isn't perfect, because we're comparing milliseconds against seconds, but it should be fairly close. :) Here is an example:
Public Sub SpeedHackTest() Dim TimerDiff As Long Dim TickDiff As Double Dim TickAndTimerDiff As Double TimerDiff = Timer - SpeedHackTestTimer TickDiff = (GetTickCount - SpeedHackTestTickCount) / 1000 TickAndTimerDiff = TickDiff - TimerDiff If TickAndTimerDiff > 1 Or TickAndTimerDiff < -1 Then 'System is running a speed hacking program. 'We can notify the server, or simply end the application. 'You would need to develop a packet to send to the server 'if you wish to notify the server.. Then keep track of the number 'of times a user uses speed hacking software, and ban if needed. :) GameDestroy End If End Sub
Now, this is not fully conclusive.. If 'they' develop a way to modify the Timer function's return value, you will not be able to use this method to detect speed hacking software. Please feel free to post any bugs/questions/comments/suggestions. :)
|