DOTS speeds up mobile games and development

How the new Data-Oriented Technology Stack delivers major benefits for Tic Toc Games

Tic Toc: A Unity developer case study

How do you speed up development and improve the user experience while adding unprecedented numbers of components to game graphics? Tic Toc Games leveraged Unity’s high-performance Data-Oriented Technology Stack (DOTS) – which includes the Entity Component System (ECS), the C# Job System, and the Burst Compiler – to enable 60 frames per second (fps) performance on mobile devices without draining batteries or overheating phones.

  • The project

    Implement a data-oriented software design approach  ​​​​​

  • The goal

    Improve multithreading performance and reduce device power requirements

  • Platforms

    iOS, Android, Xbox One, PS4, Steam, Nintendo Wii U eShop

  • Team members

    ~40 with 5 developers using Unity

  • Location

    Burbank, CA

Tic Toc Games is a full-service developer with a seasoned staff of artists, designers, programmers and production managers, all of whom have shipped award-winning interactive products. They want their players to love the game while they are playing, think about it when they are not playing, share their enthusiasm with their friends, and return to play again and again. They’ve used Unity since they began creating games in 2011.

As with any game company, Tic Toc is always looking for ways to get better performance out of its code and, at the same time, iterate faster on design. Garth Smith, Tic Toc’s lead programmer, put it more elegantly: “We need to make better games, faster.” He’s a long-time Unity user, and finds some of the major new features in Unity 2018.x remarkably powerful.

With several high-profile puzzle releases due in 2019, including a Match 3 and a Collapse game, Smith committed his team to leveraging ECS in particular. “Working with ECS, it’s definitely a different way of coding than what people are used to,” Smith noted, “Data-oriented programming is not taught in school much, so it’s a major paradigm shift. Even for us, there was a little bit of fear about starting something new.” However, what they accomplished with ECS made them believers.

The results:

  • 60 fps on mobile devices without CPUs overheating
  • More efficient testing workflow
  • Fewer iterations and less troubleshooting/bug-fixing
  • Longer device battery life
Tic Toc connects the DOTS

In order to make massive performance and productivity gains, Tic Toc implemented the major components of Unity’s new Data-Oriented Technology Stack (DOTS), which includes the Entity Component System (ECS), the C# Job System, and the Burst Compiler.

ECS shifts the focus from objects to data

ECS replaces object-oriented coding with a data-oriented approach much more appropriate for many parts of gaming applications. It decouples data from processing, eliminating an enormous amount of data scattering and enables true multithreading as events no longer have to be processed sequentially.

For example, two entities might be a bullet and a player, each with references to different attributes like position, spawning, and health data. The entities and the attributes are pure data with no attached functionality. The system applies a function to an entity, such as a motion system to a bullet or a spawning system to a player. This separation of data and function lets Unity create jobs that can be processed in parallel on multiple cores. According to Mike Geig, Unity’s Global Head of Evangelism Content, “Once it clicks, it’s pretty easy to wrap your head around it.”

The benefits of using ECS are significant. Simply because of the way data is organized, it’s easier to write optimized code – thus the tagline, “Performance by default.” Smith added, “Some of the doors that ECS opened showed us how to make better algorithms.” In addition, ECS code is highly reusable, archetypes (unique entities) are tightly packed in memory, and perhaps most importantly, ECS can take advantage of increasing numbers of CPU cores. Today, mainstream CPUs have up to 4-6 physical and 8-12 logical cores, while “enthusiast” CPUs have up to 16 physical and 32 logical cores. Most go unused, but DOTS takes full advantage of them all.

Watch Mike Geig’s 5-part Intro to the Entity Component System (ECS) and C# Job System.

Teaming up with the C# Job System

Combining the team’s data-oriented ECS code with Unity’s C# Job System let Tic Toc increasingly leverage multi-core processing and multithreading. Writing thread-safe code is difficult because race conditions (threads running in unexpected order, causing unexpected results) add constraints, and constant context-switching is inefficient.

Yet the Job System manages all of the above, letting the Tic Toc developers concentrate on game-specific code. Smith said, “A job lets us run our systems on multiple threads and use different cores on a CPU – processes we found quite difficult to do before. ECS and the Job System let us make almost 100% use of the other cores, which is incredibly efficient.”

The Burst Compiler speaks directly to the hardware

The new Burst Compiler is an LLVM-based, math-aware compiler technology that takes C# jobs and produces highly optimized machine code for the particular capabilities of the target platform. For Tic Toc, that meant Smith and his team didn’t have to spend time relearning and grinding out complex low-level code to fix performance hitches.

“With the Burst Compiler, we could make assumptions about what we’re doing with ECS, and that really sped things up. We found some loops would increase by around 30x, especially when loops occurred many times during a frame,” Smith said.

The team found that when large systems interact, the Burst Compiler eliminates a significant number of integration bugs that would typically have to be weeded out in QA. “With the Burst Compiler, you get the advantages of hand-tuned assembler code, across multiple platforms, without all the hard work,” added Smith.

DOTS advice for other studios

Tic Toc’s transition to a data-oriented approach was tentative at first, but it was a fun challenge to take on. “Once I got the hang of ECS, it started to come along pretty easily. I think at this point, everyone in the studio gets it – we love it, actually – and we’ll probably be doing all our future games with ECS,” said Smith.

He has some solid advice for other studios too. “You don’t have to go ‘all in’ with ECS at first. You can adopt it gradually, and even by doing the small things you’ll get a big performance boost, especially with code reusability.”

As well, Smith recommends doing a prototype project before going into full production. “Try something simple like a game jam, a Tetris, Tic-Tac-Toe – it doesn’t really matter – just complete a game in ECS before you have a whole team go into production with art and all that. You’ll learn a lot with your first exposure to it.”

Finally, Smith is excited about what Tic Toc’s players can expect. “They’re really going to notice the different feel and performance with our new games running at near 60 fps, no matter what’s happening on the screen. I know they’ll definitely appreciate the enhanced gameplay and responsiveness!”

Garth Smith, Lead Programmer, Tic Toc Games

“With Unity’s Entity Component System, the performance is awesome, but even if you are not eager to get performance there are still significant benefits in terms of code reusability and preserving mobile device battery life.”

Garth Smith, Lead Programmer, Tic Toc Games

The benefits of ECS for mobile game development

Hear why ECS means faster mobile-game development, fewer bugs, longer battery life and lots more.

Listen to DOTS early-adopter Garth Smith share his experience with Unity’s new data-oriented approach.

How Tic Toc Uses ECS in Mobile Puzzle Games

At Unite Los Angeles, Tic Toc led a session titled “We Love Performance.” In the talk, Garth Smith explains how ECS helped them speed up iterations, as well as their general experience working with Unity’s Entity Component System. 

Performance by default

Take full advantage of multicore processors with our new high-performance multithreaded system.

We use cookies to ensure that we give you the best experience on our website. Visit our cookie policy page for more information.

Got it