kbengine+unity+php make a poker game-day1

Source: Internet
Author: User
Tags shuffle shuffle shuffle

When I wrote this blog, I actually developed a large part of it.

PHP part, Unity part is already almost, because Kbengine (abbreviation KBE) completely did not touch, in fact many place PHP part of logic can move directly to KBE complete. In order to develop efficiency, the same logic at the moment I still write with PHP fast, so the composition of the project has some small wonderful

We are now pondering the KBE and PHP part of the convergence problem:

1. When entering the room, call into the interface/room/join

2. Prepare state, call interface/game/prepare

3.

A. When PHP detects the number of players ready to Preparedplayercount = = Room.maxplayercount (the last player calls to prepare the interface), the PHP side generates a 52 card (without the size of the king) of the pool, and then shuffle shuffle ~ If the pursuit of extreme can be more shuffle two times ... Insert pool data into database table Cards_pool, generate new Poolid

B. Notify KBE to send the start game message to all players in the room, and inform the poolid that has just been generated (each room in the pool of roundcount starting from 1 increments, that is, the new creation of a room to start the game calculation of the first round, each new into a pool of the number of rounds +1)

C. The player (Unity side) to call the touch interface/game/getcards after receiving the message, the interface parameters of the Cardscount by the specific gameplay determines how many rows per person (such as bucket Landlord 13), prepare the game interface:



4. Notify KBE to send a message to the first player to play the card (by the specific rules to determine the first card player ID), Unity end start 20 seconds countdown, the player needs to call out the card interface/game/stepcards, the card out of the tiles into a string as a parameter, if selected, Then the parameter is null. The interface only records the card step to the database table Cards_pool_step, does not check the card type is legal, by the unity side self-check

5. Notify KBE to send a message to the next player to repeat step 4 until a continuous MAXPLAYERCOUNT-1 card record is null to determine the end of the card, record the player's UserID, start the next round of cards

6. Notify KBE to send a message to the player. Repeat steps until the number of players is 0 (according to the specific play to determine the winning conditions), the end of the round, by the client self-detection, the winning player calls the end of the round interface/game/roundover

7. Repeat steps 2~6 until any player leaves the room


===================

Interface test data: When a player touches a card from the table:

  1. {
  2. : "licensing successful"
  3. : "$"
  4. "ErrorMsg" : "Get Cards Success"
  5. "Cardpool" : {
  6. "Poolid" : "1"
  7. : "2016-11-04 04:50:15"
  8. "cards" : "3_10|3_1|3_6|4_10|3_8|4_12|3_13|4_2|2_6|2_4|1_10|4_3|1_3|2_13|2_8|1_6|4_6|1_9|3_12|1_2|3_7|1_8|3_5|2_2|4_11| 1_1|3_4|2_12|4_13|1_11|1_4|2_1|3_3|2_7|2_10|4_4|3_9|2_5|4_7|1_5|3_2|1_13|2_11|3_11|4_9|4_1|1_12|4_8|2_3|2_9|4_ 5 "
  9. "Roomid" : "1003" ,
  10. : "1"
  11. },
  12. "myCards" : "1_7"
  13. }
The prefix 1~4 represents the color suffix representing the number

Cards is the pool of cards after shuffle.


The Unity side Current effect:

Make a 3-band pair of steps (the tablecloth's UI material hasn't been given to me yet):


kbengine+unity+php make a poker game-day1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.