Pong is a classic video game created in the 70s by Atari. I recreated this game as the final project for the CS50 computer science course that I did in 2020.
The goal of this project is to create an online multiplayer version of the original Pong game.
First install NodeJS version 12 or newer, if you haven't got it already.
Then run node install inside the project folder. This will install the app and its dependencies.
Run node src/main.js to start the game server. It will be listening on port 3000 by default.
Then go to http://localhost:3000 in a web browser.
The game starts in offline mode. In this mode you can play on the same computer against another player or against the robot 🤖.
Press [M] to listen to some music. Press [H] to see what other game options there are.
If you want to play online against a friend, you need to install the software on a public server that can accept incoming connnections.
In this case you might want to turn online mode on by default. This can be configured in src/public/config.js.
Then send the url of the server to your friend and have some fun! 🏓
To help with the development of the game I used a number of freely available resources:
- JavaScript game library Phaser3 🦄
- Another beek beep beer please music by Rolemusic 🤘
- Sounds created with Bfxr 🏆
- Sounds converted to MP3 with Convertio
- Press Start 2P font by Codeman38
- Dead Space font by DC-designs 🤩
- Lava texture by Outworldz
- Server software NodeJS
- JavaScript 3rd party libraries as descripted in package.json.
- I might have used Stack Overflow once or twice 🤣
All this software is free to use and is created by many unsung heroes of the internet 🦸♀️
Game states progress by user actions like pressing <enter>, or the game logic like scoring a point.
When playing online the game waits after connecting to the server for another opponent to join the session before continuing on to the next state.
The play state finishes when a player scores a point. The game logic decides which state comes next: Serve if there is no winner yet, otherwise Done.
This project's is made public under the GNU GENERAL PUBLIC LICENSE. For more information see the project LICENSE file or visit GNU.org.
To run tests locally first start the server with npm start, and then start the tests with npm test.