Adding FOV Slider to Options
by Jason Campbell · 02/18/2015 (10:12 pm) · 8 comments
Not much of a resource but it seems that some players want this option and I've seen some complaints, "Why no FOV options?!"
Anyway it's real simple and only really adds the ability to raise the FOV, 9 above it's default from 65 to 74. It's 74 because any further and you see the end of the FPS arms. I chose the ability to go from 50 to 74 in the slider. It's easily altered from the GUI editor by clicking the slider and altering the range within the properties.
Step 1:
If you haven't altered your optionsDlg.gui, just replace your current file with the one from the download below. Back-up your current one, if you like.
FOV_Slider.zip
www.mediafire.com/download/ckzw497t2f84f7n/FOV_Slider.zip
Step 2:
Open game/art/datablocks/player.cs
in datablock PlayerData(DefaultPlayerData) find:
and change it to this:
Step 3:
Open game/scripts/client/default.bind.cs find:
and change it to:
Hopefully that will do it. Load up a level and hit Ctrl-O and knock yourself silly with an almost useless slider!
Anyway it's real simple and only really adds the ability to raise the FOV, 9 above it's default from 65 to 74. It's 74 because any further and you see the end of the FPS arms. I chose the ability to go from 50 to 74 in the slider. It's easily altered from the GUI editor by clicking the slider and altering the range within the properties.
Step 1:
If you haven't altered your optionsDlg.gui, just replace your current file with the one from the download below. Back-up your current one, if you like.
FOV_Slider.zip
www.mediafire.com/download/ckzw497t2f84f7n/FOV_Slider.zip
Step 2:
Open game/art/datablocks/player.cs
in datablock PlayerData(DefaultPlayerData) find:
cameraDefaultFov = 55.0; cameraMinFov = 5.0; cameraMaxFov = 65.0;
and change it to this:
cameraDefaultFov = $pref::Player::currentFov; // change cameraMinFov = 5.0; cameraMaxFov = 75; //change
Step 3:
Open game/scripts/client/default.bind.cs find:
function turnOffZoom()
{
ServerConnection.zoomed = false;
setFov(ServerConnection.getControlCameraDefaultFov());
Reticle.setVisible(true);
zoomReticle.setVisible(false);
// Rather than just disable the DOF effect, we want to set it to the level's
// preset values.
//DOFPostEffect.disable();
ppOptionsUpdateDOFSettings();
}and change it to:
function turnOffZoom()
{
ServerConnection.zoomed = false;
setFov($pref::Player::CurrentFOV); // Change
Reticle.setVisible(true);
zoomReticle.setVisible(false);
// Rather than just disable the DOF effect, we want to set it to the level's
// preset values.
//DOFPostEffect.disable();
ppOptionsUpdateDOFSettings();
}Hopefully that will do it. Load up a level and hit Ctrl-O and knock yourself silly with an almost useless slider!
About the author
#3
02/19/2015 (9:56 am)
I'm sure it can and that's a good idea. Might actually make this useful. I'll look into it.
#4
Great idea!
02/19/2015 (2:00 pm)
Yeah also if there is a way to do some of the other camera views people are interested in there project...using maybe the adv camera system code and have it where each camera view has certain values..That would really be an awesome resource for the engine!!Great idea!
#5
02/20/2015 (6:29 am)
please note that this is for single player only, and will affect all players if you choose to have a multiplayer game. the FOV imo should not even be in the datablock.
#6
02/20/2015 (7:00 am)
I admit I thought containing the variable in the client prefs would allow this to work in multiplayer. I guess I'm wrong?
#7
Unless the client overrides the shape FOV with its own preference value.
But yeah, having these shape FOV fields in ShapeBase is kind of dumb. I think we should nuke them sometime in the future.
02/21/2015 (3:00 pm)
When the datablock is created (on the server), its FOV will be set to the value that the host has in their preferences. Then, when a client connects to the game and spawns a player with DefaultPlayerData, they will receive the datablock from the server, with the server's FOV in it, and be stuck with that FOV.Unless the client overrides the shape FOV with its own preference value.
But yeah, having these shape FOV fields in ShapeBase is kind of dumb. I think we should nuke them sometime in the future.

Jason Campbell