Skip to content

Retro pong game webpage. The final project of the 42 common core

Notifications You must be signed in to change notification settings

magnitopic/transcendence

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Transcendence

The last project of the 42 common core.

This project is single page application that allows users to create accounts, log in, and play a game of pong against other users.

The project is divided into three main parts:

  • Web Sockets and algorithms: The game is played in real time from different clients, using web sockets to communicate the game state between the clients and the server.

  • Frontend: A vanilla JS fronted that accts as a single page application, requesting the data to the backend and updating the DOM accordingly. And using Bootstrap for the styling of the page.

  • Backend: A Django server that provides an API for the frontend to interact with using Django-Ninja and using Postgres as a database. It also manages the game state and the web sockets connections.

This project runs in Docker. Using three containers:

  • Django (API and backend) 🐍

  • Postgres (database) 🗄️

  • Nginx (frontend) 🌐

Team work 💪

This project was a team effort. You can checkout the team members here:

Run project

With Docker

cp .example.env src/docker/.env

#Enter values for the variables in the .env file
vim src/docker/.env

make

Without docker

Run the backend

cd /src/backend

docker run --name some-postgres -e POSTGRES_PASSWORD=postgres123 -e POSTGRES_USER=postgres -e POSTGRES_DB=transcendence_db -p 5432:5432 -d postgres

export POSTGRES_DB=transcendence_db POSTGRES_USER=postgres POSTGRES_PASSWORD=postgres123

python manage.py migrate

python manage.py runserver

Database schema

In the project database we store the aplication information in 5 tables:

  • user: Stores user information for their login credentials as well as user statistics from matches

  • match: Record of all matches played, indicating what users participated, their respective score and if the match was from a tournament

  • userTournament: Table that stores what users are participating in a tournament

  • tournament: Table that stores the information of the tournaments, indicating the status of the tournament, the number of participants and the date of the tournament

  • friend: Table that stores the relationships between users, indicating if they are friends or if they have a pending friend request

Untitled Diagram drawio

Languages

  • JavaScript 48.3%
  • Python 28.1%
  • CSS 20.1%
  • HTML 1.9%
  • Makefile 0.9%
  • Dockerfile 0.6%
  • Shell 0.1%