S.T.A.L.K.E.R.: Call of Pripyat

S.T.A.L.K.E.R.: Call of Pripyat

Konk Apr 20, 2024 @ 3:20pm
make the game use entire CPU?
running the Gunslinger mod, notice that my cpu usage is super low at like 15% and the game is stuttering all over. pretty sure its only using one core, is there a way to make the game use all 8 of my cpu cores?
< >
Showing 1-15 of 16 comments
arottweiler Apr 20, 2024 @ 3:41pm 
Run Task Manager while playing the game and when it stutters exit the game to view the CPU utilisation to confirm what cores are being used. I can't remember which game it was but I had the same issue of only one core being used despite it maxing out while the other cores were on 0% utilisation and I did something that enabled all of the cores so the utilisation was spread. I'll try to remember what I did but whatever it was it was done via Task Manager so I didn't need to change anything in the BIOS or msconfig. I seem to remember it involved enabling something and then disabling it. Possibly Affinity but not sure and don't have access to my PC to check.
vlad[54rus] Apr 20, 2024 @ 8:17pm 
Nope, the game is strictly single-threaded.
Moving to OpenXray engine can give some improvements, but the porting project is still in alpha stage.
Cannibal Holiday May 9, 2024 @ 1:29am 
You can always use Process Lasso to make sure the game runs on one of the performance cores. That helps with some single-thread CPU-bound games.
arottweiler Sep 26, 2024 @ 9:33pm 
I've been looking for ways of optimising the game and remembered how to make it use more than one CPU core so am sharing it here. This fix load balances the game over all cores leading to a big performance increase.

Open Task Manager, select the Options tab and ensure there is a tick next to 'Always On Top'.

Click on the Details tab of Task Manager.

You can now launch the game and after a few seconds you will see xrEngine.exe appear in the list in the Task Manager Details window.

Right click xrEngine and hopefully you will see a tab called ' set affinity'. Select this and you will see all of your cores listed. Uncheck the box next to core 0 and then re-check the same box. You don't even need to close it in-between, Just uncheck, recheck and the game will start running on all cores from that moment onwards.

That's all there is to it. Remove the tick next to core 0 and then add the tick again.

I'm testing it now and it works but the only downside is having to manually do it every time. If I can find a way to automate it I'll post it here.

*Remember you need to right click exEngine.exe in the Details tab NOT the processes tab of Task Manager*

There should also be a tab called 'Priority' when you right click xrEngine.exe and it's probably set to 'Normal'. You can set it to 'High' to give more priority to running the game compared to other system tasks.

https://steamcommunity.com/sharedfiles/filedetails/?id=3338491437
Last edited by arottweiler; Sep 26, 2024 @ 9:42pm
Ayyoue Sep 27, 2024 @ 4:05am 
Having multiple threads/cores won't matter much. You're probably doing something else wrong with your game configs.

Originally posted by arottweiler:
I'm testing it now and it works but the only downside is having to manually do it every time.
Just complementing with this, which solves the quoted issue:
https://answers.microsoft.com/en-us/windows/forum/all/how-to-permanently-set-priority-affinity-with/4e83fd39-34a7-49fe-a54a-ee891c38b737
arottweiler Sep 27, 2024 @ 9:07am 
Originally posted by Tiago:
Having multiple threads/cores won't matter much. You're probably doing something else wrong with your game configs.

Originally posted by arottweiler:
I'm testing it now and it works but the only downside is having to manually do it every time.
Just complementing with this, which solves the quoted issue:
https://answers.microsoft.com/en-us/windows/forum/all/how-to-permanently-set-priority-affinity-with/4e83fd39-34a7-49fe-a54a-ee891c38b737

It's due to older games only using one CPU core even when multiple cores are installed but the permanent fix in that guide works. It took a while to work out the hex code for utilising cores 0,1,2 and 3 but I worked out the code is F0.

Right click on Stalker-Cop.exe in the main stalker folder and create a shortcut. Then right click on the shortcut and select properties.
Paste the below in to the target box, save it and when you launch the game using that shortcut it will always use all four CPU cores with a high priority:

%ComSpec% /C Start /High /affinity F0 Stalker-COP.exe
vlad[54rus] Sep 28, 2024 @ 12:56am 
STALKER games are a special case - the developers specifically made it so that the main game thread gets locked to the first CPU core (source code[github.com]). Their intention behind this is unknown.
Last edited by vlad[54rus]; Sep 28, 2024 @ 12:57am
Ayyoue Sep 28, 2024 @ 2:30am 
Originally posted by vlad54rus:
STALKER games are a special case - the developers specifically made it so that the main game thread gets locked to the first CPU core (source code[github.com]). Their intention behind this is unknown.
Most games are like this. Specially one that came out in 2009.

Recently, more and more developers are taking into account the multiple number of cores.

it's not a "mystery". It's just easier to make a game for a single core.
Last edited by Ayyoue; Sep 28, 2024 @ 2:48am
vlad[54rus] Sep 28, 2024 @ 3:00am 
Originally posted by Tiago:
Originally posted by vlad54rus:
STALKER games are a special case - the developers specifically made it so that the main game thread gets locked to the first CPU core (source code[github.com]). Their intention behind this is unknown.
Most games are like this. Specially one that came out in 2009.

Recently, more and more developers are taking in account the multiple number of cores.

it's not a "mystery". It's just easier to make a game for a single core.
"locking thread to core #1" and "not taking in account the multiple number of cores" are two different things. Other games do not lock thread to cores and instead let OS decide which core to assign to. Out of all my old games - STALKER are the only ones which have this behavior. Look at the source code I linked earlier.
Last edited by vlad[54rus]; Sep 28, 2024 @ 3:03am
arottweiler Sep 28, 2024 @ 6:18pm 
Originally posted by vlad54rus:
STALKER games are a special case - the developers specifically made it so that the main game thread gets locked to the first CPU core (source code[github.com]). Their intention behind this is unknown.

Thanks for the info. Strange how it's got that in the code and this is listed in the CoP readme file:

----
Dual Core and Performance
S.T.A.L.K.E.R.: Call of Pripyat should utilize your dual and quad core processor natively and automatically. Running a dual or quad core processor is one of the best ways to improve performance.
----

I've been reading about when SetThreadAffinityMask would be useful and it seems like something a game should leave well alone. I've noticed the shortcut I created isn't working as I thought it was and it's probably because that SetThreadAffinityMask is overriding what I set in the shortcut. It seems the only reliable way is via Task Manager because it's after the xrEngine.exe has launched so SetThreadAffinityMask can no longer override changes.

I'll see if I can decompile xrEngine.exe to remove that line and re-compile it again although I'm sure if it was that easy someone would have done it by now. I can read it in Notepad++ and see the line 'SetThreadAffinityMask' but editing it there would break it and I've never decompiled an .exe before so will need to find a utility to use.
Last edited by arottweiler; Sep 28, 2024 @ 6:18pm
vlad[54rus] Sep 28, 2024 @ 10:42pm 
Originally posted by arottweiler:
I'll see if I can decompile xrEngine.exe to remove that line and re-compile it again although I'm sure if it was that easy someone would have done it by now. I can read it in Notepad++ and see the line 'SetThreadAffinityMask' but editing it there would break it and I've never decompiled an .exe before so will need to find a utility to use.
In vanilla CoP SetThreadAffinityMask is being called in xrEngine.exe at offset 9135, go here with a hex editor and replace bytes FF 15 D4 F0 46 00 with 90 90 90 90 90 90.
arottweiler Oct 10, 2024 @ 5:17pm 
Originally posted by vlad54rus:
Originally posted by arottweiler:
I'll see if I can decompile xrEngine.exe to remove that line and re-compile it again although I'm sure if it was that easy someone would have done it by now. I can read it in Notepad++ and see the line 'SetThreadAffinityMask' but editing it there would break it and I've never decompiled an .exe before so will need to find a utility to use.
In vanilla CoP SetThreadAffinityMask is being called in xrEngine.exe at offset 9135, go here with a hex editor and replace bytes FF 15 D4 F0 46 00 with 90 90 90 90 90 90.

Thanks very much for the advice. I've created a duplicate xrEngine.exe to test with and opened it with HxD. When I go to offset 9135 I see something different so am not sure how to proceed.

AE 46 F7 27 2D 9A 9C A2 31 BE 50

https://steamcommunity.com/sharedfiles/filedetails/?id=3346563620
vlad[54rus] Oct 11, 2024 @ 4:52am 
Originally posted by arottweiler:
Originally posted by vlad54rus:
In vanilla CoP SetThreadAffinityMask is being called in xrEngine.exe at offset 9135, go here with a hex editor and replace bytes FF 15 D4 F0 46 00 with 90 90 90 90 90 90.

Thanks very much for the advice. I've created a duplicate xrEngine.exe to test with and opened it with HxD. When I go to offset 9135 I see something different so am not sure how to proceed.

AE 46 F7 27 2D 9A 9C A2 31 BE 50

https://steamcommunity.com/sharedfiles/filedetails/?id=3346563620
What is your version of the game? Retail? GOG? Modded?
Do a search for a hex value FF 15 D4 F0 46 00, there should be only one result.
arottweiler Oct 12, 2024 @ 6:15pm 
Originally posted by vlad54rus:
Originally posted by arottweiler:

Thanks very much for the advice. I've created a duplicate xrEngine.exe to test with and opened it with HxD. When I go to offset 9135 I see something different so am not sure how to proceed.

AE 46 F7 27 2D 9A 9C A2 31 BE 50

https://steamcommunity.com/sharedfiles/filedetails/?id=3346563620
What is your version of the game? Retail? GOG? Modded?
Do a search for a hex value FF 15 D4 F0 46 00, there should be only one result.

Sorry I should have mentioned I've tried searching for FF 15 D4 F0 46 00 but not finding anything listed. I'll keep looking because I've not used HxD before so still getting used to it. Is there a modified file I can download? I'm using the retail disk version of CoP and the xrEngine.exe file from the bin folder.
vlad[54rus] Oct 12, 2024 @ 10:11pm 
Originally posted by arottweiler:
Originally posted by vlad54rus:
What is your version of the game? Retail? GOG? Modded?
Do a search for a hex value FF 15 D4 F0 46 00, there should be only one result.

Sorry I should have mentioned I've tried searching for FF 15 D4 F0 46 00 but not finding anything listed. I'll keep looking because I've not used HxD before so still getting used to it. Is there a modified file I can download? I'm using the retail disk version of CoP and the xrEngine.exe file from the bin folder.
Retail exes are protected by SecuROM so patching them isn't feasible.
Here you can grab patched exe, based on the GOG version: https://drive.google.com/file/d/14KH5X07d4fNPncysQSOsJ2QXByKXtZ-k
< >
Showing 1-15 of 16 comments
Per page: 1530 50