Multiplayer reference to other Player

Hi all!

I’m new in the unreal universe, now I’m working on a simple online MMO like game ( C++ Dedicated server) and make a mistake.

My “Trading” system looks like now:

Client Call Server RPC from BP with Actor Reference ( Player and Enemy )
the server call the Client RPC from C++
Is it okay to Call server rpc from client with actor reference?
If i click on self character ( trade request with myself) works well, but if i click on other multiplayer character the reference invalid

In blueprint i can’t make a valid reference from other character to send server.

What is the right way to this:

Player1 Call Server RPC with a player reference to Player2
The server call a server rpc which fire on player2 client

My code:

What reference I need or what is the best and safe way?

your InteractPlayerRef needs to be either set on the server or passed to the server via the RPC

yes, I understand this, but i can’t make a valid reference from the othe multiplayer character.

after the break hit result i check the CUnrealCharacter cast is valid, but when i set it to a variable on the widget, and check on the widget side it is invalid.

I tried to set variable values with CUnrealCharacter cast return variable and with the Hit Actor return variable from break result, but it always invalid on the widget side.

If i’m right, the playercontroller is not replicated?
What is the perfect way to send an “Identify” from the other multiplayer character to the server?

On click, get hit, get Actor, cast as your character class.
RPC the Server, pass the reference.
Server takes passed reference and executes a run on owning client event.
Owning client event does the action.

Yes, i did like this, but I have a problem on client side, when I try to pass the reference, I get this warning if try to reference to other player:

[2024.11.20-19.38.00:397][454]LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor ThirdPersonCharacter_C_1. Function Server_RequestPlayerInteract will not be processed.

if i click on my character, it works well

Because you are executing the commands on your characters server proxy. You need to have your server proxy tell the other characters server proxy to run the command (owning client rpc).

Sorry, It’s my bad, but maybe I don’t understand what “Proxy” means, i’m new in unreal & networking.

In blueprint the Request Player Interact is a “BlueprintCallable”
(in this picture my reference is a CUnrealCharacter, in the c++ code is it actor, only for testing)

Is this code same like what you wrote?
my code looks like this:

kép

kép

kép

For each player there are 3 proxy pawns/characters.
Autonomous (your character controlled)
Authority (servers copy)
Simulated (representative of you on other clients)

Your Autonomous and Authority proxies cannot execute code on another Autonomous proxy. You have to get the other players “Authoritative Proxy” [server] to send an RPC to its Autonomous.

You → Your Server Proxy.
Your Server Proxy → Their Server.
Their Server Proxy → Them.

It’s long winded, but you have to abide by Server Authority and Ownership rules.


Code in the pic is close to mine.

IsValid check needs to use CUnreal Character as Input Object. We are validating the value (CUnreal Character) being passed to “Requested Actor” is not empty/null.

The Request Player Interact Event needs to be Run on Server.
Requested Actor isn’t needed. It’s implied by you sending a message to your server copy.