09-03-2007, 12:30 PM
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:
At the top add:
Then at the bottom add:
Server Side - This will replace the tmrPlayerSave.
Go inside:
Then at the bottom add:
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:
To:
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:
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
Now you can simply do this for all timers to get rid of them.
Server Side - This will replace the tmrSpawnMapItems.
Go inside:
Code:
Sub GameAI()
Code:
Dim XTickCount(1 to 2) as Long, XFirst(1 to 2) as Byte
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()
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
Code:
Dim XTickCount(1 to 3) as Long, XFirst(1 to 3) as Byte
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
Now where it says "'Run the timer code here", that is the place were you put whats inside the timer. And thats it
