This Monday’s practical insights at AiGameDev.com features an interview with Phil Hassey. Phil is an independent game developer and an active member of the indy games community. He notably won the Ludum Dare contest in April 2006 focusing on swarms, which resulted in the popular game called GalCon — a remake of an old 80s game called Galactic Conquest.
I caught up with Phil by email recently to ask him more about Galcon, its artificial intelligence, and Python game development in general. You can find out more about his projects by visiting his website, or the GalCon homepage. Also, here’s the demo of the game.
Screenshot 1: The Ludum Dare contest entry on swarms.
Alex Champandard: Hi Phil, thanks for taking the time to answer these questions! Could you introduce yourself briefly, and give us about your background as a game developer?
Phil Hassey: I’ve been making games since I was 10. I guess I just didn’t have much else to do :) My favorite language is Python, I use it for all my game development. I also use C for speed sensitive things and PHP for web based projects. Most of my games are open source and I’ve written quite a few open source tools / libraries for game development.
Games by Phil Hassey:
AC: How did the idea of Galcon come about? Can you give a quick description of the game for the readers who don’t know about it?
PH: In April 2006 there was a 48 hour game development contest called Ludum Dare #8. The theme was swarms and I had been wanting to create another “Galactic Conquest” style game, so I figured I’d give a try with having swarms of ships. The prototype of the game was made in the 48 hours and won that contest. Quite a few people encouraged me to continue development of the game, so I did.
Related material by Phil Hassey:
AC: The ships play an important part of the game, and I’m curious how you implemented them. Are these based on Craig Reynold’s steering behaviors? Did you need many customizations of the algorithm?
PH: The algorithm is fairly simple — the ships are all given a destination to move towards. After that it’s a just a matter of collision detection and bumping each other out of the way.
AC: Did you have any trouble with performance of simulating so many ships? If so, how did you get around those problems?
PH: Yeah. In the compo version there were a max of 4096 items on screen at a time and I used brute for collision detection. So in some cases that would cause quite a slow-down :) In the current version the max is now 2048 and I use a grid of the screen for subdividing the collisions. I also make sure to drop ships onto the screen in such a way that the initial display of ships won’t cause too many collisions. In the original version I’d drop them all at a single center point (the planet of origin) and they would expand out from there over a few frames — this cost quite a bit in terms of excessive collisions.
Screenshot 2: Missions available in GalCon’s full version with various AI bots.
AC: How did you go about implementing the opponent AI? Did you build most of the game first, or was it more of an incremental process?
PH: During the 48 hours, I spent most of the time getting the mechanics and graphics together. The AI was nailed together in the last few hours.
AC: Did you find the AI useful during the development process? For example, tweaking parameters in the design?
PH: Not really. I found feedback from humans more helpful in the realms of play-testing.
AC: The gameplay in Galcon seems deceptively simple, but finding an optimal strategy seems rather advanced when you think about it! To what extent did you work out the game theory to implement the AI?
“Trying to implement neural networks helped identify the information needed for decision making.”
PH: I spent quite a bit of time working on the AI for the final version of the game. I tried a lot of simple variations, and even spent a week fooling with neural networks. I failed to have any progress using those. However, trying to implement neural networks helped me think more clearly about the kind of information the AI needs for decision making. My primary bot in the game used a lot of the ideas I learned.
I’m working on some new bots, and for those I found that reading over strategy guides written for Galcon have been the most help. I’ve implemented a few of those strategies and been able to create some very challenging bots. Some of the strategies seem almost counter-intuitive to me, but they work really well.
I’m also experimenting with other types of AI that are fun to play against in certain scenarios. One example is a bot that plays like a complete noob from the multi-player game. This bot would be extremely easy to beat given a fair game, but in these scenarios, I give the bot about 30 planets and you only get 2. The player then has to out-think the noob and go onto win anyways.
AC: I noticed the game is based on PyGame. What were your experiences with the framework? What would you do differently in retrospect?
PH: PyGame is great :) I don’t know if I’d do anything differently, but I suspect I’ll use OpenGL for an update sometime. The rendering of all those ships takes a lot out of the CPU.
Screenshot 3: Galcon is proudly based on PyGame.
AC: From digging into the scripts for the mods, I’ve been amazed how clean and structured Galcon’s API is. Do you have any advice for anyone wanting to play around with the AI?
PH: Have fun!
Screenshot 4: Bot battle mode is useful for testing AI.
AC: What’s in store for you next? Do you have any other projects in the pipeline?
PH: I’m working on an enhanced version of Galcon. Hopefully it’ll come together in a few months :)
AC: Thanks Phil for taking the time to answer these questions, and best of luck with the project. I’d encourage everyone to check out the full version of the game if you enjoy the demo!