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)
when i manage it via gamestate i get the same result
the Client ignors, that the server switched the state of the variable
is it maybe a problem, that the server and the client are not in the same level ?
if they are connected then your PrintString nodes should prepend their messages with “Server:” or “Client:”. How does yours print?
tha t depends, from where i print it when i print it in the gamestate both print server when i print it in the level bps there is nothing before the state of the variable
i think i made a mistake in the hosting and joining, on th host i load am map with the controlls (menu widget) and when the client joins it loads a different map im not sure whats about the open level options
when i join the same level it works
Interesting. I didnt know a client could connect to the server and be on a different Level