A real-time multiplayer implementation of the classic Simon Says memory game built with ColdFusion WebSockets. Two players compete head-to-head in this beautifully designed web-based version where timing, memory, and quick reflexes determine the winner.
Simon Says is a memory game where players must repeat increasingly complex sequences of colored button presses. In this multiplayer version:
- 2 Player Maximum: Each game channel supports exactly 2 active players
- Turn-Based Gameplay: Players alternate turns, with each turn adding a new color to the sequence
- Real-Time Synchronization: All game state is synchronized in real-time using WebSockets
- Score Tracking: Win/loss records are maintained throughout the session
- Audio Feedback: Each color button has its own distinctive sound
Prerequisites: CommandBox and modern web browser
- Clone this repository
- Install dependencies:
box install
- Start server:
box server start
- Play at
http://localhost:{port}/
- Navigate to the home page and click "Play a Game"
- Enter your username and create/join a game channel
- Wait for a second player to join the same channel
- Game starts automatically when both players are connected
- Watch the Sequence: The game begins with a random colored button lighting up
- Repeat the Pattern: Click the buttons in the exact same order
- Add Your Move: After successfully repeating the sequence, add one new color
- Pass the Turn: Your opponent must now repeat your extended sequence
- Continue Growing: The sequence gets longer with each successful turn
- Make No Mistakes: First player to make an error loses the round
- Colored Buttons: Click to select colors (Green, Red, Yellow, Blue)
- Restart Button: Appears for the winner to start a new round
- Channel Management: Each game session is isolated to its subchannel
// Channel Configuration (Application.cfc)
this.wschannels = [
{ name:"game", cfclistener:"GameListener" }
];| Component | Purpose |
|---|---|
Application.cfc |
WebSocket channel configuration and app lifecycle |
GameListener.cfc |
Server-side WebSocket message handling and game logic |
index.cfm |
Landing page with navigation |
play.cfm |
Main game interface |
subscriptions.cfm |
Active game monitoring for admins |
assets/js/game.js |
Client-side game logic and UI management |
assets/css/ui.css |
Game styling and responsive design |
- Channel-Based Isolation: Each game uses a unique channel (
game.{channel-name}) - Real-Time Synchronization: All player actions broadcast to channel subscribers
- Automatic Cleanup: Handles player disconnection gracefully
- Spectator Support: Console can monitor games without participating
Access http://localhost:{port}/subscriptions/ to view:
- Active game channels
- Connected players per channel
- Real-time subscription data
The included console application allows:
- Game Monitoring: Watch live games without participating
- Debug Information: View WebSocket message traffic
- Channel Inspection: Monitor multiple channels simultaneously
To monitor a specific game:
- Open the console at
/console/ - Subscribe to channel:
game.{channel-name} - Leave username blank for spectator mode
This project was inspired by a presentation I saw ages ago at cf.objective by Mark Mandel. If I remember correctly, the original concept included physical controls alongside a web interface, demonstrating the power of real-time web technologies. After seeing this, I thought, what a great idea to try and mimic using WebSockets in ColdFusion.
Ready to test your memory? Challenge a friend and see who has the better recall in this fast-paced game of Simon Says! 🧠⚡