Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Animation Loops outside the Gameloop
#8
Well Ive moved onto server loops and need some more advice..
I think that certain events arent important enough to check every loop, such as the respawning of map objects (ex/ trees, ore, etc)
SOoo.. I just through this together in a minute:

Serverloop:
Code:
If GetTickCount > SecondTimer + 1000 Then
            Call CheckTempTree
            SecondTimer = GetTickCount
        End If


Code:
Sub CheckTempTree()
Dim x As Long
'RespawnTreeID records current temp trees, and handles the timer and respawn

    Do while x  -1
        If RespawnTreeID(x) = -1
             x = -1
        Else
             If GetTickCount > RespawnTreeID(x).Timer + 20000 Then
                 RespawnTree(RespawnTreeID(x))
                 RemoveTreeID(x)
             End If
        End If
    Do Events
    Loop

End Sub
This would reduce checking certain unimportant procedures, thereby lightening up on the serverloop. Idk I just pieced this together off the top of my head, you can harrass me now.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)