Piggy in Search of Kak

Published

Around 1993 I was studying for a BTEC National Diploma in IT Applications at Burnley College. On the second year of that course, we were given an assignment to create a simple computer game in Borland C++. At the time I already had a big interest in game development and poking at BIOS interrupts, so I went above and beyond what was expected and wrote a 256 colour platform game. Ok, so in this day and age it doesn’t sound so impressive, but at the time it was great!

Essentially I called BIOS interrupt 0x10 to put the graphics card in to mode 0x13, which was a 320×200 pixels, 256 colour display. The best thing about this mode was that the memory could be easily accessed at memory address 0xa000 with 1 byte representing each pixel. One byte can of course represent 256 different values, so I could change the colour of each pixel simply by accessing it from a char pointer.

The most challenging part, was dealing with the limited speed of computers and graphics cards at the time. Redrawing the entire screen on every frame was simply not an option so I had to use an off-screen buffer and get the sprites to replace their backgrounds as they moved, and then copy that section of the buffer over to the live video memory. It’s was super geeky fun.

And so Piggy in Search of Kak was born.

Who in Search of What?!

Advanced Dungeons & Dragons 2nd Edition Player's Handbook

Piggy was a friend of mine at college. He wasn’t in the same year but if I remember correctly, he was studying the same course. A bunch of us used to play Advanced Dungeons & Dragons (2nd Edition) in a classroom that the college kindly let us use. Piggy used to turn up to every session with a monstrous sized can of his favourite cola drink, which for the purposes of the game was rebranded to KakaCola. Hence the primary objective of the game is to get Piggy to his favourite beverage vending machine.

During one of our role-playing week-ends, we decided to do some Live Action Role Play (LARP) with a local group. It was based in a large warehouse that had been converted in to a dungeon. It was dark, cold, atmospheric and brilliant. Whilst making our way through the dungeon, wielding our rubber weaponry, an orc unexpectedly jumped out in front of us. Fearing for his hit-points, Piggy jumped backwards in to a wall that held a candle sconce.

His costume caught fire impressively quickly. The orc kindly put his murderous intentions on hold while we extinguished the flames by patting Piggy down. His clothes burned so fast that they didn’t manage to set anything else on fire and Piggy’s long ginger locks survived. He was left with a smouldering circle on his back that glowed nicely in the darkness.

So bearing in mind that Piggy is also highly flammable, the objective of the game was to get to the KakaCola machine without setting Piggy alight, hence the need to avoid the Matchstick Men. Now it all makes perfect sense.

Piggy Lives Again

I recently rediscovered a tonne of old source code, including the original Piggy game and decided to port it to JavaScript for posterity’s sake. I used all the original graphics but the code is very different since technology has advanced so much. There’s no longer a need to write directly to video memory for a game as simple as this and computers are fast enough to cope with redrawing the entire frame, especially for a game with a resolution of only 320×200 pixels.

Get Piggy to the KakaCola machine. Use your arrow keys to move (or a finger if on a touch device).

Source code available on GitHub.