The birth of Cocos2d-Java Game Engine
Summary: Cross-platform Cocos2d-Java game engine and supporting CocosEditor2.0 game development tools for a large number of developers to bring the gospel, the use of Java language can also be developedCocos2dCross-platform games.
The birth of Cocos2d-Java background ~
Java and C/C ++ have been playing very well for a long time. Whether in the programmer's circle or in the language rankings, we will always hear a variety of battles and controversies. C/C ++ directly controls the memory and its unique efficiency, which is the reason why many game engines choose it. However, C/C ++ is hard to learn, making many developers daunting, java is widely welcomed by programmers because it is easy to learn, flexible, and fast. Many games require rapid development, migration, and release, so they cannot blindly pursue the high performance of games and miss the ever-changing market, performance and agile development need to find the balance between the two. The Cocos2d-Java team in the continuous attempts and gradually improve the Cocos2d-Java, the technology is mainly rely on the cocos2d-x, but an additional layer of jni encapsulation, cocosEditor is a plug-in Development Tool Based on intellij idea.
Principle and performance of Cocos2d-Java ~
Principle: Similar to js-binding and lua-binding, the jni method is used to encapsulate java to retrieve c ++, so the foundation of all is cocos2d-x;
Performance:Porting to Android: higher than cocos2d-js; porting to ios: Same as cocos2d-js
Why cross-platform android and ios ~
Porting to android can be, and can be transplanted to ios, because ios itself does not have Java virtual machine, the Cocos2d-Java team modified an open source project Avian (Java Virtual Machine ), the Virtual Machine is packed in the ios game developed by the user, so the successful implementation of cocos2d-java runs in the ios system; the development tool cocoseditor will compile all java code into available for ios after compilation of your development project. library a, use xcode to import the library and Java Virtual Machine library, and the migration can be completed easily.
CDK (Cocos2d-Java Develop Kit) Development Kit ~
Cdk is a coos2d-java development kit that can develop cocos2d-java Games through any java Development Tool (such as eclipse. Of course, cocoseditor is a built-in development tool;
Bin directory: It is stored in the computer operating system running Java virtual machine, and cocos2d-x c ++ core library are played in the dll file;
Extreas directory: Stores third-party libraries, including advertising, payment, and sharing;
Lib directory: It stores the jni library that deals with the underlying c ++, and is the core of the entire cocos2d-java.
The engine Api structure follows the-x and-js structures, including Sprite, Direction, Layer, event, particle, ui, audio, and other basic concepts; on the right side, we can clearly see the jni definition method:
Public native static Sprite create (String fileName );
Cocos2d-java code style. See the following code style. The function is to create a new genie, set relevant attributes, add the root node, and then runAction. As long as you are familiar with cocos2d shoes, you may be quick start;
Introduction to CocosEditor2.0 tools
Cocoseditor2.0 is a custom Mobile Phone Based on Intellij Idea Open PlatformGame DevelopmentTool, which can run on Windows/Mac systems. 1.x supports js and lua scripting languages. 2. Version x currently supports the Java language. All game release packages can be quickly transplanted to Android and ios platforms. The tool sets code editing to show the available Scenario Design, animation production, font design, image packaging, particle editing, physical system, map, and other functions, and facilitates debugging and real-time simulation. If you are interested in the source code of this tool, you can directly view the intellij idea community source code. In addition, google's android studio is also derived from the Intellij Idea open platform.
The Interface Design cce is similar to the xml interface design of android. 1. You can drag the control to make it visible. 2. You can switch to the Text directory and write it in xml.
Image TexturePacker automatic packaging: In 1.x, You need to manually import the image for TexturePacker. Now, in 2.x, the image is automatically packaged by recognizing the note. plist, saving a lot of effort.
Font design: Obtain the font of an image by capturing an image.
Physical System: You can use visual shape to edit physical shapes. This is a feature of version 2.x. Functions are basically available, but there are still some improvements;
Code Writing and tips: intellij idea has become the best java development tool in the industry. I agree with this sentence. cocoseditor inherits all its advantages, code prompts, and code refactoring, code review and so on. This is a good news for developers.
Simulator and code debugging: Real-Time Simulated debugging on windows and mac through cocosplayer, which is the standard for game development.
Third-party sdk: provides a wide range of built-in third-party libraries to meet most of your needs.
Supports mac and windows dual-System Development
Fast Release of multiple platforms: ios and Android
TipsCocos2d-java is now more suitable for small and medium-sized games, in addition to the engine in hot update and incremental aspects are relatively weak, developers may encounter some problems in the process of use, and everyone and cherish it ~