Git Product home page Git Product logo

game-matchmaking's Introduction

Game Matchmaking System

This project implements a basic game matchmaking system using Flask and Redis. It allows players to join a matchmaking queue and pairs them based on skill levels. The system supports checking a player's status to determine if they have been matched.

Features

  • Add players to a matchmaking queue with a skill level.
  • Automatically match players based on skill levels.
  • Check the matchmaking status of a player.

Getting Started

Prerequisites

  • Python 3.8+
  • Flask
  • Redis
  • Docker (optional, for running Redis in a container)

Installation

  1. Clone the repository

    git clone https://github.com/siddharthpk/game-matchmaking.git
    cd game-matchmaking
  2. Set up a virtual environment

    python -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
  3. Install dependencies

    pip install -r requirements.txt
  4. Start Redis

    • Using Docker:

      docker run --name redis-matchmaking -p 6379:6379 -d redis
    • Locally:

      Ensure Redis is installed and start it according to your system's instructions.

Running the Application

  1. Start the Flask application

    python app.py

    This command starts the Flask server and the matchmaking process.

Testing the Application

Use curl commands to test adding players to the matchmaking queue and checking their status.

Add Players to the Queue

# Replace <skill_level> with the desired float type skill level of the player
curl -X POST http://localhost:5000/join_queue -H "Content-Type: application/json" -d '{"skill_level": <skill_level>}'

Example:

curl -X POST http://localhost:5000/join_queue -H "Content-Type: application/json" -d '{"skill_level": 10.5}'

Check Player Status

# Replace <player_id> with the actual player ID returned by the /join_queue request
curl "http://localhost:5000/check_status?player_id=<player_id>"

Development and Contributions

Feel free to fork the repository and submit pull requests to contribute to this project. For major changes, please open an issue first to discuss what you would like to change.

Ensure to update tests as appropriate.

License

MIT

game-matchmaking's People

Contributors

siddharthpk avatar

Watchers

 avatar

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.