Entity Component Systems

Entity Component  Systems
Slide Note
Embed
Share

Entity Component Systems (ECS) in game development organize data into entities and components, with systems adding functionality. ECS models like Pure and Hybrid offer improved game object organization and performance benefits. Burst compiler in Unity enhances performance by optimizing machine code. Leveraging Unity's Job System allows for writing multithreaded code safely.

  • ECS systems
  • Game development
  • Unity
  • Burst compiler
  • Job System

Uploaded on Feb 19, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Entity Component Systems Gurpartap Aujla

  2. ECS Principles Entity Component Systems (ECS) is a way of organising data predominantly used in games and simulations. Entity Entities or Game objects are any objects in the game you can see or interact with. For example the player, enemies, obstacles, powerups. Components Components are attributes that are assigned to an Entity for example attached to a player Entity you could have a Health, Collision, Transform and Motion component. Systems This is where functionality is added to the Components i.e. using the Motion and transform Components you can make a basic Movement system

  3. Entity Manager Component Managers Collision Manager Health Manager Player (1) Spike Trap (2) (1) (2) (3) (1) Health Pack (3) Transform Manager Motion Manager (1) (2) (3) (1) System Manager System Components Movement Transform + Motion Collison Collison+ Transform

  4. ECS Models Pure vs Hybrid Pure Hybrid Entities are the new Game Objects Includes all the features of Pure ECS There are no more mono Behaviours Includes special helper classes which convert Game Objects into entities and mono behaviours into components. Data is stored in components and Logic in systems Utilizes the new C# job system which gives performance benefits

  5. Burst compiler Burst is a new math-aware compiler developed by Unity. It can produce highly optimized machine code that takes full advantage of the platforms you re compiling for. does this all automatically. All you need to do is add the Burst compiler package to your project. Then make sure your C# jobs are marked with the Burst Compile attribute. Unity will then take your Job system code and compile it into Highly optimised machine code This means writing logic in languages like C++, or even C, can be executed directly on the processor.

  6. Advantages Extremely easy to implement. You don t need to know complex, low-level code. Greatly improves performance even more so coupled with ECS. Burst Compiler is still in preview mode and not ready for production.

  7. Unity Job System The Job System lets you write multithreaded code both easily and safely. It does this by creating jobs instead of threads. A Job represents a unit of work that the system can process as a series of steps. When you schedule a job, the system places it into a special queue. A worker thread will thenpullthe job out of the queue and perform it. Worker threads are individual threads that are managed by the Job system. They complete jobs in the background so they don t interrupt the main thread. All you need to do is place your logic into custom jobs and then schedule them to run. The Job System will handle the rest, executing all of your jobs on separate threads that are managed by Unity.

  8. Why use the Job System The difference is that the developers who created the Unity Job System have gone to great lengths to ensure that their multithreaded code is iron clad. For instance, the Job System will do it s best to avoid context switching by only creating one worker thread per logical CPU core. This allows you to create as many jobs as you want (within reason) without having to worry about how it ll affect the performance of your CPU. The Job System also has a built-in mechanism for guarding against race conditions in the form of job dependencies. For example, if Job A needs to prepare some data for Job B, you can assign it as Job B s dependency. That way Job A will always run first, and Job B will always have the correct data.

  9. Synopsis It allows you to use multithreading in a way that safe, easy, and completely managed by Unity. And when you combine it with Unity ECS and the Burst Compiler, you get extremely performant code that s optimised by straight away.

More Related Content