If you’ve ever wanted to create a video game, you may know that coding is involved. For some people, they see coding as this impossible challenge, barring their way into the game development industry. Here in our modern times though, learning to code has never been more accessible!
However, getting started can definitely be a bit of a challenge if you’ve never touched a single piece of code in your life. So, how to learn coding is definitely not an intuitive process. With many different languages and game engines available, though, there are fortunately countless courses and tutorials to help you on your coding journey.
In this guide, we will help you take those crucial first steps on how to learn coding, so that you can more quickly spread your wings and start working on those dream projects you’ve had in the back of your head. If you’re ready to get started and learn how to code, let’s jump in!
What is Coding?
At its core, coding is a human writing down instructions for a computer to run (execute). That’s all code really is – instructions. Things like: store the player health, if the health reaches 0 show the game over screen, etc. The computer reads the code and does exactly what it says. But to get from you typing out the code to the computer running it, there are a couple of steps.
- First, you as a the human sit behind a computer and write code into a program known as an IDE (integrated development environment). Basically a text editor designed for coding.
- Then, that code is compiled which means it’s broken down into 1’s and 0’s for the computer to read. At this level, the code (machine code) is unreadable to humans, but for the computer – it knows exactly what to do.
- Now it can be executed and you can begin to use your program or play your game.
Like with our real-world languages, there are also a number of different coding languages. Which one you should learn depends entirely on the types of games you’d like the make and the game engine you choose.
One good thing about coding languages, is that pretty much all of them share the same core concepts. This means you can learn one language and have a basic understanding of others. It’s just the syntax (grammar) that’s different. Of course, some languages have their own quirks and way of doing things (especially based on how close it is to machine code), but at its core – there are the fundamental concepts of coding:
- If statements
Learning one coding language opens up all others and makes the learning process much easier. So if you want to know how to learn to code, always start by just picking up these fundamental aspects in any language! Of course, you may want to dive more into what coding is, so before moving to the next section, you can check out our What is Coding and Why Learn to Code? article or our What is a Developer? Getting to Know the Industry article.
Choosing a Game Engine
Coding games can be a difficult journey. What can make it a lot easier though, is to use a game engine. A game engine gives you the basic foundations such as rendering, physics, inputs, etc, so you can jump straight into coding all the good stuff. Many people want to code their own game engine from scratch, although for a beginner, I do not recommend that. Creating the engine in many cases can take longer than the actual game and it’s a very difficult and tedious process. Using an already established engine can help make your development process a lot shorter and create a much more polished final product.
Here’s a list of some popular game engines:
- One of the most popular game engines out there for beginners, Unity gives you tools to create pretty much whatever type of game you want. 3D, 2D, VR, AR, multiplayer, etc.
- Coding Language: C#
- Pros: most popular game engine, large amount of learning resources, very versatile.
- Cons: compared to the other engines, Unity has disadvantaged graphics and 2D.
- Unreal Engine
- Unreal has a focus on graphics and is used by many AAA studios.
- Coding Language: C++
- Pros: graphically amazing, used by AAA studios.
- Cons: large game file sizes.
- Godot is an open-source game engine with a heavy community focus. It’s similar to Unity in what you can create and is constantly growing.
- Coding Languages: GDScript (similar to Python), C#, C++
- Pros: open-source, lightweight, versatile, excels at 2D.
- Cons: less feature-rich compared to other engines, not a large number of learning resources.
- Phaser is an open-source framework for Canvas and WebGL games.
- Cons: limited to what platforms you can build to.
- GameMaker has been around for quite some time and is great for creating 2D games.
- Coding Languages: GML, C++
- Pros: great 2D, large amount of learning resources.
- Cons: uses its own custom language.
- Pygame is a framework for games made with Python.
- Coding Language: Python
- Pros: lightweight Python framework.
- Cons: Python is not generally used for game development.
That’s quite a list, but where should you start when you’re discovering how to learn coding?
I’d recommend trying out a few engines to see which one suits you best, and even reading a bit more about each one. If you’re not sure about what types of games you’ll want to create, I’d recommend either Unity or Godot for their versatility. Either way, though, a game engine will help ease the process of learning how to code immensely!
Creating Your First Game
So you’ve got your game engine, now it’s time to start coding a game – yes, just doing it is part of the process of how to learn coding! You may have an idea of what game you want to create but I can almost guarantee that the scope is too large. When first learning to create games, you need to start small. Most people recommend re-creating a simple retro game such as Pong or Breakout. These games have a small scope, basic graphics, and simple mechanics.
Okay, so we’re ready to make a game but what do we actually make first? I always like to start with the player controller. That being a platformer character or a paddle from Pong, try and create the player first and we can build out from there.
Next, what does the player need to do? In Pong, they need to hit a ball, so we can implement that. When coding a small game like this, it’s always best to start with the player and expand from there.
- Begin coding the actual player so you can get a feel for the game.
- What does the player do? Start coding that into your game so your player has something to interact with.
- What is the player trying to achieve? This may involve coding the win state for your game. In Pong, for example, this is detecting when the ball has gone past an opponent’s paddle.
Knowing or Understanding Coding
There’s a difference between knowing how code works, and understanding how code works. Knowing is taking in the information and having that stored in your mind. Understanding involves being able to apply it in new circumstances. Both are vital and come at different times. Watching courses and tutorials will give you the knowledge of how to code, but only through doing it yourself – will you truly understand it and actually learn how to code.
When you’re learning coding, I highly recommend you follow along and create the content alongside the presenter/teacher as that’s the best way for it to soak in. Also, work on your own projects. Giving yourself a coding challenge will help you develop your problem-solving skills and further understanding of the coding language/game engine.
Below are a bunch of learning resources for game development and coding languages.
- Intro to Programming Bundle
- Unity Game Development Mini-Degree
- Unreal Game Development Mini-Degree
- Learn Python Programming by Making a Game
- Unity 101 – Game Development and C# Foundations
- Phaser 101 – Introduction to Game Development
- Python 101 – Introduction to Programming
- How to Program in C# – by Brackeys
- How to Program in C++ – by The Cherno
- How to Program in Python – by Microsoft Developer
- How to Program in GDScript (for Godot) – by Godot Tutorials
- How to Program in GML (for GameMaker) – by Let’s Learn This Together
Relevant Informational Articles
- Best Programming Languages to Learn to Code: 2020 Edition
- Learning How to Code: Coding vs. Programming
- Developer Job Prospects: In-Demand Industries for 2021
- How to Code a VR Game
- How to Code an AR Application
We hope that this short guide has given you, at the very least, some food for thought as you figure out how to learn coding. Even if your ultimate goals aren’t to create games, much of the same principles apply for other subfields – you’d still learn a language, still choose a helpful framework or engine, and still focus on making a project. So regardless of where coding leads you, these fundamentals will serve you well in learning to code.
Ultimately, how to learn coding is up to you as well, as everyone learns differently. Nevertheless, the resources here are a great start, so good luck with your learning journey, and we can’t wait to see what sorts of games you develop!