GithubHelp home page GithubHelp logo

chips-blockchain / pangea-poker Goto Github PK

View Code? Open in Web Editor NEW
25.0 25.0 16.0 16.44 MB

This is the reference GUI for Pangea Poker, blackchain based decentralised game.

Home Page: https://chips.cash/

HTML 0.14% JavaScript 31.56% CSS 9.68% TypeScript 58.62%
blockchain electron game game-development graphical-user-interface html5 lightning pangea-poker poker reactjs

pangea-poker's People

Contributors

dependabot[bot] avatar norbertdragan avatar piggydoughnut avatar renovate-bot avatar sg777 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pangea-poker's Issues

Log player actions in the log box

If a log of each bet could be added in a text box down the bottom left corner of the display. So people can see a text log of each hand/bet played on the table. (by @NutellaLicka)

Add the log box from the original designs and display player actions in it.

  • Add basic logging
  • Fix logging for All-In
  • Add test coverage

Remaining board cards don't show during All-In

Screenshot 2019-10-31 at 15 34 23

![image](https://user-images.githubusercontent.com/17296915/67957323-b4c6d680-fbf5-11e9-95ad-ebaa06fb0553.png)

In case of All-In during any of the screets, the remaining cards don't get shown at all. The winner gets selected, and the game goes on.

Stack is negative for BB at the start of a new hand

image

When a new hand starts after an All-In, the palyer at the Big Blind has negative stack. The problem appears to be that the first round_betting message does not have player_funds property, as seen bleow.

image

How should Muck be handled?

There is an action in poker called Muck. It is essentially the same as a Folding, but it happens during the showdown and allows a player to not show their cards, therefore signaling that they have a worse hand and loose the pot.

Consider the following scenario:

River

  1. Player A bets 1000
  2. Player B calls 1000

Showdown

  1. Board reveals AKT23
  2. Player A shows AA and has three of a kind (set)
  3. Player B has `KT and has two pair and chooses to muck the hand

In this scenario, Player A has to act first and must show their cards. Player B has a worse combination of cards with two pair, therefore he can just "fold" their cards, which is called muck in this case. Note that he has the option to either muck or show, default setting usually being muck. PokerStars even has a Show/muck hand preferences option.

Had Player B had a better hand, they would have to show it in order to win the pot.

In live poker, a mucked hand is never shown, and although technichally could be requested to be shown, it is considered to be a huge briech of etiquette. In online poker, many of the poviders show mucked hand during replay or hand histroy, but not during the actual game.

How should the muck be handled?

My suggestion is to not to show mucked hands by default, but provide a hand history text file, where it will be available.

Name the players consistently on the frontend and backend

The front-end originally started naming players with 1, as player1. The backend however, starts counting from 0, as player0. This is causing some unnecessary and sometimes confusing code all around the app.

We should fix it and the frontend should begin counting form 0 to match the backend.

No way to know who is the currently active player

The backend should send a message to all the players informing the UI which player is currently active. The message should be sent at the same time the round_betting method is being sent to the currently active player.

This will be very important to have for 2+ player tables. Also, it's currently blocking #17 and #20.

Dealt hands are broken after a fold

Following the next hand after a player folds, the new holecards don't display at the GUI for some reason. The message is correctly received from the backend, just no GUI update.

Opponent's cards don't show up during showdown

For some reason, sometimes the opponent's cards don't show up during showdown.

For example:
Screenshot 2019-12-13 at 13 18 11

Player 1 did not display Player's cards and vice versa.

The finalnfo message was:

{
  "method": "finalInfo",
  "showInfo": {
    "allHoleCardsInfo": [
      [
        "KS",
        "8C"
      ],
      [
        "JD",
        "10D"
      ]
    ],
    "boardCardInfo": [
      "5S",
      "7C",
      "JS",
      "2H",
      "7S"
    ]
  },
  "win_amount": 4,
  "winners": [
    1
  ]
}

All-in does not progress when one player has chips

In the above scenario, player1 went All-In before the flop and player2 called. Since there is only one player left with funds (as it is currently player_funds: [0, 200]), it is impossible to do any more betting, therefore the showdown has to begin Pre-Flop.

finalInfo has to be sent to the players before the flop. It is the equivalent of both players going All-In with equal stacks (eg. if it was player_funds: [0, 0]).

If there was a third player who had chips (eg. player_funds: [0, 200, 200]), then the betting round has to continue and we will have to create a side pot that the player1 cannot win. But that's only once we get pass heads-up.

Add some time after the hand finishes to show the winner

Instead of going into the next hand straight away, is there a way to add a couple of seconds after the hand finishes, for people to digest who won the hand and with what cards.

Also, if a log of each bet could be added in a text box down the bottom left corner of the display. So people can see a text log of each hand/bet played on the table.

Create a landing page

We will need a landing page that will display the available tables. Displaying the number of players on the table would be a nice to have, but it might entail some extra work on the back-end.

Tasks

Update README

The current README does not contain much information for either players or developers who'd like to contribute. I should spend some time to update it.

Do not require joining for the players when the Table is Filled

Currently the GUI expects the players to click on the player widget in order to join the table.

This is only a requirement if the game has not started yet. If it's already on and the backend returns Table is Filled, it means that the player has already joined and the GUI should be in the appropriate state.

This raises some UX questions that need to be addressed in the future.

GUI crashes when both of the first actions are all-in

Once the game started, player1 goes all-in and when player2 also goes all-in, in the GUI everytime I'm getting the error as mentioned below:

Controls.tsx:88 Uncaught Error: Something is wrong with the betamount.
    at handleButtonClick (Controls.tsx:88)
    at onClick (Controls.tsx:177)
    at HTMLUnknownElement.callCallback (react-dom.development.js:362)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:411)
    at invokeGuardedCallback (react-dom.development.js:466)
    at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:480)
    at executeDispatch (react-dom.development.js:612)
    at executeDispatchesInOrder (react-dom.development.js:637)
    at executeDispatchesAndRelease (react-dom.development.js:743)
    at executeDispatchesAndReleaseTopLevel (react-dom.development.js:752)
handleButtonClick @ Controls.tsx:88
onClick @ Controls.tsx:177
callCallback @ react-dom.development.js:362
invokeGuardedCallbackDev @ react-dom.development.js:411
invokeGuardedCallback @ react-dom.development.js:466
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:480
executeDispatch @ react-dom.development.js:612
executeDispatchesInOrder @ react-dom.development.js:637
executeDispatchesAndRelease @ react-dom.development.js:743
executeDispatchesAndReleaseTopLevel @ react-dom.development.js:752
forEachAccumulated @ react-dom.development.js:724
runEventsInBatch @ react-dom.development.js:769
runExtractedPluginEventsInBatch @ react-dom.development.js:914
handleTopLevel @ react-dom.development.js:5848
batchedEventUpdates$1 @ react-dom.development.js:24343
batchedEventUpdates @ react-dom.development.js:1463
dispatchEventForPluginEventSystem @ react-dom.development.js:5943
attemptToDispatchEvent @ react-dom.development.js:6059
dispatchEvent @ react-dom.development.js:5963
unstable_runWithPriority @ scheduler.development.js:815
runWithPriority$2 @ react-dom.development.js:12188
discreteUpdates$1 @ react-dom.development.js:24359
discreteUpdates @ react-dom.development.js:1486
dispatchDiscreteEvent @ react-dom.development.js:5926

Slider climbs out the table

Console error:
Warning: Slider[max] - Slider[min] (-96) should be a multiple of Slider[step] (196)

Actions:

  1. Player2 raised to 100
  2. Player1's turn now

The slider climbs out it's container as seen on the screenshot above. The game does not break.

Backend is not responding for All-In when `possibilities: [6]` is sent

Currently, the front-end is sending possibilities: [4] even if the player goes All-In. When I fixed this and properly sent [6] to the backend, the game stopped responding.

Scenario:

  1. SB Calls raises to 4
  2. BB Re-raises to 200 and is All-In
  3. Backend is frozen.

I am wondering how important it is to actually send possibilities: [6]. Does that make any difference in the game? All-in can happen by calling or by raising or even by posting the blinds.

Therefore maybe we should just ignore this possibility and remain using raise instead?

image

image

Seat selection is missing

The original designs have a "Sit Here" state for the player widgets to indicate which seats are available. This feature should be added for clarity.

Use WSS instead of WS

HTTPS is also more secure, and in order to go to production on the web, we would have to switch.

I would like to use netlify for continous deployment, but currently we are using ws which only work on non-secure http connections, and is not supported by Netlify.

In order to use https, we need to use wss.

Package the GUI using Electron

It would be great to get out from the browser and have a standalone app, in order for better window management when it comes to playing on multiple players.

Incorrect minRaiseTo calculation

Actions on the flop

  1. Player1 opens with a bet of 2
  2. Player 2's turn

Expected behavior

The Raise button should show Raise to 4, due tominRaiseTo being 4.

Actual behavior

The Raise button showsRaise to 6, due tominRaiseTo being 6.

Thoughts

Not sure why this is happening. Player1's first action to open with a bet of 2 is being interpreted by the backend as a raise (possibilities: [4]) -- however, technically it is called a bet, because there are no prior bets in this betting round that the player can raise compared to.

I don't think we need to create a new backend message type for the possibilities, raise should be fine, but the GUI should receive the proper number.

Add audio feedback

The game currently doesn't feature any sounds. For better UX and accessibility, we should add audio feedback to certain actions.

Some todos:

  • Integrate a sound library
  • Sample sounds
  • Add fold, call, raise, check sounds
  • Add chips movement sounds
  • Add alert sound
  • Add card deal sound
  • Add chips collection sound for each street (currently only works for the river)
    • Address the winner selection flow glitch that was caused due it
  • Do not trigger chips collection sound when there are no chips to collect
  • Add flop sound
  • Add turn and river sounds
  • Set bet sound to the same as call
  • Add alert sound to when the time is about the be up
  • Add mute option
  • Add test coverage

Add timer

The timer functionality has been disabled. We should enable it again.

Hole cards get exposed during the River, before the Show Down

If one player folds during the River (the last boardCard), the backend sends allHoleCardsInfo for both of the players. This should not happen, hole cards should only be disclosed if all of the River bets get called, which is called the Show Down.

See this video from 00:54: https://i.norbert.dev/a534bf

The bet on the River does not get called, the allHoleCardsInfo array gets filled up with the all players' cards. This should not be the behavior.

Player funds are negative

On the test nodes, one of the player's balance is -1. This should not be possible.

I thought that once a player's fund reaches zero, it will automatically recharge to 200. Also, the some of the two player's funds should always be 400. Am I wrong about it?

image

image

Slider can't go All-In

The slider maxes out just 1 chip less than it is the total balance, not allowing the player to go all-in.

Update pot form the backend

Currently, calculating the pot happens on the frontend. Recently, the pot property has been added to the betting messages, thus the pot should be calculated from the backend to avoid mistakes.

Update player balances from the backend

The player balances are currently all calculated at the front-end. Recently, the back-end began to send an array of balances, thus, we should also use this data to update the balances.

Currently, the balances get reset after each hand to 200, however, the front-end does not do this reset, which results in mismatching values.

A backend response for Table Selection is needed

@sg777#2257 there are two missing pieces for the Table Select feature to work:

1. The ability to check how many people are currently at the table before joining the table
This is important to know to which table the user can join to when she picks from the list. (https://share.getcloudapp.com/NQuv1qkg).

2. A way for the player node to know where the other players are sitting at the table
When the player joins the table, before sitting down to an available seat, we must update the GUI with all the other players currently sitting at the table. This way the player can know which seats are free and we can seat the player there.

A potential solution may be for both of the above is to have a method (eg. game) that responds from the dcv (or even from the player) with the following info:

  • number of seats available at the table
  • number of players currently at the table
  • small blind/big blind
  • game type
  • which seats are occupied and which are empty

Add Chat Box

The Chat Box might have been properly implemented in the original Pangea Poker repo. We need to look into it and determine how it will be ported to the new GUI.

Update palyer stacks when a hand ends

Currently, after a hand ends and the winner gets announced, the winner's stack does not get updated with the amount the winner won. The GUI should do the math until this has been solved via a property from the backend.

Reset player tables after each hand ends

When the method: reset is received for the players, the table should reset to it's initial state. There is an existing action called nextHand that does the reset, it just needs to be linked with the new reset method.

Add URL query strings to hold the node info

Each time we refresh the game when testing, the startup modal appears again an we have to do multiple clicks to start the game. Having query strings such as ?nodeType="dcv"?ip="192.168.0.1 in the URL would make the refresh a bit faster.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.