In just two months, our ECS team and two artists from our FPS Sample group produced a futuristic cityscape – alive with flying vehicles, hundreds of thousands of highly detailed game objects and unique audio sources – that showcases our progress on ECS and the Burst Compiler.
Unite LA 2018 Keynote
In Los Angeles, there was a lot of interest in ECS and the Burst Compiler. Building on the Nordeus demo from Unite Austin, our Game Code and FPS Sample teams produced Megacity, a dynamic futuristic cityscape. Megacity exploits our Data-Oriented Technology Stack (DOTS), the name for all projects under the Performance by Default banner, including ECS, Native Collections, C# Job System, and the Burst Compiler.
It takes a village...
to build a Megacity. To produce this sample, we tapped teams and technology across all of Unity R&D, including the latest features like nested Prefabs and the Scriptable Render Pipelines as well as many existing ones such as Scene editing, World-building, Cinemachine, and the Post-Processing Stack. We also leaned on some in-development features, coming your way in 2019:
- Workflows for (very) large scenes
- C# audio system
- HLOD system
- ECS culling system
- Asynchronous scene streaming
- Asynchronous entity instantiation
- Improvements to ECS tooling and debugging features
Megacity on Mobile
A few developers from Nordeus took on the Megacity demo to show how DOTS and the Lightweight Render Pipeline (LWRP) can help seamlessly scale a PC project down to mobile platforms. The goal was to maintain the graphics complexity of the PC version but run it on mobile devices with a very fast frame rate.
To achieve this, they used LWRP which is coming out of preview in 2019.1. Their takeaway: “When you are working on a game that is supposed to stretch the limits of PCs, and then you decide to port it to mobile later, you usually have to rework large parts of it due to performance limitations of mobile platforms. DOTS enabled us to use the same exact code running gameplay logic and rendering on a PC and seamlessly scale it down to mobile platforms.”
Megacity Soundscape (experimental)
DSPGraph is a new Audio rendering/mixing engine built on top of Unity’s C# Job System. It’s completely extensible in C# and can be used with the Burst Compiler. In Megacity, it powers 100,000 uniquely scattered 3D/spatial sound emitters, including neon signs, air-conditioning fans, and cars, producing a rich, realistic soundscape.
Note that DSPGraph is an internal experimental API that we plan to polish and publish as a Preview package later this year. This will be the foundation of the upcoming Data-Oriented Technology Stack audio system. If you have questions or suggestions about DSPGraph please join the discussion in the official DOTS audio forum thread.
Building the Megacity
Getting Started with the Megacity Demo
In this session, recorded at GDC 2019, Unity Evangelist Mike Geig will give you an introduction to the project and show how we leveraged Unity's "Performance by default" to create a massive game world full of complex objects and simulations.
Megacity at Unite LA: Welcome and Overview
Joachim Ante opened the ECS track at Unite LA 2018 by presenting what he and his team have been working on for the last six months.
Megacity at Unite LA: Building a Living World on a Tiny Budget
A small team constructed a hugely complex, high-fidelity city in less than two months. Martin Vestergaard walks you through the concept, mockup, documentation, production, and polish stages.
Megacity at Unite LA: Graph-Driven Audio in an ECS World
Learn about the new C# job-based audio rendering engine. You’ll get an introduction to this low-level audio renderer and an understanding of the ECS technology that brings large-scale audio to the demo.
Megacity at Unite LA: LOD and Culling Systems That Scale
Mike Acton explains how the team used ECS to display a large environment in the Unite LA Megacity streaming demo.
Megacity at Unite LA: Spline-Based AI Agents
Find out how the traffic simulation in the demo examines the compute kernels and their Burst Compiler-produced code as well as how we developed the spline-based AI agents with ECS.
Megacity at Unite LA: Streaming and Serialization
Learn about entity serialization to and from disk, how we built seamless play-mode streaming and efficient Editor workflow, and what a separate ECS world can do for you.
Megacity at Unite LA: The Evolution of the ECS API
Learn about the past, present and future of ECS. Aria Bonczek, from the Unity Data-Oriented Design team, explains our choices for this powerful API.
ECS designed to power massive game worlds
One of our major goals with Megacity was to show how the Entity Component System is perfect for streaming huge numbers of scene elements.
For example, Megacity contains 4.5M mesh renderers, 5000 dynamic vehicles and 200,000 unique building objects. The vehicles fly on spline-based traffic lanes, never colliding, and there are 100,000 unique audio sources, including neon signs, air-conditioning fans, and cars producing unique sounds to form a rich, realistic audioscape