Welcome to Hell Pong, a fast-paced multiplayer ping-pong game built with Lerna, TypeScript, Phaser 3, Matter.js, and Socket.io
- Demo
- Features
- Getting Started
- Prerequisites
- Acknowledgments
- Installation
- Running the Game
- Deployment
- Contributing
You can try to play the game on this link
- Real-time multiplayer gameplay
- Smooth and responsive controls
- Physics-based ball and paddle movements using Matter.js
- Customizable game settings
- Interactive lobby system
- Cross-platform compatibility
These instructions will guide you through setting up the project on your local machine for development and testing purposes.
Before starting, make sure you have the following software installed on your system:
- Node.js (v14.x or later)
- Yarn (v1.x or later)
- Git (Optional, if you want to clone the repository)
- Lerna (v6.5.1 or later)
- Phaser 3 - A powerful game framework used for building the game
- Matter.js - A 2D physics engine for the web used in the game
- Socket.IO - A real-time bidirectional event-based communication library
- Lerna - A tool for managing JavaScript projects with multiple packages
- TypeScript - A typed superset of JavaScript that adds optional static types
- Clone the repository or download the project files:
git clone git@github.com:Dsazz/hell-pong-game.git
- Navigate to the project folder:
cd hell-pong-game
- Install the required dependencies and bootstrap the Lerna packages:
yarn && yarn lerna bootstrap
To start the development server for both client and server, run:
yarn start
Important for Apple M-series: arch -arm64 brew install pkg-config cairo pango libpng jpeg giflib librsvg
This will start the client and server concurrently, accessible at http://localhost:8000. Open the URL in your browser to start playing the game.
You can also run the client and server separately with the following commands:
yarn start:client
yarn start:server
To deploy the game on a production server, follow these steps:
- Build the production bundle:
yarn build
This will create optimized production builds for both the client and server packages.
-
Set up a web server of your choice (e.g., Nginx, Apache, or Node.js) to serve the client files from the
packages/client/dist
directory. -
Configure the server to serve the game over HTTPS, as the game uses WebSockets for real-time communication, and most modern browsers require a secure connection for WebSockets.
-
Set up a process manager like PM2 to run the server package. Navigate to the
packages/server
directory and run the following command:
pm2 start dist/index.js --name hell-pong-server
This will start the server using PM2 and keep it running in the background.
-
Update the client configuration to point to the production server's WebSocket URL. This can be found in the packages/client/src/config.ts file. Change the serverUrl to match your server's domain or IP address.
-
Restart the client and server processes to apply the changes.
Now your game should be live and accessible on your production server!
We welcome contributions from the community! If you'd like to contribute to Hell Pong, please follow these steps:
- Fork the repository
- Create a new branch with a descriptive name (e.g.,
feature/new-game-mode
) - Commit your changes to the new branch
- Open a pull request against the
main
branch, describing your changes and any relevant context
For more detailed information on contributing, please read the CONTRIBUTING.md file.