03-04-2007, 08:45 PM
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


Alternative to GetTickCount
|
03-04-2007, 08:45 PM
The other game is the original Mirage Online
![]() ![]()
03-04-2007, 08:51 PM
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:
03-04-2007, 09:22 PM
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*
03-05-2007, 03:45 AM
Okay, I don't know why the hell I didn't think of this earlier. It just randomly came to me a while ago. Hope you like it, Verrigan. :wink:
Basically, this wrapper will take all the pros of this system and eliminate most all of the cons (adds slight overhead, but hardly anything to worry about). What you do is make one call to initialize it, which will create an offset value that will allow your program to start at the smallest signed 32-bit value (which is -(2^31)), or a VB Long. This doesn't let you run your program for an ungodly amount of time like what Verrigan posted does, but it will let your program run for 2 ^ 32 milliseconds (about 50 days). So you have a roll-over time of your program being up for 50 days, not the computer being on for 25 days. Demo project: Code: Private GetSystemTimeOffset As Currency I do a quick -1 on the init up there just in case rounding takes a turn for the worst and creates an overflow. I don't think you'll be sad about loosing 1 millisecond. :wink: Pros: - Retain 32-bit timers (not as widely used in MS, but if you use Time Based Modeling you will have a timer for just about everything) - Based on the application's time running, not the computer's (although still, the 64-bit timer would've probably never rolled over) Cons: - Slightly more overhead (about 10% slower, but its so fast as it is in the first place) To be honest, I can't remember how much MS uses tickcount-based timers (ie timers that count based on the system's tick count, not by "counting down"), but I believe it is quite minimal, so this may not benefit MS greatly, but I'm sure some people will find use for it. ![]()
26-07-2007, 01:37 PM
Had a quick read through, but if anyone adds this you will need to convert anything you save as gettickcount to currency.
Quote:Robin:
26-07-2007, 01:41 PM
Actually, this is in FPO, I think all you had to do was define one thing as currency and then change all the gettickcount calls. It works though, so w/e.
26-07-2007, 01:45 PM
I have to disagree.
Trying to push a currency value into a long is gonna hurt. Quote:Robin:
26-07-2007, 01:55 PM
Robin Wrote:I have to disagree. I'll check my source later, but I have this 100% on the server working, and I think I only changed a few things to currency.. I forget. Oh well. It's been forever since I added it. I could be wrong, my memory isn't the best.
11-08-2007, 12:38 PM
OMG! Verrigan lives! xD
Yeah, it was tested successfully on FPO back when Shan was hosting the server. His machine had been up way too long with no restart and all non-admin characters were getting booted for packet flooding. I told Verrigan about it, and he asked me to add this to test his theory, and luckily his theory was correct and it stopped the booting. |
« Next Oldest | Next Newest »
|