No announcement yet.

Trying to replicate event from Game Mode to all the clients Game States

  • Filter
  • Time
  • Show
Clear All
new posts

    Trying to replicate event from Game Mode to all the clients Game States

    I feel kind of silly because this should be so simple but it's the first time working on multiplayer stuff.

    In my Gamemode I wait for a certain number of players to join, if i.e. 2 players are connected the match state goes from "Waiting" to "InProgress". Since the Game Mode is only on the server I want to call an event in the game state in replicate that to all the client's game states to basically start a clock for the match.

    However, everything gets only called on the server:

    Here is the call from the Game Mode to the Game State (this should only happen on the Server):

    Click image for larger version  Name:	1Gamemode.jpg Views:	0 Size:	100.0 KB ID:	1689632

    This is in the Game State. The First Event should only run on the Server also but if the Game State has changed to "InProgress" it should run the Multicast Event which then runs on all clients, but it doesnt. The last Print String also only runs on the Server:

    Click image for larger version  Name:	2Gamestate.jpg Views:	0 Size:	310.5 KB ID:	1689633

    I added prints to all game state casts to see if maybe some game states aren't initiated yet but no cast failed and yet with this change it works now:

    Click image for larger version

Name:	3Gamemode.jpg
Views:	445
Size:	175.6 KB
ID:	1689715
    The client joins the server so it's game state takes a little longer to initiate, this is my guess. However if someone knows what is actually happing, that would be awesome. I thought the post login means, a client has not only connected to the server but is also finished with loading the map, spawned and possed a pawn and is generally ready to start playing the game. There is also an Event "Handle starting new Player" maybe I should use this to start the game when everyone is ready?

    I'm not a fan of using delays like that.