Unreal Engine 4: AimOffSet Replication in FPS Multiplayer
If you understand how to use SwitchHasAuthority and when to use Server, Multicast, and Running on Own Client in the Replication box, you can create your own FPS multiplayer game.
Aim Offset is a critical feature in every FPS game. You cannot imagine a FPS game without the AimOffSet System, whether it is single player or multiplayer.
If your game does not support multiplayer, I recommend that you follow CyberLOD’s playlist for True FPS Character Setup. If you’re creating a multiplayer game, you’ll run into the contradiction of AimOffSet not replicating, despite the fact that anything linked to Animation Blueprint should have default replication. All of your other blendspaces are flawlessly reproducing, but the AimOffSet is not.
Popular AimOffSet System
Whatever Tutorial or Documentation you use, I’m sure you have a Function in Animation Blueprint to calculate Pitch and Yaw. Then, in the Event Graph of Animation Blueprint, use those values.
This System is perfect as long as you are limited in a TPS Single Player Game. But for Multiplayer, this is not gonna work. The Pitch is not going to replicate as you want.
Also, if you’re making an FPS game, you don’t need to calculate the Yaw for aimoffset. You will, of course, use “Use Pawn Control Rotation” in your player’s Follow Camera. All you need is the Pitch input; the camera will handle the Yaw.
AimOffSet System for Multiplayer
The first thing you should know is that the pitch calculation must be done in the Character Blueprint using a custom event to call the server and then send the value to the Animation Blueprint.
The Set Pitch Function is nearly identical to the popular system. Just no Yaw. The biggest differences, however, are in the Character Blueprint. If the player is also the server, the Pitch will be immediately changed. If the Player is not the server, it will invoke the Function “ServerLookUp” which will update the Pitch Value on the server.
Don’t forget to replicate the Pitch Variable.
The final step is to use this value in the Animation Blueprint for continual updating. If you don’t already have one, make one variable called Pitch and set its value with the value of pitch from the Character Blueprint.