brhfl.com

JPEG Comments

A while back, floppy disk enthusiast/archivist, @foone posted about a floppy find, the Alice JPEG Image Compression Software. I suggest reading the relevant posts about the floppy, but the gist is that @foone archived and examined the disk and was left with a bunch of mysterious .CMP files which appeared to have JPEG streams but did not actually function as JPEGs. Rather, they would load but only displayed an odd little placeholder1, identical for each file. I know a bit about JPEGs, and decided to have a hand at cracking this nut. The images that resulted were not particularly interesting – this was JPEG compression software from the early ‘90s, clearly targeted at industries that would be storing a lot of images2 and not home users. The trick to the files, however, was a fun discovery.

The title of this post gives it away, I realize – the real images were effectively ‘commented out’. Here’s a hex dump of the relevant chunk of one of the photos:

(offset)   (hex)                                              (ascii)
00000270   F4 F5 F6 F7 F8 F9 FA FF C0 00 11 08 00 3C 00 50    .............<.P
00000280   03 01 21 00 02 11 01 03 11 01 FF DA 00 0C 03 01    ..!.............
00000290   00 02 11 03 11 00 3F 00 FF FE 00 0E 49 4D 41 47    ......?.....IMAG
000002A0   45 20 44 41 54 41 3D 3E C6 B1 3F E8 51 7F BB 52    E DATA=>..?.Q..R
000002B0   13 5E 64 BE 26 7D 65 1F E1 C7 D1 08 EA DB 73 B4    .^d.&}e.......s.

Something sure looks suspicious in that ASCII column, doesn’t it? Let’s talk briefly about JPEG files. JPEGs contain a number of different sorts of data: EXIF/metadata, the Huffman and quantization tables used to compress the image, information about the details of the image (bit depth, dimensions), and the image data itself, to name a few. All of this information is split up into chunks prefixed with a two byte code: FF followed by another byte that says what the data that follows is. At offset 277, we see FF C0. This is the start of frame, and the next seventeen bytes tell us (among other things) that it’s an 8-bit/channel color image, 80x60 pixels3. At offset 28A, we run into FF DA, which is the start of the image itself. This only runs for 11 bytes, until we hit FF FE at offset 298. Those 11 bytes are the odd little placeholder image from above, and FF FE is, as you can probably guess, a comment.

Comments aren’t that prevalent in JPEGs. JFIF, EXIF, and XMP data are all stored in application-specific data chunks (much like the layer information in Adobe Fireworks PNGs). Comments are typically used to mark what encoder produced the JPEG, and that’s about it. But, much like using comments to soft-delete code, an entire image can be stuffed in there, waiting for a specific decoder (or hex editor user) to erase the placeholder image and the comment prefix. Presumably this is just what the Alice software did: it would find FF DA, and ignore everything until after FF FE 00 0E IMAGE DATA=>. Other decoders would simply ignore the real image, because that’s what the JPEG spec tells them to do.

Not seen above, but necessary for the process to work and interesting to consider is the sequence FF 00. All markers, including comments, are only terminated upon encountering another FF byte. Once you get to the compressed image data, you’re likely going to need FF bytes that aren’t instructions to the decoder. These are essentially escaped by the two-byte sequence FF 00. The decoder knows that this is not the start of a new chunk, but rather a literal FF. This works across the board – which means that our commented-out image can (and does) contain several FF 00 sequences, and the decoder does not interpret this as termination of the comment.

Finally, it’s worth noting that JPEG images end with FF D9, which are (expectedly) the last two bytes in any of the given .CMP files. The placeholder image doesn’t need its own FF D9, since the one at the end of the file is the next marker that’s encountered after the comment regardless. In fact, doing so likely would have required additional logic in the Alice placeholder-removal scheme, as you would now have to ignore the end-of-image marker under (exactly) one specific condition on top of everything else.

This is obviously not a robust form of copyright protection, and seemingly lends itself to an inefficient set of Huffman and quantization tables as well. These inefficiencies could likely be handled better by modern encoders designed around needing tables for two images, and it is interesting to think of potential use-cases. One could, theoretically, comment out encrypted image data, while leaving a placeholder image that tells a user as much4. Practical? Likely not, but as much as us code nerds take our ability to comment out code for granted, it’s rather fascinating to see the same techniques played out in the binary sphere.


  1. I have a policy against including raster images in my posts, but this seems like a perfectly valid time to make an exception: Two 8 x 8 grids of greyscale pixels that start highly contrasted in the upper left and fade to the lower right.. ↩︎
  2. Among other things, the images seemed to be of forensic evidence, automobile damage, a patient’s teeth, and a museum artifact. ↩︎
  3. The sample image chosen for this demonstration was a thumbnail; 80x60 are actually the correct dimensions and not part of the placeholder. ↩︎
  4. Some data would likely still get through – image dimensions, for one. Presumably these are not sensitive, but what about the Huffman tables? How much information can be gleaned from the bits and bobs that define the image compression? Could these data chunks be encrypted and commented out as well? ↩︎

Americana

Americana is currently up on Kickstarter, waiting to be backed. Be sure to check out the Kickstarter campaign or the quick start rules.

A while back, I wrote lovingly of a sweet little tabletop RPG (TTRPG) called Mirror. Currently, I am in the middle of a campaign of an upcoming (to Kickstarter, October 1) TTRPG by the same author (a personal friend, it’s worth noting1), entitled Americana. I have no real desire to discuss the nitty-gritty mechanics of, say, where the dice go and how to use them, but as far as my experience is concerned this all works well. I don’t mean to be dismissive of the gears that make the clock tick – all the little details are incredibly important and difficult to make work. I just don’t think that writing about them is particularly expressive, and Americana has a lot of implementation facets that really make for a compelling experience. These experiential details are what I’d prefer to discuss.

Americana is a murder-mystery. The ultimate goal is to solve the murder of the group’s mutual friend. Thus, while there will be all manner of conflict, the primary driving factor for success is that of deduction. In its default state2, it’s a game of deduction defined by play – nobody, not even the game master (GM), knows who the murderer is. For a potentially-relatable board game comparison, it’s less Clue, and more Tobago3. By the same tack, the GM doesn’t come to the first session with a fully-developed setting. Instead, the first session is essentially a collaboration between the GM and players to figure out make decisions on everything about the town the characters reside in. Its size, its local hangouts and cliques, the adults who will yell at you for smoking in the alley. It’s an approach that gives the players agency, and therefore makes them more invested in the narrative. This is, perhaps, less important in a lot of TTRPG settings; you don’t necessarily need to be invested in the dungeon you’re slashing your way through, you just need a compelling hook (of course I want to slay Richard the cockatrice and avenge the death of my sister, the statue!). But, for a group of teens to band together in the confines of a single town to sneak around and solve their mutual friend’s murder? The additional level of engagement makes the whole thing more personal.

Character generation is, of course, also done during the first session. To add one more collaborative element to setup, however, the group collectively creates an additional character: the dead friend. Your own personal Laura Palmer gets assigned skills just like any other character, which any player character can make use of throughout the game via a clever flashback mechanism. Largely, however, the dead friend’s sheet is whitespace, to be filled with a Charlie-Kelly’s-mailroom-esque web of characters, places, objects, and their ties to the victim. During setup, it’s another place where players get to create their own investment into the campaign. For the rest of the game, it’s the framework of deduction.

Engaging experiential details like those compel me to step into the world, but there are a handful of less hands-on details that I also feel the need to bring up. For starters, the standard setting of Americana is that sort of Happy Days-esque idealized 1950s America: cool cars, malt shops, and teenage hijinks4. While there’s a lot to be said for this aesthetic, (privileged) creators have a tendency to ignore the fact that it was a pretty tough time if you weren’t a straight white cis male. It is a very welcome touch, then, that Americana explicitly says that this is not our 1950s America, but one which developed without the horrible marginalization that still informs our 2018 reality. Of course, the world of Americana has elves and bipedal dragons5 as well, so it’s not a huge leap to say ‘hey, this world ostensibly resembles an existing world, but is canonically better.’ It’s a simple thing that many creators seem unwilling to do, but it has huge implications as far as diversifying the hobby. I’m lucky enough to game with a bunch of folks who I trust implicitly, but if I were joining a random game night or a session at a con, I’d be a lot less likely to express myself in ways that are honest to myself. Even moreso in a game setting that, if taken at face value, gives players a tidy excuse for harmful behavior.

This conscious, proactive approach to player safety and comfort is extended to the No Card, a bit of paper with a big ol’ “X” on it that every player has on hand. If anything currently being played out is making a player uncomfortable, they can reveal their card and halt the narrative. Theoretically, of course, any player in any game can speak up and announce that they’re not okay with the direction a narrative is going, but in reality that takes a lot more emotional energy than flipping a card – especially when you factor in marginalized folks tending to be taught not to speak over their oppressors. I’ve seen this sort of thing mentioned before as a mechanism to ensure an inclusive environment for any game. Being baked right into the rules immediately sets a positive tone, though, and I think little inclusions like this in rulebooks really have the potential to make the hobby more welcoming.

I don’t necessarily play roleplaying games to win. Winning is (hopefully) very satisfying, of course6, but the overall experience is what makes hours of gameplay over weeks of sessions feel like no time at all. Experience encompasses many things, and it comes as much from the GM and players as it does the rules. But a good rulebook lends itself to a good experience, and from ensuring that all the players are engaged and invested in the narrative to establishing basic safety nets and boundaries for players, Americana lays the groundwork for a great experience.


  1. The author is a good friend, but I’m not getting anything out of this post aside from perhaps a hug. I fully intend to back the Kickstarter like anyone else. ↩︎
  2. There is an extensive set of rules laid out for a sealed-envelope sort of game where the GM knows what’s up. I have no experience with this. ↩︎
  3. For those who don’t know and don’t feel like reading through the BoardGameGeek link, Tobago is a treasure-hunting themed game using a deduction-style mechanic. Unlike, say, Clue, the rules that narrow down where the treasure can be are played as actions. It feels deductive, even if it isn’t predetermined and the players’ actions actually construct the answer. An imperfect analogy, to be sure, but I think it provides some sense of how moving forward works in Americana. ↩︎
  4. To be fair, there’s murder too, but you know what I mean. ↩︎
  5. The dragon race is so dang good. Their sex characteristics freely shift with their internal understanding of gender and they’re typically encouraged to experiment with this shifting ability and figure out who they are. While they’re not all genderfluid, they canonically can be. When I was young, the best I got was checking off one of two gender boxes on a character sheet. Now I get to be a crime-solvin’ pink non-binary dragon, and all I can say is heck yeah. ↩︎
  6. It is a collaborative, coöperative experience, of course, so I’m not saying I intentionally derail or throw games. The point is still to work toward getting everyone to a positive ending. ↩︎

Solo play: Cardventures: Stowaway 52

When I first wrote the ‘Solo play’ series, they were basically the top five solo board/card games that I was playing at the time, in order of preference. Adding to this series at this point is just adding more solo games that I love, the order isn’t particularly meaningful anymore.

Beyond nostalgia, I’ve enjoyed a lot of the modern takes on the Choose Your Own… errm… Narrative style of book. Recently, my fellow commuters and I have been laughing and stumbling our way through Ryan North’s 400-page Romeo and/or Juliet, which I highly recommend. There are great independent works up at chooseyourstory.com. It’s an art form that’s alive and well, and has grown beyond the exclusive realm of children. Does a book that you read out of order, and often fail to bring to a happy conclusion count as a game? Does it warrant a post in my ‘Solo play’ series?

Cardventures: Stowaway 52 by Gamewright is a card-based version of the choosable narrative. The premise is something along the lines of being stuck on an alien ship set to destroy Earth. The assumption is that you like Earth, and would therefore like to keep this plan from happening. My initial suspicion was that the thing should’ve just been a book, and that the card-based system was a cost-cutting measure or a gimmick. I was pleasantly surprised to find that I was quite wrong about this.

The card system has a few implications, two of which make it stand out for the better. First, the game instructs you to start with any card in the deck (of 52, in case the name wasn’t telling enough). This is a little bit gimmicky, but it’s oddly charming as well. You pick a card at random, and go from there. The narrative is largely about moving around the ship, and so the cards are almost all just locations, except for those which make for the second neat thing about the card-based approach: items. Ordinarily, as you choose your next node, you discard the current card so you can measure your progress later. But some of the cards are items, which you set aside for further use – some paths can’t be chosen unless you’ve already acquired the necessary item. This could be done in a book, using counters or a notepad or something, but I think it would be very clunky compared to the cards. This is a very clever mechanic that brings the experience slightly closer to a Zork.

Those rather innovative aspects do have some drawbacks. Because there’s no defined beginning, there can’t really be a defined end either. Instead, you go through until you can’t go anywhere (cards always have two choices, and you can’t revisit a card). Every card has a point value, and when you have no more choices, you count up all the points from the cards you made it through, and read one of four endings accordingly. They are… not terribly satisfying, because the game has no real sense of what narrative decisions you took, only that you made it pretty far or not far at all1. Likewise, as mentioned, the cards themselves are by necessity basically just locations. This is more satisfying than the issue with the endings, you do get the sense that you’re frantically sneaking about, trying to avoid aliens. But it still lacks the depth that the control afforded by a slightly more linear system would have.

Cardventures: Stowaway 52 is a novel approach to the choosable narrative concept. Gamewright apparently has a second entry in the series, Jump Ship, which I look forward to trying at some point. In my first run-through of Stowaway 52, I managed to get over 200 points (the maximum is 300, and hitting this is the only way to get the winning ending). Even though the narrative itself was kind of thin, moving through all the bits of the ship and grabbing items was pretty satisfying. Reaching a node where I needed one of the items I had was very satisfying. Enough so that I think it deserves a write-up in my Solo Play series, apparently.


  1. I might actually be wrong about this – the cards are allotted point values of 1, 5, and 20, and it sort of seems dependent on what the card is/where you are. It may very well be that it’s impossible to get some of the endings without hitting certain cards, and if this is true then that’s… very clever. ↩︎

Sea Duel

HOW TO PLAY THE GAME:

  1. Slide ON/OFF switch to “ON” position. Listen to a few bars of the song “Anchors Away [sic]” and see a computer graphic of the American flag appear on the screen.

Such begins the instruction booklet for the Microvision game, Sea Duel. A few days back, I wrote about the Microvision, and reviewed the handful of games I had at the time. I figured I’d acquire the handful of remaining games, and in several months or whenever, I’d sum them all up in one more post. But then Sea Duel came in the mail. This game is such a prime example of depth in a limited system, that I feel compelled to discuss it on its own. Putting aside the hilarity of describing listening to a song and looking at a flag as one of the steps you must take to start playing, it highlights one of the immediate standout features of this game – despite having 256 pixels, a piezo buzzer, and ridiculously limited processing power and storage space, the game actually has an intro screen that shows something resembling an American flag and plays something that resembles “Anchors Aweigh”.

The game is a battle between a submarine and a destroyer. While it is not the game of Battleship (also a Milton Bradley property), I can’t help but imagine that was the inspiration – two different-sized ships operating in secret from each other on a grid. The destroyer is a 3×1 pixel vessel that dumps a 3×3 depth charge immediately adjacent to itself as its attack; the sub is a single pixel that fires a single-pixel torpedo in any direction that attacks until the edge of the screen. The game can be played two-player, or as either boat vs. the computer.

Here’s what makes the game interesting – both players secretly input up to eight commands for their boat (a command is either moving a space in any direction, or firing in any direction), and when the second player is done, the actions all play out. Actions have to be input in a certain order (for instance, your first two actions have to be movement – if you want to fire immediately, you forfeit two moves for that turn), and they’re played out in a certain order. The manual describes it as a simultaneous playback system, which isn’t entirely true, but given the limitations of the Microvision it’s still impressive.

I’ve only played against the computer thus far, and I can’t really tell what its ‘strategy’ is, though I assume it involves cheating. I imagine playing it against another human would be far more similar to playing a board game than a typical multiplayer video game. Indeed, this idea of ‘we take actions secretly and independently, and then reveal and play them out’ mechanism is present in a lot of modern board games. Programming piece movements in board games dates back at least to Richard Garfield’s 1985 RoboRally1. It would be easy to imagine Sea Duel as a board game: tokens to keep track of ammo and fuel, eight action tokens per player placed on an ordered track behind a shield, plays revealed and boats moved around on something like a Battleship board. It’s also the sort of thing that could easily be implemented as a little web puzzle, possibly even as a very naïve machine-learning playground.

Sea Duel is very involved compared to the other Microvision games I own. It’s the only one that requires more than two pages of instructions, it’s the only one with anything resembling an intro screen, and given the 16 bytes of RAM it’s just all around pretty impressive. 256 pixels put to good use.


  1. Richard Garfield is largely known for Magic: The Gathering, which I played the hell out of in middle and high school. Nowadays I rather look upon it in disdain as a cash grab, and while Wizards of the Coast is to blame for this capitalist wet dream, I unfortunately tend to have a tainted view of Garfield as well. He has designed some great games, however (and, to be fair, M:tG was at least a very clean game in the early days) including RoboRally and King of Tokyo. Garfield did succinctly defend the collectible card game genre in this very old interview with Tom Vasel, while conveniently ignoring how exploitative it is. 🤷 ↩︎

Oh-so-many colors

The app and website that I generally turn to for weather forecasts is Dark Sky. Recently they made some great changes to the app (like being able to save locations, bizarre that that took so long to implement and that you can still only save six). Alongside these other changes, they swapped out their old monochrome icons with new colorful ones from The Iconfactory. The icons are lovely, the artists who created them did a fantastic job. But when I see them all lined up on the screen, I get… something resembling anxiety.

I really freaked out a little bit when I first saw them, and I still find them very unsettling, and the whole thing made me reflect on my relationship with colorful things… I’ve always gravitated toward monochromatic photography, I spend as much of my computing time as possible in fairly monochromatic terminals, my blog looks like this, I had the same sort of disturbed feeling when Microsoft switched to color emoji (and still pine for the monochromatic ones), I miss laptops with monochromatic LCDs (and still play Game Boy DX games on the Game Boy Light), etc. Obviously this isn’t a universal issue in my life, I love a lot of colorful animation and other media1, but even then… I definitely prefer muted palettes.

I’m not entirely sure why I felt the need to write about this, though if nothing else it’s something to mull over in design. I’m sure the muted palette of this blog is received negatively by some, just as very colorful things seem to cause my mind considerable unease. I think part of it is simply that more colors make for a busier presentation – it’s more visual data providing the same amount of information. And to that tack, perhaps the constant bombardment of ‘eye-catching’ advertising ubiquitous throughout the world, providing nothing but noise competing with the signal of life has taken its toll.


  1. Particularly, work like that of Nicole Claveloux came to mind because that sense of unease brought on by her vibrant artwork. I’m sure this is intentional to an extent, but I also wonder how much more I related to that tension compared to others. ↩︎