How do I use SimpleMoveToLocation over a network?

Hi All

I am confused as to the proper networked use of SimpleMoveToLocation.

I have started with the Top Down Sample and attempted to add networking to it. (Basically just have two characters running around, one per client.)

I have changed the code so that the SimpleMoveToLocation function is called on the server and while this does cause the client’s character to move, it does not move at the proper speed, play its running animation or face the right direction. The SimpleMoveToLocation call is built into the Top Down Sample by default, but the sample does not support networking as far as I can tell.

I have Enabled Replication in Character Blueprint including Movement.

Help would be appreciated. I have tried to solve this and I suspect the problem may have something to do with the fact that the SimpleMoveToLocation function accepts the Controller as an input but on the server, where it is called the controller is not the controller on the client. I am not sure if I am making a mistake or if I am not using the function as intended.

Calling SimpleMoveToLocation for a client controlled pawn (even called on the server) does not seem to work well. I changed my code to rather call AddMovementInput and all is well now.

Urquan, Could you give more details as to how you did this? I’m finding out the SimpleMoveToLocation doesn’t work out as well. Please answer here if you could, I posted almost the same question.

https://answers.unrealengine.com/questions/48558/movement-replication-client-to-server-in-top-down.html

AddMovementInput seems to work but it doesn’t use the navigation system. Basically you just making the character walk in a given direction without considering the obstacles. Might work good in your game but I need path finding for mine so unfortunately AdMovementInput() is not a solution for me.

Hi

Yes, AddMovementInput does not use AI. You may have to use an AIController to which you pass instructions to use SimpleMoveToLocation properly.

Hi Urquan,
thank you for the suggestion. Could you please elaborate on how exactly this should work? Do I use two controllers - AI for SimpleMoveToLocation() and PlayerController for input? How do you setup this combination? Do you set Player- or AI- Controller as the “Player Controller Class” in the GameMode? And how do you access the one controller from the other?

I want to implement something like this myself, but haven’t got to there yet.

But as a rough outline, your player controller will have no pawn or perhaps an invisible pawn with no collisions. Then you would have to implement code which returns the AI controlled pawn you click on. You then call the SimpleMoveToLocation for the AI Controlled pawn, perhaps by implementing a special function in the AI controller class.

Just as an update:

I have implemented the above outline and it works well.