#archived-dots
1 messages ยท Page 65 of 1
I don't either but it always worries me when builds fail, but I guess I'll also be waiting until the next version instead of putting hacky fixes everywhere...
That's not what I wanted to hear!!
Oh definitely, I hate debugging build issues so I like to catch them early
Has there been any word on when a next version is coming? I'm still really looking forward to having working leak detection again...
I feel like I heard minor in Dec that they were assuming for a minor version end of Jan
If they're sticking with the 3 month plan they were doing last year you can expect a major update end of Feb, first week march
Alright, that doesn't sound too bad
But who knows, I think they got a bit burned in the past committing to dates
Yeah I don't really mind, I'm more interested in the final features than a concrete release date
I'm really just hanging for burst 1.8.3
They finally tracked the corruption that had been plaguing me
Ah, bug fixes ๐
Also something I was wondering, when leak detection is in again, considering it uses the allocator and not the old dipose sentinel solution, wouldn't the system also be able to detect leaks on "unsafe" collections and leaked blob assets?
Potentially
Man I hate how I can't hide preview on mobile
Anyway that was my bug, been destroying my work flow
I'd love that, since I'm always scared of memory leaks that take ages to find ๐
Not sure what in my library is triggering to do much
That really sucks ๐ฆ
I've not been running into that specific issue luckily from what I can tell on the post
But just randomly swaps around an the function pointers
Although I do get infinite waits sometimes which forces me to kill the editor
Starts calling random OnCreate from destroy
Yeah I recall you talking about that a little while ago
Anyway should sleep, have a good day
You too, have a good sleep ๐
How hard was this? I'm only using it for raycasts, so this seems appealing.
What specifically?
Turning off the simulation is just adding a component to the world
but without the system its stuff doesn't stay in sync right?
i'm kinda just guessing, don't really know what the system does ๐
what's the component to disable it? I can probably just test if my stuff still works.
It just turns off the actual physics simulation, the system that builds the physics world still runs.
The PhysicsBody component specifically will stop doing anything useful
The authoring component is called PhysicsStepAuthoring
Ahh, yeah i think I can just disable it then.
I don't use it directly for collisions or movement. I think I just use the mesh
So do you remove the PhysicsStepComponent? or Set the system to be disabled?
hmm. Is there a way to interpret 3 integer pointers as NativeArray?
or do I need to make array of pointers?
I'm confused the docs say a commandbuffer has IsComponentEnabled method yet its not in the VS editor?
it has SetComponentEnabled though ๐
That's odd yeah, I would guess it's a typo. Doesn't make sense that commandBuffer would be reading values.
it does have some read methods though like isCreated, isEmpty
I guess SystemAPI works in a Foreach though
how do I only get enabled components in a foreach query then csharp foreach (var (isAlivevar, localtransf, enty) in SystemAPI.Query<RefRO<isDead>, RefRO<LocalTransform>>().WithAll<ShelfIsleStaticTag>().WithEntityAccess())
These are regarding the state of the buffer. The buffer are changes you can delay to later. So reading a value from it now doesn't make much sense as it might've not even made any changes to what you're trying to read from if it makes sense.
oh yeah that's true
I installed Entities, Entities Graphics, Unity Physics, Netcode for Entities, and something changed in the active URP asset:
~/projects/EcsTutorial master* โ git diff -a Assets/
diff --git a/Assets/Settings/Ultra_PipelineAsset.asset b/Assets/Settings/Ultra_PipelineAsset.asset
index 2401acf..8776b63 100644
--- a/Assets/Settings/Ultra_PipelineAsset.asset
+++ b/Assets/Settings/Ultra_PipelineAsset.asset
@@ -77,7 +77,7 @@ MonoBehaviour:
m_ShadowAtlasResolution: 256
m_VolumeFrameworkUpdateMode: 0
m_Textures:
- blueNoise64LTex: {fileID: 0}
- bayerMatrixTex: {fileID: 0}
+ blueNoise64LTex: {fileID: 2800000, guid: e3d24661c1e055f45a7560c033dbb837, type: 3}
+ bayerMatrixTex: {fileID: 2800000, guid: f9ee4ed84c1d10c49aabb9b210b0fc44, type: 3}
m_ShaderVariantLogLevel: 0
m_ShadowCascades: 0
~/projects/EcsTutorial master* โ
the above does'nt work of mine for some isDead is only enabled on a few and yet it plays over all the entities
Am I supposed to change this in other URP assets too or not
I would assume this is correct by docs.
weird because this happens https://imgur.com/a/qQafVdh
I've checked and only the ones that are hit should have enabled components and yet they all do
yeah I'm pretty sure even though only a few entities are enabled that job runs on all entities
ok neh mind fixed it with collision filters although errors persist like a ton of entities being instantiated that shouldn't be
Hi I'm an Entity
and I'm a Component
We should probably stick to more substantive discussion of ECS here and leave the banter for #497872469911404564 . (I'm the system ๐ )
this is relevant here http://lucasmeijer.com/posts/whats_next_after_burst/
(continued from #๐ปโunity-talk) That's a question best answered by someone much more knowledgeable about programming in general than I am!
Unity developer on their own gameobjects: "We try to mitigate the symptoms as good as we can, but at the end of the day itโs still lipstick on a pig."
I volunteer @tidal wedge or @glacial bolt
Lol
I can't speak for Unity in particular, but just from general programming principles, you put all the data next to each other (roughly) so that cache misses are minimized.
What's a cache miss?
CPU's have cache memory
so you don't have to fetch all recently used things from regular RAM
I haven't touched ECS yet other than a few tutorial videos ๐ณ
it's closer to CPU hence faster, but if the data you ask isn't cached, it'll be cache miss and it has to fetch it from the actual ram
CPU caches are the memory closest to the processor. It fetches stuff into that memory from RAM, in chunks of... is it 64KB? The fetching takes time, so if your data are next to each other, you can do more with that chunk.
That makes perfect sense! Thanks for the explanations!
Also the CPU tries to predict where you'll be looking in a moment and prefetch the memory. And that's easier when you're looking at things that are next to each other.
Ooo, I actually read into this and remember it vaguely, all forms of memory storage, whether its RAM or HDDs or whatever all have a minimum amount of memory that they can read at a time call the minimum block size, this is written to a buffer and is sent out when available
Functions just live in one place for all the objects of a same type (referring to your conjecture earlier).
also worth noting that modern CPU's have multiple levels on their caches
Roughly, obj.foo(a, b) is "actually" Object_foo(obj, a, b), if you see what I mean.
Is that how ECS represents it?
No, programming languages in general.
Not the name, of course, just the principle. The function does not live in the object.
Unless javascript.
The function does not usually live in the object. ๐
I was under the impression that each instance of an object had its own instances of its functions
I thought that sounded excessive
Yeah, that's not the case.
At last I can sleep at night
How does ECS work differently to OOP in that regard then?
Regarding functions, I don't know. I don't know ECS, I just know a bit about making calculations run fast.
So I guess the next question is, what makes ECS different from OOP other than the way objects are represented
And how does the way those objects are represented affect performance and scalability?
Cache locality, almost certainly, probably other things.
If it knows it'll have to call x.f() on 10k x's, for instance, it can do them all in a batch, in the order that they appear in memory.
How does it know?
well okay then
@tidal wedge thank you so much, I need to sleep but that link is really helpful
As well as you clearing up a few of my misconceptions
๐
so to have five objects would mean to have five instances of the same function this is not true @ashen plaza
the main difference between C# objects in memory, and ECS memory management is arrangement
The Garbage Collector not only collects garbage, but can also rearrange objects in memory
so there is no guaranteed linear layout with regular C# objects
the reason we want linear memory layout is, well, because CPUs love it when things are linear and predictable
far fewer cache misses can happen, and that can dramatically increase performance
among other things
a struct is still an object in C#. It needs to be separated talking about the difference between classes and structs, not objects and "ECS memory management". A struct is still a regular C# object, and can be guaranteed a specified layout.
its important to note that the GC will not rearrange structs (but could definitely rearrange classes containing structs, and still GC'ing them because they are then on the heap), hence why you need to be ValueTypes all the way down.
GC can only rearrange boxed structs
because those are essentially reference types while they are boxed
and yeah they can exist in classes
but otherwise they will be on the stack, which is not touched by GC
Every time I go to use string related types in ECS: 
I actually never tried ECS, thought that the pure version was really early in development.
I do want to ask if there are performance advantages of hybrid ECS compared to vanilla scripting
What do you mean by "Hybrid ECS" ?
Unity's ECS has a hybrid version that uses GameObjects as Entities and partially retains the Object-Oriented nature
Oh I didn't knew that ๐ฎ
Scenario: Cubes orbiting in around a central point.
With Gameobjects: 8k cubes ~ 60fps
With Gameobjects for rendering ECS for logic: ~30k cubes 60fps
With Entities (pure): 200k ~60fps
I sadly dont have images for the base or hybrid. Just the pure
So while there are performance gains to be had in hybrid( by over double in many cases, pure is still FANTASTICALLY better in most cases ๐
The current blockage for me for fully utilizing it at the moment in a pure environment, is I require string support in components for entities heavily, and partially the lack of material property block like rendering in pure
Thank you
I have a question about the state of the ECS/Job system.
would you be confident to use any of these in a small game (production ready) by maintaining the same unity versions and package number, or even by using some of the newer unity versions, like 2018.3.
or do you think it is too changing/unstable to yet be used,
even if it is not, the api seems to change.
pure ecs still seems to lack a lot of features, especially for rendering, a hybrid approach seems to work well.
Last time I tried ECS/Jobs was in June, seems like something changed but not that much.
I wonder if someone has used ECS/Jobs in a production game yet that was released and if there were any problems with it on some platforms?
Here you can read a pretty good thread about using it on production Unity ECS and Job System in production https://forum.unity.com/threads/unity-ecs-and-job-system-in-production.561229/
How would you guys go about hiding a Entity from a canvas, i'm using the new inspector alongside unity tiny
Currently adding a "Disabled" component, but i haven't found out how to just "turn it off" the same way you it off in the inspector
Hi everyone, quick question. We have a client project that had some basic ECS in it (entities moving around a spline) which now has to be ported to both webVR and mobile (APK). Does ECS work on those platforms?
one would expect so, afaik it's not really platform tied thing like Burst compiler is for example. Unity has demonstrated ECS on iOS a lot so it definitely runs on some mobiles
don't quote me on that tho ๐
Okay thanks! I guess we'll just have to do a test. ๐
Has anyone found a better way to reliably resolve "Recursive type definition detected" without just closing and reopening the editor. That solution scares me.
came across this on the forums: https://rams3s.github.io/blog/2019-01-09-ecs-deep-dive/
great stuff
I need to experiment with ECS outside of unity first to use it with unity so that I donโt pick up habits or misconceptions about how ECS works
That makes no sense :)
You could just learn some wonky things about some other ECS lib then
@dull copper Thats why I intend to write my own >:D
^ Not difficult to do (well for a simple one anyway, multithreading and millions of entities is another story ๐) and teaches you a ton about how it works and how to use it
Hey guys, I have a doubt right now: is an IJobProcessComponentDataWithEntity guaranteed to execute once and only once for every entity matching the group per frame (if executed from a system) ? I have a weird bug that makes me think that some of my entity get updated less often than others...
That is certainly the intent, yes. If you can demonstrate that that isn't happening, that would be a very serious bug indeed & we would love to hear about it.
another pick from the forums: https://www.bovinelabs.com/ecs-hello-world/
(keep posting any ECS tutes you find! I'm just lurking, and trying to learn it)
I'm on the same boat really
I've mainly fiddled with others ECS code (I can update their code to newer ECS API etc just fine) but still wrapping my head around on how I really should organize my own code with ECS
yeah, I wanna know how it's effecting audio mostly. These new hybrid components that are in the mega city demo, and how it intergrates with new DSP thing
ah, yeah, that'll take some time to arrive still
i think I'm still gonna be doing lots of hybrid components. But maybe the main audio manager will be ECS heavy
yeah, but audio peeps gotta hustle haha.
it's still one of the things that's coming "next"
I'm on the boat on people waiting for their 3d physics implementation...
and that's not even announced to come on any roadmap...
there's a few audio bits an bobs in the released alpha. So, a bit of things to play with
I can make simple 3d physics engine myself if needed, but I really hate reinventing the wheel
it's just so time consuming
ah, I actually didn't spot the audio api things on 2019.1
but then again those aren't really the things I've been looking at changelogs etc
holy crap. I just started looking into Unity ECS. Is this new? The way this works is fundamentally the same as the first iteration of my custom game engine before I changed it to use a gameobject/behaviour system.
it's relatively new, it's not fully ready yet but Unity has been working on this stuff for several years internally already
have you seen Unite talks about this?
I think I might have had my version of this system several years ago. My timeline is fuzzy. I'm really curious now.
this is really cool thing
especially when you couple it with their job system and burst
most c++ devs can't even write this efficient code
Joachim Ante opens the ECS track by presenting what he and his team have been working on for the last 6 months. More info: https://on.unity.com/2Q5KxR1 Joach...
that's the playlist from last Unite from last October
at least that intro video is worth checking out as it tells about the current state of things
I implemented mine in June 2014. To see this happen in Unity after I went out of my way to copy Unity and ditch that design makes me feel odd.
I literally had the same setup. Entities, systems, components. components were just data. systems would do all the work...
Now I feel like I should rewrite my current unity project to try this out
check also these recent blog posts:
http://lucasmeijer.com/posts/cpp_unity/
http://lucasmeijer.com/posts/whats_next_after_burst/
they explain this all really well, like what's Unity's intention on these
ECS is covered on the latter post
ok, ECS isn't covered that extensively on those but still worth reading ๐
It was a big decision for me to switch design in my engine, so I actually started a new one from scratch and have 2 engines. The main difference from my perspective is that there are far less function calls being made with ECS since you can have a single loop in the system replace many separate update() calls
I wish I could see the underlying code they're using to make it all work. One of the reasons I wasn't satisfied with that approach is because I couldn't find a way to handle components in a generic fashion without using void pointers everywhere. Since they were just data and had no functionality to speak of, polymorphism didn't have any relevance. I could have used something like json, but then I would have sacrificed performance pretty heavily.
all ECS source code is in the entities package you load with package manger
it's all in c#
some sample projects here https://github.com/Unity-Technologies/EntityComponentSystemSamples
I'd assume the job system has c++ component to it (I could be mistaken), Burst itself is Unity's own proprietary c#->native compiler, ECS itself is fully written in C#
burst basically requires you to use their job system and preferably unity's new math lib to get best gains from it
Their job system reminds me of an in-house software solution at my last job where different services could register tasks that they needed to be done and then agents could select tasks based on their own capabilities and execute them.
I didn't even realize c# bools are not blittable types
which is kinda weird since I've done work on native code wrapping in past, I guess I never needed to pass those
Hello guys! Can someone give me a hint on how to use the MeshInstanceRendererComponent with culling correctly? I have a basic setup, but the whole editor crashes on rendering, so I assume I do something wrong. I basically just create a bunch of entities with Position and Rotation components and a shared MeshInstanceRenderer component. All in pure ECS so far. But as soon as I try to play in editor, the whole editor just crashes away (from the logs it looks like it happens on rendering). Anyone with the same problem or a solution? Thanks!
@sharp nacelle no idea on that, can you show some code or make simple repro?
as another note
some of this makes my head hurt
like that you can actually do this
mousePos = mousePos,```
that's just C#
in that the first var is different from the next one
it makes some code really less readable
if you do use the same variable name for different scope that is
I'd just use different variable name to avoid cases like this
it being in a constructor means it can't mean anything else, but I can definitely see how it might be confusing
when teaching code it's hard to explain why you might choose to name a variable the same name as the class (but with differing capitalisation) and explain that one's a Type and one's just a variable name
I'll probably get used to it, just feels weird right now
I'm more used to how these things work in c++, where things are way more strict
and yeah, you are right, that's c#, I actually didn't know you can do this ๐
now I feel stupid ๐
but anyway, this actually helps me understand a lot of things now on ECS code better, so thanks @solar spire
@dull copper it's really quite simple. I have a big array of 3D tiles that I generate procedurally and create an entity for each of the tiles in a big loop. Did that without entities perfectly, replaced them with entities and it worked for a bit and is now suddenly crashing after (I presume) an update to the ECS system. Code snippet is basically this for each entity:
meshRenderer = new MeshInstanceRenderer()
{
mesh = mesh,
material = material,
castShadows = ShadowCastingMode.On,
receiveShadows = true,
subMesh = 0
};
Entity tile = entityManager.CreateEntity(_tileArchetype);
entityManager.SetComponentData(tile, new Position { Value = pos});
entityManager.SetComponentData(tile, new Rotation { Value = rot});
entityManager.AddSharedComponentData(tile, meshRenderer);
The only difference to the TwinShooter example is that I create the MeshInstanceRenderer from scratch and pass the mesh data to it, instead of copying it from a prefab.
(CSharp is how you get highlighting)
cs works too
well not much to highlight ๐
heh
@sharp nacelle stupid question but is your material set to support gpu instancing?
I'd still expect some error rather than crash
I create around 30k entities, so it's not even much compared to what some other people did already.
I set all materials I use to use instancing, yes. hm but I also use LWRP materials, could the problem lie in that? Maybe the update or whatever broke the compatibility?
I've few times had some cache not getting updated properly when updating packages, had to wipe the Library folder to fix that (I know things can be wiped separately inside of it but unless you have tons of assets to imports it's just easier to wipe the whole folder)
I think I did a Reimport All a few days ago when it first started, but I can also try to wipe the whole folder manually and do a reimport all afterwards. will let you know if something changed ๐ thanks so far
hm no. still crashing. I guess I wait for the next entities package update or next unity release. rarely ever had editor crashes like that, so I hope they will fix it. submitted a bug report, let's see.
thanks for the help ๐
you can still try different entities versions too I guess, I don't know anything, just throwing things out there ๐
but yeah
if it's hard crash, it would look like issue on Unity side
you could try it on 2019.1 alpha too, just for testing purposes
Hm right. Well I updated a lot of stuff before it stopped working. I will just try around a bit more. But well that happens if you use basically all experimental features available ๐
Oh I am on the alphas
I think it worked on a12, broke around a13 and also doesn't work anymore on 2018 for some reason.
ah, same
I'll drop a note if anything like that happens for me ๐
I think Unitys examples still work on a13
Yeah much appreciated ๐
and yeah, these kinds of things are kinda pain to debug when things break outside of your own code, on other engines you could still get full callstack for the crash
Unity you get the full callstack
yeah
Well I have a callstack in the log, that's why I know it's the renderer. It's still in code I can't debug, so I don't know how to continue
AppData\Local\Unity\Editor\Editor.log almost always has the full callstack
only when things go really wrong does it fail
I guess that makes sense, not that often you have to examine hard crashes
I know the log file, I've looked at it for other warnings sometimes
well, now my a13 project crashed to desktop when I hit play ๐
mine crashed once because of Enlighten earlier
so.. ```========== OUTPUTTING STACK TRACE ==================
0x00007FF627B339B0 (Unity) ScriptableBatchRenderer::AllocAndFillBuiltinInstancedData
0x00007FF6268BFBFB (Unity) CreateInstancedMeshIntermediateRenderer
0x00007FF62792C42B (Unity) GraphicsScripting::DrawMeshInstanced
0x00007FF6282931F6 (Unity) Graphics_CUSTOM_Internal_DrawMeshInstance```
that's yours
mine ```========== OUTPUTTING STACK TRACE ==================
0x00007FF6E2B77734 (Unity) TransferField_NonArray<StreamedBinaryWrite,Converter_String>
0x00007FF6E05D2B17 (Unity) ExecuteSerializationCommands<GenerateTypeTreeTransfer>
0x00007FF6E2B7DADC (Unity) StreamedBinaryWrite::TransferSTLStyleArray<ArrayOfManagedObjectsTransferer>
0x00007FF6E2B92F95 (Unity) Transfer_ManagedObject<StreamedBinaryWrite,1>
0x00007FF6E2B7559D (Unity) TransferField_LinearCollection<ReportScriptingObjectsTransfer>
0x00007FF6E05D2B17 (Unity) ExecuteSerializationCommands<GenerateTypeTreeTransfer>```
doesn't seem to be related at all
also my crash isn't reproducible, I can now hit play and it doesn't crash
but I think I had some other random crash on entering the play mode the other day as well, only happened lately so mine could be just some other alpha bug
it's almost as if iLoofou's crash could be coming from a selected Camera or something seeing as UIElements are being called. Defininitely from some editor GUI. Either way, bug report was the correct way to solve this ๐
sure, bug reports are great if you can make simple repro project
i have a large multidimensional array with classes in it, and as an exercise converting it to structs and hopefully to ECS and comparing the differences. But i wanted to check my understanding of the issue here with classes - an array of classes would end up in memory as an array of pointers to each class, so every time the data is accessed it has go through a level of indirection following the pointer, then also where the pointer goes to could be all over the place in memory making it slower again. Is that right?
To make things go to a Job or ECS storage space you want them to be in IComponentData . Unity will produce a runtime error if you putโฆ
post mentions that there used to be blittable bool1 and then text: PS. They are removing bool1 and making bool blittable! Soon!
but all I see now on current packages that they removed bool1 and bool is still not blittable ๐
why would they do that
(remove the workaround before it works without it)
manually copy/pasting the old bool1 struct into project still seems to work fine on latest packages: https://raw.githubusercontent.com/Unity-Technologies/Unity.Mathematics/0.0.12-preview.2/src/Unity.Mathematics/bool1.cs
I actually gravedug this thread about it :p https://forum.unity.com/threads/bool1-gone-in-preview-4.532814/
peers at the horrific almost-necro and approves
I try to do that only in places where it makes more sense than making a completely new thread
I'm just teasing, honestly I'm necro-friendly providing its relevant and it is ๐
yeah, you answered to me some year old question recently ๐
whistles innocently
The only time necroing a post really is a problem/obnoxious is when it is either non-related to the actual post, or just to "bump" it ๐
mine was pretty pure bump ๐
๐
but it's still technically possible their plan has changed so...
Not gonna lie. I have been tempted to do that with my string thread from last march 
I think Joachim mentioned strings as example on last Unite LA's ECS talk ๐
Yeah
I'm still bit worried about the new ECS editor
I've tested tiny, so I know what their plan somewhat is
that editor looks amazing
like, it's the same old experience, just on ECS land
Olento ๐ : https://twitter.com/Soaryn117/status/1081921457511428102
Some days... I go to the @unity3d forums and refresh the Entity Component System forum in hopes to see that string support finished.
When I see nothing has changed, I go back to my favorite part of Unite LA where Joachim Ante even laughs about it :D
heh
yeh i've made my own bool1 that uses a byte backing field
The video links perfectly to when Joachim points out Andres
i don't need to use it too often anyways so
I actually remember the place really well, it's not so long since I last watched that talk ๐
๐
anyway, the main concern I have about ECS editor thing is that it seems like they are going for Pure ECS only with it
and there's only like fraction of engine that works that side atm
I'd love some hybrid workaround even on that new editor but seems like those are not something we'll get
My fear with a hybrid addition to that as a temp work around for the main system: that it wouldnt be temporary
I dunno, it's not all that great
but it's pretty mandatory until we can work around it
but yeah, I can see your concern
If you need rigid body physics, perhaps, but there is a forum post that had promise for a user generated physics temp library
physics is one of my main concerns
Usually is a big one
Graphics, I think with material property blocks in ecs that would fill in a big hole
that ECSPhysics thing is still just a shell of a full thing and the guy working on it hasn't had time to update the project in ages
material propertyblock like*
I've actually updated it to run on recent Unity versions and latest ECS etc packages and turned it into package manager format
OOoh nice
but there are lots of issues on developing it forward
it's heavily based on those injections atm
so it would need to be ultimately rewritten
Yeah, I could see how that would be a problem XD
and it's still missing most of the actual physics integration kind of thing
I can do those just fine, I've done that kind of stuff a lot in past on other engines
but in my case, I'd probably be faster if I started it from scratch ultimately ๐
Potentially
and I've reinvented the wheel on core physics way too many times already, I don't really want to ๐
physics is still not a show stopper
I can not blame you. Even basic physics is a slight pain to redo
I've already used my own bullet wrapper on Unity
it's not really tied into gameobject workflow in any way
Nah you can do quite a bit without physics, it is just a nice additive in a long run
If doing a shooter, something's you'd like to have prebuilt systems
well, I'm working on a racing game so I really need solid physics ๐
it's the core of it all
Pssssh just a single plane of movement ๐
And then make the cars never need ground
Mega city style ๐
talking of megacity
I'm pretty sure it was scripted all along, despite Joachim using the gamepad ๐
or alternatively they've done just some spline follow things for it
as they most likely didn't have any physics collisions for it there, so if it was true free fly mode, he could have flown through buildings
Mmmm I have had in the past a controller for player input with a nav mesh pointer, but even then I doubt they scripted it much
Only one really would be scripted movement would be the mobile
They did not have physics in it no
mobile was fully scripted for sure
I remember someone mentioning that in one of the break downs
Think it was the ai pathing
However, as I mentioned, if they have a nav volume per se, you wouldnt need physics to disallow movement into a building
just no ability to head that direction
but afaik they have no such thing on ECS side
To be honest, I don't really know what all was "done" for that. Since they had Audio, AI pathing (spline movement really) LOD rendering, and a few others
of course MC could have have all kinds of WIP tech they just didn't mention about
on some talk they said they reused occlusion probes for it
but when I asked about it on the forums (mainly wanted to know if occlusion probes got any updates on MegaCity pass) I got reply that they didn't use them at all there
It has no collisions and the vehicle controller is quite unwieldy, but I could see him flying manually had he been working on it for so long
But it does have a flythrough option
AFAIK the creative team behind the MC demo indicated that they'd be talking a lot more about each of those processes as 2019 moves along
So I'm interested in the whole lod thing myself. I don't want to lift a finger for a completely optimal hierarchical lodded level.
And when you consider the nature of the problem and the solution, it's extremely possible providing you feed the right problems in
obviously we dont need dynamic or grass stuff in the same optimisation step
Currently, I have built my own prefab system (abstract class scriptable object) and this is really shallow with OOP so a good fit for plugging into ECS already.
so..
when you use hybrid and game object entity
and you place "position component", "rotation component" and "copy transform from game object component", only position updates in the inspector when you change the gameobject transform
why the rotation doesn't change?
I mean, this is so stupidly simple thing you'd expect it to always work ๐
I mean the regular scene view inspector on the traditional editor now, this thing
I think it's just some inspector bug
it does update live when I look at the inspector from entity debuggers entity selection
and after I return to regular gameobject inspector, it does show the updated value, it just doesn't change that live, it only refreshes the value when I jump through entity/gameobject inspector
anyway, it's not a big issue, just noticed it now
should probably file bug report unless it's some known issue
@dull copper Yeah, there was a bug where quaternions weren't updating properly in the Inspector. A fix was pushed for the next update (https://github.com/Unity-Technologies/Unity.Mathematics/pull/44). Thanks for reporting!
heh, that wasn't really proper report but nice that it's getting fixed ๐
I'm still wrapping my head around ECS basics, I've fiddled with the samples and upgraded a lot of small community projects from one ECS version to another but now trying to write some stuff from scratch
What sorts of obstacles are you running into?
it doesn't make things any easier that every place say don't use [Inject] anymore but almost every example does ๐
whats wrong with Inject
they say it's going away
I understand that chunk iteration is the way to go for performance, but still
ah
thats surprising tbh, Injection is used for more than just injecting components
anyway, this thread is pretty much exactly what I'm trying to figure out atm https://forum.unity.com/threads/entity-hierarchy-architecture.525810/
like, you can inject other systems and such too
I have a car with many complex systems that chain into others
I can put many of them as components but there has to be separate entities for some
wheels are good example
so to make this all work, I need to pass data from entity to other entity and in that thread Joachim said you should prefer ComponentDataFromEntity
there's a sample snippet that's based on Inject but I've found small info here and there how I could avoid it
but this is really messing up with my brain as I'd probably need to understand the previous workflow first to understand how to solve it now
there's no complete example anywhere that would do it now like people recommend using current ECS
there are like ton of examples with simple cube rotating without dependencies and bunch with injections
and then I'm also doing hybrid right now which brings it's own differences to most sample codes out there ๐
afaik the best resource on comparing the current three workflows is just the ol two stick shooter project
https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/Samples/Assets/TwoStickShooter
yeah, I've been looking at that
I really grasp the basics on what the differences are in theory, I've probably watched all Unity's ECS talks from last years both Unite's and bunch of other things, but they cover mainly the theory and not really give that clear samples how you'd build about anything more complicated
but then again, this is still very much WIP system and in preview so one can't really expect that extensive tutorials on it yet ๐
yeah thats the main problem that a lot of people have with ECS right now
anyway, I'll just dial down the complexity a bit and try to get something simpler to work now
its ridiculously hard to make anything more than single feature tech demos
I really need to figure the right structure to get these dependencies between entities nicely chained in the relevant jobs
how you mean?
Jobs system should take care of that for you
just have the proper [UpdateBefore] [UpdateAfter] data on your systems
yes, as soon as I feed the data in right ๐
oh theres also [UpdateInGroup]
you can pass in ECS Systems, and also stuff from UnityEngine.Experimental.PlayerLoop
like for example UnityEngine.Experimental.PlayerLoop.FixedUpdate.PlayerBehaviourSomethingSomething
ah, I didn't mean like that
I'm aware of the 2018.1 playerloop thing
my main issue to solve right now is how I get the entities to get the data from specific entities and how to fetch them, this is probably pretty basic when you get it running once
for example for my wheels to do anything, they need info from my differential that feeds the force from transmission, clutch and engine
Injection, which includes the InjectAttribute and also IJobProcessComponents
the info comes from specific entities, so I need to have a way to pass the data from jobs into right components (which exist in separate entities)
ah ok I see what you mean
if these all were individually decoupled things, it would be rather trivial
yeah, thats when ECS really shines
The TwoStickShooter has actually been deprecated internally; it relies on some features we're either deprecating or have since improved upon. Some new samples are in the works that are more up-to-date on this front.
I'm actually more interested on when ECS will go to github
I'm not directly involved in the package release process, so no news there from me I'm afraid.
aww
but even if he was, he probably couldn't tell us :p
yeah lol
while we may not get any juicy leaks here, I do love the presence of Unity staff here
sometimes staff can have way better answers than people who guess the intent of some systems here
EDIT: this is wrong; see my later post for a correction.
As far as "[getting] these dependencies between entities nicely chained in the relevant jobs", I don't think [UpdateBefore] and [UpdateAfter] directly affect those dependencies; if we're talking about component data, those dependencies are all implicit based on which systems are reading and writing each component. The attributes only affect the order in which systems are updated on the main thread, not the execution order of (or dependencies between) the jobs scheduled by those systems.
users can only tell what they see and read, they don't know the design related things like why some things were make like they were etc
yeah, the execution order is actually another issue
I may still need that but that's not the core issue I'm trying to solve right now
oh really? i was under the impression that Jobs used those attributes to catch race conditions
along with [ReadOnly] and such
yeah, but order isn't the issue now
passing data into and from right components is
of course I need very specific order for these as well but that's not what I try to solve yet ๐
(I'm aware of the ordering tags as well)
EDIT: this is wrong; see my later post for a correction.
@merry oasis yeah, that's a common misconception. I made it myself about a month or two ago. [ReadOnly] is used for dependency purposes, but I'm pretty sure [UpdateBefore/After] are not.
but I defer to somebody who's been at the company for more than 4 months.
Let me go consult an expert before I muddy the waters even further.
haha alrighty
I'll go back to basics anyway, it's always easier to understand things bit by bit..
I also checked the example Joachim linked to the forums but I don't think that approach can be applied in my case at all
in that verlet chain sample, constraints were iterated one after another, there wasn't really dependency on different type of components (that depend on specific other components)
so it's fundamentally different issue to solve
Okay, final verdict: UpdateBefore and UpdateAfter do establish dependencies between the jobs they schedule; the JobHandle returned by the updated-before system will be included in the inputDeps of the updated-after system, and any jobs scheduled in updated-after will take into account the reads/writes of jobs scheduled by updated-before systems. There was a very small corner case I ran into where that's not strictly true, and I overgeneralized.
thanks for checking it out ๐
ah nice
I'll take a short break and then start doing tests on different ways of injecting and passing data
ok just threw this together, but this is one way to do what I think you are asking
http://hatebin.com/swdywgklif
just a note ComponentDataFromEntity can be used in Jobs, I just didn't for this example because lazy ๐
and ofc you can be a lot more indepth with this, like maybe applying inefficiencies and stuff
@dull copper I definitely agree that most ECS samples right now focus on the embarrassingly-parallel "map" case, where you're just iterating over a large array of entities, applying some operation to each, independently of all the others. There are plenty of cases where that approach isn't possible, where you're iterating over 2+ sets of entities at different frequencies -- a simple example pops up in TwoStickShooter, where a bunch of enemy entities all need to aim/fire at a single player entity. That sort of operation is possible to express in the current implementation, but it's definitely not as elegant or straightforward as we'd like.
@merry oasis thanks, I'll try to decipher that
haha
I still try to figure out how to get rid of those injections tho ๐
oh
I'm probably too stubborn about it but I don't really want to learn systems that will go away
ok to finish what I was saying above
3 main ways to iterate over entities
first is Injection, which includes InjectAttribute and IJobProcessComponents
second is Component Groups, which is not directly possible in Jobs
https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/master/Documentation/reference/component_group.md
and Chunk Iteration is about as low level as you can go
Component Groups is useful for sorting through ISharedComponentData stuff
and once you have separated that data between unique instances, you can then throw that into Jobs, I think the rendering system does this in order to fill NativeArrays with Matrix4x4s
I'm actually looking to do most of the processing using IJobProcessComponentData
but I need the refs in somehow before I can do that
oh yeah well thats basically Injection without the InjectAttribute ๐
I think you should still be able to do that without injections
but of course I can be mistaken here
If understand the problem correctly, you a entity with two "child" entities, and you want to do some processing on the parent and then communicate the results to the children somehow?
I don't really care if it does injections internally ๐ it's been said that approach still will stay on final ECS most likely
yes, as simplified example yes
I still don't see anything wrong with just using regular [Inject] tbh
but it's not really even about the entities themselves
but connecting specific components at some level
If so, I agree with what Joachim said in the forums; add a component to the parent Entity that itself contains two Entities (one for each child)
yeah, that's what I understood ๐
the latter part I didn't as I don't think it applies here
and then use IJobProcessComponentDataWithEntity to iterate over the parent entities
oh right I forgot about that one
I was just about to say I don't think IJobProcessComponentData allows easy access to the Entities
actually hmm, do you even need the WithEntity variant? No, I guess not
but yeah that was added a bit back lol
I thought the WithEntity thing was for getting the data without setting it explicitly like in his first sample
the example snippet he posted is this https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/master/Samples/Assets/GameCode/Samples.Common/SimpleMovement/PositionConstraintSystem.cs#L24
but from there you include the component with the child Entities in the IJobProcessComponentData parameters, and use an EntityCommandBuffer to set the value of components on the children to whatever you'd like to pass from the parents
oh man, I need also coffee ๐
but I'm sure this all will make perfect sense in no time!
...and the EntityCommandBuffer would require the jobIndex, which you get with the IJobProcessComponentDataWithEntity variant, so that's why I was subconsciously suggesting it
I used to think myself as swift learner but this is something else ๐
This is all evolving very rapidly. The hazards of working with preview packages ๐
yeah, I still remember when I learned functional programming
I know that I only need to understand few specific things here and it'll "click". I understand many individual systems already
stuff like this is when I wish C# was more like Rust
but yeah, I'll keep doing things until it makes sense, that's what I always do ๐
Im currently trying to program an ECS library in Rust and was wondering what you guys look for in an ECS library
yes
Thanks, I'll take this into consideration 
Depends on your use case I'd guess. "High performance" and "easy to learn + fast to write" tend to be at odds with each other
Okay here's my take on how to communicate data from parent entities to child entities without injection (yes, it still injects a BarrierSystem; that's because the mechanism to avoid that injection isn't checked in yet, sssssshhhhhhh :)
https://gist.github.com/cdwfs/99535cc37ecae5d6e9743eb46fbb7638
oh cool, I'll definitely try that. thank you ๐
also I read about the barrier thing on the forums
some user had made a workaround for that I think
And as I said this is a very common operation that needs to be vastly streamlined, but that's how it's currently expressible.
The problem with not injecting the barrier (and instead retrieving a reference to it with World.GetOrCreateManager<ParentChildBarrier>()) is that there's currently no way to tell the barrier to wait until the parent system's jobs are complete before playing back the command buffer contents. injected barrier systems handle that automatically behind the scenes.
...and this approach wouldn't really scale if each engine were driving, like, 100 wheels. Silly example.
I'm not really looking at doing mass simulations at this, even traditional OOP is fine and never have issues on perf when doing things traditionally, but I'm experimenting now with ECS and job system (Burst of course included) in hopes I could multiply certain iterations on the simulations by multiple factors
job system + burst would give me what I want but to get things jobified, I'd still need to rearrange my whole data anyway so I thought it would be probably good idea to give ECS a try at the same time
downside of all this is that my iterations will depend heavily on the previous iterations results so I can't really massively run things in parallel but even being able to process things for up to 30 cars for each simulation step (so mainly looking at 120 wheels since expensive math is in the tire model) should still get nice gains from Burst + Jobs (I honestly don't expect ECS itself to help on perf at this scale that much but it can't hurt)
I of course agree that this would be a good idea
I decided to take a look into rendering sprites with ECS. The current solution everyone points to is this one:
https://github.com/paullj/unity-ecs-instanced-sprite-renderer
The problem I have with this is that currently I create literally 1000s of SpriteRenderers in all of my games. All attached to a GameObject. I animate them using my own scripts because we found that adding Animators to all these objects was incredibly slow (we were doing development on Switch) - Iโm very serious when I say that completely stripping out Animator for suboptimal sprite-swapping scripts doubled our framerate.
I just donโt know where to begin with this instanced SpriteRenderer to achieve the same result. We could clearly do better than 1000s of GameObject-SpriteRenderers, but I donโt know weโd go about animating them.
Does anyone know if Unity have any intention of providing 2D rendering support with ECS or is it just on the programmer to hack something together that looks like it only works for a specific use?
Animator is for heavier tasks where you will want blending etc, while Animation will run a lot quicker (wish they would rename the legacy animation component to something less confusing and conflict-y)
else roll own
The nice thing about SpriteRenderer is that changing the "sprite" property seems fairly cheap. With ECS we're going to want to feed it the same data. Arrays of Sprite references.
Ideally one could batch this as an ECS system, and then we'd have a nice flood of simple sprites with swappable textures.
Sprite renderer seems to be the bottleneck itself when you go for big numbers, I'd look at baking a mesh of quads and seeing how to unpack them in the shader, possibly a compute shader I guess
When I started playing around with ECS I did this SpriteSheet animator system. I did exactly what you said, using hybrid and changing the SpriteRenderer sprite based on the frame.
I remember having a video somewhere of it running 5k entities (using the same sprite) at different frame rates. I'll see if I can find it.
Then I moved to using the quad mesh instead, I got better performance with that approach. You can see some of the discussion here on this thread https://forum.unity.com/threads/questions-for-implementing-ecs-and-jobs-into-game.577123/#post-3857386
Canโt really follow anything going on in that thread. It basically looks like it wants a sprite sheet animation which is not how our artists work. The other problem with using a sheet is that any discrepancy in position leads to adjacent sprites on the sheet bleeding through.
I also take issue with 1000s of the same sprite. Thatโs not representative of the type of draw calls Iโm going to get with multiple pixel art sprites with alpha transparency.
Iโm struggling here because Iโve taken the few components I need from Unity to get the job done and Iโm sort of okay. But to get ECS working Iโd end up sinking months into bespoke rendering which could fail on a number of platforms.
ECS package update ! Is there any changelog ? I can't find anyone
i'm having an issue with slice and jobs, getting the error : InvalidOperationException: The writable NativeArray TimeStructNativeArrayJob.Flag is the same NativeArray as TimeStructNativeArrayJob.X, two NativeArrays may not be the same (aliasing). Must be something obvious im missing ๐ฆ
_nativeArrayJob = new TimeStructNativeArrayJob
{
X = slice.SliceWithStride<float>(0),
Y = slice.SliceWithStride<float>(4),
Z = slice.SliceWithStride<float>(8),
Flag = slice.SliceWithStride<int>(12),
};
_nativeArrayJobHandle = _nativeArrayJob.Schedule(_nArray.Length, 64);```
{
public Vector3 Position;
public int Flags;
}```
is the exception saying the X slice is the same offset each row as Flag? struct size is 16 so the 12 should be fine. /confused
mmm okay, it appears you can only have these slices on the same NativeArray if they are set to [ReadOnly] ?
Hm, i have a burst update, but not ecs (Entities).
how would i go about timing a scheduled job?
"Timing"? Can you give an example what you want to do?
@sleek ember I can check the changes later on, this only on staging, right?
I've setup a local git repo for tracking down Entities package changes (and partly so that I could update FPS Sample projects ECS changes to newer ECS version when they still used custom solution for it)
I could technically push this to public github too but I've chosen not to as Unity hasn't put it on their own github either
Unity companion license would let me push this out there tho
@silver dragon i want to know how long the Execute() method in my job takes to run on average.
@sleek ember I get bunch of these on 0.0.12-preview.22: Library\PackageCache\com.unity.entities@0.0.12-preview.22\Unity.Entities\ArchetypeManager.cs(304,20): error CS0246: The type or namespace name 'UnsafePtrList' could not be found (are you missing a using directive or an assembly reference?)
edit: wait, I probably need to update the other packages too (my package manager list wasn't refreshed). edit #2: now runs
@mint iron Hm, good question, don't know ๐
i guess until there is a Time function that can be called inside the job the only way is to do .Complete() straight away after .Schedule() and use profiler or stopwatch around it.
Depending on your code it may be enough to have a look into profiler which shows how long a system runs each frame.
@latent peak Look at the "Project Tiny" release for a preview of the tools ECS will have for 2d.
There is a workshop on Youtube that was quite useful
https://www.youtube.com/playlist?list=PLX2vGYjWbI0TPRStIWx3UyNB8QqjNUj98
seems like preview.22 has some gameobject conversion tool for hybrid
I dunno if it's all there but there are definitely files on the package for this purpose
Unity told they'd release the tools they used for MegaCity gameobject->entities so I'm guessing this is related to that
ok, they pushed out 0.0.12-preview.23 now too to staging (it only changes one test class related to GameObjectConversion)
@dull copper cool ! thanks ๐
i see in a lot of the jobs examples creating a new Job every update, is there a reason to do that or could you re-use an existing job by just scheduling it again.
@mint iron why would you run the same thing again?
like, you would already have the results from the previous run
yeah i see, usually the data wouldn't have changed, so you'd get the same result.
in the case of using a job on top of a permanent NativeArray it could change maybe.
[BurstCompile]
public struct TimeStructNativeArrayJob : IJob
{
[NativeDisableUnsafePtrRestriction]
public IntPtr BaseAddress;
public Vector3 CompareValue;
public int Stride;
public int Length;
public unsafe void Execute()
{
for (int i = 0; i < Length; i++)
{
var row = (StructNode*)(BaseAddress + i * Stride);
var currentX = Mathf.Abs(CompareValue.x - row->Position.x);
var currentY = Mathf.Abs(CompareValue.y - row->Position.y);
var currentZ = Mathf.Abs(CompareValue.y - row->Position.z);
row->Distance = Mathf.Sqrt(currentX + currentY + currentZ);
row->Flags = 4;
}
}
}
Anyone having issues with some burst jobs just segfaulting?
I have a job which refuses to execute in burst, and will just hard crash every time
@dull copper you have any idea how to debug segfaults in burst
or well, segfault might be wrong word
but just HARD crash
@trail burrow you already run the latest Burst version?
no idea really
you have the debugger to examine the code it created but, yeah, not going to be easy deciphering that
struct Job : IJobChunk {
// type that signifies a networked entity
[ReadOnly] public ArchetypeChunkComponentType<NetworkedEntity> NetworkedComponentType;
// the component this job serializes
[ReadOnly] public ArchetypeChunkComponentType<T0> TargetComponentType;
// length of fields array
[ReadOnly] public Int32 FieldInfoArrayLength;
// fields list
[ReadOnly] [NativeDisableUnsafePtrRestriction] public ReplicationFieldInfo* FieldInfoArray;
public void Execute(ArchetypeChunk chunk, int chunkIndex) {
var networked = chunk.GetNativeArray(NetworkedComponentType);
var targets = chunk.GetNativeArray(TargetComponentType);
for (Int32 i = 0; i < networked.Length; ++i) {
var b = networked[i];
if (b.State->Values != null) {
var t = targets[i];
var tAddr = (Byte*)UnsafeUtility.AddressOf(ref t);
for (Int32 k = 0; k < FieldInfoArrayLength; ++k) {
ReadField(b.State->Values, b.State->DirtyFields, tAddr, FieldInfoArray[k]);
}
}
}
}
static void ReadField(ValueUnion* buffer, Byte* dirtyFields, Byte* addr, ReplicationFieldInfo field) {
var current = &buffer[field.Index];
switch (field.Type) {
case ReplicationFieldType.Int32: {
var val = *(Int32*)(addr + field.Offset);
if (val != current->Int32) {
current->Int32 = val;
dirtyFields[field.Offset] = 1;
}
}
break;
/// ... snip
}
}
this is the job
NativeDisableUnsafePtrRestriction sounds always safe ๐
i snipped a bunch of other serializer switch cases, but it's not really important
it crashes with just that also
well i know it's safe
the memory is ready only
its allocated by me, and it does exist
if i run the job without burst it all works
@dull copper i mean without burst it runs fine, but with burst its just... dead
first execution, instant blows up
wonder if they'll make easier debugging for this later on
they did one for IL2CPP, but it's radically different thing
ye
like, you can now breakpoint and step through your managed code while running IL2CPP compiled version
yeah i noticed that, never tried it tho
I did, it works
reported one bug on it too
it worked but it made certain draws super slow
like borderline made it unusable
they fixed that but there could be similar issues still
my build ran 5fps with debugging enabled ๐
im thinking if the field offsets im calculating are not accurate for burst or something
or if it's this (Byte*)UnsafeUtility.AddressOf(ref t); causing the crash
i've been stuck trying to get this to run in burst for like a week, just off hour hobby work
but still
ยฏ_(ใ)_/ยฏ
@trail burrow have you tried looking at the generated codes with the Burst tool (Burst Inspector)?
if I remember right, they had output for multiple steps there
Hmm I should do that
@trail burrow if it doesn't show anything there, you probably have to hit the refresh thing there
as least I have faint memory it didn't show anything at first sight
so, looked bit into new Entities package's conversion thing. apparently the idea is that you convert whole scene with it (I thought they meant to do it for Prefabs)
anyway cs var entityManager = World.Active.GetOrCreateManager<EntityManager>(); var activeScene = SceneManager.GetActiveScene(); GameObjectConversionUtility.ConvertScene(activeScene, entityManager.World); does indeed copy my active scene into entity side
ah cool, I'd have to try out that scene -> world conversion
Scenes are prefabs as far as I know under the hood somewhere
Also what has happened to the scene-fragment concept?
scene-fragment what? ๐
oh, I think I know what you mean
March 20, 9:00am (San Francisco) - Get insight into Unityโs future plans, including what to expect regarding new features and functionality for 2018. Please ...
"Available in Preview in 2018" ๐ค
I haven't heard anything about that
I haven't been keeping up to speed but I'd like to start getting into this whole megacity lark. Is it suitable for a complex evironment such as dark souls?
that is, would I benefit from it's approaches for a typical 3rd person game? or even an FPS?
how I understood it, the whole lod setup would would really apply to all kinds of games
imagine minimal loading times for you game as you can stream the whole game world around you really efficiently in as you move around, only keeping the bare minimal at the level at given time
this is very much the thing they showed at last Unite:
oh btw
this com.unity.rendering.hybrid and new entities package are both now on regular registry, you need to manually edit the manifest for the hybrid renderer to show up there though
ah cool, thanks for the info @dull copper
Thanks for the clarification. As I'm just starting level building seriously right now, I think I need to be on this. My game will be nearly shippable state by 2019.3
and hopefully dig more info about these ๐
I'm sure Unity will make announcement about these soon too
they don't usually publish there, especially on regular registry unless they plan to tell about them more
I'd have it by now if not for annoying distractions from improbable
๐
well, as much as many dislike the whole drama, it did change things for better
so it was actually a good thing
right so to support this workflow I need to lean heavily on prefabs right?
And unity just does some kind fucking ace kungfu and bam! I have a fast game?
I honestly don't know how prefabs fit into this right now at all, besides helping you design your level faster
easy as that
well from the most recent unite, from what I tuned in to that workflow leaned on prefab and prefab variants to bake data ๐ค
Well I love untiy, and can I have it?
@coarse turtle yeah, this is why I was surprised to see gameobject scene to entities tools rather than prefab to entities ๐
but yeah, they could have just talked about these in different terms
will be really curious to see how they announce these and if they'll give some sample (before they are ready to release MegaCity)
scene makes sense since it'll be filled with prefabs, right?
I guess
sometimes you go too technical and think too much. embrace your inner idiot and it all makes sense
they did give some mixing info about the megacity earlier too
like on the level design etc talk the guy said they used occlusion probes but when I asked about that, they said they didn't use them at all there
Learn how we built the Megacity demo in this Unite LA session. Get an introduction to the editing tools developed for streaming worlds and how we utilized ne...
this was the reply I got when I asked if they did improvements to Occlusion Probes from BotD to MC:
MC lighting is probably not a topic suitable in this post, but in short it doesn't really "use occlusion probes" as such, it uses light probe volumes applied in the lighting loop (so in screenspace for 99% of the world).
so, looking at the Hybrid Renderer's RenderMeshSystem, it has description: Renders all Entities containing both RenderMesh & LocalToWorld components. And RenderMesh is just IShaderComponentData that holds mesh details like the actual mesh ref , material ref, submesh, layer, shadows. And MeshRendererConversion (which inherits GameObjectConversionSystem) actually turns all traditional MeshRenderer components into these RenderMesh components.
when I tried it without the Hybrid Renderer, it copied the gameobjects from scene into entities but didn't render them
now that I have the Hybrid thing here, it automatically also converts the mesh renderers to RenderMeshes
the main thing I now wonder is how did they store the levels beforehand into entities (because it would make no sense that you'd first load the level traditional way, then convert it at runtime to ECS and then run the new Hybrid Renderer for it. you'd have to preload the whole level in that case before you could move anything into ECS side)
they also updated: https://github.com/Unity-Technologies/EntityComponentSystemSamples/ (mainly Docs but boids sample also updated)
I think this is new on docs: https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/master/Documentation~/ecs_best_practices.md
As the ECS APIs change, so too will these best practices. For the time being, these are our best recommendations on how to use the ECS APIs.
Dos
Use IJobProcessComponentData for processing many entities' components in a job.
Use chunk iteration if you need finer-grained control.
Don'ts
Do not use injection. It is deprecated.
Do not use ComponentDataArray. It is deprecated.
Yes there are some nice changes. I'm still wondering how lod and all that will be addressed as well
they have separate MeshLOD component on the Hybrid Renderer at least
hmmmm, it's actually moved from the Entities package into Hybrid Renderer package now
conversion tool doesn't convert regular lod groups at least for this
Drat! still no string/array in IComponentData support 
Oh, worth noting that when you actually convert your gameobject using the new tool, you actually see the gameobjects old name in Entity Debugger instead of "Entity x":
And after little digging, I see that they added SetName: cs entityManager.SetName(myEntity, "So this happened");
Where is that RenderMeshSystem located? I can't find it
@soft nova it's in the Hybrid Renderer, it's a separate package
I have manifest snippet here: https://forum.unity.com/threads/ecs-hybrid-renderer-and-gameobject-conversion-tool-now-available.614629/
it doesn't show up in package manager automatically yet
Well I do see it on the package manager, trying to see how they modified it
oh, they must have enabled it then ๐
Yeah seems like it
Good to know that now I can delete my WorldMeshBoundsComponent since it didn't exist before ๐
New Features
Added new batched renderer for MegaCity sample (Requires API in 19.1 and is disabled by default)
Added custom job type to schedule parallel jobs over hash map.
Added DynamicBuffer accessor to ExclusiveEntityTransaction.
ComponentSystem.GetSingleton / ComponentSystem.SetSingleton to simplify access to singleton data
ComponentSystem.RequireForUpdate(ComponentGroup) for specifiying ComponentGroups that are required for a system to run.
GameObjectConversionSystem & GameObjectConversionUtility can be used to perform conversion of existing GameObject scenes into entity representation.
WorldDiff can be used to create a diff between a previously applied state of the world.
GameObjectConversionSystem & WorldDiff combined are the foundation for scene management tools & live pipeline tools that are in progress and not yet part of this.
NativeHashMap.GetKeyArray lets you retrieve all keys of the HashMap into a NativeArray
Added support for chunk components. Chunk components are like ordinary components expect they can be added to and accessed by ArchetypeChunks.
oh
Note especially that the MeshInstanceRenderer component has been renamed to RenderMesh, and is part of the new Hybrid Renderer package.
so it's not a new thing at all ๐
Yeah, that's why I asked you were it was located since all my code were giving me errors because of that change
heh, no wonder
well, now this all makes a whole lot more sense
this also happened sooner than expected:
Systems that use BarrierSystem.CreateCommandBuffer() to create an EntityCommandBuffer and record that command buffer in a job must now call BarrierSystem.AddJobHandleForProducer() to ensure that the recording job completes before the barrier initiates command buffer playback.
IJobProcessComponentData now supports up to 6 seperate IComponentData
I try to limit the spam now :p
i like it
please don't limit the spam, you're helping me keep up to date ๐
Morning o/
Spam more spam more ๐ However I had read all that on the github, it is nice to see on here too 
I still find it odd that Unity doesn't enforce their own no-injection policy on their new releases ๐
but tbh, that stuff was probably coded a long time ago in reality, just cleaned up now
@dull copper where do you live man, no matter what hour I'm on at you're always online lol
lol
That seems awfully awkward
more like one country to the east
yes
Finlands sak รคr vรฅr!
@dull copper yeah I know
it's silly
Yeah I Never understood why
Haha, we actually had quite a few finnish people in my class iirc
So we all knew how to curse in finnish by the time we were in 2nd grade
that seems to be a really common skillset there ๐
Haha
but yeah, I'm actually going to get some sleep now (plus I don't think people meant we should spam offtopic here ;D)
Night o/
o/
Can a burst compiled job not be contained inside of a generic class?
I have this atm
// serializer concrete class which takes type arguments
public class Serializer<T0> : Serializer where T0 : struct, IComponentData {
[BurstCompile]
struct Job : IJobChunk {
// type that signifies a networked entity
[ReadOnly] public ArchetypeChunkComponentType<NetworkedEntity> NetworkedComponentType;
// the component this job serializes
[ReadOnly] public ArchetypeChunkComponentType<T0> TargetComponentType;
// length of fields array
[ReadOnly] public Int32 FieldInfoArrayLength;
// ... snip
And I can't even get job to show up in the burst inspector
https://forum.unity.com/threads/burst-job-inside-of-generic-class.614737/ here's my forum post on this... i'm not sure what the way forward is, or if this simply isn't supported by burst atm
I have another question: Is there any way to get a pointer to a specific component data? I want to basically get a void* to a components memory so I can read data in/out of it.
Basically what I want to do is what the internal class EntityDataManager is doing in this method: public unsafe byte* GetComponentDataWithTypeRO(Entity entity, int typeIndex) which then uses another internal class called ChunkDataUtility and calls its GetComponentDataWithTypeRO
This is what I want to do: https://forum.unity.com/threads/exposing-lower-level-access-to-chunk-memory.614740/
hm, had to remove "Unity.PerformanceTesting" from Unity.Entities.PerformanceTests.asmdef after upgrade to new entities and hybrid renderer.
had to fix some calls because some methods have new signatures now:
public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) // in IJobChunk; int firstEntityIndex is new
public void SetComponent<T>(int jobIndex, Entity e, T component) // in EntityCommandBuffer; Entity e is new
Seems to work now. (Rider plugin throws some NullRefs though!)
Created an issue on github for this asmdef error.
@dull copper Prefer using stable editor, packages are unstable enough ๐
Some people also just added the missing package manually
Package manager didn't show the missing package (in 2018.3), where did you get it?
hey anyone seen a Native PriorityQueue yet?
@silver dragonhttps://forum.unity.com/threads/entities-preview-23-package-contains-invalid-references.614599/#post-4116799
thx, seems i missed that...
im seeing such massive improvements from burst jobs, i feel like its christmas
till you publish the game and find out you have customers running your game on phenoms ๐
I do hope they get the platform capability check and variants in place some day
like, drop to SSE2 set on those ancient processors
not that most modern games would run on that gear anyway
but would be nice to get AVX too
those phenom users tend to still pop up in all AAA game forums where they've limited the instruction set to SSE4
but then again, they have quite big userbase too
are there any issues with IOS building and current ECS (i mean outside of you probably shouldn't be using it in production yet anyway)
I read that apple started recently rejecting burst binaries specifically
not sure if they've sorted it out already
We are working on bringing static linking support for burst but it not be available before a few weeks (including the release of Unity editor/engine patches and backports)
I'd love to have that on Windows IL2CPP too
would get rid of the extra dll
good info, thanks
without Burst, it should just work, ECS is just c# code in this context
gotcha, yeah right now im not using ECS, just burst jobs to speed up my code.
that's kinda huge issue right now so I'm sure Unity makes it happen rather sooner than later
after all, iOS is one of the main targets for all this
of course "performance by defaults" applies everywhere but it makes even bigger impact in mobile space
having yet another conversation with my artists about why everything can't be 4k/uncompressed/mips
make your artists pay for Granite ๐ค
that being said, I wouldn't recommend it, they always lag behind and only support DX11 (and no SRP support yet)
also no source code :p
wish Amplify Texture 2 was still a thing you could buy
Amplify can't really sell it because Granite is having a wiggly eyebrow at possible patent infringements (even if peripherally)
oh speaking of which regarding the missing asmdef references, unity has some docs that I happen to come across by: https://docs.unity3d.com/Packages/com.unity.test-framework.performance@0.1/manual/index.html#test-attributes I'd probably keep an eye on these pages ๐
(software patents really suck because it's not that difficult to arrive at the same technique, and even easier in an age of machine learning)
for example I "Invented" marching cubes and bresenham's and had no idea the former used to have a patent attached
these are common solutions
@urban rivet so it was a patenting issue?
I thought these methods were used on many engines, but I guess they rely on some specific thing they hold a patent for
for example UE4 has their own virtual texturing they are working on
It was implied in chats, so I would give it a gossip sticker.
I chat to them sometimes on skype
it would explain why they never really gave clear answer
can't really.
makes sense
I would have bought their thing over Granite any day, I like Amplify
they also give full sources
people demand a lot of answers (like details of unity's spat with improb) but you can screw yourself sideways legally by talking publically about this stuff
even in text
yeah, that's true
I've been given legal notes just for talking in an irc channel before
while they can't really do much, in the world of text, it's still quite a hassle isnt it
(we're offtopic!)
I can't wait for Unity's guidence about what I should be doing for optimal level design in 2019. The current approach is:
-
low poly base geometry which serves as a simple collision and occlusion structure
-
lot of prefabs that get culled easily using umbra
So rather than just guessing and jumping into their ECS sample, I'd rather be given some pointers as I just don't have that luxury of time ๐ฆ
i can't make my custom serializer job in burst
literally tried everything
just hard crash every time
i surrender
comment out functionality until it works, then add functionality back ๐
Right now I'm hardcoding the innerLoopBatchCount when scheduling jobs, but should I be setting it to arrayLength / workerThreadCount? Wouldn't that always yield the best distribution of work?
@trail burrow at least you don't need to worry about TOS
@urban rivet lol
aww yeah, my a* navigation runs 5x faster in burst jobs ๐
no, not yet, i just managed to get it working so completely unoptimized
Then when the special buttons are pressed, it will be a lot faster still ๐
this is magnificent ๐ burst is best thing since sliced bread
Problem I have with ECS is I'm never sure if what I'm doing is the right way to do it fast within ECS
its going to take some experimentation to figure that out over time
Generally it will be faster anyway, but there's 5x and 15x and I definately want to know the latter!
for example i tried to just do the Distance calculation in Burst and it was 5x slower because the frequency of the call was causing the overhead to add up (i assume)
it matters to not check other entities I think, as it would stall it
a distance check, you would need them both float3 in the same system
i mean the same component for the system to calculate
things like this below can run very fast, any sort of discreet operations where they have all the information they need in one place. the asm out the other side seems really compact.
public static class GridNodeOperations
{
public static class AllNodes
{
[BurstCompile]
public struct SetFlags : IJob
{
[NativeDisableUnsafePtrRestriction] public IntPtr BaseAddress;
public ulong Flags;
public int Stride;
public int Length;
public unsafe void Execute()
{
for (int i = 0; i < Length; i++)
{
((GridNode*) (BaseAddress + i * Stride))->Flags = Flags;
}
}
public static unsafe JobHandle Schedule(NativeArray<GridNode> array, NodeFlags defaultFlags)
{
return new SetFlags
{
Flags = (ulong) defaultFlags,
BaseAddress = (IntPtr) array.GetUnsafePtr(),
Stride = UnsafeUtility.SizeOf<GridNode>(),
Length = array.Length
}.Schedule();
}
}
}
}
GridNodeOperations.AllNodes.SetFlags.Schedule(Grid.InnerGrid.Internal, DefaultFlags).Complete();
It 10 times out of 10 generates better ASM than I do, so there is no logical place where I'd get better perf using C++ - I would need to code way more, take more risks and probably just tire before the finish.
That said, it's still hard to solve a lot of problems with
Oh Hippocoder, just wanna say, huge fan of you on the unity forums
youve helped me loads over the years haha
I had no idea. I've gotten to the point where I google, and answer myself from the past
So the new hybrid renderer
What.... is that
Is that related to SRP or the ECS?
Im confused
From GitHub
@soft nova that doesn't really explain what it is tho
@trail burrow I have a thread about this on the forums
it's not really explaining about technical details how the renderer works tho :p
more about discovering how to use it
I did just link the Mike Actons talk on the LOD setup
but I don't really know for sure all that is included on Hybrid Renderer
it's clearly related to this whole setup tho
still watching this talks atm: https://youtu.be/9MuC3Kp6OBU
This in-depth talk covers entity serialization to and from disk, how we built seamless play mode streaming and efficient editor workflow, and what a separate...
it's actually explaining the part that I really wondered about when I saw these systems
their Unity.Entities.PerformanceTests have test for serializing to json: cs /// <summary> /// Serializes 10,000 entities as json /// </summary> [PerformanceTest] public void SerializationPerformance()
I have all Entities packages on local git so I can easily see the diffs between these, all changes related to this has been between Entities 0.0.12-preview.21 and preview.22 (.23 is just minor test fix)
would be nice to hear from Unity if they would mind if I pushed these ECS diffs to github
they must have their reasons why they don't share these there themselves
I don't quite get it though as the license itself isn't preventing anyone from uploading these to public github repo
having the diffs is really helpful for checking out the changes in new version
SerializeUtility.SerializeWorld(m_Manager, writer, out sharedData);```
```cs
SerializeUtility.DeserializeWorld(entityManager.BeginExclusiveEntityTransaction(), reader, 0);```
I have no idea, discovering this all myself now
Json will suck but assuming you can use binary also
you can watch the serialization talk I linked where they explained how they stream this on MegaCity
it sounded like they had really custom setup for this
So this new renderer
What.... Is it
Like what part of the rendering process is it responsible for
I think the word renderer is kinda misleading here
it's part of the renderer that does the cullings and lod logic etc
Ah
you'd still use this WITH SRP
I also don't think calling it Hybrid is making it any more clear either ๐
Yeah
Because the hdrp is a hybrid clustered renderer isn't it
But hybrid there means something different
I guess you can call it that, I'm not super familiar on renderer terms
but hybrid in this context probably means it works with hybrid ECS setup
or that it works in conjunction with builtin/srp renderer
Yeah okay so this new ecs thing is basically an lod/culling system
Mostly for static geometry I assume?
For now
they haven't really talked about dynamic stuff so that would probably be a fair assumption
but it does come with all ECS specific rendering elements now I think
Okay that's nice
so like, RenderMesh is the old MeshIndirectRenderer component
which we used to render meshes on ECS world side
and the conversion tools we got now can setup most of these for us if we just convert scene with meshes with it
your meshes with traditional GO MeshRenderer components become RenderMeshes after conversion
anyway
to the dserializing the world, I'm pretty sure we need to wait for MegaCity demo to get their specific setup for it, but what we have now should still let us convert individual subscenes into ECS and serialize them in editor for runtime deserialization (so we don't need to load the traditional scenes at all at runtime for these parts)
if that makes any sense ๐
I imagine that demo was running so many hacks back when they showed it - I didn't check out the ECS details when I got the chance to peek, only the audio graph and the nested prefabs (and flying around)
when they release it I suuuure hope it's got no [Inject] ๐
but their "new" Hybrid Renderer already does ๐
so basically, we are still missing the Audio part right now
@dull copper so the original reasoning for the inject attribute was two fold right, afaik
that its easy to use (its not, its annoying and magic)
and that they could put all components in linear memory
but now they recommend to use chunk iteration and such instead, which spreads the memory again
i mean the chunk memory will still be localized in 16k chunks
but when you iterate say 100k entities using chunk iteration, you will still jump all over memory for each chunk
afaik?
im not 'complaining' really, just trying to figure out whats going on internally
I just thought they wanted inject out so could control more how people use these
because as far as i an tell, chunk iteration does not copy/clone any memory, it use the original pointers to expose the nativearrays, etc.
to the other thing ```For the megacity demo we used a conversion pipeline, that takes existing unity game objects with meshrenderer + LOD group + HLOD script and converts it into pure entity& components representation. This representation is efficient to stream and the renderer scales to massive amounts of instances.
We are working on shipping the megacity demo + all necessary changes to ECS for sometime around GDC. ```
I still wonder about the lodgroup
as I did try adding it and it didn't add the ECS meshlod component automatically on conversion
but maybe it detected somehow my dummy group, should probably try on object that really has true lods
also i wish we could burst compile individual static methods
so we didnt have to go through jobs
I think that's their long term plan
since massive threading doesn't help in the case im trying to solve
i need single threaded performance
it's just easier to focus first on more limited systems
first and foremost
at most i can use two cores maybe
but preferably the whole game should fit on one core
and now i have to go through jobs to get burst speedups, even if i just execute them on the main thread
yeah this talks a bit about this
but again it's all multi threading
i just want a static method that i can pass pointers/binary data to
that will be compiled with burst
using heavy multi threading with jobs is out of the question, especially since it's not possible to control how many cores/threads the job system will saturate at the moment
yeah, I tried to find the comment where they mentioned they want it to eventually work outside jobs but that was only relevant thread I found
it could have been mentioned on some of those burst talks too ๐
my use case is simple
i just need main thread execution speed, because using X cores to handle something in realtime
is not a valid solution when dealing with dedicated server hosting
because it will cut into your bottom line, where you cant fit as many game instances as possible on each server machine
basically scaling using multi threading is not a valid use case for dedicated servers, as it becomes too expensive and is to unreliable if you have say 6-10 games instances all trying to saturate say 8 cores on a single machine at the same time
I can see that being an issue, yes ๐
you can still limit the core access per running instance tho
or hw thread in this case
@dull copper well yeah you can limit that, but then the threading doesnt help anyway and you're just paying a ton of overhead by scheduling threaded jobs which execute on 1 core ๐
since the job system atm will spin up threads equal to the amount of cores
and you're just gonna have a bunch of threads competing for 1 core
like sure you can potentially say use 2 cores per game instance and you could get some MT scaling but that literally doubles your cost,
ah, that makes sense, wonder if you could still limit that somehow
like, you can limit the amount of jobs the unity thing runs and also force the amount of tasks it schedules for single job
or something like that, I never looked these too closely as I do want them to scale up myself ๐
@dull copper yeah, but you're just doing a bunch of busy work, putting stuff in jobs (with all their limitations), etc.
which 1) complicates the code 2) probably wastes a bit of performance at least
sure, that's what we have now tho ๐
and it makes sense the implement these things one by one
or just write it single threaded for now, and not care about burst
they'd never get it done otherwise
you'd think the burst benefits would still outweigh the overhead of the jobs in this case
potentially
using jobs without burst from what i've seen so far is slower than not using jobs at all.
you sure about that?
it doesn't sound right
i have a non-job that scales over my 32 threads
its pretty much insanely much faster
considering you are utilizing 4-8x cores here
well it does make sense if you run it on a toaster with like 2 cores
but not in any modern pc
16c/32t cpu, the job is about 14x faster than single threaded
so not quite linear scaling
but still good
for example I got two 2 core CPUs here
other doesn't do hyperthreading and other does
also when u profile jobs, etc. basically has to be in build
running job system on the latter would give better results than in the former
as they can be sagnificantly slower in editor
i thought we were talking about single threaded
@mint iron im talking about how i cant use jobs to scale my workload
since using multi threading is not applicable
fholms case is quite different from regular use here
and i would like to be able to use burst as just a method call
on a static method
on the main thread
it's more about being able to run many instances of the thing on server backend efficiently
if its just about style, you could wrap the job in static class to make it feel that way like i posted yesterday
my hand made native memory/network state system is still sagnificantly faster than the ecs based one on a single core
i've been unable to get BurstCompiler.CompileDelegate<> to work ๐ฆ
@mint iron ye i saw that also, it seemed to be experimental/api is only there for future compat
they must be doing some extra magic on it, it returns a delegate that calls without crashing, but doesnt actually run.
ah, i read somewhere that it's just a place holder/there for future compat
like it doesnt actually work at all
or is intended to work
as of now
and yeah i'd like to use burst to compile some delta compression/serialization methods
im on 2019 maybe its not in older
but i have to pipe it through jobs and call .execute() on them by hand
which just feels like a bunch of busy work lol
yeah but does it actually do something? ๐
๐
or does it just return an empty stub
right now my jobs wont even compile with burst without crashing the runtime when they run
i cant even get it to show up in the burst inspector
hmmm
its wrapped in a deep generic and dynamically instantiated hierarchy tho
so burst compiler probably misses it
tbh, you are using it in very different way than avg user would ๐
that
but weird that burst compiles it but doesn't show it in inspector, are you sure about that?
@dull copper 100%
so take it out of that and simplify it or seperate into multiple jobs so you can find what part of it cant be burst compiled
I do have to refresh that inspector myself too for that to show anything
@mint iron right now it seems like the burst compiler cant even find it
@dull copper i tried everything, including restarting unity several times
can you see other burst code with the inspector?
yes
its full of other burst jobs, both mine and built in
and also my other non burst jobs show up
literally EVERY job except this one ๐
and when i run, the editor or build segfaults
remove burstcompile attribute
all works
can you see somewhere if it even generated anything for that
not at my desktop atm, will dig around later
you do IL2CPP btw?