Join #ludumdare on irc.afternet.org
Mini LD #3 :: September 5th-7th Weekend :: Theme :: Tool

Sign In | Write your Journal
Home | Planet Ludum | Rules Wiki | Mailing List

Ludum Dare 12 Final Results NOW AVAILABLE

Click HERE for the Ludum Dare 12 entries image grid
(to be included in the image grid, you must upload an image to the blog)

LD11 entry - Minim Madness

Posted by mariusz

Here it is:

http://portal.acad.cai.cam.ac.uk/~mml27/minim.tar.gz

Details to follow shortly.

Minim Madness Title Screen

Posted after close of competition:

Windows port: http://portal.acad.cai.cam.ac.uk/~mml27/minim.zip

Linux par/pp version: http://portal.acad.cai.cam.ac.uk/~mml27/minim-ld11-a-pp.tar.gz

Time-lapse video (2 minutes, 15 Mb). Warning: this video contains bright, rapidly flashing colours.

So what’s it all about?

I decided to interpret minimalism in a minimalist way, namely “minim” (half-note to Americans). You get a load of musical notes moving about the screen like particles and you have to guide them to certain points. You do this by drawing minims with the mouse. The notes then bounce off the minims. You can get more detailed instructions by running the game and waiting at the title screen.

How do I run it?

Linux users: download the tarball above and extract. Run minim.pl. You need SDL, Perl and SDL-Perl (Debian package libsdl-perl).

Windows users: download, extract and run the zip file above. It seems not to support fullscreen mode. The port includes a 1-line fix for a graphics glitch that didn’t show up on my Linux system. Linux users can get updated source here.

Linux users who can’t get a working version of SDL-Perl: download the par/pp version above. Extract and run “minim” (not minim.pl). You still need SDL, but not Perl or SDL-Perl. This version includes the graphical glitch fix mentioned above.

What’s missing in the 48-hour compo entry?

Some of the demo screens are missing animations showing how to draw minims. You can’t load in user-defined levels from an external file. There aren’t as many levels as I would have liked. I intend to add these last few things and post a second version some time in the next week or so.

Why is the game so hard? Why can’t I draw minims?

Drawing minims takes quite a bit of practice. It’s meant to be tricky, especially when you’re running out of time and panicking and can’t draw steadily. It may be helpful to know a bit about how the game judges minims. The most important things are where you start and finish the minim: these points become the ends of its stick. If you fail to draw a minim, you’ll notice a stick with a cross on the end appears nearby. This represents the shape the game expects you to draw. The head of your minim needs to pass through all four quadrants marked out by the cross, without deviating too far from it. Ultimately, this means that you have to start (or finish) your minim at a point on the stick about half-way up the head. One thing I noticed while making levels is that, because you can’t draw mirrored minims, it’s a lot easier to bounce semibreves to the left than to the right. I’ve tested all the levels to make sure they can be completed, but some of them will probably take a few attempts. Keep trying! Or (if you get fed up) cheat by pressing “S” to skip to the next level.

How did you make it?

My development machine is a 3 GHz Pentium 4 with 1.5 Gb RAM, running Debian GNU/Linux (unstable). The game is written in Perl, using SDL Perl (1.20.3) for graphics, sound and input. My text editor is joe; my window manager is FVWM2. For playing the game I used a Wacom Graphire 2 tablet. Sound effects were produced by my voice, recorded and cut in Audacity, but otherwise unmanipulated.

As SDL Perl has no line or circle drawing facilites, I had to implement them myself using a putpixel routine. This was far too slow to be used every frame, so most things are pre-rendered and blitted onto the application surface.

The collision detection routines are not optimised. If you have a large number of semibreves and minims on-screen at once, the game is likely to slow down.

How did you make the Windows port?

Using par/pp. The documentation for how to do this is rather scattered, so here’s a summary.

The problem is that you need versions of Perl, SDL, SDL-Perl, PAR and pp for Windows that will all work together. Perhaps you can build from source, but as I’m not a regular Windows user, I’d rather just download binaries that work.

Perl is distributed freely for Windows by Activestate. I downloaded and installed version 5.8.8.822. 5.10 builds are available, but it’s more difficult to find all the other libraries for it.

Activestate’s Perl includes a utility called ppm for installing Perl packages built on Windows. That can be used to install the remaining packages. SDL-Perl was a little tricky to find. As this page says, you can install the package with the command:

ppm install http://www.broadwell.org/dl/ppm/5.8/win32/SDL_perl.ppd

The package includes the SDL DLLs needed to use SDL from Perl with SDL-Perl.

Now I could run my Perl program on Windows, but I wanted a way to distribute it without requiring the user to install Perl. For that I used PAR and pp. First I installed Activestate’s package of PAR using the graphical ppm utility. Next, following the links on the PAR website to bribes.org, I found a package of pp that I installed with:

ppm install http://www.bribes.org/perl/ppm/PAR-Packer-588_820.ppd

Note that pp packages may be specific to a certain build of Perl.

With everything installed, I could now create a Windows executable of my game:

pp -o minim.exe -gui minim.pl

The -gui switch stops a console window from opening when you launch the executable. The executable still needs the SDL DLLs to run. You can pack them in the executable with pp’s -l option, but I find it easier just to copy all the DLLs into the directory and zip them up for distrubution. On my installation, the DLLs are in C:\perl\site\lib\auto\SDL_perl\ .

Where is your time-lapse video?

Here (2 minutes, 15 Mb). Warning: this video contains bright, rapidly flashing colours. The music is “Corporation” from Makke’s album “It’s Binary, Baby!”. Buy it! It’s really good!

I had a few difficulties with mencoder, so here’s a short description of how I got it to work. For some reason, mencoder crashed on trying to encode the video. Perhaps it didn’t like one of the frames. I got it to build an MJPEG-like video:

mencoder “mf://*.jpg” -mf fps=25 -o output.avi -ovc copy

However, mplayer wouldn’t play that normally. It would write the frames to PNGs, though:

mplayer -vo png output.avi

That gave me a directory of PNGs that it was happy enough to encode normally.

My time lapse sceenshots came to just under 2 minutes (the length of the music), so I thought I’d add a few seconds from my game to the beginning and a still to the end. I used SDL Perl’s save_bmp() grab frames from the game, converted them to PNGs with ImageMagick’s convert (ls | xargs -i convert ‘{}’ ‘{}.png), then resized them (ls | xargs -n 1 mogrify -background black -extent 640×512) and changed them to 8-bit colour (ls | xargs -n 1 mogrify -depth 8) with mogrify. The still at the end I made using GIMP. Renaming them into the right order with rename, I could then join them together with mencoder’s “mf” video source:

mencoder “mf://*.png” -mf fps=25 -o output.avi -ovc lavc -lavcopts vcodec=mpeg4:vhq

After that I used -audiofile to add the music (ripped from CD with cdparanoia):

mencoder output.avi -o minim.avi -ovc copy -oac mp3lame -audiofile cdda.wav -lameopts preset=64

Tags: ,

One Response to “LD11 entry - Minim Madness”

  1. mocker Says:

    Thanks for going into details about how you did this. I am going to be doing an LD entry with Perl +SDL on windows, which will be a first for me, so this is very very helpful.

Leave a Reply


All posts, images, and comments are owned by their creators.