Preface to iPhone game development practices guide
Writing a game is not an easy task. Even if you are an experienced programmer, the design pattern, terminology, and thinking process of the game may seem a bit strange and unconventional. Since I spent most of my work on creating commercial applications, writing a game is only a hobby. Over the years, my children have enjoyed playing the games I wrote. With the release of iPod Touch and iPhone, I think it's time to publish one of my games to the world.
My primary task is to find an excellent book on iPhone game development. After a large number of searches, I think the books I want to find do not exist.As I received a lot of feedback from a large number of online tutorials I wrote, I decided to write a book by myself. This is a great opportunity for me to write a book on game programming I 've always wanted.
Over the years, I have read many books on game development, but I still don't think it is enough. Although they provide a lot of knowledge that is required to create a game, they also contain many small examples, but they have never included the whole process of compiling a complete program that is sufficiently released.I have always believed that a good book should tell readers what they need to create a game and demonstrate how to implement each component in a complete game project.
Therefore, the iPhone game development practice guide not only describes the components and technologies required to write games on the iPhone, but also introduces the creation of a complete game sir lamorak's quest: the whole process of the spell of release. You can download this game from the App Store for free. You can use it to learn how to compile the game.
Download a game
You can download the game sir lamorak's quest: http://itunes.apple.com/us/app/sir-lamoraks-quest-the-spell/id368507448? Mt = 8. This game is free of charge. You can start playing it after downloading it. Try to help Sir lamorak escape from the castle!
This book introduces necessary components for creating two-dimensional games, covering technologies such as OpenGL ES and openal, as well as necessary key game engine components, such as Genie tables, animations, touch input and sound.
Each chapter of the iPhone game development practice guide describes a specific component in the game and technologies supporting the component, such as the texture map editor, or try some special effects created by Using OpenGL ES. After introducing the functions and technologies, we will introduce the details of implementing these components in the game sir lamorak seek quest. This combination of theory and implementation helps fill the gaps left by other development books.
About game sir lamorak's quest
In 1982, I got a 48 KB Sinclair spectrum game computer as a Christmas gift and started playing the game. From that moment on, I began to indulge in computers, and I had a close relationship with them.
I think of the games that I want to develop for this book. These Games impressed me at the beginning. Although they were not visually dazzling, they were still very interesting to play.
I spent a lot of time on game design, including not only the design of Characters in the game, but also how to implement game design on the iPhone. A key aspect of a game is that it should be easy to play-that is, its concept should be simple and easy to learn, and players can start and stop the game without losing their progress.
At the same time, I hope that the control of the game can be easily recognized by players, so I decided to implement a screen handle to control the main role. However, it is also important for players to move their controllers. In this case, players who are left-and right-handed can feel comfortable.
For the game scene itself, I decided to adopt the design concept of the game I played in 1980s, that is, the player was trapped in an abandoned castle, and he needed to find a curse to help him escape from the castle.
Organizational structure of this book
The iPhone game development practice guide consists of 16 chapters. Each chapter describes a specific area for creating a game sir lamorak's quest. The chapters are described as follows:
Chapter 2 "Game Design"-This chapter describes the design factors used to design the game sir lamorak's quest. This chapter provides an in-depth explanation of the idea of starting a game. Although this chapter does not cover all possible game design decisions for each category of games, it does explain the most important design decisions.
Chapter 2 "terms, techniques, and tools"-even senior programmers can be confused by these three words. This chapter describes the basic technologies, terms, and tools used to create a game sir lamorak's quest and other games. This chapter will help readers understand the terms and technologies throughout this book.
Chapter 2 "start exploration Journey"-starting from this chapter, we will officially focus on code and render something on the iPhone screen. This chapter describes how to use the OpenGL ES sample project in xcode to create the first project. It describes the sample in detail and sets the scenario for the next chapter.
Chapter 2 "game loop"-the core of any game is a game loop. Loop is responsible for ensuring that all game elements (such as AI and rendering) are executed at the right time in the correct steps. This sounds simple, but it is not that simple because there are many methods that involve game loops. This chapter describes these methods and describes in detail how to use the game sir lamorak's quest.
Chapter 2 "Image Rendering"-rendering images to the screen is a basic requirement for any game. This chapter briefly introduces OpenGL ES and runs some created classes to simplify the process of image creation and rendering.
Chapter 2 "Genie table"-genie table is a large image that contains many small images. The sprite table is used to reduce the number of independent images stored in memory and reduce the number of textures that OpenGL ES needs to bind to improve performance. The genie table is also used to create an animated genie. This chapter describes how to create a Sprite table (including images to be used in the game), whether its dimensions are fixed or variable.
Chapter 2 "Animation"-after storing different frames required in an animation with an sprite table, this chapter describes how to combine individual images into an animation, such as an animation for running a player role.
Chapter 2 "dot matrix"-a common way to interact with gamers is to use text information. It is important to be able to render operation guides and information (such as players' scores or how to use game guides) to the screen. This chapter describes how to use an open-source tool to convert any font into a dot matrix. After creating dot matrix characters, this chapter describes how to create a Sprite table to store the images used to render the font characters. This chapter also details the bitmap class used in game sir lamorak's quest. It provides a simple API for rendering text information to the screen.
Chapter 2 "map maps"-use map maps to create a large game world with a series of small images. Developers often use this method to create a large game world (think about Nintendo's Super Mario Brothers) within the time limit, especially in early home game systems. Until now, the Paster map technology is still very popular. This chapter describes how to use the open source Paster editing tool to create a Paster map and describes the classes that render these maps to the screen.
Chapter 4 "particle transmitters"-many games have unforgettable effects such as fire, explosion, smoke, and sparks. These effects are usually created by the particle system. The particle system is responsible for creating and controlling many particles. Each particle has its own attributes, such as size, shape, direction, color, and lifecycle. In its lifecycle, the position, speed, color, and size of the particle change based on its settings. This chapter describes how to create a particle system and use it to produce many basic effects.
Chapter 4 "Sounds"-it is important to give voice feedback to players even in modern Games. This chapter introduces the iPhone's Media Player function and openal, as well as how to use these technologies to play cool sounds and 3D sounds in the game.
Chapter 2 "user input"-This chapter describes how to use the unique touch technology and accelerator capabilities of the iPhone to control the game. This chapter describes how to obtain and process multi-touch simultaneously, and how to obtain and use accelerator data in a game.
Chapter 2 "game interface"-This chapter focuses on the implementation of the game interface in the game sir lamorak's quest, including how to handle rotation events to ensure that the user interface is correctly displayed, and how to mix OpenGL ES and uikit interface controls.
Chapter 2 "Game objects and entities"-when a player moves around in the castle of the game's Sir lamorak's quest, we hope he can find and pick up the target and fight the bad guys. This chapter describes how to implement the objects and entities in the game sir lamorak's quest.
Chapter 2 "collision detection"-If players and bad guys can pass through walls and doors, the game looks terrible, so it is necessary to detect players and objects, or the collision between the player and the object and entity in the game. This chapter describes different types of Collision Detection and describes how to implement them in game sir lamorak's quest.
Chapter 2 "Assemble"-This book has introduced a lot of basic content so far. However, readers can also make a icing on the cake for their own games. This chapter describes how to save the game status when a player exits after a mobile phone call. This section also describes how to use an instrument to perform unit detection and how to perform beta testing on the game.
Target readers of this book
The iPhone game development practice guide is prepared for developers who have programming experience but have not developed computer games. Although this book assumes that the reader has experience in using objective-C Programming, each chapter provides knowledge about objective-C and other technologies for the reader to understand their concepts and implementations.
After reading this book, you can learn the following knowledge: deep understanding of the game engine of the game sir lamorak's quest, as well as the key capabilities and considerations required to create a 2D game engine. This book will give you the ability to use the game engine in this book to develop your own games, or simply use the knowledge of creating games to use other available iPhone game engines (such as cocos2d.
If you have developed an iPhone application but want to turn your attention from a practical application to a game, this book is for you. This book is based on the reader's existing development knowledge. It describes the required terms, technologies and tools and provides practical implementation examples to lead the reader into the game development field.
Not suitable for readers of this book
The iPhone game development practice guide talks about two-dimensional flat games. If you are not interested here, for example, you are interested in using OpenGL ES to apply 3D graphics, this book is not suitable for you.
Before reading this book, I hope you have some knowledge about objective-C, C, xcode, and interface builder. Although the implementation described in this book has been simplified as much as possible and restricted to development in the C language, it is also necessary to have a solid foundation for other languages.
The following books provide some basics:
Cocoa programming for Mac OS X, Third Edition byaaron hillegass (Addison-Wesley, 2008 ).
Learning objective-C 2.0, by Robert Clair (Addison-Wesley, 2011 ).
Programming in objective-C 2.0, by Stephen G. kochan (Addison-Wesley, 2009 ).
Cocoa design patterns, by Erik M. Buck and Donald A. yacktman (Addison-Wesley, 2009 ).
The iPhone developer's cookbook, second edition, by Erica Sadun (Addison-Wesley, 2010 ).
Core Animation: Simplified animation techniques for Mac and iphonedevelopment, by Marcus Zarra and Matt long (Addison-Wesley, 2010 ).
IPhone programming: The big nerd ranch Guide, by calling onhillegass and Joe Conway (big nerd Ranch, inc., 2010 ).
These books and other online resources can help you learn more about programming for Mac and iPhone, and deepen your understanding of the objective-C and cocoa frameworks.
Download source code
In addition to the iPhone game development practice guide, you can also learn a lot about it. The complete annotated source code of game sir lamorak's Quest can be downloaded from informit.com.
This book is interspersed with a lot of code and provides many exercises for readers. However, it is still necessary for readers to read the tools Apple has prepared for developers, such as xcode and the iPhone SDK. You can download these resources from the Apple iPhone Dev center.
Author Profile
During the day, Micheal Daley works for the world's largest commercial software company, whose main customers are large enterprises. In the evening, Micheal learned how to build a game for the iPhone. Micheal first used basic to write adventure games on Sinclair spectrum 48kb, and later developed to write games on Commodore 64 and Amiga a500. He never stops his passion for game programming. Since the advent of the iPhone, Micheal began to learn objective-C and how to create games for the iPhone.
For many years, Micheal has compiled many games for his children. The release of the iPhone has made him want to write games for more people, not just for his children. Micheal is enthusiastic about learning and applying new technologies. He is also an Apple fan and has invested a lot of time and money on the latest Apple devices.