PDA

View Full Version : Call of Duty get Client CVAR



dobledosis
2nd August 2015, 13:56
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!

Tally
2nd August 2015, 14:19
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.

dobledosis
2nd August 2015, 14:57
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!

Tally
2nd August 2015, 17:38
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.

kung foo man
2nd August 2015, 18:40
There is quite some math behind it: https://www.quaddicted.com/engines/adjusting_fov_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 (http://www.quakeworld.nu/forum/viewtopic.php?pid=56610#p56610):
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)?

Tally
2nd August 2015, 19:18
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

kung foo man
2nd August 2015, 20:14
The setClientCvar() method never cared about limits, so just do:



player setClientCvar("cg_fov", "140");

Tally
2nd August 2015, 22:52
The setClientCvar() method never cared about limits, so just do:



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.

kung foo man
3rd August 2015, 00:38
Well, I have magic pegs ;P

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:

910

Fov table (weapon seeable again as normal):

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...

dobledosis
3rd August 2015, 02:02
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
914

1920x1080 FOV 100
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!

Tally
3rd August 2015, 03:12
I love mod forums. You make a mistake, and they take the piss out of you for doing it. Even after you've tried to help them. I call that a gratitude problem. If Kung has proved you can set the FOV beyond its intended bandwidth with screenshots, I certainly don't need any more to prove the point. Point made is point made. Only a moron needs it drumming into them, and I am no moron.

kung foo man
3rd August 2015, 03:38
I am even thankfully that you state something that can be disproven, so we can discuss things further. :D Most people probably would be "scared" of being wrong on details and don't mention anything, even though they could and would like to say something useful.

dobledosis
3rd August 2015, 03:57
I'm sorry, you are too sensitive Tally. I wasn't trying to show fov above 80, i was trying to show how i can simulate wide screen with custom res and fov.

Edit, i ask again
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!

IzNoGoD
3rd August 2015, 17:34
There could be an option for that by setting different flags for the serv. I have no clue however how that would be pushed onto the client. I push cvars pre-download onto the client to allow www downloading on my mod, but that forces the value of that cvar onto the client, which is not what you want.

Still, flags on server cvars might work