This project is a backend service for a multiplayer Uno card game built in Go using WebSockets. It enables real-time gameplay and efficient management of concurrent sessions, making it easy for friends to connect and play together—no matter where they are.
The main motivation behind this project is twofold:
- Learning and exploration: Explore the power of WebSockets, concurrent programming, and the Go language through a hands-on project.
- Play and Connect: Create a fun and engaging game that brings friends together, even when they’re miles apart.
This guide provides step-by-step instructions to set up and run the Uno game.
This is a backend service for a UNO card game multiplayer written in Go and based on WebSockets.
Install Task
brew install go-task
pip install go-task-bin
npm install -g @go-task/cli
dnf install go-task
- Clone the repository:
git clone https://github.com/mahimdashora/UNO-game.git
cd UNO-game
- Install dependencies:
go mod tidy
- Build and run the server:
task build:binary
task run:server
- Clone the repository:
git clone https://github.com/UNO-Card-Game/uno.git
cd UNO-game
- Build the Docker image:
build:image
- Run the Docker container:
docker run -p 8080:8080 uno-server:latest
task build:server
task run:server
PORT
: Set this environment variable to run the server on a specific port. Default is 8080
.
Example:
export PORT=8080
task run:server
Replace 8080
with your specific port number if needed.
- Open Postman and create a new WebSocket request.
- Enter the WebSocket URL:
ws://localhost:8080/ws
- To create a Game Room lobby, use the following URL:
ws://localhost:8080/create?player_name=[NAME]&max_players=[MAX_PLAYER_COUNT]
Example:
ws://localhost:8080/create?player_name=Alice&max_players=2
- To join a Game Room lobby, use the following URL:
ws://localhost:8080/join?player_name=Bob&room_id=1234
ws://localhost:8080/join?player_name=Bob&room_id=1234