Hi guys, I’ve been doing some more tests and I’m afraid I spoke too soon when I commented on these fps rises
– they only apply to code run directly from the editor. Standalone EXE files continue to cap at 60fps. I used this code
Sync On
Sync Rate 0
Make Object Cube 1, 15
Do
Text 50, 50, Str$(Screen FPS())
Sync
Loop
And from the editor
No program: 63-64 fps.
MS Word 2003: 63-64 fps.
MS Excel 2003: 63-64 fps
DBPro Default IDE: 63-64 fps
Cartography Shop 4: 500-511 fps
FPS Creator Free: Approx 490 fps, although fpsc crashed on program exit.
Windows Media Player 11 (open): 255 fps
Windows Media Player 11 (playing an mp3): 500 fps
But an exe stays fixed at 60fps no matter what is opened. So, I started playing around with VSync, as Latch suggested. With VSync disabled, the code snippet shown above runs in the editor at 500fps and as an exe at 600fps.
Now, it’s probably just me, but I’m very wary of fiddling with things in the control panel – not to mention, it gets tedious for the user if they have to keep changing things from game to game. I’m also concerned by this “tearing” effect that the help pages warned about. I’ve no idea what it is, and I haven’t seen it in the tests I did, but it doesn’t sound good.
So, I started looking at the code Benjamin posted. I modified it a little to run in a “Full-screen Windows mode”, and it comes in at 170fps as an exe or in the editor, with cpu usage down to about 60-70% for a single core. (The set Window on commands don’t make any difference to the code in the editor, but without them the exe caps at 60 again)
load dll "kernel32.dll", 1
Set Display Mode 1024, 768, 32
Set window on
Set Window Layout 0, 0, 0
Set Window Size 1024, 768
Set Window Position 0, 0
sync on
sync rate 0
make object cube 1, 10
do
text 0, 0, str$(screen fps())
sync
Sleep(1)
loop
function Sleep(timeMs)
call dll 1, "Sleep", timeMs
endfunction
So the upshot of it all is that a DBC exe runs with a default of VSync on, a setting which can only be changed by editing the 3d graphics card settings in Control Panel, as Latch said.
The DB Editor behaves much differently though. By default, it works as though VSync is on (again, this may be changed in Control Panel) but as soon as another 3d program starts running, the frame rate picks up to levels I would only expect if VSync had been forced off. FPSC and CShop 4 both trigger this rise, and surprisingly so does Windows Media Player (perhaps the visualisations require VSync off to run properly?)
Perhaps there’s a dll call or a hidden command in DBC itself that will temporarily disable VSync for that exe while it’s running. It has to be possible, because it’s been made an optional parameter in DBPro’;s “Set Display Mode” command (and I’ve already checked, it won’t work in DBC). Failing that, I think the greatest fps rise we’re going to get is from the modified version of Benjamin’s code snippet.
"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."