Cocos Enhance Kit: Cocos Creator engine for performance optimization, enhancements to the open source project

The original idea of the project

In my development history, projects always need some features that the engine doesn’t have, or the existing features of the engine can’t meet the demand.

So I put all the features I wanted to add to the engine in one project: Cocos Enhance Kit.

I hope everyone can participate in the development of this project (fix bugs), so it will be open source.

I hope this project will be the first to implement some of the features that people expect the engine to have and bring a “native” experience.

I hope this project can be like an alpha version of the engine, it can be a reference in the application effect, and help the engine team to implement the features that people expect the engine to have faster.

Why Custom Engine

The item of adding multi-texture rendering features to the engine, for example, has been done by many people, but.

  • There are those that do it by inheriting engine classes, which I think increases the cost to the user and is not as silky smooth as using the engine’s native features.

  • There are those that do it through plugin scripts, but this approach always requires copying some of the engine code and can be awkward to implement, and I don’t think it’s any more maintainable than a custom engine when Cocos Creator 2.x stops updating features.

Precedent for making multi-texture rendering features native to the engine.

The PixiJS engine has officially implemented multi-texture rendering in the v4 release in 2016.

The > Phaser engine is based on the PixiJS engine, so it also supports multi-texture rendering.

And the biggest advantage of using a custom engine is that it can support native platforms, the disadvantage is that since the mini-game platform has an engine plugin feature, using a custom engine will prevent you from using the engine plugin.

What are some of the features now?

Support for multi-texture rendering

  • Sprite, cc.Label, cc.RichText, cc.MotionSteak, Spine components, just drag in the components to use.
  • Provides multi-texture batcher and automatic material switching mechanism, which makes it easier to dynamically generate and manage multi-texture materials, and is the basis for many of the following features.

Support for high DPI text rendering

Previously, we would increase the fontSize and decrease the Scale of the node to achieve this, but now it is directly implemented inside the engine, and the scale can be adjusted with one line of code.

cc.sp.labelRetinaScale = 2;

And provide a global switch and a single-component switch, you can control the range of this feature on as you like.

Dynamic merge reconstruction

  • Thanks to the multi-texture rendering base, it is possible to stay at 1 Draw Call with at least 8 sets of images.
  • It supports automatic multi-texture batching, optimized algorithms, reuse of discarded space, and other features.
  • Enables Spine to participate in dynamic merging as well.
  • Support global default switch, and add a switch for components to participate in merging or not.
  • Expose more merge interfaces to control the use of dynamic merge maps in a more detailed way.

CHAR Cache Mode Refactoring

  • Thanks to the multi-texture rendering base, the maximum number of character atlases has been increased from 1 to 8, which somewhat alleviates the problem of text not being rendered when the atlases run out.
  • Automatic multi-texture batching is also supported, which means that Char character sets can be merged with dynamic merging in one batch.
  • Support for reuse of discarded space

As long as the dynamic merge and Bitmap cache modes are used properly, most scenes no longer need to do special Draw Call optimization (hitting the set, adjusting the node order, layering rendering) to have a good number of Draw Calls.

The Spine component supports merging with other components, merging into dynamic sets and SpriteFrame swap

As mentioned in the title, because we found that the forum often need to use SpriteFrame to dress up Spine, and there are many companies use Spine to implement common animations, even frame animations, which may have a big performance burden if they can’t be combined with other components.

How to use

You can get the full detailed documentation below, and it only takes a few steps (setting up a custom engine) to apply all the above features.

Github repository: GitHub - smallmain/cocos-enhance-kit: 这是一个提供 Cocos Creator 引擎特性增强、修复与优化的开源非官方增强包。

The enhance kit is extremely restrained in making changes to the engine, and will try to ensure compatibility and not modify the original defaults of the engine, so you don’t have to worry about “suddenly using it somehow”, and almost all new features are enabled and disabled by default.

So after installation you may find that nothing seems to have changed in the project, we recommend that you read the Getting Started tutorial to understand the recommended way to use it.

OMT

Finally, if you want a one-click install, then consider my personal paid engine extensions.

Cocos Store: Cocos Service Pack | Cocos Store

Of course you can write a script to implement it in minutes, so consider this a sponsored link and thank you for your support

2 Likes

Now a regular member, go ahead and add. :slight_smile:

thank you.

great job, bro!
thanks for your contribution.

Thank you all very much for your positive feedback on the issues with Enhance Kit and for your continued assistance in helping me resolve them.
The new version has been uploaded to Github, and the paid engine extensions have been submitted for review in the Cocos Store, please wait for approval.

Enhance Kit v1.1.0

  • [New feature] Dynamic collage will ignore padding to add textures to the dynamic set if they meet the conditions
  • [Bug fix] Fix the problem that maxFrameSize can be set to exceed the size of the set.
  • [Bug fix] Fix the problem that Spine reports an error when it does not determine whether there is a region object in the attachment.
  • [Fix] Fix Implicit instantiation of undefined template error in Android platform packaging.

Thanks to Jack Wang, 火焰库拉 for the above feedback.

火焰库拉?
hahahaha, I know him.

yes yes

Thanks for all the feedback!
The new version has been uploaded to Github and the paid engine extension has been submitted for review in the Cocos Store, please wait for it to be approved.

Enhance Kit v1.2.0

  • [New feature] TiledLayer supports reusing Culling data
  • [Bug fix] Fix MotionStreak initialization error
  • [Bug fix] Fix the problem that resources will not be loaded when delayed loading is checked

Special thanks to Astarte for the feedback above!

Need to make a video in Chinese and English about what you are doing. English subtitles work. But should show the features. Will help out in seeing what is possible with it.

That is great, awesome.
Just couple of days ago, i faced that problem with font rendering on hDPI, thank a lot.

And , there is a BIG question,
how to use these fixes separately in case do not broke actual project?

Sorry for the slow reply

The hdpi fix is probably only one or two files that need to be changed, you can find this commit on Github and change the engine files yourself.

Thank you all for your support!

Version v2.4.10 of the engine has been adapted.

The new version has been uploaded to Github and the paid engine extensions have been submitted for review in the Cocos Store, please wait for approval.

2 Likes