Skip to content

Conversation

mourningsickness
Copy link
Contributor

This PR (finally) adds per-style rankings!

The new !top and !rank menus allow you to pick from an "overall" rank (how bhoptimer ranks work now) or each configured (and not disabled) style.

Functionality is working, with no found errors or bugs. It should be optimized further, but I wanted to open the PR as soon as it was stable to get some insight into how to best do that.

Next on the todo is to incorporate it into shavit-chat with something like {stylerank} variables to be used in chat tags.

Screenshot from 2025-07-31 19-45-25 Screenshot from 2025-07-31 19-45-34 Screenshot from 2025-07-31 19-45-47 Screenshot from 2025-07-31 19-46-03

@mourningsickness
Copy link
Contributor Author

i added this to the bhop server (577k playertimes, 130k users) and performance is actually not bad. i still want to optimize further, but i was expecting it to take a noticeable amount of time for the migration and on each map change.

@mourningsickness
Copy link
Contributor Author

honestly, it doesn't even appear to have performance issues whatsoever.. so it could ship as-is. i'd prefer to get input first though, to make sure there isn't a good way to make it more efficient, say, if there are 100+ styles. My servers only have slightly more than 20 at the moment.

@mourningsickness
Copy link
Contributor Author

Style rank based chatrank support has been added, using {styleXrank} where X is the style ID in shavit-chat.cfg. It works the same as {rank}, being replaced with an int, allowing things like [#{style0rank} Normal] for "[#34 Normal]" in game.

@mourningsickness
Copy link
Contributor Author

image

@mourningsickness
Copy link
Contributor Author

everything is working great, but i think the queries need some more work. the !top menus seem.. just a little bit inaccurate. i am wondering if adapting the normal rank queries didn't work perfectly. i had to rewrite one completely, and use a CAST() in it to get the points to sort as floats instead of lexicographically for some reason.

@mourningsickness
Copy link
Contributor Author

Screenshot from 2025-08-01 15-36-01

dynamic {currentstylerank} chat tag support added.

@Nairdaa
Copy link
Contributor

Nairdaa commented Aug 3, 2025

What a pogchamp.

@mourningsickness
Copy link
Contributor Author

image

another example in ccname

…BY style instead of running a query for each style ID
@mourningsickness
Copy link
Contributor Author

need to test new queries, but i am trying to optimize queries using GROUP BY style instead of looping through and performing a query for each style. will fix code and test later today.

@mourningsickness
Copy link
Contributor Author

Screenshot from 2025-08-11 18-34-27

i optimized the queries a lot, and the ranks/points are identical to before.. radical

@mourningsickness
Copy link
Contributor Author

ranks load nearly instantly again :3 even with all the additional features. honestly, some queries have not been optimized yet, but i'm not sure i can do it because i am unable to test things like postgre/sqlite.. or old versions of db engines. for mysql though, it loads amazingly and works super well.

@mourningsickness
Copy link
Contributor Author

UpdatePointsForSinglePlayer, line 1343 is giving me a SQL error when someone sets a time, but the query runs fine in a SQL editor.. so i'm not sure what the problem is:

[shavit/shavit-rankings.smx] Timer (rankings, update all style points) error! Reason: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT auth, style, SUM(points) as total FROM playertimes WHERE auth = 811703...' at line 1

@mourningsickness
Copy link
Contributor Author

i got the query fixed, but think it will be for mysql only because i borrowed the JOIN from the lower query that is specified as being for mysql. i need help with these queries and testing on other db engines to find out if there are issues. as it sits, everything works great on mysql.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants