GoldSrc command Line Parameters

GoldSrc engine has many command-line parameters that are being identified at the game startup. These parameters can be used to set settings such as maximum refresh rate, the amount of heap available for the game, windows/fullscreen mode, 16bit/32bit rendering and many more.

In this article I'll cover most (hopefully all) cmd params as I can. In order to do this, I'll use IDA Pro to see the disassembled version of the game.

The maximum amount of params is MAX_NUM_ARGVS + NUM_SAFE_ARGVS + 1. That is 58.

Parameters are being stored inside a double-pointer const char* globla variable called largv with the param counter called com_argc

Safe parameter group (-safe)

Parameters inside this group are: -stdvid, -nolan, -nosound, -nocdaudio, -nojoy, -nomouse, -dibonly. Some of these parameters are obsolete and aren't even used anywhere inside the codebase.

These params are automatically set whenether the -safe param is set.

They are located inside safeargvs[] array with the size of NUM_SAFE_ARGVS (7) and they're evaluated inside COM_InitArgv() function. The array is present only on windows.

Parameter list

-16bpp, -24bpp, -32bpp

These parameters are obsolete in the newest steam version.

In order to change these values, go to registry key ScreenBPP.

These params are checked inside CVideoMode_Common::Init() function.

-addons

Enables support for the addons folder inside the game directory.

If this param isn't set, the value is read from registry key addons_folder instead.

This param is checked inside BEnableAddonsFolder() function.

-basedir <dir>

Sets the base directory for the game. By default this is set to valve.

This param is checked inside COM_SetupDirectories() function.

-clockwindow <value>

Sets the clockwindow cvar.

This param is checked inside NET_Init() function.

-condebug

Sets internal global variable con_debuglog to true. After that, every message that will be printed to console will be also outputed to a file inside Half-Life directory called qconsole.log.

This param is checked inside Con_Init() function.

-console

Sets console cvar to true if set. Also if set, the console will pop up after startup.

Use -toconsole to only set the console cvar to true without showing up the console at startup.

This param is checked inside Host_Init() and CBaseUI::Start functions.

-demoedit

Enables obsolete m_EditorMode inside DemoPlayer.dll.

This param is checked inside DemoPlayer_Init() function.

-dibonly

-dibonly is part of the safeargvs array.

This parameter is obsolete and isn't used anywhere along the codebase.

-directblit, -nodirectblit

Enables and disables blit texturing. These params control the global variable s_bSupportsBlitTexturing.

By default, if none of these params are set, the s_bSupportsBlitTexturing is set to false. However, if none of these params aren't set, and the glextension support is enabled with the GL_EXT_framebuffer_multisample_blit_scaled being available, the s_bSupportsBlitTexturing is set to true.

If one of the params are enabled, the default value of s_bSupportsBlitTexturing is being overrided with the setting. (-directblit or -nodirectblit)

These params are checked inside GL_SetMode() function.

If enabled, following code is executed inside GL_EndRendering() function:

if (s_bSupportsBlitTexturing) { qglBlitFramebufferEXT(0, 0, width, height, iDestX, iDestY, iDestWidth, iDestHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR); }

This param has no effect if either -nofbo or -nomsaa is set. Or if the glextensions aren't supported or the GL_EXT_framebuffer_multisample extension isn't present.

-forceres

Forces the -width, -height params to be set.

Can be set only if in windowed mode or when -nofbo isn't set

This param is checked inside CVideoMode_Common::Init() function.

-freq

Overrides the default monitor refresh rate.

This will work only in fullscreen mode.

If the entered frequency isn't supported by your monitor you'll get following message.

Con_Printf("Frequency %d is not supported by your monitor\n", target.dmDisplayFrequency);

The frequency is set by ChangeDisplaySettingsExA function.

On Linux this param is obsolete. Tho it does print message "Setting refresh rate to %dHz\n", but does nothing.

This param is checked inside GL_SetMode() function.

-full, -fullscreen

Force the game to launch in fullscreen mode. Both params do the same thing.

This param is checked inside VideoMode_Create() function.

-game

Sets the working directory for mod. For example for CS this is set to cstrike.

-gl_log

Enables support for gl_log console command.

This param is checked inside VID_Init() function.

-glext

If set, at the game startup, all of the extensions supported will be printed out.

This param is checked inside GL_Init() function.

-heapsize <value>

Preserves the amount of heap memory to the engine. In bytes.

The value is being capped at 14,680,064 - 134,217,728 bytes. If the value isn't in range, it will be set to default. (41,943,040 bytes)

Works only if -minmemory isn't set.

This param is checked inside Sys_InitMemory() function.

-height, -width

Sets the screen resultion.

This param is checked inside CVideoMode_Common::Init() function.

-insecure (windows only)

Sets the m_bWantToBeSecure member inside CSteam3Server.

This param is checked inside CSteam3Server::Activate() function.

-loopback (windows only)

Being passed as an argument into setsockopt() function.

This param is checked inside NET_IPSocket function.

-maxplayers <value> (windows only)

Sets the svs.maxplayers field.

This param is checked inside SV_SetMaxclients() function.

-minmemory

Overrides the heapsize to minimum amount of memory. (14,680,064 bytes)

If this is set, the -heapsize does nothing.

-netsleep

Disables global variable net_sleepforever which is then being passed into select() function inside NET_Sleep().

This param is checked inside NET_Init() function.

-netthread (windows only)

I'm not sure about this one, but seems like this enables multithreading in NET code by setting use_thread global variable to true.

This param is checked inside NET_Init() function.

-noborder

Disables window border. Adds SDL_WINDOW_BORDERLESS flag to uiFlags which is then being passed into SDL_CreateWindow() function.

This param is checked inside CGame::CreateGameWindow() function.

-nobreakpad

If set, the steam breakpad crash handler is disabled. The crash handler is being set by calling SteamAPI_UseBreakpadCrashHandler() function.

This is the first ever parameter evaluated by the engine code.

This param is checked inside CDedicatedServerAPI::Init() and CEngineAPI::Run() functions.

-nocdaudio

Disables cd audio support.

-nocdaudio is part of the safeargvs array.

This param is checked inside CCDAudio::_Init() function. (And more functions)

-nofbo

Disables opengl FBO scaling.

This param is checked inside GL_SetMode() function.

-noforcemaccel (windows only)

Forces the engine to use operating system mouse acceleration.

-noforcemparms (windows only)

Forces the engine to use operating system mouse parameters.

-noforcemspd (windows only)

Forces the engine to use operating system mouse speed.

-nohdmodels

Disables support for HD models.

-noip

Disables TCP/IP.

This param is checked inside NET_Init() function.

-noipx (windows only)

Disables IPX support.

This param is checked inside NET_Init() function.

-nojoy

-nojoy is part of the safeargvs array.

This param is obsolete.

-nolan

-nojoy is part of the safeargvs array.

This param is obsolete.

-nomaster

Disables master server communication.

This param is checked inside CSteam3Server::Activate() function.

-nomouse

-nomouse is part of the safeargvs array.

This param is obsolete.

-nomousegrab

Sets cl_mousegrab cvar to false.

This param is checked inside CL_Init() function.

-nomsaa

Disables opengl MSA FBO support.

This param is checked inside GL_SetMode() function.

-noontop

Calls SDL_SetHint("SDL_ALLOW_TOPMOST", "0");.

This param is checked inside CGame::CreateGameWindow() function.

-noquit (windows only)

Disables quiting after playback has been stopped.

This param is checked inside CL_FinishGameGauge() function.

-nosound

Disables audio support.

-nosound is part of the safeargvs array.

This param is checked inside S_Init() function. (And more)

-num_edicts

Presets number of edits when starting a server.

This param is checked inside COM_EntsForPlayerSlots() function. (And more)

-particles

Sets the maximum amount of particles that can be rendered. This number is capped at 512 - inf.

If the param isn't set, the r_numparticles is set to default, 2048. (2048 is defined as MAX_PARTICLES)

This param is checked inside R_InitParticles() function.

-port <value>

Sets cvar hostport to value.

This param is checked inside NET_Init() function.

-primarysound (windows only)

-reuse

Enables net multicasting. This enables to send IP datagrams to multiple receivers in a single transmission.

This param is checked inside NET_IPSocket() function.

-safe (windows only)

Enables all the params inside the safeargvs[] array. For more information about the array see Safe parameter group.

-simsound

Sets fakedma global variable to true. Otherwise this is set to false by default.

This param is checked inside S_Init() function.

-snoforceformat (windows only)

-sport <value>

Sets the steam port. By default this is 26900.

This param is checked inside CSteam3Server::Activate() function.

-starttime

Can manually force the startup timestamp. If this isn't set, it's 0 by default.

This param is checked inside Sys_InitFloatTime() function.

-stdvid

-dibonly is part of the safeargvs array.

This parameter is obsolete and isn't used anywhere along the codebase.

-steam

Enables steam support. This function is set in many functions.

-stretchaspect

Stretches current resolution to fit the monitor aspect rate. If this doesn't work for you, you might be probably missing some options in the graphics card driver.

This param is checked inside GL_SetMode() and CVideoMode_Common::DrawStartupGraphic functions.

-surfcachesize

This param seems obsolete and does nothing.

This param is checked inside Sys_GetSurfaceCacheSize() function.

-toconsole

Unlike -console, this param only sets console cvar to true, but no console is shown at the startup.

This param is checked inside Host_Init() function.

-wavonly (windows only)

Enables WAV sound only. By default DSOUND (Direct Sound) is enabled. If DSOUND fails to initialize

-window, -windowed (windows only), -startwindowed

Forces the game to launch in windowed mode.

This param is checked inside VideoMode_Create() function.

-zone <value>

Sets the amout for memory available for the zone allocation. This is another allocation system.

The value set here is in kilobytes and isn't capped.

This param is checked inside Memory_Init() function.

tier0 only macros

-noassert

-nocrashdialog

-debugbreak

-mpi_worker