Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Call of Duty get Client CVAR

  1. #1
    ... connecting
    Join Date
    Aug 2015
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Call of Duty get Client CVAR

    Hi, i'm trying to add wide screen support to Call of Duty. I added the option to change screen resolution with wide screen res to graphics menu, but now i need to change users fov that have this option on when they connect to server.
    So i want to check user cvar r_mode and then set the cvar.

    Despite this is a "cheat protected cvar" I can change the cvar if I do it from the server. self setClientCvar("cg_fov", "90");
    This is a temoral change. As soon as the players disconnect the cvar goes back to normal.

    But i'm having problems with reading users r_mode cvar, is there a way to do this?

    Thanks!

  2. #2
    Brigadier General
    Join Date
    Oct 2012
    Posts
    998
    Thanks
    20
    Thanked 590 Times in 390 Posts
    Quote Originally Posted by dobledosis View Post
    Hi, i'm trying to add wide screen support to Call of Duty. I added the option to change screen resolution with wide screen res to graphics menu, but now i need to change users fov that have this option on when they connect to server.
    So i want to check user cvar r_mode and then set the cvar.

    Despite this is a "cheat protected cvar" I can change the cvar if I do it from the server. self setClientCvar("cg_fov", "90");
    This is a temoral change. As soon as the players disconnect the cvar goes back to normal.

    But i'm having problems with reading users r_mode cvar, is there a way to do this?

    Thanks!
    You cannot obtain a client's cvars in COD1 (you can in COD2/COD4). So, the answer to your question is - it isn't possible. All you can do is set the FOV to 90 for all client's and r_mode to -1, and leave it at that.

    As soon as the players disconnect the cvar goes back to normal.
    You need to run your mod from an fs_game folder and not from the "main" folder. That way each client will get a different config_mp.cfg file for your mod than the one generated and run from the "main" folder. That way, any changes you make to the client's settings will be permanent.
    Last edited by Tally; 2nd August 2015 at 15:22.

  3. #3
    ... connecting
    Join Date
    Aug 2015
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you for your response Tally.
    So is there a way to set fov 80 for players who don't use wide screen? and fov 90 for those who use wide screen resolution?
    Or a way to make that cvar not cheat protected so user can change it?
    Thanks again!

  4. #4
    Brigadier General
    Join Date
    Oct 2012
    Posts
    998
    Thanks
    20
    Thanked 590 Times in 390 Posts
    Quote Originally Posted by dobledosis View Post
    Thank you for your response Tally.
    So is there a way to set fov 80 for players who don't use wide screen? and fov 90 for those who use wide screen resolution?
    Or a way to make that cvar not cheat protected so user can change it?
    Thanks again!
    After checking, I found that 80 is the max you can set for FOV. So, you will have to use that for all clients.

    FYI - the cvar "cg_fov" is not linked to widescreen monitors or old-fashioned 4:3 monitors. So, you can get that idea out of your head. The cvar pushes the world further FORWARD from the player - it does not make the world WIDER.
    Last edited by Tally; 2nd August 2015 at 18:42.

  5. #5
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,018
    Thanks
    2,110
    Thanked 1,086 Times in 753 Posts
    There is quite some math behind it: https://www.quaddicted.com/engines/a...for_widescreen

    Adjusting FOV for Widescreen

    By default Quake uses a FOV (field of view) of 90. You can set a higher FOV to distort your view to see more to the sides of the screen. Setting a higher FOV also means that the center of the screen will be "zoomed away".
    If you are using a widescreen resolution to play Quake and keep the FOV of 90, you will actually play with a zoomed-in view instead of a realistic one. Widescreen means you should be able to see the same stuff like before but with additional space on the sides.
    Lordhavoc was so nice to share the formula:
    atan(tan(120*pi/360)*0.75*resolution_x/resolution_y)*360/pi
    For your convenience, here is a table of some more or less common resolutions and the resulting FOV values.
    fov 90 fov 100 fov 110 fov 120
    5:4 86.31 96.34 106.49 116.75
    4:3 90 100 110 120
    3:2 96.73 106.56 116.20 125.67
    8:5 100.39 110.07 119.47 128.61
    5:3 102.68 112.25 121.49 130.42
    16:9 106.26 115.63 124.59 133.17


    • 5:4 (1.250) resolutions are 1280x1024 and 2560x2048
    • 4:3 (1.3333) resolutions are 320x240, 640x480, 768x576, 800x600, 1024x768, 1280x960, 1400x1050, 1600x1200, 2048x1536. For these you do not need to adjust the FOV.
    • 3:2 (1.5000) resolutions are 480x320, 720x480, 960x640, 1152x768, 1440x960
    • 8:5 (1.6000) resolutions are 320x200, 1280x800, 1440x900, 1680x1050, 1920x1200, 2560x1600
    • 5:3 (1.6667) resolutions are 800x480 and 1280x768
    • 16:9 (1.7778) resolutions: 1280x720 and 1920x1080

    As you can see, if you use the equivalent of FOV 90 on eg 1680x1050 you get a FOV of 100 with no visual distortion. That's what widescreen gives you!
    Some other resolutions:
    fov 90 fov 100 fov 110 fov 120
    854x480 106.30 115.67 124.62 133.21
    1024x600 104.00 113.51 122.64 131.44
    1280x854 96.688 106.52 116.16 125.63
    1366x768 106.29 115.66 124.61 133.19
    2048x1080 109.78 118.92 127.57 135.81
    Maybe just give the user some menu buttons in ESC menu with this table, so he can choose FOV for himself (and test around quickly)?
    timescale 0.01

  6. #6
    Brigadier General
    Join Date
    Oct 2012
    Posts
    998
    Thanks
    20
    Thanked 590 Times in 390 Posts
    By default Quake uses a FOV (field of view) of 90. You can set a higher FOV to distort your view to see more to the sides of the screen.
    No Call of Duty game has ever used the Quake engine. The closets to it was a MODIFIED Quake 3 engine. Ergo, the above quote (and ultimately the whole math table in the post above) is not relevant to Call of Duty. You cannot set the FOV higher than 80, and the default FOV is 65.

    /thread

  7. #7
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,018
    Thanks
    2,110
    Thanked 1,086 Times in 753 Posts
    The setClientCvar() method never cared about limits, so just do:

    PHP Code:
    player setClientCvar("cg_fov""140"); 
    timescale 0.01

  8. #8
    Brigadier General
    Join Date
    Oct 2012
    Posts
    998
    Thanks
    20
    Thanked 590 Times in 390 Posts
    Quote Originally Posted by kung foo man View Post
    The setClientCvar() method never cared about limits, so just do:

    PHP Code:
    player setClientCvar("cg_fov""140"); 
    That wont work. You can't make a square peg fit a round hole. If the engine doesn't support greater FOV than 80, it makes not a jot of difference if you set 3000 in a cvar it wont have any effect.

  9. #9
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,018
    Thanks
    2,110
    Thanked 1,086 Times in 753 Posts
    Well, I have magic pegs ;P

    Click image for larger version. 

Name:	cg_fov.png 
Views:	73 
Size:	860.9 KB 
ID:	909

    Edit:

    Made a comparison of fov 80 to fov 106 (as in fov table) for widescreen (r_mode -1 r_customwidth 1280 r_customheight 720):

    Default fov:

    Click image for larger version. 

Name:	shot0001.jpg 
Views:	71 
Size:	261.6 KB 
ID:	910

    Fov table (weapon seeable again as normal):

    Click image for larger version. 

Name:	shot0002.jpg 
Views:	70 
Size:	251.7 KB 
ID:	911

    And to answer the question honestly: there are ppl who know how to read CoD1 cvars, but as soon somebody can read cg_fov he can also read cdkey-cvars etc...
    timescale 0.01

  10. #10
    ... connecting
    Join Date
    Aug 2015
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Cod default fov is 80, not 65. And 80 is not the max it supports as kung foo man proved.

    Look at this screenshots:

    1280x1024 FOV 80
    Click image for larger version. 

Name:	image.jpg 
Views:	66 
Size:	90.3 KB 
ID:	914

    1920x1080 FOV 100
    Click image for larger version. 

Name:	image.jpg 
Views:	65 
Size:	136.1 KB 
ID:	915

    If i can't read the cvar from server is there a way that when i try to change fov from client side the game allows this change without telling me that its a cheat protected cvar and without disabling all cheat protected cvars?
    Thanks!
    Attached Thumbnails Attached Thumbnails shot0127.jpg   shot0128.jpg  
    Last edited by dobledosis; 3rd August 2015 at 03:05.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •