Well, you’ve definitely got some ambition in you. Making a Video Game from Scratch is not an easy task. In fact, I would say it’s the hardest thing I’ve ever done, but you know what? It’s also the most rewarding. In this article I’ll help you get started and point you in the right direction.
So where to begin? First, I’m going to assume you’ve already made a game. If you haven’t, this is going to be a lot harder, mostly because I think it will be hard to understand the enormity of the endeavor you’re about to undertake. Make no mistake about the difficulty here.
Making a game is already hard, making it from scratch is a lot harder. You’re going to need to develop expertise is many, many different fields. Everything from coding a renderer, loading image data from file, making a compiler and scripting language… man. It’s a lot. But you can do it. I did. You will.
Let’s get started.
Why make a Video Game from scratch?
To learn. That’s the simple answer. What better way you can research, learn, and implement all of the following:
- Graphics Programming (OpenGL, DirectX, Vulcan)
- Gameplay Programming
- Systems Architecture
- Compiler and Programming Language creation
- Artificial Intelligence
- Physics
- Tools programming
- Data and code optimisation
Each of these could be someone’s fulltime career and they’d never need to learn anything else. But not you, no. You want to learn it all. And to successfully complete a game, even the simplist one, from scratch, will require you to learn all of this.
You will have the biggest sense of accomplishment when you’re done. And the journey is entertaining, engaging, and fun. It is fun to finally figure out how to get refraction on your 3D models working.
What does “from scratch” mean when making a Video Game?
This is the first question you need to ask yourself. It can mean different things to different people. Firstly, I’ll assume that you don’t want to use an existing Game Engine. That’s a given, right?
But does this mean you won’t use any existing libraries? So no SFML, no Ogre3D? What about FreeType2? Just how far you’re willing to go is up to you. But I’d recommend you think about what aspects interest you, and which don’t, and focus on the ones that do.
You should also consider the time you’ll need to invest in each of these areas. You might be interested in an area, but the amount of time you’ll need to dedicate to it may not be worth it.
As an example, here’s a list of libraries/SDKs that I used in my latest engine and the reasons why:
- OpenGL (but I loaded it myself, not GLUT or GLU) – I think it’s a bit too low level for me to write graphics drivers, so this seemed like a good starting point. I’m not familiar with Vulkan, and as I was working on a 2D engine, I saw no need for the low-level features it gave me.
- FreeType2 – If you look at the various font file-types and their specifications, you’ll see why I didn’t want to implement font-loading and glyph rendering myself. It’s a whole mess of decades of bad decisions that I didn’t want to unpick.
- Ogg/Vorbis – The file-format for Ogg seems a little bit too much for me to tackle loading myself in a reasonable amount of time. It’s well documented, so I might revisit it one day.
- WxWidgets – I don’t want to code using Win32
- OpenAL – I didn’t fancy interacting with WindowsAPIs at all, so OpenAL provided a nice wrapper around them and gives me some additional stuff.
Here’s what I implemented myself that could have been done with a library:
- Vector & Matrix Math – I could have used GLM or something
- Pathfinding – A* implementations already exist
- Scripting – I could have implemented Lua, instead I made my own language and compiler. I didn’t even use an existing lexer or parser, I coded those myself too.
- Noise Generation – I really wanted to learn this, the topic fascinates me. I could have used libnoise.
- User Interface – The biggest library I needed to code was the UI library. All the bottoms, panels, and scrollbars in a heirarchy complete with animations etc. A lot of fun doing this one.
Where do I begin in making a Video Game from scratch?
First jot down a game design document for you game. Identify what you need your code to do. Then separate it into disciplines.
Pick your favourite one, the one that interests you the most, and start googling. There’s a million tutorials on the internet (some on this website as well) that will help you get where you want to be.
Do not rely completely on tutorials though. Those of us who delve down this path you’re taking have come to appreciate specification documents. Really verbose tomes of lore. You’re going to need to read those, and you’re going to need to read books on the various subjects you’re interested in.
Anything else?
Of course, you’re going to have to make your own music and art. But that’s a topic for another day. Until then, you can learn how to make quick chip-tune music for your game.