Unity DOTS: What is Data-Oriented Design?

by Liam Cubicle Published February 13, 2024

Data-Oriented Design (DOD) is a different approach to Object-Oriented Programming (OOP). DOD is the foundation of Unity’s Data-Oriented Technology Stack (DOTS). Without a full understanding of the fundamental concepts of DOD, you can’t use Unity’s DOTS.

In this article, you’ll be provided with all you need to know about Data-Oriented Design in Unity.

First, let’s understand what Object-Oriented Programming is before we can go into how DOD is different from OOP.

What is Object-Oriented Programming?

Object-oriented programming is centered around the concept of classes. It involves structuring your code into real-world entities as objects. Each object has its attributes (data) and methods (functions). Objects are instances of classes. Each instance is unique within the program. This results in lots of individual objects, which is not efficient for CPUs. In OOP, code is organized into classes that can be reused in other programs.

Now, let’s look at Data-Oriented Design

What is Data-Oriented Design?

In Data-Oriented Design, data is prioritized as opposed to OOP which focuses on classes. DOD focuses on the organization and management of data in memory for efficient CPU processing. It uses the Entity Component System (ECS) to separate the data into components, and then the systems iterate across the data to transform the data as required. This minimizes memory access times enhancing performance.

How is DOD different from OOP?

From their definitions, you can pick out their differences. DOD emphasizes organizing and managing data efficiently while OOP focuses on real-world entities referred to as objects. DOD organizes data in arrays for processing in batches resulting in much faster processing while OOP organizes code around classes which are reused through inheritance resulting in slower processing.

You don’t need the OOP concepts like; encapsulation, inheritance, polymorphism, and abstraction to work with DOD. DOD is guided by principles of performance optimization and parallel processing using concepts such as the Entity Component System (ECS).

Data-Oriented Design in Unity

In Unity, Data-Oriented Design is the basis of Unity’s DOTS. Understanding DOD will launch you into writing DOTS code in Unity. Here are fundamental key principles to understanding DOD:

  • Since DOD depends on data, prepare and work out the data you need first, data that is relevant to the game’s entity behavior. Understand how you want to group and organize the data, and the systems you want to use before you begin to write codes.
  • Make sure your data design is optimizable. That is, designed in a memory-efficient way, reducing memory caches, and enhancing performance.
  • Using DOD is an iterative process. Therefore, continue iterating until you achieve your desired performance.

Benefits of Data-Oriented Design in Unity

With DOD, be rest assured of improved performance. DOD significantly improves the performance of applications leading to enhanced user experience. DOD gives developers the chance to handle complex games better. Unity applications built with DOD have better memory management due to parallel processing and multithreading.

Conclusion

The learning curve of DOD might be steep, but all in all, it’s worth it. It’s a powerful approach to the development of high-performance applications in Unity. As a Unity game developer, you should embrace the concept of integrating DOD into your applications to unlock the full potential of your applications.

Free download: Indie Game Marketing Checklist

Download now

Category

programming

Don't forget to share this post!

Popular assets for Unity

See all assets ->
    Cutting-edge volumetric fog and volumetric lighting with support for transparent materials.
    Volumetric clouds, day night cycles, dynamic skies, global lighting, weather effects, and planets and moons.
    A lightweight procedural skybox ideal for semi-stylized projects.
    Image-based Outlines for 2D and 3D games with variable line weight, color, and displacement options.
    Drag-and-drop ready-to-use ambient, impact, and spell particle effects.
    Per-pixel gaussian blur on your entire screen, part of the UI, or in-scene objects.

Free Indie Game Marketing Checklist

Learn how to make your game successful with this handy checklist.

Download for free