Program a Game Engine from Scratch
The book Dragonfly - Program a Game Engine from Scratch guides programmers through the implementation of a full-featured, 2d, text-based game engine.
The book is free!why? Individual chapters are available as PDFs for download. For those wishing to buy a copy, see the purchase options.
In working through the entire book, an aspiring game programmer will gain an in-depth understanding of a game engine. Such a programmer will not only know how a game engine is implemented, but also why it is implemented the way it is, understanding choices required to achieve general purpose functionality to support a variety of games. Moreover, an aspiring game programmer will understand game programming from the game programmer's point of view, being able to differentiate functionality in game code versus functionality provided by the game engine. This understanding will be reinforced by making a game, albeit a simple one, using a full-featured, fully functional game engine. Lastly, and for some perhaps most importantly, an aspiring game programmer will have created a substantial body of code potentially suitable for a portfolio, a showable record of what s/he can do. The built-from-scratch engine itself can be shown, with one or more games demonstrating its functionality, with the potential for an in-depth conversation (say, with a potential employer) about how, exactly, the engine and game(s) are implemented. All of this achievable by programming a game engine from scratch.
More specifically, the goals of this book are to provide an understanding of:
a game engine from the game programmer's perspective;
the structure and design of a game engine;
the trade-offs between complexity, fidelity, and interactivity in game engines; and
software engineering techniques that can be applied to creating parts of a game engine.
In order to accomplish these goals, this book:
Gives detailed instructions on how to implement a game using Dragonfly.
Provides an overview of the Dragonfly architecture.
Provides the design of Dragonfly, in the form of header files with design rationale, presented incrementally in order of implementation.
Details step-by-step how to fully implement Dragonfly following the design.
Development is supported in Microsoft Windows, Apple Macintosh or Linux, with platform specific differences illustrated, as needed.
The book is free (see chapters available as PDFs in the download section), but for those that want a bit more (or a bit more organization) than provided by the free content, or want a printed copy, there are several options:
The Dragonfly store at Lulu.com has links to all three versions.
For a more detailed listing of what is inside the full book, see the Table of Contents (pdf).
Want to rep' the book by wearing (or drinking) a Dragonfly? See the Dragonfly-book shop for some pretty cool T-shirts and mugs.
All the book chapters are available here for free as PDF downloads. While downloading is fine, if used as a reference (e.g., a course), it is recommended using a link to this page or to individual chapters since the content will change somewhat as it is updated (e.g., errata found and fixed).
Individual chapters, with accompanying slides for some of the material:
Chapter 4 (Engine) is also available divided into the individual Development Checkpoints:
For teachers/instructors using the book for courses, additional resources are available:
Contact the author, Mark Claypool (claypool at cs.wpi.edu), to obtain the teachers-only materials (proof of a teaching position at a college or university is required, as well as information on the course).
You can also support the work by citing it:
Did you know? Dragonflies were among the first winged insects 300 million years ago. Modern dragonflies typically have wingspans of two to five inches, but fossilized dragonflies have been found with wingspans of up to two feet! - 14 Fun Facts About Dragonflies, Smithsonian.com, October 5, 2011.