We are rebuilding the Unity core using our data-oriented technology stack (Data-Oriented Tech Stack) Like many game studios, we also see great advantages in using the Entity Component System (ECS), C # Task System (C # Job System) and Burst Compiler. At Unite Copenhagen, we had the opportunity to chat with Far North Entertainment and delve into how they implement this DOTS functionality in traditional Unity projects.
Far North Entertainment is a Swedish studio co-owned by five engineering friends. Since the release of Down to Dungeon for Gear VR in early 2018, the company has been working on a game that belongs to the classic genre of PC games, namely a post-apocalyptic game in zombie survival mode. What sets the project apart from others is the number of zombies that are chasing you. The vision of the team in this regard drew thousands of hungry zombies following you in huge hordes.
However, they quickly ran into a lot of performance problems already at the prototyping stage. The creation, death, renewal and animation of all this number of enemies remained the main bottleneck, even after the team tried to solve the problem with oblect pooling and animation instancing.
This forced the studio’s technical director Andres Ericsson to turn his attention to DOTS and change the mindset from object-oriented to data-oriented. “The key idea that helped bring about this shift was that you had to stop thinking about objects and hierarchies of objects and start thinking about data, how it is being transformed, and how to access it,” he said . His words mean that it is not necessary to build a code architecture with an eye on objects of real life in such a way that it solves the most general and abstract problem. He has many tips for those who, like him, are faced with a change in worldview:
“Ask yourself what the real problem is that you are trying to solve, and what data is important to get a solution. Will you convert the same data set the same way over and over again? How much useful data can you fit in one line of the processor cache? If you make changes to existing code, evaluate how much junk data you add to the cache line. Is it possible to divide the calculations into several threads or do I need to use a single command stream? ”