How to Learn How to Develop iphone games

Source: Internet
Author: User
Tags coding standards

It has been about half a year since the release of "how to learn iphone game development. In fact, when I wrote "How to Learn iphone game development", I wrote a story about how to learn iphone game development well. But now, when I sit down and write this article, I still feel a little uneasy, afraid that the writing is not good, or the level is not enough, and the writing cannot achieve the expected results. However, if you care about him, I write my hand. I have summarized my learning experiences and experiences over the past six months and my blog writing experiences in the future, hoping to help people later. At the end of the article, I will also point out some directions for beginners of iphone game development and provide a better exchange platform for those who have already entered the room.

First, the basics are important. For example, c/c ++, especially pointer and memory management, if you do not have a deep understanding, it will be difficult to learn. However, you may ask, "Isn't objective-c used for iphone game development? ". Yes. Currently, the most commonly used objective-c is objective-c. Of course, except for Unity (c # And js are used in it ). However, in fact, objc encapsulates an object-oriented feature on the basis of c, and tries to change the common suffix expression to an infix expression (that is, syntax difference ). Moreover, anyone who has learned c/c ++ knows that memory management is very difficult, and bugs are basically in the memory. As a result, many people do not like c and c ++ and turn to c # and java. I don't want to discuss any other language here. There are too many discussions on this topic and it's boring to discuss it again. Each language has its own advantages and expertise. It has its own application fields, its companies or organizations that support it, and its fans that maintain it. What programmers need to do is to select an appropriate programming environment (including languages, tools, sdks, etc.) based on the characteristics of the problem field ).

So what about objc memory management? Currently, it is necessary. However, on mac, objc 2.0 introduces the garbage collection mechanism, and the new sdk ios5 introduces the ARC (automatic reference counting function), maybe in the future, using ojbc to develop applications and games on the iphone does not require manual memory management. However, this automatic management mechanism will certainly bring about operational efficiency issues, which is the same as all gc mechanisms. So, let's wait and see how ios5's ARC mechanism works.

If c/c ++ has a good foundation, learning objc will be very fast. At least I spent two weeks to finish learning objc. However, it takes time to manage the objc memory, that is, to control the reference count. Here we recommend you read some books and blogs. If your c/c ++ basics are not very good, build your knowledge of c and c ++ before learning objc. C language and pointer, the c programming language, c ++ primer, the c ++ programming language, Thinking in c ++, and c ++ principles and Practices, effective c ++, more effective c ++, and inside c ++ object model. If you search online, there are too many books recommended for c ++. I just listed some of them as classic ones. Of course, if you have read them all. Based on the Reference behind these books, you can also find other excellent c and c ++ books. I read books like this. After reading a good book, I read a local book according to the reference documents of this book. Then I read another book and read its reference documents. This not only expands your knowledge, but also can grasp the ins and outs of what you have learned. The deeper the understanding, the more comfortable you can write a program. Of course, there are so many books here. For those programmers who need to work overtime every day, they really cannot afford to hurt. However, these things will be supplemented sooner or later. If you are still in college, you should pay more attention to this aspect. It's not that easy to work later and want to calm down and learn. Even though I am still at school, I want to see that the overtime program is roaring every day! "You can't afford to hurt IT!

However, programming is slowly accumulating. Even if you have read these books and do not practice them, it is useless. The programming capability actually has a certain relationship with the number of times you repeat. If you just talk about it on paper, you may not be able to compile a program. Now, let's talk about objc. If you think the c/c ++ basics are good, we recommend you a few good objc books. Programming in Objective-C 2.0, Learning Objective-C 2.0, objective-c basics tutorial, and some apple technical manuals (by the way, do not leave a message asking me for an e-book. You only need to open google, and then enter the English book name + pdf, then OK !). To learn about objc, you must not be lazy. You must master the reference counting method to manage the memory, because you will be stuck in the memory management after no matter whether you are doing applications or playing games or 80% of problems. Various crash have wood! Various EXC_BAD_ACCESS methods are available! A variety of inexplicable programs have fallen! (You must understand Autorelease Pool, Autorelease Pool Stack, Main Loop, and Owner ship. These concepts are very important. If you do not understand them yet, read more about apple's objective-c memory programming guide .)

Then, when the objc Foundation is ready (I actually practice some iphone applications first, because I still need to use the UIKit and Cocoa Foundation frameworks to play games later ), xcode is also familiar with it. (You can use xcode to set breakpoint debugging, use Zombie to solve memory problems, and use instruments to detect memory leaks, memory allocation, and cpu usage, you can create a target and create a schema of 4.0.) At this time, it is easier for you to learn about iphone game development. At least you are familiar with the development environment and development tools. If you encounter problems, you can solve them by yourself, instead of asking questions online or shouting in the group one day or later. In fact, it is much easier to solve a problem by yourself than to ask others for answers. If you are very unfamiliar with yourself and haven't solved the problem for a long time, you can try again later. I will also describe the problem more clearly and discuss it with others. Sometimes, I can enlighten my mind and be enlightened. Some people like to say that no one answers questions. There are actually many reasons. One is that you are not clear about the problem, the other is that others do not know the answer, and the third is that you have not found the problem at all. Therefore, we hope that you will try your best to solve the problem, which is beneficial to all users. (For how to use tools, I have a few objective-c tutorials written by Ray on my blog. You can see them in the objective-c category, you can also listen to the Stanford University iphone development video, which is now available in the Netease open class, you can follow)

Next, can you immediately learn about iphone game development? Don't worry. You need to add some knowledge-coding specifications and design patterns. Coding specifications are very important. Every platform has its own coding style and specifications. If you follow these specifications, the code you write can be easily read and modified by others, you may feel more cordial when reading other people's code, because they look very close. Here I will not discuss the encoding standards in detail, because google has already written the objective-c Coding standards, Apple's Cocoa Coding Guidelines, and c ++ Coding standards. Why c ++? Because box2d will be used to learn about the physical engine of the game later, and mixed programming of objc and c ++ will be used at that time. Pay attention to some things. Then, let's talk about the design pattern. For those who are new to iphone development, it is best to learn about application development for about half a month. This will be good for your future game development. I believe anyone who has worked on the iphone knows about MVC. In the world of apple, this pattern is widely used, and even MVC is everywhere. In fact, MVC is not only a mode, but also a way to organize code, but also an idea of software design. I will recommend cocos2d to you later. It is an open source 2d game engine. Because engine-level programs contain a lot of software design and code organization skills, if we have some knowledge about design patterns, it will be helpful to read the source code of cocos2d. For design patterns, I recommend two books: one is GOF's design patterns, the basis for reusable object-oriented software, and the other is cocoa design patterns. Of course, if it is a preliminary design model, it is best to first read "Head first design model" and "Big talk design model". (Reading this, some children's shoes may wonder. How do you know so much about a student? Don't forget, we have google. If you still don't know how to make full use of network resources, please refer to my book "How to find information-my experiences and experiences !)

Now, let's talk about how to learn cocos2d! Cocos2d is not just a game graphics engine, it also integrates sound engine and physical engine, and has active communities and rich materials. Most importantly, it is open-source and free. How to Learn cocos2d? Previously, we generally recommended the series of tutorials that Zhiyi wrote. I did the same. That's why I suggest you learn how to develop iphone games. Zhiyi's tutorial is an eternal classic. Although the APIs used are old and the examples demonstrated are outdated, many beginners cannot find various functions during their practice, various puzzles. Therefore, I think it is easier to start with Ray's tutorial. Ray writes English, but I have translated most of his tutorials into Chinese.

Now, I want to repeat the cocos2d iphone game development process.

Starting from the article titled how to use cocos2d to create a simple iphone game tutorial (Part 1), I will read three sections of this series of tutorials. Then find a test example TomTheTurret in the program downloaded by the cocos2d-iphone, which is located under the CocoDension/TestAndDemos directory. This example is a perfect example of Ray's series of tutorials.

Next, I think we can take a look at the example of Zhiyi, and learn about the game of tank wars. Zhiyi's blog address is:

  1. Zhiyi Cocos2D-iPhone game development tutorial 001 (341)
  2. Zhiyi Cocos2D-iPhone game development tutorial 002 (94)
  3. Zhiyi Cocos2D-iPhone game development tutorial 003 (71)
  4. Zhiyi Cocos2D-iPhone game development tutorial 004 (73)
  5. Zhiyi Cocos2D-iPhone game development tutorial 005 (65)
  6. Zhiyi Cocos2D-iPhone game development tutorial 006 (66)
  7. Zhiyi Cocos2D-iPhone game development tutorial 007 (102)

Remember, if you are using the latest version of cocos2d, many class names and function names may have been changed in Zhiyi's tutorial. Don't be afraid. In fact, it's just a few small changes. For example, change CCColorLayer to CCLayerColor, change CCXXXXTransition to CCTransitionXXXX, change CCXXXXAction to CCActionXXX, and change CCSpriteSheet to CCSpriteBatchNode. In fact, it is only a few minor refactoring to make it easier for everyone to use the cocos2d engine. Here, by the way, many people do not care about variable names and class names when writing code. You can do whatever you want to name, especially when you find that the name is difficult to change. Because the code references too many bad class names, It is very troublesome to change them one by one. However, Xcode provides the refactor function.

Next, let's take a look.

How to Use animations and spritesheet in cocos2d

Cocos2d genie Tutorial: Part 1 cocos2d menu Tutorial: Part 1 How to Use cocos2d to create a tile map-based game Tutorial: Part 1

The first part describes a series of tutorials. You can navigate to the last part of the tutorial. After learning these things, you should have some knowledge and understanding about sprite, menu, layer, scene, spritesheet, spriteBatchNode, and tiledMap.

Then, you can continue to study on my blog, and there are many other tutorials. We started from the preliminary game tutorial, followed by the intermediate and intermediate courses, and then looked at the tutorial on the physical classification of the game.

At this time, you should read some books. Here we recommend two books, "Learn iPhone and iPad Cocos2D Game Development" and "Leaning Cocos2d".

If you have read all the translation tutorials on my blog, and the two books mentioned above have also been read. Of course, it is important to understand and practice it !!! Don't mess up for the quantity. If you want to speed up, it will not reach! Next, you 'd better use some projects to train your hands. If you work for a company, it's best to use the company's projects to practice it. If you are studying for yourself, we recommend that you start with an existing series of tutorials. Because many images and sound materials already exist, you can expand them to implement more cool functions. If you are willing to share your results with me, I can write your results as a tutorial, so that more people will benefit from it.

So what should we do next? I think there are two ways to choose from:

1. Continue to study the cocos2d framework in depth, carefully study the cocos2d source code, and understand the author's Code Design and Implementation ideas. Then I learned about opengles, tried to expand the cocos2d framework myself, and customized the framework based on cocos2d. I also recommend several books Learning iOS Game Programming, Oreilly. iPhone.3D. Programming. May.2010, and OpenGL ES 2.0 Programming Guide.

2. Try the cocos2d-x. This is an open-source project led by Chinese people. It uses c ++ to support multiple platforms, including ios, android, happy phone, win32, and linux. At the same time, the current cocos2d-x also provides lua interface binding. Why cocos2d-x? Currently, the competition on ios is fierce. If your game can run on multiple platforms, I believe it will be good if there are multiple sources of gold?

Of course, if you want to go further in game development and learning, you are advised to study mathematics and physics, computer graphics, artificial intelligence, data structures and algorithms in depth. I have read a blog from cool people, saying that playing games leaves only mathematics and physics. While I am developing myself, I also feel that mathematics is very important.

(It's so long. Hurry up and finish it !) In the future, please pay attention to Ray's blog at http://www.learn-cocos2d.com/. the website's author is making a new game development package kobold2d. He integrated all the resources related to cocos2d into kobold2d, and is still in the preview stage. I believe the release will bring a lot of convenience to developers. By the way, the author's website has a lot of resources, which are included in the navigation link above and in the link on the right. Let's go and watch it! Of course, in fact there is a very important learning place, that is cocos2d Official Website: http://www.cocos2d-iphone.org, there are forums, don't because it is E text won't go, see E text is king! Also, I almost forgot to use git!

In addition, to avoid copyright issues, Ray has said that he can only allow others to translate the five tutorials he wrote. Although I wrote a disclaimer, I still have concerns. So, in the future I will be on the Ray tutorial will do some "micro innovation", with the cocos2d-x to implement again. Because now cocos2d-x information is too little. In this way, if you want to see the objc version, simply go to Ray's website and check the c ++ version.

Finally, a few of my friends discussed it and set up a special forum: tairan tutorial, which serves as a starting point to provide a better learning and communication platform for everyone. The following is the statement of the Forum Founder:

The tairan Forum team is composed of a group of iOS developers with common goals. We found that the technical forums in China are more or less lacking in some resources, especially when we are doing 3D Projects and games, especially when OpenGL ES Resources are scarce, so we came up with the idea: after completing several projects at tairan studio, we set up a forum to provide a platform for developers who share the same ideals with us. In September this year, after the completion of the last project, we decided to fulfill this promise.

At the beginning of the forum, we decided to focus mainly on OpenGL ES. Because of our project experience, we can write some relevant tutorials, so that everyone is not starting as hard as we were in the past. Later, we told Zilong Shan people the idea and found that everyone had the same idea. After a period of mutual understanding, we decided to join hands to create a brand new peaceful forum.

In the future, using the experience accumulated in the previous project and testing equipment, tairan forum will bring you OpenGL ES tutorial, cococosd-iPnone and Cocos2D-x tutorial (will continue to expand later ); different from the previous blog, We will vigorously develop original tutorials, including cross-platform Cocos2D-x tutorials.

First, we stress that the tairan forum will be a free open forum and we will not adopt commercial operations.

Secondly, there will be some advertising spaces in the forum. We plan to open them to you. If you have a new app, you can contact us later. We will arrange advertisements for the peaceful forum for your app for free, to help everyone through the difficult process of the app.

Finally, if you have good suggestions or comments, please let us know. This will allow us to grow together. E-mail: iven@ityran.com

 

Welcome to the Forum!

Copyright statement: This article is original by Zilong Shan Ren. You are welcome to share it with me. Please respect the work of the author. Keep this note and the author's blog link when reprinting. Thank you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.