RoomRumble is a real-time, multiplayer stone-paper-scissors game built with Next.js. Players can create rooms, join existing rooms using a room number and passcode, and play against each other. Each room can host up to 10 players.
- Features
- Installation
- Usage
- Project Structure
- API Endpoints
- Future Enhancements
- Contributing
- License
- Room Creation: Users can create rooms with a passcode.
- Room Joining: Players can join existing rooms using a room number and passcode.
- Real-Time Gameplay: Basic stone-paper-scissors game logic.
- Room Capacity: Each room can hold up to 10 players.
To run RoomRumble locally, follow these steps:
-
Clone the repository:
git clone https://github.com/your-username/roomrumble.git cd roomrumble
2. Install dependencies:
```bash
npm install
```
3. Run the development server:
```bash
npm run dev
```
4. Open your browser and go to `http://localhost:3000` to start playing.
## Usage
### Creating a Room
1. Navigate to the home page.
2. Enter a passcode to create a new room.
3. A unique room ID will be generated, which you can share with others.
### Joining a Room
1. Enter the room ID and passcode shared by the room creator.
2. Provide your name and join the game.
3. Start playing stone-paper-scissors with other players in the room.
## Project Structure
```plaintext
/
├── components/
│ ├── CreateRoom.js # Component for creating rooms
│ ├── JoinRoom.js # Component for joining rooms
│ ├── Game.js # Main game component
├── pages/
│ ├── api/
│ │ ├── create-room.js # API route for room creation
│ │ ├── join-room.js # API route for joining a room
│ ├── index.js # Main entry point
├── lib/
│ ├── rooms.js # Shared rooms object (if applicable)
└── README.md # Project documentation
```
## API Endpoints
### `POST /api/create-room`
- **Description:** Creates a new room with a unique ID and passcode.
- **Request Body:**
- `passcode`: The passcode for the room.
- **Response:**
- `roomId`: The unique ID of the created room.
### `POST /api/join-room`
- **Description:** Joins a room with the given room ID and passcode.
- **Request Body:**
- `roomId`: The ID of the room to join.
- `passcode`: The passcode for the room.
- `playerName`: The name of the player joining.
- **Response:**
- `success`: Indicates whether the player successfully joined the room.
## Future Enhancements
- **Real-Time Communication:** Integrate Socket.IO for real-time game updates and communication between players.
- **Persistent Storage:** Implement database support for storing rooms, players, and game results.
- **Enhanced UI:** Improve the user interface and user experience with better styling and animations.
- **Player Profiles:** Add player profiles and leaderboards.
## Contributing
Contributions are welcome! Please fork the repository and create a pull request with your changes. Make sure to follow the coding standards and write tests for new features.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
```
You can customize the `README.md` further based on specific details or requirements for the RoomRumble project.
```