Devlog #8 - Leaderboards with PlayFab
To track competitive progress and display the top players, I implemented a Leaderboard System using PlayFab's player statistics API. This system allows players to see how they rank against others based on the number of wins they've achieved.
Ranking Menu UI
Setting up Leaderboard
First, I needed to set up a leaderboard in PlayFab under "Leaderboards (Legacy)". I named this leaderboard "AmountOfWins" and made sure it reset manually, and the highest value is shown first.
PlayFab Statistics Properties

Submitting Player Scores
After a match is won, the game sends the player's win count to the PlayFab server:
PlayfabLeaderboard.cs
- StatisticName is set to "AmountOfWins" to track wins per player.
- The value can be updated at any point - PlayFab handles ranking based on the latest submission.
All leaderboard information shown in PlayFab
Each user will be ranked and will be able to see their display name and the number of wins they have.
Retrieving Leaderboard Data
The leaderboard is requested when the player clicks on the "Ranking" button to view rankings:
Leaderboard.cs
- This fetches the top 10 players, sorted automatically by PlayFab.
Displaying Leaderboard Results
The returned leaderboard data is then shown in the ranking menu UI using a prefab for each player:
Leaderboard.cs
- This gives the players instant feedback on where they stand globally.
- Entries are refreshed each time the leaderboard has been opened by the player so each player can see the most updated version.
Final Version:
Conclusion
This project has been a major learning experience, giving me a deeper understanding of how multiplayer games work. I learned how to sync player data using Photon PUN and how to securely store and manage player data in the backend with PlayFab. Throughout development, I consistently learned from my teammates, which helped me grow both technically and creatively.
Building a game in this genre has been one of the most unique and rewarding projects I've worked on. I enjoyed the entire development process as it constantly pushed me to learn something new at every stage.
References
[1] YouTube, Jared Brandjes. Playfab + Unity - Statistics, Leaderboards & Display Name. Available at:https://youtu.be/99nxGhk4RNI?si=N662QAcc4_MFZCx8.
[2] YouTube, Coco Code. Easy and free online leaderboard in Unity! - PlayFab in Unity tutorial (#2). Available at: https://youtu.be/e2RXDso6fWU?si=Ymbk3lO7oLgnp4Hb.
Dice & Domination
A high-stakes multiplayer strategy game with domination and combat
Status | In development |
Author | Shivani |
Genre | Strategy |
More posts
- Devlog #7 - Upgrading the Lobby - From 2D to 3D48 days ago
- Devlog #6 - Character Customisation53 days ago
- Devlog #5 - User Authentication with PlayFab73 days ago
- Devlog #4 - Room Options87 days ago
- Devlog #3 - Lobby System98 days ago
- Devlog #2 - Multiplayer with PhotonFeb 27, 2025
- Devlog #1 - Programming ArchitectureFeb 10, 2025
Leave a comment
Log in with itch.io to leave a comment.