#archived-dots

1 messages Β· Page 66 of 1

trail burrow
#

yeah

dull copper
#

you could see the delegates

#

ah

trail burrow
#

but it crashes in both editor (mono) and build (il2cpp)

#

so... yeah πŸ˜„

#

@mint iron so this is in a generic class (non system), inside a non-generic-system, which is instantiated dynamically via reflection

#

so it might be related

#

but i cant even get the job to show up even if i move it outside of the damn class

#

like i put it inside of a namespace only, no nested types

#

could it be because im using [NativeDisableUnsafePtr] attribute or w/e its called?

mint iron
#

wait no, i take that back, i had a compilation error πŸ˜„

#

yeah its the generic in wrapper

#

doesnt work

trail burrow
#

@mint iron thanks

#

i still cant get it to compile the full job

#

even if i move it outside tho

mint iron
#

show me the code?

trail burrow
#

not at my workstation atm

#

and i have an 11 month old baby climbing on me

#

πŸ˜›

mint iron
#

haha

#

you'll get it sorted, simplify! πŸ˜„

#

i was losing my mind yesterday trying to figure out why my job wasnt working

trail burrow
#

spent a few hours trying to get this to execute with burst, or even get picked up by the burst compiler, but no luck

#

i will keep digging later

#

i might ping you later if that is okey :p

#

im really really stuck

mint iron
#

problem turned out to be, i had a 'Result' field in my Job struct, i was trying to write to from within the job and read it as a return value. but you cant do that.

trail burrow
#

im doing some really nasty stuff with manually allocated memory and such

#

that i pass to the job

#

ill be at my workstation in 10 minutes or so

#

convinced wife i need to do something important πŸ˜„

mint iron
#

yeah that's probably why every official statement seems to be warning people about staying the hell away from unsafe, stressing saftey checks because its a huge can of worms potentially, and hard to debug in burst.

trail burrow
#

@mint iron yeah i know they keep saying stuff like this, but reality is that a lot of us do need to do use that

mint iron
#

oh yeah, i find it super interesting, am glad they for now are giving us the option, i hope it stays that way and they dont try and force people to be safe

trail burrow
#

like what im trying to do does not fit perfectly to their ECS model, the way i need the data arranged in memory for delta compression and stuff

#

i cant do that directly on top of the chunk memory

#

i need to get the data out of the entities in a bit-packed and well defined format that my delta compressor understands

#

i just wish they had a 'disable all our safety checks because i know what im doing' mode

dull copper
#

you'd think those checks would also safe guard from some edge cases they know they won't support as well (just guessing)

trail burrow
#

yeah maybe

#

@mint iron at my workstation now, lets see

#

(if you time?)

#

its instantiated like this inside of the containing system (SerializerSystem):

    protected override void OnCreateManager() {
      _componentGroup = GetComponentGroup(
        _replicationModel.ComponentTypes.Concat(new ComponentType[] { ComponentType.Create<NetworkedEntity>(), ComponentType.Create<NetworkedOwner>(), ComponentType.Create<NetworkedDirty>() }).ToArray()
      );

      {
        // initialize serializer array
        _serializers = new Serializer[_replicationModel.ComponentModels.Length];

        // create serializers via reflection
        for (Int32 i = 0; i < _serializers.Length; ++i) {
          _serializers[i] = (Serializer)Activator.CreateInstance(typeof(Serializer<>).MakeGenericType(_replicationModel.ComponentModels[i].Type.GetManagedType()), _replicationModel.ComponentModels[i]);
        }
      }
    }
dull copper
#

I like your namespace πŸ˜„

trail burrow
#

burst inspector gives me this

#

first thing i tried is moving the job to the system itself, so out of the nested class

#

it does not help

#

burst inspector still will NOT pick it up

#

even removing the whole ReadField method does not help

mint iron
#

mmm, i now have my coffee ready

#

slurp

dull copper
#

but you don't even have BurstCompile tag there?

trail burrow
#

@dull copper oh sorry, it doesnt change if i add it, i removed it before

#

still wont show up

#

okey so added back burst tag

#

and put it outside of the wrapper class

#

still will NOT show up

#

and crashes editor whenever i run it

dull copper
#

I'd try some minimal repro case, see what in that breaks it

trail burrow
#

removing the native memory pointer doesnt help either

dull copper
#

if it's something that should work by design with it, file bug report with it

trail burrow
#

that still wont show up

mint iron
#

what version of unity are you on

trail burrow
#

2018.3.2

#

released yday or something

#

could it be because it's a nested generic job, instead of a generic system with a job on it?

mint iron
#

mmm i was gonna just get it to show up in my inspector but IJobChunk interface is different for me it seems

namespace Unity.Entities
{
  [JobProducerType(typeof (JobChunkExtensions.JobChunkLiveFilter_Process<>))]
  public interface IJobChunk
  {
    void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex);
  }
}
trail burrow
#

maybe ijobchunk doesnt support burst?

#

i got it to compile now

#

its because it cant resolve the generic types when its instantiated via reflection

#

i added a Job<Health> test = new Job<Health>();

#

and then that shows up

#

so... thats annoying as hell

#

then i need to code gen a long list of jobs type

#

lets see burst vs non burst speedup then

#

yeah it still hard crashes lol

#

sigh

#

even crashes when i try to show the LLVM IR for some of the jobs

#

😦

mint iron
#

for me it really doesn't like your generic class definition as soon as i comment out public class Serializer // <T0> : Serializer where T0 : struct, IComponentData it shows in inspector

trail burrow
#

weird

#

but this method

#

      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;

          case ReplicationFieldType.Float: {
              var val = *(Single*)(addr + field.Offset);
              if (val != current->Float) {
                current->Float = val;
                dirtyFields[field.Offset] = 1;
              }
            }
            break;

          case ReplicationFieldType.Mathematics_Float3: {
              var val = *(float3*)(addr + field.Offset);
              if (val.Equals(current->Mathematics_Float3) == false) {
                current->Mathematics_Float3 = val;
                dirtyFields[field.Offset] = 1;
              }
            }
            break;

          case ReplicationFieldType.Mathematics_Quaternion: {
              var val = *(quaternion*)(addr + field.Offset);
              if (val.Equals(current->Mathematics_Quaternion) == false) {
                current->Mathematics_Quaternion = val;
                dirtyFields[field.Offset] = 1;
              }
            }
            break;
        }
      }
#

is what crashes it atm

#

comment out that and im good, run it, and it explodes

#

i know the code is valid, because it does run without burst, both in mono and il2cpp

mint iron
#

thats progress!

trail burrow
#
              var val = *(float3*)(addr + field.Offset);
              if (val.Equals(current->Mathematics_Float3) == false) {
                current->Mathematics_Float3 = val;
                dirtyFields[field.Offset] = 1;
              }
#

its the switch case for float3

#

which crashes it

mint iron
#

woo!

#

do you mean for it to be a vector?

trail burrow
#

well it uses the float3 type

#

it's the Equals call

#

that crashes it

mint iron
#

ahh yep

trail burrow
#

it doesnt even suppoer instance calls on blittable structs on the stack?

#

actually i think it's this line

#

var val = *(float3*)(addr + field.Offset);

#

because without the if case, then i think that line gets eliminated

#

but if i do this:

              var val = *(float3*)(addr + field.Offset);
              current->Mathematics_Float3 = val;
              dirtyFields[field.Offset] = 1;
#

still hard crashes

#

deleted the quat/float3 serializers, just wanna see perf vs non burst

#

I'll setup a small repro case and report a bug

#

feels like something is wrong here

#

some performance tests

#

to serialize 100k entities with ~30 fields (mixed float/int) each:

non-burst: 3.5ms
burst: 1.9ms
mint iron
#

that seems like a worthwhile boost

trail burrow
#

this fully saturating 16 cores tho πŸ˜„

#

but yeah decent speedup for sure

#

@mint iron thanks for the help btw

mint iron
#

np πŸ˜„

dull copper
#

I found a workaround (by accident) on how to force Unity to do that

#

just noticed it while fixing something totally diffferent

#

tbh, I don't know why they don't setup it like this by default, it totally should put all packages to your solution for pure convenience (instead of making you rely on metadata)

#

anyway, how you do this is bit hacky and not that nice for project where you want to update the packages constantly, but if you work on specific package version and try to figure things out, having it on same unity solution is golden

#

so, here's how it works:

- go to your projects `Library/PackageCache` -folder and move `com.unity.entities@0.0.12-preview.23` etc under your project `Packages` -folder
- while still in `Packages` -folder, open manifest.json and remove the entry to entities package from the json file (any package folder found under Packages will automatically be picked up and you want the pacman to pick your local package instead of the one from cache)
- open project again and open any script file through it, it will regen the solution and now all ECS related packages are also in your solution```
or simpler version would be just
```- don't install Entities through package manager at all, make sure it's not in your manifest
- copy entities package into your projects Packages folder from some other project's cache or from your user/appdata's package cache
- open unity editor and open any script file through it```
#

in case you need to update the entities package, you can just do the latter version..

#

huge downside of all this is that when you actually use local package, you can't see through package manager that there could be a newer version for it (as local package always overrides everything for it)

trail burrow
#

@dull copper oh cool

#

Yes that was me

#

Perfect

#

Tyvm!

dull copper
#

np

#

in case of entities package, this brings all Unity.Entities and Unity.Transform packages to solution

#

you can repeat the same thing obviously for all packages you need it to work like that

#

would probably be nice to pick actually all these Entities dependencies there too

#

so you'd get full burst, jobs, collections, mathematics there too

trail burrow
#

Ye, cool I will try later today

#

Still stuck with the baby lol

dull copper
#

that's with those

#

that should help debugging and figuring these out a lot πŸ˜„

#

I just wish I had realized this earlier

trail burrow
#

Haha ye, it's convenient to have it all in the solution

dull copper
#

have just opened individual files so far for these

trail burrow
#

Ditto

#

So annoying

dull copper
#

but you can't jump around the code then with IDE

dull copper
#

oh, you also need com.unity.test-framework.performance apparently too if you do this, but then again, I think that was requirement on 2018.3 already (testing this on 2019.1)

#

also may want to add com.unity.rendering.hybrid πŸ˜„

trail burrow
#

@dull copper ha

dull copper
#

bit offtopic but I sometimes wonder if Unitys own HDRP team is aware you can place custom packages in Packages folder

trail burrow
#

I'm going to skip that for now

dull copper
#

they always put them in some other folder and then put relative link to manifest for the file

trail burrow
#

The baby is doing his best to destroy the family iPad but at least he's not bothering me

dull copper
#

they've done this for FPS Sample, Book of the Dead environment and Fontainebleau demo

#

#CheapToys

trail burrow
#

Yes but iPads are pretty resilient

knotty radish
#

@dull copper Hi, just read your message about moving packages to /Packages.
Not sure if it has changed or not but you won't be able to update any package inside that folder (at least it was like that last time I tried)

#

It's like not using packages at all

dull copper
#

@knotty radish that hasn't changed, that is what I tried to warn as being a huge downside of all this πŸ˜ƒ

#

I did notice that on 2019.1, pacman can still see the other versions but you can't update to them as long as you use local package

knotty radish
#

Missed that part haha

dull copper
#

but the main thing here is that if you want to debug or even learn how entities internals work, you really benefit from having these included on your solution

#

as otherwise you'll only get metadata with VS when you try to follow up what part does what and you can't trace things back so far

#

if there's some better way on getting these included on your solution, I'm sure many would love to know, I just discovered this hacky workaround today so shared it πŸ˜„

knotty radish
#

Yes, for my own packages that's what I do. I have a Unity project looking for a local package and with that I have access to that package through VS

#

So either you put the package inside Packages or you put it somewhere else and just add the path in the manifest

dull copper
#

yeah

#

or add git repo path there

#

that works now as well

#

(as long as the git repo is in package format)

#

I dunno how well the live updates work on the git thing tho, haven't used it much

#

I actually use file approach for manully cloned git folder for SRP

#

but that's mainly because I can control git directly for that then

knotty radish
#

Doesn't really work since when it pulls the repo the commit sha will be saved inside the manifest

#

So you would not be able to update that package

dull copper
#

unless you wipe the hash manually?

knotty radish
#

Exactly

dull copper
#

I could swear I read how that worked (and probably quoted on the forums too) but never did that myself πŸ˜„

#

yeah, in that case, it would be nice to be able to control it a bit better

#

I can see benefits from it not automatically updating

#

but "git pull" would be nice option for it

knotty radish
#

Yeah

dull copper
#

re: Packages folder, of course if you update the contents inside that folder yourself, they will be used as is as that's in that case the actual files used in your project

#

(just clarifying that if others read this)

knotty radish
#

I also used that technique in order to fix something in the Addressable package until unity do the fix on their side

dull copper
#

yeah, I did same today for visual effects graph on 5.2.3-preview as it doesn't work on 2019.1.0a13

#

there's small API change

#

Unity has actually planned having some option on pacman for moving the thing as local package for modifications

#

I hope they let you also update those later on if they are things that pacman lists normally

knotty radish
#

For anyone working on mac and on latest versions of ECS / Burst, know that VS latest update do not have the correct C# SDK which is 4.7.2, you need to update mono yourself then change default mono target in VS preferences to make it work.

dull copper
#

@knotty radish I had that on windows few weeks/month ago as well

knotty radish
#

The difference is that on windows you have VS Installer where you can easily download that SDK

#

Don't have that on mac :/

dull copper
#

my VS just directed me to a MS website for installer, I swear πŸ˜„

#

(I know there should be or used to be built-in option for that)

knotty radish
#

It's not a really big issue since in the next update of VS Mac it will have the new SDK, it's just that at the moment it's not here yet

gusty comet
#

Hi guys :)
I was just trying to build and run ecs samples (that I renamed Hello World because I have several).
But it seems like I have something missing for burst. I can see burst is downloaded (PM and on the disk). So do I miss something?

dull copper
#

@gusty comet you have visual studio's c++ toolchain installed?

#

I'm not 100% sure it's requirement for Burst but have seen people having issues building with Burst without it

gusty comet
#

@dull copper Yeap 2017 installed

#

oh wait maybe I still havent installed C++ tools on this one :0

dull copper
#

I mean, you have the c++ toolchain installed along with 2017?

#

it's not there by default

gusty comet
#

had some llvm problem because of it last time

dull copper
#

you have to separately select it

gusty comet
#

Seems like I didn't, going to try again after the update ^^

dull copper
#

I always have that on my end as I need c++ for other things + I use IL2CPP which also requires it πŸ˜ƒ

gusty comet
#

Yeah can't you download MSVC++ compiler whitout VS?

dull copper
#

it's part of the VS installer

#

you should be able to run the installer on preinstalled VS2017 and just add things with it

gusty comet
#

I'm using VS Code at the office (probably gonna swithc back to neovim/linux), had to reinstall VS just for that because I was in a hurry x)

#

@dull copper That did the work thanks πŸ˜„

dull copper
#

cool, lucky guess πŸ˜„

mint iron
#

anyone know if burst plays nicely with extension methods?

trail burrow
#

@mint iron it's just a static method call so yes, assuming you obay the other limitations for Burst then np

gusty comet
#

Somebody has been through the last ECS update? HLOD was already there before so that was maybe already the case. But I'm not sure (currently reading source code) if nested lodgroup is supported. Or is it simply going to use the Parent attribut?
Oh well I guess it's not supported :

if (parentLodGroup.ParentGroup != Entity.Null)
    throw new System.NotImplementedException("Deep HLOD is not supported yet");
dull copper
#

@gusty comet you probably know you now need Hybrid Renderer for the rendering stuff on ECS

gusty comet
#

Yeah that's the code source from it, seems like I can use nested lodgroup, just not with HLOD strategy

#

And I think that the ParentMask allow me to tell that the group is gonna replace a specific lod level from the parent

#

Sounds nice ^^ I need to try it on a test project now

#

@dull copper Maybe you did try something like that?

dull copper
#

nah, I only played briefly with the conversion tool

#

been investigating other things lately

mint iron
#

What's the status on bubbling error/exception info out of burst code. I see that it won't compile with a string arg in your exception.

Looks like its just interpolated strings and ToString() it doesn't like.

dull copper
#

that blog post contains a snippet that lists all Job Safe APIs from Unity

#

We’re now up to 301 job-safe APIs, but many of them are private or internal to Unity and so must be called indirectly via a public API.

urban rivet
#

Oh nice he's posted a new blog lets take a look... I guess this will change as Unity moves more perf critical engine code to the C# side. You're going to have to keep some API's closed when you have this huge barrier to cross as well

#

Going to be a weird time when they do that, because it'll be the same problem in reverse.

median snow
#

hello there, anyone tried to use the new WorldDiffer feature?
i have 2 different worlds, one with a lot of entities and the other is just empty. But when I call the UpdateDiff method it returns a zeroed WorldDiff struct

var worldDiff = WorldDiffer.UpdateDiff(m_SimulationWorld, m_StateWorld, Unity.Collections.Allocator.TempJob);
gusty comet
#

Guys, just to be sure. exception on Deep HLOD not supported occur when I try to add 3 level of group lod. Even whitout HLOD tag, is that normal?

median snow
#

managed to get the WorldDiffer working, you have to add an EntityGuid component to the entities that you want to map in the diff

entityManager.SetComponentData(entity, new EntityGuid { a = (ulong)entity.Index, b = (ulong)entity.Version });
spark moon
#

Hey guys.

#

Updated to p23 and now EntityCommandBuffer.AddSharedComponent doesn't accept SharedComponentData with entities (why ever). Wouldn't be bad for me, if I wouldn't transport my reference to my GameObject with it. What I'm actually doing: my UI has a button for a skill. When pressing the button, I create a SkillActivatedData SCD and add a GameObject prefab reference to the SCD. Now a different system will take this SCD and the player, check if he has enough energy and actionpoints to do the skill. If so, it creates a SkillData (different data, this time with the actual effect, time, damage values,...) and takes the GameObject reference to visualize the effect. That's not working anymore :<
Anyone has a workaround for me or can tell me how you're handling this kind of problem?

mint iron
#

gawd, spent far too long tryign to figure out why burst was giving the error 'System.NotSupportedException: The `try` construction is not supported by burst when i wasn't using that construction. Turns out it gives you that misleading error when you use a 'foreach', which was in some innocuous down line math library :S

gusty comet
#

Do someone know if there is (I think I saw it) an attribute to say update the system if a component has been modified (a shared component in my case) ?

dull copper
#

oh wow, I didn't realize they wiped almost all old ECS examples out on latest sample update

#

there's only Boids and new HelloECS (3 samples) now

#

probably for the good too, old samples were kinda just stuffed there

gusty comet
#

yeah definitely the right choice to remove deprecated samples ^^

gusty comet
#

Okay I gues I shouldn't have wanted to use the full API the first time on a case like that but... how do I do a jobsystem using CombineMeshes ? Let's say I have a entity with a list of childs (entities) with a tag to activate the job and them it check the list of childs and combine their MeshRender to create a new mesh and put it inside the main entity.

thorn wing
#

I'm trying to do/follow the ECS videos on the Unity learning portal... I don't have "Mesh Instance Renderer Component" and I can't find what package it's included with. Does anyone here know?

coarse turtle
#

@thorn wing hey you want to get the Hybrid Renderer package and use the RenderMeshComponent instead

thorn wing
#

Just found this in the ECS sample project, is any idea if it's the latest version?

"com.unity.rendering.hybrid": "0.0.1-preview.3",

coarse turtle
#

yeah, that should be the latest one

thorn wing
#

cheers!

#

Bit of a pain in the ass to find this info

dull copper
#

@thorn wing Package Manager should offer you latest versions

thorn wing
#

Unity.Rendering isn't in the Package Manager, as far as I can see

#

Oh, no, it is. as "Hybrid Renderer" ..

dull copper
#

yeah, that's the one

#

they moved all rendering stuff out from Entities package

#

old and new rendering things are now at Hybrid package

slow jasper
#

@thorn wing https://bintray.com/unity/ you can check here both the stable and staging packages and what version the latest is

gusty comet
#

Hey guys,
I have some troubles with procedural meshes. I have a lot of different meshes that I want to merge (as a part of the LODs system), at some specific moments (player actions and AI). I was hoping to use some burst optimized jobs. but modifying shared component, especially in a job isn't really the best idea ever. I guess I could create some components with some blittable array (btw is there still no support for that stuff from Unity?) and having a custom rendering system. But I don't really want to cut myself from ecs updates. So I'm using MeshRenderer with a bunch of entities specially to manage the LODs System but it doesn't seems like it's possible to use combine meshes and update the RenderMesh component inside a job. Or I'm wrong? Well what would be a good approach of this problem?
Thanks πŸ˜ƒ

coarse turtle
#

Hey @gusty comet , I haven't played too much with the new rendering system lately, but CombineMeshes may not be thread safe - I'll have to look at it further

#

if you could store the vertices in a NativeArray and then construct the mesh that might work πŸ€”

gusty comet
#

@coarse turtle it doesn't need to be thread safe. It's a readonly process. So yeah your guess would be having a custom mesh + a convertion system i guess?

#

Btw Γ  native array? I can't have them inside a component right?

thorn wing
#

I've been following the videos, and then found this post https://software.intel.com/en-us/articles/get-started-with-the-unity-entity-component-system-ecs-c-sharp-job-system-and-burst-compiler

I've got the code the same, but in MovementSystem, on line 41 I'm getting an error for 'this'. Saying cannot convert from MovementSystem to int

#

If I put this: JobHandle moveHandle = movementJob.Schedule(this);
Instead of this: JobHandle moveHandle = movementJob.Schedule(this, 64, inputDeps);

It compiles.

quiet gull
#

iirc the batch count was removed in some version, that's why

#

Yeah, in 0.0.11
IJobProcessComponentData.Schedule function no longers takes the number of batch iteration count. Batch iteration count is now always implicit to be the size of a whole chunk. This requires changing all code using IJobProcessComponentData.

thorn wing
#

thanks

dull copper
#

@thorn wing if you see old tutorials, you see a lot of [Inject] in them, that is going away in the future too

#

so don't rely on it too much if you are learning Unity's ECS for future use

#

that being said, Unity itself still uses that in the "new" Hybrid Renderer :p

#

they tell others it's going away, yet they keep releasing their own packets that rely on it. that's not the right way to show example to others :p

thorn wing
#

Difficult sifting through stuff, finding the most up to date info... feel like I'm getting in too early

solar ridge
#

GDC will likely be their next big push so all the deprecated things COULD be gone by then. Would help with the sifting

#

That is purely a guess though

dull copper
#

I really think the main limiting factor atm is Unity's own systems relying on it

thorn wing
#

There must be a better way ?

#

(also, how to post code nicely here)

coarse turtle
#

A backtick followed by another back tick

#

Yep what down below said

quiet gull
#

```cs
// code
```

thorn wing
#

doesn't want to do it in an edit

coarse turtle
#

Btw, I highly recommend going through the forums and viewing the code snippets posted there

#

you can start piecing together the structure and the new APIs

#

and since [Inject] is going away sometime, the ComponentGroup API

#

isn't going to change too much, so you probably want to switch to using that

coarse turtle
#

@gusty comet you can have a NativeArray in a SharedComponent instead - sorry I missed the question

gusty comet
#

Well I'm not going to spam shared component for fun x) it's already a problem to have a render mesh as a shared component, for my case.

urban rivet
#

So... graph based ECS is a thing now?

#

I wonder if this will be jobified also

solar ridge
#

Graph... based?

#

@urban rivet to what are you referencing? πŸ€”

urban rivet
#

Unity's visual scripting is ECS/DOTS based now

knotty radish
#

@urban rivet is there a thread or blog post about this ?

dull copper
#

@knotty radish there's a forum thread

solar ridge
#

πŸ€” πŸ€” πŸ€”

#

Also. Everytime I see DOTS I dont see Data Oriented Tech Stack but rather Damage Over Time 'S'

dull copper
#

https://forum.unity.com/threads/unity3d-getting-visual-scripting-in-2019-2.577084/page-2#post-4146832:


With Unity quickly moving to DOTS (Data Oriented Technical Stacks - our ECS framework) we had to reconsider our original VS release strategy. We are now stopping development on our monobehavior solution and moving to VS for DOTS exclusively. This will enable the team to focus on one tech and improve our overall long term velocity.

Before making this decision, we asked ourselves about the consequences for our monobehaviour users. We came to the conclusion that since good monobehaviour VS solutions exist already in the Asset Store, we had to prioritize DOTS. It is very important to provide a way for non-programmers to interact with ECS. There are a lots of tools we will need to rebuild for DOTS and VS will be a big part of it.

Unfortunately this will delay our first release to public that was scheduled for 2019.2. In the meantime, we are going to share regular incremental releases with the community through the DOTS forum. These will be bleeding edge releases that will have issues and that are not intended for production use. We will be sharing current state of work to be fully transparent and to gather your feedback.

The overall goals remain unchanged and VS will still be a non-programmer friendly way to create script in Unity.

I'm sure you will have many questions, so please ask away! ```
solar ridge
#

Ah

#

Interesting to see the stopping of the GO for Visual scripting

#

Im not surprised, just interesting

dull copper
#

I'm sure they'll talk more about this change at GDC

solar ridge
#

Yea

dull copper
#

or at least have some new target for it

solar ridge
#

Same deal as last year. Lots of "OOoooooh" but more info is done in March

knotty radish
#

Thanks!

solar ridge
#

Curious if we will see the arrays and strings problem sorted by then πŸ˜ƒ

knotty radish
#

Strings are already "solved" in the new version

solar ridge
#

Oh?!

knotty radish
#

Is that not enough ?

#

You can have 3 different size of string now

solar ridge
#

Then all that is left is arrays (unless that is solved) then I wont need to reinvent the wheel converting an API level json to an arbitrary entity

knotty radish
#

Well Arrays could also be used with DynamicBuffer but I would opt for refactor from scratch for a use case like yours

solar ridge
#

My case scenario: I unfortunately dont have control over what is sent to me via json object

knotty radish
#

(Not saying it's easy or it won't take long to do, just saying what's best case for the thing you are building)

solar ridge
#

As for the string support. Which version is this?

knotty radish
#

It's a way to use strings not something handling strings by default

#

And it's the last version so v23

solar ridge
#

Ah so not package managered yet

dull copper
#

we have access to 0.0.12-preview.23

#

it's in package manager

solar ridge
#

I just looked?

#

I assumed it was the staging packages that you manually edit the json

dull copper
#

nah, it's on main

solar ridge
#

Hmmm

dull copper
#

make sure you set package manager to show previews

knotty radish
#

"com.unity.entities": "0.0.12-preview.23"

dull copper
#

but you should still see it if you have any entities package installed

#

these are the latest things on regular registry: ```json
{
"dependencies": {
"com.unity.burst": "0.2.4-preview.41",
"com.unity.collections": "0.0.9-preview.11",
"com.unity.entities": "0.0.12-preview.23",
"com.unity.jobs": "0.0.7-preview.6",
"com.unity.mathematics": "0.0.12-preview.19",
"com.unity.rendering.hybrid": "0.0.1-preview.3",
"com.unity.test-framework.performance": "0.1.50-preview",

#

you need to add that rendering.hybrid manually to manifest atm I think

#

at least I didn't see it listed today

knotty radish
#

I saw the hybrid rendering in the package manager so it should work

dull copper
#

you also need that test framework now with preview.23 or you get some errors

#

I could swear I saw the Hybrid Renderer listed when it released

#

but I didn't see it today (could be 2019.1 related thing)

solar ridge
#

I actually grabbed the hybrid in the manager

#

However, It looks like I will need to manually edit the json for preview 23

#

As it says Im up to date with 21

#

2019.1a14 ... assuming that is the latest alpha atm

knotty radish
#

2019 beta is out

#

But you should see everything if you have preview packages shown in the package manager

solar ridge
#

Ah

#

Ok then there may be my issue

dull copper
#

all 2019.1's should show it

solar ridge
#

I'll double check in a few mins

dull copper
#

they upped the min engine version on preview.22 from 2018.2 to 2018.3

knotty radish
#

Do you have the registry targeting staging ?

dull copper
#

you don't need staging for this

#

that snippet I just posted is working on my end

#

but staging has the same packages (and tad newer mathematics)

solar ridge
#

Also, this is what I need IComponentData to be able to handle ;)

public struct APIMessage : IComponentData {
    public string type;
    public Data data;

    public struct Data {
        public string id;
        public InternalData[] randomBlobs;
        
        public struct InternalData {
            public int[] something;
        }
    }
}
#

something like that.

knotty radish
#

Can't handle list of list at the moment, need to find another way (not sure it will ever change)

solar ridge
#

Would it be feasible assuming randomBlobs wasnt an array?

#

Still likely would break on "something"

knotty radish
#

Yeah you could put a buffer on that entity and have an array of Data (without randomBlobs being an array)

#

Then you would fetch APIMessage and the Buffer (which are on the same Entity)

solar ridge
#

@knotty radish any docs on how one would utilize strings in p23?

#

Unless you meant the NativeStrings πŸ€”

#
  // If you need to store the text of "War and Peace" in a single object, you've come to the wrong place.

Looooool

#

Interestingly NativeString64 is not blittable

#

While NativeStringView is

knotty radish
#

Haven't seen any docs yet

solar ridge
#

So far have yet to find any string support that is really viable atm soarynSad

#

At the very least, no where that I can do it without using "unsafe"

#

Since NativeStringView needs a char*

knotty radish
#

Doesn't NativeString512 or NativeString4096 fit your needs ?

solar ridge
#

Those are nonblittable

#

NativeString64 was fine

knotty radish
#

Hum it's inside Entities package

solar ridge
#

Doesnt entail that it is blittable though

#

I dont see a reason for it not to be

#
        Debug.Log(UnsafeUtility.IsBlittable<NativeStringView>());
        Debug.Log(UnsafeUtility.IsBlittable<NativeString64>());
        Debug.Log(UnsafeUtility.IsBlittable<NativeString512>());
        Debug.Log(UnsafeUtility.IsBlittable<NativeString4096>());
True
False
False
False
#

And as I mentioned, NativeStringView is blittable, but the only way to actually set it, is to be in unsafe context, which seems like a weird requirement to use a string :\

#

Understandably it is doing unsafe context in the backend, but on this level it probably shouldnt be needed

knotty radish
#

I think Words.cs give a little bit of explanation about these things

solar ridge
#

That is where I am looking

#

Though

#

I can at least use words to gen a StringView

knotty radish
#

Words should be usable in a IComponentData struct

#

Yeah but it may not work inside a job

#

(since it's using a singleton from somewhere else)

solar ridge
#

so does the setString

#

Hmmm

knotty radish
#

But at least in a system update loop it will work

#

That would be a ECS solution while not being jobifiable

solar ridge
#

Im a little sad there is not an implicit conversion between string and say NativeStringView

solar ridge
#

The words/NativeStrings are not serializable soarynPalm

solar ridge
#

Hmmm is there an ECS equivalent to JsonUtility?

dull copper
#

@solar ridge ECS package tests seem to use JsonSerializer.Serialize()

#

dunno if that really helps anything

#

also don't ask me where that is from (JsonSerializer they use), just saw they use it πŸ˜ƒ

solar ridge
#

They get it from their Properties namespace. πŸ€”

#

So... It has to be a reference type to use that soarynThink but... that means it works completely against IComponentData

#

Confused...

dull copper
#
public static string Serialize<TContainer>(TContainer container, JsonPropertyVisitor visitor = null) where TContainer : class, IPropertyContainer;
public static string Serialize<TContainer>(ref TContainer container, JsonPropertyVisitor visitor = null) where TContainer : struct, IPropertyContainer;
solar ridge
#

Deserialize

#

That is my current issue

#
public static T Deserialize<T>(string json) where T : class, IPropertyContainer, new()
#

My other option is:

public static ObjectContainer Deserialize(string json)
#

JsonUtility was nice as I could just create the structure and be done, but with this NativeStringView not having either serializable nor an implicit conversion from string, things get really iffy with json

mint iron
#

or DataContractJsonSerializer. It probably wouldn't work out of the box because its quite strict but you can customize it if you own the objects or are willing to wrap the unity ones. https://blogs.msdn.microsoft.com/carlosfigueira/2011/09/05/wcf-extensibility-serialization-callbacks/

    public static class JsonSerializer
    {
        public static string Serialize<T>(T value) where T : class
        {     
            var serializer = new DataContractJsonSerializer(typeof(T));
            using (var stream = new MemoryStream())
            {
                serializer.WriteObject(stream, value);
                return Encoding.UTF8.GetString(stream.ToArray());
            }     
        }

        public static T Deserialize<T>(string json) where T : class
        {   
            using (var stream = new MemoryStream(Encoding.Unicode.GetBytes(json)))
            {
                var serializer = new DataContractJsonSerializer(typeof(T));
                return serializer.ReadObject(stream) as T;
            }
        }
    }```
solar ridge
#

The Extensibility is nice, however most of the examples there have backing fields. You can not have backing string fields :\

solar ridge
#

Interestingly IDataContractSurrogate doesnt exist according to rider?

solar ridge
#

I can find it by "shift+shift" find in project, but it wont use it oddly

left spindle
#

Shift+shift?

solar spire
#

rider shortcut

solar ridge
#

^

#

Basically helps find files in project/solution etc

left spindle
#

Okay, feeling dumb again: "rider"?

solar spire
#

Jetbrains Rider

solar ridge
#

IDE from jetbrains

left spindle
#

Oh, okay thanks.

solar spire
#

(The superior IDE)

left spindle
#

Oh no I'm using the inferior one AGAIN?

solar ridge
#

Loool

#

Use what you want

#

But in this case

#

Which version of unity are you using atm?

#

if 2019.1b, mind checking to see if implementing "IDataContractSurrogate" compiles for you?

left spindle
#

I'm still going through the release notes for 2018.3...

solar ridge
#

Hmm "CodeTypeDeclaration" ... does unity roll its own variant of DataContractJsonSerializer? soarynScared

#

That isnt good...

dull copper
#

- Add preliminary support for burst AOT settings in the player settings```
#

that's from new burst package which still is on staging (and seems to require editor side change too so need to wait for next beta or two)

#

well, that's not really ECS news but I guess it can be seen related πŸ˜„

#

that AOT thing is needed now when apple started to reject Burst compiled things as they had burst compiled things on separate file or something

solar ridge
#

Ok. So my plan to remap the string I get from a json to the ECS NativeStringView is failing thus far because it seems The DataContractSerializer is different in unity from this msdn doc https://docs.microsoft.com/en-us/dotnet/api/system.runtime.serialization.json.datacontractjsonserializer?view=netframework-4.7.2

solar ridge
#

Ah... API compatibility layer... um wat?

#

So far has to be set to API: .Net 4.x

solar ridge
#

Newtonsoft is the answer I think for my solution πŸ€”

solar ridge
#

Curiously, in WordStorage: kMaxEntries. Is that the number of strings that can exist in total across the board? Because if you have 100k entities all storing a string, then I will hit that EXTREMELY quickly

chrome pawn
#

hey everyone, this isn't really an ECS question but more about job system and IJobParallelFor

#

so I'm trying to run a jobified marching cubes (marching tetrahedra really) on a NativeArray<float> which is basically an unrolled 3D density texture

#

so every Execute() of this job is calculating the triangles to output for that voxel. each voxel is broken into 6 tetrahedra, and each tetrahedra could contain 0, 1, or 2 triangles

#

so each Execute() needs to return between 0 and 12 triangles, but I haven't had any luck finding the right NativeContainer yet

#

I'm about to just allocate a NativeArray<Vector3> (vertices) and a NativeArray<int> (triangle indices) to worst-case size, 36 * voxelCount

#

but that seems super wasteful

#

I thought I would be able to add to a NativeList<> from multiple threads if it was [WriteOnly] but apparently not

#

I can accomplish what I want with 2x NativeQueue<>.Concurrent, but then I can only Enqueue

#

I saw a code sample online where the author appears to implicitly cast a NativeQueue<> to a NativeQueue<>.Concurrent when initializing a job struct

#

but that throws an error in my environment (2018.3.4f1, com.unity.collections 0.0.9-preview.11)

#

so if I could figure out how to convert back and forth between a NativeQueue<>.Concurrent and a regular NativeQueue<> that would solve my issue

chrome pawn
#

the same script imported into my project throws the same error

#

it seems this was supported in an older version of com.unity.entities 😭

#

as of com.unity.entities 0.0.12-preview.23

solar ridge
#

YOu may want to check to see if there is a "GetConcurrent"

#

I thought they removed the implicit conversion

#

@chrome pawn

chrome pawn
#

ah, ToConcurrent

#

thanks, will report back in 10

solar ridge
chrome pawn
#

@solar ridge as long as you're around I have 2 quick questions

#

I would like to access NativeQueue<>.Concurrent.Length but obv can't so I think what I'll do is increment a thread-safe counter every time I enqueue

#

is this still the correct way to do a thread-safe counter?

#

also, where did you hear about removal of the implicit conversion? I want to keep up to date with API changes like that but it seems like there' s still so much undocumented stuff

solar ridge
#

Mm it was one of the changes a while back. I remember aeeing it on the forums

chrome pawn
#

it looks like Unity.Rendering got dropped from com.unity.entities as well?

dull copper
#

it's now in Hybrid Renderer

chrome pawn
#

after updating to com.unity.entities 0.0.12-preview.23 it seems Unity.Rendering and MeshInstanceRenderer etc are gone

#

ah thanks

dull copper
#

it describes the relevant changes

gusty comet
#

Hi guys πŸ˜ƒ Just wondering if you knew where I should start to search for my problem : no entities when I build.

#

Well at least I think it is my problem x)

dull copper
#

@gusty comet do you rely on some editor only scripts?

#

one case where that would happen is like if you get the active scene in editor using gameobject scene -> entities conversion tool but get the original scene via editor only api

gusty comet
#

Most of my code start with bootstrap 😒 and I was able to get a debug message to be sure that the boostrap function started @dull copper

dull copper
#

can you roll back in version control to see where it still worked?

#

could help in narrowing down on the root cause

gusty comet
#

I guess I could try step by step yeah, a bit old school but always good ^^ I didn't test it before so that's gonna take a bit of time, thanks @dull copper

dull copper
#

I'd really just check the first commit before and after the jump to preview.23 really

#

as that's the most likely place here if you've upgraded to .23 recently

dull copper
#

Tiny getting C# on next release:

We are kicking it into high gear when it comes to C# support and are we working hard to bring it to users as soon as possible. However, this means we will be focusing all of our efforts and will not be releasing anymore updates until C# arrives.```
<https://forum.unity.com/threads/0-14-1-preview-release-and-an-update-about-c.621769/>
urban rivet
#

nice, it sounds like there's distance to cover so they need the space to do it

dull copper
#

I don't really care about Tiny myself (it's nice but doesn't really concern my projects), main reason I want them to get this done however is because I suspect that we don't really see full ECS scene editor before they get Tiny merged it

#

(because it would make sense that they expanded on what they have on Tiny for the editor instead of building two duplicate systems and then tried to merge them together)

urban rivet
#

I've got an interest in open world rendering again using unity terrain so I think probably, I'll need to do that convert to ecs stuff

dull copper
#

I don't think unity terrain works in pure ECS yet

urban rivet
#

I mean all the junk that will go on it, rocks, villages etc

trail burrow
#

Getting this error

#

when trying to create an instance of this tiny system:

  public class ChangedSystem<T> : JobComponentSystem where T : struct, IComponentData {
    struct Job : IJobProcessComponentDataWithEntity<T> {
      public void Execute(Entity entity, int index, ref T c0) {
        Debug.Log(entity);
      }
    }

    protected override JobHandle OnUpdate(JobHandle inputDeps) {
      Job job = new Job();
      return job.Schedule(this, inputDeps);
    }
  }
#

like this: _world.CreateManager<NetCode.ChangedSystem<Health>>()

#

i mean...

#

i have no idea

#

@dull copper any idea? πŸ˜„

#

got it running by making it non-generic

#

doesn't do what i need anyway so its not useful

#

lol

mint iron
#

i've been able to get generic jobs to work but they have to be instantiated to a static somewhere for the system to find them and compile, i guess to be able to pull out the types being substituted in.

#

Be nice if [BurstCompile] took a name parameter

trail burrow
#

im comming up against a hard wall performance wise

dull copper
#

not really no :/ I've also had some detours again, should get back to learning ECS better soon

#

@trail burrow without knowing anything, you know how hybrid stuff limits things on the main thread?

#

could there be any clue there to force something similar to happen on other threads?

#

I have zero clue on what I'm talking about here, just throwing out random thoughts πŸ˜„

solar spire
#

If you've got Joachim in your thread I'm sure an answer will come, it seems like your use case is a perfect candidate to get them thinking

trail burrow
#

Yeah I just can't get it to be fast enough, I want to be proven wrong, because it'd be great to port this to the ECS

urban rivet
#

filter could handle it if change of component adds a component

#

seems a bit of a hack though

trail burrow
#

@urban rivet having to do a unique component per change to another component

#

is... well... hacky doesnt do it justice πŸ˜„

urban rivet
#

lol but I'm used to using Unity you see.

mint iron
#

do you need to explicitly dispose of Allocator.Temp native containers? i just realized i wasn't disposing of some, and it wasn't throwing up leak errors.

elder wharf
#

yes

#

(atleast for me, I need to dispose them manually, even if they are Temp containers, or else my debug console will get filled...)

trail burrow
urban rivet
#

var is definately the right kind, of course?

#

what does the assembly say?

#

I'd assume but Unity does need to write some types for the compiler to infer, or I read about this, so it's best to check if it's really what you're expecting.

trail burrow
#

@urban rivet var is handled by the c# compiler

#

It will not fuck it up ;p

foggy chasm
#

it took me a year to make peace with var being fine

trail burrow
#

Var just means use the type of the assignment expression

#

I just can't make this code Burst compile

#

Been turning this code inside out

#

It simply will not compile

soft nova
#

What type is your c field?

trail burrow
#

@soft nova boolean

#

i did get it executing in burst

#

but performance is identical/worse in burst

#

which seems...weird af

mint iron
#

anyone have some examples of how to use DynamicBuffer<T>

trail burrow
#

@mint iron not much more to it than that

#

buffer can then be used like a list of sorts

mint iron
#

okay, i meant without entities, creating/destroying your own. it seemed like header was all protected and yeah, started building an imposter but wondering if there's something im missing.

trail burrow
#

@mint iron can you even use it without entities?

mint iron
#

you kind of can, but it seems like its not intended.

trail burrow
mint iron
#

awesome, thanks

thick plover
#

What in the world is an entity component system

thick plover
#

What is that link

merry oasis
#

wikipedia lol

thick plover
#

It’s broken

merry oasis
#

mm works for me

thick plover
#

Hmm

merry oasis
#

in any case, the first para is most important and ill just paste it here
Entity–component–system (ECS) is an architectural pattern that is mostly used in game development. ECS follows the composition over inheritance principle that allows greater flexibility in defining entities where every object in a game's scene is an entity (e.g. enemies, bullets, vehicles, etc.). Every entity consists of one or more components which add behavior or functionality. Therefore, the behavior of an entity can be changed at runtime by adding or removing components. This eliminates the ambiguity problems of deep and wide inheritance hierarchies that are difficult to understand, maintain and extend. Common ECS approaches are highly compatible and often combined with data-oriented design techniques.

thick plover
#

Um ok

merry oasis
#

key points
Entity–component–system (ECS) is an architectural pattern
ECS follows the composition over inheritance principle

#

and with Unity's ECS, the last sentence too

trail burrow
#

god i wish they would expose the low level chunk byte data to us

#

i.e. the internal calls they use to calculate offsets and such

#

for various component types in a chunk, etc.

silk basin
#

a bit of a noob question i suppose:
is there a way to write a system that'll loop over all entities that have both a Rigidbody2D and a IDataComponent (while accessing/changing data for both) without using Inject?
my initial try was:

  1. create a component group in OnCreateManager for the two types
  2. loop over entities
    but i'm at a bit of a loss as to how to get the reference to the rigidbody through the entity
elder wharf
#
ForEach((Rigidbody2D rigidbody, ref YourComponent yourComponent) =>
{
    // do something
});

^ for the simplest way

silk basin
#

Ofcourse i get an answer right as i leave home :P
Thanks a lot, will try as soon as i can
(im honestly having trouble understanding which info about UECS is up to date online so im asking probably stupid questions)

random monolith
#

Hello!

#

I'm messing around with the ECS System and trying to make a few knights fight each other. I made a system that selects a target. Now I'm trying to get the Knights to move to their targets.

public class MovementSystem : ComponentSystem
    {   
        private struct Filter
        {
            public NavMeshAgent NavMeshAgent;
            public TargetComponent TargetComponent;
        }
        
        protected override void OnUpdate()
        {
            var entities = GetEntities<Filter>();
            Debug.Log(entities.Length); 
        }
    }

But I don't get my any matching Entities. If I only filter on NavMeshAgent, it works as expected.

     [Serializable]
    public struct Target: IComponentData
    {
        //public int index;
        public Entity entity;
    }

    [UnityEngine.DisallowMultipleComponent]
    public class TargetComponent : ComponentDataWrapper<Target> { }
dull copper
#

from first one: Join Martin Gram, the Product Manager for our Data-Oriented Technology Stack (DOTS), and guests as they spotlight the latest DOTS features. They will also unveil some exciting high-level systems coming your way in 2019.

#

HPC# Physics pls πŸ˜ƒ

solar ridge
#

That and .... rendering / networking and we should be pretty solid yes?

#

Networking has a semi demo already

dull copper
#

navigation is still missing too

solar ridge
#

Ah yes

dull copper
#

like, basic pathfinding etc

solar ridge
#

There is a forum post

#

Where there is a basic system working, but yes

#

Navi built in would be niiiiiice

dull copper
#

I could imagine people doing some A* in no time if they need it now

solar ridge
#

I think physics first would likely be more prominant

#

Just because of the logic for avoidance may derive from that as well

#

Not saying physics is needed, but just that it would be the likely flow

dull copper
#

it's one of the basic things most people do need before they can jump to pure ECS

#

even if you don't do simulations, most games rely on queries (raycasts/sweeps)

solar ridge
#

Yeah. I made a geometry wars clone a few years qgo and used a navmesh for input and pathing

#

So I can see many uses within ecs context

trail burrow
#

Physics > Navigation > Networking is my guess on how they will prioritize

mint iron
#

so you should be able to use NavMeshQuery to pathfind in ECS

trail burrow
#

@mint iron that namespace doesnt give me a lot of confidence πŸ˜„

mint iron
#

haha yeah

#

i guess all of ECS is experimental though

#

it actually worked really well for me when i tested it, but there's a few gaps still, like NavMesh.FindClosestEdge has no equivilent. I had to cache the triangulation and manually map all the outside edges.

dull copper
#

Unity is hosting a Visual Scripting roundtable at GDC where we will be showing our first DOTS build and discus current direction. We have space for 10 participants and are mostly looking for experienced developers (people with VS experience, not necessarily programmers) this time around.

solar spire
#

Wow, 10

dull copper
#

well, even 10 is pretty much if you are going to have a discussion

#

I'm not 100% convinced it's good to hear mainly people who use node graphs though

#

but I guess that doesn't rule out programmers

#

just discussing the usability is one thing but without knowing the technical side, it's hard to make reasonable requests

#

all I hope for their VS is to provide all the means to keep the graphs clean

#

I wrote a bit about this on the forum thread too

#

I don't really plan to use their VS but if they provide tools to keep things clean, it will just make it way better experience for everyone

#

(and give people less reasons to call VS a spaghetti mess)

solar spire
#

I agree with everything πŸ˜›

#

I may end up using it if ECS is actually a massive pain without it, but I can't imagine that being the case

#

also it'd be nice to be able to make a bundle of nodes that could be dropped into an editor field/location that has a defined behaviour

#

like, an editor window that has custom buttons that are literally just node bundles

#

but this is my editor tools brain thinking

solar ridge
#

It be nice to be able to create back end tools for front end Vs regardless if you are a programmer or not :-)

#

Especially if used in say an event like setup

gusty comet
#

Pardon me for a question that could have been asked a bazillion times, but can we expect ECS out of preview in 2019 or 2020?

dull copper
#

they targeted 1.0.0 for the Entities Burst package for this summer originally but better really wait for GDC for their updated plan (they should reveal some new stuff related to this as well)

#

that being said, Entities package is just one part of the puzzle, we still need those ECS'fied libraries to fully utilize this + full ECS editor (which may or may not happen before 1.0.0)

solar ridge
#

Dont know if it was enities. I think it was 1.0 burst for the summer

dull copper
#

oh right, it was for burst, I missed that line, my bad

#

yeah, this makes more sense

solar spire
#

Which summer is "this summer"? 😢

dull copper
#

well, it was for Burst only (remembered it wrong)

#

that sounds feasible

#

I'd want them to support different instruction sets on the same platform tho, they've said they want to do it but it doesn't seem like huge priority

#

I'd want to use AVX on CPUs that support it and drop to SSE2 on CPUs that don't even support current default (SSE4)

urban rivet
#

sexy times ahead

#

wiggles eyebrows at Burst 1.0

solar spire
#

I can animate so many sexy boxes

urban rivet
#

Current main pain point: vegetation rendering in HDRP (and no Vegetation Studio Pro doesn't work at all with it atm)

dull copper
#

@urban rivet didn't the author share SG or ASE nodes for it?

#

but.. these will be broken on 5.3+ πŸ˜„

#

hope they merge the custom node soon

urban rivet
#

so much for having any grass before next friday deadline

#

as for "he did" I know cos I was the one requesting it

#

I'm just sulking due to HDRP node stuff πŸ˜›

#

sulks even more

wise monolith
#

How do I access entity/entities in a system that is not directly running on them? For example if I had a turret and my turret system need to find all entities with the "turretTarget" component how would I do that?

urban rivet
#

GetComponentsInChildren (it will also find components on self)

solar ridge
#

Err @urban rivet is that in ECS? Or are you talking about GameObjects?

urban rivet
#

Holy mackerel. I didn't realise the channel

#

πŸ˜„

solar ridge
#

Looool

#

No worries

#

Was about to say! I have more to learn tonight then! Thought they had released another version

urban rivet
#

I was stuffing my face not even reading anything 😦 haha

#

That would be an "interesting" solution though

solar ridge
#

You do a lot of work on here and the forums so a mistake everynow and again is perfectly fine :-)

#

It would be

urban rivet
#

I enjoyed your writeups on ECS btw

solar ridge
#

I try to be as polite as possible on there

urban rivet
#

Thanks for teaching me more about it πŸ˜„

solar ridge
#

Hey man! We are all learning this wonderous new tech together 😊 the more we share the better

#

Im amazed at what some have already accomplished

urban rivet
#

I find it absolutely amazing, very impressive performance

#

I am looking forward to the ecs scene converter + samples to dig through

solar ridge
#

Yeaah! Hopefully new docs in March but we shall see

urban rivet
#

it'll be interesting to see perf in a large open world

solar ridge
#

World handling suggestions from unity is a small request I have now. More so how to use them appropriately

#

As I can make a world... but to make it tick is.... interesting

urban rivet
#

I guess that's partly why vegetation seems to be so long coming with terrain? currently it's stuck in the dark ages

solar ridge
#

Yeaaa

#

Terrain I remember in my bachelors course. It was entertaining as that was just starting to be unity5

#

The concept is neat, but not a lot to do there

#

But lots of things this year and hopefully that includes terrain for ya :-) Im interested in the Visual scripting, animation genlock support, and audio dsp after ecs.... LOTS of potential

urban rivet
#

this year sees the foundation of it being deterministic

#

that means in addition to performance by default, you are looking at networking by default, especially with physics

solar ridge
#

Yeeep. That one may be a tricky one just due to a component of that out of your control. Hardware for ecs is rather static. Network lines can be in flux

#

There are ways to mitigate issues, but I would NOT want to be the designer of that system

urban rivet
#

And if the graph stuff turns out good then people will just click together networked games that run really well. I would have called you crazy 5 years ago

solar ridge
#

Yeeeeeaa!

#

I remember showing a teacher events in Unity and he was like whaaaa! So I kind of want to go back and show him VS

#

Games in the future will have an intersting boom I think

#

Also as an aside, something I havent tested just yet in Unity as I have been away for the weekend, passing delegates to jobs.

Delegates themselves are non blittable, but the pointer associated with them is... can anyone see something going wrong with using a delegate this way that I should be aware of? See FunctionPointer<T>

#

Where T is your delegate type

mint iron
#

i was wondering the same thing :S it seems to work fine but maybe does something evil im not sure

mint iron
gusty comet
#

Hi guys, do you have some sample about world serialization? I saw something in SerializeUtilityHybrid but I don't understand, it seems that they use a game object to save shared components

coarse turtle
#

I haven't personally played around with world serialization yet, hoping I can do that soon πŸ˜‰

rugged wagon
#

do static methods, marked to be aggressively in-lined (and called from jobs ofc) get compiled by burst?

latent walrus
#

How do you nest entities in pure ECS?

#

is it just not implemented yet?

trail burrow
#

@latent walrus you 'dont'

solar ridge
#

If you are talking about parenting, the attach system. If you are meaning something like a linked list relation, then it sounds iffy

gusty comet
#

Thanks @coarse turtle πŸ˜„

#

I found the Unit Test about serializing, which was good enough but having a blog post is damn cool !

#

Btw everyone, I was wondering how the shared components were working (I mean how do the know that they are shared). It seems like there is some hash code, does that means that a RenderMesh with the same Mesh (ptr) and same Material(ptr) get the same Hashcode and so is the same component?

winter veldt
#

@solar ridge is there somewhere I can read about the attach system? I can't seem to find anything

full stirrup
lucid idol
#

anyone having trouble with GetComponentGroup()? When I call it in OnUpdate() method in a system it seems to exit the OnUpdate() loop completely, mysteriously
I'm able to get my component through entityManager.GetAllEntities(), but really want to be able to just get the components directly instead...

safe lintel
#

i think you only want to use getcomponentgroup in oncreatemanager or onstartrunning

#

heh not sure how to paste code but anyway I recall GetComponentGroup() is expensive and should only be done once and then cached

lucid idol
#

that makes sense, but I'm still confused why it would just stop execution of OnUpdate()... originally I had it in OnCreateManager() but had a race condition with entities not being registered until after OnCreateManager() and I just wanted to get something going. Will have to figure out a different approach πŸ˜ƒ

winter veldt
#

@full stirrup thanks!

safe lintel
#

hmm it shouldnt really matter if the entity exists or not, if it has the components that fits the declared ComponentGroup, it should show up in OnUpdate, unless I'm misunderstanding

rich summit
#

To properly paste code you want to hit tilde key 3 times on its own line with cs right after it to signify c# then on the next line you start your code, then at the very last line, on its own line, do 3 tilde again so it ends up like this,

```cs
void Start()
{
Whatevs();
}
```

#

which then would make this.

void Start()
{
    Whatevs();
}
safe lintel
#

lets see

protected override void OnCreateManager()
{
    var query = new EntityArchetypeQuery
    {
        All  = new ComponentType[]{ typeof(Behaviour), typeof(Target), typeof(Character)},
        None = new ComponentType[]{ typeof(Dead)}
    };
    attackGroup = GetComponentGroup(query);
}
#

hmm

rich summit
#

make sure there is no space between the 3 tilde and the cs

safe lintel
#

thanks

rich summit
#

Typically though, when it comes to smaller blocks of code, it is fine, but when I want to do bigger ones, I just go to hastebin and then link to it.

safe lintel
#

yeah i thought it would autoformat it, anyway thanks πŸ˜„

rich summit
#

No worries, but yeah, pretty much just blocks it out and adds syntax highlighting.

scenic pelican
#

How do I add the pixel perfect component for the newest beta build?

#

It's not in the package manager.

dull copper
#

@scenic pelican you have package manager set to show the preview packages?

#

also not really an ECS issue πŸ˜ƒ

scenic pelican
#

How @dull copper

#

Its set to all packages

#

It doesnt show it

dull copper
#

not that setting, the one on the right from that

#

"Advanced"

lucid idol
#

What version of Unity do people use for ECS dev?

dull copper
#

gif from newest 2019.2 alpha but even 2018.2 should have the preview packages toggle there

lime dome
#

2018.2 actually doesn't it just shows everything by default

#

so if it exists, it should show

#

2018.2:

#

i don't see pixelperfect, it may not be available for 2018.2

#

no wait I take that back

#

there at the top

junior fjord
#

Hi everyone, very happy to have such a channel here

#

does anyone know if there is something like AddOrReplaceComponent?

#

that adds the component in case the entity does not have it and otherwise replaces it?

safe lintel
#

I would love an AddOrReplaceComponent

unborn totem
#

Did the Monobehaviour/GameObject system have AddOrReplaceComponent? You can always extend it with your own, right?

near gulch
#

why do people struggle with ECS

#

it makes way more sense than the OOP game object, component system pattern

solar spire
#

likely because it's in its infancy in unity and the code can be extremely different

dull copper
#

I can think of many reasons:

  • programming courses tend to teach OOP right after basics are down, nobody teaches ECS on those (unless you really seek for ECS content specifically).
  • having done OOP for years, swapping the model in head can take some time, but this really applies to all new tools and systems you adapt
  • ECS principles are relatively simple, I'd argue there isn't really notable difference conceptually in difficulty but in Unity's case, it's really more about how you should use their specific thing so that you get most out of it
  • in Unity ECS, it's currently a constantly moving target so finding relevant info is hard when even Unity's own code uses things that are going away etc
urban rivet
#

I don't struggle with ECS, I just can't afford to change my main codebase for it until it's settled down a bit

#

it's a big game, imagne the pain of refactor for no reason that I can avoid

blazing mural
#

As someone coming from zero programming background even with a couple years fooling around with unity and learning c# there are a lot of things about ECS that I find hard to understand.

Recently I tried to replicate the new Boids sample for instance. I tried to do it without multiple sharedcomponentgroups. But now I'm getting errors about NativeArrays lasting longer than 4 frames or being disposed when jobs are trying to access them.

In the sample, they seem to be switching back and forth between componentgroup filters of half the entitys, and disposing them without calling complete. It's not super clear why I can't do the same thing without the second filter by waiting to the next frame starts to dispose.

Maybe that's because I'm not experienced or a real programmer but there's extremely little documentation up to date for me to reason this out without just trial and error.

I've now fixed the errors using Complete() but i still get errors when i exit while the job is running. Where would I even look to figure out how to cleanly end a running job and dispose the arrays without error?

Things like this are what I've struggled with anyway.

urban rivet
#

Awesome feedback

hexed pumice
#

Noob question: Blank project with Unity 2019.1.0a10 and Entities 0.0.012-preview.23, any idea why I get the error: Library\PackageCache\com.unity.jobs@0.0.7-preview.6\Editor\JobsMenu.cs(43,60): error CS0117: 'NativeLeakDetectionMode' does not contain a definition for 'EnabledWithStackTrace'

lilac ermine
#

@near gulch like others said i think largely because it's early days, and the core api seems to have only recently settled

#

along those lines, @blazing mural you're not alone πŸ˜‰ i've been writing ecs style code with my own little framework for years now and the unity system still took me at least a week or two to get used to. and i still struggle with certain things with it. as it matures and things are built to support it, i guess this will be mitigated

#

i've been recommending to most people to check out a couple of unite videos, they clarified a lot of things for me

#

one is where acton gave a great talk on data oriented design. i had to watch a few bits several times but it's a good way to get inside his head, so to speak

#

and then this one

#

the title speaks for itself but in short it goes over why certain things are being changed and helped me make the connections between the more confusing low and high level bits

#

another thing you can look at outside the examples are things like TransformSystem - i have to keep reminding myself a lot of the core stuff is being built on this now and we can fully inspect it πŸ˜„

storm ravine
#

Daddy here πŸ˜„

full stirrup
#

Hi Dad

junior fjord
#

How do I decide if something goes to onUpdate or OnStartRunning?

full stirrup
#

think it was RequireForUpdate(ComponentGroup)? someone will have to chime in on that

#

Might not be what you are asking for either lel

junior fjord
#

As I understand onStartRunning is run when the system starts up every frame and OnUpdate when it is updated

#

And I am asking myself what goes where

full stirrup
#

Ah not exactly what i thought then

junior fjord
#

Thanks anyways

#

ah no I was wrong, onStartRunning is not run every frame

#

only at the beginning

#

well then the question is, what is the difference between onCreateManager and onStartRunning (which code should go where)

light sage
#

In the Component or Shared Component DataWrapper Constructs if I put my class name then all of the non-blittable vars (and no blittable ones ofc) will be stored in the ComponentDataType Type instantiated? Am I someone close to understanding this?

#

Wanting to get a basic non-hybrid implementation going to take care of the persistent, non-persistent, data handling as well as pretty much everything but what has to be front end at some point

#

I'm relieved to have to look no further for DLL file API ideas and SQL implementations, and I need the Overhead cut back badly, ECS is an awesome way to go btw Unity Team, thank you guys

full stirrup
#

@junior fjord
OnCreateManager is literally construction, more or less the same so when you start the game; this is called because your EntityManager is now created.

OnStartRunning is when a filter meets the systems need. So for example you have a system that runs on Position and Selection, but all your entities have Position, this wont run. Then when you add Selection to an entity this runs because that entity now has Position and Selection

light sage
#

ah, that brings a good question I had

#

I want to create a data matrix of around 30,000 spryte Objects that are ever changing and use keep that matrix updated

#

BUT I have other elements that are also sprytes, how can I reference only the ones I need

full stirrup
#

depends how you need that, theres been discussion on how to manage 'value changed' on the forums somewhere

#

If you had one matrix system that controlled the whole thing, you would need sub systems that would control individual sprites

light sage
#

ok, but I can't get them by name or tag? because they have no unique elements other than that size and pixel data

full stirrup
#

then separate your sprites by different component types

#

Adding an empty ComponentData is considered tagging

light sage
#

I know I can't get the sprite but I want to store there vector data

#

That's enough to go on thank you, best way to learn it is to try it a lot until I get

#

one final question though would be will this store all of the variables until a system picks them up ```using System;
using Unity.Entities;

[Serializable]
public struct Pos_Data : ISharedComponentData
{
public float screenPositionX;
public float screenpositionY;
public float velocityX;
public float velocityY;
public float delta;
}

public class PLAYERPOS_0_COMP : SharedComponentDataWrapper<Pos_Data> { }```

#

and I think I need to make this an IComponent, remember telling myself that for some reason

full stirrup
#

Might need to change it, think you can change shared component data in a component system and it would affect the references for other systems but id go see what happens

light sage
#

@full stirrup thank you so much

#

It's very exciting, I isolated the input data via a web tutorial and I'm already getting 5ms improvement

full stirrup
#

dont forget that you can burst some of your jobs

light sage
#

tough for one thread to loop over input data flags every half a second or so

#

: O

#

I'm going to be in the API for weeks, this is a godsend honestly, you'll undoubtly see me again in a few days with more noob questions

#

it's like a low level "Living" database, when prefab implementation happens it's going to change the industry

full stirrup
#

Prefab implementation?
You mean setting up prefabs and instantiating?

light sage
#

It was somewhere in the API which I just have to get through all the errata and I can wrap my head around this

#

exactly what I needn't for my application, matrix based procedural gen, not scene dependant more open world

#

I'm going to benchmark memory and time stats and may do a blog when I get everything changed over

#

Entities vs. GameObjects
Our goal is to be able to make entities editable just like GameObjects are. Scenes are either full of Entities or full of GameObjects. Right now we have no tooling for editing Entities without GameObjects. So in the future we want to:

Display & edit Entities in Hierarchy window and Inspector window.
Save Scene / Open Scene / Prefabs for Entities.

full stirrup
#

Pretty sure you can do that right now somewhat

{
    public GameObject Prefab;
}

public class ObjectTypeComponent : SharedComponentDataWrapper<ObjectType>{}```

It has to be hybrid styled so you add that to a game object in the scene and provide the prefab you want to use. I havent tried it to loop through some count of how many to spawn but used it to spawn individual prefabs around

The way I am using it at the moment is on multiple "spawners"... Since EntityManager has .Instantiate and its like EntityManager.Instantiate(spawner[0].Prefab)
#

It will probably improve

storm ravine
#

@urban rivet miss me? πŸ˜„

dry nymph
#

good news #1 from the ecs gang is here.... I hope tertle & 5argon will show up as well

gusty comet
#

Hi guys πŸ˜ƒ Do you know how to convert an entity to a gameobject? The GameObjectEntity component doesn't allow me to set the entity and the entity manager 😦

full stirrup
#

adding GameObjectEntity to a gameobject identifies that gameobject as an entity

#

to do it in reverse I guess you would remove that component but i doubt thats going to have a good effect at runtime

blazing mural
#

@timmeh Yeah, those videos are very helpful, I've watched them both to death trying to learn while rebuilding the Boids sample, and I feel better with ECS in general, but I lack a lot of the knowledge that I guess most have when he explains things as "simple" or "straightforward" when talking about the hash map and things like that. I'm learning from trial and error as well though so hopefully it'll click a little more as I keep going.

gusty comet
#

No I mean that I have an entity and I want it to become a gameobject. Right now I have to create a gameobject and add componentdata manually. I'd like to just say : Hey! This is my entity, use it please.

tawdry tree
#

Haven't used ECS much (yet), but IIRC you can send an existing entity to a manager to instantiate a copy?

#

The way I'd do it then would be to use a tag component to mark it as a prefab, ie. not simulated or rendered, and you could query for it. Or just disable it, if you manage that some other way.

solar ridge
#

Scenario, every entity has a ValueComponent that has an int on it. What would be the jobified way to get the largest Value from all of these and provide the entity in return? soarynThink

knotty radish
#

Send a NativeList of these ValueComponents and remove them each time you find one which is lower than the current highest value ?

solar ridge
#

NativeList you cant remove the same as you can a List

knotty radish
#

Create the job with the NatliveList, complete it and then you have your entity (the only one remaining in the list)

queen belfry
#

Hey all! Hopefully quick question -- is there a convenient way to mass-add components to an entity? I'd ideally like some way I can make component "packages" to ensure that I don't miss out on any components (or can more easily apply components to multiple entities that share similar properties).

knotty radish
#

There is a removeandswapback, is it not enough ?

queen belfry
#

Not actually familiar with that -- fairly new to ECS in general.

solar ridge
#

THat was in reference to my previous inquiry

queen belfry
#

Ahh. Got it. πŸ˜„

solar ridge
#

Mass add components to an entity, you can create entities with archetypes

#

that will add the tags but no data backing, so you will still need to call SetData on each component

queen belfry
#

Perfect!

#

Thank you.

solar ridge
#

You can also create/add/etc in a CommandBuffer

#

which will do a playback at a barrier

#

IE EndOfFrameBarrier

#

that way you wont invalidate any chunks in the middle all of the sudden

wise monolith
#

Soaryn there is a way to do a foreach over all entities with X component and you could test if the last entity had a greater value. Can’t give a code snippet at this time though.

solar ridge
#

Foreach is usually the lambda on the main thread

#

Also, foreach is not burst compileable

wise monolith
#

Sorry old data....

solar ridge
#

Another interesting question: Is there a way to get an entity from a ArchetypeChunk when using IJobChunk? πŸ€”

junior fjord
#

So how would I start a system in the second frame instead of the first for example (I want the system to only start after the CopyInitialTransformFromGameObject is run)

solar ridge
#

Why exactly do you need to start a system after this?

#

Understandably you want the effects to happen from the copyinitial, but ... not sure why the wait is necessary

junior fjord
#

I have "Humans" and every Humans needs a Goal. In OnStartRunning I want to filter out all "Workshops" (directly copy their positions to a NativeArray in my ComponentSystem since their positions never change)

#

And then the system just assigns a MoveTo Component to ever Human that does not have one (and it finds the destination from the cached NativeArrays)

#

Problem is, if I do this in OnStartRunning, the System caches the initial positions of the Workshops which are (0, 0, 0) instead of the position it would get after CopyInitialTransformFromGameObject is run

#

if there is a better way to do this please tell me!

solar ridge
#

I would actually work on the assumption the goals can change. (even though in your case they dont)

wise monolith
solar ridge
#

It would clean somethings: 1) You no longer cache the data twice, 2) this allows you to have moveable goals.

To fix your problem though...

#

OnCreate have it set enabled to false

#

have another system that after EndOfFrame enable it once

#

You would then have a frame delayer in a sense, but it isnt my recommended choice

#

As again, the caching sounds ... odd

junior fjord
#

@solar ridge Thanks for the suggestion. Why do you say cache the data twice? I only cache it once right?

solar ridge
#

You cache the data that is already stored else where and referenced through the entity id

#

so technically you have duplicate data,

junior fjord
#

I did this since it feeled bad to allocate an array on every frame for all the mine positions and copy all of them, allthough this will be exactly the same thing for most of the game

wise monolith
solar ridge
#

.... uh

#

So @wise monolith dont post images here for code πŸ˜›

junior fjord
#

But I am going to do it as you suggested for now thanks... just somehow feels like needless work

wise monolith
#

I am on mobile soarynSad

#

Could not do otherwise

solar ridge
#

Partially, but if you make systems more independent it is closer to DDD or DOD

junior fjord
#

Also what do I do if my FindGoalSystem runs before CopyInitialTransform. Then also in the first frame all Humans would be assigned a wrong position

solar ridge
#

Rather than have intertwined dependencies

junior fjord
#

DDD or DOD?

solar ridge
#

Data Driven Design

#

or Data Oriented Design

junior fjord
#

ah ok

wise monolith
#

Soaryn if you look back in the project channel and you will find the code snippet not an image.

junior fjord
#

But still, if I then cache the positions in OnUpdate instead of onStartRunning I would still cache the wrong positions for my job if CopyInitialTransform didn't run before

solar ridge
#

Well... for now you could use [UpdateAfter()] on your system

#

but I think the problem, as odd as it sounds, needs to be refined. I'm not sure of many solutions @storm ravine may be better at pathing / goal finding since a nifty little rts looking game is in their wheelhouse

#

Biggest oddity I have with the current gen system is the Hybrid approach. It is good for prototyping, but I'd stay away from most of it for end work. Just because of how influx everything is

#

I want to say Pure ECS all the way, but that doesnt fit everyone's needs

junior fjord
#

I mean I am just at the bare start, I can refine the problem πŸ˜„ I am happy about any suggestion

#

I have the Humans (they have Human component) and I want them if they don't currently have a goal to get a Goal by a system somehow

solar ridge
#

So just know, allocating a NativeArray everyframe is actually ok

junior fjord
#

later on they will decide which mine is best for them exactly etc

solar ridge
#

As long as it's lifespan is <4 frames

#

Ah! In that case. There are a couple solutions

#

System assigning goal : Any Human who does not have a goal tag gets one; ignore goal tagged humans

System cleaning the tags: Goals met or goals invalid

#

Also note, there have been many talks on whether or not it is advisable to add/remove tags runtime for performance and I think it wound up being too dependent on call frequency. In this case, it should be fine to add/remove as much as you'd like

junior fjord
#

Yes that is what I am doing I guess. The FindGoalSystem assigns a "Goal" tag and the MoveTo component which then directly sends the human in the right direction

#

which led me here since all humans went to (0, 0, 0) πŸ˜„

#

because CopyInitialTransform had not yet run

#

but probably the best solution is to actually use UpdateAfter and cache the positions in OnUpdate instead of OnStartRunning as you said

solar ridge
#

Also check the goals for the tag copy

#

I think that tag is removed from the entity

#

so you can check when it has been applied

junior fjord
#

Would have been nicer without any dependence at all, especially since the dependence is only needed for the first frame of the game πŸ˜„

solar ridge
#

which solves your original dilemma

#

There is an IJob that is run "RemoveCopyInitialTransformFromGameObjectComponent"

#

So I'd assume "CopyInitialTransformFromGameObject" no longer exists after frame one

#

which case you can subtractive search with "CopyInitialTransformFromGameObject"

junior fjord
#

yes I think the problem is that I never know how much performance something costs. Using UpdateAfter or doing a subtractive search as you said all give me a bad feeling since I think I am potentially loosing performance for something that is only needed in the first frame

solar ridge
#

No no

junior fjord
#

but that is very premature optimiziation I guess πŸ˜„

solar ridge
#

Every entity at the start has "CopyInitialTransformFromGameObject". After first frame, that component is gone

#

much like the Goal component we were talking about

#

so when you search for viable goals

#

search for goals that DONT have that component on it

junior fjord
#

exactly but I will always do the subtractive search, so unity will in every frame have one more condition to check on the archetypes

solar ridge
#

It will only do those searches if everything matches

junior fjord
#

Yes I should search for
Has(Goal) AND HasNot(CopyInitialTransform)

#

erm no

#

HasNot(Goal) AND HasNot(CopyInitialTransform)

solar ridge
#

Errr....

#

Search for [Human][No-Goal]
For [Human][No-Goal] Find [GoalTarget][No-CopyInitial]

#

then add the appropriate toggles for each

#

Note, you can have a LOT of IJobProcessComponents running

#

There is a lot of early optimization for a system that has a lot more optimization than gameobjects

junior fjord
#

What do you mean by For [Human][No-Goal] Find [GoalTarget][No-CopyInitial]

As I understood it I should search form
[Human]&&[No-Goal]&&[NoCopyInitial], right?

solar ridge
#

Your human isnt the thing with CopyInitial right?

junior fjord
#

ah right no it isn't!

solar ridge
#

You are looking at the goals that you have set with CopyInnitial

#

So you will need 2 lists

#

1 of viable humans, 1 of viable goals

#

I'd actually recommend

#

Getting viable goals first

#

and then pass that list to the human job

#

first human there gets the goal

junior fjord
#

all humans there would get one of the goals as I thought it

#

ok, so now I will
in OnUpdate: search for [IsGoal] &&[NoCopyInitialTransform], copy their stuff to native arrays and pass them to the job using goalGroup.GetComponentDataArray

and then have an IJobProcessComponentDataWithEntity that searches for [Human]&&[NotHasGoal]

solar ridge
#

Just add to a NativeList as you find them

#

Errr

#

actually

junior fjord
#

how do you mean that? my current code is like this:

        mineGroup = GetComponentGroup(typeof(Mine), typeof(Position));
        Debug.Log("Whatsup");
        var entity_array = mineGroup.GetEntityArray();
        mines = new NativeArray<Entity>(entity_array.Length, Allocator.Persistent);
        entity_array.CopyTo(mines);
        var positions = mineGroup.GetComponentDataArray<Position>();
        mine_positions = new NativeArray<Position>(positions.Length, Allocator.Persistent);
        positions.CopyTo(mine_positions);
solar ridge
#

nevermind that would work, but you will need the entity of the goals too

junior fjord
#

Goal == Mine for now (later other Goal types will be added)

solar ridge
#

so you don't readd them to anyone else

junior fjord
#

ah of course it will not be persistent anymore, but TempJob

solar ridge
#

And Tag them with [Taken] or something

junior fjord
#

Ah but there can be many Humans in one Goal (think of Goal like a gold mine for now :D)

solar ridge
#

Aahhhhh ok

#

Then in that case

junior fjord
#

thanks for all the help!

solar ridge
#

Yep yep

junior fjord
#

Does anyone know how I would pass a subtractive to GetComponentGroup?

#

Ah I found it, nevermind

junior fjord
#

Do I remember right that there was already something implemented for using navigation meshes in the ECS? If so, where do I find it?

solar ridge
#

ehhhhh.

#

There is a jobified nav. But.... not really ecs ready iirc

junior fjord
#

if it is jobbified isn't it ecs ready?

toxic mural
#

Is the hierarchy available for ECS yet?

safe lintel
#

can someone explain how the Any component query is useful? how is specifying a component may or may not have certain components handy, isnt that the same as not including them in an archetype query?

junior fjord
#

@safe lintel I think it has to has at least one of the components

#

so it has to have any one them

safe lintel
#

ahh

junior fjord
#

basically it is Component 1 OR Component 2

safe lintel
#

thanks, that would make more sense than what I had thought

solar ridge
#

@toxic mural if you mean like for transforms yes

#

you make 2 entities then you make an 3rd proxy entity that has an attached component specifying the parent and the child

toxic mural
#

Oh hm

#

But theres not like an editor view?

solar ridge
#

Oh. No there is nothing except the entity debugger atm

#

Backend work first, then front end support

toxic mural
#

Right right. True. Thanks.

#

ECS is like this itch in the back of my mind, I keep wanting to dive into it but also want to wait until its 1.0

solar ridge
#

1.0 isnt for a while

#

there is no determined date for ECS 1.0

toxic mural
#

I remember seeing some Unite video that showed editor integrations that I thought was 2019.2 so I'm hoping it wont be much longer

#

Oh hrm

solar ridge
#

I think that was Unity Tiny

#

Which is not QUITE what you want

#

Burst 1.0 was slated for this year

#

I think 19.2

#

But that is not ECS

#

As I'd imagine all the big (was it 7?) need to be done before 1.0

toxic mural
#

Good point. And really the last thing my project needs is another "hey lets start over but with a new paradigm" again

#

It just sounds so cool though

solar ridge
#

You can use some ecs components now to help the backend of your code a lot

#

Im using it now for an entire API listener system to allow for entities to be created based on external json API calls

toxic mural
#

Ah cool

junior fjord
#

But I think they say somewhere that you should not use it for production

solar ridge
#

Talk to @storm ravine about that. He has a forum post on the fact that you CAN do it

junior fjord
#

or only use it for production if you just are starting out and plan to release end of 2019 earliest

#

I took that as an hint that we can hope for the full features end of 2019

solar ridge
#

It is not built for production, but it is code

#

so use it at your leisure in this case

#

Example

junior fjord
#

yeah the second part of what I said was more important πŸ˜„

solar ridge
#

That was a lot easier to calculate in jobs and ECS than gameobjects

junior fjord
#

I saw the great post of this RTS in ECS

#

woah nice πŸ˜„

#

is that open source?

solar ridge
#

The cubes there? no

junior fjord
#

But what I meant was that they hinted that it maybe released end of 2019

solar ridge
#

Most of my stuff is closed source sadly

#

They hinted many times throughout the past 3 years ECS

#

so I wouldnt take hints very far πŸ˜›

junior fjord
#

ah you did that, nice. Is it for a game or an animation?

#

ah ok πŸ˜„ good to know

solar ridge
#

Oddly... it is for a twitch reactionary notifier

#

Someone subs/cheers make cubes with smaller cubes

#

these cubes can then be absorbed by absorbers

junior fjord
#

πŸ˜„

#

do you stream or did someone want you to do that?

#

are you full time indie?

solar ridge
#

I am a partner on twitch.

junior fjord
#

ah you work for twitch?

#

the animation looks really nice

solar ridge
#

That was ~200k cubes iirc

junior fjord
#

I don't really see what is happening there?

solar ridge
#

There are so many it looks like static in the gif 🀣

junior fjord
#

a lot of cubes orbiting the center of the sphere?

solar ridge
#

Woops

#

Yeah ~200k cubes orbiting a central point at 60+fps

junior fjord
#

nice πŸ˜„

solar ridge
junior fjord
#

I am going to breakfast now

#

ah is this the limit of radius -> 0 of the sphere?

solar ridge
#

Each cube is moving towards their origin point

#

to them it seems like 0,0,0 but for everything else it may not be

storm ravine
#

You can use ECS in production πŸ˜ƒ all depends on skills and requirements πŸ˜ƒ

urban rivet
#

YOU can use it in production because in your homeland, cars are made of wood and steel

#

+bottles and bits of stuff

storm ravine
#

And bears with vodka πŸ˜ƒ

urban rivet
#

:D

#

But vodka means water, right? how does it float