Half Life 2 & Source Engine Tweak Guide

[Page 9] Advanced Tweaking (Pt.3)

The list of command variables is continued below:

Demo Commands

record [demoname] - Starts recording a demo of the current gameplay under the specified filename. The demo will be saved as demoname.dem in the \Program Files\Steam\SteamApps\[username]\[game name]\[game name]\ directory along with all its associated files.

stop - Stops recording the current demo.

demoui - Opens a small demo user interface which looks like a media player, but makes the opening and playing of demos much easier, including the capability to FF, REW and skip to specific points in the demo. Alternatively you can use demoui2 to open the advanced demo user interface.

playdemo [demoname] - Plays back a pre-recorded demo of name demoname.dem.

stopdemo - Stops playback of the currently playing demo.

demopause - Pauses playback of the currently playing demo.

demoresume - Resumes playback of the currently paused demo.

listdemo [demoname] - Provides details of the specified demo file.

demo_recordcommands [0,1] - If set to 1, records any commands typed at the console into demo files.

startmovie - Starts recording movie frames, stored in the \Program Files\Steam\SteamApps\[username]\[game name]\[game name]\ directory as .tga files.

endmovie - Stops recording movie frames.

Benchmarking Commands

timedemo [demoname] - Plays the specified demo and reports performance information upon completion, including frames played, time taken, average FPS and FPS variability. Also records the information in a file called sourcebench.csv in your \Program Files\Steam\SteamApps\[username]\[game name]\[game name]\ directory.

timedemoquit [demoname] - Plays the specified demo as per the timedemo command and then exits the game to desktop.

bench_start [filename] - Starts benchmarking your current gameplay and writes information to the specified file in .csv format.

bench_end - Ends any benchmarking.

bench_showstatsdialog - Shows a dialog box displaying the most recent benchmarking results.

bench_upload - Uploads the most recent benchmarking stats to the Valve servers.

benchframe [framenumber] - Takes a snapshot of the specified frame of a timedemo.

perfvisualbenchmark - Runs a series of benchmarks on the current scene.

perfvisualbenchmark_abort - Stops the benchmarking and prints the results for various aspects of the rendering system in average FPS in the console.

View Commands

firstperson - Switches to firstperson (from your character's eyes) point of view, which is the default.

thirdperson - Switches to thirdperson (behind your character) point of view. Note in thirdperson view your character may appear as an incomplete grey model.

centerview - Centers the character's view on the middle of the screen (only when bound to a key).

force_centerview - Centers the character's view on the middle of the screen whenever used.

fov [angle] - Specifies the character's Field of View (fov), i.e. the total angle which can be viewed at once. Default is 75, higher values create more of a 'fish-eyed' view, lower angles create a zoomed view.

default_fov [angle] - Determines the default Field of View. Normal default is 75 (cheat).

gameui_hide - Hides any visible portions of the game user interface, e.g. the console. Primarily used prior to taking a screenshot.

hidehud [0,1] - If set to 1, hides the Heads Up Display (HUD) from view (cheat).

cl_drawhud [0,1] - If set to 1, the HUD is drawn on screen, if set to 0 the HUD is not rendered, which can improve performance (cheat).

Information & Diagnostic Commands

bug - Opens a bug reporting user interface which makes the reporting of game bugs to Valve simple, such as being able to take a screenshot and attach it to the generated report automatically.

cache_print - Shows the amount of memory used by cached information, and the total cache capacity currently used by the game.

cl_precacheinfo - Shows the files which have been precached.

cl_showpos [0,1] - Displays the player's position on the current map in X, Y and Z co-ordinates and velocity in the top right corner if set to 1.

developer [0,1,2] - If set to 1 shows Developer messages in the top left corner, if set to 2 shows more detailed information.

fs_printopenfiles - Shows all files currently open.

listmodels - Lists all models currently loaded.

mat_info - Shows material system information.

mat_reloadmaterial - Reloads all materials which can take quite a while but may resolve any temporary graphical glitches.

mat_wireframe [0,1] - Displays materials in wireframe form (cheat).

mem_dump - Writes memory statistics to the file memstats.txt.

perfui - Opens a user interface which allows easy access to performance tools.

r_drawlightinfo [0,1] - Shows the source of all lights in the current scene and their associated information (cheat).

showbudget_texture [0,1] - If set to 1 displays a detailed control panel which graphs the memory usage for various types of textures.

soundinfo - Shows information about the current sound output device.

soundlist - Lists all known sounds.

snd_restart - Restarts the sound system which can take a while but may clear any temporary audio glitches.

snd_show [0,1] - If set to 1 displays information about sounds loaded (cheat).

stopsound - Stops all sound effects currently playing.

stopsoundscape - Stops all soundscapes currently playing.

surfaceprop - Shows information about the surface currently under the cursor.

Cheat / Fun Commands

Note: sv_cheats 1 must be used for some of these commands to work.

Also enabling cheats can negate the ability to gain Achievements.

sv_cheats [0,1] - Toggle. Enables the use of cheat commands in single player, or on a multiplayer server if set to 1 by the server owner.

god - Toggle. The player becomes invulnerable.

noclip - Toggle. The player can fly and move through solid objects.

notarget - Toggle. The player becomes invisible to NPCs (Non-Player Characters).

ai_disable - Disables all Artificial Intelligence (AI) for NPCs and puts them into their idle animations. Can be used to test the performance hit of AI, or to freeze NPCs.

impulse [code] - Generates objects, e.g. Impulse 101 gives the player all weapons.

give [item name] - Gives the player the named item.

givecurrentammo - Gives the player maximum ammunition for the currently equipped weapon.

buddha - Toggle. Player can take damage but won't die.

map [mapname] - Starts playing on the specified map (see maps command for mapnames).

sv_unlockedchapters [chapternumber] - Allows access to the specified chapters of the game. Chapter number are shown under New Game in the main menu (e.g. sv_unlockedchapters 3 unlocks the first three Chapters of the game).

npc_create [npctype] - Creates an NPC of the given type if that NPC is available on the current level.

npc_destroy_unselected - Destroys all the NPCs not currently specified.

npc_kill [npcname] - Kills specified NPC, or NPC currently under the cursor if none specified.

npc_speakall - Forces the current NPC to speak all their possible responses.

setpos [x y z] - Moves player to the specified co-ordinates on the current map.

Note: newer commands added below:




The above commands create an airboat, jalopy or jeep respectively in front of the character, which can then be driven as normal.

award_achievement [ID] - Awards a specific achievement based on the ID number entered.

Multiplayer Commands

addip [ipaddress] - Add an IP address to the ban list.

banid [userid] - Add a user ID to the ban list.

changelevel [mapname] - Change server to the specified map (see maps command above to find out mapnames).

cl_allowdownload [0,1] - Client downloads customization files.

cl_allowupload [0,1] - Client uploads customization files.

cl_cmdrate [packets/sec] - Max number of command packets sent to server per second.

cl_lagcompensation [0,1] - Perform server side lag compensation of weapon firing events.

cl_rate [bytes/sec] - Max bytes/sec the host can send data. Default is 10,000.

cl_downloadfilter [all, none, nosounds] - Determines which files can be downloaded from a server.

cl_playerspraydisable [0,1] - Enable or disable player sprays.

cl_resend [seconds] - Delay in seconds before the client will resend the 'connect' attempt.

cl_timeout [seconds] - After this many seconds without receiving a packet from the server, the client will disconnect itself.

cl_updaterate [packets/sec] - Number of packets per second of updates you are requesting from the server.

clientport [port] - Host game client port. Default is 27005.

connect [serverip] - Connect to specified server.

disconnect - Disconnect game from server.

hostport [serverip] - Host game server port. Default is 27015.

ip - Overrides IP for multihomed hosts.

kick [username/userid/userslot] - Kick a player by slot, userid or name.

killserver - Shutdown the server.

listid - Lists banned users.

listip - List IP addresses on the ban list.

writeid - Writes a list of permanently-banned user IDs to banned_user.cfg.

writeip - Save the ban list to banned_ip.cfg.

maxplayers [playernumber] - Change the maximum number of players allowed on this server.

mp_allowNPCs [0,1] - Allow NPCs on the server if set to 1.

mp_allowspectators [0,1] - Toggles whether the server allows spectator mode or not.

mp_chattime [seconds] - Amount of time players can chat after the game is over.

mp_fraglimit [frags] - Frag limit for deathmatch games.

mp_friendlyfire [0,1] - If set to 1, friendly fire is enabled.

mp_timelimit [minutes] - Game time per map in minutes.

mp_weaponstay [0,1] - If set to 1, weaponstay is enabled.

net_fakelag [milliseconds] - Lag all incoming network data (including loopback) by this many milliseconds (cheat).

net_fakeloss [percentage] - Simulate packet loss as a percentage of total packets.

net_graph [0,1,2,3] - Draw the network usage graph if set to 1 (More details of usage here).

net_maxfragments [bytes/packet] - Max fragment bytes per packet.

net_showdrop [0,1] - Show dropped packets in console if set to 1.

net_start - Initializes multiplayer network sockets.

password [password] - Current server access password.

ping - Display ping to server.

rate [bytes/sec] - Max bytes/sec the host can receive data. Default is 20000.

rcon [command] - Issue an rcon command.

rcon_password [password] - remote console password.

removeid [userid] - Remove a user ID from the ban list.

removeip [userip] - Remove an IP address from the ban list.

retry - Retry connection to last server.

say [string] - Display player message.

say_team [string] - Display player message to team.

slist - List servers on your LAN.

spec_player [playername] - Spectate player by name.

sv_allowdownload [0,1] - Allow clients to download files if set to 1.

sv_allowupload [0,1] - Allow clients to upload customization files if set to 1.

sv_alltalk [0,1] - Players can hear all other players, no team restrictions if set to 1.

sv_filterban [0,1] - Set packet filtering by IP mode.

sv_lan [0,1] - Server is a lan server (no heartbeat, no authentication, no non-class C addresses, 9999.0 rate, etc.).

sv_maxunlag [seconds] - Maximum lag compensation in seconds.

sv_maxrate [rate] - Max bandwidth rate allowed on server, 0 = unlimited.

sv_minrate [rate] - Min bandwidth rate allowed on server, 0 = unlimited.

sv_maxupdaterate [updates/sec] - Maximum updates per second allowed.

sv_minupdaterate [updates/sec] - Minimum updates per second allowed.

sv_password [password] - Server password for entry into multiplayer games.

sv_specnoclip [0,1] - If set to 1, spectators cannot fly through objects.

sv_timeout [seconds] - Number of seconds without a message from a client before client is dropped.

sv_voiceenable [0,1] - Enable voice on the server.

users - Show user info for players on server.

The descriptions above provide as complete a list as I can compile of what I believe are the most useful command variables for HL2: Episode 2 and the Source Engine. If you feel there have been any serious omissions or errors, please Email Me with the details and I will update the list to keep it as complete and accurate as possible. However please don't email me with obscure commands or general guesses as to command functionality as I cannot post these in the guide.

The next section wraps up the guide with some additional information for optimizing the game.