Code Monkey home page Code Monkey logo

kuninoto / 42_ft_transcendence Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 22.12 MB

A website with user accounts/profiles and relations (friendships & blocks), real-time multiplayer game and chat (DMs & rooms)!

License: GNU General Public License v3.0

JavaScript 0.54% Dockerfile 0.12% Makefile 0.18% TypeScript 98.98% CSS 0.18%
nestjs nestjs-backend nestjs-postgresql nextjs reactjs socket-io socketio swagger swagger-ui tailwind-css tailwindcss typeorm

42_ft_transcendence's People

Contributors

kuninoto avatar ramos21rodrigo avatar realmadnessworld avatar

Stargazers

 avatar  avatar

Watchers

 avatar

42_ft_transcendence's Issues

Feature: Developer Achievement

When one of us creates an account on the site an achievement relative to being one of the developers is assigned
(check by intra name upon user creation)

Request: Information relative to friendship

  • Need friendship_id on users/{id} so its possible to use /friendship/{friendship_id}/update
  • Being able to recive pending requests user on /users/search (send a request to a user won't make it disapear from the query).
  • Recive the friendship_status on /users/search

  • Merge unfriend and cancel update into one

Feature: Theme information on /me

Add:

  • object theme to /me whith background and paddle theme

theme : { background: string, paddle: string, }

  • post /me/theme that will receive the theme

Feature: engine on backend

The frontend it's just the reflection of backend's logic, this means that the paddle, ball and score aren't connected in anyway they just update when needed

Which mean:

  • Both clients emit the paddle position to the bo

  • The bo starts the ball position and speed and because it has the paddles can also do the collisions
    So for the frontend that only receives the ball position the collisions are meaningless.

  • Every time the ball passes one of the sides (point) an event from bo is emitted with the new scores.
    There is one emit on bo with the paddles and ball position (to reset), then a 2~3 seconds delay w/o emits, and the game starts again.

  • score passes the max. Bo emits a winner message with the winner and disconnects both

Bug: If 42's Auth is not approved (401 status code is returned by the intra and the backend), the user enters anyway

When I tried to run the app on my side I was not able to login properly with 42's auth and this error popped on the frontend container logs:

frontend  | 
frontend  | Import trace for requested module:
frontend  | ./node_modules/ws/lib/validation.js
frontend  | ./node_modules/ws/lib/receiver.js
frontend  | ./node_modules/ws/wrapper.mjs
frontend  | ./node_modules/engine.io-client/build/esm-debug/transports/websocket-constructor.js
frontend  | ./node_modules/engine.io-client/build/esm-debug/index.js
frontend  | ./node_modules/socket.io-client/build/esm-debug/url.js
frontend  | ./node_modules/socket.io-client/build/esm-debug/index.js
frontend  | ./contexts/GameContext.tsx
frontend  | ./app/matchmaking/finding-opponent/page.tsx
frontend  | - warn ./node_modules/ws/lib/buffer-util.js
frontend  | Module not found: Can't resolve 'bufferutil' in '/app/node_modules/ws/lib'
frontend  | 
frontend  | 
frontend  | Import trace for requested module:
frontend  | ./node_modules/ws/lib/buffer-util.js
frontend  | ./node_modules/ws/lib/receiver.js
frontend  | ./node_modules/ws/wrapper.mjs
frontend  | ./node_modules/engine.io-client/build/esm-debug/transports/websocket-constructor.js
frontend  | ./node_modules/engine.io-client/build/esm-debug/index.js
frontend  | ./node_modules/socket.io-client/build/esm-debug/url.js
frontend  | ./node_modules/socket.io-client/build/esm-debug/index.js
frontend  | ./contexts/GameContext.tsx
frontend  | ./app/matchmaking/finding-opponent/page.tsx
frontend  | 
frontend  | 
frontend  | ./node_modules/ws/lib/validation.js
frontend  | Module not found: Can't resolve 'utf-8-validate' in '/app/node_modules/ws/lib'
frontend  | 
frontend  | 
frontend  | Import trace for requested module:
frontend  | ./node_modules/ws/lib/validation.js
frontend  | ./node_modules/ws/lib/receiver.js
frontend  | ./node_modules/ws/wrapper.mjs
frontend  | ./node_modules/engine.io-client/build/esm-debug/transports/websocket-constructor.js
frontend  | ./node_modules/engine.io-client/build/esm-debug/index.js
frontend  | ./node_modules/socket.io-client/build/esm-debug/url.js
frontend  | ./node_modules/socket.io-client/build/esm-debug/index.js
frontend  | ./contexts/GameContext.tsx
frontend  | ./app/matchmaking/finding-opponent/page.tsx
frontend  | - error api/api.ts (14:29) @ localStorage
frontend  | - error ReferenceError: localStorage is not defined
frontend  |     at eval (./api/api.ts:18:36)
frontend  |     at (sc_client)/./api/api.ts (/app/.next/server/app/auth/page.js:710:1)
frontend  |     at __webpack_require__ (/app/.next/server/webpack-runtime.js:33:43)
frontend  |     at eval (./contexts/AuthContext.tsx:9:66)
frontend  |     at (sc_client)/./contexts/AuthContext.tsx (/app/.next/server/app/auth/page.js:754:1)
frontend  |     at __webpack_require__ (/app/.next/server/webpack-runtime.js:33:43)
frontend  |     at eval (./app/layout.tsx:9:79)
frontend  |     at (sc_client)/./app/layout.tsx (/app/.next/server/app/auth/page.js:743:1)
frontend  |     at __webpack_require__ (/app/.next/server/webpack-runtime.js:33:43)
frontend  |   12 |      headers: {
frontend  |   13 |              'Content-Type': 'multipart/form-data',
frontend  | > 14 |              'Authorization': `Bearer ${localStorage.getItem('pong.token')}`
frontend  |      |                                        ^
frontend  |   15 |      },
frontend  |   16 | })
frontend  |   17 | 

Also, we should check for a scenario where the browser history has the 42 authentication saved (so that allows the user to bypass the 42's login credentials) but the 42's session has expired or if the user is in AGU (he can type his credentials and trigger the 42's auth but most probably a 401 is also returned)

image

Bug: Socket user

Seems like the Socket user is always the id 1. But it might be due to me directly editing stuff on the DB. Need another account to verify that

Fix: friendships route

Everything to change darling

  • Create endpoint for friend_requests from /me to /me/friend_requests

  • Create endpoint for friends from /me to /me/friends

  • Remove friendship_* from every /friendship name (eg. friendship_name -> name)
    My code : friend.friend_name

  • Send friendship information in /users/{id} and block status

  • Automatically reject friend request when blocked

  • Remove blocked, friends, (not on pending requests) and self from /users/search

Feature: Achievements popup

Using the chat socket the backend sends events acknowledgeding that a new achievement was unlocked and the frontend shows a popup with which achievement and its description.

Bug: Declining and blocking requests

  • When blocking a request still leaves on pending.

  • When request is declined and you can't search for the declined users and if the declined try to send request again doesn't appear on friends requests.

Basically "declined" status is behaving like blocked. W/o the "not be able to search" part, "declined" can be change to "blocked", block table can disappear, and on decline just erase the relation from db.

Feature: Rooms on Matchmaking

Upon user (player) connection to game-gateway, enqueue and if there are more than 2 players waiting dequeue both and create a Room for them

OR

Upon user connection to game-gateway create and assign a room for him and later, when a new player arrives, add him to that room

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.