Search Unity

Question Offline Lobby

Discussion in 'Lobby' started by Jontac, Aug 8, 2022.

  1. Jontac

    Jontac

    Joined:
    Feb 6, 2019
    Posts:
    33
    Hi
    Does anyone know if and how one might be able to use the Lobby-service to connect two players when they aren't both online at the same time? Like a invite waiting for x-hours.

    Thanks in advance!

    Best regards!
     
  2. veleek_unity

    veleek_unity

    Ben Randall Unity Technologies

    Joined:
    Aug 25, 2021
    Posts:
    59
    This is not currently possible. A host can create a lobby and not delete it when they go offline, but the lobby will go inactive if it is not being heartbeated and will eventually be deleted (after about an hour).

    We are in the process of validating some changes to support service authentication for Lobby (using something like Cloud Code, or a custom game service) that could allow you to have a lobby that is "owned" by a service (as opposed to a player) which would allow you to keep the lobby alive even if all the members are offline. You could then keep the lobby active to prevent it from being deleted and accomplish this scenario.
     
    Jontac likes this.
  3. Jontac

    Jontac

    Joined:
    Feb 6, 2019
    Posts:
    33
    Too bad, thanks for the answer.

    But is there some sort of database functionality in the Services? So one might be able to send a request as a player with User-ID and another players User-Name for the cloud code to locate the challanged player and maybe send notifications every 12 hours or 24 hours for 2-3 days. And if/when that player accepts the unity cloud code start a seperate turn based game on each device and continue assist as a mediate in between turns?
     
  4. veleek_unity

    veleek_unity

    Ben Randall Unity Technologies

    Joined:
    Aug 25, 2021
    Posts:
    59
    There are a bunch of different ways to accomplish what you want depending on the specifics. The Lobby service is not a database itself, but it can be used to hold a small amount of data. As an example, if you were building an async card game, you could probably use lobby to hold the information about which cards each person had. If you need to hold more data than that, then you could potentially use the CloudSave service to hold the game metadata and have the Service or CloudCode load that metadata whenever a player submits a move.

    Separately from that, for creating a lobby and sending notifications about it, Unity doesn't currently have a system that allows sending notifications to users (online or offline). There is some work in progress around that, but we don't have a timeframe for it yet. The way I would accomplish this right now would be to have a service create a lobby and then use some other mechanism for sending an invite. For example if your game is on Steam, you could use the Steam messaging system to notify the other player about the lobby. Then when that player launches the game they can join the lobby and trigger the service to start the game.
     
  5. Kreshi

    Kreshi

    Joined:
    Jan 12, 2015
    Posts:
    445
    @Jontac Wouldn't simple HTTP requests to a server with a database and login-credentials be enough to achieve what you need?