Freakend 2015 and my Gameboy Powerpoint-like ROM

Freakend 2015 Logo

I just came back from the awesome Freakend weekend event on its 2015 edition (4th one if I'm correct). From friday night to sunday afternoon we had a lot of talks (and discussions) either directly of videogames, or related to them. This year we were 48 people and the bar has raised so much I've felt like an infiltrate among so much enthusiasts and professionals, all doing or having done great projects. People from the major (and quite a few minor/indie) spanish videogame companies like MercurySteam, Digital Legends or Tequilla Works, people working at Remedy, "web" games companies like PlaySpace... but it was enlightening because I saw people falling into one of two categories:

  • Professionals with lots of experience developing and/or producing videogames, serving as examples of when you achieve success
  • Indies, people building games on their spare time while working doing non-game oriented daily work, and other scenarios of pure passion.

In fact, having lunch on saturday and when I said I don't do videogames either on my spare time, I was asked a plain "and why not?". And it its true. It is as simple as that: grab some spare time and instead of playing another dumb AAA title or watching a silly movie, build small games, toy with game related stuff. Nothing except myself forbids me from doing that... so the one thing I've learned this freakend is to try to find time to actually do more what I like, not just read about it.

That said, after last year's project/presentation, and based on my null actual 3D game development skills, I decided to go for something real, something related with retro game dev or around it. Combined with my love for the Gameboy, it had to be something related with the beloved handheld from 1989. The initial topic was more regarding AI and using an emulator to try to make the computer beat Super Mario Land level 1 automatically, but as I digged into the source code of some emulators, I saw that I had to learn how the GB hardware works. And to my surprise, any CS student can really understand many things, as the hardware is a Z80 like 8bit CPU that was coded in Assembly. After some nights reading I decided I instead wanted to do either a game or something similar directly like people did in the early nineties.

And this is how the GBSlides idea was born... As I predicted I was going to have not enough time to build a full game (work, personal life, my young dog...) so I narrowed the scope to instead build a "Gameboy Powerpoint" and present the talk using a GB emulator.

I am just going to show very briefly three screenshots of the process and the results, as the talk and the source code are both available, along with a nice "development kit" (at that contains all you need to create tiles, backgrounds, compile code, see samples and read the best documentation I found out there. Because sadly the original Gameboy scene is dying and many links are already broken, resources missing and wasn't easy to find and gather all pieces, so if at least I can help with that I'm happy enough.

This were my first experiments building tiles with GBTD and then loading and displaying them (kind of a hello world):

GBSlides screenshot 1

Once tile loading and map loading were done, I moved to building a system (a Ruby script) to read and convert from plain-text files into ASM's tile data (raw byte "arrays") inside include files to load into the ROM. It's complex because as the screen is 20x18 you have really few characters to explain things (I had to do my best to summarize). Example source and GB-displayed slide:

GBSlides screenshot 2

And once data loading was ready, I had the hardest fight, trying to read joypad input. It seems the hardware has an optimization of not checking input state if there isn't any sprite DMA operation (aka "if you're not drawing/managing sprites") because I got crazy trying to make it work and then found a sample that said "just do the sprite DMA and input read works" and it did, so the slide viewer was ready.

GBSlides screenshot 3

If you head to the code you can see the content was pretty basic (but not a bad overview considering what I've seen out there), and I haven't even used sprites on the talk, but time is limited and the MVP was showing slides and input handling. I also got quite nervous because after two days of amazing talks I felt I was cheating for giving such a entry level talk, but as I mentioned before I hope that at least the talk, sources and dev kit serves for someone who wants to start coding something with the Gameboy as a good and complete SDK.

I also have plans to keep learning more about this wonderful console and try to actually do some small games, because I've really enjoyed going so down into the metal and into such a restricted hardware. It's been also a nice exercise to switch to Assembler and I think is healty to use something so different instead of Ruby, C#, Javascript or SQL.


Posted by Kartones on 2015-03-09