That is interesting, however, when I bump up the sync rate to say...60, and change the value in
NewYAng#=wrapvalue(YAng#+(0.5*(40/FPS)))
so it looks like
NewYAng#=wrapvalue(YAng#+(0.5*(60/FPS)))
The speed at which the cube rotates is slightly faster (5.61 secs at sync rate 40, 4.6 seconds at sync rate 60).
Then check this out:
sync on : sync rate 0
make object cube 1,10
load image "test.bmp",1
x=600
y=0
yadj=1
do
for i=1 to 7
sprite i,x,y,1
next i
FPS=screen fps()
text 0,0, str$(FPS)
if FPS<1 then FPS=1
YAng#=object angle y(1)
speed=60/FPS
if speed<1 then speed=1
NewYAng#=wrapvalue(YAng#+(0.5*speed))
yrotate object 1,NewYAng#
y=y+yadj
if y>350 then y=350:yadj=-1
if y<0 then y=350:yadj=1
sync
loop
Allow the computer to set its own sync rate, throw in some sprites to get the FPS down, and the ratio has changed.
30fps(with sprites) : 60fps(without sprites)
3.8 secs per rotation : 2.6 secs per rotation
But then we're only using 1 object and 7 sprites. Try something crazy like 27 sprites........
10fps(27 sprites) : 30fps(7 sprites) : 60fps(no sprites)
2.9 secs per rot : 3.8 secs per rot : 2.6 per rot
I hope I've found something useful.
The big thing to watch out for is to make sure when your program starts that it doesn't shrink down to 0 fps for a split second and then have DB generate a "Cannot Divide by 0" error, and if the FPS is greater than the preferred sync rate, then make sure FPS and speed always equal at least 1.
In the source button is a little way to test it with input on preferred sync rate and number of sprites to mess up the FPS. Test it then comment out "get image 1,0,0,80,80" and uncomment "load image "test.bmp",1" and try it out with a bitmap of your own for the sprite because I've found that get image is a little slow-just for testing.
BTW DarkGuy, my thanks to you for the example code. This one's been bothering me lately as well.
Crazy Donut Productions, Current Project: KillZone
Web Site Button Does Not Work, Visit Here: http://www.geocities.com/crazydonutproductions/index.html