This is a simple 8 Ball Pool game built using Go for the backend and React with Konva for the frontend. The game supports multiplayer mode on the same machine and features a realistic cue stick and ball physics.
- Realistic ball and cue stick physics
- Multiplayer support on the same machine
- Real-time updates using WebSocket
- Responsive design using Tailwind CSS
- Go (1.16 or higher)
- Node.js (14.x or higher)
- Navigate to the backend directory:
cd backend
- Install Go modules:
go mod tidy
- Run the backend server:
go run main.go
The backend server should now be running on http://localhost:8080
.
main.go
: The main entry point for the Go server, handling WebSocket connections and game state updates.engine/
: Contains the game logic and physics calculations.
- Navigate to the frontend directory:
cd frontend
- Install npm dependencies:
npm install
- Run the frontend development server:
npm run dev
The frontend application should now be running on http://localhost:3000
.
src/App.tsx
: Main React component.src/Game.tsx
: React component that handles the game interface using Konva for rendering the game objects.
- Use the mouse to aim the cue stick.
- Click and drag to set the power and release to shoot.
- Players take turns to pot their respective balls.
- Pot the black ball to win, but only after potting all your other balls.
This project is licensed under the MIT License.