mWalrus / MapRank

A trackmania plugin which shows your world rank on the current map
https://openplanet.dev/plugin/maprank
MIT License
1 stars 0 forks source link

Feature request: ability to change region #9

Open martijnckx opened 1 year ago

martijnckx commented 1 year ago

I'd love to be able to see how many players and what top% I am in my region / country. I haven't looked into the technical feasibility of this, but I'd be nice if I was able to change the region this plugin takes into account. Maybe a setting, or it automatically following the displayed region of the native leaderboard.

mWalrus commented 1 year ago

I'll have to do some investigation on this beforehand because the API doesn't really have any real support for fetching total player counts at all. I currently have to use a separate account for that which has to have no records driven on any track in order for me to be able to use it for player count fetching purposes.

So, this could either be trivial to implement if the API behaves as one hopes it would, or the account's region is the only region I can fetch scores for, making this feature completely impossible :sweat_smile: I'll post another comment after I've done some testing to report back :+1:

mWalrus commented 1 year ago

From what I can gather, it seems like this would grow the complexity of my API by quite a bit since none of the Nadeo API endpoints support supplying a region when requesting leaderboard positions. This means my API would have to work around this fact somehow. It is probably possible somehow and if someone has any ideas on how to do this I'm all ears!

So, in conclusion, this is not planned at the moment but I'll keep the issue open in case someone, who has any ideas, would stumble across this in the future.

martijnckx commented 1 year ago

Thanks for looking into it! Might look at a workaround myself if I find the time and motivation in the next few weeks 😊.

the-ether-bunny commented 6 months ago

Hello @mWalrus I've been enjoying your plugin for some time now but like @martijnckx (and a lot of other people that come from trackmania turbo, for example) I've been wishing it could give you regional rankings along with global. Anyway I wanted to say I've actually discovered a plugin How Many Contenders? by ElRubioLoco that will give you the playercount on the current map for your regions. (Edit: Now that I'm testing it again maybe it's not really working properly. It will give you the correct player count but seemingly only on tracks you've yet to set a time on. In other words it just gives your rank as if your time were max, and if you already have a rank on the map it returns that instead of the true player count. I'm gong to message ElRubioLoco about it to see if it might be a bug on my end.)

Anyway I've looked into the code myself but as someone with no coding experience (since highschool at least) it's pretty overwhelming. Do you think it would be difficult to basically update your plugin with these regional numbers somehow (basically give [Player Rank/Player Count (Player %)] for each of your regions along with global? (Or I suppose the other way around might be easier but I contacting you first because you're more active on here than ElRubioLoco). I sort of set off to do this myself originally but seeing the actual code I don't underestimate how much time/effort this would probably take and when I saw someone else had already started a feature request thread about the same topic on here I thought I could be of help.

Thanks for any time if you get a chance to see this!

mWalrus commented 6 months ago

This looks very interesting! Sorry for the late reply, I've been busier than usual in the last week. I've currently just skimmed through the code you sent (and it looks promising), but I will take a closer look when I have time some time next week! :)

the-ether-bunny commented 6 months ago

@mWalrus Hey thanks for the reply and no worries (obviously!). I've been looking into this for the past week and the main problem I believe is that for some strange reason you can't request surrounding scores (times) for times that are lower than your own (as in the account doing the requesting, not the one you're requesting about). So there's this page about requesting surrounding scores but it's useless for any races you've already set a time on.

The thing that gets me is that in game you can obviously see the players one rank ahead and behind you for each of your regions (along with the top 5) but I can't figure out if plugins can access that information (and, very importantly, access that information about players other than yourself). If that could be figured out I think the whole endeavor would seem a lot more promising!

In any case thanks again for your time and also for your plugin btw (Maprank is perfect for global numbers).

mWalrus commented 6 months ago

Yeah, the issue I came across last time I looked into this was that the API for getting player positions works differently depending on if you have set a score or not on the map in question as you mention. For MapRank, I work around this issue by using a separate account for total player count fetching. However, the Nadeo API for fetching positions cannot be supplied a region to fetch scores for, this is instead controlled from the account's specified region.

This means that, in order to provide positions for every region, we would have to periodically fetch and cache regional information in a database or something. This just grows the scope of the plugin substantially and also kinda nullifies the reason for using my own API I built, which was avoid cached player count values.

For now it really doesn't seem like there is a feasible way to support this, which is a shame really.

the-ether-bunny commented 6 months ago

Yeah unfortunately that seems to be the state of it. I'll keep poking around and see if anything interesting pops up.

On a side note actually I tried using my Global % Rank and Region Rankings to back calculate (what I'd hoped to be) a very rough estimation of number of players in each region and...yeah, it's wildly inconsistent lol. I compared the results against the actual player count I had recorded on campaign tracks previously, and the numbers were off sometimes by a factor of 2 or more. I didn't expect much out of it but obviously the variance in skill of each region's player pool is significant and the problem is exacerbated when dealing with small numbers of finishes.

Anyway, thanks again. I appreciate that you took a look at it even if nothing can be done for the moment. Cheers!

mWalrus commented 6 months ago

@the-ether-bunny no worries whatsoever! Thank you as well for taking ur time to assess all the different possible avenues we discussed! Let's hope someone comes along with a good solution at some point so we can get this implemented! :smile: