Hi there,
I want to kind of restructure my question and answer it myself.
What had I already achieved?
I’ve defined the movement of my pawn for a singleplayer game. Therefore I created a pawn, which inherited from APawn. It used functions like SetActorRotation, AddActorLocalOffset, SetRelativeRotation and no explicit MovementComponent.
NOTE: There is a difference between APawn and DefaultPawn!
What do I want
Multiplayer support for my pawn while running a Dedicated Server.
What I’ve figured out
the main problem regarding networking
The basic idea while creating a multiplayer game with a dedicated server is, that the server does all the gameplay important decisions and the client gets only informed about the results.
E.g. you want to activate a skill:
- you would press the key for that skill
- you would let the server know that you want to activate that skill
- the server validates, if you are allowed to press this skill and if yes, activates it for you and should tell you that it really activated that skill
- you see that your skill activates and gain the effects of that skill
Well in most cases you can do it this way, since you do not really care about the little needed time for sending your event to the server, letting the server do its magic and waiting for the answer of the server.
In some cases however (like movement) this time will be perceived as lag and clunkiness, which it truely is! The majority of games will try to hide this lag by already doing this move locally and only letting it validate by the server. This is also called Client-Side-Prediction.
the two solutions:
In my research I’ve found 2 ways to solve this problem. The first one uses direct transform manipulation(SetActorLocation,SetActorRotation, …). The second one uses a custom movement component.
1st option:
You use the inbuild replication/networking system of the engine and determine all the movements through events and replicated variables.
For that one I want to give you one example on how to solve this:
The green commment boxes should highlight for you what the client is doing, while the red is highlighting the servers actions.
This implementation is analogue to the explanation which described how you would activate a skill networkwise. (1.-4. from before).
In this implementation you will feel lag if you have a high ping.
Further readings on this one:
- [Come Learn Blueprint Multiplayer with me!][3]
- [Pawn Networking][4]
… regarding movement components
Movement components seem to generally encapsulate all the behvaiour you want and additionally make it functional for networking. (Or at least you hope that your movement component is doing that). In addition some smoothing should be done here. (Client-Side-Prediction and some more neat stuff to achieve nice fluent movements)
Furthermore a movement component inherits somwhere down the line from UNavMovementComponent. This should allow Pathfinding for your AI. (At least I think so, could be wrong here, haven’t touched AI yet!).
Further readings on this one:
- [Lack of Movement Components for Networking][5]
- [Networked “Physics-Vehicle Movement Component”: existing examples or implementation hints?][6]
Conclusion
Movement components exists to make your movements look smooth. The player should feel to achieve changes through input immediately.
They might have some more use (AI).
However you can update all your movements manually through the given networking/replication system.
Further readings/tutorials:
- [Introduction to Blueprint Networking][7]
- [About general networking issues][8]
- [Networking Interpolating replicated movement data in Pawn, without modifying source][9]
- [Is Default Pawn multiplayer capable?][10]