True First Person VS Normal First Person

I’m currently in the process of creating a large multiplayer single map realistic World War 2 shooting game.
It’s an attempt to create a game similar to Red Orchestra but focus on larger maps with more complex flag capping mechanics. It’s also focused on more emergent gameplay. The first map will be set in Normandy.

In any case, I’m trying to work out the pros and cons of true first person (where the player is able to see their own body) verses normal first person. My question boils down to this: in true first person, is it possible - via blueprint - to bring the player’s weapon into an “aim down sights” mode of fire? I have seen this done in the game Squad (built on UE4), and I wondered how this might be achieved.

I come more from the art side of things, so forgive me if my question is a newbie one.

Thanks.

There are several ways you could align the camera view to the weapon sights.

Animation:

  • Requires some effort to make sure the sight is perfectly aligned.
  • Requires an animation for every weapon & sight combination.
  • Only requires a single camera.

Multiple cameras:

  • Easy to line up with sight.
  • Requires no additional animations.
  • Requires an extra camera for every weapon & sight combination.

Math:

  • Once you’ve figured out the math, lining up the sight is easy.
  • Requires no additional animations.
  • Only requires a single camera.
  • Support any weapon & sight combination you can think of.

You can read a similar thread here: How to make aiming?

Includes a post about multiple cameras and a post from yours truly pointing to an true first person demo I did using the UDK, as well as a run down on the math you can use to line up the camera with the weapon sight.

2 Likes

I see no reason to keep making regular FPS characters, TFPS is so much nicer and with VR standing by the door, it’s going to be a lot more important.
We’ve had no problems doing anything you can with a regular FPS character with TFPS.

1 Like

Thank you both. That is a great answer. That gives me a lot to go from. Bookmarked - I’m going to attempt this on getting home tonight.

Hi Iller,

Will you be sharing your progress on the forum? I would be really interested to read how did your tests go, which solution did you choose and why.

I will if there’s interest. I plan to attempt multiplayer down the line (the tutorials I’ve watched and read have indicated that it’s best to set functions up a specific way for ease of multiplayer implementation later). I will most likely attempt the multiple cameras route first or the math route (seen here) as I don’t understand animation yet.

In terms of my actual game I have so far:

  1. Made MyCharacter use true FPV based off the ThirdPersonTemplate using this tutorial.
  2. I then gave him the ability to sprint using this tutorial
  3. I then gave him a stamina bar and a sound effect for being out of breath using this tutorial(I combined this with the tutorial above).
  4. I altered the values so that his walk speed was slower (because he’s a GI in Normandy) and his run speed was more realistic, and depreciated and regained as per real life.

Now, I’m endlessly attempting to get my terrain material right. It’s proving very difficult as no very detailed tutorials exist with an example I want to follow (I don’t care about giant mountains, I want to recreate countryside). Depending on how I go, I might update a major post about it, as I’ve found that anyone could follow in my footsteps and get to where I have just from videos alone. For me, psychologically, it feels good to have a terrain to work towards filling.

In the next couple of days I will attempt:

  • Health Bar (although I will only display the effects of damage through the players vision).
  • Retargeting animations? (basically want to put my skeleton in the rifle animset that I bought - not super sure how to do that atm).
  • Give him a gun
  • Begin working out how to get him to fire it (I bought realistic weapon pack for this - I think I have to create the separate guns with separate blueprints which I’ll base off wikipedia stats in order to get the most accurate reflection of the weapon).
  • Try to achieve ADS via multi-cam.

I will then probably need to take a look at multiplayer (which looks punishing) and maybe vehicles.

Hi Kris,

I looked at your UDK true FPV. It looks outstanding. Have you thought about porting it over to UE4, or is there a way I can rebuild it in blueprints? To be honest it looks like you’ve done all the heavy lifting there.

@Kris, I remember your awesome work in UDK. I was actually in the process of revisiting the UDK TFPS to translate to UE4. I concur with Iller. Have you thought about porting it over to UE4, or is there a way I can rebuild it in blueprints? To be honest it looks like you’ve done all the heavy lifting there.

@Iller, I’m very interested. I concur with Sitrec points on the advantage of TFPS. I believe TFPS allows the player to establish a deeper connection to their avatar, especially when avatar customization is added. I desire the option to decouple the hand/weapon from the camera allowing independent control of each manually or automatically. I think decoupling is necessary to improve First-Person Melee Combat. Decoupling can also changes the firing mechanic to Gallery Style. In short, one can do more in First-Person with TFPS, than the normal FPS. I would anticipate TFPS replacing traditional Arm/Weapon only. Perhaps, we’ll see a TFPS Template someday.

Hi all,

I’m getting to this stage now where I know exactly what I need to do to achieve my desired effect, however, I’m struggling working out exactly how to do it technically:

I have my character idling in an Idle Hip Gun pose (where his gun is held at his hip). From his true first person perspective, you can see just the muzzle of his gun. He is able to fire, and when he fires, the bullets land in the centre of the screen (firing towards camera centre).

I wish for the following:

When RMB is pressed, an animation blend plays and brings the gun from his hip to his face in an aim offset animation.
I wish at the same time to restrict his speed to a walk while in this state.
I also wish to transition to a camera that is aiming down the sights on the gun actor.

Therefore, achieving an effect similar to THIS.

  • I would imagine I would first set up the input in the event graph on my character. Would I have to set it up in the input part of my game preferences?

  • I then imagine I would have to go to the event graph and make it so when right click is pressed, it plays both the “raise gun/offset” animation, as well as triggers setViewTargetWithBlend - pointing at the camera in the gun blueprint. I would have set the camera up aiming down the sights, and called the camera “ADS”.

However, I don’t really understand where I am able to set up the setViewTargetWithBlend, or how this all ties together, and where each function needs to be based. I sort of understand the concept, but am not finding it as easy as many others make out (obviously due to my inexperience).

I would love some pointers, or a picture of how and where these are laid out.

Have you tried using timelines? You could set a bunch of variables for the timeline to smooth between the 2 states. That way It should all fire together and smoothly, based on a boolean.
I hope that helps you or have I misinterpreted the question?

That is helpful Lambchop, but a bit too advanced than what I need right now. For instance, at the moment I’m unable of getting the player camera to switch to the ADS camera on clicking RMB - I have a vague idea of what to do, but everything I’ve tried hasn’t worked. I’d love a step by step of each of my above points. IE. whether I have to set up input, or I can just use RMB as an event in my character blueprint. I’m quite a beginner, and while I have some of the concepts, I’m struggling to actually execute it.

I do understand though that a timeline would help for a seamless transition. I will try that when I actually get the transition working haha.

This is sort of where I’m up to:

In Character Event graph, I create an RMB input. I then link this on press to a Flip Flop, which I then link to a timeline, which I call “Aim”.
I then add a float track in timeline (or should this be a boolean), and set base FOV to 100 (which is my game base FOV), and create a .5 second timeline, the last key frame setting the FOV to 40.

My question is, how do I transition to using the camera in the gun actor, so that not only do I trim the FOV, but zoom a little as well as I look down the sights of the weapon?

G’day,

I threw together a quick blueprint of the math for people to use.
I used a third person blueprint project with the animation start pack included.

The important part - a bit of math - is here.

It is a Blueprint based on PlayerCameraManager with an override for BlueprintUpdateCamera.

Aim Alpha is a timeline value from 0.0 to 1.0.

Rifle is the mesh from the ShooterGameExample with a socket called “Sight” added to represent the weapons sight line.

Hopefully its enough for people create their own version from it, with Blueprints or C++.

This is the same basic math we use for Ground Branch.

Enjoy.

This is amazing Kris, and very generous. Your work on Ground Branch is something to behold. I’ll attempt to implement this tonight on my new Thompson model and report back with updates. Currently, my game is playing very similar to Ground Branch (unintentionally), in that hip aim is the idle pose and movement speeds are true to reality.

For zooming you could try reducing the FOV of the camera. I think that’s how most games do it.

Reducing the FOV is the most straight forward way of doing it.
In the example above, I didn’t include it, but you could easily add it yourself by using a lerp and feeding the result into New Camera FOV.

@Iller: Glad its useful to you :slight_smile:

Help… Please

Thanks for this Kris but I am still pretty confused! I’ve been trying to make out which nodes are what in your pastebin but am struggling with a few of them; most notably those labeled with “K2” references. Where are these nodes set up? Are they in the weapon BP (for each weapon), character BP in the “aim” action mapping/function, level BP or elsewhere? Is it best if the guns have an armature to attach sockets to in order to assist in lining up the sights? How many sockets should there be on the gun, just the one for the end sight or for both sights to line up?

Seeing as I have yet to figure this out and test it, I was curious if this moves the weapon into the line of sight or does it move the camera into the line of sight? Does proper animation still need to occur in order to visually bring the gun perfectly level with the line of sight? You mentioned earlier that by figuring out the math:

  • Once you’ve figured out the math, lining up the sight is easy.
  • Requires no additional animations.
  • Only requires a single camera.
  • Support any weapon & sight combination you can think of.

I don’t mean to be a nooby pest about this but there is literally no good help out there about implementing an ADS system in a true/first person shooter… Which is surprising because that seems to be the popular choice for people learning UE4. I can sense what your nodes are doing but just getting it all figured in my head seems to be the issue… In other words would you bother spelling it out for me? :slight_smile:

Thanks for any further help you can provide, it would be greatly appreciated!
Jesse

1 Like

Ignore the K2 part and it makes more sense. It goes Function(Zoom), Cast to Character.

As Character—> Get control rotation, Set Final Rotation
As Character—> Camera Component—> Get Component Location
Somehow he is getting his Rifle Actor from the Character Cast, he most likely has a variable referencing the blueprint ----> Rifle —> Get Socket Transform

The rest is all math which he uses to move the character camera to the socket location. It appears you still need to have aim animations to bring the gun up. This is all being done in a Player Camera Manager blueprint

Hi Iller , im trying to do something similar, going for the multi cam option, but im having this problem:

did you have this kind of problem?
I will appreciate any kind of help, i am having this problem since a couple the days now!

thanks

Al…Most…There…

I was able to step back for a day and reprocess the information from his pastebin. Before I could test it, I was having trouble casting my weapon from my character but have since got that issue sorted (PHEW). I have tested what I have and while the camera does move, it moves very oddly. At first glance, it doesn’t appear to attach to the socket but after moving the socket to different locations, I notice the camera is moving relative to the socket but it is far from the desired result. When I go “ADS” the camera actually moves in the opposite direction from the socket but let go of the ADS button and the camera goes to what appears to be the socket location (returning the camera to original location will appear to be a whole other ball of wax lol.)

I’m pretty sure I have exactly what he has written. Here is a SS of the blueprint I made for it:

This is part of my weapon blueprint, which once working and other weapons are created, this will be on a parent weapon blueprint that all weapons will be children too. And as simple as it is, in case you need to see it, this is my call to the event which is location in my character bp:

I can’t see what I have done wrong. I would like to successfully implement @Kris method as I believe using the math one time for all weapons is the best solution to going ADS but if I can’t get this figured for some reason then I guess I will have to go the sloppier way and use cameras attached to every weapon socket and blend between them. While that method would work, I fear that it may not be as accurate as well as needlessly adding components to a scene.

Here is my C++ implementation of Kris his blueprint example (WIP, need some tweaking)
In my project, the Camera is attached to a socket on the “Head” bone of the character skeleton.

Tried my code with the SurvivalGame project, but for some reasson the ADS view is located right of the weapon.

In the character class, override the CalcCamera method:



	/** Calculate camera view point, when viewing this actor */
	virtual void CalcCamera(float DeltaTime, struct FMinimalViewInfo& OutResult) override;


In the source file:



void ASwatCharacter::CalcCamera(float DeltaTime, struct FMinimalViewInfo& OutResult)
{
	UCameraComponent* FirstPersonCamera = FindComponentByClass<UCameraComponent>();
	if (FirstPersonCamera && FirstPersonCamera->IsActive())
	{
		FirstPersonCamera->GetCameraView(DeltaTime, OutResult);
		if (bIsTargeting)
		{
			// Get the camera location
			FVector CameraLocation = FirstPersonCamera->GetComponentLocation();

			// Get the weapon sight transform
			FTransform SightTransform = CurrentWeapon->GetMesh()->GetSocketTransform(FName(TEXT("SightView")));
			FVector SightLocation = SightTransform.GetLocation();
			FRotator SightRotation = SightTransform.GetRotation().Rotator();

			// Get the sight location
			FVector SightDirection = FRotationMatrix(SightRotation).GetScaledAxis(EAxis::X);
			FVector DirectionToSight = SightLocation - CameraLocation;
			float DirectionToSightDot = FVector::DotProduct(DirectionToSight.GetSafeNormal(), SightDirection);
			float DirectionToSightLen = DirectionToSight.Size();
			float DirectionToSightDotLen = DirectionToSightDot * DirectionToSightLen;
			FVector SightDirectionDotLen = SightDirection * DirectionToSightDotLen;
			FVector SightTargetLocation = SightLocation - SightDirectionDotLen;

			float AimAlpha = IsTargeting() ? 1.0f : 0.0f;
			OutResult.Location = CameraLocation + AimAlpha * (SightTargetLocation - CameraLocation);
		}
	}
	else
	{
		GetActorEyesViewPoint(OutResult.Location, OutResult.Rotation);
	}
}


ps: The code also work when override the “UpdateViewTarget” method in the PlayerCameraManager, so not sure what is best place to put it.