first pass at third person over the shoulder option

Everything about development and the OpenMW source code.
crassell
Posts: 49
Joined: 26 Aug 2017, 21:10

first pass at third person over the shoulder option

Post by crassell »

Hello everyone. This is my first post. I have not officially applied to be a developer but I have been wanting to get involved with toying with the game mechanics of OpenMW for some possible post 1.0 feature adds. I have little to no experience in game engine programming but I know my way around c++ for large code bases as I help maintain a large micro-architectural CPU simulator at my job.

I have added a very simple modification to camera.cpp/camera.hpp to support over the shoulder third person camera. It seems to work pretty well but I have not tested all view changing states that may be options in Morrowind. Basically, as of now, you can keep pressing tab to cycle through first person, third person, and third person over the shoulder.

Seems like this feature is also partially satisfied with what i've added:
https://bugs.openmw.org/issues/390

Image

A few things I would like to know for incorporating this into OpenMW:
1. Is the team ok with adding these sort of modifications as options to OpenMW even though they are non-vanilla at this point?
2. How would one add these sort of game mechanic options without breaking the vanilla experience (set in the config file, enable in a game menu, etc.)?
2. Is there a way to get a more experienced graphics coder to review my changesets until i know what i'm doing? :)
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: first pass at third person over the shoulder option

Post by Zini »

1. I would see this more as a post-1.0 feature, but I also don't see it causing any problems besides maybe missing localised labels. Therefore I won't veto it.
2. For the time being it would be best to offer this as an alternative mode for 3rd person. In other words add an option to the user settings file that selects between conventional 3rd person and the over the shoulder version. I guess we could get away with not adding this option to the settings GUI for now, which would also eliminate the issue of localised labels.
3. Push it to github, then start a pull request to initiate the review.
crassell
Posts: 49
Joined: 26 Aug 2017, 21:10

Re: first pass at third person over the shoulder option

Post by crassell »

Zini wrote: 28 Aug 2017, 11:29 1. I would see this more as a post-1.0 feature, but I also don't see it causing any problems besides maybe missing localised labels. Therefore I won't veto it.
Completely showing my ignorance here. Can you elaborate on "localized labels" ? Would this be the new config option for it?
Zini wrote: 28 Aug 2017, 11:29 2. For the time being it would be best to offer this as an alternative mode for 3rd person. In other words add an option to the user settings file that selects between conventional 3rd person and the over the shoulder version. I guess we could get away with not adding this option to the settings GUI for now, which would also eliminate the issue of localised labels.
Ok so I'll revert the cycling option and add a new variable as something like mActiveThirdPersonView. This will contain a value from the current active view enum whose options are: (FirstPerson, ThirdPerson, ThirdPersonOverTheShoulder). I may also add a left and right ThirdPersonOverTheShoulder if people want the option. I'll have to reverse engineer the portion of code for adding GUI elements but the code base is fairly organized so shouldn't take too long. I'll post updated screenshots.
Zini wrote: 28 Aug 2017, 11:29 3. Push it to github, then start a pull request to initiate the review.
Will do after I make the necessary modifications.
User avatar
Amenophis
Posts: 320
Joined: 30 Oct 2011, 04:34
Location: Fortaleza - Ceará - Brasil

Re: first pass at third person over the shoulder option

Post by Amenophis »

crassell wrote: 28 Aug 2017, 15:30 Ok so I'll revert the cycling option and add a new variable as something like mActiveThirdPersonView.
Just passing to say how I’m like this new camera mode and to remember that OpenMW has an option to use the mouse scroll to change from 1st to 3rd view. http://openmw.readthedocs.io/en/master/ ... erson-zoom
I ask that you keep that TAB cycling option because combined with the Third Person Zoom the result would be fantastic.

Can I ask for a crosshair in 3rd view when the player has an bow or is the magic stance like MGE XE does? http://www.nexusmods.com/morrowind/mods/41102

“There are three modes available:
Mode 0 - Always display crosshair in third person mode.
Mode 1 - Display when a ranged weapon is readied,
or you are in magic casting stance. [default]
Mode 2 - Display only when a ranged weapon is readied”.
crassell
Posts: 49
Joined: 26 Aug 2017, 21:10

Re: first pass at third person over the shoulder option

Post by crassell »

Amenophis wrote: 28 Aug 2017, 16:57 Just passing to say how I’m like this new camera mode and to remember that OpenMW has an option to use the mouse scroll to change from 1st to 3rd view. http://openmw.readthedocs.io/en/master/ ... erson-zoom
I ask that you keep that TAB cycling option because combined with the Third Person Zoom the result would be fantastic.
I'll keep the tab cycling when the configuration is enabled then. Also, thanks for pointing out the mouse scroll support. Didn't realize it was there so I'll make sure this mode is friendly with it.

FYI code like this pains me even though it may not be on a performance critical path. String compares/hashing here, there, and everywhere are death by a thousand cuts:

Code: Select all

if (Settings::Manager::getBool("allow third person zoom", "Input"))
                    MWBase::Environment::get().getWorld()->setCameraDistance(static_cast<float>(arg.zrel), true, true);
                    
Amenophis wrote: 28 Aug 2017, 16:57 Can I ask for a crosshair in 3rd view when the player has an bow or is the magic stance like MGE XE does? http://www.nexusmods.com/morrowind/mods/41102

“There are three modes available:
Mode 0 - Always display crosshair in third person mode.
Mode 1 - Display when a ranged weapon is readied,
or you are in magic casting stance. [default]
Mode 2 - Display only when a ranged weapon is readied”.
This feature will have to be on the next pass for me but seems doable. For now i'll get over the shoulder in the source and then i'll look into these options.
User avatar
Amenophis
Posts: 320
Joined: 30 Oct 2011, 04:34
Location: Fortaleza - Ceará - Brasil

Re: first pass at third person over the shoulder option

Post by Amenophis »

Thank you!
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: first pass at third person over the shoulder option

Post by Zini »

Completely showing my ignorance here. Can you elaborate on "localized labels" ? Would this be the new config option for it?
In the settings GUI, if you add a new option you will have to add a label to it that describes what the option does. These labels need to be localisable (not sure if that is actually a word). Currently we do not have a mechanism in place to do that (post 1.0 feature).
crassell
Posts: 49
Joined: 26 Aug 2017, 21:10

Re: first pass at third person over the shoulder option

Post by crassell »

So now it cycles by tab like vanilla when third person over shoulder is disabled. Otherwise, it will cycle first, third person vanilla, and over the shoulder third person. I decided not to enable mouse wheel distance changes with third person over shoulder since the effect moving away from the camera looked strange when the player is shifted to the left for over the shoulder.

I added a new default-settings.cfg variable:

Code: Select all

# Allow third person over the shoulder option
third person over shoulder = false
Is this placement for the option ok?

Image
crassell
Posts: 49
Joined: 26 Aug 2017, 21:10

Re: first pass at third person over the shoulder option

Post by crassell »

Pull request is now available.
Chris
Posts: 1625
Joined: 04 Sep 2011, 08:33

Re: first pass at third person over the shoulder option

Post by Chris »

crassell wrote: 31 Aug 2017, 02:30 So now it cycles by tab like vanilla when third person over shoulder is disabled. Otherwise, it will cycle first, third person vanilla, and over the shoulder third person.
Why add a config option just to add over-the-shoulder to the existing modes? If it's not replacing anything, why have an extra step to enable it?

Seems to me there doesn't really need to be a distinction between third-person and third-person over-the-shoulder. The latter is just the former with a X/Y offset, isn't it? Simply adding some offset configuration options would create the same effect (and allow users to tweak their desired offset, if they prefer a larger or smaller offset, farther up or down, or on the left instead of the right).
Is this placement for the option ok?
You can't add it to the in-game UI because there's no localization for it (it's the wrong language for someone playing the German version, for example).
Post Reply