Does UE4 have client-side prediction built in?
This UE3 doc says that it is implemented in UnrealScript in the PlayerController script. http://udn.epicgames.com/Three/NetworkingOverview.html#Player Movement and Prediction
I assume this is still present, but nothing networking related is mentioned anywhere in the features page and the documentation doesn't mention prediction. The recent Blueprint Networking video tutorials also don't bring it up (I didn't watch all of them though).
If it is included I would think it would be something they advertise, since Unity's networking implementation is not great and you don't have enough access to their physics to make client-side prediction doable at all.
asked Apr 24 '14 at 05:06 AM in Using UE4
I've come up with a working solution and decided to post it - it may help someone who is struggling with the same issue. Here how it goes: you have a total of four Blueprints two of which are spawned on the client and the other two on the server:
Both are set up as "Default pawn class" and "Player controller class" in Game Mode.
Both are spawned and owned by the server.
The main idea is that the player is owning and controlling a proxy pawn which spawns the actual character and his AI controller (on the server) when the game begins. After that all the input received by the player controller is sent to the server and passed to AI controller which in return moves the actual character.
Here is BP_WarriorProxy: It spawns both the character and his AI controller and saves them as variables for later use. Don't forget to set both variables "Replicated" for later use.
And his controller BP_WarriorController: Nothing special here: take users mouse click and send it to the server (vector would've been enough) where I take the AI controller from the proxy and call MoveToHitLocation event.
BP_WarriorAI : I can not attach more screenshots but it's rather simple: It has the same movement logic as in the TopDown template except that I use the MoveToLocation() method instead of SimpleMoveToLocation() which is important.
BP_Warrior : This is the actual character with all the usual components like MovementComponent, SkeletalMesh etc.
Couple of problems I've encountered:
Altogether it feels like a hacky way to make smth. basic like moba-game so if you have any suggestions - I'm all ears.
answered Jun 06 '14 at 08:37 AM
Yes, player movement replication and prediction is implemented in UE4 as Rama points out.
However it has changed locations from the days of UE3 (where it was in the PlayerController) to the CharacterMovementComponent for Characters in UE4. Prediction and correction when the character strays too far from the server's authoritative position is implemented, as well as a Client authoritative mode that can be enabled. It's fairly complex, but you can get a grasp of it by looking at the INetworkPredictionInterface implementation in UCharacterMovementComponent, as well as the related SavedMove processing in there that replays moves on the client when they receive a correction.
Vehicles using UWheeledVehicleMovementComponent also support replication to/from the server basically by replicating the input which drives the remote simulations. This is a simpler example but may server as a good starting point.
answered Apr 24 '14 at 06:28 PM
Player movement is properly and wonderfully predicted in the UE4 engine
I know from having hosted multiple real multiplayer games in UE4, some involving more than 2 people!
answered Apr 24 '14 at 07:41 AM
Can you please post All BPs cause i dont understand how it works at all, and i cant even try to make example cause i dont have all BP sheets
answered Oct 07 '16 at 01:24 AM
This is also causing me bother, an in native engine method would be brilliant.
answered Jan 08 '17 at 09:52 PM
First of all thank you very much for your help on this! The solution you posted has been fantastic.
I am, however, having problems setting up the proxy. I have posted my question here: https://answers.unrealengine.com/questions/491420/how-do-you-set-up-a-camera-on-a-proxy-pawn-for-a-c.html
If you have the time and notice any reasons why this isn't working, I'd greatly appreciate the help. Alternatively, if you know of any tutorials that could be useful to watch as I try to problem solve - please let me know :)
answered Sep 29 '16 at 10:43 AM
Hello its 2019 and same problem still exists. for a long time im loking a way to solve this. still couldn't find anything. https://www.youtube.com/watch?v=HqM-XqmqqB4. And just only find this method for the solution. But there is one problem in here. If player has lag and when you try to move it, player waits a little bit. "Wait time depends to your ping" and then it moves.So it can be bad in terms of play. There is nothing like this in "Add Movement Input ". It moves exact time when you try to move.
And i learnt Torchlight Frontiers made with unreal engine.It uses Navigation System click to move and also contains multiplayer.So there must be an another way to make this maybe with c++? or maybe they are using the method that i posted the youtube link.
So could someone manage to make it ? Any ideas ?
answered Mar 13 '19 at 03:00 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here