GithubHelp home page GithubHelp logo

suamorales / infinite_hangman Goto Github PK

View Code? Open in Web Editor NEW

This project forked from meticulo3366/infinite_hangman

0.0 1.0 0.0 9.23 MB

a socket based game of hangman designed to scale one a single computer with 1,000,001 Connected users

License: Apache License 2.0

ApacheConf 33.69% HTML 11.80% CSS 1.97% JavaScript 48.54% Shell 1.60% Nginx 2.41%

infinite_hangman's Introduction

INFINITY HANGMAN

Uses NGINX, Redis, and PM2 to horizontally scale to handle a theoretically million simultaneous user game of hangman. Game only tested up to 60,000 simultaneous playing users. Mocha on the testing farm keeps running out of memory, server however does not have memory issues and should be able to scale fantastic.

###Why Socket is way way fast than Restful HTTP

#Game Rules

  • 10 trys for each game
  • Users Can't submit same characte twice
  • submit characters to game by using the /submit command

#HOW TO USE SERVER THE EASYWAY

  • turn on server
    • npm install
    • SIMPLE=true node app.js
  • make sure to find your ip address, localhost will not work, run this command in terminal to find your ip address
    • ifconfig en1 | grep 'inet ' | cut -d ' ' -f 2
  • navigate to your ip address and port 3000 in browser
    • http://192.168.0.17:3000
  • view game statistics via API GET REQUEST at /api/gameStats
    • http://192.168.0.17:3000/api/gameStats
  • run the tests using mocha
    • mocha

#Environment Variables

  • DISABLE_BROADCAST=0 disables slow broadcast messaging
  • SIMPLE disables reddis for message queue and socket management
  • HOST SOCKET_HOST sets the server IP addres, useful for testing
  • PORT SOCKET_PORT sets the server PORT address, useful for testing
  • REDIS_HOST REDIS_PORT sets the redis HOST and PORT

READ MAC INSTRUCTIONS README.md to get started on deploying the server farm and private cloud or local dev

Game Logic

Architecture

  • username is uniquely fingerprinted from the start
  • DevOps Architecture for frontend + backend + clients as implemented (not using cloud foundary)

###Redis Diagram alt

###Client Networking Diagram alt text

Millions of User Scaling...

  • usernames and IDs limited to 7 characters
  • /commands limited to 7 characters
  • user can only send 1 character at a time during the voting session
  • Heavy Inspiration
  • The ideal architecture is in the following diagram
  • Final Diagram

Screens

alt text

Game Screenshoot

alt text

Game Statistics Example

alt text

Server Farm Benchmarking Video

ScreenShot

Future Plans

Look Into Using Hapi.js and Redis Messaging Queue

infinite_hangman's People

Contributors

krimple avatar meticulo3366 avatar

Watchers

 avatar

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.