Store and retrieve average player data globally ?

Keeping it simple… I want to implement something like a online time attack system where the player will have a time for that stage but i want to also show the average time it took to complete that stage globally. So for example: it would show Stage 1: 0.45sec then show the the average global score for Stage 1: 0.53sec. So they can compare their time to the average time in the world.

I assume I would have to save each players time for that stage to a cloud or some SQL database then find the average from all the players data and return it to the game. Ive been looking into different ways to do this but I’m not sure what will be able to help with this. I’ve looked into 2 things.

1.google play services. Thought i could upload their time to the cloud based on their account but I’m unsure if google play services has a feature that will allow me to find the average of a specific stat globally and return it to the game. Most things I’ve looked up seems to be more player analytics like average play time or time spend doing this or that but not game stats. Like average of all the stage 1 completion times.

2.Another route i was looking at was using a SQL server but its been like…5 years since i messed around with SQL server stuff and even then I only knew the basics so I not sure what can and cannot be done with this.

Just need to be pointed in right direction on how to tackle something like this. New to the whole online part of development

I wanted a global high score list for Rocket Plume, and ended up just writing a simple web service that stores its data in a file. Basically just a php script on a server, that your app invokes. I included a bit of very simple encryption to make it harder to spoof (though I’m sure a determined hacker could get around it).

You don’t really need a database for this. For a global average, for example, all you need is the current average and the count. Store those two numbers in a file, read them when the script starts, add in the new score, and write it back out. Easy peasy.

You should also check out dreamlo on the asset store - easy, free and you should be able to use it for what you want to achieve

Wow ,Never knew you can calculate average with just the current average and count. Thanks for the reply guys looked into Dreamlo as well.

Unity Analytics with Custom Events (free) can do this https://unity.com/solutions/analytics