Unity DOTS with TCE

Unity’s Data-Oriented Technology Stack (DOTS) is a transformative approach in game development, shifting the focus from traditional object-oriented methods to a data-oriented mindset. This paradigm change offers significant performance enhancements, enabling developers to build more complex and efficient games.

At Tashi we were keen to show off how our Mesh multiplayer solution could be integrated with a Unity DOTS focused project and built a simulation showing off the virtues of both Unity ECS/DOTS using the Tashi consensus engine (TCE) Which we presented at a Unity Dev Day.

We were delighted to receive significant interest not only in how TCE inherently protects against a number of common cheats in peer to peer gaming and how we reduce the costs of creating a client/server modeled games by removing the necessity of procuring centralized infrastructure but it was also clear that realizing the benefits of DOTS had proved elusive to many in the audience.

As such we thought we’d share some of our own discoveries as a result of implementing Tashi with Unity DOTS in our ant simulation and invite anyone interested to discuss either subject further to join us on our discord.

The following is a brief overview of our findings, we hope that anyone who is looking to benefit from Unity DOTS will find it useful.

  • Understanding ECS vs. Object-Oriented Approaches

The Entity Component System (ECS) is at the heart of DOTS, differing fundamentally from object-oriented programming. In ECS, components store data, entities group components, and systems execute logic for these components. This approach allows more efficient memory access and faster execution, as components are grouped in memory

  • Best Practices for DOTS

Effective implementation of DOTS involves adhering to best practices. These include using unmanaged data in ECS for efficient memory usage, employing SystemBase and ISystem for different system requirements, and utilizing authoring systems for easier setup and robustness in working with the editor. Additionally, leveraging IAspect for tagging entities and Entity Command Buffers for scheduling structural changes is crucial

  • Overcoming Challenges and Adopting a New Mindset

Transitioning to DOTS requires a mindset shift from object-oriented to data-oriented thinking. This shift is essential for harnessing the full potential of DOTS and achieving optimal performance

  • Iterative Development Strategies in DOTS

ECS’s data-oriented paradigm raises questions about data division among components. A practical approach is to start with a naive build and refine it over time. This method involves initially creating broader data components and systems, then gradually extracting reusable parts for efficiency.

  • Hybrid Design and Animation in DOTS

While DOTS excels in certain areas, it currently lacks native support for animation and some game development aspects. A hybrid approach, combining DOTS with traditional methods, is often necessary. This approach involves using Monobehaviors for animations, VFX, and other elements, driven by data and events managed in ECS.

  • Common Pitfalls and Tips

Adopting DOTS can present challenges like runtime errors, weird interactions with ScriptableObjects, and scene-loading issues. To mitigate these, iterative development and thorough debugging are recommended. Also, understanding the nuances of ECS syntax, such as idiomatic for each, RefRW, and SystemAPI, is crucial for avoiding common pitfalls.

  • Conclusion

Unity’s DOTS heralds a new era in game development, bringing forth unparalleled efficiency and performance. Though it demands a shift from traditional object-oriented to data-oriented programming, the benefits are substantial, particularly in complex game scenarios. For developers willing to navigate the learning curve, DOTS offers a powerful toolset to elevate game design to new heights.

To get a deeper insight, join our discord server for the detailed downloadable PDF created by our team. There are some useful resources that you’d love to check out!

Last updated