So, about last year…

Turns out that I’m better at writing code than writing about code. Though that’s not too surprising if I’m honest. Documentation is always a chore and my past low tech attempts at chronicling events can be found in various unfinished diaries.

So to start 2019 with slightly better intentions – and yes, I’m aware it’s already mid February – let’s begin with some details on my latest release for the venerable ZX Spectrum, Your crackers, m’lord!

Towards the end of October last year, R-Tape took his special ceremonial horn off the wall, put it to his lips and let out a clarion call for submissions to the second edition of the Woot! Christmas tape magazine . I had an idea for something to do but couldn’t get it together in time as I was struck down with a chronic bout of level designer’s block. With the December deadline rapidly approaching, I went back to the drawing board.

So what to do in a short amount of time? I still wanted to knock a simple game together. I tend to favour writing puzzle games as they can be easier to implement in a short amount of time – especially if the main mechanic isn’t too complicated. Then, it’s just a matter of going through and adding all the levels.

By chance, I stumbled across a Scratch remake of Kiragames’ ‘Unblock Me’ by griffpatch. The aim of the game is to slide the pieces of wood vertically or horizontally to let you move the red block across the screen to the hole on the right hand side. The red block can only slide horizontally and the others can only slide in the direction they are oriented. It had a small level set, was challenging and the cleanly designed graphics would work well on the Spectrum.

griffpatch’s Scratch remake

Over the first weekend in December, I fired up my trusty text editor alongside with the z88dk C compiler and started work on my conversion. By Sunday afternoon, I had this garish prototype:

Crackers on acid!

It had a frontend (recycled from Thoroughly Modern Willy), 4 levels and the code to display the board – but you couldn’t move any of the crackers around or finish a level. Over the subsequent days, common sense prevailed and I settled on a more sedate set of cracker graphics. I also added the code to select a cracker (using the Spectrum’s BRIGHT attribute as an easy way to implement the selection cursor), move the cracker around the board vertically or horizontally and to detect when the red cracker was at the gap in the board which meant the level was finished.

The finished product.

With the game code sorted I set about playing the levels on the original to obtain the level data for the 28 remaining levels. These were pretty straightforward until the last 2, which had been sourced from a harder level of play. After some head scratching, I had the full level set and the skills to play test all the levels. For each level, I took screenshots of the game’s web page on starting and finishing a level so I could check I’d entered the level data in correctly and knew where I needed the crackers to end up to complete the level.

At this point, the only reference to Christmas was the cracker graphics. When you pull a cracker at Christmas, aside from the coloured paper crown you usually end up with a gift of dubious quality – usually a tiny notepad, some impossible joined metal loop puzzle or a red plastic fish with ‘psychic’ powers – and a piece of paper with a poor quality Christmas joke printed on it. I decided to source 32 cracker jokes, one for each level to display on completing a level. Fortunately the internet had my back with various web sites compiling lists of the best worst Christmas cracker jokes.

The main constraint for using a joke was whether I could fit the question and answer parts of the joke on one line. This proved challenging with an 8 x 8 pixel font, so I used Einar Saukas’ fzx font system support in z88dk to use a variable width font which let me squeeze more characters on to the line.

Just one of the 32 pieces of comedy gold strewn between the levels.

The name ‘Your crackers, m’lord’ comes from a sketch by the Two Ronnies (a popular UK comedy double act from the 1970s and 80s whose Christmas show was a big telly event back then). The sketch is in a similar vane to the classic ‘Fork handles / Four candles’ where the property of certain English phrases sounding identical to each other but meaning vastly different things is used to comic effect. In this case, the butler whilst serving courses of a meal to an aristocratic couple is saying nice things to his Lordship’s wife “Your sweet m’lady.” but is insulting to his Lordship “Your nuts m’lord.”Your crackers m’lord”.

This sketch also gave me the bare bones of a story to hang the game off. The reason you’re having to go to all this trouble moving these other crackers around is to satisfy your aristocratic employer’s demand for a red cracker with his festive food stuffs. I’m sure this was one of the sub plots of a Christmas edition of Downton Abbey one year.

For a rush job I was happy with the overall result. I’d like to thank griffpatch for his original Scratch game which provided the inspiration and source material for my conversion and R-Tape for compiling another Woot! tape magazine.

Knockabout, WIP build 107

Knockabout has been available in varying forms for about 3 months now. I’d received next to no feedback on the game after initially making it available on the ZX Spectrum Next forum back in August. Recently, a new forum opened at Spectrum Computing which I joined. It had a section for letting people know what projects you are currently working on. I posted a topic about Knockabout and within a couple of days got a much better response and some proper feedback.

One of the surprising things with the previous releases was the lack of reported bugs (one of the first versions had a typo in the level data which made it impossible to get past level 4). In software there are usually two reasons for this: 1 – the code is perfect and bug free or 2 – no one is using the code. I’m realistic enough to see the latter as the reason for the lack of bug reports. Maybe it will be the former one day. 🙂

Turns out there were some cosmetic glitches and some right howlers. From a rotating switch not being drawn correctly in a certain situation, player tiles being left behind after moving which would block your progress and the undo mechanism which – apart from working intermittently  – would randomly corrupt memory.

I made a number of intermediate builds available on the forum to get to the bottom of the reported issues. After a hiatus of a month or so (I was working on contributions for the upcoming WOOT! ZXMAS 2017 tape magazine but, more on that to come…) I’ve picked up the code again and made a proper new build available.

Level 89 – “We’re gonna need a bigger block array…”

The following changes have been made in build 107:

  • Added levels 83-90.
  • Fixed switch graphics glitch when rotating a 2×2 switch anti-clockwise.
  • Logic fixes to undo system.
  • Undoing a move was corrupting memory.
  • Try and stop issue where a ‘stuck tile’ gets left behind on the level after moving.

knockabout_121017

Knockabout, WIP build 106

My guess at the the number of levels – 136 – has been confirmed. I managed to find a newer version of the Nintendo DS game ‘PuzzleBoy’ – 1.10. rather than 1.04. This had a read me file which states the game has 136 levels and more usefully, the source of the additional levels. PuzzleBoy is a not a direct clone of Kwirk. While it uses the levels, they are interspersed with other levels that I assumed had been written by the author of the DS version. It turns out though that they are from Amazing Tater (a sequel to Kwirk on the Gameboy) and PuzzleBoy, a version of Kwirk for the PC Engine.

Hitting the wall(s) on Level 71 on the DS.

Level 71 on the Spectrum.

This proved rather helpful in getting me past level 71 which I had been stuck on for a while, as I found and downloaded walkthroughs for Amazing Tater and Puzzleboy. I then managed to track down which game the level was from and then used the solution to complete the level. I couldn’t figure out a way to auto convert the levels from the DS so I’ve been adding them in one at a time as I’ve been progressing through the game – which is why they’ve been added in spits and spurts.

The following changes have been made in build 106:

  • Added levels 71 to 82.
  • Swapped the Restart and Map options around in the break menu.
  • Made the code entry screen look similar to the level info screen.
  • Added support for blocks greater than 1 x 1 starting over a hole.
    Needed for level 74. I think this is an enhancement from Amazing Tater as Kwirk doesn’t appear to have blocks or switches starting over holes.
  • Fixed a bug creating a block when you had two n x n blocks on the same y axis. Spotted on level 71.
  • The initial switch position on level 12 was incorrect.

knockabout_102917

 

Heath Robinson coding

The Incredible Machine is a DOS game that implements a – for the time – quite realistic in game physics engine. This lets you create machines in the style of the British illustrator William Heath Robinson, whose name became shorthand for any over engineered or elaborate, slightly fantastical contraption that performs a simple task. A good example of this is something like the machine you end up assembling in the board game Mouse Trap.

The first stage of The Incredible Machine

I can’t remember how I came across love2d initially. I think it was mentioned in passing on a news article for a free / indie game. It’s a multi platform 2d game engine which uses lua as a basis for development. It also includes box2d which lets you do some quite advanced physics. At that time, I had written some code for a C interface to lua scripting for a project at work, so I had a familiarity with the language.

Partly as an experiment to see if I could get the physics engine to do something interesting, I wondered whether it would be possible to create a clone of The Incredible Machine using love2d. Which brings us to Contraption.

Contraption v001

Version 001, released in April 2011, is just the first level. There’s some nice placeholder graphics too.

Contraption v002

Despite a virtually identical screenshot, version 002 now has three levels, the ability to manipulate the placed objects and a reset button to return a level back to it’s initial state.

Contraption v0021

Version 0021 added some description text for the current object and some minor tweaks and fixes.

Contraption v0025

Version 0025 now has some slightly better visuals thanks to my attempts at pixel art and judicious use of Google’s image search to replace the various coloured shapes of the previous versions.

And that’s sort of where I got to. I started work on adding a level designer which would let you create your own contraptions but was having difficulty getting the love2d physics code to do some of the stuff required for the later levels. My interest started to wane and I moved on to other things.

At some point inbetween major versions of love2d, the interface to the box2d physics engine changed dramatically which meant the code no longer ran (Top Tip: if you’re going to provide a wrapper or API around another existing API, try and abstract or insulate it so that if the internals change, the exposed interface remains the same to the consumer).

Back around August 2016, after a gap of 5 years, I made a concerted effort to get the old code working with version 10 of love2d.

Contraption v0030 title screen

I added a blueprint style design, partly as a homage to the blueprints Wile E. Coyote used to have when designing his latest elaborate trap to catch the Road Runner.

Contraption v0030 level screen

The idea was to extend the blue print styling to the whole game but I never got round to that part (are you sensing a theme here?). The rest of the game is far from finished and will probably never be – but I think it’s an interesting failure, none the less.

There’s not much point providing code for the older versions as they no longer work with the current version of love2d. So here’s a .love file which should work with love2d 10.02. You’ll need to rename it from .zip to .love.

contraption_0030

Knockabout, WIP build 105

Knockabout

Knockabout is a port of ‘Puzzleboy’, a homebrew title by maRk on the Nintendo DS (which in turn was based on the Gameboy title ‘Kwirk’ by Atlus), for the ZX Spectrum.

Puzzleboy on the Nintendo DS

You need to get our heroine to the flag to move on to the next level. You can’t pass through walls but the blue switches can be pushed to rotate them and yourself around – so long as there is nothing in the way of the switch. Yellow blocks also obstruct your path on some levels and need to be moved out of the way. They can also fill in black holes if they are completely consumed by the hole.

Some levels need you to enlist the help of your friends. You can change between players with the ‘Swap/Ok’ button. You can also press the Break key in game to access the game menu (select an option with left, right and swap/ok). This lets you undo your last move, view an overhead map of the level to help get your bearings, restart the level if you get stuck or quit back to the main menu.

Build 105 has improved switch graphics to help make them more distinguishable, implements the overhead map view and now has 70 levels implemented. My investigations lead me to believe Puzzleboy has 136 so at least we’re on the downhill bit.

knockabout_101517

Statement of intent

Hello. This is the first post on my site. If you have high expectations, allow me to dash them quickly. This site will showcase new and current projects as well as  some of the older things I’ve worked on.

I’m currently writing code for the ZX Spectrum (an 8 bit computer from the UK) but have dabbled with 68000 assembly on the Amiga, lua games programming (through love) and homebrew on the Nintendo DS using libnds and gcc.