Giter Club home page Giter Club logo

open-hearts's People

Contributors

cynical89 avatar jdickey avatar snollygolly avatar whoatedacake avatar zlshames avatar

Stargazers

 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  avatar  avatar

open-hearts's Issues

Add websocket support for server

The server needs to listen for connections and then store users that are connected in Redis.

  • Accepts new connections
  • Sends the game object to the client
  • Accepts moves from the client

Speed up Travis build process

To speed up our Travis CI build time, I'd like to migrate away from using NPM for front end modules, and instead have bower manage them.

Add websocket support to client

After the user inputs the number of players and creates the game on /, we give them a game link

Formatted like: /game/:id

When that URL is accessed, on the backend, we make sure that a game with that ID exists. If it doesn't, we redirect to an error page and no action is needed from the client.

If the game is valid, we render the /game view, and client side logic starts.

  • The client establishes a websocket connection with the server
  • The client sends the game ID and the player's name to the "join" event on the server (JSON encoded)

In addition to the kickoff events, some listeners need to be set

  • The client must listen for join events to see when players (including themselves) have joined the game
  • The client must listen for broadcast events that update the user on opponent moves
  • The client must listen for emit events (private) that update them with the result of their moves (legal or not)

Implement phases of play

Phases of play:

  • Waiting
    This is the phase where we have created the game, but we are waiting on enough players to start.
  • Passing
    This is the phaser where we have shuffled and dealt the cards, all players are now passing X cards. Recipient of the cards is determined by round. This phase is optional (especially for non-passing rounds).
  • Playing
    Once all cards have been passed, the game mode goes into playing. Players take turns playing according to game rules.
  • Round Over
    Once all cards are gone, count the score for everyone's tricks, add that score to each player's score. Wait for everyone to select ready before proceeding?
  • Ended
    A win condition has been met for a player and the game is over.

Change package references to non-global form

In the package.json, the build and watch scripts have global commands attached to them. They need to be changed to the local versions so they work without global installs.

(Look at how we call tests to an example of this)

Create dummy client

As we're developing the socket.io parts, we need a way to test specific actions in the game without using the socket.io tester (which sucks) or waiting on the front end logic (which may take a while, or be optimized for playing the game vs. testing it).

We need to create a page with some simple client side JS that will perform common game actions and show us responses/results.

The goal with the dummy client is information gathering, and making testing quick.

  • Needs to connect to the web socket instance
  • Needs to send a join event with a name and game id (should be input by the user)
  • Needs to be able to perform a fetch and get the current game state (not needed yet)

Add DB support

Add a NoSQL database and tie it into the CONTROLLER. Avoid having the models call the DB directly if we don't have to.

Require linting to pass travis tests

We need to run ESlint on the code in addition to npm test to ensure that proper styling is followed.

./node_modules/.bin/mocha ./tests/ && ./node_modules/.bin/eslint .

Add action logic

Actions encompass all the actions a player can perform. Note: examples don't include non-action related fields, such as token

  • Passing cards (which cards) - pass type

Client -> Server

{
  "type": "pass",
  "cards": [
    "2H", "3H", "QS"
  ],
  "to": "PLAYER ID RECEIVING CARDS"
}
  • Playing a card (which card) - play type

Client -> Server

{
  "type": "play",
  "card": "5C"
}

We need to listen for the following.

  • Being passed cards (which cards and from who) - pass type

Server -> Client

{
  "type": "pass",
  "cards": [
    "2H", "3H", "QS"
  ],
  "from": "PLAYER ID SENDING CARDS"
}
  • Seeing a card be played (which card and who) - play type

Server -> Client

{
  "from": "PLAYER ID WHO LAID THIS CARD DOWN",
  "type": "play",
  "card": "5C"
}
  • Someone takes a trick (which cards) - trick type

Server -> Client

{
  "type": "trick",
  "cards": [
    "2H", "3H", "QS", "5H"
  ],
  "to": "PLAYER TAKING CARDS"
}

All action events happen with the emitter/broadcast action

Update outdated dependencies, including `npm install` deprecation warnings

As of 14 Feb 2017, running npm install on a fresh clone of this repo gives three deprecation warnings:

npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: to-iso-string has been deprecated, use @segment/to-iso-string instead.
npm WARN deprecated [email protected]: Jade has been renamed to pug, please install the latest version of pug instead of jade

There are other outdated dependencies (npm outdated lists browserify 13.3.0/14.0.0, radium 0.17.2/0.18.1, and shipit-cli 1.5.2/2.0.0); my expectation/hope is that a relative newbie to Node and to this project should find updating those and ensuring that none of the existing tests break ought to be a fairly gentle, low-risk ramping-up exercise.

minimatch

The minimatch package is used by several direct and indirect dependencies; nearly all match against the current version (presently 3.0.3). [email protected] is, however, a dependency of [email protected] (current version: 7.1.1), itself a dependency of [email protected]. An optimist might conjecture that updating koa-hbs to the current 0.9.0 should fix that, considering that that package's current package.json specifies a version of glob matching "^7.0.5".

to-iso-string

The (original, deprecated) to-iso-string is listed as a dependency in the package.json for Mocha 2.5.3; it is not so listed in the current Mocha 3.2.0 package.json. That's apparently because a newer version of @segment/to-iso-string has been copied into the lib directory since version 3.0.0-2; technically, since Commit mochajs/mocha@37fa564. That suggests to our optimist that updating our dev dependency on Mocha from "^2.5.3" to "^3.2.0" should solve the issue, providing no other changes to Mocha break the current tests.

jade/pug

According to the README for pug, jade was renamed to avoid colliding with a registered trademark. Inspection of the README history suggests that this dates from around March, 2016. Again, updating Mocha should remove the deprecation warning, since Mocha replaced jade with pug effective with Commit f50ad28, which was rolled into release 3.0.0-0 (Beta).

Add confirmation message and failure message to index page

When creating a new game, the user should see a confirmation message with a link to the game if creation was successful (going to /game?id=ID).

If when creating a new game there was an error (the result object passed back from the server has an error property set to true), display and error explaining what went wrong (result.message should have error descriptions in it)

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.