Hacker News new | ask | show | jobs
by fredrb 1735 days ago
This is very interesting. Unfortunately it seems to be closed source and they're still working on a more technical blog post.

I wonder how they encode all the information in the PNG file? Apart from the .zip with the entire ROM I assume they snapshot the current memory state on the beginning of the Quote and all the subsequent inputs.

3 comments

You can see the source here: https://glitch.com/~tenmile we haven't taken the time to figure out what precisely what the appropriate license should be, though it will probably need to be GPL since the emulator we use is GPL licensed.

That said, the basics of making a quote are so simple that it should be pretty easy to add Playable Quote capabilities to other emulators with a minimal amount of code.

A full writeup of how it works is here: https://joel.franusic.com/playable_quotes_for_game_boy

Thanks for reminding me that our site said the post wasn't ready yet, I've just updated it with the link to that blog post!

Most gameboy games use banked memory, swapped in as 16k chunks. I'd wager a guess that the recording process monitors what chunks get banked in during the recorded gameplay, removes any bank that isn't used, and then restarts the demo if that removed data is accessed, as a failsafe.

The Raccoon demo behaves the way I might expect this to work: most potential player inputs allow you to reach the Raccoon, trigger his two text prompts, and cut the grass with Link's sword. But you can't enter any other screen, can't leave the second screen out the bottom, and can't perform most other actions; the moment you do, the game would need to run code that the quote never accessed, which triggers the failsafe. Even performing certain "safe" actions out of order occasionally fails, I'm guessing due to the RNG for stuff like leaf particles and whatnot.

We actually monitor each individual byte of memory accessed, then add some (configurable) padding around those bytes to make the quotes more durable.

You can see what that looks like in this visualization of the Racoon demo: https://tenmile.quote.games/quote-visualizer.html#drop=https...

That's extremely cool, thanks a bunch for the clarification! I'm working on an NES emulator that runs in the browser, and while it's not fit for purpose yet (lacks save states and recorded-input playback), this might just inspire those features. Seems like it should be a fun weekend project :)
Awesome! I'm really happy to hear that. I expect that you're going to have a LOT of fun with that project. Please let me know if you ever need another pair of eyes to help with your project, even if it doesn't involve adding support for Playable Quotes. As I recall, the Game Boy shares a lot of design features with the NES.

Oh, and regarding recorded input playback. That is something we haven't gotten working yet. Some of the details for that are in our blog post. The short version is that button presses can happen in the middle of a scan-line, which can make it really tricky to play back if the emulator wasn't designed with that in mind!

It doesn't sound like they include the entire ROM, only the parts necessary to play back the recording. If you "take control", the game may try to access parts of the ROM which are missing, which causes the quote to reset. This happens frequently with the Metroid II example - the Tetris one seems much more robust.
Exactly right! Part of a quote is a "ROM validity mask" which is checked on each memory access. When an "invalid" memory address is requested, we'll fire a callback which in this case just resets the game.

The durability of each quote depends on the actions taken while the quote was being made. In the quote of Metroid II, for example, many of the sprites were not recorded, so unless you do exactly what was done in the recording, you'll get a reset.

Here's a visualization of the Metroid II quote: https://tenmile.quote.games/quote-visualizer.html#drop=https...