im working on an rpg game engine, and im having a problem with the time based system.
i got like this :
'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 :
Do While Running = True
' all the game stuff comes here...
TimeElapse = ((EndTime - StartTime) / Freq)
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?