2.15.2011

Multi-Core Cpu Architecture and WoW / Lag and Graphical tweaks

The TLDR version of this guide

Also, as a little side note. If you decide to edit your config file you obviously need to open it. Right click on it, click open with, and open it in notepad, word, or any other text editor. 



Updated for 4.0:
They changed wow in 3.1 to run on more processor threads. Originally it was running on 2 main threads with several smaller threads handling simpler tasks. As of 3.1 there are now 3 main threads, and many more smaller threads. This means that forcing wow to run over all 3 cores may prove more beneficial then having it run over only 2 cores, as now you can"force" it to use all of the available cores.


If you want more information on what exactly setting the masks values does, and how it works, look in the CPU stuff section of the article.

These are the new recommended affinity mask values taking into account three available cores:

Intel:
i7 Qudcore with Ht- 84
i5 Quadcore which does not have HT - 14
i5 Dualcore with HT- 5 (note - wow will default run over both availabile processors in dual core systems - no gain may be experienced)
Dualcore with HT- 5 (note - wow will default run over both availabile processors in dual core systems - no gain may be experienced)
Dualcore without HT - 3 (note - wow will default run over both availabile processors in dual core systems - no gain may be experienced)
I7 - Hex core (6 logical / 6 virtual) - 1344


AMD:
AMD tricore - 7
AMD quad core ( Phenom series ) - 14
AMD hex core - 56




TCPAckFrequency portion of the latency fixes can be done manually or by using the Leatrix utility. Look at the bottom of this post for the steps or download Leatrix's Latency fix from WoWInterface. Its verified to work, and does exactly what the manual steps illustrated below will do. I have examined his code myself, it's visual basic, and it emulates the exact functionality that I go over in this thread. If you're lazy and like using apps, try his. If you prefer to learn and do things yourself, take a look at the lag stuff portion of the article.

However, the Leatrix tool will not be able to to the TCPNoDelay tweak, that one must be done on your own. As mentioned, the steps are listed below.


CPU STUFF

The CVAR value which controls what cores wow ill run over is SET processAffinityMask ""

If fore whatever reason this is missing from your config file you can manually add it, by copying and pasting it from above. In between the quotes is where the number for the mask value goes. For example, SET processAffinityMask "84"

This should clear up any confusion some people were having. 


I recently have been toying around with assigning certain running processes on my computer to certain cores on my PC via Affinity I/O controls. I have an Intel i7 quad core. I know a lot of people use this processor, and a few others use AMD phenom cores. In any event whether you use dual core, quad core, or hexcore the following information pertains to you.

Config.wtf is located in the WoW/WTF game folder. Contained in this file is CVAR's a.k.a console variables or in some cases referred to as configurable variables. These variables allow you to manipulate program settings often found in games and other applications. I used to edit this config file a lot in the past to manipulate camera settings but never really paid much attention to the CVAR's. There is a ton of variables that can be changed and manipulated within this file, but for the purpose of this write up we will only talk about AffinityMask CVAR.


WoW is a threaded application meaning it can take advantage of more than 1 single core. However, no matter how many cores you have, WoW cannot take advantage of more than 3 main threads(after patch 3.3.3). After monitoring process activity on each core, I saw that when I started WoW, core 1's activity spiked while my other cores were remaining pretty low. The majority of applications that run on my computer are not threaded meaning that for the most part they either default to core 1 or windows will dictate which core the application is processed through. Having WoW run on core 1 as well as all my other programs run on it seems counter productive as the other cores have no work load. This is the main point behind why you want to set affinity mask values. So that you can force WoW to run over less busier cores therefore reducing any type of cpu bottleneck that may occur during heavy gaming sessions.

The whole point of this is we can force WoW to run on whatever cores we want, up to 3 cores in total. We can change the Affinity CVAR value from the default which is 3. The default value of 3 has wow running over cores 1 and 2. You have to think though that this isn't really running over physical cores 1 and 2. Instead it is running over 1 physical core/ and one virtual core.See below chart I put it in quotes:

A Dual Core processor :[CORE1][CORE1Virtual][CORE2][CORE2Virtual]
Core numbers: 1 2 3 4
A Quad Core: [CORE1][CORE1Virtual][CORE2][CORE2Virtual][CORE3]
Core numbers: 1 2 3 4 5
[CORE3Virtual][CORE4][CORE4Virtual]
6 7 8


This is what is called hyper threading which basically splits each core into 2. 1 physical core and 1 virtual core. Which means that on quad cores we have a total of 8 cores. It isn't really a virtual core, but for the sake of argument we can call it that. Each core on the chip has circuitry on it that splits that core into two separate entities in software. Look up hyper threading if you want more of an explanation its to long to write out and really off topic for this.

This is also the reason the default value of 3 is not recommended. If you reference the above chart, a value of 3 has wow running over only the first core. Which means that's, even in a dual core system, the second core is not being utilized.

If you have a dual core processor with hyper threading you can stop reading here and set your CVAR value for affinity mask to 5. What this does is force wow to run over the actual hardware cores of your computer instead of having it run over 1 physical and 1 virtual. Make sense?

Dual core set your value to 5 and your done. This will force WoW to run on cores 1 and 3 which in actuality represent the 2 physical cores in a single processor w/ dual cores.

____________________________

For single processor/ quad core it becomes somewhat more complex because instead of being

[CORE1][CORE1Virtual][CORE2][CORE2Virtual]

it turns into

[CORE1][CORE1Virtual][CORE2][CORE2Virtual]
[CORE3][CORE3Virtual][CORE4][CORE4Virtual]

4 phyiscal cores / 4 threaded (virtual) cores = 8 logical cores (the chart above also shows this)



The mask/CVAR values also become more complex. See my chart below.

Logical Cores: |C1|C(v)1| |C2|C(v)2| |C3|C(v)3| |C4|C(v)4|

Core Number: | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

Mask Values: 1 2 4 8 16 32 64 128




Binary translation: We have to reverse the processor cores around since binary is read right to left, like Hebrew.


|C(v)4|C4| |C(v)3|C3| |C(v)2|C2| |C(v)1|C1|



In dual core systems setting the value to 5 would allow you to make wow run on physical core 1 and core 2, which we already went over. The default value of 3 has wow running on 1 physical core and 1 virtual core which are both parts of the same core in reality, which we also went over. In quad core systems you can set it to 5 as well like we do for dual cores, but you can also set different numbers. You want to stay away from running the game on virtual cores and run it only on 3 out of the 4 physical cores. The beauty of quad core is that we do not have to run anything on core 1, like you do with dual core processors. Core 1 is the most used core of all the 4 physical cores since it is the default core most applications run on. In my case I wanted wow to run over physical cores 2/ 3/ 4.

I typed in 80 which would be cores 3 and 4 as per the above chart, you have to add the decimal values that I listed in the chart above that correspond to the core numbers that you want to enable. Now if you convert 80 to its binary equivalent 1010000 *Remember binary is read from right to left* Now if you match up that number to the binary translation chart.

for cores 3/4 - CVAR value 80

|C(v)4|C4| |C(v)3|C3| |C(v)2|C2| |C(v)1|C1|
0 1 0 1 0 0 0 0

for cores 2/4 - CVAR value 68

|C(v)4|C4| |C(v)3|C3| |C(v)2|C2| |C(v)1|C1|
0 1 0 0 0 1 0 0

you could even have it run on cores 1/4 if you wanted with the value 65

|C(v)4|C4| |C(v)3|C3| |C(v)2|C2| |C(v)1|C1|
0 1 0 0 0 0 0 1

For most people I would recommend a value of 84. Cores 2, 3 and 4 are used virtually never.



People who have done this tweak report, in some cases, double their fps.



LAG STUFF

I have been using this for a while, and I noticed substantial results with it. If you have random lag spikes, lag all the time, or internet problems this may help you out a bit.

Its kind of old school now, but a lot of people don't seem to know about it though so figured I would include it here. Depending on your system settings it can drastically improve ping times due to TCP/ACK response times.

Basically at the root of this tweak is changing the frequency at which TCP ACKS's or acknowledgments are sent out, it also disables NAGLE. Most know that TCP/IP works with data packets, the header of the packet contains destination port information as well as source port, followed by sequence and acknowledgment numbers, data offset, and then lastly the data itself.

By default the TCPackfrequency is set to 2 in windows. Other programs that you might have installed can manipulate this number though, some network drivers for certain cards also can edit it as well. A value of 2 means that for every 2 tcp packets you computer receives an acknowledgment packet is sent. It basically tells the sending end, in the case of wow the server, that I received the data you sent me. The below reg tweak changes this value from whatever it is set to on your PC to a value of 1. It takes about a total of 2 minutes to make this change anyway, it is very simple.


TcpAckFrequency defaults to 2. At this setting, copying a
250 MB file from the server takes 45 seconds. That's not a terrible
result, but I'm just establishing a baseline.

Microsoft Windows 2003 performance guidelines recommends a setting for TCP
ACK of 13 for gigabit Ethernet. Setting TcpAckFrequency to 13 on the
client yields copy time of 20+ minutes!!

Microsoft recommends a TCP ACK setting of 5 for 10/100 networks. Setting
to 5 yields copy time of 18 minutes!!


Finally, I tried setting to TcpAckFrequency of 3. This yields copy time of
13 minutes.

In the case of wow a much higher number will generate a retarded amount of lag while a lower number should remove it.

The second part of the hack is TCP no delay. Setting this value to 1, disables the Nagle algorithm in the TCP stack. The nagle algorithm buffers up TCP packets and arranges them in a way that balances the size of the packets with the delay in sending it. It can rearrange different packets of different sizes coming from different programs on your computer and it sends out the bits and pieces that are easier to send first. It prioritizes and it also will wait for a packet to fill until sending it. Its kind of like QOS on a router, prioritizing certain pieces of data over others.

This is normally a good thing as it balances the load of a network if you have multiple PC's going at a time, and the delay is typically not noticeable with normal internet surfing etc. However, with WoW, any bit of lag is noticeable. Any bit of delay can mean the difference between living and dieing, wiping the raid or being the hero. On our level of internet usage, the TCP buffer/prioritization from nagle can affect performance. The second part of the tweak disables this. Instead of allowing Nagle to do its thing we are basically telling it, "choke and die, do not buffer the packets and wait to send them, just push them out NOW!!! NO u no u."

Here are the actual tweak steps:


-TcpAckFrequency -

Type "regedit" in windows "run.." dialog to bring up registry menu

Then find:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Tcpip\Parameters\Interfaces\

There will be multiple NIC interfaces listed in there, find the one you use to connect to the internet, there will be several interfaces listed (they have long names like{7DBA6DCA-FFE8-4002-A28F-4D2B57AE8383}. Click each one, the right one will have lots of settings in it and you will see your machines IP address listed there as one of the values.

-Right-click in the right hand pane and add a new DWORD value, name it TcpAckFrequency, then right click the entry and click Modify and assign a value of 1.

You can change it back to 2 (default) at a later stage if it affects your other TCP application performance. it tells windows how many TCP packets to wait before sending ACK. if the value is 1, windows will send ACK every time it receives a TCP package.

Again make sure you set it to 1.

- TCPNoDelay -
This one is pretty simple

Type "regedit" in windows "run.." dialog to bring up registry menu

Then find:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ\Paramet ers

Right-click in the right hand pane and add a new DWORD value, name it TCPNoDelay, then right click the entry and click Modify and assign a value of 1.

Click Ok and close the registry editor, then reboot your PC.

FOR WINDOWS VISTA/7 HOME ONLY PEOPLE:

I just want to note that the MSMQ key DOES NOT EXIST IN WINDOWS VISTA/7 HOME BY DEFAULT. If you cannot find the MSMQ key, then please do this instead:

Open up notepad and paste in the following:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ\Paramet ers]
"TCPNoDelay"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ\Paramet ers\OCMsetup]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ\Paramet ers\Security]
"SecureDSCommunication"=dword:00000000

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ\Paramet ers\setup]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSMQ\Setup]

Save the file as Lag.reg ---- Run the file, say yes to the prompt. This will automatically enter all the above reg values for you.




WINDOWS 7/VISTA STUFF

This section is dedicated to core parking. Core parking is a feature that will disable cores in real time that are not being used, as a power saving feature. The OS will then switch them back on as needed.

This poses a problem while gaming at times, because if you are out farming herbs/ore and their isn't very much graphical intensive activity going on some of the cores on your cpu may be disabled.

Lets say you then take a queue for Tol Barad, and you are shot right into the midst of angry battle. Fire is raining from the sky, green little lasers are flying at your face, and there are 25 angry alliance bum rushing your node. The OS will then flick the cores back on again.

The problem is that sometimes this process of turning the cores on and off causes noticeable video lag or screen tearing. Neither of which you want to deal with especially in pvp.

The following steps will disable this annoying feature.

Shut off Core parking:



- Go to Regedit

- Find this key:- " 0cc5b647-c1df-4637-891a-dec35c318583 "

- Within this key, there is a value called: " ValueMax "

- This value represents the % number of cores the system will park - the default 100% ie: all Cores are potentially park-able

- Change the value from 64 to 0 so the " ValueMin " and " ValueMax " are both zero

- You will have to find the key a few times and repeat the process for each time it is found - the number of instances will depend on the number of power profiles in your system

- Do a full shutdown and power-off and cold-re-start



GRAPHICAL/DX11 STUFF

If you have a graphics card that supports DX11, and are running on Vista/7, then you can potentially unlock a 20-30% gain in FPS while playing WoW by doing the following:

-Open your config.wtf file (located in ...\World of Warcraft\WTF\) with notepad.
-add the line SET gxApi "d3d11"

This will unlock experimental dx11 support for wow(full support will probably be implemented in a future patch), it made me jump from 80fps to 100fps. Not a noticeable increase to my eye.

There have been numerous articles linked in the pages that follow this guide about how many FPS the human eye can actually see. Some say 30, some say 60, some say 200. Beauty is in the eye of the beholder, and so is your sensitivity to FPS. Some of us who have a more acute sense of sight may notice the jumps in fps even at higher values like I mentioned above.

In conclusion, the above DX11 tweak is definitely beneficial, and you have absolutely nothing to lose by trying it out. You have nothing to lose by trying any of these tweaks out as all of them are completely reversible.

Thank you for reading, and please post in the thread or send me a PM if you have further questions on something written here. Feel free to recommend adding things to the guide. I will certainly try and keep up to date on any type of new tweaks, or changes in the game and update the guide with further suggestions in the future. 

32 comments:

  1. well made guide... thanks for the info

    ReplyDelete
  2. I've been reading your blog and I like it :) I'll be following for sure!

    ReplyDelete
  3. I loved wow, but cata killed it for me

    ReplyDelete
  4. Very good guide man. loved it

    ReplyDelete
  5. I've never been very good with regedit. I'm always afraid I'll break something haha.

    ReplyDelete
  6. i would like to see WoW shit its graphic platform into more modern styles. The resources needed would be crazy, but the game would be so intense.

    ReplyDelete
  7. i hope you meant shift dbar :P but yeah wow's graphics engine need's a boot now not a polishing

    ReplyDelete
  8. impressive. you should be writing pdf's for magazines.

    ReplyDelete
  9. Running on 3.1 is going to be so much nicer.

    ReplyDelete
  10. Excellent guide, thanks for the info xD

    ReplyDelete
  11. Very in-depth post which I'm sure could be applied to to other games too!
    Cheers man.

    ReplyDelete
  12. Thank you so much for this info. Very helpful

    ReplyDelete
  13. Interesting features, thank you.

    ReplyDelete
  14. awesome, as a techie, i love reading about the inner workings of wow.

    ReplyDelete
  15. Really indepth, kudos. I'mma start looking out for more of your stuff

    Consider me a follower

    ReplyDelete
  16. lol, you're real nerd. but me too, so thanks for the guide!

    ReplyDelete
  17. This guide is great. It's a shame that I stopped playing WoW after Cataclysm came out.

    ReplyDelete
  18. Wow, that was real indepth. Thanks for covering, I knew pretty much none of that.

    ReplyDelete
  19. Impressive. Cataclysm has made me want to get back into WoW for sure. Only time will tell...

    ReplyDelete
  20. Wow doesn't really have a noticeable graphic decrease when you are inbetween 30 and 60 fps. Maybe that's just because of how outdated their graphics really are.

    ReplyDelete
  21. very awesome tweaks! talk about a wall of text! i really wish i still played WoW.

    ReplyDelete
  22. Wow, you'd think these new pc's would be able to pump WoW at max settings.

    ReplyDelete
  23. I had a dual core cpu and 6 gigs of ram, and was running 2 video cards... still got some lag in some spots! Nice writeup.

    Garage Zoku

    ReplyDelete
  24. It says to edit the AffinityMask CVAR in the config, but it doesn't appear to be there. O.o
    Help?

    ReplyDelete