120 Views
May 09, 18
スライド概要
講演者:Dan Miller(Unity Technologies)
こんな人におすすめ
・プログラマー
受講者が得られる知見
・データ指向に基づいた設計に対する理解
・UnityのECSを使った開発手法に対する理解
・C# Job Systemを使ったマルチスレッド対応コードの書き方
リアルタイム3Dコンテンツを制作・運用するための世界的にリードするプラットフォームである「Unity」の日本国内における販売、サポート、コミュニティ活動、研究開発、教育支援を行っています。ゲーム開発者からアーティスト、建築家、自動車デザイナー、映画製作者など、さまざまなクリエイターがUnityを使い想像力を発揮しています。
Intro to C# Job system and Entity Component System A Dan Miller [email protected] @DanMillerDev
Overview ● Terminology and System overview ● Implementing Jobs and Entities ● Building a demo
C# Job System Multi-thread your code in a safe, accessible and efficient way ● API for scheduling jobs that run on multiple threads as well as linking dependencies ● Provides protection from pitfalls of multi-threaded code by giving easy to understand errors messages for things like dependencies and race conditions
Entity Component System A new way for writing high-performance code by default ● Data-Oriented approach to development that allows you to separate data from the processes that manipulate that data. Entity a lookup index (database key) into the parallel streams Components parallel streams of data, grouped by archetype System code that manipulates data
What is Classic The current Object oriented design pattern, GameObjects and Monobehaviors ● ● Data and processes are coupled together Largely dependant on reference types
Memory Layout - Classic ● ● Data is scattered… Loading from memory to cache is very slow...
Extra information and data ● ● ● Unity components contain extra data when referenced Instantiating is a problem Moving data from Memory to cache is very slow
How data is processed in Classic One at a time, on the main thread
How ECS and the C# Job System are different than classic
Bullet ECS Entity Data Player Enemy Render Render Render Position Position Position Spawning Health Health Spawning Render System Health System Spawning System Filter : Filter : Filter : Render Position Health Render Spawning Some complex parallelized behavior Some complex parallelized behavior Some complex parallelized behavior Render Job Health Job Spawning Job
ECS & C# Job System ● Data is tightly packed in memory ● Data is being processed in parallel ● Only worry about the specific data you want to operate on.
How to get Started Today
Available in 2018.1 ● Change scripting runtime version to use .NET 4.x Equivalent (instead of .NET 3.5) ● Change package manifest to include ECS packages
Demo
Burst Compiler A new LLVM-based math-aware backend Compiler Technology takes C# jobs and produces highly-optimized code.
Additional Resources https://unity3d.com/unity/features/job-system-ECS
Thanks! Dan Miller [email protected] @DanMillerDev