How we used a video game system to solve a real-world problem

By Bety Rodriguez-Milla on Feb 11, 2020 3 min read

Many of the software engineers at Zeitspace have unique backgrounds, and I’m no different: I’m a software engineer with a background in computational physics. That made the transition into the industry both daunting and exciting. There are a lot of new programming practices and principles that a physicist rarely learns in graduate school. While algorithms are second nature to me, becoming a software engineer was new.

What has helped me a lot in this transition is the company’s Lean UX approach to developing products. Among those principles are having cross-functional teams with a shared understanding — I wish physics would be this open to having interdisciplinary teams on a project — and giving people permission to experiment and fail.

I recently wrapped up my first project at Zeitspace, where I worked on a web-based application for the National Cycling Institute in Milton (NCIM).

As a physicist making the transition to industry, my first task at Zeitspace was to come up with a method to rank riders competing and training at the Mattamy National Cycling Centre. Having riders sorted out in races according to their skill level is necessary to have safe races. Beginners and experienced riders in the same race just don’t mix.

A group of coaches and race organizers wanted to take an automated approach to ranking cyclists, so I had to figure out whether we should build this method from scratch, or whether we could use something that already existed. As it turned out, we found the solution in the video gaming industry. Automation allows anyone familiar with cycling to run a race night, not just someone who is familiar with the usual riders. Currently, there are only a handful of people at NCIM who know the riders well enough to place them in the correct race on a given race night, so automation lightened the load.

My first challenge was to find a way to automatically rank the riders based on their past performance. We had initially looked at using the same point system used in world rankings, but it didn’t account for who the racers were competing against. NCIM events can be highly variable, including recreational racers, those on the national team, and international competitors. So we needed a system that would consider opponents in the race and not just the racers themselves.

My internet searches into how sports rank players took me to the Elo rating used in chess competitions. However, this type of rating is best for one-to-one matches, and, in cycling, racers are competing against each other at the same time. After reading research papers and some other algorithms, we settled on Microsoft’s TrueSkill algorithm. This algorithm supports a multiplayer environment, it doesn’t penalize losses as harshly as other ones, it can infer individual skills from team results (a Madison race, anyone?), and it has better accuracy and convergence speed. If the algorithm rings a bell, it’s because Microsoft developed it to rank players on its Xbox online gaming platform.

The TrueSkill algorithm is free to use if you don’t use it for profit. In our case, Zeitspace was working on this project pro bono and our client, NCIM, is a not-for profit organization, so TrueSkill was an ideal fit: It suited our needs and it was free for our client.

Having chosen the algorithm, the next step was to set it up for our case. We found a Python library that does the math and logic behind the TrueSkill algorithm. Now, we just had to feed all the previous race results chronologically into it in order to update each riders’ ratings. This was no small feat — NCIM race results were stored as Excel files with a somewhat inconsistent style. So, armed with the tools of a data scientist, a Jupyter notebook and the pandas data analysis library, we were able to clean, parse, and organize all the data for each different race type.

Having chosen the ranking algorithm, the steps around setting a web app, like choosing a stack, are all well-known practices in the software industry. In our case, software engineers and UX designers came together to provide a great user experience.

So next time you want to build something from scratch, you may want to first do your research to see if there is already a tool that meets your needs. In this day and age, most of the time, there is no need to reinvent the wheel, but just to refine it. The tools may not be explicitly made for what you want to do, but it may well perfectly serve your purpose.

Bety Rodriguez-Milla

Written by Bety Rodriguez-Milla

Bety Rodriguez-Milla is a software engineer at Zeitspace.