Sign In Register

How can we help you today?

Start a new topic

Create a leaderboard for puzzle game based on the average solving time

I'm making a puzzle game that has a leaderboard to rank the country (rank the country, not the players group by country), based on the average solving time of the players in that country. For example:

Country A - 01:30 - rank 1

Country B - 01:40 - rank 2

Country C - 01:50 - rank 3

My solution is to group players in a country into a team, then their solving time will be submitted for that team, but I don't know how to configure the running totals to calculate the average time (I only see the Max, Min, Sum, Count, Last, etc. options).

Can anyone show me how to do that.

Thanks in advance!

1 Comment

Hey There,

There is no default function to calculate averages on LBs. What i'd advise is to wrap your LB post event in another event where you can store all the times on the player account in Spark.getPlayer().setScriptData(). You can read all the entries from there and calculate the average. You would set the LB aggregation type to 'last' so that the rank would go down as well as up depending on the average value.

Does that make sense?


Login to post a comment