So I have a problem with my interaction workflow. Right now we are using a parent interactable bp with tag “interactable” with a single event inside “Interaction”. This is used on doors, pickup keys, switches and more. My solution for making things sync up on all clients was to make network replication calls to the server from inside the character, triggering the Interaction inside the door or switch. I did it this way so I didn´t have to go into every child and set up the replication in there.
So this has been working until now when I want widgets to trigger from childern of the interaction BP. The widget appears on all clients.
I was thinking that a solution might be to add another tag on certain children that don’t need to be triggered by the server.
Do you guys have a better solution for this or does this sound like a okay solution?
Hey [USER=“1821903”]Bobby Rösehag[/USER], the way I do all of this is through BP Interfaces.
Each “interactable” actor type (Doors, Switches, pickup items etc) has its own parent actor class. Each class uses a dedicated BP Interface. The event logic, e.g. doors … is coded into the parent door actor class and uses Doors Interface to communicate.
Hi, if you want the widget to only appear on a specific client, then you should execute the logic to create the widget only on this specific client and not on all clients. I don’t know your current setup, but when the player interacts with something you could also send a reference to the player controller that does the interactions, and when you create the widget, then only create it locally on this player controller (you could create an event inside your player controller that runs on the owning client and takes in the widget class and creates the widget, and then call this event from the server).
Thanks for sharing your setup! Do you use this in multiplayer or singleplayer? I try to use events more than interface calls since I am little bit more familiar with them, but maybe interface calls are better in some situations?
Yes the problem I made for myself was that since my interaction calls where run on the server so making the widgets would still be shown on all screens since that logic was later down the line. I was dreading having to remake the system but I figured out a pretty simple way to solve it without any major refactoring. (puh)
Thanks for the input guys!
It’s hard to explain my setup sometimes but I solved it using the method I figured out with using tags. I took some screenshots, if anyone wants me to try to explain it further I will do my best.
The interface is simply used to interact locally. On interaction an event is called on the server. Said event is what actually does the action.
e.g. Opening a door… Player gets close enough to trigger an Interact overlap. Player presses E to open the door. An event is called on the server to open it, meanwhile the player executes the local character animations (reaching out to turn knob etc).