Posts Tagged ‘shrapnel’

Shrapnel Post-Mortem (+ timelapse!)

Posted by
Saturday, December 29th, 2007 6:18 am

This was my fifth Ludum Dare (including 8.5). Before this compo I went through all my previous LD entries and wrote some small post-mortems for them, and looking back, I’ve never been particularly good at handing in finished entries for these compos. I think maybe the first one I entered (7) resulted in the most complete game. That one (which I named Pathmania: Way of the Jelly for some reason, I think it was supposed to be some obscure joke) left a few things to be desired, but it had a title screen, several levels, a random level generator and even a level editor! Shrapnel has one thing it didn’t have, though: Sound =)

Libraries and tools

I used the SDL, SDL_image and SDL_mixer libraries (which in turn uses some libs for decoding png and ogg vorbis), the rest was written from scratch during the compo. All work was done in Linux, using the KDE desktop with 4 virtual desktops. Tools I used was:

  • kate: Text editor. The split view feature is great!
  • gcc: Compiler and cross-compiler.
  • gimp: Graphics. I always use several views of the same image when making pixel graphics, this time was no exception — one for 1x, sometimes one for 2x, and one for 8x or 16x. Sometimes I use a mouse, sometimes tablet, this time I mostly used a tablet.
  • sfxr: DrPetter’s sound effect generator we all know and love. I used the SDL port which I ported myself during the compo =)
  • pxtone: Pixel‘s music editor (v

Other things:

  • xchat 2 and firefox: Internet distractions =)
  • amarok: Music player. Tuned to Nectarine during the compo =)
  • scrot: Screenshot utility, to take screenshots for the timelapse video. Worked really well, I didn’t notice it at all.


I had those previous half-finished entries I mentioned in mind as I started out, and simplified a few things right away. For example, I’ve traditionally used libpng directly for loading images in stead of simply using SDL_image. There’s a few reasons for this, but most of them have usually been irrelevant for my LD entries anyway, and SDL_image is a lot quicker to use than libpng. You just call one function to load your SDL_Surface from a file and that’s it.

So for this compo, I did what I should’ve done all along and went the quick and simple way, using the SDL, SDL_image and SDL_mixer libs. I think that worked out well, it took almost no time at all to set up the traditional black window with an event loop, and some image loading capabilities for good measure. I added sound later on, which was also very quick and simple. I still made the game in plain C, but I did some header magic to autogenerate loading and unloading code for resources, setting defines and including the header several times in the file that should get the handling code. This way I didn’t have to worry about either spreading things out in several places or making some fancy resource management system, just put the resource IDs and filenames in one place, and the resource is instantly available for use with that ID. I’ve done similar things in some earlier LDs, and while the headers can look a bit hairy it works really well =)

The result: Less fiddling with technical fluff, more time to work on the actual game. This was a very good thing, since I worked horribly slow and inefficiently during the entire compo and could use all the time I got. I also had major trouble getting to sleep during the compo, which didn’t exactly help (that happens sometimes, compo or not .. I’ve tried several variants of sleeping pills before, but none actually work on me for some reason). So, I ended up wasting more hours just lying in bed trying to sleep, during the night, than I spent actually sleeping, which ended up being during the day. Ugh.

I also spent some time porting DrPetter’s sfxr tool to SDL and Linux, since the Windows version had some issues when I ran it in Wine, and I was determined that for this Ludum Dare, I would have sound in my game or die trying. The porting work was done entirely during the compo, so that “wasted” some time too, though I don’t really see that as a waste of time since I ended up using the port to make some really nice sounds that I feel add a lot to the game. Similarly, the time I actually spent sleeping, eating and going outside for some air was time well spent, I doubt locking myself in the room for a 48 hour marathon would’ve resulted in a better game. On the other hand I could’ve really used some of that time to make more and better levels. The short and crappy levels are, I think, Shrapnel’s most major flaw.

What went right

Well, I made a playable game, and I think it’s kinda fun despite its many flaws =)

The food I ate during the compo was great, probably the best I’ve had during a Ludum Dare so far. One of my flatmates made us lots of delicious food =)

I kinda like the graphics, too. It’s not amazing by any means, and the ship designs are perhaps somewhat uninspired standard fare, but at least they’re not plain ugly =). The graphics was made in Gimp with my tablet. Before the compo started I had some serious issues with the tablet in Gimp, so I was afraid I wouldn’t be able to use it. Gimp would freeze, crash, make all tools behave like the “move layer” tool, and generally misbehave in any number of ways. Thankfully these issues magically disappeared the day before the compo started when I compiled GTK and Gimp from source and installed that in stead of using the distro’s packages.

The sound effects are great, which I have DrPetter’s sfxr tool to thank for. The time spent porting it to SDL was time well spent in that regard =)

I also like the music, which I made with pxtone (pxtone works well in Wine as long as you touch .ptcop files before saving them, since only overwrite works). I was equally determined to get some music in the game as I was about the sound in general, but initially I didn’t have any musical inspiration at all. I tried to make some tunes, but everything I did sounded like crap (specially since I don’t really know any musical theory, it can be a bit hit or miss). I was ready to give up and continue making the game — this was during the last hours of the compo, there wasn’t much time left and I really should be spending time on more important things than trying to make music — and even switched over to the code desktop, ready to do some coding again, when the whole tune suddenly popped into my mind out of nowhere. So, I switched back to pxtone and, according to the timelapse images I’ve got of my desktop, the primary and secondary voice was basically complete in literally three minutes for the first half, four more for the second half, note for note what you hear in the final tune apart from some minor tweaks I did later. That includes time for listening to it a bunch. It was so weird! I did spend some more time with it later, added the drums and such (and made the ingame background thing), but the whole thing was done pretty quickly. Most of what you can see of the pxtone window in the timelapse video (below) is actually rejected tunes, listening to it, and doing and undoing small insignificant tweaks =)

What went wrong

I already mentioned a bunch under General, so I’ll skip that here.

By far the two biggest complaints I’ve seen about my game in the comments have been that the game is too short, and that there’s not much connection to the chain reaction theme, and both of those are really at least partly because of the levels, or lack of, and their design. Actually calling it “level design” is a bit of a stretch since I didn’t really put much thought into their design at all, there wasn’t enough time. They were literally thrown together at the last minute. For the next compo I really need to set off some time for level design, or make some game where level design isn’t so important.

There really are chain reactions in the game, I made the game with the idea in mind from the start — when you kill enemies, they send out shots that kill any other enemies they hit (or you!), which again sends shots when they die to kill yet more enemies, and so on — it’s just not very apparent that they’re there since the level design I mentioned doesn’t really take advantage of the fact at all, except perhaps for this one place. So, there’s not often you actually see chain reactions happening unless you’re both lucky and work really hard at making some. Originally I wanted to have a bit more advanced enemy behavior too, with them floating around the screen for a while before going on, going both left and right and upwards in addition to just down, so that you had to choose both where and when to shoot to make the most chain reactions possible. I’m sorry I didn’t get around to that, because I think that that would definitely have been a much better game. However, that would also have required good level design, and even with the current enemies I think that some decent level design, levels to really set up potential chain reactions, could have had an impact.

Also, the scoring system could use some work perhaps, but the effect the chain reactions have on the score isn’t really obvious in any case (see next section). There should have been some visual feedback when combos happen and such, or at least a mention in the readme in the slim chance that someone should happen to read it.

There’s also a few bugs that slipped through. The most apparent one is probably that the last level sometimes ends before you get a chance to kill the last few enemies, so you win the game with enemies still firing shots at you =). Another bug is that the Alt test when pressing Alt-Enter for fullscreen doesn’t actually work, so you go into fullscreen just by pressing Enter without Alt. Maybe that’s a good thing though, since the fullscreen toggle is undocumented and it’s easier for people to accidentally discover it that way =)

Another undocumented feature is the joystick support. I wonder if someone used it?

Last words

Overall, I think I’m going to call the game at least a partial success. I didn’t get done nearly as much as I wanted to or even could have had I been more efficient, and the levels are a huge detractor, but it’s still kinda fun to play, and I like it =)

By the way, it actually is possible to take advantage of the chain reactions for higher scores if you’re just aware of the scoring system =). I think my record is around 11800 or so.

First, you lose one point for every shot you fire, so if you want high scores it’s in your best interest to not just keep firing, but choose somewhat more carefully where and when to fire.. like a bleak shadow of the original intent with the smarter enemies, heh. You only score 1x the points for each enemy you kill yourself, but enemies killed by the death fire of other enemies get a combo multiplier — 2x for the first one, 3x for the next, and so on. Score is also multiplied by the current level number.

Or, if scoring’s not your thing, you can also try to beat the game by not firing a single shot =)


Finally, here’s a timelapse video of my desktop during the compo. I turned off the computer when I went to sleep, since it’s a bit noisy and is in the same room as my bed, so it’s broken into three parts. I use four virtual desktops, you can see which one I’m in in the little indicator at the taskbar if you look closely. During the compo I used the top left mostly for code (kate), top right for graphics (gimp), bottom left for IRC (xchat2) and internet (firefox), and bottom right for sound (sfxr) and music (pxtone) and sfxr porting =) (except for day one, when sfxr porting was done in the top left desktop).

There’s one screenshot for every 30 seconds at 30 fps. I used scrot in a shell script loop to take the screenshots in the background during the compo, and then mencoder to combine them into this video.

Hm, looking at this I seem to be doing a lot more work than I actually did. Like I said, inefficient..

Shrapnel: sound latency fix

Posted by
Tuesday, December 18th, 2007 10:10 am

For everyone who was having issues with huge sound latencies in Windows, here’s an updated zip that should fix the issue:

[ ]

The only changes in that zip from the compo version is that I rebuilt the executable without debug info and with optimization (no code changes), removed svn files to make the zip smaller, and replaced the buggy SDL.dll I was using with a good one from

I’ll probably write a postmortem in a few days.

Shrapnel: Final entry

Posted by
Sunday, December 16th, 2007 7:00 pm



Downloads (both have windows exe + source code and Linux makefile):

Uses SDL, SDL_mixer and SDL_image. I used kate for code/text, gimp for graphics, sfxr for sound effects (thanks DrPetter!), and pxtone to make music.

If the Linux version crashes when you run it on 32-bit x86, use this SDL library (contains a fix for a bug in SDL_SoftStretch)

Edit: Figured out the Windows sound latency issue! Seems the SDL.dll I used was buggy. Replacing it with one from fixes things.

[cache: storing page]