auQuiksilver / Apex-Framework

Apex Framework
MIT License
81 stars 46 forks source link

leaderboards #32

Closed YuXiaohuann closed 1 year ago

YuXiaohuann commented 1 year ago

Hi, I want to know how leaderboards are calculated. Because I can't tell the meaning of QS_leaderboards2,QS_leaderboards3,QS_leaderboards4.

YuXiaohuann commented 1 year ago

I want to obtain the UID and name of the top 10 players on the transportation list. This is my existing code, which runs on the server side.

_var = [];
{ if(_y select 1 == 0) then {continue}; _var set [count _var,[_y select 1,_x,_y select 0]]}forEach (missionNamespace getVariable 'QS_leaderboards2');
_var = [_var, [], {_x select 0}, "DESCEND"] call BIS_fnc_sortBy;
_var resize 10;
_var;

But I found that the calculated value is less than the value of viewing the leaderboard in the game.

auQuiksilver commented 1 year ago

hey,

try "missionProfileNamespace" instead of "missionNamespace"

"leaderboards2" is saved to "missionProfileNamespace". it is the master copy

"leaderboards3" is updated frequently with new scores, and is sent to clients on demand.

"leaderboards4" is not updated at all during the session, kept as a copy of initial state only. it keeps data from previous sessions, not current session. It is a clone of "leaderboards2" but with no new data from current session.

player menu shows sum of: "leaderboards4" (sent to client only once on first menu access) + "leaderboards3" (send to client on demand whenever menu is opened, with a short sync cooldown). _menuLB = leaderboards4 + leaderboards3

We do this to limit network traffic, so client is not receiving the entire database regularly.

YuXiaohuann commented 1 year ago

Okay, thank you for your help