Book Image

iPhone Game Blueprints

By : Igor Uduslivii
Book Image

iPhone Game Blueprints

By: Igor Uduslivii

Overview of this book

Designing and selling games on the iOS platform has become a phenomenon ever since the introduction of the App Store. With mobile gaming taking the World by storm, users are indulging in all different types of games. iPhone Game Blueprints is a hands on guide to both inspire and help developers, graphic designers, and game enthusiasts to create their own games for iOS devices. Taking a selection of iPhone game "styles" we will learn how to set the foundation and essential functionality for each game. Including thorough explanations of popular games such as puzzles, arcades, and adventures, as well as useful theoretical and technical concepts. iPhone Game Blueprints is your complete guide to creating great iPhone games, from a simple gesture game to a classic shoot 'em up. iPhone Game Blueprints guides you through the universe of mobile games, starting with the overall information about game ideas, ergonomic aspects, and much more. Then it switches to a description of each particular game type, presenting ready-to-use ideas and applications. This book will take you through a selection of iPhone game styles and show how to create the foundation and essential functionality for a game of that genre.The examples in this book are only the beginning. Including a deluge of practical tips, focusing on the best approach to game design, not forgetting to mention the pitfalls. iPhone Game Blueprints will give you the blueprints of several mobile game's essentials cores. Whether you're just getting started with gaming, or want to try a whole different genre of game, these blueprints are everything you need.
Table of Contents (16 chapters)
iPhone Game Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preparing animation


It is impossible to imagine a modern game without animation. The game world should be alive to compel attention. There are two major types of animation: based on programming code and frame based stored in animation sprites. The first type requires some programming algorithm to move or transform a graphic object; in most cases, this is a linear process. An object is moved from location A to location B with predetermined speed, its size is increased, and its alpha channel is changed. Such type of the animation with automatic incrimination is called motion tween in Adobe Flash. At a more complex level, the object has curved trajectories and moves with some acceleration and there is inertia in its movement; the games in which such interpretation is used require advanced control on an element's dynamics; first of all, I'm talking about various physics puzzles.

Frame-based animation on the other hand is a way to beautify the motion. Besides the automatic animation successfully moving a sprite around the screen, the illustration inside the sprite would be still; for example, a character would not step. Several images to illustrate the walking cycle are needed so that the game can form animation sprites. This is a bunch of images, portraying various phases of motion. Modern SDKs usually have rich collections of methods to work with the animation sprites. They can be played in the order in which they are stored in the animation sheet, or they can be organized by using an array with a custom order, which is very useful because more complicated animation sequences can be created with a minimum number of images.

Here are some tricks: if there is a portion of opposing movements (for example, a character is showing up from a hatch and then hides back), the animation sheet can include only half the frames, displaying the motion in one direction; the other part would be constructed from the same frames but played backward. A pause in an animation of given duration can be organized by simple repetition of one of the sprites. Another interesting option of non-linear frames are extra frames, which helps to deal with sameness of animation cycles. Each gesture and movement an object makes in the real world is pretty unique. Take for example a passerby walking in the street, his legs make steps in cycles; the cycles are pretty similar, but not quite the same. There is a beautiful metaphor:

"Sometimes a butterfly lands on the shoulder, so step at this moment is a little bit different."

So, it is good to add the unexpected touch to the animation frame sometimes. It can be done by replacing an ordinary frame with one differing frame that has some small unique detail. There can be several extra frames; the game would choose them randomly.

It is good to animate characters in Adobe Flash and then to export the result as separate still images, finally collecting them into one Adobe Illustrator document and exporting it as an animation sheet. It is worth mentioning about a very interesting tool for creating smooth and natural character animation called Spine (http://esotericsoftware.com/). Its general advantage is that it is a 2D skeletal system with various fragments of a character (head, body, legs, feet, and so on) attached. Positions of bones and their angles are calculated in real time and interpolations are very smooth and correlated with the frame rate; therefore, the motion is very smooth. Moreover, because animation is not tied to strictly defined frames, the system is very flexible; this means that some combination of motions can be easily introduced without redrawing a full sequence of frames. For example, by default in traditional frame-by-frame animation, a character running and the same character running and shooting are two separate sequences, which increases consumption of memory resources and makes animation exporting a bit complex. A skeletal animation has no such complications; various gestures of the character can be combined more easily with minimum memory costs. Of course, this is possible only if a game did not use a raster output of Spine in the form of video files or sprites, but used binary data of virtual bone positions and keyframes stored in special documents instead.

Different special effects are based on animation too. For example, smoke can be created by using a translucent and blurry circle being duplicated around the screen; the opacity of each circle should be reduced softly, but their sizes should be increased.