Tag: SGDK
This is a list of all posts, games and tutorials tagged with the tag "SGDK".
Editing the Rom Header
Has this happened to you? You spend days crafting and coding an amazing Pong game for the Mega Drive. You create artistic, beautiful graphics, use highly advanced coding techniques and magical algorithms, and have composed a soundtrack that sounds like Streets of Rage as arranged and conducted by John Williams. Then you compile the game, fire it up in your emulator and see this: That just ruins the whole thing, doesn’t it?
Megalaga BONUS - Powerup
One of the coolest things in shmups are the powerups. It’s fun to grab them to see what effects you get, and they can make you feel extremely powerful. So let’s put one in!
Megalaga 9 - Sound
In space, no one can hear you scream. But you can hear lasers, explosions and video game beeps. That’s just science.
So far our game has been rather quiet. So let’s add some sound to it to spice things up! What would a classic shmup be without beeps and bloops after all?
Megalaga 8 - Spam Protection
Last time I mentioned that there is a potential issue concerning our game which was related to the bullet pool. And now I’m going to reveal the secret (and of course fix the issue)!
Megalaga 7 - Enemy Bullets
So far, enemies are nothing more than cannon fodder. They don’t shoot or even move towards the player, so there’s not really any way to fail the game. Let’s change that by having enemies shoot at the player!
Megalaga 6 - Collision and HUD
We have enemies and bullets flying around on screen, and now it’s time to smash them together! Shooting enemies will award the player with points, so we will also implement a HUD that will show the current score, as well as the number of enemies left. Let’s get into it! Collision All collisions in the game will be handled in one big function. This function will loop through all bullets and all enemies to see if any of them collide.
Megalaga 5 - Bullets
Let’s lock and load to shoot some space scum! This time we’re going to create a pool of bullet entities, out of which we’ll grab a bullet to launch at our enemies. Let’s get shootin'! Bullets First of all we’ll of course need a bullet graphic. Download it using the link below, extract the archive, then put the image in res/sprites. Download bullet sprite Then import the bullet image by adding this line to resources.
Megalaga 4 - Enemy Movement and Input
Now we have enemies, but they’re not moving. That’s not really intimidating, is it? Also, our player can’t move either. Let’s change all that so that we can actually interact with our game! Moving the Enemies First a quick bit of setup. At the top of main.c add these two defines: #define LEFT_EDGE 0 #define RIGHT_EDGE 320 These will define the left and right edges of the screen. It’s good to use defines (or variables) for these values, so that we can easily change the bounds of the play area later on.
Megalaga 3 - Enemies
Last time we defined a struct of type Entity and used it to create a player. Now it’s time to throw some enemies into the fray! It ain’t a shooter without somethin' to shoot at, after all. Luckily our Entity struct will make that rather easy for us, because this way, each entity will keep track of its own position, velocity and other values. And to be extra lazy clever, we’ll put all enemy entities into an array, so we can deal with them more easily in bulk.
Megalaga 2 - Entities
Alright, last time we created some scrolling space. But we’re not making a screen saver here! We’ll need entities to populate our game, entities to shoot with and entities to shoot at. We could define all of those manually, which would look a little something like this: int player_x; int player_y; int player_velx; int player_vely; int player_health; int enemy1_x; int enemy1_y; int enemy1_velx; int enemy1_vely; int enemy1_health; int enemy2_x; int enemy2_y; int enemy2_velx; int enemy2_vely; int enemy2_health; int enemy3_x; int enemy3_y; int enemy3_velx; int enemy3_vely; int enemy3_health; //And so on and so on.
Megalaga 1 - Space
Last Updated: Dec 20 2021 Update: Changed the offset check to offset <= -256 as pointed out by Pyxel Pub (see comments below) Welcome to another new project tutorial series on Mega Drive development! This time we’ll be creating a space shooter from scratch using SGDK, the Sega Genesis Development Kit. This is what the end result will look like: It’s a very basic take on the genre.
4 Programs For Creating Mega Drive Graphics
Making art is hard, but retro consoles make the job even harder due to technical limitations and restrictions, such as a limited color palette. You have to keep these things in mind from the very beginning, before you even place your first pixel. Only practice makes perfect, but the graphics software you use can make your job easier…or maybe even harder! So in this post I wanted to give you a list of 4 graphics programs that you can use to create graphics for your Mega Drive game.
Color Swapping
Having to use palettes is one of those things that seem like a restriction at first, but… well okay, it is a restriction. But palettes can also be a powerful tool if you know how to use them right. One very simple but effective thing you can do is color swapping. How does it work? The Mega Drive uses a palette of 64 colors that is shared among all visual assets in a game.
How to Quickly Generate C Prototype Functions in VSCode
One of the cool things that VSCode offers is the support for extensions. And there are a ton of them. There’s pretty much one for every occasion, and if there isn’t, there probably will be soon. And since we use C, an absolute classic of a programming language, there are also some that can help us out with Mega Drive coding!
Megarunner BONUS - Tile Scrolling
Know what makes any game better? Parallax scrolling! I know that might sound like an overstatement, because it is. But parallax scrolling is really cool, so let’s add a small parallax effect to our game!
Megarunner 6 - Collision and Score
We have obstacles and the player can jump over them, but it doesn’t really matter…you don’t get rewarded when you do and you don’t get punished when you don’t. So let’s add a scoring system and collision to the obstacles so that there’s actual motivation to do things! Collision First we’ll take care of the collision detection. Go down into your main game loop and add the following if-statement after the code that moves the obstacle across the screen:
Megarunner 5 - Jumping Math
Now that we have obstacles, we need to enable the player to jump over them. However, in order to do that we need to use math. Don’t panic, SGDK makes it quite simple. Let’s go! Fixed Point Math To make the player jump we’ll have to change his vertical velocity to move him upwards, then apply gravity to pull him back down so that we get a jumping arc. We could do this using variables of type int, but this would lead to very hectic and jerky movement, because there’s just not much precision.
Megarunner 4 - Player and Obstacles
Update: Fixed a small error when importing the rock graphic. Thanks to Thiago for pointing it out!
Alright, we got the background moving, now we need a player sprite to complete the illusion. Of course we could create very long levels and have the player actually run through them, but it is way more efficient to fake endless running by just scrolling the background past the player.
Megarunner 3 - Scrolling
Welcome back! Last time we drew a background with a floor and even some street lights. This time we’ll get things moving by scrolling the background to create the illusion of endless running! Preparations As usual, we have to do a bit of preparation work. First off we’ll define a new constant at the top of the file that will store the speed at which our background will scroll. const int scrollspeed = 2; Next up we’ll set our desired scrolling mode.
Megarunner 2 - Tiles
Welcome back! Now that we have a framework, we can start building the game proper. Let’s start by importing some graphics and displaying tiles on the screen, so that our game stops looking like a text adventure. We’ll be using some graphics from the Game Creator’s Pack by Jonathan. You won’t have to download it, I’ll provide all the files you’ll need here, especially since I’ve edited some of them.