When I learned about the hackathon onboarding project, I knew I wanted to take the opportunity to expand my skillset and learn a new modern programming language. Golang has always been on my list of languages to learn, so I just needed to find a project to work on. I find it easier to learn while building a practical application, rather than reading through documentation and doing the traditional “Hello World” tutorials.
I recently started playing the video game Destiny, which has helped me stay connected with family and friends during Covid lockdown. This game makes use of several impressive technologies, including cross-platform play and a mobile companion app that interacts with the game in real-time. What impressed me the most was that the app uses an API that Bungie, the game’s developer, has opened up to the public for anyone to make their own apps.
I read through the API documentation and came up with an idea for an app that would both be useful to me and help me learn Go as I build the app. Given the two-week deadline to present my work to the Commit community, I wanted to keep it simple since the majority of my time would be learning Go rather than building a proper demo. My idea was to create a dashboard displaying various stats on my performance in the Crucible player-versus-player mode, and details about what weapons are being used by other players.
Getting started with the API was not too challenging, although I did not come across many articles or tutorials on how to use it. Creating a Bungie developer account was quick and easy, but the notable challenge working with the API was using the manifest and SQLite database. It took some time to find an old article about using the manifest API endpoint to download an SQLite database with several tables of asset definitions. The other API endpoints contain reference IDs to entries in these tables, however some IDs from JSON responses were unsigned integers that needed to be converted to signed integers to look up in the database.
Getting started with Go was quick—I read documentation and tutorials as I developed the app. The most time-consuming part was shifting my mindset from a more dynamic language like Python, where variables can be of any type, to having to be more strict in Go. For example, consuming a JSON endpoint can be easily converted into a dictionary object in Python; with Go this was a bit more cumbersome, as you have to create typed structs for every JSON object.
For the HOP demo, I was able to produce a single-page app that displayed charts of the different weapons and weapon categories used by the players in the most recent PVP activities.
There are many features that I would like to include in future versions of the app, but there are a couple that I think are the most important. The first would be the OAuth login flow so any player can login with their Bungie account and view a dashboard of their player data. Currently, the dashboard is hardcoded to my player profile. The next feature would be to add a database to the backend to save historical data and get aggregate data for any date range instead of limited to the most recent activities.
Luke Swamy is a Commit Engineer who specializes in developing web applications. When he is away from the computer he enjoys video games and playing soccer.