Reduce CPU usage and increase FPS
Moderator: JeremyaFr
Reduce CPU usage and increase FPS
- JeremyaFr
- Posts: 3840
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
Hello,
Here is a hook to reduce the CPU usage. The side effect is that the framerate is reduced.
xwa_hook_time.zip
Here is a hook to reduce the CPU usage. The side effect is that the framerate is reduced.
xwa_hook_time.zip
- Darksaber
- Posts: 10931
- Joined: Mon Jan 10, 2000 12:01 am
- Contact:
So does this remove the need to run XWA on one core, using Runfirst.exe
http://www.xwaupgrade.com/phpBB3008/vie ... 10&t=10594
http://www.xwaupgrade.com/phpBB3008/vie ... 10&t=10594
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate
Good Things Come To Those Who Wait....
Darksaber's X-Wing Station
- John Lydgate
Good Things Come To Those Who Wait....
Darksaber's X-Wing Station
- JeremyaFr
- Posts: 3840
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
It does not remove the need to run XWA on one core.
The game uses 100% of one cpu core. It's because at several places the game engine calls timeGetTime in a loop in order to wait a few ms.
The hook adds a call to Sleep before the call to timeGetTime.
The game uses 100% of one cpu core. It's because at several places the game engine calls timeGetTime in a loop in order to wait a few ms.
The hook adds a call to Sleep before the call to timeGetTime.
-
- Posts: 31
- Joined: Sun Jun 10, 2001 11:01 pm
I assume this is the same reason I get 100% cpu usage with XvT/Bop ?
If so how would I go about applying the same fix for it ?
Thanks for the great work on this btw !
If so how would I go about applying the same fix for it ?
Thanks for the great work on this btw !
craig mac
-
- Posts: 239
- Joined: Mon Jan 19, 2009 11:45 am
You can't easily use this for XvT/BoP, it is specific to the game binary.
I think I don't see the issue when running XvT with this wrapper (the one from JeremyaFr with small changes to make it work with XvT):
https://github.com/rdoeffinger/xwa_ddra ... ses/latest
But even if you do, you can set the PresentSleepTime = 10 option, then it will just stop the game from using your CPU for a fixed amount of time every frame.
It's not as good as this change as it doesn't adjust to how much resources the game really needs, so too low means you waste CPU, too high means the game will run slower than it should, but it's something.
I think I don't see the issue when running XvT with this wrapper (the one from JeremyaFr with small changes to make it work with XvT):
https://github.com/rdoeffinger/xwa_ddra ... ses/latest
But even if you do, you can set the PresentSleepTime = 10 option, then it will just stop the game from using your CPU for a fixed amount of time every frame.
It's not as good as this change as it doesn't adjust to how much resources the game really needs, so too low means you waste CPU, too high means the game will run slower than it should, but it's something.
-
- Posts: 31
- Joined: Sun Jun 10, 2001 11:01 pm
thanks very much!
this seems to run a lot better.. certain areas were making my framerate fluctuate .. the interdiction of tie advanced fighters especially, but its far more playable now
never thought i'd see the day where i can play the game 1080p with AA but here it is
thanks again for the fantastic work
this seems to run a lot better.. certain areas were making my framerate fluctuate .. the interdiction of tie advanced fighters especially, but its far more playable now
never thought i'd see the day where i can play the game 1080p with AA but here it is

thanks again for the fantastic work
craig mac
- JeremyaFr
- Posts: 3840
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
UPDATE
Hello,
I've included the 60 fps patch to the time hook.
Please redownload xwa_hook_time.zip
Hello,
I've included the 60 fps patch to the time hook.
Please redownload xwa_hook_time.zip
- JeremyaFr
- Posts: 3840
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
UPDATE
Hello,
I've updated the time hook.
I've reduced CPU usage in game menus and in video playing.
Please redownload xwa_hook_time.zip
Hello,
I've updated the time hook.
I've reduced CPU usage in game menus and in video playing.
Please redownload xwa_hook_time.zip
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate
Good Things Come To Those Who Wait....
Darksaber's X-Wing Station
- John Lydgate
Good Things Come To Those Who Wait....
Darksaber's X-Wing Station
-
- Posts: 51
- Joined: Tue Feb 05, 2019 12:43 am
the 60fps part isn't working for me, game won't go higher than 11 fps for some reason
- JeremyaFr
- Posts: 3840
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
UPDATE
Hello,
I've updated the time hook.
I've removed the limit of 59 fps.
Hello,
I've updated the time hook.
I've removed the limit of 59 fps.
- Phoenix Leader
- Posts: 437
- Joined: Wed Aug 08, 2018 2:20 pm
Is there a new fps limit now? Is it that 118 fps you mentioned in this topic: https://xwaupgrade.com/phpBB3/viewtopic ... 6&start=70 ?
- Phoenix Leader
- Posts: 437
- Joined: Wed Aug 08, 2018 2:20 pm
Great. X-Wing Alliance on 120 Hz and 144 Hz monitors will be amazing.
- JeremyaFr
- Posts: 3840
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
WIP
Hello,
Here a WIP version of the time hook.
I think I've found how to modify the explosions animations speed.
I've added a config file to control the animation speed.
The settings are in the "hook_time.cfg" file or in the "[hook_time]" section of the "Hooks.ini" file.
To define the duration of an animation frame for explosions, set the ExplosionAnimationTimeFrame setting. The setting is an integer value. The default value is 60.
To define the duration of an animation frame for small debris, set the SmallDebrisAnimationTimeFrame setting. The setting is an integer value. The default value is 60.
Download:
EDIT: link removed
Hello,
Here a WIP version of the time hook.
I think I've found how to modify the explosions animations speed.
I've added a config file to control the animation speed.
The settings are in the "hook_time.cfg" file or in the "[hook_time]" section of the "Hooks.ini" file.
To define the duration of an animation frame for explosions, set the ExplosionAnimationTimeFrame setting. The setting is an integer value. The default value is 60.
To define the duration of an animation frame for small debris, set the SmallDebrisAnimationTimeFrame setting. The setting is an integer value. The default value is 60.
Download:
EDIT: link removed
-
- Posts: 1157
- Joined: Mon Apr 05, 2004 11:01 pm
Also on a related note, the explosion time (or rather the duration of explosions) can be lengthen too for say Starships and Stations by using AlliED editor's Departure tab for any FG, and it's bottom left corner tool called "Explosion time." I set larger craft from between 3 to around 7 seconds delay.
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.
-
- Posts: 1157
- Joined: Mon Apr 05, 2004 11:01 pm
Hi Jeremy, FYI -- when using the new WIP time hook you posted above, the game kept crashing to desktop for me. Think it's bugged because when I go back to previous version all is well. Would you like me to post a crash report?
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.
- Ace Antilles
- Posts: 7706
- Joined: Sat Jan 22, 2000 12:01 am
- Contact:
Hi @JeremyaFr. Is this still a WIP bug or has it been released as a final version now?
- Ace Antilles
- Posts: 7706
- Joined: Sat Jan 22, 2000 12:01 am
- Contact:
Does this still crash for you? I know you've had other crashes of late.
- JeremyaFr
- Posts: 3840
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
Hello,
The WIP time hook was merged before fixing the random crashes. Then Bman reported that his game is now stable.
Question for @Bman: Can you confirm?
The WIP time hook was merged before fixing the random crashes. Then Bman reported that his game is now stable.
Question for @Bman: Can you confirm?
-
- Posts: 1157
- Joined: Mon Apr 05, 2004 11:01 pm
Hi J. & A., yes, all latest hooks are working fine for me. Thanks
. Just having some transparency issues with new GPU ddraw. Posted video of what I see in TFTC discord server in VR-Help channel. Could be my .cfg files or AMD card issue. ???
W-I-P: TFTC, MC Viscount Cr., ISD-II Avenger, NL-1 Platform, Ton-Falk Esc. Cr., & Misc.
-
- Posts: 20
- Joined: Mon Jun 06, 2011 3:15 pm
Hi @JeremyaFr
I've just installed the XWA megapatch, and there is any
hook_time.cfg file to set explotions framerate. I guees I can get the DLL and the cfg from your GitHub and use that.
Another issue I see, with the unlocked framerate (I'm using a 120hz monitor), is that framerate is much better than vanilla 30fps, obviously, and actually It runs at 120fps, but is not completly smooth and it's 'jittering'. I've tried various settings in Nvidia control panel and in the .ini files (vsync on/off, fixed framerate/gsync, setting my monitor to 60hz...), but nohing chance, it is still 'jittering'. It's most noticiable with backgrounds. Is there ant way to fix It? Maybe this issue is some engine limitation.
Thanks in advance.
I've just installed the XWA megapatch, and there is any
hook_time.cfg file to set explotions framerate. I guees I can get the DLL and the cfg from your GitHub and use that.
Another issue I see, with the unlocked framerate (I'm using a 120hz monitor), is that framerate is much better than vanilla 30fps, obviously, and actually It runs at 120fps, but is not completly smooth and it's 'jittering'. I've tried various settings in Nvidia control panel and in the .ini files (vsync on/off, fixed framerate/gsync, setting my monitor to 60hz...), but nohing chance, it is still 'jittering'. It's most noticiable with backgrounds. Is there ant way to fix It? Maybe this issue is some engine limitation.
Thanks in advance.
- Ace Antilles
- Posts: 7706
- Joined: Sat Jan 22, 2000 12:01 am
- Contact:
Use hooks.ini for custom settings
-
- Posts: 20
- Joined: Mon Jun 06, 2011 3:15 pm
Yeah, I checked that hooks.ini file, and the only setting I saw about framerate is vsync, but It doesn't fix the 'jittering'.
Also, I don't see inside hooks.ini the ExplosionAnimationTimeFrame setting. I will check It again when I get home.
Also, I don't see inside hooks.ini the ExplosionAnimationTimeFrame setting. I will check It again when I get home.
- JeremyaFr
- Posts: 3840
- Joined: Mon Jan 18, 2010 5:52 pm
- Contact:
WIP
Hello,
Here is a WIP version of the time hook.
When pressing Ctrl+Q, you can toggle increasing time speed.
Download:
Hello,
Here is a WIP version of the time hook.
When pressing Ctrl+Q, you can toggle increasing time speed.
Download:
You do not have the required permissions to view the files attached to this post.