This is a very weird bug I found when fooling around with fps-independent movement.
It seems that DBPro will return insanely high FPS values if you have used SCREEN FPS()
command in statements before. This doesn't mean that the actual performance of the
application will increase at all. In spite of SCREEN FPS() lies to us, the real FPS that we
can't know will be the same and this will screw up the ratios which are needed to build
a fixed movement values.
Please don't say I should use timer() instead. It is not the point of this topic.
OK.. I have a proof on this. I have two very similar programs. First try this one:
sync on
sync rate 0
dim PlayerSpeed#(0)
color backdrop rgb(16,16,16)
do
PlayerPlusX#=sin(wrapValue(HeadingAngleWhenPressed#+PlayerStrafing#))*PlayerSpeed#(0) :`*(75.0/(screen fps()+0.001))
PlayerPlusZ#=cos(wrapValue(HeadingAngleWhenPressed#+PlayerStrafing#))*PlayerSpeed#(0) :`*(75.0/(screen fps()+0.001))
NewCameraX#=curvevalue(1.0,oldCameraX#,2.0) :`*((screen fps()+0.001)/60.0))
NewCameraZ#=curvevalue(1.0,oldCameraZ#,2.0) :`*((screen fps()+0.001)/60.0))
NewStickX#=curvevalue(1.0,oldStickX#,3.5) :`*((screen fps()+0.001)/60.0))
NewStickZ#=curvevalue(1.0,oldStickZ#,3.5) :`*((screen fps()+0.001)/60.0))
cls
ink rgb(255,255,255),1
set cursor 0,0
print screen fps()
sync
loop
end
Mark up that there are a couple of lines with the end of it commented which will ignore
SCREEN FPS() command in the statement. Nothing unusual there. Take the next example:
sync on
sync rate 0
dim PlayerSpeed#(0)
color backdrop rgb(16,16,16)
do
PlayerPlusX#=sin(wrapValue(HeadingAngleWhenPressed#+PlayerStrafing#))*PlayerSpeed#(0) *(75.0/(screen fps()+0.001))
PlayerPlusZ#=cos(wrapValue(HeadingAngleWhenPressed#+PlayerStrafing#))*PlayerSpeed#(0) *(75.0/(screen fps()+0.001))
NewCameraX#=curvevalue(1.0,oldCameraX#,2.0 *((screen fps()+0.001)/60.0))
NewCameraZ#=curvevalue(1.0,oldCameraZ#,2.0 *((screen fps()+0.001)/60.0))
NewStickX#=curvevalue(1.0,oldStickX#,3.5 *((screen fps()+0.001)/60.0))
NewStickZ#=curvevalue(1.0,oldStickZ#,3.5 *((screen fps()+0.001)/60.0))
cls
ink rgb(255,255,255),1
set cursor 0,0
print screen fps()
sync
loop
end
Now I have taken the SCREEN FPS() command within and it's now a part of the statement.
The first example ran me at 62 fps solid. The I tried the second one and got about 470 fps solid!
AMAZING!
BUT it is not the true value! I really don't know why this happens, but it's very odd indeed!
The evil plan is now even closer!
- - - - - - - - - - - - - - - - - - - -
Specs:- P3 550 Nvidia TNT2M64, 192Mb RAM