Mirage Source

Free ORPG making software.
It is currently Fri Mar 29, 2024 6:38 am

All times are UTC




Post new topic Reply to topic  [ 77 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
PostPosted: Mon Nov 27, 2006 3:19 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
Author: Verrigan
Difficulty: 1/5 (Easy Peasy, Cut and Pastey)

This tutorial is designed to provide you with an alternative to GetTickCount. The reason this tutorial was originally designed was to provide a method to break speed hacks that modify the return value of the GetTickCount API function. It turned out, thanks to Pingu's awesome research, that my method could be broken by changing the local computer's system time. So.. you should still perform checks server-side to ensure that packets are not being sent by the client too fast.

Why should you use this method? It returns the value of the system time in milliseconds.. (Actually, it returns a decimal format with nano seconds after the decimal..) The difference is that this method uses a currency value, which uses 8 bytes, as opposed to the GetTickCount method that returns a long value.

The long value in VB is a signed integer that uses 4 bytes.. Since it is signed, it will sometimes return a negative value.. So.. when your system's tick count reaches 2,147,483,647, it rolls back to -2,147,483,648. This rollover happens about 25 days after your computer was turned on..Then.. about 50 days after that, it will do it again.. With my method, you won't have to worry about rollovers for a very long time. Here's a break-down that I did on December 2nd:

Quote:
Milliseconds Until Roll-Over: 909,527,648,354,217
Seconds Until Roll-Over: 909,527,648,354
Minutes Until Roll-Over: 15,158,794,139
Hours Until Roll-Over: 252,646,568
Days Until Roll-Over: 10,526,940
Years Until Roll-Over: 28,821

I'm thinking that by the time the year 30827 comes along, there will be a better method for checking how many milliseconds have passed over time. ;)

Anyways.. This method will break the current speed hack applications out there.. but it is very easy to develop a program to constantly change the system time, and effectively speed up the return value of this method.. But doing that would have various different effects on other applications..

For example, I started part-time network administrator work at a school in Seattle, and one of the systems would not run the virus scan because the system's virus definitions were out of date.. It had the same definitions as everyone else, and further investigation revealed that the system's time had been set to about a week in the future. :)

Anyways.. you can decide whether or not you want to use this method.. Tests done by Pingu and myself have pushed me to this final version of this method, which performs at or about the same speed as the original GetTickCount API function.

All you need to do is add an API declaration to a public module:
Code:
Public Declare Sub GetSysTimeMS Lib "KERNEL32.DLL" Alias "GetSystemTimeAsFileTime" (ByRef lpSystemTimeAsFileTime As Currency)


To use it, declare a variable as type Currency, and pass the variable ByRef to the procedure. The procedure will change the value of the variable to the current system time in milliseconds (and nano-seconds..). Here is an example:
Code:
Private Sub cmdTest_Click()
  Dim cTimeStart As Currency
  Dim cTimeFinish As Currency
  Dim i As Long

  Call GetSysTimeMS(cTimeStart)

  For i = 1 To 200000000
    Call GetSysTimeMS(cTimeFinish)
  Next

  Call MsgBox("The loop took " & int(cTimeFinish - cTimeStart) / 1000 & " second(s) to complete.")
End Sub


Please post any bugs, comments, gripes, etc.

[Edit]
This tutorial was completely rewritten on December 2nd. Please take that into account.

[Edit]
The following code will demonstrate how to setup a function to use this API call in a similar manner to the way GetTickCount() API currently works.
Code:
Public Function GetTickCountNew() As Currency
  GetSysTimeMS GetTickCountNew
End Function


Now just call GetTickCountNew() instead of GetTickCount(). :)

Thanks, Spodi. :)


Last edited by Verrigan on Thu Mar 08, 2007 7:20 pm, edited 14 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 4:34 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
I suggest removing the speed hack names. I dont see a reason why the names should be posted.

Great tut otherwise :)

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 4:43 pm 
Offline
Knowledgeable
User avatar

Joined: Mon May 29, 2006 11:38 am
Posts: 293
Location: Cambridge, UK
Well people on come here to make a game from a source, im sure they wont speed hack there own game, also i think verrigan posted an anti speed hack tutorial.

_________________
Image
Image


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 5:26 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
William.. The only way to test it for yourself is by knowing the names of some of the speed hack applications out there.. Otherwise you are just taking what I say on faith.. And, though that feels pretty good.. :P I wouldn't want anyone to take what I say just on faith alone. ;)

So yeah... test it out for yourselves.. I really want someone to tell me a program that this doesn't work for.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 5:46 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Okay, just know there are bad guys out there that wants to cheat :P

I'll try this later.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 5:56 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
And if they want to cheat bad enough, they will find these applications..

SpeederXP, Speed Hack, and Cheat Engine all work with unedited Mirage Source and Elysium/Konfuze/PW/etc..

With this tutorial, those applications should be broken.. So why not tell you about them so you can go get them and test it for yourself? :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 6:15 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
You made your point, ill add it :P

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 6:51 pm 
Offline
Pro
User avatar

Joined: Mon May 29, 2006 3:26 pm
Posts: 493
Location: São Paulo, Brasil
Google Talk: blackagesbr@gmail.com
I just added it and it works perfectly fine. I didn't test any hacker tool, but it seams to work ^^ Maybe I'll just need to add a few Int() someplaces, but that's ok for now. Very nice tut!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 7:06 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
Dragoons Master wrote:
Maybe I'll just need to add a few Int() someplaces, but that's ok for now.

You don't want to use Int() because it returns an integer, which is only 2 bytes. My GetTickCount() function returns a Double, which is 8 bytes, so you would (possibly) get an OverFlow error if you try to use Int().

You could, however, modify the GetTickCount() function to return a value without the decimal, but I think it would be faster to leave things as they are.. :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 7:54 pm 
Offline
Pro
User avatar

Joined: Mon May 29, 2006 3:26 pm
Posts: 493
Location: São Paulo, Brasil
Google Talk: blackagesbr@gmail.com
I added int only once becouse I have a lag packets that tells players how much 'lagued' they are... and I dont want it to say 15,876 I want int value, that's all, the Int() is not even acting over GetTickCount but into an other variable.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 8:10 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: johansson_tk@hotmail.com
Dragoons Master wrote:
I added int only once becouse I have a lag packets that tells players how much 'lagued' they are... and I dont want it to say 15,876 I want int value, that's all, the Int() is not even acting over GetTickCount but into an other variable.


weey. Thats a good idea =P To tell them how laggy they are :P

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 3:58 pm 
Offline
Pro
User avatar

Joined: Mon May 29, 2006 3:26 pm
Posts: 493
Location: São Paulo, Brasil
Google Talk: blackagesbr@gmail.com
Hummm, I can post a tut, is a pretty simple code... Maybe I'll post it as the tut for the contest :P


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 5:44 pm 
Offline
Regular

Joined: Mon Jun 12, 2006 10:10 pm
Posts: 68
Verrigan wrote:
Dragoons Master wrote:
Maybe I'll just need to add a few Int() someplaces, but that's ok for now.

You don't want to use Int() because it returns an integer, which is only 2 bytes. My GetTickCount() function returns a Double, which is 8 bytes, so you would (possibly) get an OverFlow error if you try to use Int().

You could, however, modify the GetTickCount() function to return a value without the decimal, but I think it would be faster to leave things as they are.. :)


Sorry Verry, but "Int()" actually returns a Long. You'd expect that it'd return a Integer based on the name, but a Long IS an integer, but it just doesn't have the same name.

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 6:01 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
pingu wrote:
Verrigan wrote:
Dragoons Master wrote:
Maybe I'll just need to add a few Int() someplaces, but that's ok for now.

You don't want to use Int() because it returns an integer, which is only 2 bytes. My GetTickCount() function returns a Double, which is 8 bytes, so you would (possibly) get an OverFlow error if you try to use Int().

You could, however, modify the GetTickCount() function to return a value without the decimal, but I think it would be faster to leave things as they are.. :)


Sorry Verry, but "Int()" actually returns a Long. You'd expect that it'd return a Integer based on the name, but a Long IS an integer, but it just doesn't have the same name.

Actually, we're both wrong.. It returns a variant. :) So, using it with my GetTickCount() would work.. Not sure what the limitations on Int() are, but since it returns a variant, it's using way more memory and probably taking way too long than is necessary. :)

Thanks for letting me know I was wrong, Pingu. I appreciate it.. I, for some reason, confused Int() with CInt().


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 6:57 pm 
Offline
Persistant Poster
User avatar

Joined: Tue May 30, 2006 2:07 am
Posts: 836
Location: Nashville, Tennessee, USA
Google Talk: rs.ruggles@gmail.com
I haven't tested your tutorial, but I did test speederxp to see it's effects on a vanilla MS303. My character zoomed around pretty quickly! I also noticed that the server was saving every 20 seconds rather than 10 minutes xD

I pushed SpeederXP to the limit though, maxed it out. EVERYTHING on my computer stopped responding. I had to restart for the first time in like 3 months x.x

_________________
I'm on Facebook! Google Plus My Youtube Channel My Steam Profile

Image


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 12:25 am 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
Updated tutorial.. Turns out we don't have to use the FILETIME structure at all.. Just pass the memloc of the CurrVal variable to the function, and it does the same thing. :)


Last edited by Verrigan on Thu Nov 30, 2006 1:58 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 3:20 am 
Offline
Pro

Joined: Mon May 29, 2006 2:15 am
Posts: 368
What's with the elysium-based (haha) hostility?

_________________
Image
Image
The quality of a man is not measured by how well he treats the knowledgeable and competent, but rather how he treats those less fortunate than himself.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 3:33 am 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
Pingu didn't want to approve of it as a valid, working tutorial, and suggested that it was not useful (for Elysium).. So I withdrew my offer for its use in Elysium. :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 4:00 am 
Offline
Pro

Joined: Mon May 29, 2006 2:15 am
Posts: 368
Oh okay.

Just out of curiousity, does this have any real advantage over just checking the names of the programs that they're running, and just auto-banning them that way? That's what i was about to start working on, because it would be more effective than simply speed hacks alone...

_________________
Image
Image
The quality of a man is not measured by how well he treats the knowledgeable and competent, but rather how he treats those less fortunate than himself.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 4:09 am 
Offline
Regular

Joined: Mon Jun 12, 2006 10:10 pm
Posts: 68
Verrigan wrote:
Pingu didn't want to approve of it as a valid, working tutorial, and suggested that it was not useful (for Elysium).. So I withdrew my offer for its use in Elysium. :)


Verrigan, I only didn't approve it yet because nobody actually said it stops speed hacks, and not because I have some illogical hatred for you...

Look, my posts have nothing to do with a tutorial's approval or not, they are just me as a user saying something (as opposed to me as an admin). I wrote my own code only because I wanted to try and fix the problems with your code, but it ended up just having more (namely speed issues). This is just the way I am, and I try to be an expert on something I know very little about with a few Google searches and some quick code.


Anyway, as for stopping speed hacks in general, this way would be useful only if the speed of the new function is about the same as the old one. If it's any slower, you could just do Verrigan's other anti-speed hack tutorial that just checks for any speed changes in the tick count compared to a fixed timer. Just looking for the hack's name would not work very well, because a simple name change could bypass it and even then, you'd spend a LONG time getting the names of all the speed hacks...

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 4:24 am 
Offline
Knowledgeable
User avatar

Joined: Mon Jul 24, 2006 2:04 pm
Posts: 339
Why don't you just throw in an elapsed calculate server-side? You'll still be able to do a mild speed-hack, since you have to take into considerate the time it takes the packet to travel to and get processed by the server, but you wont be able to speed hack much. It'd be a good addition to any of the other methods.

_________________
NetGore Free Open Source MMORPG Maker


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 6:24 am 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
Pingu,

You said you didn't see any use for it in Elysium. (Can't quote this, cause my thread on the Elysium forums was deleted on my request)

As for it being slower.. Of course it's slower. It's using 64 bits on a 32 bit system, but my FPS on Kronia is still exactly the same, so it must not be hurting anything too badly. ;)

You were being critical where being critical wasn't warranted.. I clearly stated the slowness of my approach as being a con. That wasn't the issue.. The issue was whether or not it works.. and, the answer to that is yes. You got stuck on the slowness of it, and it's not really all that slow... Apparently you didn't even bother to test it.. So whatever.

[Edit] Okay.. Maybe it wasn't clear to you that a 64-bit variable would be slower than a 32-bit variable.. But that is what I meant when I posted the con. :)

Spodi, you're right, of course.. an EXE on someone's computer could easily be modified to make the speed hacks work.. Server-side checks are still very important.

---

I figured out this method because I know that 99.9% of the 'hackers' that use speed hacking software would be deterred by the simple fact that the speed hack software they were using simply didn't speed them up. :)

[Edit]
Sonire, SpeederXP does do that.. Apparently it modifies the GetTickCount() value for everything.. and then when you shut it off, it reverts to what it was supposed to be.. And since a lot of applications rely on GetTickCount, they are waiting for it to return a specific value, so they appear frozen.. (That was my experience with it..)

I didn't notice this with Speed Gear, which looks like the same program.. but a newer version.. Cheat Engine seems to speed up the GetTickCount value only for specific applications.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 10:26 pm 
Offline
Regular

Joined: Mon Jun 12, 2006 10:10 pm
Posts: 68
Verrigan wrote:
You said you didn't see any use for it in Elysium. (Can't quote this, cause my thread on the Elysium forums was deleted on my request)


There are much better ways of stopping speed hacks, that's all I really said. I wasn't singling out Elysium either, because it'd be the same for Mirage.

Verrigan wrote:
As for it being slower.. Of course it's slower. It's using 64 bits on a 32 bit system, but my FPS on Kronia is still exactly the same, so it must not be hurting anything too badly. ;)


FPS cap that might not be binding in slower machines. Just thought I'd point that out...

Verrigan wrote:
You were being critical where being critical wasn't warranted.. I clearly stated the slowness of my approach as being a con. That wasn't the issue.. The issue was whether or not it works.. and, the answer to that is yes. You got stuck on the slowness of it, and it's not really all that slow... Apparently you didn't even bother to test it.. So whatever.


You PMed me about your tutorial specifically, so I payed more attention to it. Of course I didn't test if it stopped speed hacks because I myself have never used one before (and never will, frankly). I did use your code and tried it out with a sample application to see if the actual tick count thing worked, however. I only made my version because you stated the memory thing as a con and I thought I could fix that. I was just suggesting an alternative that didn't have your cons, but I created my own anyway so there wasn't much point (I'm guessing my way is slower than yours).


What the heck, I'll download a speed hack and try out various methods myself. I'll make a simple program with all of them and even figure out the respective speeds (with the original GetTickCount as the control). You win Verrigan, mainly because I'd hate to not have you participate with Elysium any longer just because I butted into your tutorial.

PS. Your topic is in the hidden recycle bin, I can restore it at your request.


EDIT: Perfect results! I downloaded SpeederXP and make this sample exe to compare GetTickCount, your method, and my method. Before running SpeederXP, all the tick counts were in perfect unison. I maxed out SpeederXP and...

GetTickCount said 514 seconds had elapsed.
Verrigan's method said 10 seconds had elapsed.
Pingu's method said 10 second has elapsed.


My computer is fast and didn't freeze up (still 1% comp usage at max speed). It's obvious that both our method work, but I'll set up a speed test now to see who's is actually faster.

:P

EDIT EDIT:
Contrary to popular belief, speed hacks DO effect the interval of timers in a project. There goes your old tutorial Verrigan...

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 11:08 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
It wasn't that you 'butted' into the tutorial.. :P It was more about how you didn't seem to comprehend the reasoning behind it.. You went off in a direction that I didn't think needed to be addressed, because I had already addressed it as an issue..

I like your attitude, however.. So I'll remove the 'ban' on Elysium using this tutorial.. It's not like I really could have stopped anyone from using it anyway.. (Just being realistic there. :P) If you replace it, I'll edit it.. (Or you can..)

As for the speed of it.. I did some tests, and I think I'm going to see what kind of speeds I get with the GetSystemTime() function, cause I don't think it's doing any calculations.. So we'll see.. The only problem with that one is that it uses 16 bytes.. But.. Like I said, I don't think it's doing as many calculations.. so I'll have a go at it later tonight.

[re: EDIT EDIT]
I tested that one pretty thoroughly.. You used SpeederXP? (That was the only one I could find at the time..) I'll have to check it out later.. I'll test it with all 3.. bleh..


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 11:17 pm 
Offline
Regular

Joined: Mon Jun 12, 2006 10:10 pm
Posts: 68
I've already made a test program and I'll compile an exe quickly.

EDIT:
Here you go: http://www.splamm.com/sigs/GetTickCount.exe

EDIT EDIT:

Well, I managed to find some problems with our methods...

Your method is largely fine, but a potential problem is that the "Calculating..." text occasionally is bumped a few units to the left meaning a zero was missed somewhere and you've got a much lower number than it should be now. However, I currently believe that there is a simple, rational explanation that poses no problem. The number just ends in ".0" sometimes and VB doesn't bother outputting the ".0"...

My problem is a bit more extreme. Run the first test for a minute and you'll see why. It skips 40 seconds at the start of a new minute. The reason is obvious and I'll have to fix it pretty soon. However, this is not a bad error because I'll be ditching all the strings I used before and I'm sure my newer method will actually be faster if I manage to complete it!

_________________
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 77 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group