I’m messing around trying to learn how to deal with multiplayer stuff but I seem to have a mental challenge when it comes to playercontroller and gameinstance communications.
I have a playercontroller calling a function on the gameinstance and want to send a response to ONLY that particular gamecontroller/client. I’ve seen many replication/repnotify tutorials but they seem tuned to having the gameinstance send to ALL playercontrollers and never mention anything about a message back to only the sending controller. Perhaps it’s just so obvious that they don’t see a need to mention it but I just can’t see it.
How would I call a gameinstance function, derive a response, then send that back to ONLY the requesting playercontroller?
I just stumbled across a video that did a great job of describing replication but it INCLUDED how to set that to ONLY the owner. During that video it dawned on me - I don’t need replication at all for what I want to do!
If I want to check something that is only available from the server and return a boolean value to the specific client then I can use a GameInstance custom function (running only on server) and set a variable on the gameinstance itself. When I want to check the result I just use getgameinstance in a blueprint (I’ll use player controller to ensure information security for now) then get that variable value. The value will be correct for the calling player and simply blank for all other players because it is set on each client individually (unless I specifically tell it otherwise).
I tested it out and sure enough it works. No wonder replication tutorials don’t mention much of anything about it - you don’t need replication for what I wanted.
Unless I’m still not seeing the obvious of course.