Mirage Source

Free ORPG making software.
It is currently Sat Apr 27, 2024 9:27 pm

All times are UTC




Post new topic Reply to topic  [ 77 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject:
PostPosted: Wed Nov 29, 2006 11:48 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
Can you recompile with a GetTickCount() method at the bottom? :) I'd like to compare all three.. and I don't have VB at work. (Just VBA, which isn't gonna be the same..)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 30, 2006 12:15 am 
Offline
Regular

Joined: Mon Jun 12, 2006 10:10 pm
Posts: 68
Verrigan wrote:
Can you recompile with a GetTickCount() method at the bottom? :) I'd like to compare all three.. and I don't have VB at work. (Just VBA, which isn't gonna be the same..)


I completely forgot that it'd be a good idea to compare with GetTickCount...

And if you don't notice, I had to remove my method for you because I was still fixing it. This would be a great place to ask why the hell I'm getting overflow errors:
Code:
GetTickCountMethod = (SysTime.wDayOfWeek * 86400000) + (SysTime.wHour * 3600000) + (SysTime.wMinute * 60000) + (SysTime.wSecond * 1000) + SysTime.wMilliseconds - 2147483647


Don't let the big numbers fool you, this number really does fit in the ranges of a long. I keep getting an "Overflow" error at seemingly random times. I've debugged a bit and have determined that I get that overflow error if the milliseconds equals "0" (there is a 1 in a thousand chance of that, and it'll occur with enough calls). I really can't see why the hell I'd get an overflow if I tried adding zero to the number...

If I can fix the above error, then I'll have a method that competes with yours speed wise...

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 30, 2006 1:41 am 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
Wow.. My method was only like 1 second longer.. I thought it might have been way slower than that.. (I was thinking it would take 6-10 times as long.)

Can't wait to see yours working.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 30, 2006 2:38 am 
Offline
Regular

Joined: Mon Jun 12, 2006 10:10 pm
Posts: 68
The stupid thing likes to work every once in a while. I run the thing and I get overflow at the weirdest locations now. I split that one big line into multiple lines (slowing it down, but it might work more consistently...) but I'm getting overflow every once in a while and now it's telling me that "22 * 1000 = overflow". I really don't understand why it's giving me these errors, but it's weird.

I managed to run it a few times without the error and the speed results aren't good enough for me to continue.

GetTick - 3.7
Verrigan's - 4.1
Mine - 5.0


Oh and Verrigan, it seems awfully forced when you say "Can't wait to see yours working".


EDIT:
I just had another idea. Why don't we just make our own TickCount like Microsoft does? Make a timer that just increases a variable every certain amount of time.

EDIT EDIT:
I've made a basic version of that idea, but it's not going so great. The interval is set to "100" and even then it doesn't keep an accurate second (it's a bit slower). I ran a speed test though and it's 3.7 for my method and 3.9 for Microsoft's, but that speed increase isn't really worth it.

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 01, 2006 6:49 am 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
pingu wrote:
Oh and Verrigan, it seems awfully forced when you say "Can't wait to see yours working".

It wasn't forced.. I was being sincere.

Also... Just updated the tutorial to be slightly faster.. And I provided a test application similar to yours. (I think..) to show the differences with the changes.

[Edit]
I decided to further my studies with this matter, and I have come up with the following:
Code:
Public Declare Sub GetTickCount Lib "KERNEL32.DLL" Alias "GetSystemTimeAsFileTime" (ByRef lpSystemTimeAsFileTime As Currency)

Call it as such:
Code:
Dim MyTick As Currency

Call GetTickCount(MyTick)


You could set the ByRef variable type to Any, and use a Double.. but it returns an exponential value, and screws up.. But anyways.. Doubles/Currency use the same amount of RAM. :) Anyways...

So.. On to my point for this post.. This method tested as being faster than the previous methods.. And is comparable to the regular GetTickCount() API function.. Most of my tests showed that this new method was 2-10% faster than the normal GetTickCount() function.

I updated my speed test program.. I disabled the Double section, cause it was goofing up.. But you'll see the results.. Anyways.. Download the new test program from http://www.verrigan.net/downloads/GetTickCountTestNew.exe.

[Edit]
If you use the test program, make sure you do more than 1000000 (default) loops, cause 1 million loops seems to be fairly close between the two.. 10 million+ loops shows the 2-10% difference.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 01, 2006 7:06 pm 
Offline
Regular

Joined: Mon Jun 12, 2006 10:10 pm
Posts: 68
1,000,000,000 loops:

GetTickCount: 17.453
Verrigan: 17.984

Honestly, there isn't too much difference between both methods but that Verrigan's way is no influenced by speed hacks.

However, an overlooked issue that I just realized is that Verrigan's way will cause a some problems if you change your computer time. however, this would be a minor pause/jump depending on a total change.

Actually, I just thought up another problem. It's all too possible to write a simple VB program that speeds up the computer clock. Sure, this method is speed hack proof, but not speed hacker proof ("speed hack" = downloadable program and "speed hacker" = the guy who wants to hack and can program a bit).

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 02, 2006 6:47 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
Good points, Pingu. I should have thought of that... Time to go back to the drawing board.. or maybe figure out a way to combine the two... Hmm.

Thanks, Pingu! :)

[Edit]
Tutorial completely rewritten to reflect all changes and ideas. Feel free to post if I missed anything. :)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 02, 2006 10:16 pm 
Offline
Knowledgeable

Joined: Fri Aug 25, 2006 6:40 pm
Posts: 132
umm there are edited version of speedxp that not even runescape can stop there made to reright the main hack attempt profile then they use it to shut servers down like overloadign it to where runescape cant use it for a while that its so bad. they banned a few peopel for doing that.

_________________
http://spirea.flphost.com come and join today i got flash games lol.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 03, 2006 5:16 am 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
lordgivemick wrote:
they banned a few peopel for doing that.


Sometimes that is the only way.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 04, 2007 2:23 am 
Offline
Regular
User avatar

Joined: Sun Aug 27, 2006 5:36 pm
Posts: 53
ahrg, where is the old "Difficulty: 1/5 (Easy Peasy, Cut and Pastey)" Tutorial?
i dont really get the point what i have to do with this function .___."

also, this shall be in security tutorials


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 12:55 am 
Offline
Knowledgeable
User avatar

Joined: Mon Jul 24, 2006 2:04 pm
Posts: 339
I checked this out the first time you posted it and it came with that big conversion overhead - cool to see that you got rid of that!

Great post, Verrigan!

Edit: Not sure if someone has posted this, but if you want to use the format of the function returning instead of passing a variable ByRef, you can create a wrapper like so:

Code:
Public Function CurrentTime() As Currency

    GetSysTimeMS CurrentTime

End Function


Its the same speed just about if you are creating a variable just to hold receive the time value. I personally use most every counter in the format of X = Time + Y, so I find this priceless. :wink:

_________________
NetGore Free Open Source MMORPG Maker


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 4:40 am 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
one wrote:
ahrg, where is the old "Difficulty: 1/5 (Easy Peasy, Cut and Pastey)" Tutorial?
i dont really get the point what i have to do with this function .___."

also, this shall be in security tutorials


All you have to do is copy/paste the declaration, and then use it as shown in the example code... Pretty simple.

--

Thanks for the nice addition, Spodi!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 06, 2007 11:31 pm 
Offline
Pro
User avatar

Joined: Wed Sep 20, 2006 1:06 pm
Posts: 368
Location: UK
Google Talk: steve.bluez@googlemail.com
The first post of this thread is up to date isn't it? And I think what one means is, where do you put the second part of the tutorial? It would be much easier for newer users if you actually showed an example using the MS source itself, atleast then they'd get a good idea on how to use it properly.

Thanks though.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 08, 2007 7:21 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
The first post is up to date, and I added Spodi's idea to the post to show users how they can use this in a similar fashion to the current GetTickCount() API. Please note, doing it this way will slow down the process (by microseconds).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 08, 2007 7:35 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
So changing a computer clock and school will mess stuff up?

Image

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 08, 2007 10:12 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
It depends on what applications are running on the PC that depend on the date/time. ;)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 09, 2007 3:23 am 
Offline
Pro
User avatar

Joined: Wed Sep 20, 2006 1:06 pm
Posts: 368
Location: UK
Google Talk: steve.bluez@googlemail.com
So after adding the API declaration I can just replace all call gettickcount with the one you posted in the edit?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 09, 2007 6:38 am 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
You will first need to change all your gettickcount variables from Longs to Currency.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 09, 2007 6:48 am 
Offline
Pro
User avatar

Joined: Wed Sep 20, 2006 1:06 pm
Posts: 368
Location: UK
Google Talk: steve.bluez@googlemail.com
Thank you Verrigan, you've been most helpful.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 03, 2007 8:10 pm 
This is a must add, for everyone.

I was having that issue where I couldn't attack and non admin characters get booted for packet flooding. If you convert to this, you won't have that issue anymore.

I strongly suggest you convert to this. It was so simple to do.


Top
  
 
 Post subject:
PostPosted: Tue Apr 03, 2007 8:13 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
Some of you may know about the bug where if the system a mirage server is running on is up long enough, your game will go hay-wire, and start kicking people for packet flooding.. Not to mention, it won't let you attack.

I had a hunch that doing this tutorial would fix this problem as well, but it was just confirmed by Advocate. The server his game is running on had reached the rollover.. (No telling how many times it needs to roll over... but anyway..) and his toons couldn't attack, and when he logged into a non-admin toon, it would boot him for packet flooding.

Anyways.. He did this tutorial on the server-side, and while another game on the same computer was still experiencing that no-attack/kick for packet flooding thing.. His server was good to go.

I'd like to hear anyone else's experiences in this arena.. (If you have never had an MS server up longer than 20 or so days, I'm not talking to you. :))


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 03, 2007 8:45 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 7:22 pm
Posts: 101
The other game is the original Mirage Online :) And yes, I'm applying this tutorial to the sucker as the code between MO 3.0.4 and MS are fairly similar at this stage :)

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 03, 2007 8:51 pm 
Offline
Knowledgeable
User avatar

Joined: Mon Jul 24, 2006 2:04 pm
Posts: 339
I used this, but removed it since I changed my timers/counters to work differently. Instead, I just added a check every server loop that :

if timeGetTime > LasttimeGetTime Then Unload Server

Works fine - a reset every that many days isn't going to hurt anyone, especially with a rebooting tool, and you don't have to double-up on all your counter sizes. :wink:

_________________
NetGore Free Open Source MMORPG Maker


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 03, 2007 9:08 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
Spodi, the situation with the booting for packet flooding...

It continues to happen until the system the server is running on is rebooted.. No matter how many times the game server software is rebooted. I don't know what method you're using.. But I'd imagine that if you ran your server for 50 days, something similar would be happening.

I've never run my own game server.. But I have seen many other games have this issue.. Magi Knights.. Kronia.. (Haven't yet seen it in Jerrath, but I don't play Jerrath..)

So yeah.. It's an elusive little bug, and 4 extra bytes for the 7 or so timers that are required.. (Someone help me here.. not sure about the number of timers in MS servers..) But I don't think 28 extra bytes hurts much.. (Just my humble opinion)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 03, 2007 9:22 pm 
Offline
Knowledgeable
User avatar

Joined: Mon Jul 24, 2006 2:04 pm
Posts: 339
Quote:
So yeah.. It's an elusive little bug, and 4 extra bytes for the 7 or so timers that are required.. (Someone help me here.. not sure about the number of timers in MS servers..) But I don't think 28 extra bytes hurts much.. (Just my humble opinion)


Yeah thats not a problem at all, but I use tons of timers for the characters and base the timers off of at what tick they will end, not how long they last and gradually decrease them (prevents having to constantly modify the values and can maintain accuracy).

I'm having a hard time seeing why it would continue to cause a problem after it rolls over... you know why it happens or have any general idea what could cause it? My only guess is the timer system described above that I avoid using, but that should be fixed just by resetting the server itself... *shrugs*

_________________
NetGore Free Open Source MMORPG Maker


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 15 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:  
Powered by phpBB® Forum Software © phpBB Group