For the WASD input though you shouldn’t need to do it that way with server events unless you want really strict movement input and logic for your game(In Unreal the character movement is already replicated to the server in an optimized way) and that is how most FPS games do it because it will probably end up flooding the server sending the direct inputs to the server.
If you are removing click to move you will probably want to remove having the client possess a pawn.
This method of possessing a server character is done in the MP TopDown Kit so that the click to move will work networked and with serverside pathfinding. It doesn’t really add too much overhead leaving it in and just disabling the click to move part in the Player Controller. But it would make things a little cleaner in your project if you are only using WASD for movement and just want to keep the mouse interactions to remove it.
If you are no longer using click to move at all in your game and want to remove the extra possession controller/pawn then here is a really rough guide I put together for someone on how to remove the pawn possession.
To remove having the player possess a server pawn simply follow these steps and it will get you most of the way there… or break everything.
Please backup your project folder before doing any of this lol…
*It’s possible unreal will **** out halfway through with a crash and mess up your blueprints.
In that case you will want to start over from the top with your backup. *
So the real trick is trying not to get confused by the naming of the controller classes and what they are for.
MPTopDownNetworkController is your games main PlayerController that is set in your game mode.
This has (should have) your WASD code and keeps all the exiting code it has, so nothing really changes in terms of it being your games player controller.
MPTopDownNetworkPawn will be your games main PlayerCharacter pawn that is (Already) set in your game mode.
At the end of these steps you will no longer need the PlayerCharacterController blueprint as the MPTopDownNetworkController is your main player controller and we are no longer ‘possessing the player’ and do not need the additional controller anymore.
[MPTopDownNetworkPawn Blueprint]
Open your MPTopDownNetworkPawn and reparent it to PlayerCharacter (from Pawn).
*(Later you can update the PlayerCharacter blueprint to have a Camera and the stuff that is in MPTopDownNetworkPawn and remove having an extra blueprint. But first get everything working then you can focus on trimming the extra character class.)
*
[MPTopDownNetworkController blueprint]
If you look at the variables the TopDownNetworkPawnReference is now what you want to treat as YourPlayerCharacterReference.
The MPTopDownNetworkPawn inherit’s from PlayerCharacter now so we will be able to easily replace the PlayerCharacterReference in the following steps.
We will be removing the PlayerCharacterControllerReference and the PlayerCharacterReference after we have made some changes to the RespawnPlayer() function.
Update the RespawnPlayer() Function to look like this image
Now you can delete the PlayerCharacterControllerReference variable.
This will update all the “Stop Movement” nodes that get called from using the PlayerCharacterController and will now have Self as the target. (Self being MPTopDownNetworkController)
You will get a couple errors with the movement code, this is fine as we don’t want click to move and the AI controller anymore.
Fix the errors in MoveToLocation() & MoveToTargetActor() by removing the Move To Location nodes.
Unhook/remove the UpdateFollowCamera() from the OnTick event because the Camera is on the character you control so it no longer needs to follow anything.
Right Click on PlayerCharacterReference and find everywhere it’s used in the controller.
Replace the references with The TopDownNetworkPawnReference.
*They will just plug right in because again since it inherits from PlayerCharacter and the PlayerCharacterReference was a PlayerCharacter it’s easy peasy.
There are a lot of places to update this but it should only take a minute working through the find results list.
*
After all traces of PlayerCharacterReferences are replaced with TopDownNetworkPawnReference delete the PlayerCharacterReference variable, then compile and save.
Don’t try and launch the game yet, If you try and launch now you will have errors in the NPC and the PlayerCharacter blueprints because they can’t find the PlayerCharacterReference variable that you just deleted anymore.
Simply rename TopDownNetworkPawnReference to PlayerCharacterReference and those errors will go away.
*Remember the TopDownNetworkPawnReference is parented to the PlayerCharacter so it is a PlayerCharacter class.
*
Now when you hit play things won’t be perfect but you are now a regular character with a regular controller.
You will have a few things you will no doubt need to clean up still but this should get you most of the way there.
**[NPC Blueprint]
**
You will want to open up the NPC blueprint and replace the cast to PlayerCharacterController with a cast to your MPTopDownNetworkController.
You will also have to repull off the get PlayerCharacterReference and plug it into the AddTarget node.
[PlayerCharacter Blueprint]
Then in the PlayerCharacter blueprint in the OnDeath() function you will want to replace the cast to PlayerCharacterController with a cast to your MPTopDownNetworkController you can now pull directly off your cast node to call the event ServerPlayerDeath
You can now delete the PlayerCharacterController blueprint. I would close and reopen the editor before trying to delete it though to clear any memory references.
**Now you have 1 PlayerController and 1 PlayerCharacter and no silly possession business. **
As mentioned earlier I will try and update this rough guide into a more formal tutorial in the near future. Please contact me at support@vanguardinteractive.com if you need any advice on adding WASD movement.*