Skip to content
odoland edited this page Nov 16, 2018 · 1 revision

Welcome to the CardsAgainstHumanity wiki!

OUTLINE

  • Node: our working environment (javascript)

  • NPM: Node Package Manager - helps us install the dependencies, other modules or frameworks

  • Express and HTTP: These are used to create our server

  • MongoDB: A NoSQL database where we will hold JSONs of our registered users

  • Socket.IO: Our real-time two-directional (client and server) event-based communication

  • Heroku: How we will deploy our server

How it Works

This is a single web-page application built with Node.js, Express, MongoDB and SocketIO. Each section has a div / section which is changed in the css to display (or hide)

Login & Registration

Login and Registration is done by connecting to a MongoDB NoSQL database hosted at mlabs.

Lobby is refreshed to print out all the online players in the lobby. Upon connection, players are added onto . Each socket.id becomes the key, and their username is a value.

var totalOnlinePlayers = {}; // {socket.id:username}

Lobby

The Lobby chatroom sends the client's message to the server. The server receives it through:

socket.on('updateChatbox', (message, sender) => updateChatbox(socket, message, sender));

which will broadcast the message to all other clients to update the HTML (client side) to display the chat message.

Custom Cards Page & Cards

Card values and text are stored in .txt files on the server, under the Classes/ directory.

Classes/promptcards.txt
Classes/playercards.txt
Classes/array.txt

They hold the player's custom cards and the default and player cards.

Game Logic

Client clicks any card -> sends the index to the server, which stores the card values of the card.

Clone this wiki locally