Page 1 of 1

[BUG][URGENT] Leaderboard API wrong range (CScoreMgr)

Posted: 16 Dec 2019, 04:47
by Nerpson
Hi,

The range returned when asking for a map leaderboard through the CScoreMgr object is not the same as the asked range in some cases, when the count is large apparently. The following examples have been ran in the CManiaAppTitle context.

Examples:

Working example
The range 0 to 10 works. But you will notice that for some reason the variables Count and FromIndex are inversed. (??)

Code: Select all

declare Task = ScoreMgr.MapLeaderBoard_GetPlayerList(NullId, "E4ZKEOE1b6L64b5r5MYMtwNh8T3", "", "World", 0, 10);
wait(!Task.IsProcessing);
log(Now ^ "> FromIndex : " ^ Task.FromIndex ^ " Count : " ^ Task.Count);
foreach (Key => Info in Task.LeaderBoardInfo) {
	log(Now ^ "> " ^ Key ^ " - rank : " ^ Info.Rank ^ " '" ^ Info.Login ^ "'");
}
ScoreMgr.TaskResult_Release(Task.Id);
Output:

Code: Select all

31738173> FromIndex : 10 Count : 0
31738173> 0 - rank : 1 'riolu'
31738173> 1 - rank : 2 'skilley77'
31738173> 2 - rank : 3 'jack1998'
31738173> 3 - rank : 4 'rotaker'
31738173> 4 - rank : 5 'btonios'
31738173> 5 - rank : 6 'getax'
31738173> 6 - rank : 7 'kakaoos'
31738173> 7 - rank : 8 'kripke'
31738173> 8 - rank : 9 'atlan28'
31738173> 9 - rank : 10 'vinteq'
Buggy example
The range 0 to 11 DOES NOT work. You can notice that the FromIndex has been changed and Count zeroed. (??)

Code: Select all

declare Task = ScoreMgr.MapLeaderBoard_GetPlayerList(NullId, "E4ZKEOE1b6L64b5r5MYMtwNh8T3", "", "World", 0, 10);
wait(!Task.IsProcessing);
log(Now ^ "> FromIndex : " ^ Task.FromIndex ^ " Count : " ^ Task.Count);
foreach (Key => Info in Task.LeaderBoardInfo) {
	log(Now ^ "> " ^ Key ^ " - rank : " ^ Info.Rank ^ " '" ^ Info.Login ^ "'");
}
ScoreMgr.TaskResult_Release(Task.Id);
Output:

Code: Select all

31687893> FromIndex : 2 Count : 0
31687893> 0 - rank : 2 'skilley77'
31687893> 1 - rank : 3 'jack1998'
31687893> 2 - rank : 4 'rotaker'
31687893> 3 - rank : 5 'btonios'
31687893> 4 - rank : 6 'getax'
31687893> 5 - rank : 7 'kakaoos'
31687893> 6 - rank : 8 'kripke'
31687893> 7 - rank : 9 'atlan28'
31687893> 8 - rank : 10 'vinteq'
31687893> 9 - rank : 11 'scrat'
31687893> 10 - rank : 12 'arms08yuki'
Another buggy example
The range 0 to 20 DOES NOT work as well.

Code: Select all

declare Task = ScoreMgr.MapLeaderBoard_GetPlayerList(NullId, "E4ZKEOE1b6L64b5r5MYMtwNh8T3", "", "World", 0, 20);
wait(!Task.IsProcessing);
log(Now ^ "> FromIndex : " ^ Task.FromIndex ^ " Count : " ^ Task.Count);
foreach (Key => Info in Task.LeaderBoardInfo) {
	log(Now ^ "> " ^ Key ^ " - rank : " ^ Info.Rank ^ " '" ^ Info.Login ^ "'");
}
ScoreMgr.TaskResult_Release(Task.Id);
Output:

Code: Select all

32362634> FromIndex : 2 Count : 0
32362634> 0 - rank : 2 'skilley77'
32362634> 1 - rank : 3 'jack1998'
32362634> 2 - rank : 4 'rotaker'
32362634> 3 - rank : 5 'btonios'
32362634> 4 - rank : 6 'getax'
32362634> 5 - rank : 7 'kakaoos'
32362634> 6 - rank : 8 'kripke'
32362634> 7 - rank : 9 'atlan28'
32362634> 8 - rank : 10 'vinteq'
32362634> 9 - rank : 11 'scrat'
32362634> 10 - rank : 12 'arms08yuki'
32362634> 11 - rank : 13 'lukisuperracer'
32362634> 12 - rank : 14 'frasobema'
32362634> 13 - rank : 15 'diaboliknat'
32362634> 14 - rank : 16 'jumperjack'
32362634> 15 - rank : 17 'amaterasu.'
32362634> 16 - rank : 18 'thoni_tower'
32362634> 17 - rank : 19 'tundzar'
32362634> 18 - rank : 20 'skandear'
32362634> 19 - rank : 21 'dvilx'
As you can see, riolu has been skipped for no reason!
A side note, this bug is not present in the CManiaAppPlayground context (run in the campaign mode server's ManiaApp) as you can see here:
leaderboard working in the context CManiaAppPlayground
leaderboard working in the context CManiaAppPlayground
Annotation 2019-12-16 050617.png (364.41 KiB) Viewed 2070 times
A fix is needed ASAP, players are blaming me for buggy leaderboards but I just noticed the bug is in the API.

Nerp for Unbitn

Re: [BUG][URGENT] Leaderboard API wrong range (CScoreMgr)

Posted: 16 Dec 2019, 15:37
by Alinoa
Hello Nerpson :)

Thank you for your report :thumbsup:

Re: [BUG][URGENT] Leaderboard API wrong range (CScoreMgr)

Posted: 07 Mar 2020, 01:05
by BigBang1112
This is a cause of the FromIndex issue which I doubt will be fixed because it's now hardcoded in many title packs.
Currently, only FromIndex being 1 and Count being 10 works properly. Others tend to skip the world record.