<< ABX! Devlog

Switching to Odin

Why I switched this project from C to Odin and how that has affected development

This project is my first dive into game development, so I’ve really been going in blind. I wanted to start in C because I felt like I needed to learn classic gamedev, since historically some of the greatest programmers in the game world started in C. Part of me wanted to learn the true foundations of gamedev and follow in the footsteps of every gamedev I admire (John Carmack, Jonathan Blow, Casey Muratori, Sean Barrett).

However, after a couple of months of doing it myself and asking AI to guide me, my project was a mess. Here is the repo if you wanna check it out. Now, I fully realize that the reason it was a mess is a skill issue and not a C issue. I think C is a great foundational language that everyone should do a little programming in. However, as a beginner, I created a real mess really quickly.

As I was figuring out how to move forward, I rediscovered Odin. Rediscovered because I found Odin early in my learning, but I was so confused by it that I never gave it a shot. Now, having a bit more experience and having built a couple of things, it just made sense to me. I built two little projects to test-drive the language: a Chip-8 emulator and a DNS resolver. Those projects went off without a hitch, and I really enjoyed my time using the language. Here’s why:

The Odin Programming Language

Odin is a general-purpose programming language with distinct typing built for high performance, modern systems and data-oriented programming.

Odin is the C alternative for the Joy of Programming.

To me, Odin is the low-level equivalent of Go: simple, easy to use, tools included, and it just works.

Now, I haven’t been programming for years and years, so I can’t tell you the intricate details of why Odin is a great language. What I can tell you is why it’s great for beginners who want to create a game without using an engine.

It’s Opinionated

For some people who have been programming for a long time, this might be a turn-off because it forces you to do things you may not agree with. However, for the beginner, this lack of options is a gift because we don’t have an opinion on almost anything. A common phrase I say is, “You don’t know what you don’t know.” Having a language that just makes the decision for you helps with learning the basics of gamedev, because you’re not worrying about whether it was the correct decision. You can just focus on making your game or project.

It’s Simple

To me, if you know a little bit of programming, Odin is one of the easiest languages to read. It’s not like Rust, which is really verbose and where you almost need a PhD to understand the most basic syntax. Nor is it like Python, with very little structure that just relies on whitespace. It falls right in the middle for me: just enough information that you know what’s going on, and it provides structure without too much line noise.

Tools Included

On this Wookash Podcast, Ryan Fleury mentions something along the lines of: if you’re just starting out and haven’t had time to build up your own tools for C, Odin is very useful. This is due to Odin’s standard library and vendor collection. Odin comes pre-shipped with a wide range of packages, so there’s very little need to reach for an external library. For example, if you need to create an RNG state based off a u64, all you need to do is:

import "core:math/rand"
import "base:runtime"

rng_state := rand.create(seed)
rng := runtime.default_random_generator(&rng_state)

And there you have a random number generator. The same goes for graphics and physics libraries like SDL2, SDL3, Raylib, Box2D, Box3D, OpenGL, Metal, pretty much anything you need to ship a game. It’s just import "vendor:sdl2" and there you go, you have SDL2.

Current State of the Game

After rewriting the entire game in Odin, I’ve been able to iterate faster than I ever could in C. I’ve also simplified the project down to five files for the entire game, and honestly, I could probably go with fewer. I believe I’m past the beginning stages of gamedev and into the long dark tunnel, where it’s dark in either direction I look.

Right now I’m working on the wave design system and enemy spawning. After that, I’ll build out the formation logic so I can have playable levels. Then it’s time to make it fun!