Quake3e

This client aims to be fully compatible with original baseq3 and other mods while trying to be fast, reliable and bug-free.
It is based on ioquake3-r1160 (latest non-SDL revision) with upstream patches and many custom improvements.
Common changes/additions:

- a lot of security, performance and bug fixes
- much improved autocompletion (map, demo, exec and other commands), in-game \callvote argument autocompletion
- \com_affinityMask - bind Quake3e process to bitmask-specified CPU core(s)
- raized filesystem limits, much faster startup with 1000+ pk3 files in use, level restart times were also reduced as well
- \fs_locked 0|1 - keep opened pk3 files locked or not, removes pk3 file limit when unlocked

Client-specific changes/additions:

- raw mouse input support, enabled automatically instead of DirectInput(\in_mouse 1) on Windows XP and newer windows operating systems
- MOUSE4 and MOUSE5 works in \in_mouse -1 mode
- \minimize in-game command to minimize main window, can be used with binds/scripting
- \in_minimize - hotkey for minimize/restore main window (direct replacement for Q3Minimizer)
- \in_forceCharset 0|1|2 - try to translate non-ASCII chars in keyboard input (1) or force EN/US keyboard layout (2)
- \in_nograb 0|1 - do not capture mouse in game, may be useful during online streaming
- \s_muteWhenUnfocused 0|1
- \s_muteWhenMinimized 0|1
- \s_device - linux-only, specified sound device to use with ALSA, enter aplay -L in your shell to see all available options
- \screenshotBMP and \screenshotBMP clipboard commands
- hardcoded PrintScreen key - for "\screenshotBMP clipboard"
- hardcoded Shift+PrintScreen - for "\screenshotBMP"
- \com_maxfpsUnfocused - will save cpu when inactive, set to your desktop refresh rate, for example
- \com_skipIdLogo 0|1- skip playing idlogo movie at startup
- \com_yieldCPU <milliseconds> - try to sleep specified amount of time between rendered frames when game is active, this will greatly reduce CPU load, use 0 only if you're experiencing some lags (also it usually reduces performance on integrated graphics because CPU steals GPU's power budget)
- \r_defaultImage <filename>|#rgb|#rrggbb - replace default (missing) image texture by either exact file or solid #rgb|#rrggbb background color
- \r_vbo 0|1 - use Vertex Buffer Objects to cache static map geometry, may improve FPS on modern GPUs, increases hunk memory usage by 15-30MB (map-dependent)
- \r_fbo 0|1 - use framebuffer objects, enables gamma correction in windowed mode and allows arbitrary size (i.e. greater than logical desktop resolution) screenshot/video capture, required for bloom, hdr rendering, anti-aliasing, greyscale effects, OpenGL 3.0+ required
- \r_hdr -1|0|1 - select texture format for framebuffer:
  -1 - 4-bit, for testing purposes, heavy color banding, might not work on all systems
  0 - 8 bit, default, moderate color banding with multi-stage shaders
  1 - 16 bit, enhanced blending precision, no color banding, might decrease performance on AMD/Intel GPUs
- \r_bloom 0|1|2 - high-quality light bloom postprocessing effect
- \r_dlightMode 0|1|2 - dynamic light mode
0 - VQ3 'fake' dynamic lights
1 - new high-quality per-pixel dynamic lights, slightly faster than VQ3's on modern hardware
2 - same as 1 but applies to all MD3 models too
- \r_modeFullscreen - dedicated mode string for fullscreen mode, set to -2 to use desktop resolution, set empty to use \r_mode in all cases
- \r_nomip 0|1- apply picmip only on worldspawn textures
- \r_neatsky 0|1 - nopicmip for skyboxes
- \r_greyscale [0..1.0] - desaturate rendered frame, requires \r_fbo 1, can be changed on the fly
- \r_mapGreyScale [-1.0..1.0] - desaturate world map textures only, works independently from \r_greyscale, negative values only desaturate lightmaps
- \r_ext_multisample 0|2|4|6|8 - multi-sample anti-aliasing, requires \r_fbo 1, can be changed on the fly
- \r_ext_supersample 0|1 - super-sample anti-aliasing, requires \r_fbo 1
- \r_noborder 0|1 - to draw game window without border, hold ALT to drag & drop it with opened console
- \r_noportals 0|1|2 - disable in-game portals (1), and mirrors too (2)
- negative \r_overBrightBits - force hardware gamma in windowed mode (not actual with \r_fbo 1)
- \video-pipe <filename> - redirect captured video to ffmpeg input pipe and save encoded file as <filename>
- \r_renderWidth & \r_renderHeight - arbitrary resolution rendering, requires \r_fbo 1
- \cl_conColor [RRR GGG BBB AAA] - custom console color, non-archived, use \seta command to set archive flag and store in config
- \cl_autoNudge [0..1] - automatic time nudge that uses your average ping as the time nudge, values:
  0 - use fixed \cl_timeNudge
  (0..1] - factor of median average ping to use as timenudge
- \cl_mapAutoDownload 0|1 - automatic map download for play and demo playback (via automatic \dlmap call)
- less spam in console (try to set "\developer 1" to see what important things you missing)
- faster shader loading, tolerant to non-fatal errors
- fast client downloads (http/ftp redirection)
- \download and dlmap commands - fast client-initiated downloads from specified map server
- you can use \record during \demo playback
- conditional shader stages
- linear dynamic lights

Server-specific changes/additions:

- \sv_levelTimeReset 0|1 - reset or do not reset leveltime after new map loads, when enabled - fixes gfx for clients affected by "frameloss" bug, however it may be necessary disable in case of troubles with GTV
- \sv_maxclientsPerIP - limit number of simultaneous connections from the same IP address
- much improved DDoS protection
- \sv_minPing and \sv_maxPing were removed because of new much better client connecion code
- userinfo filtering system, see docs/filter.txt
- rcon now is always available on dedicated servers
- rconPassword2 - hidden master rcon password that can be set only from command line, i.e.
  +set rconPassword2 "123456"
  can be used to change/revoke compromised rconPassword
- significally reduced memory usage for client slots

\in_minimize
cvar that specifies hotkey for fast minimize/restore main windows, set values in form
\in_minimize "ctrl+z"
\in_minimize "lshift+ralt+\"
or so then do \in_restart to apply changes.

Fast client downloads
Usually downloads are slow in Q3 because all downloaded data is requested/received from game server directly. So called `download redirection' allows very fast downloads because game server just tells you from where you should download all required mods/maps etc. - it can be internet or local http/ftp server
So what you need:

- set sv_dlURL cvar to download location, for example:
  sets sv_dlURL "ftp://myftp.com/games/q3"
  Please note that your link should point on root game directory not particular mod or so
- Fill your download location with files.
  Please note that you should post ALL files that client may download, don't worry about pk3 overflows etc. on client side as client will download and use only required files

Fast client-initiated downloads
You can easy download pk3 files you need from any ftp/http/etc resource via following commands:
\download filename[.pk3]
\dlmap mapname[.pk3]
\dlmap is the same as \download but also will check for map existence
cl_dlURL cvar must point to download location, where (optional) %1 pattern will be replaced by \download|dlmap command argument (filename/mapmane) and HTTP header may be analysed to obtain destination filename
For example:
1) If cl_dlURL is http://127.0.0.1 and you type \download promaps.pk3 - resulting download url will be http://127.0.0.1/promaps.pk3
2) If cl_dlURL is http://127.0.0.1/%1 and you type \dlmap dm17 - resulting download url will be http://127.0.0.1/dm17
Also in this case HTTP-header will be analysed and resulting filename may be changed
To stop download just specify '-' as argument:
\dlmap -
cl_dlDirectory cvar specifies where to save downloaded files:
0 - save in current game directory
1 - save in fs_basegame (baseq3) directory

Built-in URL-filter
There is ability to launch Quake3 1.32e client directly from your browser by just clicking on URL that contains q3a:// instead of usual http:// or ftp:// protocol headers
What you need to do:

- copy q3url_add.cmd/q3url_rem.cmd in quake3e.exe directory
- run q3url_add.cmd if you want to add protocol binding or q3url_add.cmd if you want to remove it
- type in your browser q3a://127.0.0.1 and follow it - if you see quake3e launching and trying to connect then everything is fine

Condifional shader stages
Optional "if"-"elif"-"else" keywords can be used to control which shaders stages can be loaded depending from some cvar values.
For example, old shader:

    console
    {
     nopicmip
     nomipmaps
     {
      map image1.tga
      blendFunc blend
      tcmod scale 1 1
      }
    }

New shader:

    console
    {
     nopicmip
     nomipmaps
     if ( $r_vertexLight == 1 && $r_dynamicLight )
     {
      map image1.tga
      blendFunc blend
      tcmod scale 1 1
     }
     else
     {
      map image2.tga
      blendFunc add
      tcmod scale 1 1
     }
    }

lvalue-only conditions are supported, count of conditions inside if()/elif() is not limited

Redurect captured video to ffmpeg input pipe
In order to use this functionality you need to install ffmpeg package (on linux) or put ffmpeg binary near quake3e executable (on windows).
Use \cl_aviPipeFormat to control encoder parameters passed to ffmpeg, see ffmpeg documentation for details, default value is set according to YouTube recommendations:

    -preset medium -crf 23 -c:v libx264 -flags +cgop -pix_fmt yuvj420p -bf 2 -c:a aac -strict -2 -b:a 160k -movflags faststart

If you need higher bitrate - decrease -crf parameter, if you need better compression at cost of cpu time - set -preset to slow or slower.
And since ffmpeg can utilize all available CPU cores for faster encoding - make sure you have \com_affinityMask set to 0.

Arbitrary resolution rendering
Use \r_renderWidth and \r_renderHeight cvars to set persistant rendering resolution, i.e. game frame will be rendered at this resolution and later upscaled/downscaled to window size set by either \r_mode or \r_modeFullscreen cvars.
Cvar \r_renderScale controls upscale/downscale behavior:

- 0 - disabled
- 1 - nearest filtering, stretch to full size
- 2 - nearest filtering, preserve aspect ratio (black bars on sides)
- 3 - linear filtering, stretch to full size
- 4 - linear filtering, preserve aspect ratio (black bars on sides)

It may be useful if you want to render and record 4k+ video on HD display or if you're preferring playing at low resolution but your monitor or GPU driver can't set video|scaling mode properly.

High-Quality Bloom
Requires \r_fbo 1, available operation modes via \r_bloom cvar:

- 0 - disabled
- 1 - enabled
- 2 - enabled + applies to 2D/HUD elements too

\r_bloom_threshold - color level to extract to bloom texture, default is 0.6
\r_bloom_threshold_mode - color extraction mode:

- 0 - (r|g|b) >= threshold
- 1 - (r+g+b)/3 >= threshold
- 2 - luma(r,g,b) >= threshold

\r_bloom_modulate - modulate extracted color:

- 0 - off (color=color, i.e. no changes)
- 1 - by itself (color=color*color)
- 2 - by intensity (color=color*luma(color))

\r_bloom_intensity - final bloom blend factor, default is 0.5
\r_bloom_passes - count of downsampled passes (framebuffers) to blend on final bloom image, default is 5
\r_bloom_blend_base - 0-based, topmost downsampled framebuffer to use for final image, high values can be used for stronger haze effect, results in overall weaker intensity
\r_bloom_filter_size - filter size of Gaussian Blur effect for each pass, bigger filter size means stronger and wider blur, lower value are faster, default is 6
\r_bloom_reflection - bloom lens reflection effect, value is an intensity factor of the effect, negative value means blend only reflection and skip main bloom texture

End Of Document