Search Unity

Creating both Multiplayer (Coop) Offline Mode and Single Player Mode

Discussion in 'Multiplayer' started by tmrebca, Feb 18, 2023.

  1. tmrebca

    tmrebca

    Joined:
    Dec 26, 2022
    Posts:
    8
    I am in the development stage of a new game. I want to incorporate a coop mode and single player mode, but do not know the best way to go about this. I have done some research on Unity Netcode and some other resources, but still need some guidance.

    Some core features for the Multiplayer mode I am looking into developing are the following:
    • Each player gets a character they can control
    • Split screen
    • Building with GameObjects that results in a final product/output worked on together.
    • Identifying options for character chosen by player. For example, option 1 is food maker, and option 2 is food producer, than each player can choose which option they want to be apart of, but both can not be apart of the same option at the same time.
    The game will center on teaching about food access, nutrition, zero hunger,etc. and is a educational/social impact video game.

    Thank you for your time.
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,956
    Single Player == Host playing all by him/herself. If needed you can make client approval check always fail in singleplayer to ensure no players can join.
     
  3. tmrebca

    tmrebca

    Joined:
    Dec 26, 2022
    Posts:
    8
    Thank you! So to make sure I understand correctly, when writing the game, just default to single player? So does that mean even if it’s “coop” when really it’s just two single players working together?
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,956
    No, you make the game assuming that it is always networked. When starting singleplayer or multiplayer in both cases you start as a host. Only difference being that in singleplayer no one else joins, whereas in coop someone else can join. In fact the singleplayer only exists to serve a player‘s expectations but technically that player is still hosting a network game, although you may configure the network settings/code so that the sp game session cannot be joined.
     
  5. nilagard

    nilagard

    Joined:
    Jan 13, 2017
    Posts:
    77
    "Just" disable the lobby creation part with a button click when starting a new singlaplayer session and you'll have yourself a singleplayer game.
     
    MrUndead likes this.
  6. tmrebca

    tmrebca

    Joined:
    Dec 26, 2022
    Posts:
    8
    Thanks. I understand better now.