A Dreamcast dev tutorial
UPDATE NOTE 2016/09/14:
This tutorial is a work in progress. Currently, up to the conclusion of Chapter 3 has been written, although all chapters written are not final and are subject to change. For the sake of prosperity, the original OP is being mirrored untouched: Link!
Developing a video game can be a deeply rewarding experience. It is a demonstration of technical proficiency in a number of disciplines that makes it rewarding to engineering types, while simultaneously being an expression of creativity and personality that makes it rewarding for artistic types. If you hang around on gaming forums long enough, you'll undoubtedly see people express the desire to try their hand at making games. There is a creative spark in amateurs that manifests in many art forms, from fan films to cover bands.
I've been doing computer programming focusing on game development for over 20 years now. One of the things I did that immensely helped my understanding of game development was picking a classic console and learning how to program for it. Since about 1998, I've been studying the Sega Genesis, called the Sega Megadrive outside North America, as a hobby. I picked up m68k microprocessor assembly in the process and played along the ROM hacking scene for many years. Learning how the genesis worked gave me a deep understanding of how video games actually interact with hardware, and how those interactions fuel design choices. I've often recommended people pick up a classic system if they are serious about learning game development. Unfortunately, it's pretty hard for a complete beginner to jump into that kind of system due to comparatively weak hardware. We live in an era where programmers have essentially unlimited resources if they are developing a 2D game, which makes jumping back to an era where you are literally counting clock cycles enormously difficult. A better system to recommend people pick up is the Sega Dreamcast.
The Dreamcast is a wonderful system. I consider it the last classic console - in terms of 3D, it offers no shader support (although you can perform bump mapping), nor does it have an incredible CPU that can brute force shader effects. In terms of 3D, it's still of the fixed function pipeline era of OpenGL. It's GPU, the Holly chip, is part of an exotic design - the PowerVR 2 core. It even has a real dedicated sprite mode for 2D graphics. All this means that the Dreamcast has a pretty unique visual style. In terms of design, the Dreamcast is sort of the opposite of the Playstation 2. The PS2 had a powerful CPU - The Emotion Engine - to offset a crummy graphics chip, with only 4MB of fast ram. The Dreamcast, by contrast, had a weak CPU even for the time, but a pretty incredible graphics chip that punched way above its weight to go along with a huge 8MB of slow ram. The PVR Chip is pretty fun to play with - it offers tile based deferred rendering, and has hardware functions that greatly improve it's performance and ways to get even more out of your already-large pool of ram - sometimes even 32 times more.
What all that amounts to is a system that is still unique enough to affect your approach to game design, like you have to do with mega drive programming, but with a lot more power. You need to tap the Dreamcast hardware in a specific way to make it sing, and doing so is pretty fun. I've researched online for a long time and there are many great resources for Dreamcast development out there, but no one singular guide to bring everything together.
The goal of this tutorial is to introduce you to Dreamcast game development. It's meant to be a small slice of what game development can be like, concentrating more on the technical side of the equation than the creative side. With fans who want to dabble in homebrew, there never seems to be a loss for creativity anyways. This guide will walk you through making a breakout clone for the Sega Dreamcast. Breakout was the very first game I ever made using QBasic, several decades ago. Breakout is such a simple game to get your feet wet with - there is really no AI, the rules and mechanics are simple, and we can concentrate most of our energy on actually getting the to know the Dreamcast environment.
This guide will walk you through every step, from you having no tools on your PC (Windows or Linux) at all to running the game on your Dreamcast. Along the way, it will discuss optimization, and teach techniques that can apply to more than just Dreamcast programming. It will also walk you through the creation of tools we will need to make our Dreamcast game, that help us interact with the hardware on deeper levels.
Be mindful, though, that while this is a guide for beginners, a degree of basic programming knowledge will be assumed, but the point of this topic is for beginners to ask questions as we progress through this project to help understand what very basic development is like. I'll also try to explain the logic of what is going on as best as possible. Additionally, I make no claim to being the world's best coder and I'm still pretty new to Dreamcast Development in general, so if my code is embarrassing or I'm doing something all wrong, please feel free to correct me. In the end, this tutorial is for my own benefit as well.
TABLE OF CONTENTS
-LESSON 1: CREATING THE TOOLCHAIN
-LESSON 2: BUILDING OUR FIRST EXAMPLE PROJECT
-LESSON 3: SOFTWARE RENDERING
ALL FILES (as of 2016/09/14)
------IMG Burn 4 DC
Official KallistiOS reference manual
The official online manual for KallistiOS, with reference pages for every function and file in KallistiOS.
DC Emulation is the best resource for Dreamcast programming I found. The board is active, as is the IRC chat (chat.freenode.net, #Dreamcastdev). Many of it's moderators have a deep understanding of KOS, and you get answers to questions pretty quickly.
Dreamcast Programming by Marcus Comstedt
Marcus is one of the people who figured out the bin scrambler. His website is old, but is full of great Dreamcast knowledge that is still relevant today
Sega Dreamcast Hardware Specification Outline
Sega's official Hardware outline for the Dreamcast, good for a basic understanding of the Dreamcast architecture.
Lazy Foo's SDL Tutorials
Much of our PC software will use SDL 2.0. This guide is not intended to be a tutorial for SDL 2.0, but Lazy Foo's tutorials are where I learned SDL 2.0. You can use his pages if you wish to learn more about SDL 2.0
Gamasutra - Image Compression with Vector Quantization
While I briefly cover Vector Quantization in this tutorial, this is a better, fuller read on the subject. In fact, I use images from this article to help with the concept.
SPECIAL THANKS TO
I couldn't have possibly learned all I have learned or compiled this guide without the following people or places. It is with a huge debt of gratitude to the following that this guide exists:
PLEASE NOTE: ALL FILES WITHIN THIS TUTORIAL HAVE EITHER BEEN CREATED BY ME, OR USED WITH PERMISSION FROM THE ORIGINAL AUTHORS. ALL CODE IS APPLICABLE UNDER GPL.
Code:BlackAura BlueCrab MetalliC Tvspelsfreak Bogglez tonma The Taxman Lazy Foo Marcus Comstedt Dan Potter Light-Dark Chilly Willy SWAT Ivan-Assen Ivanov Gecko Yamori Zeboyd Games