this isn't particularly difficult to fix, it just requires a different way of thinking
anything and everything relating to doing stuff per loop, needs to be changed to doing stuff according to how much time has passed
Movement is rather easy to fix, all you need to do is store 2 variables and find the difference between them. I.E.
CurrentTime=Timer() : OldTime=Timer()-16
do
CurrentTime=Timer()
Move object 1,100.0*((CurrentTime-OldTime)/1000.0)
OldTime=Timer()
sync
loop
The first line is to set the variables, since if you don't then upon first execution you'll be comparing a very high value to 0, and it'll assume your framerate is 1 per hour or whatever, resulting in the first loop making everything INSANELY fast. So set both to timer and assume 60fps by taking away 16ms from the oldtimer
You must set both variables again, put 1 at the very beginning of the loop, and the other just before the 'sync' command. So that upon the next execution it'll compare the old time (lets assume 100ms) and the new time (116ms), meaning it's taken 16ms to update the screen, which is 60fps.
When actually moving the object, you should specify your intended movement per second (in this case 100.0 units), then divide that by the framerate. So if you have 1fps, the unit should move at 100.0 per loop. If you have 20fps it'll move at 5.0 per loop. Keeping the same overall speed of 100.0 units per second. Make sense?
I'd recommend simplifying/shortening your actual code by writing a function
global CurrentTime as integer : CurrentTime=timer()
global OldTime as integer : OldTime=timer()-16
do
CurrentTime=Timer()
Move object 1,Speed(100.0)
OldTime=Timer()
sync
loop
function Speed(a#)
b#=a#*((CurrentTime-OldTime)/1000.0)
Endfunction b#
That should get you started, You need to get your head around that first, then move on to more complicated stuff. Movement is quite easy but you also need to change the speed of
- object animations
since it'll still be playing at 1/3rd normal speed at 20fps)
- projectile calculation
it's all well and good being able to move them faster, but you need to check for collision between those 2 points, and not just where it currently resides, otherwise it might go through walls
- weapon firing speed
low rates of fire are usually not such a big deal, for instance if your weapon shoots 2 times per second, well then you won't notice much difference until it drops below 2fps, but if your fire rate is say 30 rounds per second, then anything below 30fps will be restricting the fire rate. You need to check time elapsed and possibly fire several rounds in a single loop, and get the bullet spacing correct so they aren't all bunched together at the same position
- damage over time
much like above, if you have an effect causing damage every 1/10th of a second then below 10fps will cause the damage effect to be slower than intended. Additionally (this applies to above) if the framerate is not a multiple of 10, it'll be slightly out. 19fps for instance will cause slightly less damage per second, than 20fps