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 UpIf 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
![Smile :)](./images/smilies/icon_smile.gif)
Now you can simply do this for all timers to get rid of them.