Preface

This book will teach you how to create awesome video games. Games from scratch. Games that run cross-platform, in web browsers, and on phones. Games filled with dynamic sound and music. Games overflowing with impressive visual effects. Fun games.

More importantly, this book will teach you how to think about making games. You’ll learn to analyze and dissect games—to understand what makes great games great. By the end of the journey you’ll have all the knowledge and tools needed to produce engaging, polished products that you can unleash on the internet, sell on app stores, or just use to impress your friends.

Aside from creating something cool, gamedev also tantalizes us with the possibility of becoming world-famous indie game superstars! In the ’90s, if you wanted fame and fortune you had to start an alternative rock band. In the 2000s it was all about being in an electronic music production outfit. But today, all the cool kids are getting a gamedev studio together. The bad news is that you may have wasted all those years learning the guitar, but the good news is that you already know a bunch of JavaScript—and JavaScript is an excellent instrument in the quest for gamedev superstardom.

Whether you want to create games to express yourself and have an emotional impact on your audience, or whether you’re just digging for gold looking for the next Flappy Bird money-making hit, we all have to start at the same place: the beginning.

“The beginning” for us means establishing a solid codebase for our projects. We’ll use it to create a challenging little side-scrolling shoot-’em-up. Then (having got our feet wet) we’ll evolve it into a tile-based action game. From there, we’ll add gravity to get a fast-paced, dungeon-crawler platform game. And finally, we’ll make an entertaining, mobile, penguin-based, physics-based, procedurally generated golf game. Each game builds gradually from the previous, leaving you with a solid foundation for constructing whatever quixotic ideas are swirling around your brain.

Then you’ll be a game developer.

Who Should Read This Book?

This book is for anyone who wants to create their own games using tools such as a browser and a text editor. It’s expected that you're proficient in HTML and CSS, and are reasonably experienced with JavaScript, but no prior game development experience is assumed.

Acknowledgments

I’d like to thank Amelia for supporting (and tolerating) me throughout this long long journey. Really, thank you!

Also thanks to Simon Mackie for your professionalism, good ideas, and for being the voice of reason whenever I was stuck.

Thanks to Gaëtan Renaudeau for helping kickstart this project and giving it a great foundation to build on, and Franco Ponticelli and Andrzej Mazur for all your fantastic advice and formidable tech knowledge: it was great working with you both.

A huge high-five to everyone who let me use screen shots of their beautiful games and artworks in the book - it wouldn’t be the same without it, and I can’t wait to see what you all come up with next.

Shout-outs to the early-morning café crew: Warren and Madoo (for keeping my spirits up), and Anthony (for making good coffee).

Finally, thanks to Disasterpeace for the FEZ OST. I listened to it a million times over the course of this project. The perfect soundtrack for writing a gamedev book.

Conventions Used

Code Samples

Code in this book is displayed using a fixed-width font, like so:


<h1>A Perfect Summer's Day</h1>
<p>It was a lovely day for a walk in the park.
The birds were singing and the kids were all back at school.</p>
			

Tips, Notes, and Warnings

Hey, You!

Ahem, Excuse Me ...

Make Sure You Always ...

Watch Out!

Supplementary Materials