[0.11.3] Latios Framework for ECS megathread

Latios Framework for Unity ECS – [0.11.X]

The Latios Framework is a powerful suite of high-performance low-level APIs and feature-sets for Unity’s ECS which aims to give you back control over your gameplay. If you like the general paradigms, syntax, and workflows of Unity’s ECS, but find Unity’s offerings to be incomplete or frustratingly full of quirky unintuitive details, then this framework may be exactly what you need to achieve your vision.

The Latios Framework does not replace Unity’s ECS, but rather complements it with additional APIs and tools. In some cases, the Latios Framework may override Unity ECS’s underlying mechanisms to provide more features or improve performance. Desktop platforms are supported out-of-the-box. Other platforms may require additional effort (i.e. compiling native plugins) to achieve functionality and performance benefits.

Originally, this framework was for my own personal hobbyist game development, and in a sense, still is. However, after several years of development, it has proven a valuable resource to the Unity ECS community. It is provided here free to use for personal or commercial usage and modification. All modules are licensed under the Unity Companion License. The modules may contain code borrowed from official Unity packages and therefore may be seen as derivative works. Despite this, the Latios Framework contains many adaptations of top-class solutions in the industry (see Third Party Notices) as well as original inventions geared towards Unity’s ECS.

The Latios Framework is best-known in the community for Kinemation, a module which provides extremely high-performance CPU animation and GPU skinned mesh rendering features.

This version targets Entities 1.3.2 with ENTITY_STORE_V1 and a minimum editor version of 2022.3.36f1.

[0.10.x] users, please read the Upgrade Guide!

If you have any experience with DOTS, please take this survey!

Modules

The Latios Framework contains multiple modules, each of which contain public API for your own use. Additionally, each module may contain addons. Addons are community contributed features, and consequently may have different design philosophies or support guarantees as other features. With that said, some addon authors are very active and offer support and reliability that surpasses native features.

Modules and addons are disabled by default and are installed via a custom bootstrap. Bootstrap templates are provided in the Assets Create menu.

Core

Core is an essentials kit for handling common programming concerns in Unity’s ECS. It contains many features you might have heard of such as Rng, Blackboard Entities, Collection Components, Instantiate Command Buffers, Smart Blobbers, Explicit System Ordering, and Baking Bootstraps. But there are many more features around. If there is a common “hard” problem in ECS, there’s a good chance Core has a tool to address it.

Common Reasons to Use:

  • You use one of the other modules
  • You want one of the features

Common Reasons to Avoid:

  • You move a large amount of entities between worlds in the middle of gameplay

QVVS Transforms

QVVS Transforms provide custom transforms systems based on the concept of QVVS transforms, which are vector-based transforms that can represent non-uniform scale without ever creating shear. This module comes with a fully functional custom transform system with automatic baking and systems, offering more features, performance, and determinism than what is shipped with Unity.

If you wish to use Unity Transforms instead, you can enable a compatibility mode for all other modules using the scripting define LATIOS_TRANSFORMS_UNITY. Some features in the other modules will be disabled when you do this.

Common Reasons to Use QVVS Transforms:

  • You want a good transform hierarchy solution

Common Reasons to Use Unity Transforms:

  • You use Unity Physics, Unity Character Controller, or Unity NetCode.

Psyshock

Psyshock Physics is a physics and spatial query module focused on user control. While most physics engines provide out-of-the-box simulation, Psyshock instead provides direct access to the underlying algorithms so that you can craft the perfect physics simulation for your game and not waste any computation on things you don’t need. Psyshock’s Collision Layers can be built directly from Entity Queries, removing all the archetype guesswork out of collisions and triggers.

Common Reasons to Use Psyshock:

  • You use QVVS Transforms
  • You only need collision detection
  • You want more control over physics
  • Unity Physics events system is too expensive

Common Reasons to Use Unity Physics:

  • You want an out-of-the-box full simulator with zero code

Myri

Myri Audio is an out-of-the-box pure ECS audio solution. It features 3D spatialization of both looping and non-looping audio sources, multiple listeners, directional and non-directional sources, and a voice combining feature to support massive amounts of sources at once. Playing audio is as simple as instantiating prefabs.

Common Reasons to Use:

  • You want something simple and easy

Common Reasons to Ignore:

  • You can afford FMOD

Kinemation

Kinemation Animation and Rendering provides authored animation, simulated animation, and everything in between. It includes an overhauled Entities Graphics for significantly improved performance of both skinned and non-skinned entities including true frustum culling and LOD crossfade support. It also provides a comprehensive API for injecting custom effects into ECS rendering.

On the animation side, Kinemation supports bone entity and optimized bone buffer configurations. It includes utilities for inertial blending. And for animation clips it leverages ACL, a powerful high quality animation compression solution used in AAA titles such as Rise of the Tomb Raider, Fortnite, and Valorant.

Common Reasons to Use:

  • You use QVVS Transforms
  • You want better rendering performance and features related to LODs, light probes, and deforming meshes
  • You want to customize and extend ECS rendering with access to the culling logic
  • You prefer code-driven animation workflows and inertial blending
  • You wish to build your own animation visual tool tailored to your project

Common Reasons to Avoid:

  • You absolutely require a robust out-of-the-box code-free skeletal animation solution for only a small number of entities

Calligraphics

Calligraphics is a world-space text rendering module. It uses TextCore fonts and formats text to be rendered via the Kinemation rendering pipeline, complete with custom ECS material property support. The text can be animated with the built-in tweening engine, or you can make your own animations with the glyph mapping API. Rich text tags are supported, with much of the implementation being ported from TextMeshPro and made Burst-compatible. Use Calligraphics for world-space labels, dialog, player names, and damage numbers.

Common Reasons to Use:

  • You use QVVS Transforms
  • You want animated text
  • You are using any other module

Common Reasons to Avoid:

  • TextMeshDOTS works and fully covers your needs

Mimic

Mimic provides behavioral replicas of popular solutions within the Unity ecosystem, rewritten to leverage the features of the other modules and the performance benefits of Unity’s ECS. With Mimic, teams can continue to use familiar and proven authoring tools and workflows while simultaneously being fully invested into Unity ECS and the Latios Framework.

  • Addons
    • Mecanim by Sovogal – Replication of Unity’s Animator Controller state machine with support for blend trees, interrupts, root motion, and events.

Future Modules

  • Unika – A high-performance scripting solution including support for interfaces and coroutines using source generators
  • Life FX – VFX simulations which add immersion to stylized worlds
  • Mach-Axle AI – A utility AI evaluator designed for high throughput
  • Unnamed Networking – Something fast and flexible at scale

Why Use the Latios Framework?

Typically, “frameworks” fall into one of two categories. Either, they are someone’s collection of convenience classes and extension methods, or they define a specific architecture and workflow for describing gameplay code.

While the Latios Framework has some of those things, its primary concerns are at the engine level. Many of its tools and solutions are inspired by GDC presentations, technical blogs, and research papers. A key focus of the framework is to make these advanced technologies usable within a DOTS-based production environment. But another common theme is fixing or providing alternatives for fundamental design issues in the official ECS packages. For technical reasons, it is a “framework”, but the individual APIs act more like a toolkit and stay out of the way. A developer using it should always feel in control. If not, there’s likely an issue worth bringing to attention.

0.5 marked the end of Phase II, where focus was placed on enabling technologies in Unity ECS such as audio and animation. Current Phase III development focuses on modernizing the technology for Entities 1.X and facilitating gameplay design.

Long term, the Latios Framework’s mission is to dramatically reduce the development effort required to make highly artistic 3D games and short films.

Still not convinced? Here’s a video showcasing the performance impacts:

And if you are concerned about all the ways this affects existing ECS workflows, there’s a comprehensive guide detailing the changes here: https://github.com/Dreaming381/Latios-Framework-Documentation/blob/main/What Parts of ECS Does the Latios Framework Change.md

Getting Started

There are three methods to install the framework package (contains all publicly released modules).

  • Clone or submodule this repository into your project’s Packages folder (recommended for contributors or those wanting faster bugfixes and updates)
  • Add package via Package Manager → Add package from git URL
  • Add via OpenUPM

After installing the framework package, follow the instructions in the first section here. You may also want to look through the compatibility guide.

Getting Started pages and documentation are provided with each module.

Learning Resources

Support

New feature releases occur every 4-9 months. Bugfix releases typically occur weekly.

Feel free to reach out here or on Discord for any of the following:

  • You are attempting to use the framework and encounter issues
  • You are considering using the framework and have questions about its features or whether it would be a good fit for your needs
  • You have a feature request (no promises, as I am only one person)
  • You would like to get involved and make things even better
  • You have any feedback (negative or positive)

Enjoy the Latios Framework!

39 Likes

I haven’t gotten around to trying it yet, but the docs look great. Especially the physics FindPairs optimization article was very interesting, it’s rare to find such in-depth articles.

I agree with your notes on Unity Physics and it’s nice to see an alternative for different design purposes (e.g. games that need mutable colliders). But what I think is even more important is that right now there is no other “build your own solution” frameworks for Unity’s ECS (and the ones that are engine agnostic would have interop overhead). Many devs including me want their game to use its own unique ‘non-realistic’ physics, or maybe even don’t have a need for physics simulation and just want to check trigger overlaps, but don’t have the knowledge to build the part that handles the actual queries (with efficient broad/narrowphase algorithms etc). This seems to solve that while still letting games handle the simulation part (gravity, collision responses etc) tailored to the game, which imo is easier to build than efficient broad/narrowphases.

I see a lot of potential here, I hope you’ll keep at it!

1 Like

Thanks for the kind words! I don’t blame you for not having tried it. this first release was a little rushed before the holidays because I mostly wanted to use it as an example to provide feedback to core DOTS and also get some feedback on the general design if I was lucky enough. The next few releases should hopefully make the framework a lot more usable.

To your comment about custom physics, that is totally the goal with this project. Most Unity games don’t need true physics, but often relied on trigger colliders and raycasts to make development simpler. That’s exactly what I am targeting. The reason I don’t comment on it much is because Unity.Physics has an ISimulation interface which allows the simulation aspect to be written custom or just straight-up omitted. I don’t think this solution is nearly as flexible or as intuitive as a library of stateless algorithms and acceleration structures, but it is there.

2 Likes

I haven’t tried Unity.Physics yet but you make an excellent point on your documentation, those are some solid arguments with good explanation on your decisions.
This is something I would use or take some ideas for my projects.
Thanks a lot for putting it together.

1 Like

Hello everyone!

A lot has happened to me since January, much of which has interfered with the release of 0.2.0. I wanted this release out months ago.

A special feature of 0.2.0 is that I had planned to release it alongside a space shooter sample. This sample game would serve both as an example and as a project to ensure a suitable amount of stability in the framework.

I have gotten the game to the point where things feel stable enough to share. So rather than horde my tech until I finish, I have decided to migrate the game to a public repo and attached a preview version of the framework as an embedded package. GitHub - Dreaming381/lsss-wip: Latios Space Shooter Sample - an open Unity DOTS Project using the Latios Framework

Feel free to copy the package or game for your own use cases, or just the snippets you care about.

In addition, if you would like to contribute and help me move on to documentation and version 0.3.0, by all means do so!

10 Likes

Hello again! After 9 months of distractions and well… more distractions…

Latios Framework 0.2.0 is officially released!

Link here

This release is designed to work with Entities 0.14.0 and is significantly more stable. It is currently powering several game projects of mine including this one: Latios Space Shooter Sample

  • Core Features

  • Fluent EntityQuery construction API

  • Collection components with automatic dependency handling (store NativeContainers on entities)

  • Component copying by ComponentType

  • Scene management with entity destruction on scene change

  • Scene and Global scope entities with entity merging capabilities

  • Top down system construction and ordering

  • Hierarchical disabling of systems by custom criteria

  • Custom bootstrap helpers

  • simdFloat3 type (4 packed float3s)

  • Interface-constrained generic job scheduling from generic functions with Burst support in builds

  • Physics Features

  • Multithreaded broadphase with parallel thread-safe event dispatch

  • …Uh yeah… That’s all its really good for at the moment

  • There’s some collider types and queries too, but this is still really early

  • Documentation

  • There is documentation for both Core and Physics

  • There is also an article series I call “Optimization Adventures” which some of you may find informative

If you try it out, please let me know what you think! I want this to eventually become something people can use to kick-start their DOTS projects (especially small game jam projects).

Also, I have yet to decide which features will end up in v0.3.0. You can find a list of features at the bottom of these two pages and let me know which ones you would like to see prioritized:

Feel free to share your thoughts on this thread! You can also PM me if you prefer that. I don’t mind. :smile:

17 Likes

Main things I’d like to see right now are box colliders and collider casts.

1 Like

Oh, just started porting my character controller to use your library instead of Unity.Physics and realized that raycast vs collision layer doesn’t exist yet. Not sure why I thought it did. So I’d like to have that as well.

Still, what’s there worked wonderfully for my animated hitboxes and hurtboxes.

1 Like

Yeah. I’ve been faking the raycast broadphase with capsule colliders. The issue right now is that proper raycasting requires a simd binary search and an inverse walk along the x-axis for negative x directions. Those will take time to get right and are dependent on some other optimizations like sentinels.

I’m waiting to see how badly the next Entities release breaks Core before I lock in for v0.3. But I know that box colliders and some debugging improvements will be coming before the end of this year.

1 Like

I am loving your documentation so much. A lot of these docs would be great blog posts, and it could be easy to host with github pages and Jekyll.

1 Like

Thank you! I’m glad they are useful.

I actually have considered doing a blog with GitHub pages. But I am not exactly sure what advantage that would have over the current format (I am really bad at web design and CSS so that is a factor). I don’t have much of a following, otherwise I would probably stream my dev on weekends. Anyways, are there specific topics you would like me to cover in a more blog-like format?

As a side note, my active development (with the exception of rough prototypes) is still happening in this repo: https://github.com/Dreaming381/lsss-wip
I try to leave relatively detailed commit messages in case people get curious about my progress.

2 Likes

Hey everyone! So I didn’t have to wait very long for the next DOTS to drop.

First off, Latios Framework 0.2.0 is incompatible with Entities 0.16.0. Unity broke ComponentSystemGroup, again. :rage::rage::rage::roll_eyes:

I will be making a patch release this weekend. However, if you are using LatiosFramework 0.2.0 and doing any of the following:

  • Adding or removing systems after bootstrap
  • Running systems inside of InitializationSystemGroup but outside of LatiosSyncPointGroup
  • Reordering or omitting Core systems
  • Doing something I likely wouldn’t expect someone to do with system ordering

Please tell me so I can ensure your needs are met in the patch!

With that out of the way, here’s what’s coming in v0.3:

  • Core

  • Smart Sync Points and specialized command buffers

  • Deprecation of Burst Patcher (no longer required due to some new discoveries about generics)

  • Updates for future DOTS releases (mostly dependent on if unmanaged systems arrive)

  • Physics

  • FindPairs.ScheduleParallelUnsafe

  • Box Colliders (using SAT)

  • Entity aliasing safety checks for FindPairs.ScheduleParallel

  • PhysicsDebug improvements including full job and Burst support

  • Minor CompoundCollider improvements

  • Audio (dependent on unmanaged systems not arriving)

  • Music

  • One shots

  • Looped Effects

  • Spatialization

  • Culling

  • Voice combining

  • Sync point job thread saturation

ETA: Late December 2020

3 Likes

Yeah, that is the issue with any frameworks at this stage of Entities.
It is rather risky using any atm., if not own to be honest.

I’m a bit confused, you’re saying the framework isn’t compatible with Entities 0.16.0, but the most recent version of Entities I can find is 0.14.0, is there something I’m missing?

0.14 is the last one displayed, in package manager. Maybe is visible in Unity 2020 beta. There is info somwhere here on forum as well, that entities version 0.15 is skipped.

I am legitimately confused why you wrote this. There’s obviously a value/risk tradeoff when using other people’s code. I try to mitigate that risk by being open and proactive about communication. And while I don’t think this was your intent, what you wrote slightly comes off as “This thread is stupid”. I’m not asking for an apology or anything. But I am genuinely curious, why did you write this?

Entities 0.16.0-preview.21 dropped yesterday, along with new Collections, Jobs, Hybrid Renderer, DOTS Editor, Data Flow Graph, Animation, and possibly some of their dependencies. The documentation for these are still not up on the website.

I am seeing this in Unity 2020.1.7f1 and 9f1. These versions are apparently compatible with 2020.1 still.

Interesting, I’m seeing the new version of Unity Physics in 2020.2.0b8, but not the new versions of the other packages.

Try replacing the hybrid renderer entry in your manifest.json with this:

"com.unity.rendering.hybrid": "0.10.0-preview.21",

Firstly, I never indicated that your work is useless, or anything like that.
You should be open for a critique as well.
Why you so defencive and wording in such way. Please don’t put such words into my mouth like “this thread is stupid”. It is really not in place.
You can defend your point of view, but please dont be mean to others.

It is open source that’s great.
But the reason I see as risky, because for once DOTS evolves very fast and changes quickly.
For second, if framework stops being developed tomorrow for any reason (nothing new here, happens to many in past), very little can be done, other than trying fixing it on its own.

Anyway, anything is good for learning resources.

Like I said, I did not think it was your intent. But I am letting you know that whether you intended it to or not (in this case, not), that was how some people could perceive it.

I’m 100% open to criticism. But in this case, I’m not exactly sure what you were trying to accomplish. There’s no real action item I can extract. The problems you are presenting are things I am already taking every possible step to mitigate that I can think of. Because of this, the only logical meaning I could extract was that your statement was being dismissive. I wasn’t sure if that was your intent before, and I definitely know it wasn’t now. So hopefully we can agree this was a misunderstanding on both our ends and I will try to find better words when reacting to such situations in the future.

I’m still absolutely baffled as to what your real intent is though.

1 Like