Making a Mega Drive Game!

Given that I work in the games industry, it’s probably not hard to guess that I’d love to make my own proper full game someday.

Well a couple years back I learned about SGDK, its a “development kit” for the Sega Megadrive! I was afraid to try it because it requires you to program you games in the C language… a step up from 68000 assembly for sure, but daunting for me who started off with Javascript, C# and Python!

I’ve made lots of random game things and prototypes in Unity over the years, so I have a good idea of game loops, and all the general game patterns, so I figured, time to buckle in and give it a real good go. First thing I made was this website’s logo showing up on screen:

Next I started looking at the sample code and again got a little freaked out as they looked like alien text to me. So I found two blogs Ohsat’s and Danibus, both absolutely great resources!

I played around with some more SGDK stuff for a couple of weeks, got scrolling and animations working, without fully understanding them. And then work got busy again, so I didn’t have time to play with the SDK any more.

Until this weekend! I knew Ohsat had been doing some guides, so I checked the blog out again and decided to follow along with his MegaPong guide to refresh my memory.

It’s very well written and super easy to follow, so much so that I was done in about half a day (while also getting distracted by other things). It left me with a player controlled sprite, a bouncing ball and a very light gamestate, well by jove that’s nearly a game!

So I set myself a goal of actually making this a “full” breakout clone, and well… I did! Here it is running in Fusion, a Sega Mega Drive Emulator:

It even runs on real hardware:

The sound was the harder part to figure out as I personally find the documentation somewhat lacking. But after playing around with it for about an hour I figured out how to have some Music and some sounds all playing at the same time. You might have recognized Streets of Rage’s ending theme =D

Hopefully I will have time in the future to do some more cool retro game coding, if I do I will post it here!

You can download the ROM file here to run on your own emulator:

You can also view the source here: https://gist.github.com/theshaneobrien/e53698dcba44942c8e2ddccb960db0a8/

Leave a Comment