Programming in Odin for Absolute Beginners

In this tutorial series, we are going to be programming some very simple games in a language called Odin. As the title suggests, this series is intended for those who have never programmed in a systems-level programming language before. If you're coming to this tutorial as a person with prior experience, I would still be glad for you to read these articles and send me your feedback. Most of the content that we will cover in this tutorial will not differ depending on the operating system you are using. However, the installation steps below will be very much specific to Windows.


Why Odin?

I had originally intended to develop the games for this tutorial in C. However, due to the overcomplicated mess that is software in the modern age, even a very simple language like C can take quite a while to set up a development environment for. Because Odin is very similar to C in many respects, the information that we cover in this series will largely transfer if you choose to learn C or C++ in the future.


Development Environment Setup

Installing Visual Studio

The Odin compiler has a dependency on the linker provided with Visual Studio, so despite the fact that we will not be using Visual Studio in these tutorials, we will need to install it. You can download the 2019 or 2022 Community Version for free here. When you install the program, make sure to check the "Desktop development with C++" option. I hope you have 10 gigabytes of disk space you don't mind giving up, because Microsoft doesn't know how to distribute a program that's any smaller anymore. Once installation has finished, you can close the installer.

Installing The Odin Compiler

You can download the latest release here. On the release page, scroll down to the "Assets" and download the zip file for your operating system. Once you have this folder downloaded, I recommend that you extract all of the contents to a folder at the root of your system like "C:\odin". This will make things simpler when you add the compiler to your system path. Speaking of which...

Adding Odin to Your System Path

Open the windows settings menu and type 'path' in the search bar. You should see an option that says 'Edit the system environment variables'. Click on that option and a popup window should open. At the bottom of this popup window there is a button that says 'Environment Variables'. Click on it and there will be yet another popup window. On the bottom half of this window, there will be a section labeled 'system variables'. Scroll down until you see the entry for 'Path'. Click on 'Path' and then click on the 'Edit' button below. In this window, click on 'New' in the top right. Then type in 'C:/odin', or wherever you extracted you Odin files to. Make sure that wherever you placed those files is the place you want them to stay, because if you move them after this then you will need to update the entry in your system path again.

Text Editor

When it comes to setting up an environment in which to actually write code, you have quite a few options. At this stage in learning to program, my advice would be to keep things as simple as possible. You really don't need fancy rock candy syntax highlighting or language server features for most programming, and certainly not for the types of programs that we will be writing in this course. Notepad++ If you want nothing more than a simple text editor (or if you have no idea where else to start), just download Notepad++ and start writing code. Visual Studio Code If you would like to have syntax highlighting in your text editor and the ability to browse your project's files a bit more efficiently, you may want to look into using VS Code. I will not be spending any time on teaching how to use VS Code, but I'm sure there are plenty of outube tutorials to help you get started if you are an absolute beginner. The one thing I will advise is that if you use VS Code you should download the Odin Language Server extension. If I have the time later on, I may add some additional notes here about setting up debugging in VS Code, since that may actually be useful information. I personally have been using the Focus text editor lately and have found it to be a very pleasant experience. However, I will note that the editor is still quite new and I have occasionally had the program crash on me for unknown reasons.

Next time...

In the next article, we will be writing and compiling our first program in Odin. If you have any questions or feedback on this article, please send me an email at stuart_mouse@protonmail.com.

Next Article