Role ordering, and a funny mistake I'm weirdly proud of
by The Tank Man on The Tank Man 1675233191431 |
Live game now orders players by role! This makes it easier to glance at while loading into the game or eating a cookie or something, and quickly parse top, jg, mid, adc, supp.
This is what it looks like now:
To order champs, for each champ I take their playrate in each role, and assign champs roles that maximize the sum of all 5 champ role playrates. The only caveat is if a champ has smite I add 100 to the champ's jungle playrate, which dwarfs the playrate numbers, so they'll always go jungle.
It was very cool to see champs in correct role order, but when checking out the result I noticed what seemed like a mistake: Jayce bot and Swain mid. Shouldn't it be Jayce mid and Swain bot? I checked quantum's vod and yep, it was Swain bot, my instinctive guess was right and my site ordering was wrong.
So I looked at my champ role playrate source data.
For swain:
"50": {"TOP": {"playRate": 0}, "JUNGLE": {"playRate": 0}, "MIDDLE": {"playRate": 1.106}, "BOTTOM": {"playRate": 0}, "UTILITY": {"playRate": 2.761}}
For jayce:
"126": {"TOP": {"playRate": 1.187}, "JUNGLE": {"playRate": 0}, "MIDDLE": {"playRate": 0}, "BOTTOM": {"playRate": 0}, "UTILITY": {"playRate": 0}}
Jayce is 0 for both middle/bottom, and swain is actually 0 for bottom but 1.106 for middle. So the overall champ role sum is higher with swain mid/jayce bot than the reverse. So the role order function worked correctly given the data it was given.
A perceptive reader might have noticed earlier I just "take their playrate in each role" - I didn't say where I take that from or how. Well, it's just https://cdn.merakianalytics.com/riot/lol/resources/latest/en-US/championrates.json - Thanks random guy who provides this helpful resource for free for everyone to use! I'd speculate in this case the swain bottom games got misclassified as swain support but who knows. Anyways guessing champ role playrates is the sort of thing I don't want to spend time/effort on, so this almost completely correct resource is great.
Now for the funny part - this got me wondering if my role model, opgg, makes the same mistake of putting Jayce bot, Swain mid. Sure enough, they do!!
Is it because opgg is using the same championrates source I am, and the same way of ordering roles? I would actually LOVE that - if I happened to pick the same way of ordering roles by maximizing the sum of the champ role rates because that's the intuitive way, and getting the role rates from the helpful meraki guy because that's the easy way, and at opgg they had the same sense of what's intuitive/easy as I did.
When you trip on the exact same mistake as the site you're trying to copy, seems like a pretty good sign you're on the right track! So I'm weirdly proud of the mistake as well as the working live game feature.
It could also be that they have their own champ role rate data which makes the same mistake on 0 for swain bottom as the one I used, or that swain genuinely doesn't play bottom, but I like my headcanon in which opgg and I do the same thing.
By the way, right now it simply tries all permutations of 5 roles, which is 120 cases, to get the permutation with the maximum sum of champ role playrates. Our new robot overlord suggested solving it as a linear programming problem, but I feel like gpt is not at the point yet where even though you yourself don't understand what it's doing you can simply copy paste its code importing libraries and doing math, and be confident what you copied works. It does actually sound correct to use linear programming here, but it's a premature optimization (i.e., idk how lol). So maybe that time/effort another day.