*look at above code and wonders if we're answering the same question*
Method 1
UP SIDE: Will force your friends computer to play the game at the same speed as your computer. Simple to code.
DOWN SIDE: Completely wastes the power of your friends computer and gives him the same jerky framerate despite the more powerful machine.
Method 2
global gameSpeed as float
global lastTime as integer
do
rem Main Game Loop Here
sync
updateGameSpeed()
move object exampleObject,gameSpeed*0.01
yrotate object exampleObject,wrapvalue(object angle y(exampleObject)+(gameSpeed*0.1))
loop
function updateGameSpeed
time=timer()
gameSpeed=time-lastTime
lastTime=time
endfunction
PLUS SIDE: Maximises framerate across all computers and runs the game at the same speed regardless.
DOWN SIDE: Cannot apply percentages on a frame by frame basis, mommentum code therefor harder to write. Every movement in the game must be multiplied by the gameSpeed variable and therefor migrating your program may be a little effort. Exact values are hard to calculate, speeds are best attained by trial and error (gameSpeed=1000 over a second so would be 10 if you had 100fps, or 20 if you had 50fps).
You can also add together the framerate over the last half second and divide them to act as a dampening effect (a bit like suspension) which will help eliminate any jerkyness caused by background tasks eating processor time up.
Pneumatic Dryll
