Giter VIP home page Giter VIP logo

facemash-v2's Introduction

FaceMash V2

Simple, Reusable, Prototypical solution inspired by FaceMash ( As seen in The Social Network (2010) ) that allows users to rate two Pokemons against each other. The game uses Glicko 2 rating system to calculate the relative strength?/popularity? whatever of each Pokemon, and features a leaderboard that is automatically updated at GMT midnight.

Inspiration

FaceMash

Data

The dataset is collected from fanzeyi/pokemon.json

Seed Data for MongoDB

You need 2 MongoDB collections for the application. One for saving Pokemon data and the other for saving Match/Pairing data. Initial seed data for MongoDB can be found here. Initial rating,deviation and sigma are set to 1500, 350 and 0.06 respectively. The initial rank values are set to the same value as the currRank field, and prevRank is also initialized to the same value. Below is an example of what the seed data for a Pokemon in the database would look like:

{
  "id": "1",
  "name": "Bulbasaur",
  "img": "https://raw.githubusercontent.com/fanzeyi/pokemon.json/master/images/001.png",
  "currRank": 1,
  "prevRank": 1,
  "rating": 1500,
  "deviation": 350,
  "sigma": 0.06
}

Seed Data for Algolia

You will have to create an Algolia index for this. You can do that for free. Initial seed data for Algolia can be found here. Below is an example of what the seed data for a Pokemon in Algolia would look like:

{
  "objectID": "1",
  "name": "Bulbasaur",
  "img": "https://raw.githubusercontent.com/fanzeyi/pokemon.json/master/images/001.png",
  "currRank": 1,
  "prevRank": 1,
  "rating": 1500
}

Note that the id field in the database seed data corresponds to the objectID field in the Algolia seed data, and that the deviation and sigma fields are only included in the database seed data. Also make sure to configure the name as a Searchable attribute and to configure the ranking to sort by increasing currRank in Algolia.

Deploying your own

Backend

The backend for this game is a Serverless API that is hosted on Vercel. To deploy the backend, follow these steps:

  1. Fork the repository to your GitHub account.
  2. Open the Vercel dashboard and "Import Project".
  3. Select the serverless directory as the source directory.
  4. Set the Environment Variables according to the given .env.example.

Frontend

The frontend for this game can also be hosted on Vercel. To deploy the frontend, follow these steps:

  1. Fork the repository to your GitHub account.
  2. Open the Vercel dashboard and "Import Project".
  3. Select the frontend directory as the source directory.
  4. Set the Environment Variables according to the given .env.example.

Sync server

The sync server for this game can be hosted on Render or any other platform of your choice. The sync server contains 2 endpoints which can be used to automatically update the ratings in the database and Algolia search index, as well as delete any unfinished matches from the database. To deploy the sync server using Render, follow these steps:

  1. Fork the repository to your GitHub account.
  2. Create a new Render project and connect it to your GitHub repository.
  3. Select the sync directory as the source directory.
  4. Set the Environment Variables according to the given .env.example.

Setting up Cron Jobs

To automatically call the endpoints of the sync server, you can use a third-party service like cron-job.org.
The 2 endpoints will be https://deployedUrl/sync/rating and https://deployedUrl/sync/delete. Set the desired interval for the cron job. By default, the sync server is set to update the ratings every day at midnight GMT. If you need to change the duration, make sure to update the time difference in the sync.js file in the sync/controllers directory of the repository.

Contributing

This project is open-source and contributions are welcome. If you have any suggestions or would like to contribute to the project, please feel free to submit a pull request or open an issue.

License

FaceMash is an open-source project released under the MIT License.

facemash-v2's People

Contributors

cmgchess avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

cryptonord

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.