Setting CPU2 Affinity for StarCitizen.exe

marcsand2

Space Marshal
Staff member
Officer
Donor
Mar 15, 2016
7,007
22,018
3,025
RSI Handle
marcsand2
I also have Windows 10 ;)
- start command prompt as administrator (press windows, type cmd, right click on command prompt, select: run as administrator)
- go to location of your "StarAffinity.ps1" and "'start_sc.bat" (should be in same location)
- start task manager
- start star citizen launcher, login etc
- launch game
- check in task manager -> processes if StarCitizen.exe is running (during launch it can change to "Star Citizen (2)")
- go to command prompt, type start.sc.bat
- result should be: (forget the: start_sc.exe :oops:)
upload_2016-5-9_0-15-54.png

- if not, then the fault will be shown in red
 
  • Like
Reactions: AstroSam

Stoutman

Space Marshal
May 1, 2016
768
1,446
2,350
RSI Handle
Stoutman
I did try this on my win10 and was having permission issues so the affinity didn't get reset as the powershell command failed to be run.

I spent a couple hours on it but didn't find the correct permissions settings needed.
 
  • Like
Reactions: AstroSam

marcsand2

Space Marshal
Staff member
Officer
Donor
Mar 15, 2016
7,007
22,018
3,025
RSI Handle
marcsand2
did you run cmd as administrator?
- press Windows key
- type cmd, cmd.exe wil show up in the found list
- press cmd.exe with your right mouse button, a dropdown will apear
- select Run as Administrator
 
  • Like
Reactions: AstroSam

AstroSam

Barrista
Mar 8, 2016
5,884
19,636
1,525
RSI Handle
AstroSam
Man, this should be a sticky thread!

Fact is: during loading phase of the basic application CPU No.#6 is loaded 100%, when you are loading the miniPU CPU No.#2 is loaded 100% - whereas the other cores are used at max. 60% I'd say.

I executed Stoutmans small scripts - and the usage of all CPU cores now is even!

Perhaps a little bit more simple written:

Step #01:
- open notepad
- copy the lines
$Process = Get-Process StarCitizen
$Process.ProcessorAffinity = 251
$Process.ProcessorAffinity = 255
into it​
- save file as StarAffinity.ps1 into your Cloud Imperium Games directory (for instance C:\Program Files\Cloud Imperium Games)


Step #02:
- open notepad
- copy the line
powershell.exe -ExecutionPolicy Bypass -file StarAffinity.ps1
into it​
- save file as start_sc.bat into your Cloud Imperium Games directory


Step #03:

- start cmd.exe as Administrator (press Windows key, type "cmd", right click on appearing application "cmd" ("command prompt") and start it as Administrator)
- navigate to CIG directory (for instance: cd C:\Program Files\Cloud Imperium Games)

- start Star Citizen Launcher; login; launch game

- once being in main menu, use Alt+Tab to go back to the cmd-window
- type start_sc.bat



This doesn't help to rise the fps. But it lowers the CPU usage of one single core and therefore lowers the temperature in your rig.
 
  • Like
Reactions: marcsand2

marcsand2

Space Marshal
Staff member
Officer
Donor
Mar 15, 2016
7,007
22,018
3,025
RSI Handle
marcsand2
Step #01:
- open notepad
- copy the lines
$Process = Get-Process StarCitizen
$Process.ProcessorAffinity = 251
$Process.ProcessorAffinity = 255
into it- save file as StarAffinity.ps1 into your Cloud Imperium Games directory (for instance C:\Program Files\Cloud Imperium Games)


Step #02:
- open notepad
- copy the line
powershell.exe -ExecutionPolicy Bypass -file StarAffinity.ps1into it- save file as start_sc.bat into your Cloud Imperium Games directory
If you want to save both files directly in C:\Program Files\Cloud Imperium Games, then you must start notepad also as Administrator (press Windows key, type "notepad", right click on appearing application "notepad.exe" and start it as Administrator)
 

RedLir

Vice Admiral
Donor
Feb 16, 2016
205
601
450
RSI Handle
RedLir
I've been doing this for quite some time. I run a 6 core Intel 5820, so I essentially toggle the affinity to the first core (core 0 in task manager) and back to all cores.
In my case the binary to decimal value for 12 core ( 6 + hyperthreading ) is 4095 not 255

Code:
PowerShell "Get-Process StarCitizen | Select-Object ProcessorAffinity"
PowerShell "$Process = Get-Process StarCitizen; $Process.ProcessorAffinity=1"
PowerShell "$Process = Get-Process StarCitizen; $Process.ProcessorAffinity=4095"
Keep in mind the final $Process.ProcessorAffinity value should match the binary value for all cores ( virtual ).
If for example you use 255 on an Intel 5820 , you would essentially tell SC not to run on 4 of the 12 cores at all, which is probably not what you're after.

Each virtual core you have is a binary column, then just convert to decimal to figure out the value.


Binary = Decimal

1111 = 15 ( 4 core Intel I5 no hyperthreading)
1111 1111 = 255 ( 4 core I7, 8 virtual cores with hyperthreading)
1111 1111 1111 = 4095 ( 6 core I7,12 virtual cores with hyperthreading)
etc


To get around the permissions issue, I create a shortcut to the batch file, and then set the shortcut to run as administrator. There is no option for this directly on a batch file. I start the game, alt tab and just run the shortcut.


 
Last edited:

DeepDrum

Captain
Jun 27, 2016
300
626
200
RSI Handle
DeepDrum
Interesting. That got me from this:



To this:



I also noticerd as a byproduct of all these posts while looking at Marcs pics, my cpu virtualization was turned off.
Rectified.
Thanks for these types of posts. This one had merit for sure...I think. ;)
 
  • Like
Reactions: marcsand2

DeepDrum

Captain
Jun 27, 2016
300
626
200
RSI Handle
DeepDrum
It was interesting to see that it was using 8.6 Gig of ram at the time of the tests.
16 Gig seems like a pretty necessary thing.
 
  • Like
Reactions: marcsand2

DeepDrum

Captain
Jun 27, 2016
300
626
200
RSI Handle
DeepDrum
So do I need it for just windows use or not?
I just torture tested in SC for 3 hrs with no loss of functionality since I did the other fix in the OP post.
Since 2.4, I haven't even been able to get an hour in without losing radar for everything but the targetted ship.
It is soo much better now.
Arena Commander is much improved as well. FPS is near unchanged or a bit less. It behaves much better.
It gives us hope. Thanks.
 
  • Like
Reactions: marcsand2

marcsand2

Space Marshal
Staff member
Officer
Donor
Mar 15, 2016
7,007
22,018
3,025
RSI Handle
marcsand2
  • Like
Reactions: DeepDrum

marcsand2

Space Marshal
Staff member
Officer
Donor
Mar 15, 2016
7,007
22,018
3,025
RSI Handle
marcsand2
So, it would be possible to make a batch file to start SC and run the CPU file with one click, right?
It would be tricky, the batch file could start your launcher, but you still must enter your password and hit the launch game button.When SC is started the CPU affinity can be modified but will not be stored.

This link sugests that it will be a permanent solution, but I didn't tried it.
 

DeepDrum

Captain
Jun 27, 2016
300
626
200
RSI Handle
DeepDrum
  • Like
Reactions: marcsand2

thanatos73

Space Marshal
Nov 21, 2014
1,376
1,412
2,510
RSI Handle
thanatos1973
Well, the batch files didn't work for me, so I tried the Process Lasso program, and it worked. Plus, it keeps the config, so no monkeying with it when ever I want to play.

I was at work when I first posted this, but here is the link for Process Lasso
https://bitsum.com/
 
Last edited:

smeggy

Space Marshal
Aug 28, 2015
172
439
2,300
RSI Handle
sm3ggy
Thank you @Stoutman, this helps.
I'm currently waiting for the newest version of VisualStudio to download so I can write a basic launcher executable for this.
 

DeepDrum

Captain
Jun 27, 2016
300
626
200
RSI Handle
DeepDrum
Well, the batch files didn't work for me, so I tried the Process Lasso program, and it worked. Plus, it keeps the config, so no monkeying with it when ever I want to play.

I was at work when I first posted this, but here is the link for Process Lasso
https://bitsum.com/
Interesting and informative
 
  • Like
Reactions: marcsand2
Forgot your password?