Giter VIP home page Giter VIP logo

social-system's People

Contributors

gonnagle avatar tam95 avatar

Watchers

 avatar  avatar

Forkers

tam95

social-system's Issues

Improve socket/client handling (server to deal/update hands directly without clients polling em)

Refactor the socket.io communication so that the client doesn't initiate the player specific updates (especially updating the hand).

Problem:

Currently there are cases where the socket.io isn't efficiently used and especially the flow with hands is far from optimal:

  1. One of the players makes an action that changes the game state (plays cards for example)
  2. Server sends the updated game state to all players
  3. All players request their updated hands from the server on by one
  4. Server returns everyone their hands individually (direct response to the specific client/socket action)

Proposed solution:

Implement tracking of players sockets (already tracking the "logged in" players and their cookie tokens so client id could be added to there. Then the flow go be simplified to be:

  1. One of the players makes an action that changes the game state (plays cards for example)
  2. Server sends the updated game state to all players
  3. Server sends update to those players hands that have changed (if any)

Deploy the App

Deploy to somewhere. For example Heroku?

Will add separate issue about creating CI/CD pipeline as well.

Unit tests

Pick up a suitable test framework and write some unit tests for the classes to cover at least the most important cases.

Persist users and ranks

First version could be even just a simple text file or something else super lightweight to hold the info

Taxation before first round

Before first round there should be taxation with the following flow:

  1. Multiple actions that can take place simultaniously:
    • Last player (lowest rank -> last in round) picks two (2) smallest cards (can be auto-picked as only one valid answer, but the player should still first see what they are giving out) to give out for the first player
    • Second last player picks their single (1) smallest card to give out for the second player
    • First player (highest rank -> first in round) picks any two (2) cards to give out for the last player
    • Second player picks any single (1) card to give out for the last player
  2. Once all of those four players have committed their picks those will be delivered to to the target players and game is ready to start

Technical design:

  • Add state taxation for the game
  • Before game can start wait for players to pick the cards to hand out
  • Each player should be able to send their pick separately to the server
  • Once everyone has sent their cards the server will deal out the changed cards (update hands for those players) and change to the started state

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.