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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Using multiplayer ready objects in "singleplayer"

Discussion in 'Multiplayer' started by Hertzole, Aug 14, 2015.

  1. Hertzole

    Hertzole

    Joined:
    Jul 27, 2013
    Posts:
    416
    Hi

    I'm currently working on a small multiplayer game and I it has the ability to play both online and offline. So I am wondering if I need to make something that disables all multiplayer components in offline mode and make a separate game manager just for offline or can I use the multiplayer ready objects in offline mode without changing anything/changing much?
     
  2. SuperNeon

    SuperNeon

    Joined:
    Mar 16, 2014
    Posts:
    85
    Hi,

    It will be easier to consider the offline mode as online or you will have a lot of work and it will be hard to maintain.
    So you have just to start a server and spawn a local player.

    Hope that help.
     
    Brainswitch likes this.
  3. EhoNo1

    EhoNo1

    Joined:
    Aug 25, 2015
    Posts:
    2
    When making physics and mechanics, try to make them for multiplayer only. That way when your in single-player your basically just running a server with only one player, so everything should run the same. Then you can simply switch off the multiplayer aspects to make it single-player.
     
  4. Brainswitch

    Brainswitch

    Joined:
    Apr 24, 2013
    Posts:
    270
    Yes, this is definitely the way to go. I have used this way successfully myself.
     
  5. Firoball

    Firoball

    Joined:
    Aug 6, 2015
    Posts:
    60
    I'm also going this way with having always server/client setup, but have to add some additional code to replace the client prediction/reconciliation system. On a host, server and client code would interfere with each other due to the predicted movement on the client.