A air hockey game with multiplayer ability
Demo.mp4
- Host the game server on Python(Source) or on the Python(Executable) or on an ESP32 microcontroller
- To play this game, open the html using your browser or host it using vscode Live Server. Reasons for not hosting the webpage is stated here
- Learn how to play the game here
- Learn about the features here
- Type
git clone https://github.com/YeetTheAnson/MultiplayerAirHockey
into CMD - Double click and open PythonServer.exe
- Copy the IP address and Port and move on to the next step
- Type
git clone https://github.com/YeetTheAnson/MultiplayerAirHockey
into CMD - Ensure you have all the libraries, run
pip install asyncio websockets json random string socket
- Open CMD and navigate to MultiplayerAirHockey/PythonServer
- Run the server by using the command
PythonServer.py
- Copy the IP address and Port and move on to the next step
- Type
git clone https://github.com/YeetTheAnson/MultiplayerAirHockey
into CMD - Navigate to
ESP32Server
and open the.ino
file in Arduino IDE. - Set the configuration by changing the SSID and password in the code.
- Add ESP32 to the board manager:
- Go to
File
>>Preferences
>>Additional Boards Manager URLs
- Paste the following URL:
https://espressif.github.io/arduino-esp32/package_esp32_index.json
- Go to
- Select the board
ESP32S2 DEV MODULE
. - Flash the code to the ESP32S2.
- Copy the IP address and Port and move on to the next step
Most browsers and webpage hosting like github pages try to automatically upgrade the http connection to https, and will make the ws:// connection method invalid. The reason why I didn't implement wss:// was because it would be too complex as it involves SSL certificates and keys which the user have to generate
- Copy the IP and port from the Python terminal or on the ESP32 serial monitor
- Paste the IP and port in the designated boxes in the website and press
Connect to server
- Join a room by hosting a room, or by typing in the room code an joining the room
- Only the host can start the game, and the start button will turn green when 2 players are in the room
- Only the host are allowed to kick users
- Depending on the client, players are only allowed to move the paddles on one side