How to get started with game programming

An unconventional approach to learning to code that worked for us (and might work for you?)

I make games with my wife, Rebecca. Earlier this year, she posted this tweet:

Besides a lot of encouraging replies, she also got a bunch of questions like:

  • “Where can I get started with programming?”
  • “What tips or tricks do you have?”
  • “How long did it take you to learn programming?”
  • And everyone’s favorite question, “What tools do you use?”

I figured I could give some insight into how Rebecca and I learned to code and try to give some broad answers to the questions people had.

The approaches we have are a little out there and only go over what worked for us. We don’t have much experience in teaching folks how to code, so what’s outlined here might not work for you. If you end up getting dumber after reading all this, please don’t get angry at me.

An important disclaimer

I taught myself how to program and have been working as a professional software developer for quite a few years since then, but I don’t actually do any of the programming on Ooblets.

A computer model from IT Simulator, a game Rebecca and I were working on

Rebecca handles all the programming as well as most of the art. If you haven’t figured it out yet, she’s pretty incredible.

I, on the other hand, focus on the game design, writing, and marketing (all of which she also helps out on). I don’t touch the code on Ooblets because Rebecca is much, much better than me at Unity, it’s often tougher for self-taught programmers to work together quickly, and because it’s a point of pride for us to say she single-handedly coded everything.

I mention all this because I’ve watched as she’s been underestimated while working in the industry and how people tend to make assumptions about what her role in things is. I’ve also seen all the work she’s put into everything behind the scenes, so it’s important to both of us that nobody can discredit or diminish what she’s doing. I hope everyone can relate to that in one way or another.

Quick reality check

There’s a common line of thinking that if you could just find the right approach, tutorial, toolset, or some simple secret, you could get to the finish line without years of hard work.

Unfortunately, we can’t offer that. We would have definitely taken such a route if it existed. It’s taken both us many years to become proficient at what we do and we’re still learning all the time.

That said, the tools do seem to get more accessible every year — but just remember, if what you’re doing is easy and accessible, there’s a good chance it’s not worth that much anymore.

Getting started before writing a line of code

One thing I distinctly remember about trying to learn how to code was how hard it was to take the very first steps. Getting a development environment going seemed beyond me at first. Just look at the instructions for installing Ruby on Rails these days (they sell a freakin book about it!).

If you’re not coming from a technical background, those first little steps can often be a huge wall.

So what should my first steps be?

This is probably not what a lot of other guides might say, but I would start with one of two things:

Factorio

1. Play Factorio

(or Rimworld or Human Resource Machine or Prison Architect)

Not really sure if you want to get into programming? Don’t really know what programming is? The above are some games that I think will help you determine if you’re going to have an interest in it. Beyond that, I think they’ll start getting your brain working in the way to work out problems like you do in programming. Game programming is all about building stuff and loving to build stuff, so if that’s not your thing, you might struggle a bit more.

Note: There are games that are more programmy than the ones I listed above, but they tend to have a higher barrier to entry.

2. Install Unity

Unity does a pretty good job at giving you everything you need to get going. In many ways it’s jumping into the deep end — but it’s what Rebecca got started in, so I know it’s definitely doable.

It’s got a huge user base so there are tons of tutorials and a lot of fellow noobs all asking the same sorts of questions you’ll be asking (and sometimes there will be answers to those questions).

But why?

The reason I’m not suggesting things like Scratch or Python or more traditional starting points is that I think it’s important that you get immediate feedback and progress towards the sort of things you actually want to build.

Learning in a vacuum where nothing you do directly translates to what you really want to build can be discouraging. You need to learn that you can actually make stuff to get that positive feedback loop going.

Tricks you probably shouldn’t use at this point

At this stage, you may have heard about some visual programming systems like PlayMaker or EU4’s Blueprints. From what I’ve seen, you can do some pretty impressive stuff with these, but I don’t think they’re a perfect base to learn from. You’ll still need to learn most of the fundamentals of programming to use them, but everything will be one step removed from you (and often in frustrating ways), and you’ll be limiting your available tutorials and answered questions dramatically.

Jump into your first project

Don’t worry about learning how to code. Think about what you want to use the code for.

Don’t just plop down in front of a video tutorial and think you’ll learn everything by osmosis. Even if you’re studiously following and coding along with the tutorial, you’ll still just be rote copying, which is a terrible learning method.

So what do you do instead?

Come up with a project and start making it.

Want to make a sprawling procedural space MMO? Let’s do it.

Yes, this is from Rebecca’s and my early space game attempt

A lot of folks will scoff at you, but at this point you need to have a target that actually interests you. Sure, you’ll struggle to even make a Pong clone and you’ll almost definitely fail to reach anywhere near your target, but you need to be excited about what you’re attempting so you’ll have the drive to solve all the problems you’ll face.

It’s okay to attempt something too ambitious. Everything you do when you start out will be ambitious. If you hit a serious wall or get excited about something else, it’s okay to drop what you were doing and change direction.

It’s okay to attempt something too ambitious

What is important for beginners here is to split all your goals into tiny itsy bitsy microscopic steps and focus on just the next immediate step. Move that cube across the screen, get a button to change color when you click it, make a cube follow another cube. Even a space MMO will need these things.

Look up solutions and tutorials for each of your tiny little tasks you get stuck on, so that way you’ll have a reason to commit that knowledge into functional use.

Fundamentals

The fundamentals of programming are actually pretty straightforward, but if you don’t know why you need any of them, they’ll seem completely obscure. Once you start wrapping your head around the limitations of turning code into a game, the fundamentals will start looking like obvious and basic building blocks.

Assorted asteroids by Rebecca

I remember many years ago when Rebecca was brand new to programming, I had tried to explain arrays and loops to her, but she just wasn’t getting it. A short time later when she was working on her own project, she wanted to modify a bunch of items but thought there must be a better way than writing a new line of code for each one. This time around, she figured out arrays and loops instantly. At that point, they weren’t some esoteric conceptual thing but rather a solution to a problem she understood because she ran into it.

If you want a leg up, here are the core concepts you’ll want to have a familiarity with:

  • Variables: Is this data a word, a number, or a spaceship?
  • Operations: Adding, subtracting, multiplying, etc. E.g. If your spaceship has 100 hp and take 10 laser damage, what are you left with? Take your time.
  • Functions: How to make the spaceship go pew-pew
  • Conditions: If my spaceship gets pew-pewed to 0 hp, make it explode
  • Classes: How to connect all the functions of your spaceship
  • Arrays: How to list your 10 million concurrent players
  • Loops: How to send a notification to each of your 10 million players to buy your DLC

When you get stuck

As you’re learning, you’re going to be constantly butting heads with the limits of your knowledge, the way you conceptualize problems, things that seemingly make no sense, and a barrage of weird syntax and techno-mumbo-jumbo, but this is normal.

Here’s what you can do when you get stuck:

1. Ask for help

This is what most people will jump to. God knows how often I call out to Rebecca whenever I try to do anything in Unity. BUT I’d suggest you don’t get too comfy with running for help. It can be a crutch, it can be slow (like when you ask a question on a forum and wait 3 days for a response), and it can be frustrating (to both parties).

An unnamed spaceship by Rebecca

2. Find another way around the problem

There’s no real shame in this one. Can’t figure out how to get revolving doors working? Change them to sliding doors. Can’t figure out how to make a realistic voxel world? Make everything big and blocky. As long as you don’t give up in general, you’ll fill in the gaps eventually.

3. Copy something you don’t understand

My personal favorite option. Find a couple snippets from Stack Overflow or something and try plugging them in until it does what you want. Eventually you’ll start understanding what these solutions mean, but until then you can at least keep moving.

4. Figure it out

This one is the toughest and least likely to be implemented suggestion. You can take the time to research the problem, read lots of documentation, try a billion different approaches, and figure out how to solve it yourself. If you’re into that sort of thing.

Now what?

If I can give one last piece of advice, it’s this:

Don’t wait for the planets to align to get started. If you want to do something, the most important step is to do it and not wait on everything to be perfect or easy or when you think you’ll be ready.

Commit to a plan, get your hands dirty, and find your own way.


Originally published on Rebecca Cordingley’s Patreon.