Author |
Message |
Kaus
Gameop
Joined: Tue Nov 19, 2002 3:00 am Posts: 1050 Location: USA
|
Server Timing Variance (Script Side) GetTime
Ive been doing some reasearch into the effects of CPC and serverside variance timing wise. My current project entails finding specific times of a servers colo regen. In that 65535's mathmatical regen is not correct client side and I'm not sure why. Go easy on me I'm still a nooblet scripter. I found that ((65535 / 24 / 60 / 60) = 0.75850694 to infinity)) and in twx 758.50694 respectivly; still is not even perspectivly close to the actual regen timing. So i have attempted to write a script to actually time it and below are my findings. I wanted to write a T1 and T2 variable that detects the moment terra ticks to another number then start the gettimer when the while ='s the third adjusted variable divide by 2 and get my total time. However I have noticed some fluxuation in the script also; in that it doesnt allways catch the first or second change over and ideas on why and how one might accuratly devise the exact or close to exact colo regen rate? I did try a exit variable for If T2 ='s T3 dump, but i had the same timing issues. Code: SetVar $Idx 1 setVar $file GAMENAME & "_Seconds.txt" Delete $file setPrecision 18 :Start Send "L 1 * " Waitfor "There are currently" Getword CURRENTLINE $Timed 4 Send "q" Send "L 1 * " Waitfor "There are currently" Getword CURRENTLINE $Timed2 4 Send "q" If ($Timed = $Timed2) goto :Start else goto :Cont end
:Cont If ($Timed <> $Timed2) SetVar $Timed3 ($Timed2+1) getTimer $startTicks While ($Timed2 <= ($Timed3)) Send "L 1 * " Getword CURRENTLINE $Timed2 4 Send "q" Waitfor "There are currently" end getTimer $stopTicks end setVar $durationTicks ($stopTicks - $startTicks) setVar $seconds ($durationTicks / 2000000000) SetVar $seconds2 ($seconds / 2) echo ANSI_15 & "**Time lapse in Seconds: " $seconds2 "*" Write $file $seconds2 If ($Idx = 20) Halt Else Add $Idx 1 End goto :Start
Net results, where the higher results were captured after the second tick. Most results in my test of 100 fell between .94-1.6 seconds. Code: 1.007376647000000000 1.172460128750000000 1.060652404249992370 2.010546163250011440 1.632459465250000000 1.614271321500003820 0.996939919000003815 2.624385140999996180 1.600974019250003820 1.631386053250000000 1.560350857249996180 1.093451877250003820 2.038756074249996180 etc.. you get the idea
Also visually at least it appears some colo ticks are much longer than the previous. (using the most common timing in my test of 100) Code: :start Setdelaytrigger land :land 1001 pause :Land Send " l 1 * q" goto :start
_________________ Dark Dominion TWGS Telnet://twgs.darkworlds.org:23 ICQ#31380757, -=English 101 pwns me=- "This one claims to have been playing since 1993 and didn't know upgrading a port would raise his alignment."
Last edited by Kaus on Wed Mar 04, 2009 11:12 am, edited 1 time in total.
|
Wed Mar 04, 2009 1:28 am |
|
|
Big D
Veteran Op
Joined: Tue Nov 28, 2006 4:04 pm Posts: 5025
|
Re: Server Timing Variance (Script Side) GetTime
The actual regen on Terra is a random formula. It will reproduce a total regen of whatever the figure is set at, but the actual regen amount may vary throughout the day. At times Terra might produce 2000 colonists per hour and at times it may produce 8000 colonists per hour. So if Terra produces a lot of colonistes earlier in the day, you can bet it's going to slow way down later in the day.
|
Wed Mar 04, 2009 7:13 am |
|
|
Kaus
Gameop
Joined: Tue Nov 19, 2002 3:00 am Posts: 1050 Location: USA
|
Re: Server Timing Variance (Script Side) GetTime
Big D wrote: The actual regen on Terra is a random formula. It seems like pretty much everything sent from the server has some sorta random variance to it... Geez.
_________________ Dark Dominion TWGS Telnet://twgs.darkworlds.org:23 ICQ#31380757, -=English 101 pwns me=- "This one claims to have been playing since 1993 and didn't know upgrading a port would raise his alignment."
|
Wed Mar 04, 2009 11:13 am |
|
|
Singularity
Veteran Op
Joined: Thu Jun 02, 2005 2:00 am Posts: 5558 Location: USA
|
Re: Server Timing Variance (Script Side) GetTime
Do this... instead of using cpu ticks to measure things, use getTime... Linky: http://www.navhaz.com/files/script.html#CMD_26CPU ticks aren't always accurate, it'd be good to have it confirmed thru the clock.
_________________ May the unholy fires of corbomite ignite deep within the depths of your soul...
1. TWGS server @ twgs.navhaz.com 2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads 3. Open IRC chat @ irc.freenode.net:6667 #twchan 4. Parrothead wrote: Jesus wouldn't Subspace Crawl.
*** SG memorial donations via paypal to: dpocky68@booinc.com
|
Wed Mar 04, 2009 11:43 am |
|
|
Kaus
Gameop
Joined: Tue Nov 19, 2002 3:00 am Posts: 1050 Location: USA
|
Re: Server Timing Variance (Script Side) GetTime
Confirmed I guess, allthough not as accurate the gettime command shows the variance also. Code: :Cont If ($Timed <> $Timed2) Gettime $start ss SetVar $Timed3 ($Timed2+1) While ($Timed2 <= ($Timed3)) Send "L 1 * " Waitfor "There are currently" Getword CURRENTLINE $Timed2 4 Send "q" end Gettime $stop ss end setVar $duration ($stop - $start) Divide $duration 2 echo ANSI_15 & "**Time lapse in Seconds: " $duration "*"
Net Results
_________________ Dark Dominion TWGS Telnet://twgs.darkworlds.org:23 ICQ#31380757, -=English 101 pwns me=- "This one claims to have been playing since 1993 and didn't know upgrading a port would raise his alignment."
Last edited by Kaus on Wed Mar 04, 2009 3:36 pm, edited 1 time in total.
|
Wed Mar 04, 2009 12:26 pm |
|
|
Promethius
Ambassador
Joined: Mon Feb 09, 2004 3:00 am Posts: 3141 Location: Kansas
|
Re: Server Timing Variance (Script Side) GetTime
You can get millisecond accuracy with gettime:
gettime $msEnd zzz
The "zzz" isn't in the help docs, but EP put me onto its existence as part of the Delphi function. The original snippet I had was:
gettime $msEnd "h:m:s:zzz" replaceText $msEnd ":" " " getWord $msEnd $ms2 4
_________________
/ Promethius / Enigma / Wolfen /
"A man who has no skills can be taught, a man who has no honor has nothing."
|
Wed Mar 04, 2009 1:06 pm |
|
|
Singularity
Veteran Op
Joined: Thu Jun 02, 2005 2:00 am Posts: 5558 Location: USA
|
Re: Server Timing Variance (Script Side) GetTime
Ya, use milliseconds... hehe. You might want to invert the test, too. Land every X seconds and log the regen (difference from last).
_________________ May the unholy fires of corbomite ignite deep within the depths of your soul...
1. TWGS server @ twgs.navhaz.com 2. The NavHaz Junction - Tradewars 2002 Scripts, Resources and Downloads 3. Open IRC chat @ irc.freenode.net:6667 #twchan 4. Parrothead wrote: Jesus wouldn't Subspace Crawl.
*** SG memorial donations via paypal to: dpocky68@booinc.com
|
Wed Mar 04, 2009 1:23 pm |
|
|
Kaus
Gameop
Joined: Tue Nov 19, 2002 3:00 am Posts: 1050 Location: USA
|
Re: Server Timing Variance (Script Side) GetTime
Abit more accurate with the zzz settings Prom tipped me off on. Still netting the same results which basically confirms some other reasearch I had previously done using other commands. I will try the reverse one you are mentioning Sing at a later point. I have noticed there are less "blips" (read: large tick exceptions) using a gettime over a gettimer. Recoded and recycled, instead of just timing the time between colo regens at terra I expanded to allow for total time and regen using the gettime command. Purpose was to both verify my previous findings and to verify the random regen timer. Both have in my eye been satisfied. It appears that indeed terra regen is random within a 1000ms variable (generally). There is prolly some redundant code within the following example so I appologise in advance, I tried my best to remove and replace anything I thought or saw to be repetative. Going abit crosseyed here from all the gettime commands.. hehe Code: #-------------INT Variables-------------- SetVar $Idx 1 setVar $file GAMENAME & "_Seconds.txt" Delete $file #------------Check to see if we can start----- :LetsGo Gettime $StartDaTest ReplaceText $StartDaTest ":" " " Getword $StartDaTest $Started 2 SetDelaytrigger EMCPU :EMCPU 100 pause
:EMCPU Gettime $StartDaTest ReplaceText $StartDaTest ":" " " Getword $StartDaTest $Started2 2
If ($Started = $Started2) Echo ANSI_15 "* Waiting to go!" goto :LetsGo End Echo ANSI_12 "* Started The Test!!!!"
GetTime $StartedTest
Gettime $Stop Replacetext $Stop ":" " " Getword $Stop $Stoploop 2
#--Change this variable to increase time of test--- Add $Stoploop 1
#------------While Start------------------- While ($whileloop < $stoploop) :Start Send "L 1 * " Waitfor "There are currently" Getword CURRENTLINE $Timed 4 Send "q" Send "L 1 * " Waitfor "There are currently" Getword CURRENTLINE $Timed2 4
If ($Idx = 1) SetVar $StartColo $Timed end
Send "q" If ($Timed = $Timed2) goto :Start else goto :Cont end
:Cont If ($Timed <> $Timed2) Gettime $start s:zzz SetVar $Timed3 ($Timed2+1) While ($Timed2 <= ($Timed3)) Send "L 1 * " Waitfor "There are currently" Getword CURRENTLINE $Timed2 4 Send "q" end Gettime $stop s:szzz end
Replacetext $Start ":" " " Replacetext $Stop ":" " "
Getword $start $SecTimer 1 Getword $start $MilliSecTimer 2 Getword $stop $SecTimer2 1 Getword $stop $MilliSecTimer2 2
setVar $SecDuration ($SecTimer2 - $SecTimer) SetVar $MilliSecDuration ($MilliSecTimer2 - $MilliSecTimer) Divide $SecDuration 2 Divide $MilliSecDuration 2 Write $file "Time lapsed " & $SecDuration & ":" & $MilliSecDuration Add $Idx 1
GetTime $Check Replacetext $check ":" " " Getword $Check $Whileloop 2 END
#-------------Ended While Loop Spit out the Results--------------------- SetVar $StopColo $Timed2 GetTime $EndedTest echo ANSI_15 "* " ($StopColo - $StartColo) " :Total Colos Regened" "*" echo ANSI_12 "*" $StartedTest "*" $EndedTest Halt
Results Code: Time lapsed 1:1953 Time lapsed 2:6570 Time lapsed 1:8047 Time lapsed 1:9961 Time lapsed 1:13390 Time lapsed 1:15945 Time lapsed 1:19000 Time lapsed 1:20508 Time lapsed 1:23469 Time lapsed 1:26008 Time lapsed 1:28046
Total Time 1 Minute Cycle Code: 50 :Total Colos Regened
3:20:00 PM 3:21:00 PM
Total colos regenned over 1 hour in 1 minute increments would be 72000 however to truely test it I would need to run a full hour and my attention to this project is just about spent. I believe as the script nears 60mins the 72000 would be allot closer to the stated 65535 in the twgs/*. Thanks for humoring me -Kaus
_________________ Dark Dominion TWGS Telnet://twgs.darkworlds.org:23 ICQ#31380757, -=English 101 pwns me=- "This one claims to have been playing since 1993 and didn't know upgrading a port would raise his alignment."
|
Wed Mar 04, 2009 2:00 pm |
|
|
Kaus
Gameop
Joined: Tue Nov 19, 2002 3:00 am Posts: 1050 Location: USA
|
Re: Server Timing Variance (Script Side) GetTime
Necro post for CC Bee and because I felt like it.
Can use the above get-time for other commands as well.
_________________ Dark Dominion TWGS Telnet://twgs.darkworlds.org:23 ICQ#31380757, -=English 101 pwns me=- "This one claims to have been playing since 1993 and didn't know upgrading a port would raise his alignment."
|
Wed Sep 17, 2014 6:05 pm |
|
|
LoneStar
Commander
Joined: Fri Jun 09, 2006 2:00 am Posts: 1396 Location: Canada
|
Re: Server Timing Variance (Script Side) GetTime
Kaus wrote: Necro post for CC Bee and because I felt like it.
Can use the above get-time for other commands as well. Hey Kaus! like seing your avatar.. you need to post more often
_________________ ---------------------------- -= QUANTUM Computing 101: 15 = 3 x 5 ... 48% of the time. -= There are 10 types of people in the world: Those that understand Binary and those who do not -= If Oil is made from Dinosaurs, and Plastic is made from Oil... are plastic Dinosaurs made from real Dinosaurs? -= I like to keep my friends and my enemies rich, and wait to see which is which - Tony Stark (R.I.P.)
|
Wed Sep 17, 2014 8:52 pm |
|
|
|