hi everyone.
im working on an rpg game engine, and im having a problem with the time based system.
i got like this :
Code:
'world time stuff
Private Declare Function QueryPerformanceFrequency Lib "kernel32" (lpFrequency As Currency) As Long
Private Declare Function QueryPerformanceCounter Lib "kernel32" (lpPerformanceCount As Currency) As Long
'time system stuff
Dim Freq As Currency
Dim StartTime As Currency
Dim EndTime As Currency
Dim TimeElapse As Double
and in my main loop i have this :
Code:
Do While Running = True
QueryPerformanceCounter StartTime
' all the game stuff comes here...
QueryPerformanceCounter EndTime
QueryPerformanceFrequency Freq
TimeElapse = ((EndTime - StartTime) / Freq)
DoEvents
Loop
so now i basicly have "TimeElapse" which should be the time passed between eatch frame.
so i suppose to double everything in that value, right?
like Player.x = player.x + speed.x * TimeElapse
Now, the wired part is.. its somtimes work fast, and sometimes works really slow.. and i dont know why...

i mean, it sould work fine, and always at the same speed...
thats the whole idea of it now isnt it?
im using DX btw, maybe it has anything to do with it.
so anyone knows what can somehow effect the speed, or what im doing wrong?
thanks.