Well, it’s the time of year that we’ve all been waiting for … the annual year-end code challenges have begun. Like last year, I’m participating in the Advent of Code challenge throughout this month, and will be posting my solutions up onto my GitHub repo linked below. If you’re reading this and taking part in…
Category: Programming
All the World’s a Stage…
Now that we’ve got the main game stage all set, we need to populate it with Actors. That is to say the things that move about the screen and interact with one another and with the players. As previously mentioned, I’m going to approach this from the perspective of a new class of object so…
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…
Credit, Where Credits Due
As a brief aside, after building a (mostly) non-functioning menu state, I have taken the time to build a quick state for showing a scrolling credits page as proof of concept for switching between states in the state manager. This allows for some exploration of some other techniques related to how we display the screen,…
Main Menu Development
Now that we have the basic framework for the game in place, it’s time to take a look at out first ‘real’ state definition. This will be the main menu for the game. At this stage, the MainMenu class will be an incomplete placeholder, but it will serve to demonstrate some of the basic functionality…
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…