No announcement yet.

Noobie replication/GameMode question :)

  • Filter
  • Time
  • Show
Clear All
new posts

    Noobie replication/GameMode question :)


    As you might suspect, I havent really figured our the whole replication thing yet...
    Ive got some of it down, but I cant figure out why the following isnt working;

    I am trying to set an Array of PlayerControllers in my GameState, to keep track of Teams and squads etc...
    For some reason changed made on client does not replicate on the server, but changed made in the server replicates on the client. The Custom Event is being called from a Widget Blueprint.

    I have the exact same setup, in the same Widget made to change a value on the PlayerState, which works fine... but not for the GameState...

    Any suggestions?

    GameMode is not replicated and it only exist on the server.
    GameState is replicated and owned by the server which means that the server can send RPC (Remote procedure calls) to all clients but the clients can't make RPC's to the server.
    PlayerController is spawned on the server and replicated to the owner ONLY, which means client 1 will never know about client 2 PlayerController.

    So the GameMode is only useful for the Server and GameState is like the server Bulletin board that the server use to post things that all clients can read. The PlayerController is personal to each client but the Server needs to know about it too to execute commands from them on behalf of the player.

    UserWidgets are visible locally to each player and are not replicated so they can't be used to send server events from. They are just cosmetic elements that has to send information through perhaps the PlayerController.

    TLDR: Use the PlayerController instead of GameState to communicate from Client To Server and GameState to communicate back to the clients.
    • PlayerController
      • Client-side.
      1. Make a RunOnServer CustomEvent
      • Server-side
      1. Make a CustomEvent calling a function in GameState
    • GameState
      • Server-side
      1. Make a Multicast CustomEvent
      • Client-side


      Thank you!
      That was helpful. I thought I have kinda got that part, and what each Mode/State is for (but apparently I still havent)

      What I am trying to do right no; I want a couple of arrays with Player Controllers, to later be able to send out "objectives" to players in each team. Two Arrays; TeamA and TeamB...

      What i am trying to do is set the array inside the GameState from a Widget (as I want every player in the game to be able to access it to change team, and receive updates from other clients) wich creates when you Spawn. Its a VERY SIMPLE task, and I dont understand why its not working?!?



        Never mind... I figured it out
        The problem was (as you said), that I cant call server events from a widget.