Odin is a manually memory managed language. Beginners of such languages are often afraid of memory leaks, meaning that you forget to deallocate memory. The first remedy for this is to use the tracking allocator. It will warn you about memory you forgot to deallocate. Nifty! But you can also think along these lines: Can I simplify things a bit, so I don’t have to think about the deallocation? What you can do is to try to use the temporary allocator whenever possible.| zylinski.se
In my book Understanding the Odin Programming Language I wrote that “Odin incorporates some of my favorite C best practices, straight into the language”. But I didn’t really elaborate on the details. Let’s do that here! This brings me to talking a bit about a previous job I had. Back in 2021 I worked at a place called Our Machinery. We were creating a whole game engine in plain C. We used a very comfortable and powerful way to program C.| zylinski.se
Games can be made in many different ways. Many games are made using big, general purpose game engines such as Unity and Godot. I enjoy using the Odin Programming Language combined with Raylib. Odin is a C-like programming language and Raylib is library for drawing graphics, checking input and playing sounds. So it’s just a program that uses a simple library, no engine! There are no objectively best ways to create games.| zylinski.se
In my post “Handles are the better pointers”: An Odin gamedev follow-up I talked about how one can implement a handle-based map in Odin. In this post I want to follow that up by talking about three specific variants of a handle-based map, and highlight what sets them apart. The three variants are available in this repository: https://github.com/karl-zylinski/odin-handle-map NOTE: In the old post I used the term “handle-based array”, I’ve since then switched to saying “handle-based...| Posts on Karl Zylinski
I’ve written a binding generator for Odin. You can check it out here: https://github.com/karl-zylinski/odin-c-bindgen In this blog post we’ll look at what it is and how to use it. What is it? This binding generator takes header files from C libraries and outputs Odin code. This Odin code can then be used to interface with the library. This code is known as “binding”: It glues the world of Odin together with that of the C library.| zylinski.se
When programming in Odin you can use arena allocators. If you use an arena allocator combined with a dynamic array, then there are a couple of pitfalls that may not be apparent at first. Let’s look at what arenas are, how you can run into trouble when naively using them with dynamic arrays and what you can do instead. What’s an arena? How does it work? Arenas and arena allocators are useful for grouping allocations that have the same lifetime.| zylinski.se
Background Andre Weissflog wrote an article in 2018 called “Handles are the better pointers”. In it he talks about how one can use handles instead of pointers when one wants to store permanent references to elements in an array. I think there are many nuances regarding handles that only become apparent after some real-world usage. Here we’ll look at an implementation in Odin and discuss it. I use the Odin Programming Language and the examples are game development-centric.| zylinski.se
In this post I’ll share some details on how I wrote the first book about the Odin Programming Language. I’ll talk about how I got started, what the process was like, as well as some technical things related to writing programming books. This book is called “Understanding the Odin Programming” language. It’s a digital book (HTML and EPUB). It was released on December 6, 2024. The book is available at https://odinbook.| zylinski.se
If you are a game developer then you might have heard about data-oriented design. You might have read that programming in a data-oriented way can make your game run faster. However, if you come from some object oriented approach then the ideas you’ve seen can feel a bit overwhelming. It may seem like you need to completely redo all your gameplay code. Where do you even start? So let’s try to keep it simple.| zylinski.se
This post is about what hot reload for gameplay code is, why you would use it and what the limitations are. I’ll also present an example implementation in Odin Programming Language. The final section is on some caveats, improvements and how to use hot reload in Odin together with Raylib. The front parts are language agnostic while the further down you read the more Odin specific it gets. The methods I will outline here are for people who are writing their own game ‘from scratch’, meanin...| zylinski.se