Stephane-D / SGDK

SGDK - A free and open development kit for the Sega Mega Drive
https://www.patreon.com/SGDK
MIT License
1.74k stars 187 forks source link
68000 assembly c game-development gcc java m68k m68k-assembly m68k-elf-gcc mega-drive megadrive motorola-68000 programming retrodev sdk sega sega-genesis sega-megadrive sgdk sgdk-library

SGDK 2.00 (January 2024)

Copyright 2024 Stephane Dallongeville

Patreon: https://www.patreon.com/SGDK
Github: https://github.com/Stephane-D/SGDK

SGDK is a free development kit allowing development of software in C language for the Sega Mega Drive. It contains the development library itself (with the code sources) and some custom tools used to compile resources. SGDK uses the GCC compiler (m68k-elf target) and the libgcc to generate a ROM image. Binaries (GCC 6.3) are provided for Windows OS for convenience, but you need to install it by yourself for other operating systems. Note that SGDK also requires Java (custom tools require it), so you need to have Java installed on your system.

SGDK library and custom tools are distributed under the MIT license (see license.txt file). GCC compiler and libgcc are under GNU license (GPL3) and any software build from it (as the SGDK library) is under the GCC runtime library exception license (see COPYING.RUNTIME file)

GETTING STARTED

First, you need to know that SGDK uses the C language (assembly is also possible, but not necessary) so it's highly recommended to be familiar with C programming before trying to develop with SGDK. Learning C language at same time as learning 'Sega Mega Drive' programming is definitely too difficult and you will end up getting nowhere. It's also important to have, at least, a basic knowledge of the Sega Mega Drive hardware (specifically the video system).

MEGA DRIVE TECHNICAL INFO REFERENCES

INSTALLATION AND DOCUMENTATION

Then when you feel ready you can go further and finally install SGDK :)

You can find installation instructions and tutorials about how use SGDK on the wiki:
https://github.com/Stephane-D/SGDK/wiki

SGDK comes with doxygen documentation (generated from .h header files) which provides descriptions about SGDK structures and functions. You can find it in the 'doc' folder (open your local doc/html/files.html in your browser).

It's important to know that SGDK heavily relies on resources which are compiled through the rescomp tool. You should read the rescomp.txt file to understand which kind of resources you can use and how to declare them. Then you can look at the 'sample' folder from SGDK and, in particular, the sonic sample which is a good showcase of SGDK usage in general (functions and resources).

OTHERS TUTORIALS

You can find a lot of tutorials online about SGDK but be careful, some are outdated or sometimes just wrong.
I really recommend starting from the wiki which provides the basics to start, but if you need more visual and more complete tutorials you can give either of these a try:
MD programming tutorials from Ohsat:
https://www.ohsat.com/tutorial/mdmisc/creating-graphics-for-md/
Very complete and visual tutorials from Danibus (spanish only):
https://danibus.wordpress.com/

USEFUL TOOLS

Here's a list of useful tools to help you creating your assets:

Pixel art / Sprite

Map / Level

Music / sound

Alternates sound drivers

SGDK sound drivers may not fit your needs so it's important to know that some alternatives exist:

HELP AND SUPPORT

If you need help or support with SGDK, you can join the SGDK Discord server:
https://discord.gg/xmnBWQS

You can also go to the Spritesmind forum which is dedicated to Sega Mega Drive development and has a specific section for SGDK:
http://gendev.spritesmind.net/forum/

MACOSX / LINUX

Unix/Linux users should give this very simple script a try, allowing you to use SGDK from Wine easily:
https://github.com/Franticware/SGDK_wine

There is also a new solution proposed by Daniel Valdivieso to use SGDK with VSCode under any OS using Wine:
https://github.com/v4ld3r5/sgdk_vscode_template

Another great alternative is to use the complete MarsDev environment developed by Andy Grind: https://github.com/andwn/marsdev It supports all OSes, provides SGDK compatibility as well as 32X support, so be sure to check it out.

MacOSX users also have access to SGDK with Gendev for MacOS from the Sonic3D project:
https://github.com/SONIC3D/gendev-macos

DOCKER

A modern way to install it on any environement is to use Docker.

To download the sgdk base image:

 docker pull ghcr.io/Stephane-D/sgdk
 docker tag ghcr.io/Stephane-D/sgdk sgdk

Or build it:

 docker build -t ghcr.io/stephane-d/sgdk-m68k-gcc:latest -f deps/gcc.Dockerfile deps/
 docker build -t sgdk .

And then to compile the local env, such as samples for example:

cd sample/game/sonic
docker run --rm -v "$PWD":/src sgdk

Notes:

AWS

Yes you're reading correctly, thanks to Matthew Nimmo you can even now use SGDK from AWS ^^ Here's the link to his blog which explain how to do that: https://community.aws/content/2hZInsYwWX8cYEAIFKquutVoYQj/how-to-build-retro-games-in-aws-using-sega-genesis-development-kit-sgdk

VISUAL STUDIO

You can find a Visual Studio template in the 'vstudio' folder to facilate SGDK integration with VS. Or, to take it even further, you can also install the VS extension made by zerasul:
https://marketplace.visualstudio.com/items?itemName=zerasul.genesis-code

SUPPORT SGDK

SGDK is completly free but you can support it on Patreon: https://www.patreon.com/SGDK

THANKS

SPECIAL THANKS

Of course I thank all my patreon for their continuous support but I want to dedicace a very special and warmfull thanks for generous donation from:

POWERED BY THE SGDK!

These projects are known to be based on the SGDK (non-exhaustive list):

alt text

Tanzer by Mega Cat Studios

alt text

MASIAKA by Resistance

alt text

Xeno Crisis by the Bitmap Bureau

alt text

Demons of Asteborg Neofid Studios

Random list of SGDK-powered games and demos