| www.ClassicTW.com http://classictw.com/ |
|
| Server Timing Variance (Script Side) GetTime http://classictw.com/viewtopic.php?f=15&t=21625 |
Page 1 of 1 |
| Author: | Kaus [ Wed Mar 04, 2009 1:28 am ] |
| Post subject: | 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 |
|
| Author: | Big D [ Wed Mar 04, 2009 7:13 am ] |
| Post subject: | 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. |
|
| Author: | Kaus [ Wed Mar 04, 2009 11:13 am ] |
| Post subject: | 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. |
|
| Author: | Singularity [ Wed Mar 04, 2009 11:43 am ] |
| Post subject: | 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_26 CPU ticks aren't always accurate, it'd be good to have it confirmed thru the clock. |
|
| Author: | Kaus [ Wed Mar 04, 2009 12:26 pm ] |
| Post subject: | Re: Server Timing Variance (Script Side) GetTime |
Singularity wrote: Do this... instead of using cpu ticks to measure things, use getTime... Linky: http://www.navhaz.com/files/script.html#CMD_26 CPU ticks aren't always accurate, it'd be good to have it confirmed thru the clock. 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 Code: 1 1 2 2 2 3 1 1 1 1 etc... |
|
| Author: | Promethius [ Wed Mar 04, 2009 1:06 pm ] |
| Post subject: | 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 |
|
| Author: | Singularity [ Wed Mar 04, 2009 1:23 pm ] |
| Post subject: | 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). |
|
| Author: | Kaus [ Wed Mar 04, 2009 2:00 pm ] |
| Post subject: | 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 |
|
| Author: | Kaus [ Wed Sep 17, 2014 6:05 pm ] |
| Post subject: | 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. |
|
| Author: | LoneStar [ Wed Sep 17, 2014 8:52 pm ] |
| Post subject: | 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 |
|
| Page 1 of 1 | All times are UTC - 5 hours |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|