Earle CastledineJavaScript flneur and internet flibbertigibbetis back! By day its serious business while Earle steers the ship as lead engineer at hot startups. By night his attention turns to the world of weird art and wonderful game design.
Now, having been making games with JavaScript long before it was cool, hes here to guide you on your journey to gamedev superstardom.
SitePoint specializes in publishing fun, practical, and easy-to-understand content for web professionals. Visit http://www.sitepoint.com/ to access our blogs, books, newsletters, articles, and community forums. Youll find a stack of information on JavaScript, PHP, design, and more.
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. Youll learn to analyze and dissect gamesto understand what makes great games great. By the end of the journey youll 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 JavaScriptand 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 youre 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. Well use it to create a challenging little side-scrolling shoot-em-up. Then (having got our feet wet) well evolve it into a tile-based action game. From there, well add gravity to get a fast-paced, dungeon-crawler platform game. And finally, well 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 youll 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. Its expected that you're proficient in HTML and CSS, and are reasonably experienced with JavaScript, but no prior game development experience is assumed.
Acknowledgments
Id 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 Gatan 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 wouldnt be the same without it, and I cant 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:
A Perfect Summer's Day
It was a lovely day for a walk in the park.The birds were singing and the kids were all back at school.
Youll notice that weve used certain layout styles throughout this book to signify different types of information. Look out for the following items.
Tips, Notes, and Warnings
Hey, You!
Tips provide helpful little pointers.
Ahem, Excuse Me ...
Notes are useful asides that are relatedbut not criticalto the topic at hand. Think of them as extra tidbits of information.
Make Sure You Always ...
... pay attention to these important points.
Watch Out!
Warnings highlight any gotchas that are likely to trip you up along the way.
Supplementary Materials
https://github.com/spbooks/html5games1 is the books code archive, which contains code examples found in the book, plus game library that well build in the book.
https://www.sitepoint.com/community/ are SitePoints forums, for help on any tricky problems.
books@sitepoint.com is our email address, should you need to contact us to report a problem, or for any other reason.