I wanted to test out the new FPS template and see if it works with Multiplayer. I added a 2nd Player Start and I set the players to 2 and Net Mode to “Play as Listen Server”.
When I hit play I get this error in the message log:
Blueprint Runtime Error: “Accessed None trying to read (real) property CallFunc_GetLocalPlayerSubSystemFromPlayerController_ReturnValue in not an UClass”. Node: Add Mapping Context Graph: EventGraph Function: Execute Ubergraph BP First Person Character Blueprint: BP_FirstPersonCharacter"
The new client window gives this error and it prevents the Mouse looking Functionality from working. The walking and shooting work fine.
Long term you will be better suited to flow control actions anyway. My character class does this by defining the Proxy Type on begin play then executing specific functions based on the defined proxy.
Just as a heads up. On Listen Server the “Host client” is the Server. Keep that in mind as you code client abilities and actions. That player will be running dual roles.
I was able to solve this issue for my use case by moving the blueprint section from the “Aid Aim Mapping Context” from the BP_FirstPersonCharacter and bringing it to BP_FirstPersonPlayerController and attaching it after adding the Default Mapping.
I did 8h of streaming and replicated the fps template
I shared the files and playable game on itch.io linked in the description if you’re interested
There were a bunch of things like people mentioned already
team scores held in game mode inaccessible, moved to game state
added a team component with delegates for team change, and applied balanced team logic on player join in gm pclogin
moved enhanced input mapping to local PC
made an inventory component to track weapon pickups over net
replicated behavior of the weapon pickup BP
fixed the pitch over net using base aim rotation instead of PC control rotation as PC are server/local only
replicated weapon firing with multicast for cosmetics (montage) and replicated the projectile
also added some QOL like per team stencil color through walls and name tags over allies
added a spectator cam on death, and replicated death with cosmetic ragdoll and UI popup then respawn
end round event via game state score requirement reached
end round score board with cached player/kills (this was a bit messy as key map isn’t replicated, and I didn’t want to cache it on player states as players can leave mid round and wouldn’t appear on score board leading to confusion)
fixed owner only see on the 1P mesh otherwise other clients see both models on character
I had some other experiments in there too like IK front hand on gun via weapon skeletal socket ref, and fixing the appearance of strafing which looks borked in 3P
The playlist had vods of all the streams if you want to watch the process though I expect it will be a slog.
Inventory component should be in the Player State… just an FYI. On disconnects (net drop, crash) the PS is temp copied for a short duration. On rejoin it can be reapplied to the proper player. Anywhere else you’re out of luck.
A lot more flexibility and control of this in C++
Base Aim Rotation and Camera Manager → Camera Location is the only way to go for Multiplayer.
Camera components on Sims and Server are not updated with the new values. Just the vars are.
Being technical Sims don’t even need cameras. You can remove the components on Begin play to reduce simulation overhead.
Projectiles should never be replicated. You have each proxy fire its own object pooled projectile.
Client fires a local only and rpc server it shot.
Server fires its own (auth) projectile, then Multicasts to Sims Only to fire their own using the servers Aim Vector velocity.
When the servers hits it calcs dmg, applies it and can pass hit location/normal to sims to apply decals and hit fx. The whole process only has you replicating a few vectors. No need to even do separate RPC’s for firing montage.
Client Fire Event, Server Fire Event, MC (sims only → Sim Fire Event
The events process the full scope per proxy on what to do. pool projectile → FX → montage
IK Left Hand on Gun should be a standard. Custom offset per weapon is the only dynamics needed.
I fixed this easily by following the advice here. After some testing it was pretty simple.
Attached is a screen shot on how to alter the templates to work.
+Create a Game Controller BP.
+Reference the Game Controller in the Game Mode.
+Move the Add Mapping Context over to the controller.
All done, screenshot shows the cleanest version that probably should be in the actual templates going forward.