Some limitations of Egret

Source: Internet
Author: User

Egret is a good thing, the whole set of workflow used down, especially handy, for mobile game development, choose Egret is undoubtedly a no two choice.

Of course, the primary school Chinese teacher taught a kind of writing techniques, to promote the first inhibition, the author today Upside down, to say egret some limitations.

The author from Contact Egret to now use Egret as the main development tool, has been a whole year, some noise has been spit, but some noisy still swallowing. Of course, which tool framework has no limitations, but these limitations are still for Egret beginners to understand.

1.3d Rotation

3D rotation Although has been out of Egret this 2D engine category, but, let us miss Flash Rotationx,rotationy,rotationz These three attributes of the people, in the implementation of some cool effect, is undoubtedly a big discount ah. In fact, as early as last July, the author has already communicated with Egret official, the result of communication will not support 3D rotation.

At this point, some experienced developers will say: You can use ScaleX and ScaleY to achieve the top and bottom around 3D rotation. In fact, I have been using this method to achieve false 3D rotation, but, this is not the true meaning of 3D rotation, 3D rotation will produce perspective effect, that is, near large far small.
I wonder why the 3D rotation is not supported, for OpenGL and WebGL, it should be the original support, for canvas2d, can be achieved through the matrix, and then asked, why Egret realized the skew (oblique cut), But does not implement perspective (perspective). In fact there is a reason, because canvas2d transform is able to operate a 3*3 matrix, but the 3*3 matrix does not realize the transformation of perspective, less z-axis, so this is HTML5 canvas2d indirectly caused by egret limitations of the limitation.

·2. Rendering

Because Egret is not only a HTML5 game engine, but is a JS game engine, now can support 3 platforms (Html5/android/ios), if not understand can go to the author of another it See (Egret essays-egret shallow into shallow out), It explains the mechanism of Egret. Really because this is a multi-platform engine, so it sacrificed a lot of performance aspects of things, this sacrifice is shown in the JS code and native code ratio, the higher the ratio, then the performance of the game will be worse (now card or not card, popular). have seen Egret shallow into the shallow, you will know Egret mechanism is in fact for the underlying abstraction out a lot of context for the JS call, this abstraction brings advantages and disadvantages.

One benefit is the ability to directly adapt to the current holding of the CANVAS2D environment, because the canvas2d provided by the rendering is very basic, and there is no strong encapsulation, there is also a benefit is convenient egret to its JS code maintenance, directly to the engine source code released will be the most efficient update.

However, the disadvantage is that the ratio has risen a lot, egret in order to be 3 on the platform can publish similar degree to achieve the maximum effect, so that the JS code rate will be very high, leading to some very core and high operating rate of the code segment need to use JS to achieve, and do not say V8 engine has more cattle break, always to translate once.

Because of this, making native run a physics engine will be laborious, because the JS version of the physical engine running on the mobile side is very inefficient.

Personal advice is to learn some of the cocos2d-x, the core of something, developers basically do not move the code, native on the native code, so that the native can achieve a higher rendering experience, (Anyway, native template is not the same as the main version of Egret Update!) )。

·3. Inequalities behind the cross-platform

I am currently in the company, requires the game to do 3 platform export and synchronization on-line. Originally I think this should be quite simple, with Egret official Support Template set is good, but the project did deep, you will find actually not so simple, for this I learned the development of Android and iOS (comparative basis of the current learning is the kind of degree), is to meet the needs of the above, such as access to Facebook social, GA analysis, flurry analysis, AdMob ads and many other features, the implementation of these features is not to say egret limitations, in fact, these are the same for every cross-platform game engine, are implemented using native code.

The author in the development process, but also with the Egret official developers chatted a lot, just know Egret for 3 platform attention is priority: Html5>android>ios. Because HTML5 is directly involved in code writing and debugging projects, and is currently the highest market share of the release form, so first to ensure its correctness, and then because the Android device ratio is much higher than iOS, so iOS is left behind, in some implementations is relatively lag and do not pay attention to. Sure enough, the author in the development process, found that the problem from more to less exactly is IOS>ANDROID>HTML5.

For example, in fact, for the iOS problem, Egret official grape June has been the author asked, bug a bit more, are the grape June directly to the hotfix version to the author. But for the graphics code on iOS, a basic graphics module, at the beginning of the 2.0.x is broken, the author tested many times, found that the x, y parameters will be invalidated, resulting in all the graphics drawn by the visual objects are stacked in the upper left corner of the screen, Finally, the grape king directly said that they have a developer in the reconstruction graphics module to break, the author can only recognize. He also gave a temporary solution, that is, instead of using a pixel chart, however, due to platform differences, in iOS and browser, directly to a very small Tula stretched to a very large, it will do a linear interpolation pixel fill, the popular point is the figure distortion, such as you gave a 1*1 of Red (0xFF0000) picture, To stretch to 3*1 size, then it will "help you" fill the pixels: 0x000000, 0x800000,0xff0000, not three are 0xFF0000, so there is no way, can only be filled with nine Gonglai.

Another example, is the non-uniform hot update, although now give "almost" consistent hot update scheme, but obviously in iOS and Android implementation is not the same, so in order to achieve consistency, the author has been using their own implementation of the heat more way, is to let them call the same interface.

The unfair treatment of iOS, is to make the author most annoyed a limitation, Egret do the complete product, since has launched the support of the iOS platform, should do a good job in this area of service, not because the user group and unequal treatment of it. In our developers, we do the product is trustworthy Egret only choose it, so Hope Egret official can pay attention to this point.

4. Bitmap manipulation

Egret does not provide developers with a bitmap-related operational API, which is a lot of development mention, but Egret really did not provide. These developers should be a lot of from Flash, like the BitmapData class, but Egret BitmapData class is just a bunch of data, it in the web and native in different forms, but this heap of data provides the interface difference is relatively large, difficult to integrate. There is the use of JS to manipulate the data, that the efficiency must be very low, generally this package is in the bottom through C/s to direct manipulation, so do not provide JS bitmap operation interface

If you are in favor of the flash of the BitmapData class, it is recommended that you look at the Egret source code, implement it yourself, of course, this method is only valid in the Web publishing.

• 5 ...

I've met you again.

• End

For the limitations of Egret, but also only the author stand in their own position, with your egret in-depth understanding, you will certainly find more. Of course, the Egret team will humbly accept your comments or suggestions, we will be better for the development of Egret to provide a little help.

Some limitations of Egret

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.