Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Unity Multiplayer Program architecture to support SP, local MP and network MP

Discussion in 'Multiplayer' started by moose0847, Jan 27, 2021.

  1. moose0847


    Dec 26, 2019
    Hey everyone,

    I've recently been looking into adding multiplayer to my game, and have been doing some initial prototyping with mirror to that effect. While I am getting the behavior I would like, I do find that I'm having situations where the code paths for the SP, local MP and network MP games deviate significantly, and I'm having to maintain multiple code paths to do the same thing based on the game mode.

    I was wondering if anyone had any experience working on a game that supports all these modes, or any resources on what are considered best practices for this kind of thing. I expect I'll need some deviation when it comes to match setup & networking concerns, but I would ideally like to have the game logic not be concerned with that kind of thing where possible. My main question is--How can I support all these modes, but not have to maintain unique code paths for game logic? (i.e. different functions for spawning bullets in SP vs local MP vs network MP).

    At the moment my thinking is to just have the game always be "networked" to the local host under the hood, but I've heard this can lead to some problems on particular platforms (though I haven't found any good resources on what these problems are exactly).