Page 1 of 1

[Bug?] Records not saving in AscendingScore context

Posted: 11 Nov 2019, 08:19
by Dommy
I'm currently trying to make a point-based campaign in TM, where the best player is determined by their points score. However, I encountered a problem while setting the player's new record.

I have tested both in title edit mode and compiled title, results are the same. My title right now has one campaign with one map. In ManiaPlanetTitle.xml the solo section looks like this:

Code: Select all

<score_context>
    <name>NewSoloCampaign</name>
    <maprecord_type>0</maprecord_type>
    <medals_enabled>true</medals_enabled>
    <compute_medals_from_maprecord>false</compute_medals_from_maprecord>
    <author_medals_enabled>true</author_medals_enabled>
    <skillpoints_enabled>true</skillpoints_enabled>
</score_context>
<campaign num="0">
    <playlist name=""/>
    <mode name=""/>
    <score_context>NewSoloCampaign</score_context>
    <official_record_enabled>true</official_record_enabled>
    <disable_unlock_system>true</disable_unlock_system>
    <maps folder="Campaigns\New\"/>
</campaign>
Note that I replaced some specific word here with "New" to keep my new project somewhat hidden from public for now.

I start my map using PlayMap(Text Map, Text Mode, Text SettingsXml). Synchronisation status seems to be okay:

Code: Select all

::ELocalScoreStatus::Loaded
::EMasterServerScoreStatus::Synchronized
When I drive the first run, I try to save the new record using this method:

Code: Select all

declare Ghost = ScoreMgr.Playground_GetPlayerGhost(Event.Player);
declare NewRecordTask = ScoreMgr.Map_SetNewRecord(NullId, Map.MapInfo.MapUid, "NewSoloCampaign", Ghost);
wait(!NewRecordTask.IsProcessing);
if (NewRecordTask.ErrorCode != "") log(NewRecordTask.ErrorCode^": "^NewRecordTask.ErrorDescription);
I assume the campaign uses Score instead of Time when context is set to type 0 (ascending scores). CTmResult of the ghost looks as follows:

Code: Select all

== CNod ==
Ident Id NullId
== CTmResult ==
Integer Time 23089
Integer Score 83
Integer NbRespawns 0
Integer[] Checkpoints [9750, 23089]
However, instead of saving a record I am greeted by this message after calling the method (the error message):

Code: Select all

Unexpected: Previous record is best than this one.
To see how my record looks like now, I call a few functions and they return this data:

Code: Select all

ScoreMgr.Map_GetRecord(NullId, Map.MapInfo.MapUid, "NewSoloCampaign");
// Record is -1
ScoreMgr.Map_GetRecordGhost(NullId, Map.MapInfo.MapUid, "NewSoloCampaign");
// Ghost is Null
ScoreMgr.Map_GetSkillPoints(NullId, Map.MapInfo.MapUid, "NewSoloCampaign");
// SP are 0
ScoreMgr.MapLeaderBoard_GetPlayerRanking(NullId, Map.MapInfo.MapUid, "NewSoloCampaign", "World");
// My rank is 1st
ScoreMgr.MapLeaderBoard_GetPlayerCount(Map.MapInfo.MapUid, "NewSoloCampaign", "World");
// 1 player on record
In conclusion, it looks like the "ascending score" campaigns are not working properly right now since I can't get my mode to set a new record and my online record is always -1. Would be welcome if this could get patched.

Bonus question:
Is it possible to use this campaign system in ShootMania? In theory, Playground_GetPlayerGhost should work with CSmPlayer and the CTmResult of the ghost can be edited to contain the information required for the online records.

Re: [Bug?] Records not saving in AscendingScore context

Posted: 11 Nov 2019, 23:53
by BigBang1112
+1

Re: [Bug?] Records not saving in AscendingScore context

Posted: 12 Nov 2019, 00:09
by WTCYoStunt12
This issue is probably related to how MP manages saves. In the following function, if _Context is related to ascending score, the score isn't saved. However, if it's related to descending score / time / respawns, is saved. (it even works with an invalid map uid)

Code: Select all

Void NewCustomRecord (Text _Context, Integer _Score) {
    if (G_PlaceholderGhost == Null) {
        Private_LoadPlaceholderGhost();
    }

    G_PlaceholderGhost.Result.Score = _Score;
    declare request = ScoreMgr.Map_SetNewRecord(LocalUser.Id, "g7H3LCnjEy4GjSxPWO0Qafef2Aa", _Context, G_PlaceholderGhost);
    wait(!request.IsProcessing);
}

Re: [Bug?] Records not saving in AscendingScore context

Posted: 12 Nov 2019, 17:49
by BigBang1112
I actually realized that the issue is very highly the thing of -1. As -1 is always smaller than any score you set, even zero, so -1 is mathematically the best score in the ascending order. :idea:
The thing that would (possibly) do is to always set a new record if personal best score is -1 (or smaller than zero).

So it should be a minor fix, but a major fix, tho needed on the engine side.

It would be awesome to use the ascending order for record types like distance. :)

Re: [Bug?] Records not saving in AscendingScore context

Posted: 11 Jun 2020, 15:27
by adamkooo2
+1
well, documented

I am another one who needs this to be working :D