, , , , , , , , , ,

Arkwood asked me, ‘How manic is Manic Miner? Which levels are the craziest?’

It was a fair question. Of course, he was referring to the Commodore 64 classic game Manic Miner:


Well, let’s find out!

I have just got started using AForge.NET, an open source C# framework for computer vision and artificial intelligence. Its motion detection and processing algorithms will tell us which levels of Manic Miner have the most hectic terrain.

namespace Motion
    using System;
    using System.Drawing;
    using System.Drawing.Imaging;
    using AForge.Vision.Motion;

    class Program
        static void Main(string[] args)
            // initialise screen
            var screen = new ScreenEasy(new Point(150, 100), new Size(1400, 570));

            // initialise motion detector
            var detector = new MotionDetector(new TwoFramesDifferenceDetector(), new MotionAreaHighlighting());

            while (true)
                    // get screenshot
                    var screenshot = screen.Capture();

                    // obtain motion reading
                    var motionReading = detector.ProcessFrame(screenshot);

                    // save screenshot
                    var filename = String.Format("img/{0}_{1}.jpg", DateTime.Now.ToString("HHmmssfff"), motionReading);
                    screenshot.Save(filename, ImageFormat.Jpeg);
                catch(Exception ex)
                    // likely got too Manic!

I create a C# Console application and make use of the AForge.Vision dll (as well as a dependency on AForge.Imaging).

I initialise a class for screen capture (more on that at the foot of post) as well as our motion detector (I’ve chosen the two frames difference motion detector combined with motion area highlighting).

Once done, the app simply loops forever in the background whilst we play Manic Miner. It takes a screenshot of the current gameplay and detects the amount of motion.

Every screenshot we take is saved to disk, with the motion marked in red. Note that we are also saving the motion reading as part of the filename – this metric will tell us which part of Manic Miner is the most frantic (i.e. the more stuff we have moving about on the screen, the higher the reading).

Okay, let’s take a look at Level 1 – the Central Cavern:


If you look closely, you’ll see the motion marked in red around Miner Willy, the trumpet-faced dude and the conveyor belt. Fairly manic. The screenshot gives a motion reading of 0.007625313

What about Level 2?


The cool penguins have given a chilled-out reading of 0.004362155

Of course, the motion reading will fluctuate a bit within each level. For example, if the penguins and Miner Willy stop for breath then less motion will be detected. I’ve picked out screenshots for each level that give a roughly average reading.

Next, Level 3:


A few burnt feathers, as the menagerie hots up a bit to 0.005146617

Level 4 – Abandoned Uranium Workings


Nothing too manic here, with a low reading of 0.002260652

Perhaps Eugene’s Lair will offer a more frenzied sort of atmosphere?


Wow! All those toilet seats, conveyor belt and that bouncing bespectacled fat-face has yielded an astronomical motion reading of 0.009889725

But then our Miner Willy becomes unstuck:


Game over! Look’s like I’ll need a bit more practice before I can find out just how manic Manic Miner is.



Here’s the ScreenEasy class I put together to take the screenshots of Manic Miner (based on a stackoverflow post):

namespace Motion
    using System.Drawing;

    public class ScreenEasy
        private Point ScreenPoint;
        private Size ScreenSize;

        public ScreenEasy(Point screenPoint, Size screenSize)
            // initialise screen point and size
            ScreenPoint = screenPoint;
            ScreenSize = screenSize;

        public Bitmap Capture()
            // obtain screen capture based on screen point and size
            Bitmap bitmap = new Bitmap(ScreenSize.Width, ScreenSize.Height);
            Graphics graphics = Graphics.FromImage(bitmap);

            graphics.CopyFromScreen(ScreenPoint, Point.Empty, ScreenSize);

            return bitmap;

Note that we are taking screenshots of Manic Miner at about 12 frames a second.

I used VICE emulator to play the Commodore 64 version of Manic Miner on my Windows 7 PC.