Logo Pending


Musings on iMuse

One of the things I think LucasArts got Sierra beat in with regards to their old point-and-click adventure games has to be the music. I don’t mean that the music itself is better, but the underlying technology.

In SCI, a given music track can have cue points and a loop. These cue points can increase or set a value visible to the game engine, and let the game time things accordingly. Notable examples off the top of my head include the singalong text and images in Freddy Pharkas Frontier Pharmacist, the selection highlight following the beat in Quest For Glory, the singalong in Leisure Suit Larry 6… yeah.

But that’s just one way. The song can nudge the game, and that’s about it. A harmless bit of Mickey Mousing at best.

iMuse, on the other hand? The DirectMusic of its day. Remember DirectMusic? Me neither. Anyway, an iMuse song (near as I understand it) has queued triggers and a sense of beat, allowing the game to say “hey, switch to the cartographer’s version of Woodtick” and the song would wait for the current beat to finish, play a little flourish, and seamlessly transition into a different song. You could cancel them too, if you were fast enough. And let’s not get into the most triumphant example I’ve heard so far, X-Wing/Tie Fighter.

I figure if you give an SCI track beat markers, preload a fill riff, and have a script listen for requests, you might be able to approximate the basics. If you’re playing variations of the same song that only differ in instruments, you might be able to mute specific tracks, or send raw “Program Change” messages if you’re really adventurous…

But yeah. That’s why you can have proper MIDI dumps of SCI games, but you can’t quite hack it with most SCUMM games.

[ , ] Leave a Comment

King’s Quest 4 Copy Protection

King’s Quest 4 – The Perils of Rosella starts with a copy protection challenge right off the bat.

If you were playing the original 1988 version you could just enter the magic word “bobalu” and be done with it, but the 1989 version removed this.

It’s a pretty simple challenge-reply system, but the interesting bit is how your answers are considered. If someone were to somehow find the challenges they would also find the answers in the same order, but there’s a catch: the answers are hashed.

Very simply so, but they are. And of course the script code containing the challenges and answer hashes is compressed in the RESOURCE.001 file, and the whole thing is script code and nobody outside of Sierra could be expected to be able to read that stuff back in 1988. Sure, maybe some people could but still good luck figuring out how this worked. Even the backdoor phrase was compressed.

But now it’s 2018, nearly 2019, and I for one have made happy use of the tools now available to us, mostly to slake my own thirst for knowledge. So here’s how it works.

The copy protection script has several local variables: a random number from 1 to 79, the challenge text, the correct answer’s hash, a buffer for the user’s input, the hash for said input, and some work variables.

On startup, the random number is chosen. Then, in a big ol’ switch statement, the correct hash is decided on:

(switch (= randomPick (Random 1 79))
  (1 (= requestSum 431))
  (2 (= requestSum 521))
  (3 (= requestSum 535))
  ;...
  (79 (= requestSum 686))
)

In another big ol’ switch (instead of doing it at once?), the matching challenge is set up:

(switch randomPick
  (1 (= requestText "On page 2, what is the fourth word of the first sentence?"))
  (2 (= requestText "On page 2, what is the fourth word of the second paragraph?"))
  (3 (= requestText "On page 3, what is the fourth word in the first paragraph?"))
  ;...
  (79 (= requestText "In the section TIPS FOR NEW ADVENTURE PLAYERS, what is the eighth word in the first paragraph of tip #2 (STAY OUT OF DANGER)?"))
)

Incidentally, I said our guess would be stored in a buffer variable, that is an array in memory large enough to contain it, but I did not say any such thing about the challenge text. That’s because it’s stored as a pointer to the text, in the place it was loaded to as part of the script. From then on these challenges don’t mutate in any way. Our input can be literally anything.

Anyway, after displaying the challenge, we have our input in a buffer. This is where the magic happens:

(= i 0)
(while (< i (StrLen @userInput))
  (= ch (& (= ch (StrAt @userInput i)) $005f))
  (StrAt @userInput i ch)
  (= inputSum (+ inputSum ch))
  (++ i)
)

Iterating through the user’s input, we read the next line inside-out. Using the StrAt function we fetch the next character and store its value in our work variable. Then we use some binary magic on that same value to turn it into UPPERCASE, and assign that to our work var. Now, as I write this I feel like this can be simplified a little bit…

(= ch (& (StrAt @userInput i) $005f))

…Yeah, that seems nice. I don’t think it’d hurt functionality to do this. Anyway, the next line shows how SCI function and kernel calls can be variadic as all get out — given three arguments, StrAt will set the character on the given spot. In the third line, we add the character’s value to our running sum.

And that’s it! We can now compare our input to the expected answer, and either continue on to the title screen or display an error and quit.

But that’s not all there is to it. First, for some reason, the input is uppercased and then stored again, character by character. This is so the 1988 release can compare it against the magic backdoor word, which is also in uppercase. This seems like an awful waste when you could compare it against a number instead. Not to mention, the 1989 release doesn’t even have the backdoor and still does all this. (For the record, that would be 437.)

Second, this is such a simple method that there are guaranteed to be words with the same hashes. For example, “voice” and “licks” are both 374.

But yeah, that’s just about all there is to know about the copy protection in King’s Quest 4 – The Perils of Rosella.

[ , , , ] 7 Comments on King’s Quest 4 Copy Protection

Palette Cycling in Space Quest 4

It’s a followup.

Here’s Roger falling through the chronostream in the introduction:

And here’s the EGA release’s take on that shot:

I immediately thought, of course, the EGA release wouldn’t support palette cycling effects. That’s the official EGA release, with an ega320.drvnot the later ones with ega640.drv. Totally different.

But what if I were to make SQ4 VGA use ega640.drv? What would happen? Would the background remain static?

Keeping the answer under the fold for all you epileptic viewers out there.

Continue reading “Palette Cycling in Space Quest 4”

[ , , ] Leave a Comment

Palette Cycling in Larry 5

I distinctly recalled just before posting this that one particular room in Leisure Suit Larry 5 – Passionate Patti does Pittsburgh a Little Undercover Work had a palette cycling effect that bit into the 64 global colors of the palette. So I enabled the debug handler, loaded up ScummVM, and Alt-T’d my way over to room 700.

…It looks perfectly right. That’s not right.

Now, you’ll notice the Fast Forward icon isn’t grayed out. That’s what you get when you cheat, but that’s hardly relevant here.

Had I remembered wrong? Was this the wrong screen? No, surely my memory isn’t that bad? Besides, old adventure games are relevant to my interests. I don’t tend to forget things about those.

But then again, this is ScummVM. What does DOSBox have to say?

Thank you, DOSBox. I figure it must be because ScummVM draws it all in truecolor mode, manually applying the effect to the background, as opposed to the original actually changing the VGA color palette.

(Any political implications are entirely in the reader’s head.)

[ , , , ] Leave a Comment

Codename: OUCHMAN

So I’m making my own install/setup program for The Dating Pool, that also happens to be 100% compatible with Sierra’s games. Fun, fun. What’s was particularly funny to me is the size difference.

Sierra’s installer is at minimum three separate files. One is the installer proper @ 74.4 KB, one is the on-screen text @ 9.21 KB, and one is the driver database @ 17.2 KB, totaling 100 KB. Add to that the “install to hard drive” script file for another 1.80 KB if you want, but that’s optional.

Mine is, with all the features it has to offer so far (and I can certainly add more) a mere 34.4 KB. This includes every single bit of on-screen text. It is almost entirely self-contained. The presence of a single extra file switches it into “install to hard drive” mode, and that file merely specifies the standard target directory and the number of disks. Add another four kilobytes if you build with -DISOFONT for 256×16 bytes of extra font data, subtract about a half if you build without -DNORTON.

But then I wondered, how does Sierra’s installer do a bunch of things exactly? Like how does it know it’s being run from CD so it knows to invoke that script at the end, among other things? It’s not the presence of the script file, since that’s copied right along. So I opened it up in IDA… and was told it was compressed.

Turns out install.exe is actually a whopping 167 KB. You’ll excuse me for my curiosity…

17.7 KB. With everything but the disk install trigger file built-in. Sweet Christmas.

[ , ] Leave a Comment

Sierra’s setup/install program

Let’s summarize!

First of course we had this subdued thing. It doesn’t state its version number, and has no main menu – it just goes through all the different driver selections, then offers to copy the game to your hard drive. I got this from The Colonel’s Bequest. King’s Quest IV (1988) has the same, but with a different caption: “3D Adventure Game Setup/Installation Program”.

Unstated version, goes through a fixed script asking which driver you want and if you want to copy the game to your hard drive at the end, exactly like the original… but in color! Found this one in Space Quest IV (disk version).

Version 3.15b looks like the SQ4D version, but actually has a proper menu like those from later on. This one is from the Leisure Suit Larry 1 SCI remake.

Version 3.31 brings the finalized style. This copy is from the Space Quest I remake.

Version 3.569 is pretty much the same, but the copyright box is taller.

Version 3.681, again not much to write home about. The copyright has been amended. I got this from Space Quest III, which is chronologically confusing to me. Version 3.690, from Freddy Pharkas, bumps it up to 1991-94… but to add to the confusion, the diskette version of Freddy Pharkas is version 3.644, with a 1991-93 copyright. To round out the confusion, the SVGA version of Leisure Suit Larry 6 has installer version 3.670, copyright 1991-93 as well. What ever!

Rounding out the official installers we have King’s Quest 7′s installer, now called inst.exe, version 3.758.

And finally, because nobody asked for it…

…there’s my from-scratch rewrite. Functionally on par, this is still missing a few features such as viewing a readme file, making a boot disk, detecting if a given driver is supported to begin with (it only shows known drivers that it can find the DRV file for, like the B/W installers, but doesn’t do the “supported by your system” tick marks), only showing options in the main menu if there’s a choice – if you only have VGA320.DRV, it shouldn’t show “Graphics”. The minimal menu should only show “Mouse”, “Memory”, “Make boot disk”, “Accept”, and “Cancel”, and actually installing the game to HDD (at least, the same way Sierra’s does). But other than that, it’s basically a drop-in replacement.

That version number will reach 1.000 soon enough, mark my words.

[ , ] Leave a Comment

Evolution of a Title Screen

From day one, the title screen for The Dating Pool has been rendered, with one short intermission. Looking back at my development archives, I felt I should show the unseen. So in the inimitable words of Verka Serduchka… Let’s begin!

The original title screen was a closeup of the main character’s little black book, in what was then planned to be her bedroom. Between the default textures and the book’s cover being edited in post, I honestly can’t remember why I replaced it… but it’s not exactly evocative of a “dating pool”, or any kind of pool, really.

Ah, the original demo release’s title screen. This is actually slightly newer than it should be at this point, with the wine and glass added, but who’s keeping track? Maybe me at best, but I hardly did. Anyway, I’m not gonna hunt down a copy without the wine only to post this version a little later.

At one point I figured the 3D renders could serve as the basis for pixel art redraws. I put hours into this image, only to not use it at all. Honestly, I can’t quite remember why I gave up on that idea. But before the demo was in a playable state, I’d reverted to the render and added the wine. Perhaps it was just to not increase the workload even more, or maybe it was because it didn’t actually help solve some issues with global palettes that I’d hoped it would. Oh well, what’s a few wasted hours when you have this much free time to waste to begin with?

And that brings us to the title screen as it is now. The Itch demo has a slightly earlier version of this screen that’s a bit shinier in silly places, but otherwise it’s the same.

(2018 note: the above paragraph was later outdated by an updated demo release.)

I wonder if should put some animation in this. The old screen had the flickering candles… Anyone?

[ , , ] Leave a Comment

Adventure game background art

Ah, Sierra. You gotta love the beautiful background art in their VGA games. From the cartoony…

…to the outright pretty…

…you have to admit someone was credit to team.

But then there’s games where they seemingly dropped the ball (in my opinion) for whatever style-related reason…

…or simply didn’t do much “background art” at all…

And that makes me feel…

Well, okay, I guess, about using edited Gmod screenshots from Letrune in “The Dating Pool”, turning this…

…into this:

[ , , , , , , ] Leave a Comment

The Dating Pool – One Day Demo

Yes folks, that’s right. It’s a brand-new point-and-click adventure romp!

If you think that looks at all like the classic Sierra interface, you’d be right! This not only looks like a classic Sierra game, it actually runs on the same engine! None of that cheap-ass Adventure Game Studio bullshit here, folks, this is the real deal!

And just in time for New Years Eve, here’s a public preview release: http://helmet.kafuka.org/sci/catdate

Go ahead and try it. If you have any suggestions for the full version, including things you’d change in the part shown in this demo, don’t hesitate – my askbox is open.

(Protip: get DOSBox.)

Update: crash fixed in certain scene, thanks to @iliketurnips for notifying me.

[ , , , ] Leave a Comment