x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

alt text

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

Product Version: UE 4.19
Tags:
mp.jpg (89.4 kB)
more ▼

asked Jul 27 '18 at 12:39 PM in Blueprint Scripting

avatar image

schweinerüssel
34 3 6 11

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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)

more ▼

answered Jul 27 '18 at 07:09 PM

avatar image

mightyenigma
3.8k 18 23 20

avatar image schweinerüssel Jul 30 '18 at 10:14 AM

Thank You

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 ?

avatar image mightyenigma Jul 30 '18 at 04:17 PM

if they are connected then your PrintString nodes should prepend their messages with "Server:" or "Client:". How does yours print?

avatar image schweinerüssel Aug 01 '18 at 08:44 AM

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

avatar image schweinerüssel Aug 02 '18 at 07:55 AM

when i join the same level it works

avatar image mightyenigma Aug 05 '18 at 07:52 PM

Interesting. I didnt know a client could connect to the server and be on a different Level

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question