Mirage Source http://miragesource.net/forums/ |
|
Replace Server Timers http://miragesource.net/forums/viewtopic.php?f=210&t=1478 |
Page 1 of 1 |
Author: | William [ Fri Mar 09, 2007 12:30 pm ] |
Post subject: | Replace Server Timers |
I dont know if this will speed up anything or slow it down. So please tell me if it dont and I remove the topic. This will replace the timers with a part of code in the game loop using TickCount. Server Side - This will replace the tmrSpawnMapItems. Go inside: Code: Sub GameAI() At the top add: Code: Dim XTickCount(1 to 2) as Long, XFirst(1 to 2) as Byte Then at the bottom add: Code: If XFirst(1) = 0 Then XTickCount(1) = GetTickCount XFirst(1) = 1 End if If GetTickCount > XTickCount(1) + 1000 Then Call CheckSpawnMapItems XFirst(1) = 0 End If Server Side - This will replace the tmrPlayerSave. Go inside: Code: Sub GameAI() Then at the bottom add: Code: If XFirst(2) = 0 Then XTickCount(2) = GetTickCount XFirst(2) = 1 End if If GetTickCount > XTickCount(2) + 60000 Then Call PlayerSaveTimer XFirst(2) = 0 End If The tmrShutdown is a little bit different, but Im tired so Im not gonna do that one. Follow Up If you want to add more timers into the gameloop. Change: Code: Dim XTickCount(1 to 2) as Long, XFirst(1 to 2) as Byte To: Code: Dim XTickCount(1 to 3) as Long, XFirst(1 to 3) as Byte You add by 1 for each new timer that is going to be removed. Now in the bottom part of the Sub GameAI, you will add two new parts: Code: If XFirst(3) = 0 Then XTickCount(3) = GetTickCount XFirst(3) = 1 End if If GetTickCount > XTickCount(3) + 60000 Then 'Run the timer code here. XFirst(3) = 0 End If You see that instead of using 1 and 2 as the first two timers, you now use the added number, which now is 3. Now where it says "'Run the timer code here", that is the place were you put whats inside the timer. And thats it ![]() |
Author: | Coke [ Fri Mar 09, 2007 12:43 pm ] |
Post subject: | |
The thing i have found with timers is they behave differently on different speeds of computer... at least thats what its like at college ~.~ |
Author: | William [ Fri Mar 09, 2007 12:45 pm ] |
Post subject: | |
They should work independently i think, can't be sure thought. |
Author: | Coke [ Fri Mar 09, 2007 12:48 pm ] |
Post subject: | |
I think its just a case of the pc's we use in class are just lagging so bad, its a pain in the arse since you make something and its timed perfectly then you go onto a normal pc and its hyperspeed -.- |
Author: | William [ Sun Jun 10, 2007 10:53 am ] |
Post subject: | Re: Replace Server Timers |
But the tick count should be reliable thought. So its probably better than using timers. |
Author: | Coke [ Tue Jun 12, 2007 1:57 pm ] |
Post subject: | Re: Replace Server Timers |
William, does the login rely on any of these? Getting really ![]() |
Author: | Rian [ Tue Jun 12, 2007 5:49 pm ] |
Post subject: | Re: Replace Server Timers |
I'm looking into that right now, Fox. Have you tried this tut to see if it helps your problem? |
Author: | Robin [ Tue Jun 12, 2007 6:16 pm ] |
Post subject: | Re: Replace Server Timers |
Fox wrote: William, does the login rely on any of these? Getting really ![]() Think it might help solve it. |
Author: | Lea [ Tue Jun 12, 2007 11:15 pm ] |
Post subject: | Re: Replace Server Timers |
Not only can it vary from computer to computer, but people can change it on their computers using various speed hacks. Verrigan's posted a way to foul those hacks. |
Author: | William [ Thu Jun 14, 2007 10:31 am ] |
Post subject: | Re: Replace Server Timers |
Updated a follow up. |
Author: | Coke [ Thu Jun 14, 2007 3:46 pm ] |
Post subject: | Re: Replace Server Timers |
I converted the gameAI timer.. booted and noticed no npc's etc were moving... then realised that timers needed to run through the sub the tickcounts in lol. How would i work around this? |
Author: | William [ Tue Sep 18, 2007 11:35 am ] |
Post subject: | Re: Replace Server Timers |
Opss xD I forgot it should be: Private XTickCount(1 To 2) As Long, XFirst(1 To 2) As Byte If its just dimmed, it wont keep the variable after the sub is completed. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |