#archived-dots

1 messages ยท Page 65 of 1

rotund token
#

/probably/

#

It can still be both ๐Ÿ˜„

misty wedge
#

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...

misty wedge
rotund token
misty wedge
#

Has there been any word on when a next version is coming? I'm still really looking forward to having working leak detection again...

rotund token
#

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

misty wedge
#

Alright, that doesn't sound too bad

rotund token
#

But who knows, I think they got a bit burned in the past committing to dates

misty wedge
#

Yeah I don't really mind, I'm more interested in the final features than a concrete release date

rotund token
#

I'm really just hanging for burst 1.8.3

misty wedge
#

How come?

#

I've not really been following burst releases

rotund token
#

They finally tracked the corruption that had been plaguing me

misty wedge
#

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?

rotund token
rotund token
#

Man I hate how I can't hide preview on mobile

#

Anyway that was my bug, been destroying my work flow

misty wedge
rotund token
#

Not sure what in my library is triggering to do much

misty wedge
#

I've not been running into that specific issue luckily from what I can tell on the post

rotund token
#

But just randomly swaps around an the function pointers

misty wedge
#

Although I do get infinite waits sometimes which forces me to kill the editor

rotund token
#

Starts calling random OnCreate from destroy

misty wedge
#

Yeah I recall you talking about that a little while ago

rotund token
#

Anyway should sleep, have a good day

misty wedge
#

You too, have a good sleep ๐Ÿ‘‹

tribal pollen
#

How hard was this? I'm only using it for raycasts, so this seems appealing.

misty wedge
#

What specifically?

#

Turning off the simulation is just adding a component to the world

tribal pollen
#

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.

misty wedge
#

The PhysicsBody component specifically will stop doing anything useful

#

The authoring component is called PhysicsStepAuthoring

tribal pollen
#

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?

rustic rain
#

hmm. Is there a way to interpret 3 integer pointers as NativeArray?

#

or do I need to make array of pointers?

pliant pike
#

I'm confused the docs say a commandbuffer has IsComponentEnabled method yet its not in the VS editor?

#

it has SetComponentEnabled though ๐Ÿ˜•

mystic mountain
#

That's odd yeah, I would guess it's a typo. Doesn't make sense that commandBuffer would be reading values.

pliant pike
#

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())

mystic mountain
covert lagoon
#

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* โžœ
pliant pike
#

the above does'nt work of mine for some isDead is only enabled on a few and yet it plays over all the entities

covert lagoon
#

Am I supposed to change this in other URP assets too or not

mystic mountain
pliant pike
#

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

fair vine
#

Hi I'm an Entity

real egret
#

and I'm a Component

dark tangle
#

We should probably stick to more substantive discussion of ECS here and leave the banter for #497872469911404564 . (I'm the system ๐Ÿ˜ˆ )

dull copper
dark tangle
#

(continued from #๐Ÿ’ปโ”ƒunity-talk) That's a question best answered by someone much more knowledgeable about programming in general than I am!

dull copper
#

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."

dark tangle
#

I volunteer @tidal wedge or @glacial bolt

ashen plaza
#

Lol

tidal wedge
#

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.

dark tangle
#

What's a cache miss?

dull copper
#

CPU's have cache memory

#

so you don't have to fetch all recently used things from regular RAM

glacial bolt
#

I haven't touched ECS yet other than a few tutorial videos ๐Ÿ˜ณ

dull copper
#

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

tidal wedge
#

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.

dark tangle
#

That makes perfect sense! Thanks for the explanations!

tidal wedge
#

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.

ashen plaza
#

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

tidal wedge
#

Functions just live in one place for all the objects of a same type (referring to your conjecture earlier).

dull copper
#

also worth noting that modern CPU's have multiple levels on their caches

tidal wedge
#

Roughly, obj.foo(a, b) is "actually" Object_foo(obj, a, b), if you see what I mean.

ashen plaza
#

Is that how ECS represents it?

tidal wedge
#

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. ๐Ÿ˜„

ashen plaza
#

I was under the impression that each instance of an object had its own instances of its functions

#

I thought that sounded excessive

tidal wedge
#

Yeah, that's not the case.

ashen plaza
#

At last I can sleep at night

#

How does ECS work differently to OOP in that regard then?

tidal wedge
#

Regarding functions, I don't know. I don't know ECS, I just know a bit about making calculations run fast.

ashen plaza
#

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?

tidal wedge
#

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.

ashen plaza
#

How does it know?

tidal wedge
#

You tell it.

#

"Here, have 10k x's and do x.f() on them each frame"

ashen plaza
#

thonking 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

tidal wedge
#

๐Ÿ‘Œ

#

Good night.

keen cairn
#

๐Ÿ‘Œ

merry oasis
#

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

civic glen
#

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.

merry oasis
#

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

solar ridge
#

Every time I go to use string related types in ECS: soarynSad

fringe sinew
#

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

ripe blaze
#

What do you mean by "Hybrid ECS" ?

fringe sinew
#

Unity's ECS has a hybrid version that uses GameObjects as Entities and partially retains the Object-Oriented nature

ripe blaze
#

Oh I didn't knew that ๐Ÿ˜ฎ

solar ridge
#

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

fringe sinew
#

Thank you

minor sluice
#

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?

soft nova
vivid drum
#

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

low hazel
#

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?

dull copper
#

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 ๐Ÿ˜ƒ

low hazel
#

Okay thanks! I guess we'll just have to do a test. ๐Ÿ˜ƒ

gusty comet
#

Has anyone found a better way to reliably resolve "Recursive type definition detected" without just closing and reopening the editor. That solution scares me.

dull copper
#

great stuff

ashen plaza
#

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

dull copper
#

That makes no sense :)

#

You could just learn some wonky things about some other ECS lib then

ashen plaza
#

@dull copper Thats why I intend to write my own >:D

candid dune
#

^ 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

rocky pendant
#

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...

rotund torrent
#

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.

dull copper
proven trench
#

(keep posting any ECS tutes you find! I'm just lurking, and trying to learn it)

dull copper
#

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

proven trench
#

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

dull copper
#

ah, yeah, that'll take some time to arrive still

proven trench
#

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.

dull copper
#

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...

proven trench
#

there's a few audio bits an bobs in the released alpha. So, a bit of things to play with

dull copper
#

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

gusty comet
#

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.

dull copper
#

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?

gusty comet
#

I think I might have had my version of this system several years ago. My timeline is fuzzy. I'm really curious now.

dull copper
#

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

#

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

gusty comet
#

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.

dull copper
#

heh

#

Unity is really pushing this now

gusty comet
#

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

dull copper
#

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 ๐Ÿ˜ƒ

gusty comet
#

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.

dull copper
#

all ECS source code is in the entities package you load with package manger

#

it's all in c#

gusty comet
#

So there is no C++ under the hood?

#

They just using Burst?

dull copper
#

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

gusty comet
#

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.

dull copper
#

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

sharp nacelle
#

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!

dull copper
#

@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

#
mousePos = mousePos,```
solar spire
#

that's just C#

dull copper
#

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

solar spire
#

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

dull copper
#

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

sharp nacelle
#

@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.

solar spire
#

(CSharp is how you get highlighting)

dull copper
#

cs works too

sharp nacelle
#

well not much to highlight ๐Ÿ˜ƒ

dull copper
#

heh

#

@sharp nacelle stupid question but is your material set to support gpu instancing?

#

I'd still expect some error rather than crash

sharp nacelle
#

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?

dull copper
#

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)

sharp nacelle
#

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 ๐Ÿ˜ƒ

dull copper
#

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

sharp nacelle
#

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.

dull copper
#

ah, same

#

I'll drop a note if anything like that happens for me ๐Ÿ˜ƒ

#

I think Unitys examples still work on a13

sharp nacelle
#

Yeah much appreciated ๐Ÿ™‚

dull copper
#

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

solar spire
#

Unity you get the full callstack

dull copper
#

there's crashdump somewhere tho

#

you get?

#

like if it crashes on engine side?

solar spire
#

yeah

sharp nacelle
#

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

solar spire
#

AppData\Local\Unity\Editor\Editor.log almost always has the full callstack

#

only when things go really wrong does it fail

dull copper
#

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 ๐Ÿ˜„

sharp nacelle
#

aha!

#

so it might be a13 then

solar spire
#

mine crashed once because of Enlighten earlier

dull copper
#

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

solar spire
#

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 ๐Ÿ˜›

dull copper
#

sure, bug reports are great if you can make simple repro project

mint iron
#

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?

dull copper
#
เธญเธขเธฒเธเธ—เธณเน€เธเธกเธ•เน‰เธญเธ‡เธ—เธฃเธซเธ”เธญเธ”เธ—เธ™

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)

merry oasis
#

I've been wondering that for so long

#

why remove bool1 when bool isn't supported yet

urban rivet
#

It's going to have

#

It would be a bit old school to be using ints ๐Ÿ˜›

dull copper
urban rivet
#

peers at the horrific almost-necro and approves

dull copper
#

I try to do that only in places where it makes more sense than making a completely new thread

urban rivet
#

I'm just teasing, honestly I'm necro-friendly providing its relevant and it is ๐Ÿ˜„

dull copper
#

yeah, you answered to me some year old question recently ๐Ÿ˜„

urban rivet
#

whistles innocently

solar ridge
#

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 ๐Ÿ˜›

dull copper
#

mine was pretty pure bump ๐Ÿ˜„

solar ridge
#

๐Ÿ˜†

dull copper
#

but it's still technically possible their plan has changed so...

solar ridge
#

Not gonna lie. I have been tempted to do that with my string thread from last march soarynDerp

dull copper
#

I think Joachim mentioned strings as example on last Unite LA's ECS talk ๐Ÿ˜„

solar ridge
#

Yeah

dull copper
#

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

solar ridge
dull copper
#

heh

merry oasis
#

yeh i've made my own bool1 that uses a byte backing field

solar ridge
#

The video links perfectly to when Joachim points out Andres

merry oasis
#

i don't need to use it too often anyways so

dull copper
#

I actually remember the place really well, it's not so long since I last watched that talk ๐Ÿ˜„

solar ridge
#

๐Ÿ˜›

dull copper
#

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

solar ridge
#

My fear with a hybrid addition to that as a temp work around for the main system: that it wouldnt be temporary

dull copper
#

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

solar ridge
#

If you need rigid body physics, perhaps, but there is a forum post that had promise for a user generated physics temp library

dull copper
#

physics is one of my main concerns

solar ridge
#

Usually is a big one

#

Graphics, I think with material property blocks in ecs that would fill in a big hole

dull copper
#

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

solar ridge
#

material propertyblock like*

dull copper
#

I've actually updated it to run on recent Unity versions and latest ECS etc packages and turned it into package manager format

solar ridge
#

OOoh nice

dull copper
#

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

solar ridge
#

Yeah, I could see how that would be a problem XD

dull copper
#

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 ๐Ÿ˜„

solar ridge
#

Potentially

dull copper
#

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

solar ridge
#

I can not blame you. Even basic physics is a slight pain to redo

dull copper
#

I've already used my own bullet wrapper on Unity

#

it's not really tied into gameobject workflow in any way

solar ridge
#

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

dull copper
#

well, I'm working on a racing game so I really need solid physics ๐Ÿ˜„

#

it's the core of it all

solar ridge
#

Pssssh just a single plane of movement ๐Ÿ˜‰

#

And then make the cars never need ground

#

Mega city style ๐Ÿ˜‰

dull copper
#

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

solar ridge
#

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

dull copper
#

mobile was fully scripted for sure

solar ridge
#

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

dull copper
#

but afaik they have no such thing on ECS side

solar ridge
#

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

dull copper
#

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

solar spire
#

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

urban rivet
#

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.

dull copper
#

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 ๐Ÿ˜ƒ

dull copper
#

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

rotund torrent
dull copper
#

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

rotund torrent
#

What sorts of obstacles are you running into?

dull copper
#

it doesn't make things any easier that every place say don't use [Inject] anymore but almost every example does ๐Ÿ˜„

merry oasis
#

whats wrong with Inject

dull copper
#

they say it's going away

merry oasis
#

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

dull copper
merry oasis
#

like, you can inject other systems and such too

dull copper
#

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 ๐Ÿ˜„

merry oasis
dull copper
#

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 ๐Ÿ˜ƒ

merry oasis
#

yeah thats the main problem that a lot of people have with ECS right now

dull copper
#

anyway, I'll just dial down the complexity a bit and try to get something simpler to work now

merry oasis
#

its ridiculously hard to make anything more than single feature tech demos

dull copper
#

I really need to figure the right structure to get these dependencies between entities nicely chained in the relevant jobs

merry oasis
#

how you mean?

#

Jobs system should take care of that for you

#

just have the proper [UpdateBefore] [UpdateAfter] data on your systems

dull copper
#

yes, as soon as I feed the data in right ๐Ÿ˜„

merry oasis
#

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

dull copper
#

ah, I didn't mean like that

merry oasis
#

but yeah for the most part its all about those attributes

#

oh

dull copper
#

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

merry oasis
#

oh I see

#

well theres 3 main ways I know of

dull copper
#

for example for my wheels to do anything, they need info from my differential that feeds the force from transmission, clutch and engine

merry oasis
#

Injection, which includes the InjectAttribute and also IJobProcessComponents

dull copper
#

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)

merry oasis
#

ah ok I see what you mean

dull copper
#

if these all were individually decoupled things, it would be rather trivial

merry oasis
#

yeah, thats when ECS really shines

rotund torrent
#

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.

merry oasis
#

ah ok good to know

#

speaking of, any ETA on the next ECS update ๐Ÿ˜„

dull copper
#

I'm actually more interested on when ECS will go to github

rotund torrent
#

I'm not directly involved in the package release process, so no news there from me I'm afraid.

merry oasis
#

aww

dull copper
#

but even if he was, he probably couldn't tell us :p

merry oasis
#

yeah lol

dull copper
#

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

rotund torrent
#

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.

dull copper
#

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

merry oasis
#

oh really? i was under the impression that Jobs used those attributes to catch race conditions

#

along with [ReadOnly] and such

dull copper
#

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)

rotund torrent
#

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.

merry oasis
#

haha alrighty

dull copper
#

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

rotund torrent
#

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.

dull copper
#

thanks for checking it out ๐Ÿ˜ƒ

merry oasis
#

ah nice

dull copper
#

I'll take a short break and then start doing tests on different ways of injecting and passing data

merry oasis
#

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

rotund torrent
#

@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.

dull copper
#

@merry oasis thanks, I'll try to decipher that

merry oasis
#

haha

dull copper
#

I still try to figure out how to get rid of those injections tho ๐Ÿ˜„

merry oasis
#

oh

dull copper
#

I'm probably too stubborn about it but I don't really want to learn systems that will go away

merry oasis
#

ok to finish what I was saying above

#

3 main ways to iterate over entities

#

first is Injection, which includes InjectAttribute and IJobProcessComponents

#

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

dull copper
#

I'm actually looking to do most of the processing using IJobProcessComponentData

#

but I need the refs in somehow before I can do that

merry oasis
#

oh yeah well thats basically Injection without the InjectAttribute ๐Ÿ˜›

dull copper
#

I think you should still be able to do that without injections

#

but of course I can be mistaken here

rotund torrent
#

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?

dull copper
#

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

merry oasis
#

I still don't see anything wrong with just using regular [Inject] tbh

dull copper
#

but it's not really even about the entities themselves

#

but connecting specific components at some level

rotund torrent
#

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)

dull copper
#

yeah, that's what I understood ๐Ÿ˜„

#

the latter part I didn't as I don't think it applies here

rotund torrent
#

and then use IJobProcessComponentDataWithEntity to iterate over the parent entities

merry oasis
#

oh right I forgot about that one

#

I was just about to say I don't think IJobProcessComponentData allows easy access to the Entities

rotund torrent
#

actually hmm, do you even need the WithEntity variant? No, I guess not

merry oasis
#

but yeah that was added a bit back lol

dull copper
#

I thought the WithEntity thing was for getting the data without setting it explicitly like in his first sample

rotund torrent
#

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

dull copper
#

oh man, I need also coffee ๐Ÿ˜„

#

but I'm sure this all will make perfect sense in no time!

rotund torrent
#

...and the EntityCommandBuffer would require the jobIndex, which you get with the IJobProcessComponentDataWithEntity variant, so that's why I was subconsciously suggesting it

dull copper
#

I used to think myself as swift learner but this is something else ๐Ÿ˜„

merry oasis
#

oh yeah, its not just a new API to learn

#

its basically a different way to program

rotund torrent
#

This is all evolving very rapidly. The hazards of working with preview packages ๐Ÿ˜ƒ

dull copper
#

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

merry oasis
#

stuff like this is when I wish C# was more like Rust

dull copper
#

but yeah, I'll keep doing things until it makes sense, that's what I always do ๐Ÿ˜„

ashen plaza
#

Im currently trying to program an ECS library in Rust and was wondering what you guys look for in an ECS library

merry oasis
#

yes

ashen plaza
#

Thanks, I'll take this into consideration thonking

candid dune
#

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

rotund torrent
#

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

dull copper
#

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

rotund torrent
#

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.

dull copper
#

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)

rotund torrent
#

I of course agree that this would be a good idea

latent peak
#

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?

urban rivet
#

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

latent peak
#

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.

urban rivet
#

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

soft nova
#

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.

latent peak
#

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.

sleek ember
#

ECS package update ! Is there any changelog ? I can't find anyone

mint iron
#

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] ?

silver dragon
#

Hm, i have a burst update, but not ecs (Entities).

mint iron
#

how would i go about timing a scheduled job?

silver dragon
#

"Timing"? Can you give an example what you want to do?

dull copper
#

@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

mint iron
#

@silver dragon i want to know how long the Execute() method in my job takes to run on average.

dull copper
#

@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

silver dragon
#

@mint iron Hm, good question, don't know ๐Ÿ˜ƒ

mint iron
#

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.

silver dragon
#

Depending on your code it may be enough to have a look into profiler which shows how long a system runs each frame.

flat talon
dull copper
#

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

dull copper
#

ok, they pushed out 0.0.12-preview.23 now too to staging (it only changes one test class related to GameObjectConversion)

sleek ember
#

@dull copper cool ! thanks ๐Ÿ˜„

mint iron
#

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.

dull copper
#

@mint iron why would you run the same thing again?

#

like, you would already have the results from the previous run

mint iron
#

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;
            }
        }
    }
trail burrow
#

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

dull copper
#

@trail burrow you already run the latest Burst version?

trail burrow
#

ye

#

well latest available for 2018.3.1

dull copper
#

no idea really

#

you have the debugger to examine the code it created but, yeah, not going to be easy deciphering that

trail burrow
#

      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

dull copper
#

NativeDisableUnsafePtrRestriction sounds always safe ๐Ÿ˜„

trail burrow
#

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

dull copper
#

wonder if they'll make easier debugging for this later on

#

they did one for IL2CPP, but it's radically different thing

trail burrow
#

ye

dull copper
#

like, you can now breakpoint and step through your managed code while running IL2CPP compiled version

trail burrow
#

yeah i noticed that, never tried it tho

dull copper
#

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 ๐Ÿ˜„

trail burrow
#

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

#

ยฏ_(ใƒ„)_/ยฏ

dull copper
#

@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

trail burrow
#

Hmm I should do that

dull copper
#

@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

dull copper
#

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

coarse turtle
#

ah cool, I'd have to try out that scene -> world conversion

dull copper
urban rivet
#

Scenes are prefabs as far as I know under the hood somewhere

#

Also what has happened to the scene-fragment concept?

dull copper
#

scene-fragment what? ๐Ÿ˜„

#

oh, I think I know what you mean

#

"Available in Preview in 2018" ๐Ÿค”

#

I haven't heard anything about that

urban rivet
#

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?

dull copper
#

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

#

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

coarse turtle
#

ah cool, thanks for the info @dull copper

dull copper
#

made a post so people can copy/paste the manifest

urban rivet
#

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

dull copper
#

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

urban rivet
#

I'd have it by now if not for annoying distractions from improbable

dull copper
#

๐Ÿ˜„

#

well, as much as many dislike the whole drama, it did change things for better

#

so it was actually a good thing

urban rivet
#

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?

dull copper
#

I honestly don't know how prefabs fit into this right now at all, besides helping you design your level faster

solar spire
#

easy as that

coarse turtle
#

well from the most recent unite, from what I tuned in to that workflow leaned on prefab and prefab variants to bake data ๐Ÿค”

urban rivet
#

Well I love untiy, and can I have it?

dull copper
#

@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)

urban rivet
#

scene makes sense since it'll be filled with prefabs, right?

dull copper
#

I guess

urban rivet
#

sometimes you go too technical and think too much. embrace your inner idiot and it all makes sense

dull copper
#

they did give some mixing info about the megacity earlier too

urban rivet
#

still if it's REALLY that easy...

#

โค

dull copper
#

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

#

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).

dull copper
#

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)

dull copper
#

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.
urban rivet
#

Yes there are some nice changes. I'm still wondering how lod and all that will be addressed as well

dull copper
#

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

solar ridge
#

Drat! still no string/array in IComponentData support soarynLOL

dull copper
#

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");

soft nova
#

Where is that RenderMeshSystem located? I can't find it

dull copper
#

@soft nova it's in the Hybrid Renderer, it's a separate package

#

it doesn't show up in package manager automatically yet

soft nova
#

Well I do see it on the package manager, trying to see how they modified it

dull copper
#

oh, they must have enabled it then ๐Ÿ˜ƒ

soft nova
#

Yeah seems like it

#

Good to know that now I can delete my WorldMeshBoundsComponent since it didn't exist before ๐Ÿ˜ƒ

dull copper
#
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 ๐Ÿ˜„

soft nova
#

Yeah, that's why I asked you were it was located since all my code were giving me errors because of that change

dull copper
#

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

urban rivet
#

i like it

solar spire
#

please don't limit the spam, you're helping me keep up to date ๐Ÿ˜›

trail burrow
#

Morning o/

solar ridge
#

Spam more spam more ๐Ÿ˜‰ However I had read all that on the github, it is nice to see on here too soarynHappy

dull copper
#

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

trail burrow
#

@dull copper where do you live man, no matter what hour I'm on at you're always online lol

dull copper
#

ikr

#

I actually live in your neighbor

trail burrow
#

Inside my neighbor

#

?????

dull copper
#

lol

trail burrow
#

That seems awfully awkward

dull copper
#

more like one country to the east

trail burrow
#

Ah right

#

.fi

dull copper
#

yes

trail burrow
#

Finlands sak รคr vรฅr!

dull copper
#

yeah, I don't really talk that language ๐Ÿ˜„

#

but you probably know they force us to

trail burrow
#

@dull copper yeah I know

dull copper
#

it's silly

trail burrow
#

Yeah I Never understood why

dull copper
#

imagine you'd have to know how to talk finnish ๐Ÿ˜„

#

such waste

trail burrow
#

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

dull copper
#

that seems to be a really common skillset there ๐Ÿ˜„

trail burrow
#

Haha

dull copper
#

but yeah, I'm actually going to get some sleep now (plus I don't think people meant we should spam offtopic here ;D)

trail burrow
#

Night o/

dull copper
#

o/

trail burrow
#

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

#

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

silver dragon
#

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
#

@silver dragon it only breaks on 2018.3

#

Works fine on 2019.1 for me as is

silver dragon
#

@dull copper Prefer using stable editor, packages are unstable enough ๐Ÿ˜ƒ

dull copper
#

Some people also just added the missing package manually

silver dragon
#

Package manager didn't show the missing package (in 2018.3), where did you get it?

mint iron
#

hey anyone seen a Native PriorityQueue yet?

dull copper
#

@silver dragonhttps://forum.unity.com/threads/entities-preview-23-package-contains-invalid-references.614599/#post-4116799

silver dragon
#

thx, seems i missed that...

mint iron
#

im seeing such massive improvements from burst jobs, i feel like its christmas

dull copper
#

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

mint iron
#

that one guy with a Pentium DX66 trying to play your game

#

haha

dull copper
#

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

mint iron
#

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)

dull copper
#

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

mint iron
#

good info, thanks

dull copper
#

without Burst, it should just work, ECS is just c# code in this context

mint iron
#

gotcha, yeah right now im not using ECS, just burst jobs to speed up my code.

dull copper
#

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

foggy chasm
#

having yet another conversation with my artists about why everything can't be 4k/uncompressed/mips

dull copper
#

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

urban rivet
#

Amplify can't really sell it because Granite is having a wiggly eyebrow at possible patent infringements (even if peripherally)

coarse turtle
urban rivet
#

(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

dull copper
#

@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

urban rivet
#

It was implied in chats, so I would give it a gossip sticker.

#

I chat to them sometimes on skype

dull copper
#

it would explain why they never really gave clear answer

urban rivet
#

can't really.

dull copper
#

makes sense

#

I would have bought their thing over Granite any day, I like Amplify

#

they also give full sources

urban rivet
#

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

dull copper
#

yeah, that's true

urban rivet
#

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 ๐Ÿ˜ฆ

trail burrow
#

i can't make my custom serializer job in burst

#

literally tried everything

#

just hard crash every time

#

i surrender

mint iron
#

comment out functionality until it works, then add functionality back ๐Ÿ˜ƒ

rugged wagon
#

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?

urban rivet
#

@trail burrow at least you don't need to worry about TOS

trail burrow
#

@urban rivet lol

mint iron
#

aww yeah, my a* navigation runs 5x faster in burst jobs ๐Ÿ˜„

urban rivet
#

oh sweet!

#

only 5x tho? did you turn off error checking and make a release build?

mint iron
#

no, not yet, i just managed to get it working so completely unoptimized

urban rivet
#

Then when the special buttons are pressed, it will be a lot faster still ๐Ÿ˜„

mint iron
#

this is magnificent ๐Ÿ˜„ burst is best thing since sliced bread

urban rivet
#

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

mint iron
#

its going to take some experimentation to figure that out over time

urban rivet
#

Generally it will be faster anyway, but there's 5x and 15x and I definately want to know the latter!

mint iron
#

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)

urban rivet
#

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

mint iron
#

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();
urban rivet
#

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

mystic kraken
#

Oh Hippocoder, just wanna say, huge fan of you on the unity forums

#

youve helped me loads over the years haha

urban rivet
#

I had no idea. I've gotten to the point where I google, and answer myself from the past

trail burrow
#

So the new hybrid renderer

#

What.... is that

#

Is that related to SRP or the ECS?

#

Im confused

soft nova
trail burrow
#

@soft nova that doesn't really explain what it is tho

dull copper
#

@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

#

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);```
trail burrow
#

@dull copper how fast/slow is this?

#

Can serializer be used in real time?

dull copper
#

I have no idea, discovering this all myself now

trail burrow
#

Json will suck but assuming you can use binary also

dull copper
#

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

trail burrow
#

So this new renderer

#

What.... Is it

#

Like what part of the rendering process is it responsible for

dull copper
#

I think the word renderer is kinda misleading here

trail burrow
#

Is it meant to compete with SRP?

#

I'm assuming no

dull copper
#

it's part of the renderer that does the cullings and lod logic etc

trail burrow
#

Ah

dull copper
#

you'd still use this WITH SRP

trail burrow
#

Okay

#

Yeah naming is not clear

dull copper
#

I also don't think calling it Hybrid is making it any more clear either ๐Ÿ˜ƒ

trail burrow
#

Yeah

#

Because the hdrp is a hybrid clustered renderer isn't it

#

But hybrid there means something different

dull copper
#

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

trail burrow
#

Yeah okay so this new ecs thing is basically an lod/culling system

#

Mostly for static geometry I assume?

#

For now

dull copper
#

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

trail burrow
#

Okay that's nice

dull copper
#

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 ๐Ÿ˜„

solar spire
#

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] ๐Ÿ˜›

dull copper
#

but their "new" Hybrid Renderer already does ๐Ÿ˜„

#

so basically, we are still missing the Audio part right now

trail burrow
#

@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

dull copper
#

I just thought they wanted inject out so could control more how people use these

trail burrow
#

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.

dull copper
#

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

trail burrow
#

also i wish we could burst compile individual static methods

#

so we didnt have to go through jobs

dull copper
#

I think that's their long term plan

trail burrow
#

since massive threading doesn't help in the case im trying to solve

#

i need single threaded performance

dull copper
#

it's just easier to focus first on more limited systems

trail burrow
#

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

trail burrow
#

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

dull copper
#

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 ๐Ÿ˜ƒ

trail burrow
#

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

dull copper
#

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

trail burrow
#

@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,

dull copper
#

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 ๐Ÿ˜ƒ

trail burrow
#

@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

dull copper
#

sure, that's what we have now tho ๐Ÿ˜„

#

and it makes sense the implement these things one by one

trail burrow
#

or just write it single threaded for now, and not care about burst

dull copper
#

they'd never get it done otherwise

#

you'd think the burst benefits would still outweigh the overhead of the jobs in this case

trail burrow
#

potentially

mint iron
#

using jobs without burst from what i've seen so far is slower than not using jobs at all.

dull copper
#

you sure about that?

trail burrow
#

@mint iron thats just not possible

#

i mean i can say that that's just not true

dull copper
#

it doesn't sound right

trail burrow
#

i have a non-job that scales over my 32 threads

#

its pretty much insanely much faster

dull copper
#

considering you are utilizing 4-8x cores here

trail burrow
#

than using single thread

#

even withuot burst

dull copper
#

well it does make sense if you run it on a toaster with like 2 cores

#

but not in any modern pc

trail burrow
#

16c/32t cpu, the job is about 14x faster than single threaded

#

so not quite linear scaling

#

but still good

dull copper
#

for example I got two 2 core CPUs here

#

other doesn't do hyperthreading and other does

trail burrow
#

also when u profile jobs, etc. basically has to be in build

dull copper
#

running job system on the latter would give better results than in the former

trail burrow
#

as they can be sagnificantly slower in editor

mint iron
#

i thought we were talking about single threaded

dull copper
#

but of course more physical cores the better

#

ah

trail burrow
#

@mint iron im talking about how i cant use jobs to scale my workload

#

since using multi threading is not applicable

dull copper
#

fholms case is quite different from regular use here

trail burrow
#

and i would like to be able to use burst as just a method call

#

on a static method

#

on the main thread

dull copper
#

it's more about being able to run many instances of the thing on server backend efficiently

mint iron
#

if its just about style, you could wrap the job in static class to make it feel that way like i posted yesterday

trail burrow
#

my hand made native memory/network state system is still sagnificantly faster than the ecs based one on a single core

mint iron
#

i've been unable to get BurstCompiler.CompileDelegate<> to work ๐Ÿ˜ฆ

trail burrow
#

@mint iron ye i saw that also, it seemed to be experimental/api is only there for future compat

mint iron
#

they must be doing some extra magic on it, it returns a delegate that calls without crashing, but doesnt actually run.

trail burrow
#

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

mint iron
#

im on 2019 maybe its not in older

trail burrow
#

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

trail burrow
#

yeah but does it actually do something? ๐Ÿ˜›

mint iron
#

๐Ÿ˜ƒ

trail burrow
#

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

mint iron
#

hmmm

trail burrow
#

its wrapped in a deep generic and dynamically instantiated hierarchy tho

#

so burst compiler probably misses it

dull copper
#

tbh, you are using it in very different way than avg user would ๐Ÿ˜„

trail burrow
#

that

dull copper
#

but weird that burst compiles it but doesn't show it in inspector, are you sure about that?

trail burrow
#

@dull copper 100%

mint iron
#

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

dull copper
#

I do have to refresh that inspector myself too for that to show anything

trail burrow
#

@mint iron right now it seems like the burst compiler cant even find it

#

@dull copper i tried everything, including restarting unity several times

dull copper
#

can you see other burst code with the inspector?

trail burrow
#

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

dull copper
#

can you see somewhere if it even generated anything for that

trail burrow
#

not at my desktop atm, will dig around later

dull copper
#

you do IL2CPP btw?