magefree / magefree/mage

Stats: collect metagame stats for server's decks

Open
#5,534 0 comments 0 reactions 0 assignees View on GitHub
enhancement server
Dominant language
Java
Stars
2.4k
Forks
940
Avg merge
2d 12h
Merged PRs (30d)
160

Description

Server can collects data about all playable decks, uses and win rate. That's data can be show ups in top decks page stats. Also top decks can be selected for games from deck viewer (it's another new possible feature -- see MTG Arena) or uses in server's API (as example: server's metagame stats page in server's website)

**Feel free to comments and add new idea.**

Server stores data about all decks. Only popular decks stores in db. Deck hash = hash from (main card name and amount, sorted by name).

**Part 1 -- data collection and store**

DB table to store decks:
* deck hash;
* deck cards list (text format: main + sideboard);
* auto-generated name (from colors and/or most popular card, or from standard decks list from deck viewer);

DB table to store deck stats:
* deck hash;
* total games;
* stats by formats, json-compatible, win/lose per player per game:
* format code;
* win count;
* lose count

On game starts server collects info about decks (calcs hash, gets cards list). Per player. On game ends server calcs total stats: deck hash, format code, win count, lose count. And saves it to memory store. If that's store contains same deck hash then stats concatenates. On stats limit reaches (10+ games was played with that deck) server flushes it to database with all new stats and cards list (if it's first time add).

Top decks services/worker rebuild stats index from db after server's startup and time by time (as example: one per hour). It's read all database deck stats, calcs total values for each format and selects top decks for each format.

**Part 2** -- tools to collects deck stats and generate top lists
TODO

**Part 3+** -- api, card viewer supports and more
TODO

**Extra** -- same approach can be used for player stats (collects player stats for win/lose counts per format).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.