Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning iPhone Game Development with Cocos2D 3.0

You're reading from   Learning iPhone Game Development with Cocos2D 3.0 Harness the power of Cocos2D to create your own stunning and engaging games for iOS

Arrow left icon
Product type Paperback
Published in Jun 2014
Publisher
ISBN-13 9781782160144
Length 434 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Kirill Muzykov Kirill Muzykov
Author Profile Icon Kirill Muzykov
Kirill Muzykov
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. All About Cocos2D FREE CHAPTER 2. Hello Cocos2D 3. Cocos2D – Under the Hood 4. Rendering Sprites 5. Starting the Action 6. Rendering Text 7. Animations and Particle Systems 8. Adding Sound Effects and Music 9. User Interface and Navigation 10. Physics 11. Working with Tile Maps A. Pop Quiz Answers Index

Game engines

Long before the mobile-games era or even PC-gaming era, each game was created for a specific hardware. This means that if you wanted to create a game, you had to spend some time learning low-level details of hardware specification and take into account all of its characteristics, constraints, and sometimes, issues.

Then, when the game was completed and you wanted to create a different game, there was very little you could reuse from the previous games you created. We're not even speaking about porting your existing game to another platform. In this case, you just had to rewrite it almost from scratch.

But hey! We're very lucky to live in a different time. A game developer's life is much easier these days. In our time, we have a lot of different game engines at our disposal; these make our lives much easier.

So what is a game engine?

A game engine is a software framework that adds a level of abstraction between hardware, video drivers, sound drivers, and your code. Typical game engines provide the following functionalities:

  • Rendering: This is the main function of the majority of game engines. This function helps you actually draw something on the screen without the need to write any low-level code. In addition, a game engine sets up a lot of features for you, such as initializing graphics and loading textures. For example, using a modern game engine, you can draw a player character on screen with 2-3 lines of code compared to 30-50 lines of code if you're using OpenGL ES 2.0 directly. In addition to static drawing, game engines provide the ability to animate, scale, rotate, and do many other useful things just by changing an object property.
  • User input: There might be a few great games I don't know about, where you don't have to do anything and don't control the game flow in any way. You just watch what happens on the screen and enjoy (if you know of such games, let me know!). All the recent popular games take some kind of user input (cutting the rope with a finger swipe, touching to activate jetpack, and so on). A game engine lets you get that user input in a convenient manner and respond to it in the game.
  • Sound: Games with sound are so much better! Adding the right sound effects and music can turn a mediocre game into a real gem. Again, game engines come to the rescue and let you play sound effects and background music with only a few lines of code.

Some game engines provide additional functionalities such as physics engine, collision detection, scripting, artificial intelligence, networking and multiplayer support, and localization support. However, many great games were created only using the three functionalities mentioned earlier.

So what is this all about?

First, it is nice to know that you're lucky to live in a time when you can take a game engine and concentrate on making great games instead of spending time on learning hardware specification. So, you have no excuses to not start creating games right now!

Second, Cocos2D is a game engine, so it is a good idea to get a basic understanding of a game engine, its purpose, and its main functions.

Third, many developers including myself love to reinvent the wheel. If you're just beginning game development and considering whether you should invest your time in learning a game engine and using it, or learning low-level features such as OpenGL and possibly creating your own game engine with blackjack, I strongly advise you to start with a game engine such as Cocos2D.

You will learn a lot of game development concepts, and more importantly, you will be able to actually make games. After releasing your first game, you will get invaluable experience, and later, if you decide to dive deeper into low-level details, you will find it much easier after working with a game engine.

Also, it is nice to know that Cocos2D is based on OpenGL ES 2.0 and won't constrain you in any way. You will be able to write low-level code where you think it is required, but still leave all the routine work to Cocos2D.

You have been reading a chapter from
Learning iPhone Game Development with Cocos2D 3.0
Published in: Jun 2014
Publisher:
ISBN-13: 9781782160144
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image