STEVE, ASLEEP



Python Game Programming Tutorial

Writing programs in Python is fun. Writing games is fun. Writing games in Python is fun! Unfortunately, tutorials to help people get started are spread pretty thin. I wanted to help correct the situation, so I wrote this tutorial.

The pyglet programming guide is a great resource, but it won't really help you if you've never written a game before. This tutorial will walk you through the steps of writing a simple Asteroids clone. This tutorial was also presented as a talk at PyOhio. If you just want a broad overview, you can watch the talk, which lasts about 40 minutes. Otherwise, you can read the text version, which is much more in-depth.


Table of Contents

Introduction

Who is this document for?

This document was written for people who know how to write simple Python programs and run them. That should be all you need. If that's all you have and this document confuses you, then you should email me and I'll try to fix it.

Why use Python for games?

The same reason you use Python for anything else. It's easy, it makes sense, and there are great libraries available.

Speaking of libraries, what's available?

Which one should I use?

My personal opinion is that pyglet is the cleanest and fastest, but PyGame has also been used to do some cool things. Panda3D is more sophisticated, geared toward 3D, and has a much higher learning curve. This tutorial will use pyglet. I'm trying to teach you, not convert you.

To get you familiar with pyglet, I'll walk you through the process of creating a simple version of the classic game Asteroids. If you ever get stuck, you can look at the project in various stages of completion on its Github page.


 
 
Next