Preface
You are about to learn Odin by building a game you can actually play: a native desktop game, one self-contained binary, running the same on Windows, macOS, and Linux. Not a toy in a slide deck: a wolf that runs and jumps across an endless, procedurally-generated landscape, with sound, screen shake, a day-to-night sky, and a high score that remembers you. By the last page, you will have written every line of it, and, more to the point, you will know your way around Odin.
Who this is for
You already program in something: C, Go, Rust, TypeScript, Python, it doesn't matter which, and you have never written Odin, or you have poked at it and want a proper run at it. You are comfortable enough at a terminal to run a compiler and edit files. That's the whole list. You do not need any prior graphics, games, audio, or C-interop experience; every piece of that is built up from nothing and explained as we go.
This is not a first-ever-programming book, and it is not a games-maths textbook. The little vector and physics maths the game needs is derived inline, in a sentence or two, right where it's used.
What you'll build
Sköll, named for the wolf that, in Norse myth, endlessly chases the sun across the sky. That endless chase is exactly our genre. The wolf auto-runs; your only job is to jump, over rocks, over gaps in the ground, while grabbing runes for points as the world scrolls faster and faster beneath you. Miss a jump and you fall; clip a rock and it's over; beat your best and the game remembers.
Under that simple game sits a tour of Odin: its types and arrays, its take on structs and enums, pointers, defer, context, and calling conventions, how it calls a C library, how it stays allocation-free in a hot loop, and how it ships a real program. The game is the reason to learn each of these; the learning is the point.
The ground rules
A few constraints shape every chapter. They are deliberate, and each one is a teaching decision:
- Odin and raylib only. The Odin compiler, its standard library (
core:,base:), and the one library that ships inside the Odin distribution: raylib, undervendor:raylib. No third-party libraries, no package manager, nothing to download beyond Odin itself. If it didn't come in the Odin install, we don't use it. - Zero assets. No image files, no audio files, no fonts bundled alongside the game. Every visual is a raylib shape: a rectangle, a circle, a line, a triangle, and every sound is synthesised at runtime from raw samples. This is why the finished game is a single file with nothing beside it, and it turns out to teach more than loading art would.
- One binary, three platforms. The same source compiles unchanged on Windows, macOS, and Linux; raylib is statically linked from the copy in your Odin install. There is no browser, no server, no JavaScript, and no bundler. You type
odin run .and a window opens. - British English throughout. In the prose and in the comments we ask you to write. Identifiers that come from raylib keep their original spelling (
ClearBackground,Color,DrawTextEx); we don't rename the library.
How to read it
Build along. Don't just read: type the code, run it, watch the window. Each chapter ends on something you can see move, which is the surest sign you're on track. Every code block in this book is real Odin I compiled and ran; the finished project in code/ is the destination, and the chapters build up to it piece by piece.
Three kinds of callout recur:
Why: the reasoning behind a design choice, not just the mechanics.
Gotcha: a real trap that will bite you if you don't know it's there. When you hit a strange bug later, these are the first places to look.
Odin note: a language detail worth a moment's pause, usually with a link to the official docs.
Where to go next (before you even start)
Two pointers you'll see again at the end:
- For the whole Odin language, far more than this game needs, read Karl Zylinski's *Understanding the Odin Programming Language*. I teach the slice of Odin that Sköll uses here; Zylinski's is the thorough, standalone treatment, and the natural next step.
- For the same house style aimed at the web instead of the desktop, a game built from scratch down to the WebAssembly/browser boundary, there is a sibling volume, Yo Odin, freely readable at https://nofuss.co.za/yo_odin/. Neither book requires the other; they are mirror images.
My thanks are due to Ginger Bill and the Odin community for the language, and to Ramon Santamaria (raysan5) and the raylib contributors for the library that makes a game this small this much fun to write.
Right, let's find out what we didn't know we didn't know. Turn the page.