Exclusive: Unity takes a principled step into triple-A performance at GDC

Unity. You hear the word so often these days you rarely think of its original meaning. But it’s an apt choice for the company that set out to democratise game development and succeeded. And a sense of unity is very much still part of the firm’s outlook, as we discovered when speaking to staff at the company’s Copenhagen office.

Unity is all about working together, not just internally, but in collaboration with developers. It’s a company that prides itself on transparency and principles. Quite literally in fact, as founder and CTO Joachim Ante reveals to MCV how a set of new principles underpins the greatest changes to the engine since its inception.

"We’re rebuilding the very foundation of Unity, it’s not just a new release. Hopefully we’re going to transform what people are capable of making with Unity in a really big way.”

“We’re making sure that whatever we build is based on those principles and we hold ourselves accountable to those. We’re rebuilding the very foundation of Unity, it’s not just a new release. Hopefully we’re going to transform what people are capable of making with Unity in a really big way.”

The principles are ambitious and form the basis for changes across the board. Starting with performance, but also encompassing every facet of how the company works with developers, how fast it responds to them, how it releases cutting-edge updates to them and even breaks down the barriers between game code and engine code.

The potential is huge, and while it’s far from its only motivation, it’s very clear that Unity is targeting that triple-A space.

PERFORMANCE BY DEFAULT

Unity has long provided experienced developers with an easy-to-use environment and created new developers by lowering the technical hurdles to entry. However, experience tells us that what you gain in accessibility you must pay in performance.

At GDC 2018, Unity will dispel that notion by publicly releasing a preview of its new core engine technology: “We are going to release the Entity Component System, the C# Jobs System and the Burst compiler at GDC,” Ante reveals.

All of which is the first step in its key new principle: ‘Performance by Default’.

Ante defines the level of performance in relation to Mike Acton, previously the engine director at Insomniac Games, but now working for Unity out of its new Burbank office.

“So you give a guy like Mike Acton a PS4, ask him to write the most optimised code for it. He will create the perfect [data] layout for that specific platform. He will write the most optimised code for it, he will use SIMD instructions, maybe write in C, maybe write in assembler where necessary, but he will really use the hardware to the maximum. This is what we define as performance.”

And that is essentially what the company is giving every Unity user with the new engine, and to clarify that, here’s Mike Acton himself:

“By changing how our customers approach solving problems, and giving them the data-oriented tools they need to do it, we want to allow them to achieve performance that’s a good first approximation of what they could only previously get with dedicated performance experts on staff.”

Ante continues: “Most people don’t write code like that and they don’t do that because it’s hard, so we need to make performance easier.”

To achieve that the team is moving to a new C# Job System that was originally demoed back at Unite Austin in 2017. Unity gives us a second run through and it’s still deeply impressive.

“Most people don’t write code like that and they don’t do that because it’s hard, so we need to make performance easier.”

It’s an RTS demo, created by mobile developer Nordeus, with R&D product manager Martin Gram at the controls. A huge hellish landscape, split by a bridged chasm, is teeming with red and blue soldiers, over 50,000 according to a counter. The units are all pathfinding, choosing targets, firing vast barrages of arrows, and generally eviscerating each other en masse.

The demo is utilising an impressive 95 per cent of the multi-core CPU and the team is confident of hitting 100 per cent soon. “With this demo there is absolutely no game code running on the main thread. Zero,” says Ante. “We needed to do that, to show that if you really wanted to do this perfectly, you can.”

EASE OF ACCESS

But just how easy will this be for the average Unity user? Not that such a thing exists for a tool with millions of devoted users that range from experienced teams right down to kids creating games alone in their bedrooms.

“We want to change the default, so that when you’re writing code you not only get modular code, and it’s not only simple, but it also performs,” Ante says. “It’s a big change from an object-oriented way of doing things to a data-oriented way, and the reason we’re doing this is because it provides such significant value that if we don’t do it then our users will be missing out on the opportunity to make the best games they can possibly make.”

Ulas Karademir, R&D global director, sums it up: “We don’t want to stand in the way of their dreams.”

“People get better at using Unity and they should never get to a point where they feel that Unity is not their tool,” agrees Gram, adding it’s “a democratisation of what the triple-A space is.” Ante continues: “Our job is to make it so that the normal way of you working is automatically going to be fast.”

And Unity will achieve that by encouraging everyone to use small modular components. “Do that and you won’t have to know about data-oriented design, or the best layout for a certain platform, these things will happen for you,” Ante says.

“They have to follow this default way of writing code, which means they have to deal in simpler data types. But everything is expressible this way and the thing is, when you code this way you actually start making more modular code.”

Which means it’s easier to reuse the code and easier for others to understand and work on it: “When you build the engine you can effect the readability of the code of most games, this is a huge responsibility for us to get right.

“If you want the best performance you have to do a little more work,” he admits, but with all those advantages it seems well worth the time invested.

So what kind of games will benefit the most from the new approach? “Anything simulation heavy will get so much better,” Ante answers. Cities Skyline for instance already runs on Unity, but the multi-threaded code there was created by an experienced team. The new technology will open up this kind of game to a far wider pool of developers, and without the usual worries.

RACING SAFE

All the performance and none of the worries? It sounds too good to be true.

“People make mistakes with multi-threaded code, it’s so easy to make those mistakes, to introduce race conditions. That means we need to solve race conditions, if we don’t it’s simply not going to work,” Ante says.

“A lot of people in the game industry have made a lot of multi-threaded games by now. There are a certain set of rules, we know how to write that code. But not everyone knows how to write it and that’s the problem. The very experienced people know there is a good way and there’s a way that always blows your foot off. And we’re just encoding those in a way that helps everyone do it in a way that works.”

The new C# Job System makes it very clear what an instruction is reading from or writing to.

“At the end of the day, we can guarantee there are no race conditions in the code,” Ante says. Which is done through a combination of code analysis and runtime checks. “There is no game engine that has ever done that,” he adds. “So even someone who has never written multi-threaded before, you can trust that guy to write multi-threaded code.” And if he makes a mistake he gets an error message when he runs it, “and these messages are written with the principle of what would I tell a junior programmer if he made this mistake?”

And then the new Burst compiler takes the C# jobs and produces highly optimised code that takes advantage of the particular capabilities of the platform you’re compiling for. So you get a lot of the benefits of hand-tuned assembler code, across multiple platforms, without all the hard work.

That hugely closes the performance gap between say a small team working on multi-platform titles and the big console exclusives.

“We think this is good for our community,” Ante says. “We really believe that. But at the end of the day we are not the ones to decide that, the community decides that. But you can’t just tell them it’s better… you can only give them a way of proving to themselves that this is a good thing.”

Unity’s goal is “a positive experience in just 30 minutes.” So in that time a user should be able to update just one part of their game to the new system and see for themselves the advantages.

THE ONE TRUE WAY

To help achieve all this, and more, Unity has another core principle: “We want to have a single way of writing code,” states Ante.

It sounds a little prescriptive at first but Ante explains the team really wants to flatten the landscape between game code and engine code.

“We can never write code that works for everything. There are always game developers who want to do something special. So what if we make the engine in such a way that it’s so much more open, so you can take say the animation system and modify it to your needs, or you just write your animation engine in the normal way you write game code.”

“Anything from the smallest mobile game to a high-profile console game should be written the same way. Let’s find one way of writing this code… the same underlying structure of components.” Ante goes on to say the same applies to asset pipeline code and runtime code, removing the need to consider these separately.

“We want the people using Unity to be happy while they work. When we make it happen it’s going to be transformative.”

And he wants to make all Unity’s code deterministic – so it generates the same outputs given the same inputs. Which makes it far easier to create replays in-game and to debug code: “We think it creates a lot of value for developers… and makes their lives easier.”

Speaking of making developers’ lives easier, Unity is also committing to an iteration time of 500ms, to reduce frustration. A change in the script to seeing the response in the game should take less than half-a-second. That’s coming down from a worst-case scenario of ten minutes at present.

“There’s a lot of work to make this happen,” Ante admits but “we want the people using Unity to be happy while they work. When we make it happen it’s going to be transformative.”

PACKAGED TO GO

Next, Ante starts to talk about how these principles of performant modular code and a more open engine architecture will create opportunities to push the envelope across every facet of the engine.

“Most of our customers just want a stable product, that’s important and it’s useful for them that we ship three times a year at [a regular] cadence,” Ante admits.

“But there are always some who want something special, some customers want to be on the bleeding edge. However, they usually don’t want to be on the bleeding edge for everything, that usually doesn’t work.”

Instead they want to push in just certain areas, such as world size, AI, player count, and so on.

And that’s why Unity is introducing packages, so that developers can benefit from a stable platform but use the latest, beta versions of other parts of Unity where desired. Even the core engine is now such a package, along with various graphics pipelines, post-processing, animation, camera control and more.

“We’re moving everything into a small modular packages that you can update separately from each other,” Ante explains. These are always being developed, which also has the added bonus of the team being able to get feedback from developers on these individuals modules while they’re still in beta, so to speak.

And all of that will benefit the vast majority of users too by helping to refine new features well before the majority see them rolled into a stable release.

UNITY IN THE HOUSE

Bleeding edge features developed in tandem with developers working on live projects – it sounds like the kind of service a big publisher in-house team would get from its engine team. Say DICE working with Frostbyte. And that’s exactly what Unity wants to provide.

“Unity is your engine team,” Ante tells us.

It’s the next new principle from the company. Working far more closely with those who want to push the boundaries with its new beta packages.

“For example, we have this Slack channel where we actually have 15 customers on our company Slack. They give us feedback every day and we’re super, super transparent with them.”

But, having millions of customers, how do you choose? “You pick some that are really trying to push things. And you work with those really closely.

“When you have an engine team you would, of course, collaborate very closely with that team. With this new foundation that we’re building, we can work with users on it as we do it,” Ante says.

In practice, Unity is looking to get feedback from developers on code changes within five minutes via Slack, hugely speeding up the iteration and feedback loop between itself and its most technically ambitious customers.

“We believe iteration speed beats iteration quality,” adds Karademir, explaining that you get the best answers by keeping the cycle short and repeating it, not by pondering for the right answer to come fully formed.

And this process of working with developers is already underway, for example in how Unity worked with Nordeus to create the RTS demo we saw earlier.

“They were really interested, asking ‘how can we use Unity to make the best possible games’ and so we said ‘why don’t you work with us on a tech demo’. They had some assets, and in just five weeks they put together this tech demo. It was super useful for us and great for them,” Ante enthuses.

“Many of the learnings from this demo spurred on the principles that Joachim has been talking about today,” adds Gram, demonstrating that even the principles themselves have been iterated and developed in collaboration with the community.

ALL TOGETHER NOW

Joachim Ante has done the bulk of the talking over our three-hour meeting, but members of team dropped in for lunch and a chat and there’s a very relaxed feel to it all, a lack of obvious hierarchy. Based in the centre of Copenhagen, it reflects the egalitarian, progressive outlook of the city. And Ante is keen to impress upon us that the ideas come from the team, not just from him.

‘Performance by default’ for example was initially coined by Acton’s Insomniac, and now Unity, colleague, Andreas Fredriksson. They make up just part of an incredibly talented team, with a cumulative CV that covers a broad swathe of the biggest triple-A franchises.

Is Unity directly gunning to dominate the top-tier of games development? Well not that it will say explicitly. However it’s dead set on making sure its platform isn’t standing in the way of any studio who wants to make triple-A titles on it.

“As we do things, the principles become clearer and clearer, but add all these things together, and you achieve. And holy shit that’s going to be different,” Ante says.

“For my life to feel meaningful I need to know why I’m showing up for work, because I don’t have to show up for work,” he smiles and shrugs. “I could just say ‘fuck this’. These principles are why I show up, this is worth spending my life on. This is why I work more than nine-to-five on it, this is why I pour my whole heart into it. It’s a long-term thing, rebuilding the foundation means everything built on it will have to rebuilt…”

They have the core then but there’s still a lot of subsystems to work upon. “We have a great foundation, and we want to give that out to people already… and then ourselves and our customers can start using it in parallel.”

Unity has “a multi-year cycle” ahead building on this new foundation. But it’s confident that the principles behind it will last well beyond that.

“We’re at the beginning, but it’s a very powerful beginning,” Ante finishes. And based on the initial evidence and the passion of the team, it’s very hard not to be inspired.

About MCV Staff

Check Also

[From the industry] Five women-led games received an Innovate UK Award

Five women-led games from across the UK have received a national award from Innovate UK