Tag: SGDK

This is a list of all posts, games and tutorials tagged with the tag "SGDK".

Megarunner 1 - The Framework

| #Mega Drive #SGDK #Megarunner

Welcome to a new tutorial series on Mega Drive development! Here we’ll be creating a Mega Drive game from scratch using SGDK, the Sega Genesis Development Kit. And this is what we’ll be working on: I call it Megarunner. It’s an endless runner-type game where you jump over obstacles to gain points. The game ends when you hit one of the obstacles. It’s a simple concept and thus a good way to learn about some new concepts of Mega Drive programming like scrolling and animation!

Megapong BONUS - Flashing!

| #Mega Drive #SGDK #Megapong

Alright, we have a complete and working game now. We have graphics, gameplay, scores, game overs…sound is still missing, true, but that’s a topic for another tutorial. However, we can still add something to make our game a bit better: The almighty Juice.

In order to juice things up as it were, we’re going to make the ball flash when it’s hit by the paddle. It’s a small effect, but an important one when it comes to retrogaming. Hitting Robotnik wouldn’t be as satisfying if he didn’t flash, after all. So let’s do this!

images/flashing.gif

Megapong 9 - Game Over

| #Mega Drive #SGDK #Megapong

Time to finish this game of ours! This time we’ll add a fail state and some general polish to complete the Megapong experience. Let’s jump right into it! Making Things Easier for Us First, let’s make things a bit easier for ourselves. We’ll have to show some messages on screen soon and we can create the following helper function to help us out: /*Draws text in the center of the screen*/ void showText(char s[]){ VDP_drawText(s, 20 - strlen(s)/2 ,15); } As you can see, this function takes a string (that is, a char[]) and then draws this string in the center of the screen using VDP_drawText and the power of math.

Megapong 8 - Score and HUD

| #Mega Drive #SGDK #Megapong

It’s the final stretch! We already have the core gameplay, but right now our game is less a game and more of an activity center. We should add a score to make it a bit more challenging and exciting. Let’s do it! Score and HUD First we’re going to define the variables that we’ll need. At the beginning of the file, next to all our other variables, add this: /*Score variables*/ int score = 0; char label_score[6] = "SCORE\0"; char str_score[4] = "0"; int score will store our current score value.

Megapong 7 - Collisions

| #Mega Drive #SGDK #Megapong

It’s physics time! We got two moving parts, now it’s time to smash them together. SGDK has built-in collision stuff, but we won’t need that for this simple project. The method we’re using to handle collisions is called AABB collision detection. It uses axis-aligned bounding boxes, which sounds really fancy, doesn’t it? Basically that just means we’ll be using rectangles to check for collisions, instead of the actual sprite graphics. It’s a very simple and efficient method of handling collisions.

Megapong 6 - Input and Paddles

| #Mega Drive #SGDK #Megapong

We have a moving ball now, but a Pong game needs paddles. We’ll add one now and learn about handling input in SGDK at the same time. Let’s go! Creating a Paddle First we’ll have to create a paddle for players to control. The process is very similar to the one in the previous post, so I won’t go into as much detail this time. First, download the paddle image here.

Megapong 5 - Sprites

| #Mega Drive #SGDK #Megapong

Now that we have a background, it’s time to get things moving! Sprites are different from tiles, so we have a few new things to learn. Let’s get into it and make a bouncing ball! Importing Sprites First of all we’ll need a sprite for our ball. You can download it here. Here’s what it looks like (scaled up 4x so you can see it better): Note that you have to download the file from the link above, right-clicking and saving the above image will not work!

Megapong 4 - Palettes

| #Mega Drive #SGDK #Megapong

Update: I expanded the explanation on palettes a bit and removed a reference to PAL4, which of course doesn't exist. D'oh! Last time we put a tile on screen, which was awesome. But the color was wrong, which wasn’t so awesome. Also, one tile doesn’t really make a background, does it? So we’ll take care of all that this time around. Let’s get started! About Palettes Okay, so why was our tile white instead of the color it should’ve been?

Megapong 3 - Importing Resources

| #Mega Drive #SGDK #Megapong

Last Updated: May 18 2021 Update: Improved the section on resources.h and made the steps less error-prone. Welcome back! Last time we set up our development environment to make things easier for us. This time things will get a bit more exciting, as we’ll import a graphic and use it to draw the background for our game! We have a lot ahead of us, so let’s rock. You can either use the project from part 2 or create a new one.

Megapong 2 - Setting Up The Environment

| #Mega Drive #SGDK #Megapong

Last Updated: May 18 2021 Update: Updated instructions on how to set CMD as the default console. Welcome back! Last time we set up SGDK and made sure everything worked. This time we’ll set up a proper development environment, which will make things a lot easier and more fun for us. Believe me, it’ll be worth it! Development Environments Code for SGDK is written in C, so you can use basically any IDE that supports C.

Megapong 1 - Hello Mega Drive World!

| #Mega Drive #SGDK #Megapong

Last Updated: May 19 2021

Update: Updated SGDK installation instructions to reflect the latest version. Also updated the empty project file.

Welcome to my new tutorial series on Mega Drive development! In it we will be creating a Mega Drive game from scratch using SGDK, the Sega Genesis Development Kit. This awesome piece of software allows you to program games for the Mega Drive in C instead of ASM, which makes things a whole lot easier. I will show you how to set up your development environment, how to import graphics, how to put things on the screen, how to control them and have them collide…

Creating Graphics for the Mega Drive

| #Mega Drive #SGDK #Misc

When it comes to making graphics for the Mega Drive, there are a number of programs available that you can use. It doesn’t really matter if you’re using software specifically designed for retro pixel art or more modern graphics suites like Photoshop or GIMP, as long as your program supports the use of palettes. However, even when your software is capable of creating images that SGDK can process, there are still a number of restrictions you have to keep in mind when designing and drawing your sprites and tiles.

Setting Up SGDK in Visual Studio Code (With Auto-Complete)

| #SGDK #Tutorial #VSCode

As I mentioned in part 2 of Adventures in Mega Drive Coding I set up Code::Blocks as my IDE for Mega Drive development. And Code::Blocks is great, but I still had two issues with it. First of all, auto-complete didn’t really work. Considering I’m pretty much poking around the SGDK API blindly, that wasn’t helpful. And secondly…I use VSCode for pretty much anything else coding-related, so it would be nice to also use it for SGDK stuff.