Introduction to 2D Linux Game Programming/Introduction

What this Book Covers

edit

This book covers writing a 2D game in Linux from start to finish. It starts with setting up the build environment for various distributions, and ends with packaging the game for distribution. It also includes creating tools to make creating the game easier. Sprite and level editors for instance. The game itself will be written in SDL 1.2 and use ALSA for audio. We'll primarily cover SDL 1.2, which is probably the most commonly used flavor of SDL out there right now, and briefly cover its successor SDL 1.3. (If SDL 1.3 becomes more prevalent, we may make the transition wholly to that library.) The level editors and other helper tools will largely be written in Qt4. Sample algorithms may be demonstrated first by simply printing to stdout where applicable for simplicity's sake.

Linux is available on a plethora of environments, so this book will also cover porting code from the original environment, in this case an AMD64 based PC, to other environments. The two primary target environments will be the F-200 and the Pandora. Both are ARM based hand-helds, but with very different capabilities, input schemes, and screen resolutions. We'll cover aspects of porting from one environment to another, including control scheme, screen resolution and aspect ratio, and programming considerations.

It will also briefly cover level design considerations, both when dealing with aspect ratio, and when transitioning from an arcade environment to a PC, and to a console.

What this Book Doesn't Cover

edit

This is a programming book, a how to guide for the creation of the code and levels behind a 2D Linux game. It doesn't cover managing your programming team, or suggest ideas for games other than the one that's created in the text of this book. It doesn't delve into marketing of the game.

Languages and Libraries Used in this Book

edit

The code in this book is written in C++. It uses the libraries SDL, Qt4, and ALSA.

Who This Book is Intended For

edit

This book is intended for those who who want to have fun programming games in Linux! It doesn't assume an extensive background in C++ programming, though a basic grasp of the C++ language is required. Language fundamentals are reviewed as those topics are reached while programming the game, but as a fundamental C++ primer this would present the language in an incomplete and haphazard fashion. There are many good C++ Primers that cover the language in a coherent and comprehensive fashion that would be better suited to teaching the student C++.

Some of the concepts covered in this text are complex. Where that's the case this book will cover the concept in a step by step fashion. It is intended to guide those who've been exposed to C++ but may not have a huge experience with the language, and may not have any experience with game programming at all. Experienced programmers may find utility in this book as a reference to topics that are scarcely covered in other texts, though they may find the detail we go into in this book exhaustive.

The Target Game

edit

The end goal of this book is to walk the student through programming and packaging a fully fledged 2D platforming and side scrolling game. Super Mario Brothers is often thought of as the epitome of this genre. Our game, "A Ragamuffin's Destiny" will follow the concepts laid out in those and other good platforming games, while introducing a few twists of our own. All the sprites in this initial game will be low resolution. Most the concepts should translate well to higher resolution 2D games.