send events from server to client
im trying to send an event from the server to the client. When i hit the space bar on the server i would like to start an animation on the client,
my current aproach is to define a boolean variable"start" in the game mode and set it via custom event "go" called in the levelBP on the server.
the event is multicast and the variable replicated
this image is from the eitor left is the server right the client im printing the state of the start variable when i hit space ("go" event) the variable switches endless from false to true and back i have no clue why
in the packed game on the server the variable swiches from false to true when i press space (thats what i want) but on the client the variable keeps false.
do i miss something ? or is my whole gamemode aproach wrong? i also tryied with game state and do it directy in the game instance without success thanks in advance
Gamemode is the rules of the game so there is no reason for it to replicate between clients and server, so it doesnt. It keeps everything private to the server's control.
If you want to replicate gaemmode types of things, put them in a gamestate that your gamemode uses.
The true/false flipping might just be due to having more than one actor referencing the variable on different instances of the game (the client i stance never receives the var change because gamemode doesnt replicate, so it prints false, and then the server prints true, and then the client prints false again. etc)
answered Jul 27 '18 at 07:09 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here