I received an email the other day from one of our readers asking a few questions on how to learn game development. The questions are ones that I’m sure other developers have asked who are just getting their feet wet in game development, so I thought it would be a good idea to post the questions and my responses so that others may benefit.
“I wanted to know if you had any recommendations for how to learn all of this, as well as the best programming language to learn on.
“I’ve been learning programming off and on for about 2 years now, but just recently started making a harder push in the past 6 months after I realized how many resources there are online (including, but definitely not limited to, your blog). My biggest struggle now is that I feel like I’ve learned a lot of the basics through sites like Code Academy and the like, and then I kind of find myself at a loss for where to go next.
“Your blog for the space shooter was outstanding, but I would be lying if I said I understood every piece of the coding. I understand fundamentally what is going on, but when it comes to the nitty gritty all the pieces don’t always line up in my head. I have tried duplicating what I think makes sense into other avenues to get a desired effect and rarely does it work, which leaves me to believe I can follow the code but cannot create my own, which is part of the fun of programming (or what I hope to do at least).”
I guess this is a good question to give you a brief (ish) history of myself. I’ve been programming for almost 10 years now. I first started programming in High School when my friend showed me that you could program math equations on a TI-83+ calculator. It was a lot of fun to be able to take a math problem and just have a program ask for the input and solve it for you. We then discovered that you could also play games on the TI-83+ (like Mario and BlockDude), and it sparked my curiosity that a simple calculator could be programmed to play some fun games.
That curiosity lead me to try to create a simple text based RPG on the calculator. At the time my friends and I were playing a MUD called Divine Blood which was the inspiration for the game. I didn’t get very far on it, I think I just created a few connected rooms, but it was enough that I wanted to take the programming class offered at the school. It was just a basic Java class but I ported my simple RPG from the calculator into a town where you could walk around (it didn’t have anything else besides streets).
After that I fell in love with programming and slowly tried to learn bits and pieces as I went that interested me. When I went to college I made sure to choose a university that had a great CS department and would teach me valuable skills which I could apply in the workplace. Through the classes I learned the basics of Object Oriented Programming and how all the basic data structures worked in C++, and learned design patterns and created a user driven program in Java.
I developed and researched together for a few months, building the game in small sections one piece at a time. I started with the easy stuff (moving an image across the screen in a loop) and slowly progressed to the harder stuff (like quadtrees and object pools). Because I did everything one step at a time, I was able to learn everything I wanted to and still have the game built as the outcome. I didn’t find it difficult to work through the tough parts because I had taken my time to understand how my game was coming together.
The game probably took me 3 to 4 months to develop, and I enjoyed every bit of it. Once the game was completed, I made a few other games like a Breakout clone and Asteroids. Again, I tried to focus on simple games whose concepts I could easily understand but which challenged me to learn new techniques.
Currently I am a web applications developer by day and a hobbyist game developer by night. I enjoy working in the web and making web applications. It’s taken me 8 years to fully understand what it was I wanted to do with programming. This has allowed me dabble in many programming languages (like Java, C++, Bash script, Ruby, PHP, and MySQL) which in turn has helped me to become a better web developer (allowing me to maintain my own WordPress site and theme).
I don’t believe there is a particular language that would be a “good” starting point. All languages have their advantages and disadvantages, and I don’t think any language is easier to learn over another. My advice for you would be to choose the language you are most interested in or that you enjoy programming in the most, then dive right in. Figure out how the language ticks, what pitfalls and quirks to watch out for, and understand the programming patterns for that language.
Remember, this process will take time and possibly a few years. As the saying goes, “Rome was not built in a day.” Learn how to learn and enjoy the learning process.
Q. Do you have any recommendations for a middle ground between the basics of programming (Code Academy-esque) and really getting out there and learning to do it yourself (more like the things you make)?
However, the best way to progress past the basics of any language is to give yourself a simple project and then try to complete it. Remember to keep it simple and relatively small; You don’t want to start with something so big that you’ll never finish it. By giving yourself a project and making it something you’re interested in, you will become motivated to do the research and find the best way to make the project work.
For example, write a simple To Do List program that accepts text commands to add, edit, and delete To Do items. Then write a GUI for it and figure out how to save and load the list so the user can have access to it later. Slowly build up the list with cool little features that make it more fun to work with. Just this one project should help you learn more than Code Academy can teach you.
If you want to start making games, make the easy ones. Start with pong, then add a new feature that makes it more interesting (like power-ups). Maybe add a few more once that’s completed. Once you’ve finished with Pong, choose another easy game and start again. Wash, rinse, and repeat.
Q. Do you have any recommended web development compilers? Whenever any of my code is broken it just displays nothing. Having some sort of a debugger/compiler to know where it’s crashing would be amazing but none of my courses/research have come up with anything.
Another resource that can help you see where you might have problems is JSHint. Just paste your code in and it can help you detect errors and problems.
Q. When you look at implementing new concepts that are already created (two examples in your galaxian game come to mind – the key presses concept and the quadtree), do you look at the code, try to understand all of the pieces, but ultimately just copy and paste it into your code or look at the code, ensure that you understand it and recreate it from scratch in your code with modifications as needed?
This one really depends on what you personally want out of the project, but I think most people will just want code that works and usually Stack Overflow provides. For most cases when we copy code it’s small components that accomplish a needed task that we weren’t able to figure out ourselves. There’s nothing wrong with that, but if you always copy code without even trying to figure out the problem yourself first, then this is probably the wrong way to go about it.
For me personally, I’ve done both. For the key presses I just took the code and only took the time to understand how to use it without trying to figure out what it was doing. I didn’t really care how it worked so long as it did what I wanted since it was such a small component of the game. However, after a few games using it I learned what it was doing.
So for small parts of your project it’s ok to copy and paste without gaining an understanding first since the project as a whole doesn’t depend on it. But it would still be beneficial to learn what the code is doing later on when you’re not so concentrated on getting the project done.
On larger components though, having a firm understanding of the code will greatly help you as the project goes on. There is a saying the development community that 90% of the execution time of a computer program is spent executing 10% of the code. If the code you copied is in that 10% of the code then there are bound to be problems that arise. If you don’t understand the code you will struggle to understand how to fix the problems when they do occur. In these cases, take the time to get a good grasp of what the code is doing before you just paste it into your project. You’ll be happy you did.