Unity Dots (multi-threaded data-oriented technology stack)

1. What is DOTS?

Full nameData oriented Tech Stack, Chinese is a multi-threaded data-oriented technology stack, including the following parts:
ECS(Entity Component System): Write high-performance code. ECS provides a better way for game design, separating data and behavior, so that developers can focus on solving actual problems.
Job System: Write multi-threaded code. Before Job System, Unity's support for multi-threading was not so friendly. Developers could only use multi-threading to develop data, network and other functions. Operations on related objects could only be performed in the main thread. However, the new Jos System uses A safe, easy-to-use way to take advantage of multi-core processors, allowing developers to write complete, fast code while providing protection from issues such as thread safety.
Burst compiler: Compile and generate high-performance code. Burst is a new LLVM-based, math-aware backend compiler. It compiles C# jobs into highly optimized machine code, taking full advantage of the specific capabilities of the target platform.

2. How to use DOTS?

Unity has not officially released the official version of DOTS, but it has been seen in NetEase’s latest game “Tianyu”. “NetEase Tianyu Mobile Game: Unity’s DOTS is easy to use in multi-threaded development. It provides guarantees in terms of safety and security. The "Tianyu" mobile game has developed a variety of fish ecological behaviors and optimization algorithms to achieve more than 40 species, more than 8,000 fish, and seabed effects with different fish ecology.
When we run 5,000 fish on a single worker thread on iPhone 6s, we can theoretically reach 250 frames according to the time consumption. On mobile phones with more cores, we can have better performance. Unity’s DOTS is indeed It provides the possibility of lower-level performance improvement and is a revolutionary technology.
The following is the time-consuming distribution of 5,000 fish running at 250 frames on iPhone 6s:
Insert image description here
". It can be seen that DOTS improves game performance.

Unity environment configuration

Prerequisite environment, the latest Unity version is recommended here
1. Window-Package Manager opens the package management window, click the drop-down menu Advanced, and select show preview package (Dots has not been officially released yet) ,
Insert image description here
2. Select Entities and click Install in the lower right corner to download and install. Note: In the latest version of Unity, when downloading Entities, it will automatically download the resource packages it depends on, such as Burst and Jobs. Waiting for the resource package
Insert image description here
The installation is successful
Insert image description here
3. After only installing the above resource package, we cannot use Dots normally. We also need to import the Hybrid Renderer resource package for rendering. Display
Insert image description here
At this point, the Dots environment is completed.
Updating...

Guess you like

Origin blog.csdn.net/weixin_42186644/article/details/113259139