Lower CPU Patch

Lower CPU Patch; support/discussion/questions

Moderator: thunderchero

User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3197
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: Lower CPU Patch

Post 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
User avatar
QuasarDonkey
Code Analyst
Code Analyst
Posts: 433
Joined: Tue Jul 26, 2011 8:29 pm
Location: Ireland

Re: Lower CPU Patch

Post 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.
User avatar
ruthlessferengi
Multiple Tournament Champion
Multiple Tournament Champion
Posts: 880
Joined: Sat Apr 26, 2008 2:00 am
Location: GMT- 5

Re: Lower CPU Patch

Post by ruthlessferengi »

ok, for those hexediting challenged folk, is there an executable dummy proof file there? :)
Relevance is a post hoc phenomenon

На безптичье и жопа воробей...
Ancient Klingon Battlecry
User avatar
QuasarDonkey
Code Analyst
Code Analyst
Posts: 433
Joined: Tue Jul 26, 2011 8:29 pm
Location: Ireland

Re: Lower CPU Patch

Post by QuasarDonkey »

no, unfortunately there's no patching program for this.
User avatar
ruthlessferengi
Multiple Tournament Champion
Multiple Tournament Champion
Posts: 880
Joined: Sat Apr 26, 2008 2:00 am
Location: GMT- 5

Re: Lower CPU Patch

Post by ruthlessferengi »

will be?
Relevance is a post hoc phenomenon

На безптичье и жопа воробей...
Ancient Klingon Battlecry
User avatar
QuasarDonkey
Code Analyst
Code Analyst
Posts: 433
Joined: Tue Jul 26, 2011 8:29 pm
Location: Ireland

Re: Lower CPU Patch

Post by QuasarDonkey »

If you want, I'll throw something really simple together. You can remind me tomorrow if I forget.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7849
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Lower CPU Patch

Post 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
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1884
Joined: Sun Apr 27, 2008 2:00 am

Re: Lower CPU Patch

Post 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 // :?:
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2392
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: Lower CPU Patch

Post 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?
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
KrazeeXXL
BORG Trouble Maker
BORG Trouble Maker
Posts: 2323
Joined: Sat Jan 03, 2009 3:00 am
Location: the 36th Chamber

Re: Lower CPU Patch

Post 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
User avatar
ruthlessferengi
Multiple Tournament Champion
Multiple Tournament Champion
Posts: 880
Joined: Sat Apr 26, 2008 2:00 am
Location: GMT- 5

Re: Lower CPU Patch

Post by ruthlessferengi »

nice and thanks!
Relevance is a post hoc phenomenon

На безптичье и жопа воробей...
Ancient Klingon Battlecry
Post Reply

Return to “Lower CPU Patch”