An Introduction To Making Games (With GameMaker)

There was a time when making a game as simple as the Atari 2600 classic Combat required 6 months of constant work not simply by professionals, but by the people who developed the hardware that the game was running on. We could not have come further from that point today, and right now anybody with a computer, a little bit of time and enough dedication can make a fully playable game that far surpasses the complexity of anything made before 1983. Even better, they can often do it in less than a day. In this post, and a few after, I want to give you the tools to do so.

Before I get into it, I want to be clear that I HATE math and will do anything to avoid it. I am also not a computer science student: I’m in the fourth year of a Philosophy degree, which is as liberal arts as you can get. Until early last year, the only programming that I had any experience with was a very poor Java class in high school. Fortunately a designer from Telltale encouraged me to become familiar with Gamemaker, and on my own time, with a minimum of math, I was able to learn these skills and start experimenting with game ideas that had lived in my head for years. I just want to make it clear that anybody can do this, and many rumours about the skills needed are greatly exaggerated.

So where do I start?

Well, there are lots of ways that you could start. You could start by making mods for other games, or just make new levels and models for them. Those things are completely valid ways to start, but I’m going to assume that you, like me, want to focus on developing actual game mechanics. This means learning a game development toolset. There are many options out there, and depending on your prior experience with code you might want to go somewhere else. What I’m going to talk about here is the free 2D development software Gamemaker.

What is that?

GM is a shareware level editor, code editor, art editor, and 2D engine (it has 3D in the paid versions, but that’s not really its forte and we won’t talk about it here). It is powerful, flexible, and the recently released (and rather expensive) studio version supports development for many mobile platforms along with Windows and Mac. It has its own proprietary programming language called GML that is conceptually similar to, but not easily translated into, Java and C#.

Why are we using GM if its language is proprietary?

It certainly has many things to recommend it, but most important for our purpose is that it is a fantastic learning tool. This is because you can make a complete game for it without writing a single line of code. It features a drag and drop (D&D) system that allows you to give things in the world (objects) behaviours using an entirely graphical interface. This allows you to quickly build a reasonably complex game of your own design without having to worry about code structure or anything.

That’s all well and good, but there’s a second part to the learning process. At some point you’ll be working on your creation and realize that there is no simple way to do something using D&D. Since you love this idea to death and it would kill you not to have it, you will steel yourself and add an “attach code box” to one of your objects. It is likely that your first code will be full of bugs, and that you’ll have your eyes on the Gamemaker code reference site most of the time, but that’s ok. You’re learning. This is what learning feels like...

Well anyway, that’s what happened to me. Basically, this is a way to learn the theory behind programming without having to learn an actual language first, and to do it in an environment where the really complex work (such as collision detection) is already done. If you stay on with game making you will eventually want to learn something like C# so that you can use a more robust engine like Unity, but doing this first will give you the basics. And hey, Spelunky was originally developed for Gamemaker. In fact, the code for that game is freely available so if you want to see what is possible with these relatively straightforward tools, you can take a look at that.

That’s great, but I don’t even know where to start with this program. SO MANY BUTTONS!

Unlike most guides, I’m not going to tell you exactly where to click and what to type. I’m assuming that you are smart enough to figure out or Google that stuff. I find that I get frustrated by tutorials that explain in too much detail and start to miss things. This may not work for you, in which case there are many other very good guides out there and I certainly recommend that you check them out.

To begin with, you’re going to want to start a new project instead of using the example one that comes up when you do a fresh install of GM. Once you’ve done that, you’ll also need to create a new room. Every game must have a room (read: level) in it to run. In fact, if you press the green triangle on the toolbar you will be able to run this game! Of course it won’t do anything because it’s missing, you know, stuff.

The next thing that you’ll want (in 99% of cases) is an object for the player to control, so make a new object and call it “playerObject”. Almost everything that happens in the game will be done by and to objects. This is analogous to the way that we think about real physical space, and this type of programming is called “Object Oriented Programming,” or OOP.

Now that you’ve created an object, you’ll need to give it a sprite. You can use any image you like, and GM will adjust its in-built collision detection to transparencies so feel free to use a shaped image. Now go back to your room and (using the room editor’s objects tab) place an “instance” of playerObject into it. At this point we should note that “objects” and “instances of objects” are different from each other. I should hope that difference is intuitive, but if it isn’t you can think about the object as being the blueprint for a car, while an instance is the car itself. You can have many cars built from the same blueprint, and if you have an accident in one car it won’t have any effect on the others.

Now if you run the program (the green triangle again) an instance of your object will show up wherever you put it in the room. Of course it won’t do anything, because it needs some “behaviours” attached to “events.”

Close the game and go back to playerObject. See that “add event” button? Press it and create a keyboard event for whatever button you want to use to move the object up. Now add one of the “move fixed” boxes from the menu on the right (it’s the red one with all the arrows in it). It will ask you for a direction and some values. We’ve already decided that’s it’s moving up, and you can pick a speed. I’d recommend something small like 2 or 5, because if it’s too big your object will just run off the screen.

Now if you run your program, you can make your instance of playerObject go up. Woooo! Now, what exactly did we just do?

Time in GM is measured in frames. By default it runs games at 30 frames per second, so your object is checking the keyboard 30 times and performing its behaviour every time it find that you are pressing you’re up key. Learning what order code is being run at will be very important later, but for now this basic understanding of framerate is all that you need.

Ok, what now?

You’ve probably seen many exciting buttons and functions while doing this, so my suggestion is that you think of a type of game that you want to make (something relatively simple) and start experimenting with what kinds of events should trigger what kinds of behaviours. You’ll probably want object collision events, and you may want to mess with the room settings like size or resolution. Or not, the sky is the limit!

Wait, don’t leave me!

Relax; I’ll happily answer anybody’s questions in the comments or by PM. At some point soon I plan to write a guide exploring some more advanced features and concepts that I didn’t discover till later, and then after that I want to look at some ways to stay organized and write code (yes, code!) in ways that would have made my life much easier if somebody had shown them to me when I started out.

Go forth and make games!

(To inspire you, here is a prototype that I made from scratch for my “game design and development” class over the weekend. While there is certainly much that needs to be done with this particular project, it shows you how quickly you can build a game if you take a small amount of time to learn some tools!)

18 Comments
19 Comments
Edited by nintendoeats

There was a time when making a game as simple as the Atari 2600 classic Combat required 6 months of constant work not simply by professionals, but by the people who developed the hardware that the game was running on. We could not have come further from that point today, and right now anybody with a computer, a little bit of time and enough dedication can make a fully playable game that far surpasses the complexity of anything made before 1983. Even better, they can often do it in less than a day. In this post, and a few after, I want to give you the tools to do so.

Before I get into it, I want to be clear that I HATE math and will do anything to avoid it. I am also not a computer science student: I’m in the fourth year of a Philosophy degree, which is as liberal arts as you can get. Until early last year, the only programming that I had any experience with was a very poor Java class in high school. Fortunately a designer from Telltale encouraged me to become familiar with Gamemaker, and on my own time, with a minimum of math, I was able to learn these skills and start experimenting with game ideas that had lived in my head for years. I just want to make it clear that anybody can do this, and many rumours about the skills needed are greatly exaggerated.

So where do I start?

Well, there are lots of ways that you could start. You could start by making mods for other games, or just make new levels and models for them. Those things are completely valid ways to start, but I’m going to assume that you, like me, want to focus on developing actual game mechanics. This means learning a game development toolset. There are many options out there, and depending on your prior experience with code you might want to go somewhere else. What I’m going to talk about here is the free 2D development software Gamemaker.

What is that?

GM is a shareware level editor, code editor, art editor, and 2D engine (it has 3D in the paid versions, but that’s not really its forte and we won’t talk about it here). It is powerful, flexible, and the recently released (and rather expensive) studio version supports development for many mobile platforms along with Windows and Mac. It has its own proprietary programming language called GML that is conceptually similar to, but not easily translated into, Java and C#.

Why are we using GM if its language is proprietary?

It certainly has many things to recommend it, but most important for our purpose is that it is a fantastic learning tool. This is because you can make a complete game for it without writing a single line of code. It features a drag and drop (D&D) system that allows you to give things in the world (objects) behaviours using an entirely graphical interface. This allows you to quickly build a reasonably complex game of your own design without having to worry about code structure or anything.

That’s all well and good, but there’s a second part to the learning process. At some point you’ll be working on your creation and realize that there is no simple way to do something using D&D. Since you love this idea to death and it would kill you not to have it, you will steel yourself and add an “attach code box” to one of your objects. It is likely that your first code will be full of bugs, and that you’ll have your eyes on the Gamemaker code reference site most of the time, but that’s ok. You’re learning. This is what learning feels like...

Well anyway, that’s what happened to me. Basically, this is a way to learn the theory behind programming without having to learn an actual language first, and to do it in an environment where the really complex work (such as collision detection) is already done. If you stay on with game making you will eventually want to learn something like C# so that you can use a more robust engine like Unity, but doing this first will give you the basics. And hey, Spelunky was originally developed for Gamemaker. In fact, the code for that game is freely available so if you want to see what is possible with these relatively straightforward tools, you can take a look at that.

That’s great, but I don’t even know where to start with this program. SO MANY BUTTONS!

Unlike most guides, I’m not going to tell you exactly where to click and what to type. I’m assuming that you are smart enough to figure out or Google that stuff. I find that I get frustrated by tutorials that explain in too much detail and start to miss things. This may not work for you, in which case there are many other very good guides out there and I certainly recommend that you check them out.

To begin with, you’re going to want to start a new project instead of using the example one that comes up when you do a fresh install of GM. Once you’ve done that, you’ll also need to create a new room. Every game must have a room (read: level) in it to run. In fact, if you press the green triangle on the toolbar you will be able to run this game! Of course it won’t do anything because it’s missing, you know, stuff.

The next thing that you’ll want (in 99% of cases) is an object for the player to control, so make a new object and call it “playerObject”. Almost everything that happens in the game will be done by and to objects. This is analogous to the way that we think about real physical space, and this type of programming is called “Object Oriented Programming,” or OOP.

Now that you’ve created an object, you’ll need to give it a sprite. You can use any image you like, and GM will adjust its in-built collision detection to transparencies so feel free to use a shaped image. Now go back to your room and (using the room editor’s objects tab) place an “instance” of playerObject into it. At this point we should note that “objects” and “instances of objects” are different from each other. I should hope that difference is intuitive, but if it isn’t you can think about the object as being the blueprint for a car, while an instance is the car itself. You can have many cars built from the same blueprint, and if you have an accident in one car it won’t have any effect on the others.

Now if you run the program (the green triangle again) an instance of your object will show up wherever you put it in the room. Of course it won’t do anything, because it needs some “behaviours” attached to “events.”

Close the game and go back to playerObject. See that “add event” button? Press it and create a keyboard event for whatever button you want to use to move the object up. Now add one of the “move fixed” boxes from the menu on the right (it’s the red one with all the arrows in it). It will ask you for a direction and some values. We’ve already decided that’s it’s moving up, and you can pick a speed. I’d recommend something small like 2 or 5, because if it’s too big your object will just run off the screen.

Now if you run your program, you can make your instance of playerObject go up. Woooo! Now, what exactly did we just do?

Time in GM is measured in frames. By default it runs games at 30 frames per second, so your object is checking the keyboard 30 times and performing its behaviour every time it find that you are pressing you’re up key. Learning what order code is being run at will be very important later, but for now this basic understanding of framerate is all that you need.

Ok, what now?

You’ve probably seen many exciting buttons and functions while doing this, so my suggestion is that you think of a type of game that you want to make (something relatively simple) and start experimenting with what kinds of events should trigger what kinds of behaviours. You’ll probably want object collision events, and you may want to mess with the room settings like size or resolution. Or not, the sky is the limit!

Wait, don’t leave me!

Relax; I’ll happily answer anybody’s questions in the comments or by PM. At some point soon I plan to write a guide exploring some more advanced features and concepts that I didn’t discover till later, and then after that I want to look at some ways to stay organized and write code (yes, code!) in ways that would have made my life much easier if somebody had shown them to me when I started out.

Go forth and make games!

(To inspire you, here is a prototype that I made from scratch for my “game design and development” class over the weekend. While there is certainly much that needs to be done with this particular project, it shows you how quickly you can build a game if you take a small amount of time to learn some tools!)

Posted by vonFlampanker

Very nice post! I've been looking into these non-programmer focused game making programs ever since I heard Patrick talking about them during the MolyJam coverage. I got into GameSalad instead of GameMaker, but they're both quite a bit more powerful than I thought they'd be. I may go back and, based on what you've written here, try to see if GameMaker offers an easier time for implementing some of the bits of my game.

Do you find that GM has a decent amount of reference available online in the form of forums, faqs and documentation? GS' is growing and friendly but I find it's still somewhat lacking for specific problems.

Many thanks for the introduction to GM. Good luck!

Edited by nintendoeats

@vonFlampanker: Your welcome!

There is a ton of reference material out there for GM, and the forums are very active so you can always get help with a problem. There are also large repositories of scripts and extensions for GM, that are often very useful. GM has been around for 17 years, so it's had a long time to develop a community support base. I should say that I have had experiences with some rather unfriendly people in the forums, but that's not a universal rule.

I tried to install Gamesalad to offer a comparison, but it refused to install. Am I correct in saying that it doesn't have any programming language at all? Based on a quick scan of the internet, it seems like the D&D functions of GS are a lot more powerful (and user-friendly) than GM. However, if it doesn't have theoption to use a programming language it might not be as powerful overall or nearly as effective as a learning tool. I might try to install it later and see if I can't do a more in-depth comparison.

Posted by vonFlampanker

GameSalad has no proper programming language, correct. There's an expression editor, which seems useful but also seems to be lacking a proper guide/introduction for the math-averse like us. It also handles tables without the need to code, which I've found pretty useful.

I think GS is having some trouble with the Windows version of their client. Similar to your experience, it'll install but it won't launch. The Mac client, however, is pretty elegant from a UI standpoint (though there are areas where they could improve), and allowed me to get surprisingly far into my project before hitting any sort of wall (I'd say my project is as complex as an average NES game).

It's a good time to be doing projects like these, and I'm looking forward to these tools getting even better.

Posted by nintendoeats

@vonFlampanker: What exactly is the "wall" that you have hit? I'd be very interested to to see what you're doing. If you are that far along, I wouldn't bother trying to move over to a new toolset until you are working on a new project, unless you are lacking some really core functionality.

Posted by vonFlampanker

@nintendoeats: I've run into a couple of seemingly simple problems that turned out to be complex. For instance getting an object instance to pivot on a point other than its midpoint (to, say, open a door in a top-down view). My forays into AI behaviors haven't been very encouraging, either.

I also realized at a certain point that I was putting too many unique behaviors for each instance. That is there were too many custom, hard-coded instances when they should have been inheriting a common set of behaviors from the Prototype (GS lingo for "Object"). Going back and trying to do it "properly" so to speak has created some weird anomalies that I can't pin down. When I get some time I'll post some pictures/video of what I'm talking about. There's also the possibility that my understanding of structuring things "properly" - based on my half-ass research into OOP - is just bound to cause more problems and I'm better off just barreling forward doing things the way I know how.

Meant to mention: a nice thing about Gamesalad is its ability to target devices for export. It gives you a lot of options for iOS publishing alongside more generic desktop resolutions.

Posted by NickyDubz

It's cool your doing this always nice to see people at least explore development makes you appreciate the games and software you have ten fold

Posted by Sin4profit

As someone only curious about game development i appreciate this kind of thing, thanks.

One question about Game Maker; Does it have controller (specifically analog control) support?

Posted by nintendoeats

@NickyDubz: It really does. of course I want to develop games professionally so it was necessary, but even if you don't it's worth doing.

@Sin4profit said:

One question about Game Maker; Does it have controller (specifically analog control) support?

Yes and no. It has joypad support, but the built in support is digital only and not especially good. However, there are extensions (all of which require some GML work) which add excellent support for 360 and other controllers. I particularly recommend Sinazxinput, which was made by the guy who introduced me to GM. I would be happy to both send it to you and show you how to use it.

Posted by nintendoeats

@vonFlampanker: In GM how we would handle that is changing the origin point on the sprite, since in GM all rotations happen around the origin and not the sprite center (I should also note that rotation is the only really important feature not available in the free version). I actually had to do top down doors, and man are they a pain! Could you possibly import a sprite with a stretch of transparency on one side so that the center of the whole image is actually the side of the visible door? Just a thought.

Posted by ZombiePie

Using GameMaker could someone make a not broken NBA game within a period of one year?

Anyways good write up.

Moderator
Posted by nintendoeats

@ZombiePie: Hahaha!

Yes actually, if they managed their scope properly based on the time that they were able to commit to the project.

Posted by ZombiePie

@nintendoeats said:

@ZombiePie: Hahaha!

Yes actually, if they managed their scope properly based on the time that they were able to commit to the project.

So break it down for me...what's your average of minutes of gameplay to broken avatar?

Moderator
Posted by nintendoeats

@ZombiePie said:

@nintendoeats said:

@ZombiePie: Hahaha!

Yes actually, if they managed their scope properly based on the time that they were able to commit to the project.

So break it down for me...what's your average of minutes of gameplay to broken avatar?

In my case, because I tend to use a lot of fast moving objects and image rotations, it's minutes to the player getting stuck in something that will inevitably kill them. I believe that this is an analogy for the the violence of nature, and choose to leave it in.

So in that case it would be 0.1 minutes on my first project...but hopefully never from now on.

Posted by Tim_the_Corsair

Great post, thanks.

I've always flirted with level and mod making in games, but never made the leap into the actual development stuff.

I actually have been talking an idea over with the wife in recent times for what I think could be a totally decent, relatively simple Worms-style game with a major twist, perfect for mobiles and tablets, maybe I'll take a look into this and/or Gamesalad.

The idea of little to no math is appealing, as that has always been my stumbling block (I'm a wordsmith and even basic division scares me)

Posted by nintendoeats

@Tim_the_Corsair said:

The idea of little to no math is appealing, as that has always been my stumbling block (I'm a wordsmith and even basic division scares me)

People talk about needing math, but that's only half true. You need to be able to occasionally look up a mathematical concept to get the behaviour you want, but you should never have to DO any math. you are basically using an 800 dollar calculator, there is no reason that you should have to do any of the calculations. I'm in the same boat as you and I figured it out just fine. So give it a shot!

Posted by SexyToad

So this is just a program that makes games? Then I started learning C++ for nothing! But I'm assuming this is just for small games? Or have there been pretty decent games made like this?

Posted by c0l0nelp0c0rn1

@nintendoeats: Got any tips on building a wiki style web application for a repair depot? I'm tired of not being able to look up part numbers/repair processes.

Online
Posted by nintendoeats

@SexyToad: If all you want to do is make games, C++ is WAY more complicated than you'll ever need (unless you want to make game engines).

As I mentioned, Gamemaker was the program that was used to build the PC version of Spelunky, so that gives you a sense of what it can do. It is a very capable 2D engine that can be used to do 99.9% of what you might want. There are some things that make it unsuitable for large-scale development, and Yoyo seems to be working to fix those. On the whole however, at this point in time it is most useful for hobbyists and for developers to develop quick prototypes. I recommend it highly as a learning tool, or for very small indie devs who don't have strong programming skills.

@c0l0nelp0c0rn1 said:

@nintendoeats: Got any tips on building a wiki style web application for a repair depot? I'm tired of not being able to look up part numbers/repair processes.

I don't, but if you are serious I do know people that I could ask very easily.