Cross-platform cocos2d-x

Source: Internet
Author: User

Original article: http://blog.sina.com.cn/s/blog_56c9b55c010140xv.html

The lecturers we interviewed in this issue are:

Yang rich


Founder and CTO of mengtuo technology, Pioneer and evangelist in the domestic Android field, Senior Android/iOS development engineer and architect.


Open source International Game Engine Cocos2d-x for Win8 Metro core developers. 51cto, a well-known it website in China, recommends technical experts. He has been interviewed and written for it for many times, and has also been invited to give lectures at the Chinese mobile Developer Conference and technology Salon, very popular. He has written best-selling books such as "Secrets of Android Application Development" and "android technology Insider: system volume.


Theme: cocos2d-x cross-platform



9ria: You have rich Android development experience. Can you give me some suggestions for beginners of Android development? How to Learn and what are the key points needing attention?

Yang rich: Android, as an open-source operating system, can be used for Android development. For example, Android SDK APIs are used to develop applications and games, android framework-layer source code framework development, modification of Android system source code custom Android system, and driver development, so Android beginners must first understand their interests and needs, after familiarizing themselves with one direction, it can be expanded to multiple layers.


There are a large number of Android technical articles and technical tutorials both on the official and non-official websites of Google. learning materials are certainly not a problem. In addition to these materials, the source code of Android itself is also the best resource, it can be said that any problem can be solved through the source code. SoThe focus of Android learning should be on the understanding of various Android mechanisms, such as process management, lifecycle, and binder communication mechanisms.. Because Android is based on a Linux system, familiarity with the Linux system will certainly be of great help in learning android. Although Android is developed in Java, Google has released the corresponding ndk for each version since Android, some complex logic operations can be completed using ndk through C ++. Therefore, it is also a good choice to develop certain modules of applications through C ++ when necessary.



9ria heaven will make up: cocos2d-x engine in the cocos2d family stand out, become the most popular star, can you briefly introduce the advantages and disadvantages of cocos2d-x?

Yang rich:Cocos2d-x was originally based on cocos2d application completed, can be said to be another version of cocos2d, but because the cocos2d-x is based on C ++ language, cocos2d is based on the object-C language and can only run in iOS and Mac operating systems. c ++ developers must be more than object-C. Another important reason is that, the main direction of cocos2d lies in the architectural design of the engine, focusing on the engine itself, and cocos2d-x is mainly dealing with cross-platform Solutions.

 

At present, the cocos2d-x mainly maintains three versions, one is the native C ++ version, one is to support Windows Phone 7 C # version, one is to support HTML5 JS version, of course we also have the cocos2d-x we developed
The for Win8 Metro version supports Windows 8 Metro game development. These versions can be used across most mainstream platforms. One-time development and multi-platform reuse are the best choice, both in terms of cost and efficiency. After all, this is the most popular topic in the past two years. At that time, everyone was looking for a solution, the current cocos2d-x can meet the needs of everyone's solutions;Said disadvantages, that is, cocos2d-x has not been similar to unity3d good tools to develop the game, But small, a single tool is a lot, but also understand that the cocos2d-x team is also planning to develop in this direction, in the future will provide more tools, making game development easier. We can even make some tools ourselves.


 

9ria Tiandi will make up: Can you briefly introduce the characteristics of different platforms in cocos2d-x cross-platform development using methods? In actual development, what is the performance of the engine on different platforms?

Yang rich: This question is very good, the main advantage of cocos2d-x lies in the cross-platform, but after all each platform has its own characteristics, the development process naturally also need to pay attention to the place, first of all, the development language, cocos2d-x currently maintains three languages, C ++, JS, C #, C # is specially designed for Windows phone7, this will lead to code originally written in C ++. A simple language translation job is required for porting to Windows phone7. Although javascript can be used across platforms, HTML5 is not mature enough, there is no problem in efficiency on the PC, but there are still many problems to solve on the mobile phone.


Of course, in addition to these software features, there are also some hardware features, such as IOS, Android, Windows Phone, and PC. Their GPUs are different, and their hardware performance and hardware acceleration solutions are different, the final optimization of the game may be different. For example, different GPUs support different texture formats, texture compression formats, texture sizes, and matrix operations, in order for the cocos2d-x to achieve the best performance on every platform, it is necessary to have in-depth Optimizations to the GPU of the device.


The last example is the Windows 8 version we developed. Because Windows 8 did not support OpenGL in the early days, we had to use dx to accelerate all hardware, this allows the engine to maintain another set of graphics rendering systems at the underlying layer, specifically for Windows 8. To optimize them, we need to optimize OpenGL and DX respectively.


9ria Tiandi will make up: cocos2d-x in the large-scale development of many people, how to perform collaborative operations?

Yang rich: Speaking of multi-person development in the cocos2d-x may not be particularly obvious, because a general cocos2d-x game does not need a lot of people to develop, usually three people develop a cocos2d-x game together is already very big. Even so, the cocos2d-x can also be very convenient for multi-person development, first of all said the program and ui, in the new version of the cocos2d-x has begun to appear in the Cocos Builder tool, you can directly design the UI and some simple scenarios. This allows the uidesigner to design the UI based on their own needs without affecting program development.

After the UI is designed, the program can be used directly. There are also many gadgets, such as the map editor and particle Editor, which can be used independently. These tools can be used by planners or designers, after the completion, it can be directly integrated by the programmer.

Finally, the interaction between programmers, in fact, it is very simple, cocos2d-x has the concept of scene and layer, can be different people responsible for the development of different scenarios, different people to develop different layers, the interaction between them is only through a few lines of simple code can be integrated, coupled with the project development documentation and source code management tools, multi-person development in the cocos2d-x also become very harmonious.

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.