Garry's Mod

Garry's Mod

118 ratings
Efficient Optimization (cvar's)
By Zelloyn
Try to “optimize” the frame rate, network and sound of the client using cvar in Gmod.
2
   
Award
Favorite
Favorited
Unfavorite
Introduction
Readiness progress 45%/100%

The values of the default console variables differ depending on the hardware/device configuration, as well as the way they work and their presence on different Source Engine builds and games and in different mods (unofficial Valve games).

Please report if you have problems because of some commands are crashing, errors, or it just does not work on your pc. Also some commands may not work on the server, because they are overridden in the server config, and when you connect to the server, your settings will be overridden.

Designations
// -Means not"official" information that is not on Valve Wiki, as well as my comments.

** - Means information taken from Valve sources and Valve Wiki.
(This does not mean that it is completely true)
~~~Client~~~
cl_threaded_bone_setup
Value 0 def.
// Means single-threaded

Value 1
** Enable parallel processing of C_BaseAnimating::SetupBones()

// This is a client variable that allows “parallel processing” of bone functions. Setting it to “1” should theoretically provide a performance boost.
It's possible that the command just makes the bone models a completely separate thread, I assume this command will only give an FPS increase for people with at least 4 threads on their CPU(2 cores=4 threads, or just 4 PE cores with no threading).
// Allows the engine to process bone matrices in separate threads.
cl_particle_batch_mode
Value 0
// Do not use batch particle mode, (full display of all particles, regardless of speed and quantity)

Value 1 def.

Value 2
// Uses aggressive batch processing. Tries not to display a large number of particles
cl_phys_props_enable
Value 0
** Disable clientside physics props (must be set before loading a level).
// Limit the number of client-side physics objects to a reasonable limit

Value 1 def.
cl_phys_props_max
Value 300 def.

** Maximum clientside physic props
// (Maximum number of objects with client physics)
// Don't create objects until we see them
cl_ragdoll_collide
Value 0 def.
// Disables ragdolls colliding with each other

Value 1
// Collision of ragdolls will be allowed (with performance degradation). This prevents ragdolls from intersecting with each other and therefore improves visual quality. “Error” penetration can easily occur when a player is killed inside another ragdoll.
~~~Render~~~
r_lightcache_zbuffercache
// This is the parameter that controls the use of the buffer depth cache (z-buffer) to store information about calculated lighting in games that use the Source engine
// Use advanced lighting system

Value 0 def.
// The buffer depth cache will not be used to store information about the calculated illuminations. This may be useful to reduce memory usage, but may degrade game performance
// On some PCs, a value of 0 may crash the game

Value 1
// The Source engine will use a buffer depth cache to store information about calculated lighting. This can be useful to reduce the time required to calculate lighting and improve game performance
// Load z cache data together with the map
r_proplightingfromdisk
Value 0
** Off

Value 1 def.
** On
// Prop lighting (cache) from the disk

Value 2
** Show errors
r_hunkalloclightmaps
// Memory allocated for lightening data

Value 0 def.
// In normal “program memory” with the allocation of
// Uses the alloc system call
// Most likely the value 0 is the most optimal for the client

Value 1
// Apparently Valve has limited a certain size of “MemoryStack memory” with Hunk_Alloc
// Uses the Valve memory allocation system


Engine Hunk Overflow(Engine hunk overflow)
Garrysmod-issues[github.com]
r_threaded_particles
Value 0
// Use the standard batch rendering system

Value 1 def.
// Determines whether the particle system is multithreaded
r_ForceWaterLeaf
Value 0

Value 1 def.
** Enable for optimization to water - considers view in leaf under water for purposes of culling
// Optimization relative to leaves in "Hammer"
r_worldlistcache
Value 0

Value 1 def.
// Caches some visualization of the world
r_queued_ropes
Value 0

Value 1 def.
// Queue rendering of the rope using the material system.
r_fastzreject
** Enables or disables the fast z-buffer tuning algorithm to use fast z deflection in hardware.
// This is a console command in Source games that allows you to speed up the process of rendering game objects using the fast z-reject algorithm

Value -1
// Default hardware settings are defined for this option
// For the default value defined at the hardware level

Value 0 def.
// Disable for slow CPU and fast GPU

Value 1
// If set to 1, enables the optimized z-buffering algorithm
// The game will use a fast discard algorithm to optimize the rendering of game objects
// Renders the first pass of the scene with a z-buffer on the CPU and then on the GPU.(quickly renders the scene in the second pass with parts of the scene already visible)


// Use 1 for Nvidia, 0 for AMD (but not in all cases)
// You can look at the dxsupport.cfg file and there you can find a value of 1 for almost all Nvidia cards.

Z-buffering on Wiki[en.wikipedia.org]
r_norefresh
Value 0 def.
//

Value 1
// Do not store useless and unused frame time variable (does not update hud and console if not needed)
r_sse_s
// It refers to performance optimization and is responsible for the use of SSE (Streaming SIMD Extensions) instructions in the processor

Value 1 def.
** sse ins for particle sphere create
// The Source engine will use SSE instructions (most likely only the first version) to optimize performance.
r_sse2
** Enable/disable SSE2 code


CMD
// Status for SSE2 code support
r_3dnow
** Enable/disable 3DNow code

// Сhecks if 3dnow is enabled or disabled in processor instructions
~~~Materials/Matsysthread~~~
mat_forcemanagedtextureintohardware
Value 0 def.
//

Value 1
// Uploads textures to GPU memory
mat_forcehardwaresync
// Does not do the same thing as mat_vsync

Value 0
// This causes the engine to create frames out of sync with GPU processing, increasing input latency.

Value 1 def.
// Limits the CPU to within 1-2 frames of the GPU.
mat_managedtextures
Value 0
// Disable managed textures that don't work in D3D9Ex.

Value 1 def.
** If set, allows Direct3D to manage texture uploading at the cost of extra system memory
mat_bufferprimitives
Value 0
//

Value 1 def.
// Skip resetting primitives during grid drawing (Enables primitive caching)
mat_levelflush 1
Value 0
//

Value 1 def.
// Clear temporary memory to prevent overloading memory stores.
mat_queue_mode
** The queue/thread mode the material system should use: -1=default, 0=synchronous single thread, 2=queued multithreaded


Value -1 def.
** default
// (in game menu 1 core, in game all cores)
// The engine determines the optimal mode for processors with less than 4 cores

Value 0
** synchronous single thread
// (synchronized texture delivery)

Value 1
// Queued single thread (1 core, queued texture delivery)

Value 2
** queued multithreaded
// (“all cores”, another texture delivery)
(Forced multi-threaded mode for material system queue). Allows the engine to sort texture queues by reducing the number of swipes (texture rotation) on the video adapter. It is better to use value 1 if the GPU is heavily loaded.
filesystem_max_stdio_read
// Allows you to set the maximum limit for reading headers

Value 16 def.
mod_forcetouchdata
Value 0
// Skip loading all model data into the cache when loading

Value 1 def.
** Forces all model file data into cache on model load.
//
mod_touchalldata
Value 0
// Load vcollide asynchronously and skip loading the submodel

Value 1 def.
** Touch model data during level startup
// Load sub-model data and load stale asynchronous downloads
~~~Filesystem~~~
filesystem_max_stdio_read
Value 0
// Without buffer

Value 16 def.
// 16 KB buffer

Value 64
// Use the higher maximum read limit of 64 KB
filesystem_use_overlapped_io
Value 0
//

Value 1 def.
// Overlapping I/O requires using a separate thread to handle FS I/O, but I think it's still better than multiple threads from a pool locked in FS.
filesystem_unbuffered_io
Value 0 def.
// I/O buffering to reduce disk I/O

Value 1 def.
// Unbuffered output is generally better when you already have large buffers to send - copying to an intermediate buffer will not reduce the number of OS calls and will require extra work.
mem_min_heapsize
** Minimum amount of memory to dedicate to engine hunk and datacache (in mb)

// Used by clients/server
// Set depending on your amount of RAM
Value 48 def.
mem_max_heapsize
** Maximum amount of memory to dedicate to engine hunk and datacache (in mb)

// Used by clients/server
// Set depending on your amount of RAM

Value 256 def.
// Reserved 256 mb.
datacachesize
** Size in MB.

Value 32 min.

Value 256 def.

Value 512 max.
bugreporter_uploadasync
Value 0 def.
** Upload attachments asynchronously

Value 1
// Do not load error report attachments asynchronously
~~~Others~~~
particle_sim_alt_cores
Value 2 def.
// Defines the number of alternative threads (cores) that can be used for particle simulation. In this case, if the value is 2, the engine can use two additional threads besides the main one for simulation.
threadpool_affinity
Value 0
// Disable CPU thread anchoring, instead allowing the OS to schedule threads

Value 1 def.
** Enable setting affinity
// The engine will specify the specific cores on which threads from the pool are executed
studio_queue_mode
Value 0 def.
// Synchronous call
// May interfere with multithreading, but eliminates latency

Value 1
// Asynchronous call
// The function will be called later - at the end of the render frame or in another thread if threaded rendering is used
opt_EnumerateLeavesFastAlgorithm
// Which algorithm is used to identify BSP leaves that intersect a given axis-aligned bounding box (AABB) is a common operation in spatial caching, rendering, collisions, and visibility.

Value 0
// An old (scalar) algorithm is used, traversing the BSP tree in the traditional way


Value 1 def.
** Use the new SIMD version of CEngineBSPTree::EnumerateLeavesInBox.
// An optimized SIMD version is used, speeding up AABB crossings with BSP nodes
~~~Audio~~~
Audio setup
snd_spatialize_roundrobin
** Lowend-optimization: if the value is not zero, only a fraction of the audio channels are spatially mapped in each frame. 1/2^x channels will be spatially distributed

Value 0 def.

Value 1
// Spatial sounds every 2 frames, less performance gain

Value 3
// Spatialized sounds every 8 frames (2 ^ 3) using a looping algorithm. Quite reasonable performance advantage, but spatialization delay

// Delays the spatial distribution of sound (the ability to determine where a sound is located by how audible it is (at a 60 degree angle, behind you, etc.). Most noticeable if you turn your gaze quickly. the delay is defined as 2 ^ x, so for 1, there would be 2 ^ 1 = 2 frames needed to spatially distribute all sounds
snd_legacy_surround
Value 0 def.
// A new surround sound system is used
//

Value 1
// Inherited (legacy) surround sound mode is enabled
//
snd_async_fullyasync
Value 0 def.
// Partially asynchronous mode: the main stream can pause (block) when audio is loaded if the audio file is needed immediately.
//

Value 1
** All playback is fully async (sound doesn't play until data arrives).
// Fully asynchronous mode: never blocks the main stream, even if the audio has not had time to load. Instead there can be silence or delayed playback.
//
snd_async_minsize
// This command is in addition to snd_async_fullyasync

Value 0
// Fully run the sound system in a separate thread

Value 262144 def.
// Minimum data size, to play audio in asynchronous mode, or to play audio at all.
snd_cull_duplicates
** If nonzero, aggressively cull duplicate sounds during mixing. The number specifies the number of duplicates allowed to be playe


Value 0 def.
// Do not skip playing repetitive sounds


snd_noextraupdate
Value 0 def.

Value 1
// Do not update the sound twice
// Sound resources will not be further updated or recalculated. This may reduce CPU load and improve performance, but may reduce the quality of sound effects or their accuracy in certain situations
snd_pitchquality
Value 0
// Use linear mixer for sound, lower CPU load

Value 1 def.
// Use interpolated mixer for sound, higher sound quality, higher CPU load
snd_lockpartial
Value 0

Value 1 def.
// Sound data will be partially blocked or fixed. This can help to reduce RAM usage and optimize performance, but may affect sound dynamics and accuracy in some situations.
// Use the partial buffer locking code in stereo as well - not available when recording a movie
snd_mixahead
// How many seconds of the 44100 sample rate we are mixing. The value is selected as a fraction of samples.

Value 0 def.
// "Without buffer"

Value 0.05
// More performance due to larger buffer size


voice_steal
// Chooses the voice stealing algorithm
// Select a channel from the dynamic channel allocation area. For the given entity,
override any other sound playing on the same channel

Value 0
// Never steal the channel of a streaming sound that is currently playing or
// voice over IP data that is playing or any sound on CHAN_VOICE( acting )

Value 1
//

Value 2 def.
// Reusing secondary audio channels
// FPS and sound quality may be increased
~~~Network~~~
Setting up the network part
net_usesocketsforloopback
** Use network sockets layer even for listen server local player's packets (multiplayer only).

Value 0 def.
// Client and server communicate not through a real network stack, but through a special internal API that implements direct function calls and message queue.


Value 1
// The client and server on the same machine actually use the network stack
net_queued_packet_thread
Value 0
// Do not queue a packet. Without a stream of packets in the queue, split packets are sent without delay. Probably the best option.
// Only on linux works correct

Value 1 def.
** Use a high priority thread to send queued packets out instead of sending them each frame.
// Keep a thread in case we start sending split packets


Value ~768432
// Queue all packets. Forcibly add delay to client packets. Every 0.015 seconds, 1 usercmd (42 bytes) is sent. And you basically add an arbitrary 0.5ms delay on top of that + additional context switching/scheduling in the packet stream in the queue.
net_splitpacket_maxrate
** Max bytes per second when queueing splitpacket chunks
// The maximum rate of split packets should be low because split packets are sensitive to the order in the UDP socket receive/buffers

Value 1048576 def.
//
net_compresspackets
Value 0
// Disable packet compression

Value 0 def.
** Use compression on game packets.
// Compress multiple packets sent to the server to maximize data savings.

net_compresspackets_minsize
//

Value 1024 def.
//
net_maxfragments
** Max fragment bytes per packet
// A reasonable value will depend on the MTU size on the router
// It is best not to change this value upward on the client because of possible problems
// The server sets the maximum value for the client
// If changed, it may cause a problem getting lua files from the server you are connecting to for the first time.

Value 256.000000 (min)
//


Value 1260 def.
//


Value 1500
// Probably will be the maximum in most cases, provided the same value is available on the server

Value 1792.000000 (max)
//




net_maxroutable
** Requested max packet size before packets are 'split'.
// It is best not to change this value upwards because of possible problems

Value 576 (min)
//

Value 1260 def. (max)
//


There's a little bit of information on Reddit
Fix for LUA files from server (stuck on loading screen)
net_udp_rcvbuf
** Default UDP receive buffer size
// The formula is N * 1024 Where N is the udp receive buffer. Example: 128*1024= 131072
// Depends on the value on the server.

Value 8192.000000 (min)
//

Value 131072 def. (max)
//
net_maxcleartime
** Max # of seconds we can wait for next packets to be sent based on rate setting (0 == no limit).

Value 0.0000
// Unlimited
// There is no need to check our limit since cmdrate is the upper limit

Value 4 def.
//
net_maxfilesize
** Maximum allowed file size for uploading in MB

Value 0 (min)
//

Value 16 def.


Value 64 (max)
//

// The maximum file size that the server can transfer to clients.
// Allows servers to seamlessly upload large files of maps, sounds, textures and models to your client computer.
net_maxfilesize on Valve Wiki
net_chokeloop
Value 0 def.
//

Value 1
** Apply bandwidth choke to loopback packets
//
net_splitrate
** Number of fragments for a splitpacket that can be sent per frame

Value 0
// Perhaps disabling this command would be a better option.

Value 1 def.
//
rate
** Max bytes/sec the host can receive data
// Bytes/sec
// Set by the server for the client

Value 100000 def.

Value 786432
// 768 KB/sec.
cl_cmdrate
** Max number of command packets sent to server per second
// Set by the server

// If you are experiencing problems with net chook and loss, you can lower it from the maximum value set on the server if the lower limit on the server is set

Value 66 def.
//
cl_updaterate
** Number of packets per second of updates you are requesting from the server
// Set by the server

// If you are experiencing problems with net chook and loss, you can lower it from the maximum value set on the server if the lower limit on the server is set

Value 66 def.
//
cl_lagcompensation
Value 0
// Do not use lag compensation. This means unsynchronization of movement, animations and weapon sounds

Value 1 def.
** Perform server side lag compensation of weapon firing events.

// Lag compensation helps eliminate latency of commands on the client side.
cl_predictweapons
Value 0
// Server prediction
// (At this value there is a double sound when firing, - depends on the ping delay )

Value 1 def.
** Perform client side prediction of weapon effects.
// Client prediction of weapon behavior
cl_pred_optimize
** Optimize for not copying data if didn't receive a network update (1), and also for not repredicting if there were no errors (2)

Value 0
// Disables predictive optimization

Value 1
//

Value 2 def.
// Don't over-predict if there are no errors. Keep client-side prediction incrementally within errors
cl_interp
** Sets the interpolation amount (bounded on low side by server interp ratio settings).

cl_interp_ratio
** Sets the interpolation amount (final amount is cl_interp_ratio / cl_updaterate).
// The value limits depend on the server configuration

Value 0
// Disable the amount of interpolation

Value 1
//

Value 2 def.
// High value can smooth out predictions errors
cl_interp_all
// Manages some code optimizations to perform client-side prediction

Value 0 def.
** Disable interpolation list optimizations.
// Optimization is performed; only the set of objects that need interpolation is considered


Value 1
// The old behavior, where each network object is considered for interpolation, is triggered
cl_interp_npcs
Value 0 def.
//

Value 1
** Interpolate NPC positions starting this many seconds in past (or cl_interp, if greater)
//
cl_predict
// Values depend on the server, mostly it is 1

Value 0 def.
// Relying only on server data, depending on ping adds delay to player movements

Value 1
** Perform client side prediction.
// Skip waiting for server feedback and simulate client-side motion in real time
cl_smooth
There's information on Reddit
If you want everything (hitboxes and possibly projectiles) to be as accurate as possible on your screen, then leave cl_smooth at 0.
// cl_smooth does not affect enemy player models because it corrects prediction errors, not interpolation errors!

Value 0
//

Value 1 def.
** Smooth view/eye origin after prediction errors
//

cl_smoothtime
** Smooth client's view after prediction error over this many seconds

Value 0.0000 def.
//

Value 1
//
cl_localnetworkbackdoor
Value 0
//

Value 1 def.
** Enable network optimizations for single player games.
//
cl_resend
** Delay in seconds before the client will resend the 'connect' attempt


Value from 1.5 to 20

Value 6 def.
//
Additionally
Uncategorized
r_glint_procedural
Value 0 def.
// Using the standard method of glare in eyes. (Forced hardware(gpu) rendering of eyes)

Value 1
//
mem_force_flush
Cheat

Value 0 def.
// Disable cache clearing

Value 1
// Forced clearing of the cache of unlocked resources at each memory allocation
// The cache is cleared each time memory is allocated, which is not necessarily optimal or recommended, but can reduce memory-related errors and failures
engine_no_focus_sleep
Value 0
// This command can be used to disable,(enable) or reduce the “sleep mode” of the game engine when you are out of a tab, or the game is not your currently active window. Normally, when you exit the game, the engine “sleeps” for a set number of milliseconds (repeatedly) to reduce power and resource consumption. Set this value to 0 to completely disable sleep mode when the tab is disabled.

Value 50 def.
cl_extrapolate
Cheat

Value 0
// Extrapolation is disabled and the client will rely entirely on data received from the server. This means that the client will wait for confirmation from the server before displaying the results of the player's actions. This may cause some delay between the player's actions and their reflection in the game world.

Value 1 def.
** Enable/disable extrapolation if interpolation history runs out.
//

gl_clear
PreRender[wiki.facepunch.com]
// Only works if gmod is in opengl mode

Value 0 def.
//

Value 1
// Replaces the quality of visualization, cracks appear between textures
List of cvar's with problems
You can also use them if you want
May become an issue on some devices and versions of the game, or cause the game to crash and not work properly

mat_forcehardwaresync
Value 1
// There may be frame unsynchronization

mat_softwarelighting
Value 1
// Missing light and textures on weapons, npcs

cl_threaded_bone_setup
Value 1
// May cause errors on some cpu models. May cause crashes, preferably use without Intel HT and Amd SMT

cl_interp 0
// A value of 0 results in lower npc animation frames, in single-player game

cl_interp_ratio
Value 0
// A value of 0 results in lower npc animation frames, in single-player game

reload_materials
Value 1
// A value of 1 completely disables some graphical functions
Ready-made config
If you want, you can use the ready-made config
This does not mean that it will be optimal for you, and suitable in all events and situations

Temporarily unavailable!
32 Comments
Amazing Tampon 5 Jul, 2024 @ 9:45am 
только протестировал и команда net_queued_packet_thread 0 вызывает краш локального сервера когда игрок начинает спавниться, лично у меня сервер крашится.
Zelloyn  [author] 6 Feb, 2024 @ 12:26pm 
@Менеджер по пиву
Какие команды ты использовал?
Ксилан 2 Feb, 2024 @ 9:38am 
У меня пропал огонь (То есть когда например нпс горит, никакого огня не видно, будто просто танцует)
Редиссерк 25 Nov, 2023 @ 10:07am 
А, когда планируешь вновь открыть доступ к конфигу?
Zelloyn  [author] 25 Oct, 2023 @ 11:13pm 
Измени значение cl_predictweapons на 1
[S] Rallin λkoliet 25 Oct, 2023 @ 5:01am 
с твоим конфигом у меня на сервере на котором я часто играю
при нажатии 1 раз ЛКМ, выстрел дублируется
как убрать, зачем это?
Zelloyn  [author] 11 Mar, 2023 @ 2:54am 
Нужно изменить cl_interp 0 и cl_interp_ratio 0, или удалить эти параметры
Remalid 10 Mar, 2023 @ 11:11pm 
Используя этот кфг у нпс частота кадров в анимации сильно дропается. Какая команда за это отвечает?
у меня деменция 10 Oct, 2022 @ 5:51am 
блять что с модельками оуржия?
buby 9 Oct, 2022 @ 9:16pm 
имба :steamthumbsup: