Believe it or not, this screenshot is taken from an animated demo sequence on the Sega Mega Drive. Entitled Bad Apple, and based on the Japanese indy vertical-shooter Touhou, this demo is arguably one of the strongest examples of full-motion video and near CD quality music on the Mega Drive. That’s right, the Mega Drive! In the latest addition to the Mega Drive Unleashed series, MegaBites catches up with Stephane Dallongeville – the man behind not only Bad Apple’s 16-bit Sega conversion, but also a rather special Mega Drive port of a SNES Super FX chip classic.
More on the ‘enemy’ later… First, here’s Bad Apple:
What is Bad Apple?
Initially conceived as a fully rendered full-motion video, Bad Apple was unveiled in 2009, upon Japanese video sharing site Niconico Douga. As a prominent showpiece of the Japanese MAD video subculture, what later transpired was a veritable supernova of ports, conversions, and homages to the iconic Niconico original. However, the origins of the Bad Apple musical theme can be traced even further back, to the mid-to-late 90’s and the cult video game series Touhou.
Revered for its colourful visuals, larger than life characters and addictive – if not obscenely difficult – gameplay, Japan’s Touhou saga is a series of vertical shoot’em ups created by one-man software house Team Shanghai Alice. Coded, designed, scored and illustrated by Junya ‘ZUN’ Ota, the first title in the series was released on the NEC PC-98 in 1996. Over the years, Touhou spawned a 20 further sequels in rapid succession, eventually making the move onto Windows PC in 2002. From the outset, Touhou received a huge following. However, it is with the fourth game in the series – Lotus Land Story – where our Mega Drive interests lie.
Released in 1998, Lotus Land Story’s third level is accompanied by a rather catchy tune called none other than Bad Apple. Subsequently covered and remixed by Producer Masayoshi Minoshima in 2007, featuring the vocals of pop artist Nomico, the track became an instant hit within the Japanese Doujin music scene.
Needless to say, Japanese video artists and gaming fans went wild, as many attempted to create their own realisation of the Bad Apple music video. In 2008, one such individual upon Niconico Douga went so far as to upload a rough animated sequence that story-boarded their own concept of how the video would play out. A year later, this storyboard was illustrated, fully animated and uploaded to the site. Displaying smooth, lush, silhouetted 3D visuals, the Bad Apple craze began – as did Stephane Dallongeville’s interest, as he attempted to convert the clip for the Mega Drive.
Second bite of the apple
“To be honest I didn’t know anything of Touhou before I created my Mega Drive demo,” Stephane tells MegaBites. “I first became aware of the series when I saw an upload of the original Bad Apple sequence on YouTube. This was not long after the clip’s release. I was really impressed by the smoothness and the quality of the animation.”
Although he was a relative newcomer to the Bad Apple phenomenon, one factor became immediately clear to Stephane – the clip was hugely popular amongst the video game demo scene. “Digging around, I found that a number of programmers had already ported Bad Apple to various retro consoles, from the Famicom, to the Gameboy and even an early – if not fully complete – attempt on the Mega Drive.” Impressed by what he had uncovered, well-versed in the capabilities of Sega’s 16-bit console, and no stranger to the world of computer programming, Stephane knew he had what it took to produce the ultimate Mega Drive port of Bad Apple.
Consoles, childhood & coding
“It was around 20 years ago, at a young age that my interest in video games began,” Stephane reveals. “My first console was the NES, but I have many fond memories of playing Streets of Rage 2 and Sonic 2 with my twin brother. We had some really great times with the Mega Drive console. Despite the fact that we were twins, my brother preferred Nintendo and I preferred Sega!
“My fascination for video games continued into the 32-bit era, at which time I moved into programming,” Stephane continues. “I began by writing in BASIC on a calculator. However, it wasn’t until I got my first computer, that things started to really come into their own.”
Taking up computing studies at college, Stephane’s free time was soon taken up by the development of computer game emulators. Most notably, he was the programmer behind the Gens Mega Drive emulator. “It had to be done! The Mega Drive is my all-time favourite video game system,” he enthuses. “Later I started to develop for the Mega Drive itself and created the Sega Genesis Development Kit (SGDK) – a resource package for the development of Genesis/Mega Drive software on the Windows platform.” Clearly, there was no-one braver to push the Mega Drive into its brave new territory. But it would be no easy feat. Hold on to your hats…
21st century blast processing
“The biggest challenge when porting Bad Apple to the Mega Drive was in the development of the codec that converted the demo into a format best suited to the console,” Stephane recalls. “I wanted the output format to be 320×224, in 2bpp, at 30 Hz, with the only on-screen colours being four separate shades of grey. The only problem was that this totaled 118 MB – far and beyond the size of a typical Mega Drive ROM.”
To put this in perspective, the largest capacity game released in the Mega Drive’s natural life-cycle, at approximately 5 MB, was Super Street Fighter II: The New Challengers. The original Sonic the Hedgehog trilogy totaled 3.5 MB alone! If Stephane was to make his demo Mega Drive-compatible, it would require a monumental re-evaluation of his processes.
“To work around this issue, I developed specific tools to convert the demo frame by frame. After a great deal of effort, I brought the total size down to approximately 3.5 MB. However, I soon experienced some issues with the decompression speed – the video wasn’t playing back at the correct speed of 30 FPS.” To work his way round this, Stephane increased the demo’s ROM size to 8 MB, reserving just 1.5 MB of this allocation for its soundtrack and code. “Although 8 MB seems miniscule by today’s standards, the demo is really demanding on the Mega Drive’s resources, requiring about 85 per cent of its DMA bandwidth and squeezing almost every ounce of power out of its processor.”
Say what you will about the Mega Drive’s YM2612 sound chip – even if it isn’t known for its realistic musical sound effects and despite the fact that its PCM voice sampling capabilities leave a lot to be desired, the Mega Drive sounded fantastic. From the club-thumping hits of Yuzo Koshiro, to the sounds of Sonic the Hedgehog, the raw dynamics of the Mega Drive’s audio were perfectly matched to its fast and dynamic gaming catalogue. As it transpires, the console’s audio was capable of feats way beyond its perceived capabilities, surpassing – dare I say it – the SNES!
“It’s a shame that many of the Mega Drive’s developers didn’t take greater effort to make their games sound better. The console’s secondary processor – the Z80 – is totally dedicated to sound and extremely flexible in this regard,” Stephane details. “For this reason, especially when it comes to playing streamed PCM audio, the Mega Drive actually has the edge over the SNES. Although my Bad Apple port was limited by its ROM size, its audio quality could have been even better with the availability of more space. Nonetheless, I am quite satisfied with the standard of sound that was achieved.”
Seemingly more than a match for the SNES in terms of audio, it also transpires that the Mega Drive could also stretch to the capabilities of its rival’s Super FX chip – give or take a heavy chunk of hardware resouces.
“I’ve always had a keen interest in 3D rendering,” Stephane reveals. “Plus, the Mega Drive is actually a far more capable console than what developers had us believe during its commercial lifetime. Naturally, I was more than eager to see exactly what the Mega Drive was capable of. Starfox was an obvious choice of game to port to the Mega Drive, as I was confident of the console’s ability to come close to reproducing what was capable on the SNES. So, in 2013, after six months of hard work, I released a video of what I had achieved.”
Genesis does what Nintendon’t anymore…
“As you can see much of the SNES’ basic 3D effects are perfectly possible on the Sega console,” Stephane reveals. “The Mega Drive’s 68000 processor is such a dark horse!
“I employed a vast array of reverse-engineering techniques to understand exactly how objects were encoded in the original SNES Starfox. Importing the exact same structures as seen in the SNES game, I even included parts of the original Starfox ROM data to mimic its original code on the Mega Drive.”
It was during this process that Stephane uncovered a few truths about the Sega hardware versus its Nintendo rival. “The SNES is actually far more comfortable when processing data in 8-bit. Yet, the Mega Drive finds it far simpler to process in 16-bit,” he reveals. However, this is not to say that converting SNES software to the Mega Drive is without its pitfalls.”
Prepare for one last datablast…
“The main problem when creating 3D effects on the Mega Drive is that the console processes its graphics data in tile format – 8×8 pixel blocks to be more precise. This is very convenient when working in 2D, but is not best-suited for 3D rendering,” Stephane continues. “When sending 3D graphics data to the Mega Drive’s video chip, all data has to be converted in tile format by the console’s CPU, which consumes around 40 per cent of the console’s total CPU resources – a huge loss of processing. But this certainly isn’t going to stop me in the near future to push ahead with a new and fully playable version of Starfox, complete with sound.”
Back to Bad Apple
Completed in August 2012, Stephane uploaded his Bad Apple Mega Drive port to the net – including a ROM download, original source code and YouTube video link. “I remember how a lot of people were shocked that such a sequence was possible on the ‘simple’ Mega Drive,” Stephane recalls. “More than anything, people seemed to be more impressed by its sound quality, rather than the animated sequence itself! As proud as I was of the demo’s reception, I was simply content to have it fully realised within the constraints set by the Mega Drive console.
“Despite it being almost two years since my Bad Apple port, I’m yet to familiarise myself with the whole Touhou phenomenon,” Stephane reveals. “I’ve given a couple of the games in the series a play and really liked what I saw. It’s a great looking shoot ’em up, but it’s near impossible to master.”
How about a Mega Drive port, Stephane?
Mega thanks go out to Stephane Dallongeville for his time and input. Keep those demos coming!