Trackmania Tracker

This year my friend group started playing Trackmania again. Trackmania is a racing game with focus on speed and precision.

More precisly: Trackmania offers a the "Track of the Day" challenge. Every day a new track is released and players have to complete it within a certain time to earn medals. All optional of course.

An long standing problem of Trackmania though is its UI. So if you want to keep track of the completions of yourself and your friends, you are out of luck. Even though Trackmania offers a "Club" feature, which is basically a group or clan system, there is no comprehensive dashboard to get an overview.

So, you know what to do: Build your own dashboard.

The dashboard

Thankfully, Trackmania kinda offers an API to access the data. First you need to authenticate with your Ubisoft account, but then you can access all kind of interesting data. For example all details about the Track of the Day or the placement results of your clubs. If you combine that and think of a arbitrary ranking system, you have a dashboard.

Dashboard
Visit

So what's the stack? For small projects like this, I've grown fond of using Bun.sh. It's similar to nodejs, but faster, more modern and with better support of tools you actually need. (more on that later)

The project runs without a database and composes the data from the API on the fly. This means that it's instant and as soon as you reach the finish line in-game, you can see your new position on the dashboard.

On the flipside this also means that every user view of the dashboard results in API calls, which in time triggers the rate limit. For a personal project like this, that's not a big deal, but if you run a service for a bigger audience, you should definetly look into a proper database.

So the dashboard is nice and was really heavily used in the most active month, but what else can we do with the data?

Wrapped

As of the time of writing this, the year is coming to an end and it's time to look back and see how everyone did. So, you know how Spotify send you an end of year resume? Why not do the same for Trackmania?

Wrapped
Visit

So expanding on the concept of the dashboard, what do we need to do for a cool year in review? (aka Wrapped) First of all we need to get all data for the entire year. This includes all the tracks, but also all the players and their respective points for the year.

You can easily guess that this could be potentially a lot of data, so let's use a database for that. This has the added benefit that we can use SQL for querying the data. Luckily for us Bun.sh offers a great SQLite module. So no compiling, no external dependencies, just run and go.

So after collecting all tracks and the player data, we can start to think about some interesting awards.

Here are some of the awards I came up with:

  • Medal Collection
    • Total count of each medal type earned across all tracks.
  • Track Completion
    • Total number of tracks completed with any medal.
  • Best Average Medal
    • Average medal is calculated by taking the average of the medal values for each track. 🏎️ is worth 4 points, 🥇 is worth 3 points, 🥈 is worth 2 points, and 🥉 is worth 1 point.
  • Earliest Silver+ Medal
    • First players to achieve a silver medal or better in 2024, ordered by month and day.
  • Greatest Outperformance
    • Tracks where players performed significantly better than the average time, showing percentage improvement compared to the mean.
  • Monthly Completionist
    • Players who completed all tracks in a month with at least a bronze medal.
  • Living on the Edge
    • Players who achieved medals with less than 0.1 seconds to spare.
  • I Hate You So Much
    • Players who won by less than 0.1 seconds, crushing their opponents' dreams.
  • Longest Endurance
    • The longest time spent completing a single track, regardless of medal earned.
  • Longest Streak
    • Most consecutive tracks completed with at least a bronze medal.

As you can see, I tried to make the most out of the data I have. Naturally, there are limits to the data. For example, I would have liked to have added an award for the most tries for a single track, but the API doesn't offer that.

Anyways, when we have calculated all these awards, we can generate a single html page for the year. I added a daily cron job to regenerate the page every day with an automatic year determination, so we always see the latest data for that day.

Conclusion

This was a great project, that I had a lot of fun building on the side. The point this emphasized for me again and is reflected in a lot of founder advice: Build something you need yourself.

If you have any ideas for improvements or other features, feel free to reach out.