17-03-2009, 06:54 PM
I tried this
Test1 - My code
Test2 - The original
I tested with 1 player and 3 npcs with attack on sight. It seems when nothing is happening that the original code is a little bit faster. But when attacking players, my code is faster.
Code:
Do While ServerOnline
Tick = GetTickCount
For i = 1 To 10000
UpdateNpcAI
Next
Debug.Print "test1", GetTickCount - Tick
Tick = GetTickCount
For i = 1 To 10000
UpdateNPCAI2
Next
Debug.Print "test2", GetTickCount - Tick
Sleep 1
DoEvents
Loop
Code:
test1 1312
test2 1235
test1 1468
test2 1235
test1 1219
test2 1235
test1 1296
test2 1407
test1 1657
test2 1828
test1 1657
test2 1828
test1 1656
test2 1812
test1 1672
test2 1828
test1 1641
test2 1843
test1 1688
test2 1344
test1 1328
test2 1250
Test1 - My code
Test2 - The original
I tested with 1 player and 3 npcs with attack on sight. It seems when nothing is happening that the original code is a little bit faster. But when attacking players, my code is faster.