Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A node.js multiplayer tic-tac-toe tutorial game
JavaScript
Branch: master

README.md

tic-tac-toe

Welcome to a Tic-Tac-Toe tutorial implementation that showcases the usage of Express, SocketIO and MongoDB to write a multiplayer game. The architecture of the game uses the SocketIO channel to call remote functions and is completely message driven.

Client side

The client side part of the application is made up of the following components

File Description
api.js contains all the remote functions and handles the calling of them over SocketIO
app.js contains the application logic itself and mapping of event handlers to HTML elements
template_handler.js contains the template rendering loading and rendering functionality
templates/main.ms the mustache template used for the initial registration / login view
templates/board.ms the mustache template used for the board
templates/dashboard.ms the mustache template used for the dashboard
templates/decline_game.ms the mustache template used for message of declining a game

Server side

The server side logic is made up of the following components

File Description
controllers/main_controller.js contains the rendering code for the initial / view
handlers/chat_handler.js contains the socketIO event handlers for chat events
handlers/gamer_handler.js contains the socketIO event handlers for the actual game
handlers/login_handler.js contains the socketIO event handlers for the login and registration
handlers/shared.js contains helper methods used when emitting messages back to the client
models/game.js contains all the methods associated with a Game
models/gamer.js contains all the methods associated with a Gamer
models/user.js contains all the methods associated with a User
views/index.html contains the initial view when the user hits /
app.js the actual starting point for the server
env.js all the configuration for setting up express, SocketIO and MongoDB
Something went wrong with that request. Please try again.