Page 1 of 2

Not-In-The-Way Thirdperson

PostPosted: 31 Jan 2012, 04:11
by greaserpirate
I heard someone suggest an over-the-shoulder type thirdperson a while a go, and I decided to try making a mod for it myself. It turned out to be extremely easy, since no matter where you move the camera it still focuses on where you're shooting. However, I could only move the camera absolutely (north/south as opposed to left-right) so it's not technically an over-the-shoulder camera, but I'm not sure how the degrees of the player's yaw is measured. I tried treating it like degrees, and it didn't work, but it may be just because I haven't taken trig yet so all my knowledge is secondhand from my math-nerd friends. :)

In my opinion this is a huge improvement over normal thirdperson because you can actually see your target, as opposed to having your head be in the way most of the time.

Srcreenshot:
Image

View more screenshots: http://imgur.com/a/jaVF0#0


By the way, I should probably tell you: to use it, after compiling, type /thirdpersonx 3 /thirdpersony 3 /thirdpersonz 1.5 or some variation of that. I find those values were best when combined with /thirdpersondist 8.

Here's the source code. I didn't have to change much, just some things on lines 49-51 and 2212-2216 of game.cpp.

Re: Not-In-The-Way Thirdperson

PostPosted: 31 Jan 2012, 16:08
by Glennz
Looks nice... :)
Maybe have this as a setting?
The second and fourth images look better then the first and third, are they of different height or something?

Image

Looks very nice, great distance and position

Image

Looks a little weird???

Re: Not-In-The-Way Thirdperson

PostPosted: 31 Jan 2012, 16:12
by GooshGoosh!
I've downloaded it, I don't know how to install it or as you say: compile it.

please help me :( (I'm using Windows 7 by the way, very soon I'll move to Linux)

Re: Not-In-The-Way Thirdperson

PostPosted: 31 Jan 2012, 16:18
by TheLastProject
That plays surprisingly nicely. So nicely, in fact, that I would love to be able to choose between "First Person" and "Third Person" under gameplay style under profile. That would be sweet.

(I've tried your default values, but I generally prefer a higher /thirdpersondist, even up to 20, because it shows quite nicely how your character moves, something you can barely see when you move forward with /thirdpersondist 8)

There is only one downside to this at the moment: the camera has the urge to go into parts of the map it shouldn't go relatively often, causing rendering issues. In case this can be fixed (and even if it can't be), I really want the third person standard settings to be changed from the current default to something like this, possibly with higher thirdpersondist.

Re: Not-In-The-Way Thirdperson

PostPosted: 31 Jan 2012, 17:50
by inpersona64
TheLastProject {l Wrote}:That plays surprisingly nicely. So nicely, in fact, that I would love to be able to choose between "First Person" and "Third Person" under gameplay style under profile. That would be sweet.

(I've tried your default values, but I generally prefer a higher /thirdpersondist, even up to 20, because it shows quite nicely how your character moves, something you can barely see when you move forward with /thirdpersondist 8)

Along with this, I'd love it if you were able to "switch sides" in game while being in 3rd person. What I mean by this is that when you use the over-the-shoulder view, you are only viewing from one shoulder view. So if there was a button that symmetrically switched from the current shoulder to the other, that would be great. An example of this can be seen in games like Gears of War and SOCOM: U.S. NAVY Seals Confrontation (a game I played again last night, nostalgia ftw). It's not a big deal though. If it were included as an option in 1.3, that'd be great. But the over-the-shoulder idea in general is a really great idea IMO.

Re: Not-In-The-Way Thirdperson

PostPosted: 31 Jan 2012, 19:44
by arand
One problem I noticed with this is that the camera offset appears to be relative to the world rather than relative to the player, meaning for example that if the camera is offset to the right, relative to the player, when you are facing one direction, it will be offset to the left when facing the other direction.

Other than that, it's pretty cool, a large offset (/firstpersony 50) is really nice for making cinematic camera tracking of a player, but as per above, it only works from one direction :)

Re: Not-In-The-Way Thirdperson

PostPosted: 31 Jan 2012, 20:18
by GooshGoosh!
Can someone tell me how to install the mod!? I really want to try it out, but I don't know how to install the f***ing thing!! :x

Re: Not-In-The-Way Thirdperson

PostPosted: 31 Jan 2012, 20:31
by arand
You replace the existing src/game/game.cpp with the file supplied by greasepirate above, then recompile the game.

viewtopic.php?f=53&t=2593 has some info about compiling, there are no step-by-step instructions for windows.

Re: Not-In-The-Way Thirdperson

PostPosted: 01 Feb 2012, 00:41
by sireus
greaserpirate {l Wrote}:However, I could only move the camera absolutely (north/south as opposed to left-right) so it's not technically an over-the-shoulder camera, but I'm not sure how the degrees of the player's yaw is measured. I tried treating it like degrees

It's in degrees, but you'll have to convert it to radians for use in functions like sinf. However, instead of fiddling with trigonometric functions yourself, you can simply create an offset vector, rotate it and then apply it to the camera position. Something like
{l Code}: {l Select All Code}
vec offset = vec(0, 2.0f, 0);
offset.rotate_around_z(player->yaw * RAD);
camera->o.add(offset);

This will probably not work as is, but you get the idea. If you have z offset, you can also rotate around the y (or is it x?) axis for pitch, obviously.

Re: Not-In-The-Way Thirdperson

PostPosted: 01 Feb 2012, 02:40
by greaserpirate
arand {l Wrote}:One problem I noticed with this is that the camera offset appears to be relative to the world rather than relative to the player, meaning for example that if the camera is offset to the right, relative to the player, when you are facing one direction, it will be offset to the left when facing the other direction.

Other than that, it's pretty cool, a large offset (/firstpersony 50) is really nice for making cinematic camera tracking of a player, but as per above, it only works from one direction :)


Yeah, I don't really know how to get around that. I know the player's yaw (it's stored in the hard-coded variable "player1->yaw") but I can't seem to find what it's measured by. I made it so it would print the value every frame update, and I got huge numbers like 234789798798 and -523984798734. Any help, devs?

Oh, and by the way, for all of those who want to use this on Windows but can't compile, I think I can cross-compile it for windows on Ubuntu. Move these files to your "bin" folder (Back it up first!) and tell me what happens.

Re: Not-In-The-Way Thirdperson

PostPosted: 01 Feb 2012, 04:01
by arand
I cargo-culted it, based on greasepirate's and sireus's work, it seems like
{l Code}: {l Select All Code}
FVAR(IDF_PERSIST, thirdpersonx, FVAR_MIN, 0, FVAR_MAX);
FVAR(IDF_PERSIST, thirdpersony, FVAR_MIN, 0, FVAR_MAX);
FVAR(IDF_PERSIST, thirdpersonz, FVAR_MIN, 0, FVAR_MAX);
and
{l Code}: {l Select All Code}
vec offset = vec(thirdpersonx, thirdpersony, thirdpersonz);
offset.rotate_around_z(player1->yaw * RAD);
camera1->o.add(offset);

Does kind of what we're after...

In order to get something close to the over-shoulder style camera it seems like
{l Code}: {l Select All Code}
/thirdpersonx 2
/thirdpersony -5
/thirdpersonz 2
/thirdpersondist 0

gets close.

It is imperfect and ugly, and it makes your aim offset with the same amount :D and that will likely be the hard part to crack if this is ever going to be viable :)

Re: Not-In-The-Way Thirdperson

PostPosted: 02 Feb 2012, 04:13
by greaserpirate
sireus {l Wrote}:
greaserpirate {l Wrote}:However, I could only move the camera absolutely (north/south as opposed to left-right) so it's not technically an over-the-shoulder camera, but I'm not sure how the degrees of the player's yaw is measured. I tried treating it like degrees

It's in degrees, but you'll have to convert it to radians for use in functions like sinf. However, instead of fiddling with trigonometric functions yourself, you can simply create an offset vector, rotate it and then apply it to the camera position. Something like
{l Code}: {l Select All Code}
vec offset = vec(0, 2.0f, 0);
offset.rotate_around_z(player->yaw * RAD);
camera->o.add(offset);

This will probably not work as is, but you get the idea. If you have z offset, you can also rotate around the y (or is it x?) axis for pitch, obviously.


Thanks a million for the code! At this point, the mod is pretty much all your content. :D

arand {l Wrote}:It is imperfect and ugly, and it makes your aim offset with the same amount :D and that will likely be the hard part to crack if this is ever going to be viable :)


It's simple to fix. If you add this code, which was only a few lines above, after "camera1->0.add(offset)":
{l Code}: {l Select All Code}
          findorientation(camera1->o, (self ? player1 : focus)->yaw, (self ? player1 : focus)->pitch, worldpos);


the camera and player focus on the same point.

Now about that being hard.. :lol:

Re: Not-In-The-Way Thirdperson

PostPosted: 02 Feb 2012, 10:31
by Glennz
greaserpirate {l Wrote}:
sireus {l Wrote}:
greaserpirate {l Wrote}:However, I could only move the camera absolutely (north/south as opposed to left-right) so it's not technically an over-the-shoulder camera, but I'm not sure how the degrees of the player's yaw is measured. I tried treating it like degrees

It's in degrees, but you'll have to convert it to radians for use in functions like sinf. However, instead of fiddling with trigonometric functions yourself, you can simply create an offset vector, rotate it and then apply it to the camera position. Something like
{l Code}: {l Select All Code}
vec offset = vec(0, 2.0f, 0);
offset.rotate_around_z(player->yaw * RAD);
camera->o.add(offset);

This will probably not work as is, but you get the idea. If you have z offset, you can also rotate around the y (or is it x?) axis for pitch, obviously.


Thanks a million for the code! At this point, the mod is pretty much all your content. :D

arand {l Wrote}:It is imperfect and ugly, and it makes your aim offset with the same amount :D and that will likely be the hard part to crack if this is ever going to be viable :)


It's simple to fix. If you add this code, which was only a few lines above, after "camera1->0.add(offset)":
{l Code}: {l Select All Code}
          findorientation(camera1->o, (self ? player1 : focus)->yaw, (self ? player1 : focus)->pitch, worldpos);


the camera and player focus on the same point.

Now about that being hard.. :lol:


Sounds awesome, this needs to be in 1.3. :)

Re: Not-In-The-Way Thirdperson

PostPosted: 02 Feb 2012, 20:19
by arand
greaserpirate's suggestion seems to fix aiming :)

But the more I poke at it, the more it is apperent it needs a bit of polish before it would be Good™

It still makes aiming behave different in our case compared to the standard third person:
I you try switching between
{l Code}: {l Select All Code}
/thirdpersondist 25; thirdperson
/thirdpersondist 0; thirdperson y -25
You notice that in the first, default case, the player is always kept centered in the screen whilst aiming, whereas with our new y offset, the aim does not keep the player in focus, making it act very strange when you aim far up or down; you actually aim a good bit behind the player at full tilt :) it would be nice if it acted similarly.

Continuing on, how would clipping be corrected? It appears currently clipping is corrected based on the scalar thirdpersondist value, any idea how to do that with our now vector entity?

I wonder if it would make most sense to have /thirdperson go 0..3 as [none, default, left shoulder, right shoulder], or if there would be better with a new /thirdpersonstyle for the three alternatives (or more?)

Re: Not-In-The-Way Thirdperson

PostPosted: 02 Feb 2012, 22:10
by Catalanoic
I think that is perfect to combine this with View Bobbing or Trembling Camera, discussed here: viewtopic.php?f=53&t=2053

Re: Not-In-The-Way Thirdperson

PostPosted: 04 Feb 2012, 01:19
by greaserpirate
arand {l Wrote}:It still makes aiming behave different in our case compared to the standard third person:
I you try switching between
{l Code}: {l Select All Code}
/thirdpersondist 25; thirdperson
/thirdpersondist 0; thirdperson y -25
You notice that in the first, default case, the player is always kept centered in the screen whilst aiming, whereas with our new y offset, the aim does not keep the player in focus, making it act very strange when you aim far up or down; you actually aim a good bit behind the player at full tilt :) it would be nice if it acted similarly.


"Thirdpersony" wasn't actually intended as a replacement for "thirdpersondist". In this release I will remove it, and rename "thirdpersonx" to "thirdpersonshoulder" and "thirdpersonz" to "thirdpersonheight" for clarity.

Here are the files. I'm going to be away for a while, but I might check the forums occasionally. If anyone wants to add on to this code, feel free.

Re: Not-In-The-Way Thirdperson

PostPosted: 10 May 2012, 22:41
by GooshGoosh!
I hope it will be added to 1.3 version :D

Re: Not-In-The-Way Thirdperson

PostPosted: 10 May 2012, 22:59
by wowie
GooshGoosh! {l Wrote}:I hope it will be added to 1.3 version :D

Only if it is added as a mutator, it lets you see around corners, which encourages camping since you can see without being seen.

Re: Not-In-The-Way Thirdperson

PostPosted: 11 May 2012, 01:33
by greaserpirate
wowie {l Wrote}:it lets you see around corners, which encourages camping since you can see without being seen.


It may allow you to see around corners, but you can't shoot around them. I tried it out, and it didn't work- your legs, arm, and head always stick out, allowing your target to get an easy headshot on. It makes much more sense to firefight around the corner, i.e. shoot, duck behind corner to reload, pop out and shoot again, etc. Or if you're lazy, to hide at a 90 degree angle to the door and wait with your gun at head level for them to come around, aided by radar.

But if you really think it's a problem, I can prevent the player from entering a negative thirdpersonshoulder value, so they only see over the player's left shoulder. (if you try looking around corners like that, your whole body will be sticking out.)

Re: Not-In-The-Way Thirdperson

PostPosted: 11 May 2012, 03:34
by wowie
I'm sorry, cheap shots are always the first thing I think of when I think of 3rd person view {edit:} in a first person shooter. But, if you've tested it and it doesn't affect gameplay, I'm fine with it. {edit:} :)

Re: Not-In-The-Way Thirdperson

PostPosted: 14 May 2012, 17:11
by ZeroKnight
Looking around corners can be done with any implementation of third-person, really. So the point is kinda moot. Though you do still actually have to spring out to shoot.

Re: Not-In-The-Way Thirdperson

PostPosted: 15 May 2012, 17:29
by inpersona64
wowie {l Wrote}:I'm sorry, cheap shots are always the first thing I think of when I think of 3rd person view {edit:} in a first person shooter. But, if you've tested it and it doesn't affect gameplay, I'm fine with it. {edit:} :)

People in SOCOM Confrontation do that all the time. I think its one of the reasons 1st person just appeals to me more. But a mutator for third person (so that EVERYONE has to play in it) would be pretty nice.

Re: Not-In-The-Way Thirdperson

PostPosted: 18 Nov 2012, 10:48
by qreeves
Okay, so I had a "glimmer idea" this evening and decided to try something out with this "off-center third person" prospect, and I think the results might actually be a fair compromise that may even be appealing. My idea was basically this: If it is so much trouble to line up the camera and player orientation positions when going "off center", then why do it at all? The only important vector is where the player is aiming, so in third person, move the on-screen cursor instead. This seems to result in a semi-fluid camera state, once you get used to the fact you're aiming from the player and not the camera. Screenshots attached.

Re: Not-In-The-Way Thirdperson

PostPosted: 18 Nov 2012, 12:28
by arand
I like this new thirdperson mode, it seems like it might take a while to get used to the smoothness and relativeness, but it doesn't seem overly tricky compared to previous thirdperson as far as I can tell.

I'm not a habitual user of thirdperson, so mine might not be a heavy-weighing opinion though ;)

Re: Not-In-The-Way Thirdperson

PostPosted: 18 Nov 2012, 13:13
by S.E.S
Rebuild and looked - like nice - it looks more spectacular.
In general, I think, the old form in the third person basically was really important when editing (to see the aspect ratio) and time-trial. If for first new kind of nice, then what about for the second "I was plagued by vague doubts."
Quin, maybe it makes sense to use the old form for "time trial" and "editing"?
And so the game is, of course, has be a new, more spectacular views. Nice!