Tuesday, May 31, 2011

Portal 2 (and Source Engine games) stutter fix

So recently I got Portal 2, and a new video card. I figured the game would run perfectly on my quad core, 4gb ram, and new 1gb video card machine. Well, it does, for the most part. BUT sometimes it'll stutter. I thought it might be the autosave feature, which on older machines, might have caused some of the stuttering, but it wasn't the case this time. It seems to be the pre-loading of sounds. I don't know why, but these options aren't enabled by default. Taking a look at this site, which I've seen before, I found some console variables that seem to fix the stuttering.

cl_forcepreload [0,1] - If set to 1 forces all information to preload, reducing loading pauses and stuttering by not loading information on the fly.

sv_forcepreload [0,1] - If set to 1, forces server-side preloading, once again reducing loading pauses.


snd_mix_async [0,1] - If set to 1, this command will allow multi-core CPUs to run most of the sound engine in parallel with the renderer, which can improve performance and reduce stuttering.

Basically, find the file "config.cfg", and create a new file in the same exact directory called "autoexec.cfg", open it in notepad, and paste this:

cl_forcepreload 1
sv_forcepreload 1
snd_mix_async 1

Hopefully, when you restart Steam and the game, it'll enable those options right away. This also helps with Half Life 2 and other Source Engine games. Alright, I noticed there is still an occasional stutter, but not nearly as often.