A real-time multiplayer Tic Tac Toe game that runs on your local network. Built with Node.js, Express, and Socket.IO for seamless real-time gameplay.
- Real-time multiplayer gameplay - Play with friends on the same network
- Modern, responsive UI - Beautiful design that works on desktop and mobile
- Live game synchronization - All moves are synchronized in real-time
- Game room system - Create or join games with unique IDs
- Player status indicators - See when it's your turn and opponent status
- Game reset functionality - Start a new game after finishing
- Network accessibility - Accessible from any device on your local network
- Node.js (version 14 or higher)
- npm (comes with Node.js)
-
Clone or download this project
-
Install dependencies
npm install
-
Start the server
npm start
-
Access the game
- Open your browser and go to:
http://localhost:3000 - For network access, use your computer's IP address:
http://YOUR_IP:3000
- Open your browser and go to:
To play with friends on the same network:
-
Find your computer's IP address
- On macOS/Linux: Open terminal and type
ifconfigorip addr - On Windows: Open command prompt and type
ipconfig - Look for your local IP (usually starts with
192.168.or10.0.)
- On macOS/Linux: Open terminal and type
-
Share the network URL
- Tell your friends to visit:
http://YOUR_IP:3000 - Example:
http://192.168.1.100:3000
- Tell your friends to visit:
-
Start playing!
- One player creates a new game
- Share the Game ID with your friend
- Both players join the same game
- Game starts automatically when both players are connected
- Click "Create New Game" button
- A unique 6-character Game ID will be generated
- Share this Game ID with your friend
- Enter the Game ID provided by your friend
- Click "Join Game" button
- Wait for both players to connect
- Player X goes first
- Click on any empty cell to make your move
- Take turns until someone wins or the game ends in a tie
- Use "New Game" button to start over
MultiUser-TicTac/
├── server.js # Main server file with Socket.IO logic
├── package.json # Dependencies and scripts
├── public/ # Frontend files
│ ├── index.html # Main HTML file
│ ├── style.css # Styling
│ └── script.js # Frontend JavaScript
└── README.md # This file
npm start- Start the production servernpm run dev- Start the development server with auto-reload
You can easily customize the game by modifying:
- Port: Change the port in
server.js(line 180) - Styling: Modify
public/style.cssfor different themes - Game logic: Update the game rules in
server.js - UI: Edit
public/index.htmlfor layout changes
-
Can't connect to the game
- Make sure the server is running (
npm start) - Check if the port 3000 is available
- Try a different port if needed
- Make sure the server is running (
-
Network access not working
- Check your firewall settings
- Ensure both devices are on the same network
- Try using the computer's IP address instead of localhost
-
Game not starting
- Make sure both players have joined the same game
- Check the browser console for error messages
- Refresh the page if needed
If port 3000 is already in use, you can change it:
-
Edit
server.jsand change line 180:const PORT = process.env.PORT || 3001;
-
Restart the server and use the new port in your browser
The game is fully responsive and works great on mobile devices:
- Touch-friendly interface
- Responsive design that adapts to screen size
- Works on all modern browsers
- Uses Socket.IO for instant message passing
- No page refreshes needed
- Smooth gameplay experience
- Server maintains game state
- Prevents cheating and invalid moves
- Handles player disconnections gracefully
- Clear visual feedback for all actions
- Status messages for game events
- Intuitive lobby and game interface
Feel free to contribute to this project by:
- Reporting bugs
- Suggesting new features
- Submitting pull requests
- Improving documentation
