Search Unity

[WIP] Multiplayer card game in 3D

Discussion in 'Works In Progress - Archive' started by kshaja, Dec 10, 2012.

  1. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    I am working on a card network Video Game: Preferans 3D.
    I am working on it since February 2012.
    My idea is to make it immersive as much as possible.

    Preferans (Balkan rules)

    I am developing it in 5 phases:

    Phase I: One application instance with three players. To make and test the game logic and card rules.
    ( One user plays for three game players )

    Phase II: One applications instances per player. Real multilayer game with LAN network settings.
    ( when three players are connected the game starts) To test network game play.

    Phase III: One applications instances per player. Real multilayer game with WAN networking.
    Idea is to use lobby and rooms for joining the game and master server to hold lobby.

    Phase IV: Visual polishing, GUI

    Phase V: Make game run on PC, OS X, Linux, Web,FB, Pads, Tablets.


    Engine: Unity,Unity and Unity
    Code: Antares Universe VIZIO
    Network: LAN ( Unity Network ), WAN ( ExitGames - PHOTON )

    I will use this tread to show my progress,and any comments and suggestion are more than welcome.

    this is my first drawing about the game
     
  2. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    Beginning:

    In every real card game, you must shuffle your cards. Usually card computer games release you of that burden, and you get some random computer generated combinations. With that approach game doesn't learn players importance of good card shuffling.
    Lots of hands can be won with observing where cards goes when the deck is preparing for a shuffle.

    As I need to make the game as realistic as I could, card shuffling is a must.

    Card shuffle


    Bidding in Preferans is a part of the game where players choose who will play and what game:
    Beginning with the eldest hand, players bid for the privilege of declaring the contract and trump suit and playing as the soloist.
    The bidding can last several rounds until all players but one pass.


    Here is the script for bidding:
     
    Last edited: Dec 12, 2012
  3. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    I like this idea, of a unity card game, much like the one wolfire did for the f this jam, in fact, the source code is available, on the wolfire git. You might check that out for some ideas. Oh and its multi player. Maybe some of that could benefit your project.
     
  4. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    @MD_Reptile thanks for support

    I found it very useful to put idea on the paper first and then to "materialize" it in video game:

    Shuffle processes:






    Game View with players and cards
    The cards are dealt following the scheme 5–talon–5. If several players bid hand, the highest contract takes precedence as for the non-hand bids.In hand contracts, the talon is laid aside. Otherwise declarer exposes it to the defenders:

     
  5. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    no problem kshaja, I like the new screenshots, looks nice! I tried once to make a similar project (not an actual game just a prototype of some cards and moving them around and stuff) and it can actually be more challenging than it looks, so it seems like your doing good! I'll keep an eye out to see how this turns out
     
  6. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    @MD_Reptile Thanks again for your kind words.

    Here is an update,



    I made more scripts for the flow of the game, as you can see, I made GUI buttons for every part of the game, so I can test them separately.Text is on Serbian and it goes like this:
    New Hand - Shuffle - Deck cutting - Dealing - Bidding - Turn Talon Cards - Put back Talon - Declaration - Player Play - Game

     
    shintoo likes this.
  7. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    Idea for new GUI system:



    New GUI implemented and a game flow indicator:

    BIDDING


    DECLARATION


    PLAYING
     
  8. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    Player script In Phase I, there are three scripts for each player



    Game script



    Scripts Gizmos I spent hours on net to find these icons, and I found it very relaxing :) . They will be erased before production phase ;)

     
  9. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    New Look and new GUI. Added Camera zoom and pane



    Added simple GUI for cutting the deck at specific point




    Added talon cards random orientation and score sheet



    Added markers for hands that are won

     
  10. hellraizerhhh

    hellraizerhhh

    Joined:
    May 26, 2010
    Posts:
    619
    Coming along nicely. I assume the cutting of the deck is pretty arbitrary right? Like, If I cut the middle, or if I cut the top, I assume I have the same percent chance of getting the same card I would have got regardless where I cut. Hope that makes sense :)
     
  11. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    Thanks for comment!
    As I mention on the first post, I am trying to make this card game looks and feels like a real game ;)
    As You can see there is a slider above the deck and it goes from 0 to 31. And when You move the slider the green square is also moving along the deck to show You where is Your cut at the moment. If You cut at position 12, that means that 12 cards from the top of the deck are going to the bottom of the deck, just like in real life.



    Script for cutting the deck:



    Same thing with shuffling the cards. There are two sliders for both decks.They are used to set to how many cards are going down when shuffling.



    Script for shuffling:
     
  12. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    Phase I FINISHED !
    After some testing and some bugs found, phase I is finished. Game play is set and its operational.

    Phase II ( LAN multiplayer game). Using Unity Networking.

    Now the visual part of the game has to be changed:

    First concept of the table and camera position, and how my LOGO was inspired ;)


    One table for each part of the game ( shuffle, cut the deck, talon picking, playing )
     
  13. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    LAN networking - Three applications on one computer

    Connection testing:





     
  14. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    After testing connection, cameras positions are next :





     
  15. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    Changing one standalone game with 3 players to a single network game with 3 players was not an easy task.
    Lot of code had to be remade. And a lot of time that went into that code become void.
    But as this is my first network game it was useful experience. Lot of that code was GUI code.

    Network in LAN is little bit awkward for this type of game. The first player is a server and it see both Player2 and Player3.
    Player2 sees only server, but not Player3 and vice verse. So if I need to send message from P2 to P3 I need to do it over P1 ( server ).



    Also the script size become larger

    Bidding script:


    Having 2 monitors was a huge relief:
     
  16. Marrt

    Marrt

    Joined:
    Feb 7, 2012
    Posts:
    613
    a 3d card game, this sincerely has a lot of money-making potential (so much gambling people out there, it never tickled me however)

    -just a thought, i may be wrong:
    i played some games where some hackers were able to modify camera positions by memory modification
    if the cards on the enemy hands have already the right texture some hackers could just turn the camera and look at them, or more easily read the network stream if its not encoded. Therefore cards should only get their texture/numbers from the server as the card is shown.

    but probably you had this in mind already
     
  17. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    If those hackers could help me find where i put camera position variable, that would be a lot of help for me. I made a mess ;)
    I didn't yet implemented any system for anti-hacking in the game. But Your suggestion is on the spot. When I finish the game I will for sure implement some anti cheat features. Now my main goal is to make it work...
     
  18. sushanta1991

    sushanta1991

    Joined:
    Apr 3, 2011
    Posts:
    305
    Wow @Kshaja, that's what i call a progress :) You have done a great job, awesome.
     
  19. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    @ sushanta1991 Thanks a lot! It will get only better!

    Some taken cards,papers and photo and GUI testing:
     
  20. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    I made some tests:

    OS X


    Ubuntu


    working great :)
     
  21. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    Made options for position of the cards in the hand, their orientation, height, angle, order of colors and values.
    All changes are propagated through network so other players can see them.

    Concept:


     
  22. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    More fun with real time card manipulation

    hand hold


    card picking


    card playing



     
  23. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    Phase II FINISHED :)
    After Beta Test with my friends, which lasted 90 minutes before crash, phase II is finished.
    Bug fixing and improvements are on the way...

    Here are some latest pictures:





    and some table modifications :)



     
  24. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    Last month I made with a lot of help from Andrey Pakhomov ( Pax ) - VizioPUN!

    VizioPUN is a plugin for Antares Universe ( VIZIO ) that integrates Photon Unity Networking, thus it enables using Photon with VIZIO.

    More about it and download link for the plugin can be found here : http://viziopun.blogspot.com/

    And here are some first test of this new plugin in action inside preferans game:



    Phase III is ON!
     
    Last edited: Jan 28, 2013
  25. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    Greta work.:D
     
  26. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    @rahuxx Thanks!!!

    After two months delay, ( worked on some other project ) I have returned to the III phase , WAN transforming.

    Two instances of Unity with Vizio visual debugging system + one stand alone:

    $prefWan.png
     
  27. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    After another pause ( there is a newborn :) ) some quick testing:
    I have two instances on my PC and one on android device, all communicating over internet:

    $DSC_2722.JPG
     
  28. SuperUrchin

    SuperUrchin

    Joined:
    Mar 19, 2013
    Posts:
    4
    This is looking so good Was it difficult to get VIZIO integrated?
     
  29. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    If you like visual programming, not a problem, because it is made 1:1 with Unity script plus additional functions. You can use Unity script manual and to see what functions they use and to find them in VIZIO.
     
  30. BosnianKingdom

    BosnianKingdom

    Joined:
    May 24, 2013
    Posts:
    3
    You have done a great job!

    Zelim da uradim nesto slicno ovome tj. igricu sa kartama koja ce se moci igrati preko neta.
    Ako mozes da mi dadnes par uputa mnogo bi mi znacilo..hvala!
     
  31. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148

    Thank You!

    Prvo na dobrom si mestu jer je Unity ko stvoren za to.
    Ima sopstveni sistem za mrežu, a možeš naći i nekoliko nezavisnih pluginova i servisa za mrežu koji završavaju posao. Pgledaj na Asset storu.
    Kao i za svaki program, poželjno je definišeš unapred šta želiš, napraviš neki algoritam i onda kreneš u rad. Ne znam koje su ti sfere interesovanja i oblasti u kojima radiš pa za sada ovoliko.
     
  32. BosnianKingdom

    BosnianKingdom

    Joined:
    May 24, 2013
    Posts:
    3
    I think it's better if we continue in English, some people might have the same questions as me.
    First of all, where did you get your cards from? Since card games are so popular, are there scripts out there for the basic card movements?
     
  33. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    You can find some free card pictures on the net, or you can scan your favorite deck!
    What do you exactly mean about card movement? I didn't look for any card scripts, i did them all by my self.
     
  34. BosnianKingdom

    BosnianKingdom

    Joined:
    May 24, 2013
    Posts:
    3
    Movement as in drawing a card from a pile or discarding a card from your hand onto the table..things like that
     
  35. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    All those movement I had to do by my self. I don't believe that you can find some script for that. Basically it depends on what kind of game are you planning to do, 2D or 2D+ or 3D?
     
  36. The Ghost

    The Ghost

    Joined:
    Jul 7, 2012
    Posts:
    188
    Wow, this looks really good. Keep up the good work.
     
  37. MacAttack2112

    MacAttack2112

    Joined:
    Jul 3, 2014
    Posts:
    2
    I found this very helpful, thanks you. And visually it looks really cool..

    Starting out myself with Unity and want to program a card game. So breaking it down into phases actually gave me some good goals/.
     
  38. shintoo

    shintoo

    Joined:
    Sep 1, 2015
    Posts:
    1
    that is an excellent game, really love looking at, however i wanted to create something similar for local work, is it possible if u could share the design with me ?
     
  39. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    Thanks, what exactly did you have on mind? You can have a free card pictures on internet.
     
  40. Anonymous789

    Anonymous789

    Joined:
    Nov 29, 2015
    Posts:
    6
    I need little help.
    I wanna make online multiplayer card game(TRUMP Card Game) in unity.
    I am new in unity so i don't have much knowledge about unity.
    Can you tell me how can i start?
    Thanks in Advance
     
  41. Anonymous789

    Anonymous789

    Joined:
    Nov 29, 2015
    Posts:
    6
  42. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    Hi Annonumous :)
    Welcome to the forum.
    Here on this tread you can find some advises about how to make a card game. What you should do before starting the actual game coding.Making it work on paper first ;) About Unity there are lot of tutorials about programming.
    Hope this help
     
  43. Anonymous789

    Anonymous789

    Joined:
    Nov 29, 2015
    Posts:
    6
    As you made this game. Can i get the source code if possible hopefully it will help?
     
  44. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    As you have very small messages count I will presume you are also novice in programming, not only in unity, so I will be very polite.
    People that want to share their code are doing that by them self, putting it on some git repository, and announcing it on their first post.
    People that didn’t share their code, usually don’t like to let, get their code to some annonumous ( pun :) ) people on public forum.
    Advice: Use private messages to the authors of the code to ask them if they will share, sell etc. their code.
    In short:
    No, I am not willing to share this code ;)
     
  45. Anonymous789

    Anonymous789

    Joined:
    Nov 29, 2015
    Posts:
    6
    Okay.
    NP...;)
     
  46. Goku007

    Goku007

    Joined:
    Nov 28, 2016
    Posts:
    2
    Kshaja Can you explain me phase 2 i'm also working on it and also using unity Unet....
     
  47. kshaja

    kshaja

    Joined:
    Sep 22, 2010
    Posts:
    148
    hi, please remind me abouth phase ...
     
  48. dc_network

    dc_network

    Joined:
    Jan 3, 2017
    Posts:
    1
    hi Kshaja,
    I'm a newbie.

    One question.
    I'm starting to research about "Create Turn based multiple players game"
    I'm reading/reviewing about Photon, Smartfox and UNET .

    Where is solutions for your server card game ?
    Please suggest and comment for me,
    Thanks!