Adventures in Odin

#gamedev #odin #watt-wise-game-jam

Way back in April of 2024, my friends Chris Waldon and Andrew Thorp hosted the inaugural Watt-Wise Game Jam. While I didn't produce as compelling an entry as I would have liked, the jam got me thinking about performance and energy use in general.

I started the jam with the idea that I wanted to see how energy efficient a browser game could be, which I still do think is an interesting premise. But partway through I got a nagging itch that I should be focusing on building from the ground level to have as much control as possible.

While TypeScript and the web have been my bread and butter for a long time, I've often thought about a slimmed down toolchain targeting desktop and avoiding solutions like Electron. In my mind, this has usually manifested as some kind of shell in a low-level language which executes JavaScript code (in V8?), provides bindings to OpenGL, but without unnecessary browser APIs like the DOM.

However, involving V8 and JavaScript at all is quite a daunting set of dependencies from the start.

All this led to more consideration of low-level languages, the most obvious being C/C++. I've never wanted to learn C, mainly because I get the sense that there's a lot of legacy baggage, and I'd rather start learning something more modern.

To that end, I started looking at languages like Rust and Zig. After working through a roguelike game tutorial for Rust, I wasn't feeling it. I'm sure that Rust is a perfectly fine language, but so far it is not for me. Zig hasn't yet been given a fair shake because...

I stumbled upon a new (to me) and interesting language, Odin, and everything about the design and positioning struck a chord with me. It was as if someone (in this case Ginger Bill) had designed a low-level language with me as the target.

One of the core principles of Odin is the "Joy of Programming":

We go into programming because we love to solve problems. Why shouldn't our tools bring us joy whilst doing it?

A few aspects I particularly enjoy:

Check out the Odin FAQ if you're interested in the language itself.

As with any new toy, my first inclination was to implement my beloved ECS architecture and recreate my "Gloomstone" game prototype, playfully named "Odinstone".

Screenshot of a first person dungeon crawler in Odin

To keep dependencies light, this prototype only uses OpenGL and GLFW.

After learning the language basics, I began porting my TypeScript + WebGL code into Odin + OpenGL. While the concepts translated well, there were hurdles along the way (including manual memory management, in which I was not well-versed), and these resources really helped me out:

Learning Odin has been refreshing and the most excited I've been about new tech in a long time.

I'm not sure where this particular prototype is going next, but it's nice to have a new tool in my workshop and I'm sure I'll be doing more with Odin down the road.


  1. Runtime types are a given in many languages, but joyful when coming from TypeScript which only has build-time types. ↩︎