Book Image

HTML5 Game Development with ImpactJS

By : Davy Cielen, Arno Meysman
Book Image

HTML5 Game Development with ImpactJS

By: Davy Cielen, Arno Meysman

Overview of this book

<p>ImpactJS is a JavaScript library specially geared towards building 2-dimensional games. It is intuitive and versatile and allows the game developer to get results in no time while keeping an easy overview when games grow more complex. Games built with ImpactJS can be published on websites and even as an app on both Android and iOS. <br /><br />With "HTML5 Game Development with ImpactJS", building games for the Web and app markets has never been so easy. Using the ImpactJS JavaScript engine, you only need this book and basic knowledge of JavaScript in order to build and publish your own game. <br /><br />"HTML5 Game Development with ImpactJS" allows a single person to build a full game. Using only basic knowledge of JavaScript and this book, you will end up publishing a 2D game for the entire world to enjoy. You will learn to set up a working environment and gather all the necessary tools and resources your game needs. Develop both a top-down and a side scroller game, integrate physics such as gravity, and deploy your game as an app or to your website.</p>
Table of Contents (17 chapters)
HTML5 Game Development with ImpactJS
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Foreword

If you are new to programming, let me congratulate you for choosing one of the best ways to learn it.

Writing games can be way more fun and more rewarding than playing them. It will keep you on the edge of your seat when you first make something that you can move on the screen, when you first make something that resembles a game, when you first make something that is fun to play, and when you first put something out on the Internet for others to enjoy.

You will soon discover that programming is no black magic, but just a bunch of simple concepts glued together.

If you are new to JavaScript, the syntax can be quite confusing and some of its concepts may seem alien at first. But hidden under all that "wait, what?" moments is a language that is actually quite powerful, elegant, and concise. Stick to the simple stuff at the beginning, but don't be too afraid to get your feet wet. If you come back to something you wrote a month ago, you will have discovered more explicit and easier ways to do it. This is true for every language, but the learning curve of JavaScript is an especially rewarding one.

If you are new to game development, you will see that it's no more difficult than any other kind of development. Once you get the idea of a game loop in your head and understand how objects are moved over time, everything else will suddenly make sense.

One of the biggest revelations when I started to make games was how almost comically fast computers are. The amount of things you can do in 16 milliseconds, 60 times per second, is truly astonishing.

At the same time, it's astonishing how easily you can end up doing huge amounts of operations. Compare 100 objects with each other? That's 10,000 comparisons! Still, you can do such things and much more. So don't be afraid to try things that you think may be too slow. Your game will most likely not be bound by computation performance.

If you are new to Impact and I would think you are, since you bought this book, you will find that it is just the aforementioned bunch of simple concepts, neatly arranged for you.

One of Impact's most important aspects is its simplicity. I took great care to make the API, the functionality of Impact that is exposed to you as logical, consistent, and easy to grasp as possible. There are no callbacks anywhere; everything that's happening is happening in the game loop and it's happening in sequence. This makes it easy to reason about the state of your game at all times.

But this API shouldn't discourage you to dig deeper. In fact, I would like to invite you to take a closer look at Impact's source code.

Let's be clear here. Almost every time I had a look at the source code of a large software library or application, I felt quite lost. If I finally found the function I was interested in, it turned out to be just a stub with three lines of code that calls the actual implementation elsewhere, which in turn just calls five different functions with nondescript names in some other files.

Impact is not that large a software library. It's a very concise framework, you don't have to read through thousands of pages of code scattered over hundreds of files. Most things are self contained and you don't have to jump around a lot to get an understanding of what a certain function does.

No black magic involved.

Dominic Szablewski

Creator of ImpactJS