How to Learn Game Coding (for kids)

I recently got a list of questions from a friend’s elementary school-aged son, asking about game programming (or “coding”, as the kids call it nowadays 🙂 )

I’m posting my answers here because I know that it’s a popular topic for a lot of young people.  

Q: How do you make a game from scratch?

There are a lot of ways to make a game nowadays, but I would recommend PICO-8.  It has everything you need to make small, fun games using code.

By using it, you’ll learn about the different parts that make up a game.  For example, “sprites” are the images for things like spaceships, characters, and explosions.  You can program them to move around and animate when you press a button.  You will also learn how “collisions” work, like how to make a ship explode when a bullet runs into it.

Once you learn those things, you can try making bigger games using more advanced languages, or just keep getting better at making cool PICO-8 games.

Also, making a game involves other fun things aside from coding — like art, storytelling, music, sound effects, and interaction design (making a program easy to use).  You can learn all of those things just by making games.  You might even find out that you like them better than coding.

Q: How do you learn to code?

I believe the best way to learn to code is:

   1) Pick a language that is easy for beginners (like PICO-8 or Python), and

   2) Make a small program or game that interests you

Programming takes a LOT of trial and error.  Bit by bit, you add new lines of code to your program and you have to keep checking to see if it still works.  It’s like a snowball that gets bigger and bigger as it rolls down a hill.  You start with a tiny program and add more as you go.  

This takes a lot of patience, because you’ll spend a lot of time fixing mistakes (also known as bugs).  That’s why it’s important to learn by working on a project you like!  If you just learn coding from a book, you might get bored and give up more quickly.

It’s also important to pick a project that is small.  A lot of people try to make games that are too big, so they spend a lot of time and never finish them.  Even a small game can take many days or weeks to finish, but it will teach you a lot.

Q: Why did you start coding?

I started learning the BASIC programming language when I was about 7.  Like most kids, I did it because I wanted to make games.  When I got older, I became interested in making cool web sites and that’s where I learned more advanced programming.

I still write code because programming lets me be creative and I can make things that other people can use.

Q: What kind of code do you like the best?

I try to write code in a way that is easy for me to understand when I come back to it later.  Sometimes it’s not easy to figure out what code does, even if I wrote it myself!  Writing code is a bit like writing in English.  You want to be as clear as possible.

There is no one programming language that is the best, but I prefer languages that are easy to use.  Nowadays I program in JavaScript and PHP.  In the past, I have programmed in Java, Perl, BlitzMax, HaXe, and CoffeeScript. I even created my own programming language called THT so that I could use it to make websites more quickly.

Good luck!