Half Life 2 & Source Engine Tweak Guide

[Page 8] Advanced Tweaking (Pt.2)



Command Variables


This section lists out all of the major command variables for HL2 and Source Engine games, grouped by general function, and provides descriptions for each of them. The list does not even remotely cover every command variable available in the Source Engine, as there are over 2600 of them. I've refined the list specifically to only include the most relevant and useful working commands. Many command variables are designed primarily for use by the developers in debugging the game for example, or appear to have no impact on the game at all, and so have been omitted. In some cases I simply didn't know what a command variable does despite persistent testing, so I have left the command out rather than take an uneducated guess.


For a complete list of every command variable in the Source Engine go to the command console and type cvarlist. To see specific command variables starting with a particular letter or letters, for example to see all cvars starting with 'a', type cvarlist a, or to see all cvars starting with mat_, type cvarlist mat_. To save you time, you can download the full list (current as of HL2: Episode 2) from here: Source_Cvarlist.zip (50KB).



Click to enlarge

Some important things to note about this list:


  • For details of the various methods to use these command variables, refer to the instructions on the previous page of this guide.
  • Some commands can have multiple uses, but are only listed under their primary use category.
  • Commands with (cheat) at the end of their description can only be used if the sv_cheats 1 command is enabled in single player (See Cheats section below), and if used online will not work on non-cheat servers.
  • Commands which can be fully altered using the in-game settings (e.g. mat_Antialias) are not repeated here - use the in-game options to change these settings.
  • Commands which are not useful, have obscure functionality or show no impact at all on image quality or performance have not been included below.
  • Newer commands which have been added recently during the major rewrite of this guide are highlighted appropriately below.


  • Common Commands


    cl_showfps [0,1,2] - Draws a Frames Per Second (FPS) counter at the top of the screen. 0=off, 1=FPS, 2=Smoothed FPS. In general the smoothed fps counter is best for viewing framerates


    cvarlist [string] - If entered by itself this command generates a list of all the command variables (cvars). If one or more characters are also entered, cvarlist will list all commands starting with those letter(s).


    help [cvar] - Provides any available help text for the specified cvar.


    find [string] - Finds cvars with the specified string in their name or help text.


    differences - Shows all the cvars which are not at their default values, displaying which have been changed.


    exec [configfilename] - Executes all valid commands within the specified configuration file. The file must be a plain text file with the name filename.cfg and reside in the same directory as config.cfg.


    clear - Clears all text from the console.


    echo [string] - Outputs the specified string to the console (e.g. echo banana prints the text banana in the console).


    version - Shows the current version of the game. The version number of the HL2 executable is effectively the version number for the entire game. Also shows the current build of the Source engine being used.


    pause - Pauses the game.


    unpause - Unpauses the game.


    autosave - Saves the current game to the autosave slot. Will not work if autosave is completely disabled as per the instructions in the Conclusion section.


    sv_autosave [0,1] - If set to 1, allows the game to automatically save your progress at level transitions. If set to 0, game will not save whenever a new level starts, but may still save periodically at certain trigger points within a level. This can help reduce periodic stutters. To disable all autosaving see the Conclusion section of this guide.


    save [savename] - Saves the current game under the savename specified.


    load [savename] - Loads a game from the specified savename file.


    reload - Reloads the most recent saved game.


    restart - Restarts the game on the same level.


    kill - Kills your character.


    flush - Flushes the cache memory. Can resolve graphical anomalies such as texture glitches.


    map_background [mapname] - Runs a map as the background to the main menu. To find the mapnames, use the maps command (see below).


    maps [string] - Lists all maps starting with the provided string. Use maps * to list all mapnames.


    screenshot - Takes a screenshot.


    jpeg [filename, quality] - Takes a screenshot as a .jpg with the specified filename using the quality % specified (e.g. jpeg snapshot 50 saves a screenshot as snapshot.jpg with 50% quality). If no quality is specified the default as set by jpeg_quality will be used (see below).


    jpeg_quality [percentage] - Specifies the default quality percentage for screenshots taken with the jpeg command (see above).


    path - Shows the engine filesystem paths.


    exit, quit - Either command exits the game and returns to the Desktop.



    Binding Commands


    bind [key, command] - Binds the stated command to the specified key (e.g. bind Z console binds the Z key to opening the command console).


    bindtoggle [key, command] - Same as the bind command, except the assigned key can be used to both turn the command on and off (e.g. bindtoggle F cl_showfps 2 means the F key will toggle the FPS counter on or off).


    unbind [key] - Removes any bindings from the specified key.


    unbindall - Removes bindings from all keys.


    alias [aliasname, command] - Gives a command a short name (e.g. alias taunt echo I am your new King! changes 'taunt' into a command which spits out "I am your new King" when used). Use alias as a shortcut for long or complex command strings.


    key_findbinding [command] - Find the key bound to the specified command.


    key_listboundkeys - Lists all the keys which currently have a binding.



    Performance Commands


    mat_forcemanagedtextureintohardware [0,1] - If set to 1, attempts to force texture information into your Video RAM at the start of a level, alleviating any stuttering in the game. Note, this setting was introduced with the first 'stutter fix' patch (See Troubleshooting Tips section for details). Also note that from feedback and in my experience this setting can reduce FPS by up to 50%. Setting this variable to 0 may improve performance on some machines.


    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.


    cl_ragdoll_collide [0,1] - If set to 1, prevents characters from merging into each other due to ragdoll effects, thereby improving realism with no real performance hit. Note however that enabling this option may cause physics glitches in HL2: Episode 2, so on balance it is best to leave it disabled if playing Episode 2.


    mat_compressedtextures [0,1] - If set to 1, uses compressed textures for optimal performance. For those with graphics cards which have higher amounts of Video RAM (e.g. 256MB or more) setting this to 0 will improve texture appearance at the possible cost of some performance, but may cause a crash.


    fps_max [fps] - Limits the maximum possible framerate to the FPS specified. Has no impact on framerate performance (other than capping it). I recommend setting this to your monitor's refresh rate for smoother FPS, due to less volatile fluctuations (e.g. fps_max 85). Setting it higher does not increase overall framerate; this setting does not work the same way as Vsync.


    mem_force_flush [0,1] - If set to 1 forces the cache to be flushed on every allocation, which is not necessarily optimal nor recommended, but can reduce memory-related errors and crashes.


    r_fastzreject [-1,0,1] - If set to 1 activates a fast z-setting algorithm which takes advantage of hardware fast z reject for improved performance. If set to -1 detects your default hardware setting for this option. Initially this should be set to -1.


    cl_smooth [0,1] - If set to 1 attempts to smooth the view after prediction errors, however this can increase stuttering, so if you want to reduce stutters set this to 0.


    cl_smoothtime [seconds] - Time over which to smooth the view after prediction errors. If cl_smooth is enabled, experiment with values to see which gives the best results.


    sv_autoladderdismount [0,1] - If set to 1, the player automatically dismounts from ladders when the end is reach. If disabled, the player must press the USE key to mount/dismount ladders and hence cannot accidentally jump/walk off a ladder. Set to taste as there is no performance impact.


    mp_footsteps [0,1] - If set to 1, player footsteps can be heard, if set to 0 no footsteps are emitted from the player. Set to taste, has no performance impact, but can affect realism.


    violence_ablood [0,1] - If set to 1 shows alien blood when they are hit. Disabling this can improve performance but reduce realism.


    violence_agibs [0,1] - If set to 1 shows alien gore when they are hit. Disabling this can improve performance but reduce realism.


    violence_hblood [0,1] - If set to 1 shows human blood when they are hit. Disabling this can improve performance but reduce realism.


    violence_hgibs [0,1] - If set to 1 shows human gore when they are hit. Disabling this can improve performance but reduce realism.


    Update: newer Source 2007-based commands added below. Thanks in particular to Stephen Porter for details on the multi-core related commands:


    ai_expression_optimization [0,1] - If set to 1, disables NPC expressions when you can't see them, potentially improving performance.


    datacachesize [0-128] - Determines the amount in MB to allocate to the game's general data caches. The default is 32MB, and the maximum is 128MB. Note that in testing this in recent Source games, altering this value even to 128MB can actually reduce the size of certain caches which are already larger by default (or have been made larger by the Heapsize command), so on balance now I recommend leaving this at its default. Note further - if you see strange white textures after altering this setting, return it to its default.


    r_threaded_particles [0,1] - Determines whether the particle system is multi-threaded. This should be set to 1 on systems with multi-core CPUs.


    r_threaded_renderables [0,1] - Determines whether part of the rendering system is multi-threaded. This can be set to 1 on systems with multi-core CPUs to potentially improve performance.


    mem_max_heapsize [MB] - This command tells the Source Engine the maximum amount of memory to be allocated to the system heap. If you are using the -Heapsize command line variable (see previous page), then you may need to increase this value from its default of 256MB to allow a larger heapsize to be used for certain caches.


    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.


    mat_queue_mode [-1,0,1,2] - This setting determines the threading mode the material system uses. A value of -1 uses the default for your system, a value of 0 uses synchronous single thread, 1 uses queued single threaded mode, and value of 2 uses multi-threaded mode. Many users report performance increases on multi-core systems when setting this variable to a value of 2.



    [Graphics]


    cl_detaildist [range] - Determines the range at which detail props are shown (e.g. grass). Reducing this setting can increase performance, and conversely increasing this setting will improve image quality through more detail at the cost of performance.


    cl_detailfade [range] - Determines the range at which detail props fade into view. Increasing this value can raise performance.


    cl_maxrenderable_dist [distance] - Specifies the maximum distance from the camera at which things will be rendered. The smaller the number, the less will be rendered, improving performance (cheat).


    cl_ejectbrass [0,1] - If set to 1, weapons eject shells as they fire. If set to 0 they don't, which can improve performance especially during heavy combat.


    cl_show_splashes [0,1] - If set to 1, splashes in water are shown, if set to 0 they are disabled. Can improve performance if disabled at the cost of realism.


    crosshair [0,1] - If set to 1, enables the crosshair on the screen, if set to 0 disables it. The performance difference is negligible, so set to taste.


    lod_TransitionDist [range] - The distance at which the lod is reduced on objects. The higher this range, the lower your performance but the better distant objects will appear.


    mat_bumpmap [0,1] - If set to 1, enables bump mapping which makes flat 2D textures appear three dimensional. If disabled, textures will be loaded without bumpmapping and will appear far less realistic, however performance will be improved.


    mat_clipz [0,1] - If set to 1, uses an optimization technique to reduce what is drawn on screen for a performance improvement. Note that some Nvidia FX card owners need to set mat_clipz 0 to fix rendering problems.


    mat_diffuse [0,1] - If set to 1, uses diffuse lighting on materials. If set to 0 such lighting is removed and while performance is improved the screen is almost completely black from lack of this diffuse (ambient) lighting and hence is not recommended.


    mat_drawwater [0,1] - If set to 1, all water is rendered. Setting this to 0 can remove water for a performance boost at the cost of realism (cheat).


    mat_dxlevel [dxversion] - Determines the shader version for special effects applied to materials. Options include 70, 80, 81, 90 and 95 (e.g. mat_dxlevel 81). This is similar to the -dxlevel switch in the Advanced Tweaking section on page 7. Using shader versions lower than the highest level supported by your card will improve performance at the cost of varying degrees of image quality loss (depending on the shader version used).


    mat_fastnobump [0,1] - If set to 1, floor textures have all bump mapping removed and will appear flat and smooth. This can improve performance without affecting all bump mapping in the game, but will make floors appear unrealistic.


    mat_filterlightmaps [0,1] - If set to 1, static lightmaps are rendered correctly. If set to 0, all areas of pre-rendered lighting will be blocky and unrealistic, but performance will be improved slightly at the cost of realism.


    mat_filtertextures [0,1] - If set to 1, textures are rendered smoothly. If set to 0, textures will be blocky and unrealistic (similar to the original Doom!) but performance will be improved.


    mat_fullbright [0,1] - If set to 1, lights every texture will up brightly lit up (cheat).


    mat_hsv [0,1] - If set to 1, converts everything to black and white.


    mat_mipmaptextures [0,1] - If set to 0 disables mipmap textures, which harshens textures greatly but can improve performance.


    mat_showlowresimage [0,1] - If set to 1, loads extremely low resolution blocky textures in place of the normal ones for a significant performance boost at the cost of a great deal of realism.


    mat_softwarelighting [0,1] - If set to 1, uses only software-supported lighting. Image quality is not greatly affected, but this may increase or decrease your performance depending on whether your CPU is far more powerful than your graphics card.


    mat_specular [0,1] - If set to 1, uses specular lighting. If set to 0 materials will not have specular lighting applied to them (which makes things look more shiny) for a performance boost but a slight drop in image quality.


    muzzleflash_light [0,1] - If set to 1, weapons firing will emit a light along with the muzzle flash. If set to 0, a muzzle flash is still visible but no lighting is cast from it. Performance will improve in combat scenes with no noticeable drop in realism.


    r_decal_cullsize [pixels] - Decals (marks from weapons etc.) higher than the specified size in pixels will be removed straight away. Raising this value can improve performance during heavy gunfire for example, at the cost of some realism depending on how high this value is raised.


    r_decals [number] - Specifies the maximum number of decals possible at any one time. The higher this number, the greater the potential for getting slowdowns during large firefights as large numbers of decals are generated. Reducing this setting can improve performance in such situations.


    r_drawdecals [0,1] - If set to 1, decals are drawn. If set to 0, no decals are drawn at all improving performance but greatly reducing realism (cheat).


    r_drawflecks [0,1] - If set to 1, small chunks of rubble and dirt will be thrown up around bullet impact points. If set to 0, these 'flecks' will be disabled, reducing realism but improving performance.


    r_drawmodeldecals [0,1] - If set to 1, decals can be drawn on models, which are pretty much everything excluding walls and floors. If set to 0 these decals will be disabled, improving performance during weapons fire for example, but reducing realism.


    r_maxmodeldecal [number] - If r_drawmodeldecals is enabled, this number determines the maximum number of decals which can be drawn on a model. The higher the setting the greater the performance impact when firing at models.


    r_drawparticles [0,1] - If disabled, particle effects - which includes smoke and explosions - will not be drawn. This can greatly improve performance around such effects at the cost of a great deal of realism (cheat).


    r_DrawRain [0,1] - If set to 1, rain effects will be rendered, however if disabled no rain will be drawn. This improves performance in levels where there is visible rain, however realism is greatly reduced (cheat).


    r_drawropes [0,1] - If set to 1, all ropes and rope-like objects (e.g. powerlines) will be drawn as normal, however disabling this setting will remove such objects, perhaps improving performance in places where they existd due to a reduction in physics requirements, but reducing realism as well (cheat).


    r_drawskybox [0,1] - If set to 0, the sky textures will be completely removed, improving performance but resulting in visual anomalies in the sky and a large reduction in realism.


    r_drawtranslucentrenderables [0,1] - If set to 1, all objects which are translucent (see through), such as the Combine energy shields, will be drawn. If set to 0, these objects will not be drawn, improving performance around them at the cost of realism (cheat).


    r_dynamic [0,1] - If set to 1, enables dynamic lighting. If set to 0, disables dynamic lighting which can boost performance without a dramatic impact on realism.


    r_farz [-1,0,1] - Controls the far clippling plane, which determines what is not rendered when it is determined not to be visible to the character. A value of -1 is normal, higher values can result in normally visible objects suddenly disappearing from view (cheat).


    r_lod [-8 to 8] - Determines the rate at which level of detail (lod) is stripped from objects as they recede away from the player. The lower the value, the more detail remains visible on objects as they progress into the distance, reducing performance but increasing image quality.


    r_maxdlights [number] - Determines the maximum number of dynamic lights visible on the screen if dynamic lighting is enabled. The larger this maximum, the more chance of slowdowns during scenes with multiple dynamic light sources. Reducing this value can improve performance in such situations.


    r_occlusion [0,1] - If set to 0, disables the occlusion system in the game, which can decrease performance and is generally not recommended.


    r_WaterDrawReflection [0,1] - If set to 0, disables all reflections on top of water. This will boost performance at the cost of realism however you may experience graphical anomalies on the water.


    r_WaterDrawRefraction [0,1] - If set to 0, disables all refraction - that is images which appear distorted under the water. This will boost performance at the cost of realism, however you may experience some graphical anomalies on the water.


    sv_robust_explosions [0,1] - If set to 0, explosions will be less spectacular, but this may improve performance around explosions without a significant drop in realism.


    fog_enable [0,1] - If set to 0, will disable fog which can improve or reduce performance depending on whether your graphics card has issues with rendering fog.


    fog_enable_water_fog [0,1] - If set to 0, removes all underwater fogging which can result in a performance boost but unrealistic water appearance.


    r_waterforceexpensive [0,1] - If set to 1, the highest quality water will be used. If set to 0, performance may improve without a noticeable reduction in water quality.


    Note: newer commands added below:


    mat_picmip [-10-5] - This variable is the same as the Texture Detail in-game setting, and hence controls how detailed textures appear in Source games. However depending on the game, you can raise this value to further reduce the quality of the textures and possibly improve performance (and more importantly reduce stuttering), or you can use negative values to provide increasingly sharper textures. In HL2: Ep 2, a value of -1 equals Very High, but in games like Team Fortress 2 you can use -10 to get the absolute highest quality textures possible.


    mat_parallaxmap [0,1] - If set to 1, enables Parallax Mapping which can improve visual quality but may reduce performance.


    mat_motion_blur_falling_intensity [0-?]

    mat_motion_blur_falling_max [0-?]

    mat_motion_blur_falling_min [0-?]

    mat_motion_blur_forward_enabled [0-?]

    mat_motion_blur_percent_of_screen_max [0-?]

    mat_motion_blur_rotation_intensity [0-?]

    mat_motion_blur_strength [0-?]


    The above commands control the intensity of the motion blur effect if enabled (See In-Game Settings). The higher the value assigned, the more noticeable the blur effect. For example to alter the general motion blur you see when you turn around, alter the mat_motion_blur_rotation_intensity from its default of 1 to something like 2 or 3 to increase the blur effect. Alternatively you can lower the value to reduce the effect, e.g. to 0.5. Note however that there can be a minor drop in performance as well as added hitching/jittering from raising this too high.


    mat_hdr_tonemapscale [0-16] - If HDR is enabled, determines the way in which the dynamic component of HDR works. At 0, the HDR effect does not seem realistic, as your eyes will not 'adjust' to altered lighting by the scene becoming brighter or darker. On the other hand at 16 the effect is most pronounced.


    mat_bloom_scalefactor_scalar [0-?] - If Bloom is enabled, determines how extreme the bloom effect is, with the higher the value the more bloom visible in the scene.


    r_cheapwaterend [distance] - Determines the range beyond which water effects are reduced. The lower you set this value, the more blurry and unrealistic water will become in return for a potential performance boost. If you want to reduce all visible water quality set this to 1.



    [Sound]


    dsp_off [0,1] - If set to 1, disables audio DSP (Digital Signal Processing). This may improve performance, but will reduce the richness of audio effects (cheat).


    dsp_enhance_stereo [0,1] - If set to 1 enhances the stereo effect, making sound richer and more atmospheric for a slight performance hit.


    dsp_slow_cpu [0,1] - If set to 1, reduces the quality of dsp sound effects, improving performance on systems with slower CPUs.


    dsp_volume [volume] - Determines the volume of the background dsp effects. If the volume is increased, the impact of dsp enhancement will be exaggerated with no performance impact.


    snd_digital_surround [0,1] - If set to 1, enables digital surround sound if you have the appropriate hardware. You may need to set sv_consistency 0 for this to work in some Source games.


    snd_profile [0,1] - If set to 1, shows dsp usage stats in the console.


    snd_mixahead [value] - Set between 0 and 1, the higher the value the less stuttering and more synchronized sound will be, but performance may be reduced. A value of 0.5 to 0.7 will help reduce stuttering in the game. If you experience no stuttering, lower this value to gain some performance.


    snd_async_fullyasync [0,1] - If set to 1, sound may go out of synch with actions but you will experience reduced loading pauses and stuttering. Usually best left disabled, see the snd_mix_async command further above for a better audio-related performance/stuttering solution.



    The next section continues the command variable listing.