Skip to content

Oppo Games is a social mini-games site, built with the MERN stack, Tailwind and Socket.io. Personal Extension of OppoGames-Group6

License

Notifications You must be signed in to change notification settings

clairep94/oppo-games

Repository files navigation

OppoGames | Play Live Mini-Games with Friends

Screenshot 2024-01-12 at 02 33 41

OppoGames is a fullstack social-gaming site, showcasing use of the MERN stack, Socket.io and Tailwind CSS.

Users can sign up, log in, and play a number of mini-games 1v1 with other users. Users can see their opponents moves and message in real-time.

This is my personal extension of the Oppo Games - Group 6 final project at Makers Academy.

  • Please see Feature Updates below for ongoing feature implementation updates.

Table of Contents


Demo

OppoGamesDemo-2xspeed-720medqual.mp4
Features
* Users can view a description of each of our games
* Users can register and see errors if they do not have a unique email and username, or if their password does not have a set length and char set
* Users can see a game lobby, filter by game type or open status or ownership
* Users can create a game
* Users can see errors if they try to play without an opponent
* Users can join games, play and message opponents in realtime
* Users can see errors if they try to play out-of-turn or play out-of-bounds moves
* Users can go back to past games to see the last game-state and message history

Feature Updates

Click Me

Feb 4, 2024:
Screenshot 2024-02-04 at 18 21 14 Screenshot 2024-02-04 at 18 20 53

  • spec/utils/TestHelpers.js: Supportive functions for shorthand Jest testing. Eg. expectNewToken, expectAuthError, expectError(code, message)
  • ✅ Battleships Backend with TTD
    • ✅ Adds TTD'd: Create, Index, FindByID, Join, Delete, Forfeit, SubmitShipPlacement & LaunchMissile
      • ✅ Error handling: Out-of-Turn, Awaiting-Opponent, Game-Already-Over, You-Are-Not-In-This-Game, Cannot-Delete-Ongoing-Game, Cannot-Join-Full-Game, Opponent-Not-Ready, Space-Already-Hit
    • ✅ Adds: Concealment supportive function
      • ✅ Opponents and game-observers get a concealed view that only shows HITs and MISSes on the game board & the full sank status of ships.
      • ✅ Opponents and game-observers DO NOT see remaining ship unit locations, remaining ship unit count or initial ship placements.
      • ✅ Concealment occurs in the backend to prevent cheating through inspecting the browser.

Jan 28, 2024:

  • ✅ Frontend Test E2E coverage with Cypress
    • ✅ Landing Page
    • ✅ Signup Popup & Signup Page, Login Popup & Login Page
    • ✅ Game Intro Pages: TTT, Battleships, RPS

Jan 21 2024:

  • ✅ Backend Test coverage with Jest

    • ✅ Added 10 test suites and 185 tests for Users, Messages, Authentication & Tictactoe
    • ✅ Tictactoe covers: Create, Index, FindbyID, Join, Delete, Forfeit & PlacePiece
      • ✅ Error handling: Out-of-Turn, Awaiting-Opponent, Game-Already-Over, You-Are-Not-In-This-Game, Already-A-Piece-There, Cannot-Delete-Ongoing-Game, Cannot-Join-Full-Game
      • ✅ TicTacToe game playthrough for 4 scenarios: X-Win, O-Win, Draw, Forfeit, 9th-Turn-Win

Screenshots

Screenshot 2024-01-12 at 05 27 24 Screenshot 2024-01-12 at 05 27 34

Screenshot 2024-01-12 at 02 33 27 Screenshot 2024-01-12 at 02 39 48 Screenshot 2024-01-12 at 02 41 23


Installation:

Node.js

  1. Install Node Version Manager (nvm)
    brew install nvm
    
    Then follow the instructions to update your ~/.bash_profile.
  2. Open a new terminal
  3. Install the latest version of Node.js, currently 18.1.0.
    nvm install 18
    

MongoDB

  1. Install MongoDB
    brew tap mongodb/brew
    brew install mongodb-community@5.0
    
    Note: If you see a message that says If you need to have mongodb-community@5.0 first in your PATH, run:, follow the instruction. Restart your terminal after this.
  2. Start MongoDB
    brew services start mongodb-community@5.0
    

Packages:

  1. npm install in the three main folders:

    ; cd api
    ; npm install
    ; cd ../frontend
    ; npm install
    ; cd ../socket
    ; npm install

Running the App

  1. Start the server application (in the api directory)

    ; cd api
    ; JWT_SECRET=f6d278bb34e1d0e146a80b16ec254c05 npm start
  2. Start the front end application (in the frontend directory)

In a new terminal session...

; cd frontend
; npm start

You should now be able to open your browser and go to http://localhost:3000/

  1. Start the socket (in the socket directory)

    In a new terminal session...

; cd socket
; npm start

Running the Tests

Currently, the project has test coverage for the API only via Jest. E2e frontend testing will be implemented in the future, please see future features list below.

  1. Start the backend server in test mode. Leave this running for all testing.
# Make sure you're in the api directory
; cd api

; JWT_SECRET=f6d278bb34e1d0e146a80b16ec254c05 npm run start:test
  1. Running the backend tests.

    In a new terminal session...

# Make sure you're in the api directory
; cd api

; JWT_SECRET=f6d278bb34e1d0e146a80b16ec254c05 npm run test

Note: On first run of test suite, you must run the test twice before they pass. This is because the the test database is created and written during these initial test runs.

  1. Running the frontend tests.

    ** Cypress E2e to be implemented**

About

Oppo Games is a social mini-games site, built with the MERN stack, Tailwind and Socket.io. Personal Extension of OppoGames-Group6

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 12