Skip to content

meticulo3366/infinite_hangman

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published