Development Diary: Dink on iPhone – DMOD support

More Dink stuff.  I’ve been focusing on the more technical parts, especially dmod support.

Please ignore the ugly temporary GUI I’ve got going now.

Day/night mode added! Just kidding, just some palette glitch.

The .dmod format

When Dink was developed, I didn’t give too much thought to how add-ons would work.  Here is what it had:

  • Each dmod gets its own directory name
  • A readme.txt with a lot of info that I don’t think anybody uses, unsure
  • A text dmod.diz file would include the name, a line for copyright, a url, and a description. (starting with Mystery Island?)
  • preview.bmp that nobody uses (Actually, I think this was added by redink/Merlin for the 1.08 release, not me)

So yeah, very basic.

Also missing was a way to package and install them.  The first DMOD’s (Search For Milli Vanilli and Mystery Island) were packaged with .exe based installers that would locate the dink directory (in the ugliest way possible) and create a directory there.

By the way, Search For Milli Vanilli has a 4.6 rating?? Come on!! First DMOD ever, giant heads, awesome music, and eerily predicting the future mean nothing?! (The map.dat is dated 10/15/1997 .. yeah, not even I would be in poor enough taste to do the dmod AFTER what happened)

So I thought everybody would create a windows-centric .exe for each add-on?  Dumb idea, especially back before the era of nice free install makers.  So we ended up with a bunch of zips/rars/lha’s or whatever without a real standard.

Then, an enterprising lad from the Dink community by the name of Merlin created DFArc, a utility to help install and manage dmods.

He invented the “.dmod” file extension.  (I think?)  This is basically the above but compressed as tar.bz2.  (Grr, I only support .zip in my game framework!)

Then, the dink community went through the laborious task of converting existing dmods to .dmod format making everybody’s life easier.

Tar.bz2?!

If I want to make the DMOD experience smooth and take advantage of the currently 301  add-ons (some as big as Dink itself), I need to allow you to download and install the original .dmod files.  No porting, no special iPhone versions.  No repackaging.

First I improved my net code to handle redirects and allow in-game downloading by URL: (there will be an easier way too, but this “manual” download way will remain, useful for testing or just installing any dmod you feel like)

Enter any URL your heart desires. It just better be a .dmod.

I searched in vain for a small and portable tar.bz2 unarchiving class so ended up writing one using the bzip2 library.

Tar is a dead simple format, especially when you can ignore stored file permissions and the like.

I force all files to be lower-case when writing, helps with the case-sensitivity issue.

Single pass un-bzip2'ing and un-tar'ing. Quite zippy.

After it’s finished, it will kick back to the scrollable DMOD management screen:

Basic, but functional. I will add more text and probably icons for the readme and url if applicable.

And finally:

Ta-da! You're now playing a user made add-on from the comfort of the train and/or bathroom!

Incorrect aspect ratio and no midi music yet, but hey, it's playable.

What next?

Well, most of the technical issues are out of the way so it’s time to move on to interface and better audio.  At first I was thinking I wouldn’t need to support midi because I was going to remaster the whole dink audio track, but now I see midi support is a must for dmods.

So do I want to spend $500 to license fmod for iPhone? (I used this for Prey Invasion, so I’m already familiar with it… that would also give .mod/.xm support.  iiiiinteresting.)

Is there anything with similar functionality that is cheaper?  Hurrumph.

Thanks to magicman, Ex-D, and scratcher from the Dink Network‘s chat for helping me out.

17 thoughts on “Development Diary: Dink on iPhone – DMOD support

  1. DaVince

    I have no idea what your options are or if it’s portable enough, but fluidsynth can handle MIDI playback pretty well… It’s GPL, though, if that’s a problem.

  2. Davor

    Wow, nice job, only one question though, will you be making an Android port? Pretty please with a mango on top? Please please please please please please! I love the game and it brings me back to my childhood days and I really want to experience the Dink on my Android phone.

  3. Seth Post author

    Davor: Yep, hope to port Dink to Android soon! In some ways it will be the best mobile version due to the loosened restriction of the platform. (full in-game DMOD downloading/running, rather than the crippled version I had to do for iPhone)

  4. Seth Post author

    Will probably start on it in a couple days, will give an update after I get a better idea of how it’s going to perform.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>