Gallius asks “I grew up with games; I’ve been playing them all of my life. My programming knowledge is very limited. Over the last few years I’ve developed an interest in creating my own games. Would you mind pointing me in the direction of some good resources for not only AI, but also game programming in general?”
It’s a great question. Since you’re keen to learn programming, my advice is to actually make games (with help from examples) and integrate AI into them. It will take some time for you to become comfortable as a coder, but these days it’s easier than it’s ever been.
Here’s how I would approach your situation:
Get familiar with Python as a programming language.
Download PyGame and look into some examples.
Implement simple game AI techniques like steering behaviors.
Experiment with AI techniques from existing libraries.
That, in a nutshell, is the best way to learn about AI and programming with games. Here’s why and how…
Screenshot 1: Ants2D simulation in PyGame by Simon Oberhammer
Becoming Comfortable with Programming
The traditional programming language used in the games industry is C++. It’s important to keep that in mind, but frankly, it’s probably the worst place to start for a beginner. In my time, I started with Pascal but these days there’s much better.
I recommend you start with Python; it’s a programming language that’s intuitive to work with and easy to understand. You’ll also be able to build industrial-strength products with Python too, for example:
Eve Online is primarily a Python application, though the low-level engine (graphics) is written in C++.
Civilization 4 uses Python for various AI, gameplay, interface and configuration scripts.
Many studios, including Rockstar Games, rely on Python for certain tools, as it does a great job at bringing many different pieces of functionality together.
What makes Python such a good language to start with?
Batteries included — There are libraries for everything!
Intuitive yet powerful — It’s designed for easy reading.
Third-party bindings — Many game engines are supported.
Open source — Most programs and libraries are entirely open.
Here are some good free resources to get you going:
Spend the time and get comfortable with Python; it’ll pay off in the long term. Then just as you start feeling comfortable, move on!
Venturing into Game Development
The next step is to start prototyping with 2D graphics using PyGame. PyGame is a library that provides the primary elements you need to build a game.
Here’s some advice to get you on the right track:
Download, read the documentation and install it locally.
Try some of the games and/or demos to see if it works.
Take an example and modifying it, or build your own simulation.
Once you’ve got going, start thinking about different things you’d like to build using artificial intelligence. A great place to start with game AI is using Craig Reynold’s steering behaviors to build “boids” that wander, avoid obstacles, seek and flee other boids.
Experimenting with Artificial Intelligence
Finally, once you’ve got the hang of creating simple games, you can move on to using more interesting AI techniques. I don’t recommend you implement advanced technology yourself, you can do that later. However, you can learn a lot by simply applying existing software to solve problems for you, and use that in your games.
If you’re serious about AI, you should read Artificial Intelligence: A Modern Approach.
A good place to start is with the Orange library. It will allow you to play around with machine learning techniques as a user without having to implement any of the low-level algorithms. Applying AI in practice as a black box is one of the best ways to learn about neural networks, decision trees, Bayesian networks. See the getting started guide for Orange.
Words of Encouragement!
You can’t learn coding over night, but it can be easy if you enjoy the process! It gets more fun as you go along too. Keeping a diary isn’t a bad idea either as you’ll be able to catalog your own progress, which I find encouraging.
Anyway, the rewards are certainly worth it. As a programmer you’re more likely to get into industry easily and be paid more!
Does anyone else have some advice for Gallius?