Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SaaS Matchmaking

SaaS matchmaking system

Installation

  1. Install the python dependencies: pipenv install
  2. Install a local version of the database: docker compose up --build --remove-orphans -d
  3. Run database migration to have the latest schemas: alembic upgrade head
  4. Run the app locally: uvicorn app.main:app --reload
  5. Run the worker locally: python matchmaking_worker.py

Usage

The easiest way to get started with the api is to head over to the docs generated by fastapi at localhost:8000/docs.

  1. Create a queue using the endpoint POST /queues. It is possible to add a cost function, and a maximum cost to the queue. The cost function should output a number that represents the cost of matching players together. The higher the cost of a matching, the less likely it is the that the players will be matched together. If a max cost is provided, the queue will never match players with a matching cost higher than the max.
  2. Add players to the queue using the POST /players. Each players can have a set of attributes (for example a rating) that can be used in the cost function.
  3. Call the GET /players/{player_id} endpoint to get the status of a player. When a player gets a match, its status will have the value MATCHED.
  4. Using the match id of a player, call the GET /matches/{match_id} endpoint to get the list of players in the matching.

Cost Function

As mentioned above, a cost function can be associated to a queue. The cost function supports aggregate functions for the attributes of the players in the potential matching. For example, 60 * diff(rating) / avg(wait_time)would be a cost function that takes into account the difference in rating of the players in a matching and the inverse of the average wait time of the players. Note that wait_time is an attribute that can be used even if it's not in the attributes of a player.

About

🕹 SaaS matchmaking system for online games

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages