I am making a multiplayer RTS but I have a problem controlling spawned units (let's call them Vessels), specifically moving them around with AI MoveTo bp.

Vessels can be created by both Clients and Server and are visible for everyone but neither clients nor Server can move Spanwed Vessels.

Only Vessels placed on the map beforehand can be moved and ONLY by the Server.

Also, the server sees all Client CameraPawn movements and clients see Server CameraPawn movements BUT clients don't see each other's CameraPawn Movements (if this is related somehow...)

  1. How can I control a pawn in multiplayer from all clients for starters?
  2. How can I limit control to a specific controller?
  3. Why "preplaced" Vessels work(move) for Server only?

FYI: I spend almost all day on the web about it and found nothing close to it. I get the feeling that either I am doing something wrong or understood something wrong...


If your spawned vessels aren't moving but those placed previously are then it's likely one of two things is happening.

Either the BP is set to Auto AI possess placed in level only and not spawned or placed in world: Spawn Or Placed In World AI Possess Example

The other option would be that you haven't correctly assigned the AI Controller when spawning. The easiest way to check this would be that after the spawn actor from class call, get the AI Controller and print it out. If it's not the controller you were expecting then it's not assigning correctly.

To limit control to a specific controller, you'll need to create a new variable which you'll need to make public and Expose on Spawn. This will put a new pin on your Spawn Actor class you can plug into for a unique reference to whichever controller spawned the vessel and can be checked against when attempting to select / move the vessel.

  • \$\begingroup\$ I did what you suggested and now the units move but only the server can move them or actually do anything at all such as destroy them. I use NetMode -> Play as client and only the server and functions with Replicates -> Run On Server do anything at all. Clients can initiate Funcs for the server to run but can't interact with the objects in any way example: select an object and tell the server to move or destroy it (destroy actor)... Any insight on this? (For the life of me i am on this from 8th of Sept and found no solution whatsoever :((( ) \$\endgroup\$ – SomeDude Sep 10 '20 at 21:26
  • \$\begingroup\$ TL;DR Clients can't interact with Spawned units no matter where i execute the interaction (Run on server, Multicast or Otherwise) \$\endgroup\$ – SomeDude Sep 10 '20 at 21:33

I finally solved my problem as i guessed i understood wrong some things. It appears that the server must do everything regardless if the code appears to be executing on clients.... I ended up passing location and pawn i wanted to move to a Func that Executed on Server and there i did the entire code...

Simply put i just could not see it :)

@Stephen thanks for the reply :D

  • \$\begingroup\$ Glad you sorted it in the end. And yes, the Unreal model is that the client tells the server what it wants to do, the server checks if the client can then does or does not it happen accordingly on all client models. Get used to using HasAuthority() a lot. :o) \$\endgroup\$ – Stephen Sep 11 '20 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.