Five Games: Preface (Part 0)
It finally begins. This may end up being the longest chapter because there’s quite a bit I want to say before we begin, but I promise I’ll try to keep thing relevant to the topic. I can edit anything before I publish it anyways. To begin I want to inform the dear reader that the code I will be showing in this series will be mostly Odin code. I do plan on showing some examples in other languages though. To show you how you can easily take what you’ve learned here and transfer it to any other language, engine, or framework. Before I ask you to just follow along in my language of choice, I want to explain my reason for this decision, along with many other choices I’ve made for this series. If you have decided that you do not care and you are going to just trust me on this then feel free to skip ahead to Part 1 where we make Pong.
Why Odin & Raylib? Why not X Engine?
There’s a few reasons for this. An important one is that this series is NOT intended for programmers who already know what they’re doing. This is mostly for the artist, the newbie programmer, the person who woke up one day and decided they wanted to make games, this series is what I--knowing what I know now–would have liked to have when I first started learning to make games about 4-ish years ago. This is a series of tutorials focused on learning to solve problems with programming and not a How to Make X Game tutorial. And while we are not exactly creating everything from scratch, we are getting close. This means we get to focus on the fundamentals and learn how to build anything regardless of what tool we are using. This is something that a lot of people seem to find more daunting than just opening Unity or Godot and making a game, but I hope I can show you that it’s not impossible, it doesn’t have to take 10 years, and you ARE capable of making a game this way right now.
Okay, but why Odin and not C/C++?
To be honest I was going to do this in C/C-like C++ and thought that it would make it simpler for the reader if I were to start there and later show examples in C# so they can easily move to their engine of choice if they wanted to after completing this series. I decided pretty much right before writing this that I was going to just use Odin. It’s easy to setup and get working in any text editor, it’s batteries included so a single download will get you all the tooling you need, and maybe the most important thing of all is that it’s just a fun language to use. It’s a good choice to show you the joy of programming!
Why no AI? AI can make these games in a single prompt.
- You don’t need it
- It’s not worth it (for your brain or your wallet)
- This really isn’t so difficult that you need to offload the workload to an llm
- I just don’t care for it
How will this help me in Unity/Godot/Etc. when I’m done here?
I’ll say this here and now that I will plan to show some code for other engines and show exactly how you can take what you learn here and apply it elsewhere. This won’t be something I do frequently, but I’ll give you a few examples here and there to demonstrate how the language & tooling really isn’t important. Atleast not nearly as important as learning the fundamentals and learning how to take what ideas you have in your mind and actually build them with code.
The Setup
I’ve decided that since the dear reader may be learning to develop games in a completely different way than they’ve ever done so before, I would like to make the barrier to entry as low as possible. Since this isn’t really a series to turn you into a programmer, but moreso to turn you into a game developer, I’ll try to make this as simple as possible for and minimize the amount of things we need to download, but unfortunately we will still need to download a few things.
- Step 1: Required Build Tools
If you already have Visual Studio installed then you have the Visual Studio Installer and can skip to the final image in this step. If you don’t have Visual Studio then you don’t need to download it, but you do need to grab the build tools HERE:
This will give you an exe to run which will install the installer. Once done, open you installer and we want to check Desktop development with C++ and click install:
- Step 2: Install Odin
We can simple go to Odin’s releases on Github HERE. Scroll down until you reach the bottom of the release bubble, it should look like this:
Once we download that, we get a zip file that we can open. The top level folder in this zip may be called dist and inside there is everything. You can just take the dist folder and drag & drop it somewhere you like, then rename dist to Odin to make it easy to remember what it is.
Now let’s add Odin to our PATH. Copy the Directory that the odin.exe is in(if you renamed dist to odin then it would look like X:\…\…\Odin)
CLICK OK ON ALL 3 WINDOWS THAT YOU JUST WENT THROUGH. Sorry to scare you. If you just close the window it just might not save is all.
- Step 3: Download our Text Editor
If you know the basics of using a terminal, you can use any text editor you like. I’m using Emacs or more specifically DOOM Emacs. You could use something as bare as regular notepad if you wanted. If you want to bring your own text editor and learn how to build you game with the terminal it’s very easy. When we create a folder for our odin game we can just right click in our file browser and click Open in Terminal (if you have the option):
When your terminal opens just type
odin run .and it should run a build your game! To test it and make sure odin is working correctly, create a text file named main.odin (remove the .txt it adds to the end and it will change the filetype) and put this text inside it:package main import "core:fmt" main :: proc() { fmt.println("Hellope!") }If it didn’t work then go back and double check the other steps. Now if you are unfamiliar with text editors for programming, you can just use something like Visual Studio Code. This text editor is pretty popular so there are a ton of tutorials out there on how to use it and customize it. It also let’s you open a terminal inside the editor at the same directory as your project which make it very easy to build your game. This editor is something many people use for coding unity or godot games too. Once you download it you can check out this quick Video to learn the basics. When you learn how to install extensions you should be able to install the ols extension by Daniel Gavin and get some language support.
To test out building the same program that we wrote above, inside VS Code click File > Open Folder… and open the folder with your main.odin program in it. Then press Ctrl+/ to open the terminal and type
odin run .. You should see “Hellope!” inside the terminal after it runs and that means it works! You’re ready to make games! Odin is batteries included so getting it to work means you get all the cool librarys/frameworks along with it! Awesome right?
I don’t understand this language! Where do I learn it?!
There are 3 pages I ALWAYS keep open when working on projects in Odin:
- The Odin Docs to learn the basic language features
- The Odin Packages to search for specific features of the language or vendor library I am using
- The Raylib Cheatsheet to specifically learn what raylib has to offer
- Honourable Mention: Raylib Examples to see the library in use on some basic examples
I will cover more about how to use all of these resources in the following chapters so don’t worry if it feels like a lot looking at those pages right now. There’s a simple solution for all of it.
What to Expect? I’m scared!
The complexity of the games will scale as we progress so good news is we are starting with something VERY simple. Starting off I will also give you most of the projects code to get you started and so I can focus on teaching you why I make the decisions I do regarding the code and how I get to the solutions I came up with. I will be holding your hand and taking you on a tour through the museum, quizzing you every now and then to make sure you’re paying attention. Sometimes you’ll be given a safe space to work on your own code with the opportunity to experiment all you like. If you’ve never made a game before then this will be your first! And you’ll have built it all in 1 day!(if it took you longer then just tell everyone you did it in 1 day. It should take you less than 24 hours so that counts even if you spread it out)