Search Unity

Singleplayer to Multiplayer conversion question

Discussion in 'Multiplayer' started by Silvision, Jun 30, 2021.

  1. Silvision

    Silvision

    Joined:
    Jan 28, 2021
    Posts:
    1
    Hi, I feel like the answers might be obvious, but I was wondering if someone could clarify or give a hint / direction on how utilizing GameManagers would work once I try to convert my game? As of right now, I have a DialogueManager GameObject in my scene that follows similarly to the tutorial on Dialogue by Brackeys.

    It utilizes a singleton and has variables such as bools that I think would really only work with one person. So if I were to start converting to Multiplayer, I'm sure it would be a problem because of course they all can't use one DialogueManager. (One person talks, then the DialogueManager's bool variable says dialogue has started, so no one else can use the manager)

    Would the approach be to overhaul the Manager to handle multiple players? Or spawn a personalized DialogueManager on each player? This is just one Manager, but I have other Managers that include Quests, and eventually Inventory which I assume would follow the same idea of what I'm supposed to do with DialogueManager.
     
  2. Todiloo

    Todiloo

    Joined:
    Jan 22, 2016
    Posts:
    53
    So an overall goal could be to use as much non-networked object as possible. They can still react to networked events in the form av another networked objects receival of RPC message.
    So you could maybe still have a dialogmanager. The server sends a message to a client and its clientobject

    [ClientRPC]
    public void StartDialog(int dialogId) {
    DialogManager.StartDialog(dialogId);
    }

    That is just an example. A lot of the "states" you would only need on the server. For instance, I have states for enemy AI and that is only run on the server, the client sees the changes in behaviour but doesn't concern itself with like transitions etc.