Can someone tell me if I understand this behaviour correctly...
sync on
sync rate 30
MAKE OBJECT CUBE 1,0.75
DO
YROTATE OBJECT 1,OBJECT ANGLE Y(1)+1
if upkey()<>1 then gosub sync_me
if downkey()=1 then gosub sync_me
LOOP
sync_me:
text 0,0,"fps= "+str$(screen fps())
sync
return
Press the up arror key to prevent sync'ing
Press the down arror key to do an extra sync.
Now am I right in saying that basically SYNC actually freezes/pause the engine in some way?
This explains why just tapping the up key (doing no sync) send the cube's rotation mad. Because basically the code speeds up and rotates the cube madly.
The down key introduces a second sync into the loop, so rather than my cube rotating by a value of 1 per frame, now it only rotates by a value of 1 every 2 frames. Hence its speed halves.
I assume if by chance you run on a slow computer and the coding you're doing takes long than the 1/30 of second that you hoped it would, then the hole game would just slow down? So in a FPS shooter you could run a program in the background to use up CPU time, and you'd be able to play (cheat) in slow motion?
I also notice that the FPS is seemingly always 10% than asked for? ie: I ask for 30fps and get 33? I ask for 50fps and get 55?