Implementation notes Sixel mushroom. ---------------------------------------------------------------------- 0. Concept IOCCC ran from 2024-12-29 to 2025-06-05, but there was TRICK 2025 that took place shortly before from 2024-08-31 through 2025-02-28. After submitting to TRICK 2025, I was wondering if there is anything new that I could do for IOCCC. One piece of technology that I really liked is Sixel graphics, which apparently has not won in IOCCC yet. So I decided to make an entry with Sixel graphics. ---------------------------------------------------------------------- 1. Bezier mushrooms I had just finished watching Dungeon Meshi and read all 14 volumes of the manga not too long ago, and the image of the walking mushroom was still fresh in my head, so that's exactly what I made. Simply encoding the bitmap in Sixel was rather limited, so I drew the mushroom in Inkcape, made a Perl script that extracted the shapes, then implemented a bezier curve rasterizer in C. This allows the mushroom to be resized to any resolution. The Sixel aspect of the output was fairly straightforward, I just had to be careful in constructing the right header to avoid undesirable transparencies. ---------------------------------------------------------------------- 2. Cellular dungeon Simply rendering a mushroom didn't seem like enough, so I also wrote a dungeon generator. The idea was that the Sixel data for the mushroom will also become the ASCII characters that make up the dungeon. There are two possible ways to do this -- I could generate an arbitrarily sized mushroom and produce a dungeon that used up exactly that many number of characters, or I could generate an arbitrarily sized dungeon and try replacing the ASCII characters with Sixel data. I went with generating dungeon first and filling mushroom in later, and this mostly has to do with the run-length encoding scheme used by Sixels. If I wasn't doing run-length encoding, each set of six pixels would be exactly one character, and doing either mushroom first or dungeon first is expected to be roughly the same. But the mushrooms will come out to be very small without run-length encoding, so I had to do it. Because run-length encoding requires multiple consecutive characters, generating mushroom is not viable because it limits where the dungeon walls will appear. In the end, I generated random dungeons first, then use binary search to find the largest mushroom that would fit. As to the dungeon generation algorithm itself -- it's a cellular automata based scheme that generates organic looking caverns. Flood fill is used to find caverns that are disjoint, then tunnels are dug to connect those disjoint caverns. ---------------------------------------------------------------------- 3. Code golf and layout I implemented most of the mushroom and dungeon bits in February, then took a few weeks away from IOCCC to work on PlayJam 7. I returned in April to do all the code golf and layout bits. The character chosen for the template was Marcille Donato. The backup plan was to use a rectangle-shaped logo of a winged lion, in case if I wasn't able to fulfill the size requirements. Turns out I didn't need it, and it was pretty much just a steady grind to fit the characters to shape. I finished and submitted the entry in the middle of May. ---------------------------------------------------------------------- 4. Finally... There are some very feature rich entries in this year's IOCCC and I just have a dungeon and a walking mushroom, so I didn't win anything. Still, I implemented exactly what I planned and I regret nothing.