Need for Speed: Hot Pursuit

Need for Speed: Hot Pursuit

Ocen: 172
Reduce Stuttering, Tweaking CPU Cores & Hyper-Threading
Autorzy: Lars i 1 innych współtwórców
Severe frame rate stuttering despite playing this on a good, modern pc? I might have the solution for you.
   
Przyznaj nagrodę
Ulubione
Ulubione
Usuń z ulubionych
Introduction

FAIRLY IMPORTANT WARNING:

Messing with CPU affinities can possibly negatively affect your PC's performance and stability, follow the guide at your own risk.


Still here? Let's begin!

Need for Speed: Hot Pursuit is by now old enough that most PC's should be able to run it flawlessly. Unfortunately the game was not optimized for multi core CPU's, and this can cause problems like crash to desktop, freezes or in my case, severe cases of frame rate stuttering.

The reason for this is that (at least on my PC), the game will try to load all its processing needs to the first core on my processor. Now, I have a decently fast CPU (I7 3770 @3.40 GHz), but it is designed to evenly distribute tasks to all the eight cores (4 physical, 4 simulated or 'Hyper-Threaded') it runs on. Each individual core is not powerful enough to run a game such as NFS:HP smoothly on its own. So when the game then dumps all the work on the first core, severe stuttering and freezes while playing starts occurring.

I found the solution to be to manually prevent the game from using the first core, which then made the game use all the remaining ones evenly and as a result removed the stuttering issue completely.

By the looks of it I am not the only one having these problems, so I decided to do a guide with the goal of helping you manage processor core managing yourself so the game will run as smoothly as it should. Fair warning, I am not an IT wizard so some things here may not be explained as well as they should be, consider this an 'Idiot's guide to CPU core affinities'.
Method 1: The temporary solution.
This method is the simplest one, but unfortunately also has to be manually applied each time you play the game.

First things first, we need to find out how your CPU cores are working while the game is running.



Step one: How to see how your CPU is running Hot Pursuit:

  1. Launch the game normally.
  2. Once it is running, go to your Task Manager by hitting keyboard shortcut 'Ctrl+Shift+Esc'.
  3. Click the 'Performance' Tab and click 'Launch Resource Monitor'
  4. In the Resource Monitor, click the 'CPU' Tab, and tick off the box next to NFS11.exe
  5. Examine the core usage to the right. If you see the first core completely maxed out and all the others running at near zero load, we got a problem. If all your cores are working and none look completely maxed out, this guide will probably not help you at all, sorry.



Step two: Fixing ♥♥♥♥.

  1. Go back to Task Manager, it should still be open from earlier, if not use keyboard shortcut 'Ctrl+Shift+Esc' again.
  2. Click the 'Details' Tab.
  3. Rightclick NFS11.exe and click 'Set Affinity'
  4. You should see a window with all your cores displayed with boxes ticked off, indicating the game is set to use all the available cores on your CPU.
  5. Untick the box next to the processor core you saw max out in Resource Monitor (Most likely Core 0) and leave the rest on. Core 0 is actually your first core but it's called 0 BECAUSE COMPUTERS.
  6. If you look at 'Resource Monitor' again like we did before, hopefully you will see that the other cores are working now. Or you can just play the game and see if its fixed.



Step three: Profit!

If doing these steps has resulted in a much smoother running game of Hot Pursuit, GREAT! Unfortunately if we use this method, you will have to set CPU core affinity manually from the Task Manager every single time you play the game, because for some reason Windows doesn't let you save these settings by default. If you don't mind taking a few seconds to perform these steps every time you play the game, then we are done here, off you go, enjoy the game!

If however you wish to read about how we can set CPU core affinities automatically each time we play Hot Pursuit (or any other game), continue on to Method 2 and Method 3.

Updated! - Method 2: The shortcut.
What is it?


This method involves using what we learned from Method 1 in a windows short cut we will make for Hot Pursuit which will launch the game with a command line which specifically tells it which cores to use. While this is going to get VERY technical, it is the ideal solution since it will automatically set core affinity each time you play the game without having to use the Task Manager, and it avoids having to install extra programs (which we will cover in Method 3). There's just one problem... I can not for the life of me get it to actually work. For the sake of completeness I will still cover it just in case you can get it to work. Oh and PLEASE tell me how you got it to work, if you do.

This section is updated with a solution posted by Steam user ghuuuu, which helped me run this game from a bat file that automatically does the required CPU core disabling! The following is his elegant way of doing it, and I will keep my own initial content below in case it can be of help to others, as well.


Ghuuuu's method!

I know, that I am very late in posting this. But I made a good fix for method 2 which is easy and automated! I found out that we can't run the game from cmd. So here is how we work around it.

1. Go to your game folder and make a shortcut of "nfs11.exe" in that same folder and name it "NFSHP".

2. Open notepad and copy&paste the script below. Keep in mind to point the script to the shortcut in the game folder, and read the note below for what value you should put in ProcessorAffinity.

@echo off title NFS Hot Pursuit start "NFSHP" "D:\Steam\Steamapps\Common\Need for Speed Hot Pursuit\NFSHP.lnk" timeout /t 20 /nobreak PowerShell "Get-Process nfs11 | Select-Object ProcessorAffinity" PowerShell "$Process = Get-Process nfs11; $Process.ProcessorAffinity= 254 "

3. Save the file as 'NFS Hot Pursuit.bat' and under Save as type choose 'All files'.

4. Run bat file to play game! In 20 seconds, the script will set the affinity of the game.

ENJOY!

NOTE: The value for the ProcessorAffinity depends on how many cores you have:

Core 1 = 1 = 000000000001 Core 2 = 2 = 000000000010 Core 3 = 4 = 000000000100 Core 4 = 8 = 000000001000 Core 5 = 16 = 000000010000 Core 6 = 32 = 000000100000 Core 7 = 64 = 000001000000 Core 8 = 128 = 000010000000 Core 9 = 256 = 000100000000 Core 10 = 512 = 001000000000 Core 11 = 1024 = 010000000000 Core 12 = 2048 = 100000000000

Add the numbers in the middle for the cores you want to use. As we learnt from method 2 above, core 1 (which is 0) should not be used. Therefore as an example:

Those with 8 core CPU should add up the numbers for core 2 to 8, which adds up to 254.
Those with 12 core CPU should add up the numbers for core 2 to 12, which adds up to 4094.

This method works for me, let me know if it works for you guys or nobody is playing this game already. Cheers!

If you want a pretty shortcut on your desktop instead of the .bat file, you can make a shortcut to the bat file and change the name and icon of it, and put the .bat file in the game folder as well to keep it hidden away!



I want to try it anyway, what do I do ?

Before you start I strongly advise doing Method 1. First, because if that one doesn't work this won't help you either, and second, you still need to know which CPU core is overloaded which is explained there. This will get fairly complicated, so make sure you take it slow and follow each step carefully!


The Hexadecimal conundrum:

Before you do anything, you need to know how many cores your CPU has. If 'Set Affinity' in Task Manager shows a window with cores 0 - 7, that means your CPU has eight cores. If it shows you cores 0 - 11, then you have 12, and so forth.

Now this is where things get a bit wild!

We are going to make a binary number for our processor cores with one digit for each core. 4 digits on a 4 core processor, 8 digits if you have 8 cores etc.

We'll give each digit a value, where 0 (off) represents a disabled core, and 1 (on) is an enabled core.

The first number from the left is your last processor core, and the last number to the right is your first processor core.

In my case, if I want a binary number for my eight core processor with all the cores enabled, it will look like this: 11111111.

This is all well and good, but from what we learned in Method 1, we found that I had to disable core 0 to make the game run smoothly so I will have to change my last digit to a 0, to turn that core off.

It will look like this: 11111110. If instead you have a 12 core processor and need to disable the first one, your binary number will be 111111111110.

Now, open a web browser and go to: http://www.mathsisfun.com/binary-decimal-hexadecimal-converter.html

In the Binary field, enter your binary number. Again, mine is 11111110 but yours may look different.

This will return a Hexadecimal value, which is at long last what we are going to use in our windows shortcut. For me, with my binary number 11111110, the Hexadecimal value I have to use will be FE.



Hex YOURSELF! I thought this was going to be about a short cut?

Yep, told you this was going to get complicated! But now, armed with our mighty Hexadecimal we finally have everything we need for our Hot Pursuit shortcut. If you got this far, this next bit is easy, except, well, I can't make it actually work. But maybe it will for you?

Make a windows shortcut, for example by right clicking your desktop and clicking New->Short cut.
In the target line, we are going to launch cmd.exe (oldschool command line prompt if you will), tell it to launch Hot Pursuit, and finally tell it which processor cores it can use.

For me, that target line is going to look like this:
C:\Windows\System32\cmd.exe /c start "NFS11.exe" /affinity FE "E:\Steam\Steamapps\Common\Need for Speed Hot Pursuit\NFS11.exe"

You will have to make sure you have the path shown there pointing to where you have Hot Pursuit installed, and replace my /affinity FE parameter with the hexadecimal value you have from the steps above.

Name the shortcut whatever you like, maybe give it a nice icon, then run it. If everything is working the game will launch. Head back to the Task Manager, Details tab, right click NFS11.exe and look at 'Set Affinities' yet again. If the shortcut worked for you, it should have unticked the core you need disabled already thanks to the /affinity parameter. This doesn't work for me. If works for you, tell me how. Please?

If this didn't work for you either and you really want to not have to set core affinity manually every time you play the game, there's still hope! Method 3 is going to cover using third party programs to manage application core affinities for us!
Method 3: Using Applications to manage CPU affinities.
Before you start:

In this section I'll talk about using an application to set permanent CPU core affinities for your game. There are pros and cons to this method, and before we go further I want to just have it said that I do not consider this to be an optimal solution.

The reason for this is that, generally speaking, the more applications you install on a PC the worse it will perform. You will have to consider if its worth the extra boot time and memory use to install another program just to play Hot Pursuit smoothly.

On the bright side, it works, and for the record I am using this program myself. Not 100% happy about it, but it does the job for me.

Presenting: Process Lasso

Get it at: https://bitsum.com/processlasso/

This is a feature rich supplement to the Task Manager you'll already be familiar with if you've followed the guide so far. It can do a lot of things for you, none of which I will go into except the part we're going to be using it for. The first thing you'll notice is that this not freeware. Many of the functions of the program will be disabled after a while unless you purchase the pro license. However from what I can tell so far after a couple weeks of running this, the saved CPU affinities option is not disabled. The program is also kind enough to not nag you all the time about purchasing the upgrade. All we need this program for is covered in the Free version. There is of course no guarantee that the developers won't change that at some point.

How to use it:

Download, install and run the application. Consider if you want Lasso to launch on boot up. If you want to run it manually instead it can be set under Options->General Settings->Reconfigure the way Process Lasso Starts.

Once you're up and running, launch Need For Speed Hot Pursuit normally, then Alt+Tab back to Lasso and look at the Active Processes tab in the main window.

Rightclick NFS11.exe and select 'CPU Affinity (limit CPU use)', then 'Always'. Here you need to untick the core you need disabled as explained under 'Method 1, step one'.

DONE!

From now on, as long as you have Lasso running, when you launch Hot Pursuit it will automatically disable core 0 as required! This application can of course also be used for any number of other games and applications that struggle with using your CPU cores correctly.

And that about wraps up this guide! I hope it has been helpful to you if you've been having problems with the game randomly stuttering, especially if my guide here helped you solve the issue!
The Hyper-threading option!
It recently came to my attention that there is another thing you can do that can also remove stuttering for Hot Pursuit, and some other games. To do this you will need to find your way to the boot menu BIOS configuration screen, typically accomplished by hitting a function key repeatedly while your PC is starting up. The exact key to use varies from computer to computer but it will usually be in the F8-F12 range.

Once you are there, look for mention of core threading or hyper-threading, and disable it, then save and exit the BIOS setup and try running the game again once your OS has booted up normally.

Provided you don't disable anything else in the BIOS setup, this is safe to do, but it will affect your PC's performance more drastically than the core affinity route. You will most likely notice that your PC handles multi tasking with many windows and programs running at once worse than before if you disable Hyper-threading.

Many games are optimized for Hyper-threading, and these will also perform worse while it is disabled. Still, if going the other route with disabling a core manually with affinities didn't work out for you, then this is another thing you can try.
Credits and acknowledgements
Written by, well, me.

Big thanks to Steam user ghuuuu @ http://steamcommunity.com/profiles/76561197967813863 for providing an elegant solution to Method 2, setting affinities with a shortcut!
Big thanks to www.eightforums.com for their tutorials.
Thanks to Criterion for making this game.
Thanks to EA for keeping the servers running still.
Big thanks to everyone still playing this game and keeping it alive.
Fist bumps to Stan and Dagor for helping me correct errors in the guide!

If the readers have feedback, spot errors or have any other thoughts about this guide you are all more than welcome to leave a comment below. :)
Komentarzy: 84
hexaae 20 maja 2022 o 19:23 
There is also a simpler permanent fix patching the game exe:
https://steamcommunity.com/sharedfiles/filedetails/?id=639283716
Amon 14 listopada 2020 o 13:32 
Tnx for this mate, remastered has the same problem, but this fixed the problem. Tnx again!!
Lars  [autor] 15 października 2020 o 9:36 
Thanks for the info! Hopefully with the remaster we won't have to worry about this nonsense.
TechXPlays 14 października 2020 o 20:41 
I've come to realize that simply just setting it to 0123 cores in Set Affinity seems to be the best option that always works, but there's also a CPU Emulator I found on Github that if you use that, it makes the stuttering non-existent
Lars  [autor] 27 czerwca 2020 o 13:42 
Happy to help!
veloxSZ 27 czerwca 2020 o 4:54 
Thank you! Process Lasso worked just fine, now i can properly enjoy this game! :woodlehappy:
Lars  [autor] 7 czerwca 2020 o 14:43 
Glad so many have found this helpful. Unfortunately I have no experience with Linux, Anwar.
Uganda be kidding me! 7 czerwca 2020 o 14:35 
God bless you, author of this guide
buby 6 czerwca 2020 o 0:37 
How do I do this when running the game on Linux (with Proton)?
GranTurismo97 8 lutego 2020 o 21:24 
Hello everyone, I would just like to add yet another thing to consider trying, especially if you have a dual core processor and the "set affinity" option doesn't really help much...

1. Just like it is posted above in the article, start the game normally (let it load up all the way).
2. Alt-Tab your way back to the desktop.
3. Ctrl-Shift-Esc your way into Task Manager.
4. Click on the Details tab and locate NFS11.EXE in the list.
5. Right click it, then hover over Set Priority and choose Realtime or High.
6. Click "Change Priority" on the window that pops up.

Now Alt-Tab back into the game and try it. For me, that alone made a world of difference, stuttering pretty much entirely gone.

If you want to go all out, before the Set Priority procedure, perform a Set Affinity, disable CPU 0, click OK, then do it again and turn all CPUs back on, click OK again.

Worked great for me in this game and NFS Most Wanted 2012. I hope it helps someone else, too!