How to Get Started With Game Programming

Posted on

First of all, learn how to program. It is very essential to have a understanding of all the basic concepts regarding programming. If you don’t know how to program, I would recommend starting with Python. It is a wonderful language that takes away the low level details for the programmer and allows him to focus on concepts. It is also a very fun language, I’m sure you’ll love to program in it. I picked it up in just 3 days (although I had previous programming experience).

Once you have picked up a language and know how to program, you need to decide which language you want to program the games in. That really depends on the kind of stuff that you want to do: engine development or game development. Engine developers create the core of the game, the engine, the stuff that powers up the actual game. If you choose this route, you will have to deal with all the low level details of programming. For this, you should pick up C or C++ since most of the engines are coded in these languages. You should also be very disciplined about memory allocation/deallocation and code optimization techniques.

The other path is to actually code the games, using a previously coded engine. In this path, you will use an engine created by someone else and use it to make your own game. Usually, engines have bindings in some scripting language (like python, lua or ruby) and thus you can code the actual game in a scripting language. You can focus on the game design rather than other low level details.

Obviously you can chose to do both things: code the engine as well as the actual game.

In the beginning, I think it’s better for you to wait after you’ve made some games to decide which way you want to go. In your first few games, its better to code the entire game on your own. You will learn a lot along the way, and will also be able to decide which way you want to go.

To make games, you need certain extra libraries. If you know how to program, you must know what libraries mean. They are extra patches of code that you can link with your own code. To make games, you will need libraries for graphics, event handling, networking, etc. If you’re using Python, Pygame is an excellent library for beginners that provides almost all this stuff. For C or C++, you have Allegro and SDL. A simple Google search will give you a list of game programming libraries for the language of your choice.

Start playing with the library your have chosen. Read its tutorials online. Learn how to make simple stuff like rectangles, circles, load images, etc. Try to make some animations. The fundamental concept behind building an animation is to draw the object, then draw another object of same dimensions on top of it of the background color and then draw the earlier object, with it coordinates displaced by the required amount. Of course, if you do this really quickly, you will be able to cause an illusion of movement.

After that, make a simple game like Pong or Tetris clone which uses just event handling and some basic physics (collision detection). Google for game loop structure, it will help you out in coding the game.

After you have coded it, move on to a slightly complex game, like a game with 2 tanks fighting it out. You don’t have to get cute with graphics, just use whatever royalty free images you can lay your hands on. Try cloning more arcade games like breakout. To make these, you will have to use something called a Level editor, something that is used in almost every game.

After that, try your hand out at a game which uses some AI, like a pacman clone or a top-view soccer game. Both of them can be implemented using a FSM (Finite State Machine), a concept used for AI in 80% of commercial games. Then try your hand out at a side-scroller platform game like a Mario clone.

The games mentioned above, combined, include almost all the concepts used in 90% games. To make a game with a flashy 3d interface, all you need to do is use an engine which helps you to do so. It’s just that in the beginning, programming in 2D allows you to focus on the more important concepts and also makes your code less complicated. Once you get comfortable, you can go for 3D games.

Leave a Reply

Your email address will not be published. Required fields are marked *