Page 2 of 2

Re: Lower CPU Patch

Posted: Fri Nov 18, 2011 6:49 pm
by Flocke
If there's such a demand for this, at least set it down to <=10ms. (though inaccuracy of the sleep call might limit it to around 15ms minimum)

I've spent quite some time on 3D game programming and I know of juddering/stuttering caused by low fps in games. Commonly 30 fps is sufficient, BUT only if the framerate keeps to be constant each frame and there's no fast movement.
AND a sleep of 20h or 32ms doesn't mean it renders at 1000/32=31.25 fps BUT below of it, cause within sleep duration no computation can be done.
That's also why this actually never has been a BUG. Way back when there's been no alternative to the sleep calls, the only way to garanty good fps but still not block other applications was to use the special sleep(0) call.

That said, I agree with QD that botf is old and you won't get to see stuttering often. Eventually on camera movement or huge fleets with high poly ships in some mods.

And sry I'm not that enthusiastic on this disclosure. ;)
If people find it useful that's great!
Now let me heat my cpu again, it's getting cold. :P

Re: Lower CPU Patch

Posted: Fri Nov 18, 2011 7:42 pm
by QuasarDonkey
Well, you got me Flocke, I may have oversimplified things a little. You're right, you don't get 32 FPS. I hadn't really worked through any calculations, but I just picked values that worked okay for me.

So, if it takes 20 ms to render one frame with sleep(0), that's 1000/20 = 50 FPS. Now if we sleep(30), that means we get 1000/(20+30) = 20 FPS. That's quite a hit.

I just decided to test it, I forgot you could do that in combat. I only get 18-20 FPS with sleep(30). Without patch on the same battle, I get 50 FPS. Of course, if your system is faster than mine, it will be less pronounced. Actually I never really noticed it being choppy :? Maybe my brain runs faster than a normal huh-mon. Although I see now it is a bit smoother at 50 FPS.

By my calculations it takes 20 ms to do one frame on my system. Since I have a 733 MHz CPU, then logically, since all 3D rendering is done in software, if you have a 2 GHz processor, you should have a framerate of about 150 FPS. In that case, sleep(30 ms) will slow the framerate down to about 30 FPS. That is too much. 16 ms delay or less is acceptable (about 50 FPS on 2 GHz).

I'll edit the main post to recommend 16 ms (10h) maximum, and only for people who really want it. 32 ms sleep is pushing it too far for most users.

I guess we should heed Flocke's advice, and not treat it as a bug, but a feature (i.e. don't put this fix in mods by default). I guess one day, we can solve this to everyone's satisfaction by using a variable time delay based on framerate (or waitable timers :wink:).

I'll see if I can set sleep(0) only for tactical combat, and sleep longer for the GUI screens. I reckon that would solve this.

Re: Lower CPU Patch

Posted: Fri Nov 18, 2011 8:32 pm
by ruthlessferengi
ok, for those hexediting challenged folk, is there an executable dummy proof file there? :)

Re: Lower CPU Patch

Posted: Fri Nov 18, 2011 9:04 pm
by QuasarDonkey
no, unfortunately there's no patching program for this.

Re: Lower CPU Patch

Posted: Fri Nov 18, 2011 11:49 pm
by ruthlessferengi
will be?

Re: Lower CPU Patch

Posted: Sat Nov 19, 2011 12:19 am
by QuasarDonkey
If you want, I'll throw something really simple together. You can remind me tomorrow if I forget.

Re: Lower CPU Patch

Posted: Sat Nov 19, 2011 12:21 am
by thunderchero
QuasarDonkey wrote:If you want, I'll throw something really simple together. You can remind me tomorrow if I forget.
You are going to spoil us..... :wink:

thunderchero

Re: Lower CPU Patch

Posted: Sat Nov 19, 2011 6:45 am
by Spocks-cuddly-tribble
ruthlessferengi wrote:ok, for those hexediting challenged folk, is there an executable dummy proof file there? :)
Here is a patched multi-installer 1.0.2 exe (default path was C:\games\botf, in case that matters)

http://www.file-upload.net/download-389 ... k.exe.html


=> 0x115526 10 -> 10 // :?:

Re: Lower CPU Patch

Posted: Sat Nov 19, 2011 10:49 am
by Tethys
When QD originally posted those locations it was 0x115526 10 -> 20, since then he has edited it. I believe rather than removing it, he left it since its part of the total code?

Re: Lower CPU Patch

Posted: Sat Nov 19, 2011 1:49 pm
by KrazeeXXL
Spocks-cuddly-tribble wrote: Just a shot in the dark, but may be the secret fear behind Flocke's comments is the patch could bring on colds for those BotF players, who're utilising the synergy effect of the CPU bug for home heating in winter^^?
Good guess, now as his old chimney is gone :P

Re: Lower CPU Patch

Posted: Sat Nov 19, 2011 10:28 pm
by ruthlessferengi
nice and thanks!