Need clarification on Networking, Controllers, and Network Ownership
I'm playing around with the basic framework for a networked RTS using 4.3 and blueprints. I've just started to enable networking/replication and am running into what I think is strange behavior, but may just be a result of misunderstanding.
My first test was to start up a dedicated server with one client. The first thing I noticed was that the dedicated server is spawning a PlayerController and Player Pawn for itself, but since a dedicated server has no local player why are these being created? Is there a way I can prevent the dedicated server from getting these objects?
The second thing I noticed was that default AIControllers, on the other hand, were only being spawned on the server. Does the engine dictate that these only spawn on the authority, or does this have something to do with the 'owner' of the pawn?
That brings me to my final question: how does network ownership work anyway? It's my understanding that every actor in the game has a network owner, and that owner is the only one allowed to execute server-client RPCs. I also assume that this ownership is what directs the Switch Has Authority node. If my understanding is correct, then what determines the network owner of a particular actor? Is it the player who spawned the actor? What about actors that already exist as part of the level, who owns them and can I change their owner? My issue is that I want a client to be able to execute a Server RPC on an actor (for example, a RTS unit) but it looks like the client is not its owner and therefore can't call this RPC.
Sorry to throw a bunch of questions together in one post, but it seems like they're all somewhat related.
asked Aug 13 '14 at 05:59 AM in Using UE4
Actors spawned as part of the level are all owned by the Server.
Have a look at this (seem like they're attempting the same thing you are): https://answers.unrealengine.com/questions/41065/controlling-multiple-pawns-rts.html
The best way i found that if you want to spawn an actor from the client by input event or ui button you must redirect it to the other has the server ownership like player controller or player pawn .etc. then invoke event with [run as server] replicate and [multi cast] to all clients.
answered Nov 06 '17 at 02:00 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here