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

Advice on 4 player card game

Discussion in 'Multiplayer' started by Optimus_Prime, Dec 17, 2015.

  1. Optimus_Prime

    Optimus_Prime

    Joined:
    Apr 15, 2015
    Posts:
    34
    Hi Guys
    I am deveopling a simple turn based card game which has to modes, single or multiplayer up to 4 players.
    My game is built using the new Unity UI and everything thus far I am happy with Unity. So I
    would like to use the new Unity Networking built in, but i am unsure if it will support my design.
    Basically I need the following features :
    1. The user can choose to join a room with 2 or 4 players.
    2. The game can only begin if 2 players have joined.
    3. Basic leaderboard (do I host this information on the unity networking server or my own)
    4. If a user joins an empty room, that user should get a notification telling them when another user joined the room and now the game can begin.

    Can you please tell me if Unity Networking can support this? Are there any examples that can point me in the right direction with trading cards turn based networked.
    I have done some Unity Network tutorials using the Network Manager and they work well. But I am not sure how I implement this into my game design.
    Like does the dealer reside on the mobile phone or on the server? the game always contains 4 players which are as follows :
    2 human mobile players and 2 AI players.
    4 human mobile players.

    Please tell me if I need to specify more details. I am happy to even to a drawing on the design.
    Single Player works well. I just need it to be multiplayer now.

    Thanks guys and happy holidays
     
    Last edited: Dec 18, 2015
  2. Optimus_Prime

    Optimus_Prime

    Joined:
    Apr 15, 2015
    Posts:
    34
    any ideas anybody ?
     
  3. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    1)unet can do that
    2)unet can do that, you will have to code the logic yourself
    3) nope
    4) unet can do that
    for the "AI" and 2) if you use authoritative logic it will be done on the server, if not the logic would be executed on the first client that join the room

    for a game like this, if its meant to be seriously developed i would not use Unet but a backend server such as playfab, gamespark, braincloud. these would be cheaper, have more options and be more scallable
     
  4. Optimus_Prime

    Optimus_Prime

    Joined:
    Apr 15, 2015
    Posts:
    34
    Hi Damien Delmarle

    Thank you for the reply and pointing in my right direction, I would look into playfab and braincloud.
     
  5. StarGamess

    StarGamess

    Joined:
    Jul 21, 2014
    Posts:
    179
    As for the leaderbord goes there is a really nice free asset on the asset store which allow you to integrate leaderbords into your game and it include a plugin to make the leaderbord viewable anywhere on the web AND you can use there server for FREE!
     
  6. Mr.Mille

    Mr.Mille

    Joined:
    Sep 17, 2015
    Posts:
    21
    Hey guys, i'm also developing a multiplayer turn-based card game and i have a related question.
    I'm using UNET, but i'm not that familiar with networking stuff. As far as i know there must
    be always a player who is the host (client and server). The issue is if host leaves the game all clients
    are diconnected from the game too.Is there any way to keep the game running? Or is there any way to run
    non-player server in background using unity neworking?
     
  7. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,732
    The term you are looking for is Host Migration.

    Currently for Unity Networking this is only supported for LAN games, it will be supported for other connection types in future updates.
     
    Mr.Mille likes this.
  8. Mr.Mille

    Mr.Mille

    Joined:
    Sep 17, 2015
    Posts:
    21
    I also had an idea to use host migration, but as you already mentioned, Unity supports only LAN host migration for now.
    I checked Unity roadmap, but i didn't find any future plans for host migration. I mean it could last for minimum 3 years till they get it.
    What about dedicated server. I mean, for example, if you use networking hud you can run "server only" and then connect players. Can i run this sever in background without loading an online scene?Would it be a solution? Or should i just give up with UNET.If yes, what other networking services would you suggest?
    Thank you.
     
  9. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,732
    Yes, you can run a dedicated server, and just have clients connect to that. But if you want players to be able to host their own games and have the host automatically switch on disconnects, then you could use Photon as it handles host migration very well.

    You might also want to check out Forge, as it seems to get good comments, although I haven't used it myself.
     
    Mr.Mille likes this.
  10. Mr.Mille

    Mr.Mille

    Joined:
    Sep 17, 2015
    Posts:
    21
    Thank you.I think Photon is a good alternative. But i'm not sure if players do ever need to be a host in my game. For example online poker. If i'm not wrong all players there are only clients, which are connected to a dedicated server.
     
  11. moh05

    moh05

    Joined:
    Nov 26, 2015
    Posts:
    65
    I have been looking into forums since days and I wonder...Why no one ever did a tutorial for a multiplayer card game???
     
  12. Optimus_Prime

    Optimus_Prime

    Joined:
    Apr 15, 2015
    Posts:
    34
    Exactly moh05

    I am just trying to do a simple multiplayer blackjack game. No tutorials out there. Unity should look into this and provide a tutorial using just Unity UI and Unet.
     
  13. moh05

    moh05

    Joined:
    Nov 26, 2015
    Posts:
    65
    I mastered UI, I mastered card related logic ( creating deck, shuffling, card distribution,..)... I mastered even how to cook while coding but couldn't have a clue where to start the multiplayer feature!!!!!!

    Seriously, the first guy who comes up with such a tutorial and sell the course on Udemy as an example, will get so damn rich!!!
     
  14. Optimus_Prime

    Optimus_Prime

    Joined:
    Apr 15, 2015
    Posts:
    34
    LOL
    I know what you mean, Unity should do a live training course on a simple multiplayer blackjack game using unity networking. UNITY READ THIS THREAD!!!