Search Unity

Need advice getting started. Turn-based multiplayer with many concurrent games on the same server

Discussion in 'Connected Games' started by arcooke, Aug 3, 2017.

  1. arcooke

    arcooke

    Joined:
    Sep 1, 2014
    Posts:
    29
    There is a game I would like to get started working on but I'm not sure where to begin as far as networking goes. I'm not sure if Unity's built-in networking is a good fit for my game (it doesn't seem like it is), or what alternatives I should be considering.

    My game does not need any high performance realtime networking. You can think of it a bit like a poker game.. each player at the table takes a turn during a round, then when all players are "ready", the sever figures out the results and starts a new round for that table.

    I would like to be able to host many (hundreds or thousands) of these little 5-player poker games running from the same physical server binary. This is where I don't think Unity's networking is a good fit, but maybe I'm wrong.. it seems like it's designed for games where everyone connected to the server is playing the same game.

    The game requires so few networking resources that I've even considered using a web service in place of a traditional game server.. and maybe this isn't such a terrible idea. The hurdle I run into there, is that web services cannot push data to clients, information can only be pulled from the web service.. meaning every client would have to repeatedly poll the server to check for new instructions.

    So here I am a bit stuck.. I'm not sure where to begin. At this point I'm leaning towards a basic UDP connection using something like LiteNetLib .. but again, not sure if it's the best solution.

    I've never written a multiplayer game, so any advice would be appreciated.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    7,424
    You wouldn't want to use the standard UNet HLAPI as it is really built for a single game environment, not multiple independent games run by the same server. Though if I were to try something like this in UNet I'd just use NetworkServerSimple, which ditches all the high level game environment parts of UNet, and handle everything with messages.

    The server would organize all the different player connections into the different matches, check results, etc. I don't know if this is capable of thousands of simultaneous users though.

    https://docs.unity3d.com/ScriptReference/Networking.NetworkServerSimple.html
    https://docs.unity3d.com/Manual/UNetMessages.html
     
  3. mofirouz

    mofirouz

    Joined:
    Jul 14, 2015
    Posts:
    27
    You could use Nakama to build your turn-based games. It can run many concurrent matches on a single server. Each player can have multiple sessions and participate in multiple matches at the same time. The client is available on the Unity asset store.

    Hope it helps - I’m one of the engineers on it. :)
     
  4. Akhil1195

    Akhil1195

    Joined:
    Aug 19, 2019
    Posts:
    3
    is any demo or tutorial available for Nakama to build your turn-based games
     
  5. MrsPiggy

    MrsPiggy

    Joined:
    Jun 13, 2018
    Posts:
    134
    I would recommend to take a look at SmartFoxServer. It will probably save you a lot of time as it takes care of all main aspects of the game: login phase, room/game management, match making, chat/moderation and it is server authoritative.
    Check www.smartfoxserver.com or search it on the asset store, I believe it's there too.
     
    Joe-Censored likes this.
unityunity