Telepong is an online game that recreates the game Pong, famous for being the first videogame in history. The game allows users to register with a username and email, and to create a room to play with friends.
The game has its own communication protocol and a more modern interface made with Python.
-
Make sure you have
C,PythonandMakefilerelated tools and libraries installed in your system -
At a terminal, create a folder and run a
git cloneinside of it with the project's Github URL. Then, Navigate to the project directory withcd TelePong -
Navigate to the server folder with
cd Serverand create a folderobj. Then, run the Make cript withMake -
Execute the compiled code. Navigate to bin folder with
cd binand run the command./PongServer 8080 ../logs/logfile.txt. 8080 is the desired port to be used and ../logs/logfile.txt the path for the logfile -
Navigate to the client folder.
cd ../..and thencd client -
Recommended: run the Python code in a virtual enviroment. To create the virtual enviroment, use the command
python -m venv venvand active it withsource venv/bin/activate -
Install the needed dependencies with
pip install pygameandpip install pygame_gui -
Execute the python code with
python game.py
We had to decide whether to use the TCP or UDP protocol as the foundation for our project. At the end, we opted to use TCP, due that with the UDP protocol, despite the advantage of being faster, is not convinient since it could trigger lost packages and desynchronization between the players. With TCP we garantee that every package is delivered correctly and in the right order
- assets folder: recourses needed for the game, such as images and font
- constants: values that remain static throughout the program, such as the used IP and Port
- tpp (TelePong Protocol): class with the functions that define the comunication between client and server
- game: everything related with the game
- bin folder: contains the executable of the server
- include folder: defines the header files, which contains the declaration of functions that may be used in other parts of the code
- logs folder: in this folder the logs.txt file is generated
- obj folder: contains the .o files, generated during the compilation of the code
- src folder: contains the main C code
- The choice of using TCP led to some delay issues
- The project could have better code practices and optimization, like the use of an interface between game.py and tpp.py to decouple the code and stop the direct dependency. In addition, that way every game would use the same instance of the tpp class, unlike how we have it at the moment where every game has a tpp instance.
- Design choices and careful consideration of the problem before coding are crucial. We were able to develop the project the way we did because we first readed about both protocols and their advantages and disadvatages, we thought how to develop the solution, how to structure a project in C and created the diagrams. Without these preparations, the project development would have been significantly more challenging.
This project could not have been possible without some resources that we found in the internet
- General structure of the game: https://www.geeksforgeeks.org/create-a-pong-game-in-python-pygame/
- Screen menu system: https://github.com/baraltech/Menu-System-PyGame
- Text input: https://github.com/baraltech/Text-Input-PyGame


