Making Video Games: Where to Start (Patreon)
Content
A few people in the poll we did earlier mentioned an interest in game development. We thought we’d make a little post on the topic for anyone who is curious about it. This is a basic post for beginners, but we might get into more detail in future posts.
The thing to know about programming video games is… it can be pretty easy. You can make it complicated if you want, but if you want to make a simple choose-your-own-adventure game, you barely have to code at all.
Here’s a sample piece of code from a hypothetical game. We’ve used a program called Ren’Py for all our games except Boxing Day and the upcoming Bully Campus, and the vast majority of other English-language visual novels also use this program because it’s free, pretty easy to use, and has been around for a long time.
There are two main parts to a video game: code and assets. Assets are things like art, music, and sound effects. Code is basically just a set of instructions to tell the assets what to do. In a simple visual novel, all the code is doing is telling art when to appear or disappear, when a sound effect should play, when music should fade in or our, when the background should change etc.
Let’s look at the first block of text. You’ll see that it says “label” in one color and “start_game:” in another. “Label” is basically just the word that Ren’Py uses for a chapter or a scene. In this case “start_game” is the name of this particular block of text. A colon at the end of the line signals the start of a new block—after a colon, you indent the next line and every other line that’s part of that block.
In this block, you see “scene bg campus”, “show kali neutral”, “show ilya neutral”, and “play music jazz”. “Scene” is a reset word in Ren’Py—it gets rid of what the screen is currently displaying and displays a new image (in this case a background image called “bg campus”). The next lines show images of the characters Kali and Ilya. Each name is followed by “neutral” because these characters sprites have other emotions—there is also a “kali sad” image and a “ilya happy” image for example. That code is more or less how you create a scene that looks like this:
Ren’Py gives a lot of options for how to define images, but if you don’t want to mess with code, you could theoretically just make an image called “bg campus”, an image called “kali neutral”, and an image called “ilya neutral”, then drag all three into the “images” folder of your Ren’Py project.
The rest of the code shows a choice. In Ren’Py “jump” means go to a new label, similar to when a Choose-Your-Own-Adventure book has “turn to page X”. That's how you create branches in the story like in this screenshot:
The very bottom of the page of code has some variables and starts to look a little bit less like a screenplay and more like “real” code. Maybe it looks complicated, but what it does is extremely simple—it just picks a word randomly from a list of possibilities, then inserts that word into the dialogue that the characters are saying. You use variables like this when, for example, you want to let players name themselves. Our games get more complicated than this with the code, but a lot of it is based on similar ideas.