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