I want to create a client/server game where the client does nothig else than running an HUD which generates events on the server.
My goal is to create a kind of remote control panel in order to conctol the parameters of a game from remote.
Unfortunately, I have the problem that HUDs are “cosmetic” and their events are not sent t the server.
Here is in the description of my setting:
- The visual scene contains a red sphere which gets toggled visible/invisile from a GUI (HU) runing on the client.
- At EventBeginPlay, the HUD is created on the client only.
- When the HUD’s butto s pressed, it calls an event dispatcher which is bind to a Custom event in the Level Blueprint.
- In theLevel Blueprint, I have a “SphereVisible” bolean variale which is “replicated”.
- The custom event which is triggered bythe utton is set to “mlticast”.
When Ipress the button on the client, the sphere properly appear/disapear on the client, but not on the server.
Here is my bleprint in attachment.
Thanks and regards Unreal community !
Here is my Level Blueprint graph:
Here is myHUD:
Here is my HUD event graph:
Here is what it looks like at execution:
Just a guess. Hidesphere event set it to server call. After the “set sphere visibility” variable, do a multicast for “Set visibility”.
Though… i am not sure what is the impact with calling it from level BP or character BP. Usually this is done thru controller/character bp right?
In fact, whe wecreateacustom event trough binding to an event dispatcher, we do not have the option of setting the event replicability.
To do so I have removed the orange link from “Bind event to button clicked” to “HideSphere” and then chaned his replicability to to "Server"or “Multicast” (I triedthem all).
And after that, I remaket the orange binding link.
It sounds as atweak since I think as soon as custom event gets binded to an evet dispatcher beloging to an HUD, it can not cross the lient/server barier anymore.
Isn’t it ?
To do so, Ihad
I mean, even if I set event to “Execute on server” or “Multicast” and use “As Authorityswitch”,it executes on on client because it seems t inherit the “Blueprint osmetic” feature of the HUD.
My last option would be to use my own UDP or TCP sockets to transmit information, but I want to make sure there is no other way around before jumping into this big task.
As suggested by pickersZ , I have created another custom event that is multicast that I call by the binded event “HideShere”. It is named “JumpBarrier”.
Unfortunately, it seems to not want to acomplish what its name dictates