FANDOM


When you use zoom feature, you may notice the mouse sensitivity may give you a different feeling, maybe you may feel it becoming a bit "slower", with the difference becoming bigger as you use different cg_fov values than the standard one.

You may be perfectly fine with this, as you may like a slower movement to have more aiming precision while zooming, but maybe you may prefer keeping the same feeling instead. In this page we will show you a configuration trick that will allow you to keep the same mouse sensitivity while zooming. As the workaround includes manually re-creating a zoom feature without using the built-in zoom feature, you can also use it to add an extra or intermediate level of zoom.

Why is this necessary? How does it work?Edit

OpenArena inherited its code from Q3A, and the code which adjusts mouse sensitivity while zooming may have been better. You may be fine with that, but you are not, you can apply this workaround which uses a script which sets a button to change your field of view instead of using built-in zoom feature. So, you will no more have to hold the standard zoom button, but to press a button once to enable zoom and again to disable it.

Technical explanation that you may skip, expand this box if you wish

The code that is used to scale zoom sensitivity in Quake 3 and OpenArena is vertical_zoomfov / 75.0. The result gets multiplied to both mouse acceleration and sensitivity. This formula is a bit flawed because it assumes the user is playing on 75 vertical fov [which is equivalent to cg_fov ~107 on 16:9 and ~91 on 4:3 with "classic" OA binaries up to 0.8.8 (VERT-), or to cg_fov ~91 on both 16:9 and 4:3 with "new" OA3 binaries (HOR+) - see Wikipedia]. A formula that would create more consistent results independently from cg_fov is vertical_zoomfov / vertical_basefov.

But there is another formula that is more correct than scaling the sensitivity linearly. It is tan(vertical_zoomfov / 2) / tan(vertical_basefov / 2).

So, we are taking advantage of this by manually tweaking m_yaw and m_pitch values using this formula: m_yaw * (tan(zoomfov / 2) / tan(basefov / 2) (and the same with m_pitch in the place m_yaw).
It doesn't matter if vertical or horizontal fov is used to scale, the result will be the same.
If you are trying to use the formula on your own: depending from the system you are using to make the calculations, you may or may not need to explicitly convert fov from degrees to radians first, in order to obtain the right results.

For the scaling to work properly it has to affect both mouse sensitivity and acceleration. Adjusting m_yaw and m_pitch by a factor will change mouse sensitivity and acceleration by that factor. You could also change cl_mouseaccel and sensitivity by the same factor instead, but it's probably cleaner to adjust m_yaw and m_pitch because then you can freely change sensitivity and cl_mouseaccel and the zoom sensitivity will be updated accordingly ("mouse speed" slider in Control Options modifies sensitivity CVAR).


If you move away from using +zoom and instead use a toggle bind that changes cg_fov you can then adjust m_yaw and m_pitch to get the optimal feel according to the formula. This is however only possible when switching to a toggle bind so if you prefer to hold your zoom button for zooming there is no solution for you.
Another small drawback of this workaround is that you may occasionally find yourself starting a new match or respawning after death with zoom already active, if you had it before.

As zoom feature is managed by "gamecode", even if OA3 may include a simpler workaround for mouse sensitivity during zoom, probably this one will still be the only way to go if you will need it in old mods.

The use of the formula is not strictly related with our "manual zoom" trick: you may wish to use it just to keep the same mouse feeling after you changed your cg_fov value for any other reason.
This stuff works with both Quake 3 Arena and OpenArena.

Involved settings and default valuesEdit

Let's recap the default values of the involved variables in OA 0.8.8:

  • m_yaw: 0.022
  • m_pitch: 0.022
  • cg_fov: 90 (horizontal field of view: 90 gives a "natural" look, but many players set it higher, even to 120 or similar, to see more enemies around them!)
  • cg_zoomfov: 22.5 (horizontal fov while holding the zoom button: our script isn't going to alter or to use this, but your value of this cvar is probably the zoom level you wish to emulate)
  • bind MOUSE2 +strafe (in the example, we will use MOUSE2 button for our custom zoom feature, of course you can use the key/button you prefer!)
  • bind MOUSE3 +zoom ("+zoom" is the standard OA zoom feature, that our script desn't affect. You can use it to compare the different "feeling".)

Just for completeness (our script isn't going to alter these cvars):

  • sensitivity: 5 (but you probably already changed it, due to such value being quite slow)
  • cl_mouseaccel: 0
  • cl_mouseaccelOffset: 0
  • cl_mouseaccelstyle: 5

The script creates a few "user-defined variables" and a "key binding" to set a button run the required commands. You can add the script directly to your q3config.cfg file, or in autoexec.cfg, or in another file that you have to manually launch with /exec <filename.cfg> command. Keep in mind that user-defined variables will be stored to your q3config.cfg file if they were already there or you created them with "seta" command, and not if you created them with "set" command and they did not exist yet. Key bindings are automatically stored to your q3config.cfg file.
See Set variables and Key binding for more infos, including how to remove user-defined variables and key bindings.

Calculate the new valuesEdit

To actually calculate the right m_yaw and m_pitch values you have to enter, the formula is m_yaw * (tan(zoomfov / 2) / tan(basefov / 2) (and the same with m_pitch in the place m_yaw). You can use your cg_zoomfov and cg_fov values for zoomfov and basefov, respectively.

Important: OA FOV values are in degrees and trigonometric functions as "tan" usually work with radians. So you will probably need to convert the two values to radians first; however some systems may assume the input is in degrees, so explicitly converting to radians may lead to erroneous results in that case. Check your results with our examples in this page to be sure you are doing right.
Let's take the case of an .ODS Spreadsheet, requiring to explicitly converting degrees to radians: in case A2 contains pitch, B2 contains standard fov and C2 contains zoom fov, the right formula to use there will be =A2*(TAN(RADIANS(C2)/2)/TAN(RADIANS(B2)/2)).

Using this ODS SpreadsheetEdit

If you wish, you can use the .ODS Spreadsheet prepared by Gig and ryvnf to calculate the new values. You can find it here: https://www.dropbox.com/s/a2uih9jkoq27mws/ScaleMouseSensitivityWithFOV_Zoom-OA_Q3A_V1.1.ods?dl=0 (25 KB) - You can open it using LibreOffice or other office suites.

It's very easy, it even creates the "manual zoom script" with your values, so you can just copy-paste it into your OpenArena (or Q3A) configuration files!

Using this Python scriptEdit

If you prefer, you may use the Python script fovsenscalc by ryvnf you can find here: https://github.com/OAGuild/oa-utils

It is possible to download the script and execute it using a Python interpreter using python fovsenscalc or ./fovsenscalc on Unix/Linux; Python for Windows can be downloaded here.

ExamplesEdit

Finally, let's go to make this: a key binding to a script which changes cg_fov, m_pitch and m_yaw to "emulate zoom" and "scale" your sensitivity accordingly, and then zooms out the next time you press the button.

Using default FOVsEdit

This examples switches from the default horizontal FOV value (90) to the default zoom value (22.5) with the default m_yaw and m_pitch value (0.022).

To calculate our new m_yaw and m_pitch value. We multiply the old value by the result of the formula:

0.022 * (tan(22.5 degrees / 2) / tan(90.0 degrees / 2)) = 0.022 * 0.19891236738 = 0.00437607208236000


Expand this if you wish to use the Python computing script

With the fovsenscalc script the new value can be calculated by entering the following command:

./fovsenscalc 22.5 90 0.022


Our script to bind mouse2 to toggle zoom becomes as follows:

set cg_fov 90
set m_yaw 0.022
set m_pitch 0.022
//The three lines above are not strictly necessary

set zoom "vstr zoom1" 
set zoom0 "set zoom vstr zoom1; set cg_fov 90.0; set m_yaw 0.022000; set m_pitch 0.022000"
set zoom1 "set zoom vstr zoom0; set cg_fov 22.5; set m_yaw 0.004376; set m_pitch 0.004376;
bind mouse2 "vstr zoom"

How many decimals to use in the script to use it up to you. The more decimals you use the more accurate the sensitivity scaling will be. But as more decimals are added the difference in accuracy quickly becomes unnoticeable.

Using an high FOVEdit

This example switches form a large FOV value to the default zoom value. The unzoomed FOV is 120 and the zoomed FOV is 22.5. m_yaw and m_pitch when unzoomed are the default value of 0.022.

We calculate our new m_yaw and m_pitch using the formula as the previous example.

0.022 * (tan(22.5 degrees / 2) / tan(90.0 degrees / 2)) = 0.022 * 0.114842108852 = 0.00252652639474

Our configuration script to bind mouse2 to toggle zoom becomes as follows:

set cg_fov 120
set m_yaw 0.022
set m_pitch 0.022
//The three lines above are not strictly necessary

set zoom "vstr zoom1" 
set zoom0 "set zoom vstr zoom1; set cg_fov 120.0; set m_yaw 0.022000; set m_pitch 0.022000"
set zoom1 "set zoom vstr zoom0; set cg_fov  22.5; set m_yaw 0.002526; set m_pitch 0.002526"
bind mouse2 "vstr zoom"

Inserting an additional zoom levelEdit

It is possible to take advantage of the script to get a feature not included with the game itself: different levels of zoom. You can do it by adding an extra support variable which includes an intermediate (or even higher) level of zoom, in a way that pressing the button will allow you to cycle between standard view --> zoom level 1 --> zoom level 2 --> standard view.

Here we will be using 90 FOV for 'standard view', 45 FOV for 'zoom level 1' and 22.5 FOV for 'zoom level 2'. m_pitch and m_yaw are 0.022 in the 'standard view'.

Expand this if you wish to use the Python computing script

Here we will be using the fovsenscalc-script to do the calculation of m_pitch and m_yaw at the our zoom levels. In the calculation example $ is the shell prompt and it is assumed that the user is inside the directory containing the fovsenscalc script-file.

$ ./fovsenscalc 45 90 0.022
0.00911269837221
$ ./fovsenscalc 22.5 90 0.022
0.00437607208236000

As the output of the commands show our m_pitch and m_yaw should be 0.0091126 at zoom level 1 and 0.004376 at zoom level 2.


Our configuration script now becomes:

set cg_fov 90
set m_yaw 0.022
set m_pitch 0.022
//The three lines above are not strictly necessary

set zoom "vstr zoom1" 
set zoom0 "set zoom vstr zoom1; set cg_fov 90.0; set m_yaw 0.022000; set m_pitch 0.022000"
set zoom1 "set zoom vstr zoom2; set cg_fov 45.0; set m_yaw 0.009113; set m_pitch 0.009113"
set zoom2 "set zoom vstr zoom0; set cg_fov 22.5; set m_yaw 0.004376; set m_pitch 0.004376"
bind mouse2 "vstr zoom"

See alsoEdit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.