"Spawning" Widgets in Multiplayer

Hey all, so I’m working on my first multiplayer prototype. Most everything is replicating properly and it’s looking good. I’m a bit stumped though on getting widgets to appear on a client when the client doesn’t own the widget. As an example, below is an interface function I have on an actor pawn that’s supposed to hide the instigator’s HUD, then display dialogue from the state tree. This runs perfectly for the listen server. Unfortunately, the HUD reference I get here returns invalid for the client (though the controller is valid and correct), so the HUD doesn’t disappear.

In my interaction component, I use a server run an RPC event that executes this interaction function (also shown below) to make the logic replicate properly. So, clients can do things like open doors, and actors are destroyed when picked up and added to an inventory, for example.

Now, if I change the event to a multicast, then the widgets work fine, but now the client can’t open doors or destroy actor objects they “pickup”. I probably could just make these two different interaction types, but I would rather exhaust all other possibilities first for the sake of simplicity and optimization. So, any suggestions or feedback would be super appreciated!

you need 2 calls, 1 server call from client and then 1 multicast from server.

or depending on how youre doing it exactly a repnotify that the widget can hook into

My initial intuition is that you are trying to call the RPC (InteractionEvent) from an invalid place.

Anyway, you should separate your widgets from your game logic. If you interact with something do the the UI on the client only and send the RPC from the player character/controller that tells the server what object was interacted with. Make all interaction logic on the server (open door, update inventory) and replicate it back to the clients. UI should be updated based on the object’s state.

Hope that helps.

P.S.

As part of the server interaction logic you should repeat all interaction checks on the sever too. (check the distance, check the interacted object’s state on the server, etc.)