Previous Post

Project: DirkSimple

Next Post
Project: DirkSimple
1 / 6
DESCRIPTION

I have been in love with Dragon's Lair since six-year-old me wandered into a K-Mart that had an arcade room.

It was like nothing I had ever seen before...it was just a quantum leap ahead of the state of the art.

You have to understand the level of graphics available in 1983. You would pay a quarter to try a game for something that looked like this, the most successful arcade game of 1983:

And these two games were also the brand new hotness that year...

I'm not aiming to disrespect Mario, Luigi, or Ms. Pac-Man; I loved these games, too. But Dragon's Lair? Oh god, it was like saturday morning cartoons any time you wanted...which I realize also doesn't clarify things 40 years later, so you'll have to take my word for it. Here's the hero, Dirk the Daring, running from a boulder, Indiana Jones style:

Dragon's Lair didn't do raster graphics: it didn't light up pixels, it didn't move around sprites. It got its graphics from a "LaserDisc," a much-larger--and believe it or not, analog--ancestor of the DVD.

The game, arguably the granddaddy of the Quick Time Event, would show you a scene, lovingly hand-animated, and as you took actions (up, down, left, right on the joystick, and a button to use your sword, all of which meant different things in different moments) it would seek to a different sequence on the disc to show you what happened next, good or bad. It felt a little like controlling a movie, back when that idea was science fiction from the future.

It didn't matter that it cost a dollar to play when everything else cost a quarter, and that you were going to lose fast. It was still awesome.

So, as I modded one of those Arcade1Up cabinets, this was definitely a game I wanted to play on it.

If you want to play Dragon's Lair on a RetroPie cabinet, you can. It'll launch a copy of Daphne and none of your controls will be configured and you'll be wondering how to quit the game (surprise, there's a good chance it accidentally defaults to whatever you use for the coinslot button, which turns out to be a real headscratcher when you're trying to start the game).

There is a libretro core for this--that's lr-daphne--which would solve all these problems, but apparently the thing is a mess. You have to put files in some weird places, and it doesn't actually _work_...at least, I couldn't coerce it to.

So I decided to do something about it.

I've written a Dragon's Lair player, which I'm calling DirkSimple (because it's dirt simple and every piece of software that deals with Dragon's Lair has to be named after a character from the game, by law).

It's a little bit of C code that renders Ogg Theora movies, and a tiny bit of Lua code to provide the game logic, and then thousands of lines of Lua to make a single table with all the scene timings. You just point the program at something called "lair.ogv" and it does the rest.

When I started implementing this, after adding seeking support to TheoraPlay, and filling in a basic engine, I thought I'd just sit down for a few hours and fill in that table. It didn't take me long to realize that a) this is a big job and b) I'm way too much of a perfectionist to just sort of make it close enough.

So I asked on the Daphne discord: has anyone reverse-engineered the arcade cabinet's ROM to get this data?

Turns out, someone had. His name is Matt Ownby, and he wrote Daphne, so he had a little experience with this stuff.  :)

Matt was kind enough to give me a .NET program he wrote called "RomSpinner," which just puts all the possible game choices into a little GUI app that you can click around in. I started filling in data from this, and even this was taking days, so I ended up using dnSpy to hook into the app and extract all the info to a text file. This felt like dark magic. I was, briefly, some kind of wizard.

Then I wrote some perl code to extract the info from this text file, and then I wasn't a wizard so much as a lunatic, but it got the job done. Now I was just manually cleaning up timings. It turns out laserdisc players from the early 1980s take awhile to accept a seek command, so I had to bump out the end-of-scene timings a little...presumably the arcade units would send the next seek command before the scene was over. I ended up writing a little Lua code to find the edges of scenes and let me step through the Theora video one frame at a time, to mark the definite last frame.

Just like that, it was game time. The whole game was playable, with the quirks of the arcade cabinets, like the drawbridge sequence being skipped, and the mirrored rooms and such.

I believe the scene sequencing is correct, too, as the game has a very specific set of rules as to what scene it will choose next. The Dragon's Lair Project turned out to be a handy resource for things like this, since they've spent so long poking around the game's internals.

And, of course, I wrote a libretro core.

The core works as you would expect; you just point it at a file named "lair.ogv" (or "lair.dirksimple", if you prefer) and your controls and such all work.

Being libretro, it also supports fast-forwarding, and more importantly, save states, which is helpful in trying to beat what can be a murderously hard game.

Right now DirkSimple only plays Dragon's Lair. In the future, I'd like to add other games, like Space Ace and such.

To be clear, this thing isn't trying to replace Daphne, which plays almost every laserdisc game ever made as an actual emulator: it emulates the original machines' CPUs, with the original ROMs, and can talk to real laserdisc players or fake it with an MPEG-2 file. It can (legally!) download video content if you present it a copy of a Dragon's Lair DVD from Digital Leisure. It has a million options and features.

I was aiming for something small and without complexity, though, and I think that there's room for both things in this world.

The source code to DirkSimple is on my GitHub. Enjoy!

(this was one of the "One Last Things" that I previously mentioned. The other is getting final details in place right now and will be along asap.)

Ryan C. Gordon PATREON 3 favs
VIEWS1
FILES6 files
POSTEDJan 21, 2023
ARCHIVEDJan 21, 2023