Sponsored By

Development Diary: Dink on iPhone - DMOD support

More on porting a DirectX 5 game from 1998 to the iPhone.

Seth Robinson, Blogger

January 6, 2010

4 Min Read
Game Developer logo in a gray background | Game Developer

The second development diary on porting my old game Dink Smallwood to the iPhone.

Recently 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)

IMG_0007

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.

IMG_0008

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:

IMG_0006

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


And finally:


IMG_0002

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

IMG_0003

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.

Read more about:

Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like