Game On…

It’s been a while since my last post, so I figured I’d get back onto the horse and do a little more on the development side. I’ve added a new class into the codebase now to begin implementing the main game, it currently doesn’t do much more than show the main playfield at present, but…

Dynamic Modules

In the previous post I mentioned that I’d need to dynamically load the state modules at runtime. Luckily, Python provides a module – importlib – to do just this. In order to load our states into the system, we pass a list of dictionary objects into our Game initialiser, which in turn passes this onto…

Managing State

In order to simplify our code, we’ll implement a state-based model for the game. This will allow us to represent each significant ‘mode’ of the game as a separate, encapsulated item, thus keeping code for differing parts of the program isolated from others. This will also have the benefit of allowing us to extend the…

Throttling

In my previous post, I mentioned that we’d need to look at some mechanism to throttle the game execution so that we can achieve a consistent speed across hardware of varying speeds, so here I’ll look at how we can achieve this, and why it is important to adopt the method I outline. As we…

Game Structure

Before we begin looking seriously at the game of Pong itself, let’s first take a look at the overall general structure of a game program. All games will generally have a form similar to that shown to the right. In our initialisation routine, we set up the initial environment, get details for screen dimensions, input…

Programming Pong

As part of the degree course I’m studying, I’m having to learn the Python language, so I figured that I’d take the time to also undertake a few fun projects of my own to cement my knowledge and hopefully document the process somewhat. So, what better way to learn programming than by writing some simple…