I am not so experienced in the Unreal networking. Here is something which confuses me.
From third person template, I have two clients connected to the same dedicated server. So the two characters from the two clients can see each other on the same map perfectly. If I add a blueprint function into the character blueprint, let us say, a timer which prints a hello world message. Then you will see from each client window, two messages will print periodically. If we got three characters on the same map, then three messages at the same time.
It is not from the server, as the dedicated server was not complied with the print string test node. It seems to me that the client executes the blueprint from every character which are instanced in the view.
I guess it is basic in replication, but is there a way to avoid that? Sometimes I just want to have some functions got executed by the controlled character in the character blueprint.
I guess this is basic, hopefully someone can show me a direction…
Thank you @eldany.uy
But this is not working as I hoped. After those changes, the characters on the same map are no longer able to see each other, which means in every client’s view, only one character that is itself. Then surely only the blueprint of the own character gets executed, but it kind of loses the main point to have a multiplayer game as it looks totally like a single player game.
Perhaps you’re looking for the IsLocallyControlled BP node. Use that with a branch node and you can make sure that something only executes on the controlled pawn.
The problem seems to be, that you just call the print Node… So in MP it is called on Client AND Server…
Add an SwitchHasAuthority Node before, and just call the print from the Remote (Client). This way you avoid calling the print node on th Server (Authotity), too.
As second:
Make sure to call prints on owning client only. You can set this on the initiating events start node options.
Thanks @BDC_Patrick . The way you proposed was the first thing I tried as the picture below, but not working. The problems are from the clients showing in your view. For example, if you get three clients showing in your view, all three clients are considered as Remote, the blueprint on each of them will be executed. I have tested this. Making an event of owning client will be helpful neither, the replicated clients will still execute the blueprints…