R1Q2 Client Readme
(backup copy)



Title: R1Q2 Client README
Post by: R1CH on September 20, 2004, 03:01:55 pm


The R1Q2 client (https://r1ch.net/assets/misc/r1q2-websetup.exe) is primarily designed for me as something I want to use over regular Q2. The odd features (eg location support) will soon get added, but you aren't going to see winamp controls, mirc auto away features, etc in the considerable future. R1Q2 is not an anti-cheat client. I've seen several people and messages on forums thinking R1Q2 by itself is an anti-cheat client. It is not, however recent versions now support the r1ch.net anticheat module (http://antiche.at/) when used on supported servers.

cl_async (fps / physics / jumping / packet rate / etc)
One of the largest changes in the client is the separation of the network and rendering rate. Unlike other clients, R1Q2 accomplishes this by sampling input for several frames and generating one network packet. This avoids the hackyness exhibited in other clients that rely on Q2's packet loss recovery features to lower the network rate, however it also creates some more. The cvar cl_async controls this new asynchronous FPS behaviour, set cl_async 0 will use standard FPS identical to how Quake II 3.20 works.

With cl_async 1, cl_maxfps will control the NETWORK packet rate - ie how many packets/sec you send to the server. r_maxfps controls how many FRAMES are rendered per second at a maximum. You should never need to adjust r_maxfps, but try cl_maxfps 30 or other similar values in order to save bandwidth and server CPU time if possible.

Using a lower cl_maxfps will cause a few issues, notably: physics exploits such as crate jumping will not work, jump height when launching off ramps will be lower and prediction misses when climbing stairs can occur. For the vast majority of mods you shouldn't really experience a problem unless you're one of these people who run cl_maxfps 200 or something silly. For mods where jumping is crucial, eg the Q2 Jump mod, the cl_async cvar can be set to 0 to restore original Q2 "one packet per frame" behaviour.

Even when running a lower cl_maxfps, important events such as weapon firing or sending a command will still cause a packet to be sent immediately if cl_instantpacket 1 is set (default). This will cause you to go slightly above the cl_maxfps packet rate at times but gives you the latency benefit as if you were running cl_async 0.

If you use a joystick or keyboard to control the view, you will want to use cl_async 0 and cl_maxfps 90 or so as the cl_async 1 code currently does not work very well with anything other than mouse input for controlling the view.

Note that if you use R1GL with R1Q2, you may find your frame rate is capped at 60 (vsync). This is because R1GL correctly applies the default "gl_swapinterval 1" cvar which controls this behavior, whereas 3.20 ref_gl did not. Use gl_swapinterval 0 to allow for rendering with no waiting for buffer swaps.

Security
Another important but somewhat "unnoticable" change are the plethora of security improvements. Your client can no longer be hijacked by malicious packets from remote users, commands such as record, condump, etc are made safer in that they won't write outside the Q2 directory, the client won't crash hard on bad/corrupted data from the server and a whole lot more improvements that you hopefully will never notice but work to protect you.

Location Reporting
Location reporting using $$loc_here for current location and $$loc_there for where you are looking in a chat message or any console command will work, .loc files are loaded from mod/maps/mapname.loc, then if not found, mod/locs/mapname.loc (from the mod dir) and are in a format compatible with most other clients. addloc / saveloc commands are available to create .loc files. Note that saveloc will not work if your .loc file is in a pak file. You can use bash-style curly brackets to do forced expansion of these meta-variables where it would otherwise fail, eg say "I'm at [$$loc_here]" won't work, say "I'm at [${$loc_here}]" is the correct way. Note that location metavars won't be expanded in messagemode / messagemode2. You may also set the cl_default_location cvar, if no .loc files are loaded from the current map then the contents of cl_default_location will be sent in place of $$loc_here.

*.pak file loading
Pak file loading: R1Q2 will load ALL *.pak files! Be careful with this if you have unwanted pak files lying around as "dontloadme.pak" or similar. pak0-pakX are loaded first, then the remaining *.pak files are loaded in alphabetical order. Remember, the last pak file to be loaded will be used when searching for files, for example pak10.pak will override files in pak9.pak and newweapons.pak will override anything in pak10.pak

DirectInput Mouse
DirectInput mouse support is available with m_directinput 1. This will give a much smoother mouse response and completely fixes the issue of mouse acceleration on Windows 2000 or higher. You may need to play with the sensitivity cvar after turning on DirectInput as it samples slightly differently. If you don't wish to use DirectInput, m_fixaccel exists to enable the somewhat-ineffective mouse acceleration fix for Windows 2000+. With DirectInput, MOUSE1 through MOUSE8 can be bound, without DirectInput, up to MOUSE5. You can also use m_directinput 2 to enable "immediate" sampling mode with DirectInput if you have issues with m_directinput 1. The mouse behaviour when switching in and out of Q2 with Alt+Tab is also fixed so that it won't keep snapping your mouse all over the place.

DirectInput Keyboard
DirectInput keyboard support available in the latest versions. Use in_dinputkeyboard  to turn it on and off. I've attempted to re-create the keyboard repeat speed/delay settings similar to the "normal" keyboard input so it shouldn't be too different at all. DInput keyboard fixes the problem of Windows seemingly delaying sending input messages to Q2 during heavy CPU usage, this resulted in sticky or delayed keyboard input. You can use k_repeatrate and k_repeatdelay (both in milliseconds) to set the key repeat behaviour in DirectInput mode.

messagemode (chat) improvements
Messagemode and messagemode2 support an argument which will be used as default text in the text entry box. Eg bind u "messagemode2 I'm at" will bring up the "say_team: I'm at " when you hit it. The chat buffer also stores the previous messages you sent so you can use UP/DOWN key to go through them.

R1Q2 Protocol (protocol 35)
When connected to R1Q2 servers, a new protocol is able to be used which gives several improvements: faster free-flying observer movement, bandwidth savings on entity updates, support for much faster connection process thanks to zlib and a generic compressed packet format for faster auto downloading and receiving larger than 1400 bytes worth of entity updates at once. The qport cvar is changed to a single byte on R1Q2 protocol in order to reduce outgoing bandwidth usage. If you have multiple players behind a single IP, be sure they each use a unique qport value that is between 0 and 255. Use cl_protocol 34 to revert to the standard Q2 protocol if you have issues with the new protocol.

Sounds and OpenAL
Sounds are able to be loaded at 44Khz with s_khz 44. Be aware that Q2 sounds are mostly in 22khz format and upsampling to 44 khz will use a lot more memory and may cause stuttering if new sounds are loaded mid-game (whether this happens depends on whether mod precaches sounds properly). Experimental support for OpenAL 3D positional audio is implemented and requires the OpenAL runtimes (http://developer.creative.com/articles/article.asp?cat=1&sbcat=31&top=38&aid=46). Use s_initsound 2 to enable, see below for all the cvars to control it.

Filesystem Caching
File system speedups! R1Q2 maintains a binary tree of pak file contents so when looking for a file only a few lookups have to be done as opposed to scanning the entire pak file. A filesystem cache is also maintained, files that have previously been requested have their location stored in a separate binary tree allowing for fast future access. You can use the fs_cache cvar to control the level of caching - fs_cache 0 disables it completely. See below for more info on how fs_cache works. Be aware that if you modify a file on disk that has been cached by R1Q2, subsequent accesses will likely fail.

Misc things
R1q2 map override file generator.
Create your map (entity string) override files using this link: https://r-1.ch/r1q2gen.php

Toggle command can be used to toggle a cvar between 0/1 or a user specified list of options. Eg bind u toggle cl_gun, bind u toggle cl_maxfps 30 60 90.

Console buffer size doubled, command buffer sized up to 32k so loading large configs shouldn't be a problem. Current local time displayed in the console. Commands, aliases and cvars are stored in binary trees for faster internal lookups and are also case sensitive.

Various error conditions are drawn in text during gameplay on the middle left of the screen. These can give you an indication of a network condition well before the phonejack appears. Set scr_showturtle 0 to disable these.

Command completion is configurable how you like it - cl_cmdcomplete will determine which method to use. 0 uses standard Q2, 1 will use ProQuake (tab completes current command, hitting again will cycle to next match) and 2 will display a list of all matching cvars and commands similar to Quake 3. Default is 2.

When the client is minimized or in the background it will no longer consume 100% CPU as it will only do work when receiving packets so typically will drop to 10 fps.

Particle count increased to 16384. This should fix problems of disappearing railgun trails and other lost particle effects during heavy activity.

R1Q2 will only regard a client as something that falls under the CS_MAXCLIENTS configstring. This allows some badly designed mods which overload the CS_PLAYERSKINS indexes to work without causing hitches every time they update a configstring as normally this would invoke an attempted client load and/or auto downloading. Similarly, R1Q2 counts the maximum number of lightstyles sent by a server and won't loop through all 256 maximum entries each frame.

Improved networking functions - listen servers will no longer crash when a client drops on Win2000+, IPX code has been completely removed and better error handling added as well as some speedups and merging common code with linux functions. The client will also no longer bind to port 27910 unless it is actually running a server as well.

For those of you looking for a transparent console, you will need R1GL (put this .dll file in the root of your Quake2) and a transparent console PNG/TGA. There is no cvar to control transparency, R1GL uses the alpha from the 32 bit image in order to remain compatible with Q2 3.20.



Title: R1Q2 Client README
Post by: R1CH on December 01, 2004, 10:55:37 pm
Client Cvars:

cl_defertimer [float]
Defer rendering for this amount of time in seconds after loading renderer. Fixes vid_restarts in the middle of maps causing crashes. Default 1.

cl_protocol [0,34,35]
Protocol version to report. Defaults to 0 (autodetect) and will attempt protocol 35 followed by 34. Sometimes though you may have to set cl_protocol 34 to connect to some weird servers or if a server is running an old version of R1Q2. You should normally not need to touch this.

cl_lents [0/1]
Local entity test. Leave off for now as they don't really do anything. Default 0.

r_maxfps [integer]
Maximum rendering FPS (previously limited by cl_maxfps). Default 1000.

cl_maxfps [integer]
Controls network packet rate. More than 30 is rarely needed, keep it at 30 to save bandwidth and CPU resources on server. Default 30. If cl_async is 0, cl_maxfps and r_maxfps become the same thing.

cl_version [string]
Read-only cvar describing your client version.

scr_conheight [float]
Percentage of the screen that the console will drop to. Ranges beteen 0 and 1. Default 0.5.

m_directinput [0/1]
Enable DirectInput mouse support which provides smoother, non-accelerated mouse input. Default 0. Set to 1 to enable "buffered" DirectInput, 2 to enable "immediate" DirectInput. Immediate takes a snapshot of the mouse state when Q2 asks for one as opposed to buffered which lets Q2 see every single mouse event.

m_fixaccel [0/1]
Attempt to disable mouse acceleration on Win2k/XP/2k3. Note that this won't remove acceleration completely, but lessen the effect of it (Windows limitation). DirectInput is recommended to remove it completely. Default depends on OS, 0 on Win9x, 1 on Win2k+. Ignored if using DirectInput.

in_dinputkeyboard [0/1]
Enable DirectInput keyboard support. May help with those experiencing "keyjams" where input continues to occur after releasing a key or a key takes a moment to register. Default 0.

k_repeatrate [integer] / k_repeatdelay [integer]
Key repeat rate and delay when using DirectInput keyboard. Ignored if not using DirectInput keyboard. Defaults 0 mean to try to match those set in Windows.

cl_hidewindowtitle [0/1]
Hide the window title bar when in windowed mode. Default 0.

cl_cmdcomplete [0/1/2]
Console tab completion behaviour. 0 = standard Q2 style, 1 = ProQuake style, 2 = R1Q2 style.  Default 2.

cl_drawfps [0/1]
Draw the number of frames rendered per second on screen. Default 0.

cl_async [0/1]
Use asyncronous network/rendering FPS. Asyncronous FPS will reduce outgoing bandwidth/packet rate at the expense of altering how certain aspects of the physics respond. Set to 0 if you prefer to use the exact same model as Q2 3.20. Default 1.

cl_instantpacket [0/1]
Send packet immediately on important events such as weapon firing. Warning, this command will cause you to exceed whatever cl_maxfps is set to and may cause lag if your rendering rate is very high. Safe to use and recommended in b1788+ as it will only send additional packets on the first input event or command. Default 1, ignored if cl_async is 0.

cl_smoothsteps [0/1/2/3]
Smooth movement up steps/stairs. The prediction that smooths this doesn't work so well at low cl_maxfps values so you can turn it off. 0 = off, 1 = original Q2 style step smoothing, 2 = more aggressive step smoothing, 3 = try to detect 'steps' and only smooth them. If cl_async is set to 0, this cvar is ignored and the original Q2 style smoothing is used. Default 3.

cl_strafejump_hack [0/1]
If 1, predict strafejumps that would normally be capped by FPS limits. Will cause prediction misses on all servers except R1Q2 servers running sv_strafejump_hack 1. Before you ask, no, this will not allow you to strafe jump any better unless the server is R1Q2 with sv_strafejump_hack 1. Default 0.

cl_defermodels [0/1]
Defer model loading for faster connection times, but can cause stuttering when first entering the map. Default 1, can be disabled if it bothers you.

cl_filterchat [0/1]
Filter colortext or other funky characters from chat messages? Default 0.

cl_autorecord [0/1]
Automatically begin recording on entering a map? Default 0. Will record to 'YY-MM-DD-HHMM-mapname.dm2' if 1.

cl_railtrail [integer]
Set colored/xania railgun trail. Values from 1-5 will use a colored laser, values from 5-248 will alter the colors of the original railgun trail. Default 0.

cl_beginmapcmd [string]
cl_endmapcmd[string]
A string of commands to run at the beginning and end of a map respectively. Eg set cl_endmapcmd "screenshot" will take a screenshot at the end of a map.

net_maxmsglen [integer]
Maximum message size to support on R1Q2 servers. Default of 1390 matches Q2 3.20 default. Set to 0 to use maximum available size, this is recommended if your router/ISP doesn't suck. Many routers seem unable to handle UDP properly and thus you will experience stalled connections to R1Q2 servers with this set at 0. If it works at 0, use it, if not, stick with 1390.

s_ambient [0/1]
Control whether ambient sounds on entities or in the map are played. Default 1.

s_initsound [0/1/2]
Control sound initialization style. 0 = no sound, 1 = Q2 standard (DirectSound), 2 = OpenAL (requires OpenAL runtimes, see above). Default 1.

s_openal_device [string]
OpenAL device to use. Defaults to DirectSound3D, can be DirectSound or MMSYSTEM.

s_openal_extensions [0/1]
Control whether OpenAL should initialize any extensions. Default 1.

s_openal_eax [0/1]
Control whether to use EAX. Default 0. At present, only underwater effect is supported.

s_openal_volume [float]
Allows scaling of OpenAL volume. Default 1.

win_priority [-2/-1/0/1/2]
Control application priority level. Setting to -1 or -2 may help if you have devices drivers etc that require CPU time that Q2 is stealing from them. Default 0.

fs_cache [bitmask]
Control file system caching behaviour. Bit 1 caches files in paks, bit 2 caches missing files, bit 4 caches files outside paks. Eg to cache everything except files outside paks, use fs_cache 3. If a file is cached by R1Q2, you should not edit it on disk without performing an 'fsflushcache' command before Q2 tries to re-use it. Default 7 (cache everything).

fs_noextern [0/1]
Prevent loading of files outside of pak files. Default 0.

err_fatal [0/1]
Treat all errors as fatal. Default 0.

dbg_unload [0/1]
Control whether to unload DLLs on a crash. Default 1. Don't touch this unless you know what you're doing.

dbg_crash_on_fatal_error [0/1]
Control whether to int 3 on an ERR_FATAL. Default 0. Don't touch this unless you know what you're doing.


Title: Re: R1Q2 Client README
Post by: R1CH on May 05, 2005, 09:35:08 pm
Client commands:

ignore text
Ignore any chat messages containing text.

unignore text
Allow previously ignored messages containing text.

toggle cvar options
Toggle the value of the cvar cvar. The optional list of options may be specified as a list of options that will be toggled. Example: toggle cl_particles will flip cl_particles between 0 and 1. toggle cl_maxfps 30 60 90 will flip cl_maxfps between 30, 60 and 90 with each use.

addloc name
Add a map location at your current position called name. Used by the $$loc_here / $$loc_there metavars.

saveloc
Write the current map location database to maps/mapname.loc.

serverstatus [/s|/i] address
Show server status (player list, frags, etc) of the server at address. If /s is specified, the serverinfo string is also displayed. If /i is specified, the server 'info' string is displayed.

passive
Wait for an incoming passive connection. Test feature, probably shouldn't be used.