In February of this year, Unity Technologies shared the first details of its new DOTS system with the technological world on its blog. Just one month later, the system was presented in its full glory at the Game Developers Conference (GDC) in March. If you are feeling out of the loop, we should clarify that Unity Technologies is the company behind the Unity game engine, an incredibly popular and widespread tool for game development.
What is DOTS?
DOTS is the abbreviation of “Data-Oriented Technological Stack”, and represents a system of game development with significant modifications to previous systems used in the Unity game engine. As there are thousands of developers in the world who develop their games on the Unity engine, many of them are now undoubtedly curious about the news and how it will affect the development process. Indeed, the topic is of much interest to us as well, and we will try to break down the peculiarities of DOTS and its implications for game development.
Unity DOTS performance presented by Unity
Key Features of DOTS
According to Unity Technologies, the DOTS system was developed to make the software development process more convenient and efficient for developers, as well as to better capitalize on the full power of modern multi-core processors. These changes are accomplished with several unique features and characteristics.
Switch to Data-Oriented Programming
The biggest change of DOTS can be gleaned from the name itself. The system is Data-Oriented, which is a departure from previous systems that were object-oriented. To understand what this means, we should take a closer look at both approaches. Object-oriented programming (OOP) is focused on objects, with their own classes, functions, and data characteristics. This is the most common approach to programming used by game developers today, and most such developers would probably find it difficult to imagine code being written in any other way.
While OOP is cherished for its typically cleaner and simpler code, as well as its logical structure, it does have several drawbacks. For instance, parallelization (use of multiple processor cores to execute a task) can be difficult to achieve with OOP, and failure to do it properly can cause a game to slow down substantially. In comparison, Data-Oriented Programming (DOP) is not focused on objects, but rather on data that is part of the objects. When it is necessary to apply actions to a group of objects, DOP organizes the objects’ data into homogenous groups, which allows the changes to be applied more efficiently and sequentially, as opposed to changes being applied to isolated objects in OOP. The result of a switch from the OOP model to a DOP model is a better utilization of multi-core processor capabilities, as well as improved implementation of cache.
The C# Job System
The C# Job System has existed within Unity for several years now, but the DOTS model entails some changes to the system. Specifically, this is a better utilization of computer resources (computers with multiple cores), and exposure of the native job system (which runs on C++) to allow C# system programming scripts to run in parallel. In the context of this system, a job is a specific unit of work that needs to be carried out.
The job system lines up the active jobs in a queue and assigns worker threads to carry them out. As the threads are distributed among several cores and executed simultaneously, this practice can be called multithreading. While multithreading is a popular practice, it does have some drawbacks, such as an occasional tendency of race conditions (when two threads try to change a unit of shared data at the same time). Fortunately, the new C# Job System has built-in protections against race conditions and several other negative occurrences you may experience in a multithreaded games system and other multithreading projects.
The Unity ECS (Entity Component System)
Following the tradition of traditional Unity systems that have undergone a revamp with DOTS, we have the Unity Entity Component System. So what is ECS? This is a system that organizes elements inside a game or program into 3 categories – entities, components, and systems. In this context, an entity is an individual “thing” in a game or program. The main purpose of entities is to identify data pieces that should be grouped together. The second category – components, represent all of the data in your game or program. This data is collected and indexed by the aforementioned entities. Finally, systems represent the logic for transforming data from one state to the next.
Following the switch to Data-oriented programming, the ECS data layout (sometimes confused with the ECT tech stack meaning) has changed. The positive changes from the update include optimization of memory, better load times, and improved serialization of data within the ECS system tech process. In the grand scheme of things, the updated system makes it easier to reuse code and for others to add to it. The design process is streamlined with the ECS platform meaning that it works in conjunction with the C# Job System and Burst Compiler to fully apply the power of multi-core processors. Users unfamiliar with the ECS term sometimes confuse it with Unity ECM (Enterprise content management), but the two concepts are very different. You can find various ECS documentation (including Unity3D ECS documentation) on the company website, along with documentation on entity programming and the entity system framework.
The Unity Burst Compiler
Like all code compilers, the Unity Burst Compiler transforms source code written by the developer into executable machine code. This executable code is then used by the computer processor to execute tasks. The peculiarity of the Burst Compiler from Unity is that it transforms IL/.NET code to native code using LLVM technology. The new Burst Compiler takes advantage of the new possibility of integrating C# jobs into the native job system, and the result is highly-optimized machine code. This is a great boon for developers, as it reduces the amount of code they need to write by hand or with generic tech compiler data systems. The optimization also makes great use of the capabilities of different platforms that code is compiled for. It should also be mentioned that the burst compiler works well with a data object oriented repository system, a standard ECS database, along with various technological system components used in DOTS.
Getting started on a Unity project
Have you got an idea or concept that you would like to bring to life with the Unity engine? If so, you are not alone. Every year, thousands of games and programs for different programs enter development, but not all of them see the light of day. Most Unity projects require a dedicated team of skilled specialists coupled with much time and resources. Since the DOTS system and related data oriented architecture only exist in preview mode at the moment, you are free to develop your project with a classic Unity build, and this may require the help of a development company.
Program-Ace, the parent company of Game-Ace, is a company with a 27-year history of software and game development. We have worked with market leaders and franchises, developed hundreds of completed projects. Unity-based development is one of our strongest strengths, and we have dozens of talented specialists that are ready to help with your project, whether it is a particular stage of development or a full cycle (from start to finish). If this is something that interests you, feel free to reach out to us for an estimate on what it will require and other details.