Top-down multiplayer

Hi, Projects in Top-Down movement works with the mouse , but in multiplayer mode only works on the server. How to make it work on clients tried through replication functions , but the character is moving once only before.

http://rghost.ru/7QczzqCnY/image.png

You should watch this series on networking through blueprint:

But basically: You check behind the “MouseMove” if the event was called from someone with authority. In the very strong majority of the cases only the server has authority so only your listen server will be able to actually use any functionality behind this.

Cheers :slight_smile:

These lessons I used while writing this bp, there is very superficial information, as well as in the wiki. It turns out the entire function Move to hit location can not be replicated , it is necessary to replicate the same way all the variables in it ?

f0adb104f264b2529231251f3ef609c756073e62.jpeg
5d75e909a0ddcf0c220dfe3317a924fd40fa6519.jpeg
How to make work NavMesh in multiplayer mode ? Coordinates are obtained , but the character does not move :frowning:

I had to use Move to Hit Location instead of Simple Move to Location. It is working 100% for me in Multiplayer and I haven’t noticed any problems with it.

Simple Move to Location enters the Move to Hit Location is the default ’ function in pure Projects top-down, it is strange that you have running , I have version 4.7.1 Projects to create a clean top-down multiplayer option put the number of players 2 and run dedicated server. Press play and movement of the unemployed, if run without run dedicated server that runs on the server side

Thank you , solved his problem by using rpc, but there were other problems , such as the rotation of the client character moving in the same position in all directions, also decided , you just do not match the speed of the animation , the character moves on a server running, and the client is slow steps .

The “Move to Hit Location” function in TopDownCharacter just calls “Simple Move to Location”. There is no “Move to Hit Location” anywhere else. However, there is a “Move to Location” in AIController, but it needs an AIController.

Calling “Simple move to Location” on the server *does *move the player, but rotation and animation is messed up.
I would love to see a simple solution which “just works”, IMO this should be something the CharacterMovement component should be able to handle.

After spending a day on this issue, I have a working solution (I’ll post a tutorial or whatever someday).

explained in this AnswerHub question that Simple Move to Location was not meant to be used in multiplayer.
posted an answer in the same AnswerHub question, which works. It uses a server-side AI Pawn, which does the movement. Your player-controlled pawn replicates the AI Pawn’s movement in it’s Event Tick.

In answer he uses a lerp of the server-pawn’s transform and the client-proxy. If you experience any stuttering effect on the client, that’s why. just use the server-pawn’s transform.
And don’t forget to destroy the AI-Pawn when you destroy your player’s pawn (and vice-versa).

Okay, so I know this topic is ancient but I recently had this same issue on UE 4.25 trying to get the TopDown Example to replicate properly. I have developed a working solution by dismantling the TopDown game and removing the VR stuff from it.

First Step is to setup a server RPC to tell the pawn on the server where to move to. That actually got me 90% there. Other issues came up in that the client controlled character would not rotate toward the movement and would jump around from point to point while moving. Well the Movement component is not replicated, and with the server version doing the actual movement the Velocity on the client was not set. Interesting thing was for the other player, movement looked fine, it was only the client’s own character that was not working.

Step Two: Create a client only RPC on the Pawn that runs on Tick. Okay quick tip for Replication, NEVER do reliable network calls on tick, and try to only ever have one unreliable network call on tick (Epic has a few already so be careful). So I setup an on tick unreliable client function that fire’s and forgets each tick on the server that sends the movement component’s Velocity and the Pawns Rotation. On the client I directly set the Movement component’s Velocity and the Pawns Rotation and bam it’s working very good. You Could add some rotational interpolation but I was not having any issues with it visually.

Hi, although the topic is old, but the problem is relevant. I don’t quite understand what you mean. I use “Simple Move To Location” node on server (rpc). If you add an AI controller, it works well, except for small twitches on the client. This spoils the whole feeling of the game. Could you describe the second step in more detail?

That is really all there is to it. Basically you need to kick the “prediction” part of the client working by telling the Client Movement Component that it has a velocity and to get moving.

  1. Add variable to replicate a Vector velocity on Pawn (Best to also use the Net Quantified Versions of Vectors for this).
  2. Replicate that value Down to the Client using an unreliable RPC on tick.
  3. Have the Client RPC set the Velocity on the Client’s Movement Component.

Honestly It has been a while since I looked at this, but I am basically using the same foundational system that the Top Down Example did. I just built it from the ground up going off what the Top Down Example Did so it is using “Simple Move To Location” as well. I never had any success using the AI Controller method others describe so my example is using the normal Player Controller instead that is possessing the Pawn. This maintains ownership between the client and the character they control allowing you to send Server and Client calls using the Pawn, otherwise you will have to do it 100% on the player controller (which may not be a bad thing anyway).

Why this does not work I cannot say as I haven’t look at it in a long while. My guess is that there is no Nav Mesh on the client so simple move to’s don’t work on the client which prevents the movement component from finding a path and properly using the character RPCs to send movement UP to the server. So if you reverse it, tell the server to move the pawn, the on the server your character now has a directional velocity that you can send back down to the client and get things moving along.

Hi there could you share a blueprints or a movie how to make this working ? Thank you in advance

Hey sorry, yeah, I’ll look into sharing a project I setup to use it, I keep it around for future references for this problem haha. Will try to post in a day or two.

Found one solution which integrates content from 3rd person character - but video follow just option for mouse than button is held -https://youtube.com/watch?v=RUSIsEEOGuE
i would like to know how to click once LMB an get to the cursor position that is replicated aswell
Maybe you can share your solution iam out of ideas…Thank you in advance

In this tutorial I show two reliable setups for replicating the Topdown template for multiplayer.

Both setups are lag independent and work great for reliable multiplayer.

I use both a click-to-move setup and a simple hold-mouse to move setup.

  • To see setup 1: ‘Simple Reliable Topdown Replication’ go to 2:07
  • To see setup 2: ‘Reliable AI Pathfinding Replication’ go to 4:53

What about moving with WASD and control the rotation with the mouse but without click?