#archived-dots

1 messages ยท Page 152 of 1

unborn totem
#

they aren't that large in Unity

north bay
#

That sounds crazy

unborn totem
#

yeah, not sure what's going on there

north bay
#

Do subscenes also contain the textures and all that stuff?

ocean tundra
#

i think sub scenes copies in assets

unborn totem
#

all of my entities are just flat planes that all reference the same 4k texture (which is a sprite sheet)

ocean tundra
#

not sure that they have those excluded properly yet

unborn totem
#

yeah, you're right in that all of the .bundle files are the same size

#

the entities might be the same size because each one is 10,000 GameObjects with the same number of components

#

i wonder if I could get away with just deleting all but 1 bundle ๐Ÿ˜…

#

nope

#

well that's unfortunate that I can't control that, guess I'll have to wait for that feature

#

or spawn my entities in at runtime instead of using subscenes

zenith wyvern
#

Is Dots Editor incompatible with the latest entities?

spark glade
#

Is there an efficient way to instantiate multiple different prefabs with the EntityManager?

I have a job that has a bunch of Entity (Prefab) references that I want to Instantiate. Unfortunately they're not all the same. Is there anything short of grouping them by the same Entity (Prefab) in order to be able to use the EntityManager batch operations?

tawdry tree
#

DOTS Editor is for project Tiny, not "normal" DOTS

#

What do you mean multiple different prefabs?
You can just grab each of the Entity values for them?

spark glade
#

Let me give some context.

deft stump
#

what key reasons do I need to consider to go for Tiny than normal DOTS?

spark glade
#

It's for my ability system. And in the off chance in one frame a thousand archers and mages will shoot their projectiles.

#

Doing it 1 by 1 with an entity command buffer (despite burst and all) will take almost 16ms for 1000+ projectiles.

zenith wyvern
#

Are you sure it's only for Tiny?

tawdry tree
#

Honestly, with only that I'd say "don't worry about it"

spark glade
#

Key is they're mixed (say Arrows and Fireballs)

#

So I have an array of Entities to be instantiated

tawdry tree
#

Unless you have experienced the issue in a stress-test, probably not an issue

spark glade
#

the 4th one

#

srcEntities -> outputEntities

#

I guess that could work

#

Shove the arrows and fireball prefab entities on the srcEntities 1000 or so times, call the method and loop again to give them their velocities and whatnot.

tawdry tree
#

So you want to basically "collect" all the projectiles that should be spawned in one or more collections, and spawn a number based on them, then set the positions and whatnot?

spark glade
#

yup

tawdry tree
#

I suspect that unless you do it really clever it will be cheaper to just do it ECB where you already do it

spark glade
#

Right now I'm doing
var prefabEntityInstance = beginSimulationEntityCommandBuffer.Instantiate(entityInQueryIndex, prefabEntity); of sorts.

tawdry tree
#

Though, do put this to a stress-test!

#

Oh, how are the prefab entities made? do they have any extraneous components?

spark glade
#

It's a "prefab registry".

#

Basically on scene load it'll convert a bunch of prefabs, so that I can get a reference any where in the code through a tiny system with a nativehashmap.

#

Gonna try the batch version.

zenith wyvern
#

You can use ExclusiveEntityTransaction to create your entities in a job

spark glade
#

Maybe I can prepare the component data a job and set them with another batch call.

#

whoa!

tawdry tree
#

The purpose is to enable procedural generation scenarios where instantiation on big scale must happen on jobs
Seems spot on

#

Ooh, my experience with automatic conversion is that it's messy and adds a bunch of unnecessary components, so making one or more manual IConvertGameObjectToEntity monobehaviors to override it and get just what you need might improve perf

#

With that many entities, each unneeded component is extra time spent allocating and such...

spark glade
#

Hm, my arrows entities do have a trailrenderer.... let me try without it really quick.

#

hardly any difference, it really is that it's playing back 1:1, 1000+ times individually

#

Gonna give the "ExclusiveEntityTransaction" and the EntityManager."Batch" a try ๐Ÿ™‚ Thanks guys

zenith wyvern
#

Dots Editor is not just for Tiny for the record. Apparently it only works if you have your api compatability level set to .net 2.0

spark glade
#

@zenith wyvern hm, after reading some more, I'm not sure if ExclusiveEntityTransaction is what I want to use ๐Ÿค” Seems more intended for "let's load a million objects" asynchronously in a different world, as opposed to "I need 1000 projectiles in this frame".

tawdry tree
#

Did you check the components of the prefab entities? As I mentioned, you could be able to improve perf by stripping away unnecessary ones

spark glade
tawdry tree
#

Yeah, doesn't look like you can trim much there. Maybe LinkdEntityGroup, but...

#

Have you made a "real" stress test, though? Seems unlikely to me that you'd get all of them firing in the same frame, and even spreading it out by a few can make a huge diff on FPS

undone torrent
#

any suggest ?

tawdry tree
#

Could it be that some work is a lot heavier than the rest?
Like, depending on the inputs, it can take short or long

#

Also, that's a LOT of idling

#

Out of curiosity, is this a one-time thing, or does it run like every frame?

undone torrent
#

one time i guess

ocean tundra
#

Anyone seen this?

InvalidOperationException: The writeable Unity.Collections.NativeList`1[Game.ECS.Building.Construction.ConstructBuildingCommandMessage] <>c__DisplayClass_OnUpdate_LambdaJob0.messageContainer.LocalPlayerList is the same Unity.Collections.NativeList`1[Game.ECS.Building.Construction.ConstructBuildingCommandMessage] as <>c__DisplayClass_OnUpdate_LambdaJob0.messageContainer.Player1List, two containers may not be the same (aliasing).

tawdry tree
#

Because if it's one-time, you can shove it into a non-frame job

ocean tundra
#

key part is two containers may not be the same (aliasing). i think

undone torrent
#
 //Rellena los datos de los componentes RenderBounds and LocalToWorldMatrix
            JobHandle jobhandle_RenderBounds_and_LocalToWorld = Entities
            .WithStoreEntityQueryInField(ref occluder_query)
           .ForEach((int entityInQueryIndex, ref RenderBounds rb, ref LocalToWorld l) =>
           {
              
               rb.Value = new Unity.Mathematics.AABB { Center = list_bounds[entityInQueryIndex].center, Extents = list_bounds[entityInQueryIndex].extents };
               l.Value = list_localToWorldMatrix[entityInQueryIndex];
           })
           .WithDeallocateOnJobCompletion(list_localToWorldMatrix)
           .WithDeallocateOnJobCompletion(list_bounds)
           .ScheduleParallel(this.Dependency);
#

this is the lambda funct

tawdry tree
#

Do this for C# highlighting, useful for such big blocks :)
```cs
[code]
```

undone torrent
#

ou sorry ๐Ÿ˜… , next time

tawdry tree
#

You can just edit the message

undone torrent
#

ah okey on my way

tawdry tree
#

@ocean tundra Does it happen in an Entities.ForEach?

ocean tundra
#

super hard to tell but i think so yes

#

my whole unity dies

tawdry tree
#

the "cs" must be on same line as the first backticks, and no space after - just linebreak directly

ocean tundra
#

just peaking at the DOTS decompiler to see if that has any hints

tawdry tree
#

Do you have a "DisplayClass"?

ocean tundra
#

Display Class??

undone torrent
#

are you asking me ?

ocean tundra
#

๐Ÿ˜›

tawdry tree
#

I take that as a no, Roycon. The error says it happens in a class called that

#

lmml, does this run every frame, like it seems to?

ocean tundra
#

@tawdry tree Looking at the decompiled code there is a display class created

undone torrent
#

not at all , i have an own inspector script with a button that call a funct of the system base and this is a part of the internal code

#

i call it on edit mode

#

so i think it is called once by main thread

tawdry tree
#

Oh

#

Is it an issue that it takes time, then?

undone torrent
#

every time i check profiler i get the same results so i think yes

ocean tundra
#

so did some googling, seems my error is cause i have something like
var nativeCollection = new.....
var collection2 = nativeCollection;

undone torrent
#

i really lost cause i dont know when u answer me or roy xd

ocean tundra
#

they are the same collection but the safty system blows up

tawdry tree
#

lmml, if you do it only in edit mode, and not often... it hardly seems like an issue to me ๐Ÿ™‚

#

Roycon, NativeCollection is a struct, not class, so you copy the "value" of the nativecontainer itself. I think it doesn't copy the values it contains, but either way, danger!

undone torrent
#

so , u dont think it is a problem ?

ocean tundra
#

@tawdry tree yea im aware of that, vaules for sure arnt copied so i was hoping to have a 'shortcut' so i wouldnt need to do a lookup on my clients

tawdry tree
#

lmml, if it's not being done at runtime, then it won't affect the end user, and if you're only doing it rarely "on demand" (maybe one time per second at most), then the impact is minimal

#

Roycon, what are you trying to achieve here? What's the use case?

#

Missing enough context to say much about how to solve that...

ocean tundra
#

@tawdry tree theres a ton of context ๐Ÿ˜› basicly networked game. there are a ton of different messages created for things. they go into native lists each one matching a player and then sent off via the network
BUT for when the player is hosting their own game, the local player list for each message type is set to the same collection of that player

#

but it seems unity hates that ๐Ÿ˜› so i think ill just make it its own list again and copy all the items between lists at set times

#

is there a quick way to say Take all from this list and put into this list?

tawdry tree
#

If they implement IEnumerable you could just use linq

#

And I think they do

ocean tundra
#

hmmm maybe, but as there are a ton of lists i dont really want to use linq

tawdry tree
#

It might also be possible to grab a reference of the list, which would seem more correct

ocean tundra
#

i might actually be able to just swap the lists

#

as the server 'should' have the same list but empty (all messages processed)

#

also another issue, my unity is locking up and maxing CPU when i run, any ideas how to find out whats causing it?

#

๐Ÿคฆโ€โ™‚๏ธ

#

i changed the code gen and then didnt run it

tawdry tree
#

Check task manager with show all cores

#

If it's all single-threaded when it locks up... that happens to me sometimes, not sure why, but usually disabling or changing some code fixes (or just randomly after rebuild)

ocean tundra
#

well this isnt good then

tawdry tree
#

Oh, so it's just building

ocean tundra
#

i have so many asmdefs

#

maybe too many ๐Ÿ˜›

#

not sure its building

#

as that happens when i click play

tawdry tree
#

Did you change a code in bunch of them? Or one that many depends on?

#

Well, when you click play it has to build to be ready yo play, no?

#

Also, which unity version?

ocean tundra
#

yea but unity builds before play right?

#

2020.1b7

tawdry tree
#

It build on play if it hasn't done it beforehand

#

Either way, that 3min work should not be needed particularly often - if it is... Uh, maybe bug? I don't know what it actually does there

ocean tundra
#

except some of my code does run

#

i checked the editor.log

#

must be something im breaking then?

tawdry tree
#

What happens if you toggle pause and then hit play? (it should pause instantly)

ocean tundra
#

ooo great idea

#

just restarting unity

#

yup its fine

#

i think something in my code is causing it

#

im spamming log messages

#

so will see if i can track those back

tawdry tree
#

Alternatively, start commenting out systems, particularly those you've changed lately

ocean tundra
#

well

#

its not even happening in my systems

#

somewhere in my start code

tawdry tree
#

Huh

ocean tundra
#

its like unity isnt calling my update method again

#

its a monobehaviour im using for my start up stuff

#

like wtf?

#

well i found it

#

Im updating the PlayerLoop to add my custom worlds in there

#

something seems to be wrong with GetCurrentPlayerLoop

#

thanks for the help @tawdry tree I think one of your first guesses was right, one of my systems somewhere is super weird
But thats a tomorrow issue to fix
Thanks again

lunar coral
#

I find that the Monobehaviour scripts don't work on Entities even when converting using the ConvertAndInjectGameObject.
Still busy playing around with it

opaque ledge
#

check entity debugger if your entity has that monobehaviour

tawdry tree
#

What is the monobehaviors supposed to do? because you need to sync the changes, somehow.

#

For Transform, there is built-in functionality for that, but anything else I think you have to code yourself

lunar coral
#

No the monobehaviour is not on the Enitity it seems

#

I tried adding it on manually as well after spawning

#

Same result

tawdry tree
#

I believe the grayed out ones in the bottom is from the "link"

#

But if you have ConvertToEntity, it's super easy to see wheter it works - with convert and destroy, GO disappears, with convert and inject, it stays. Either case gives you entity.

#

One thing to note is that updating the entity does not automatically change the GO

prime cipher
#

Not sure, if this is the right channel, if to ask questions about tiny mode; but didn't find a web channel, so this seems most appropriate one, as tiny uses ECS. As by now the documentation of tiny mode is ... a bit tiny, I was wondering, if anybody has infos / hints about interaction with javascript. Only found very outdated infos, the days tiny was still using ts.

opaque ledge
#

i rarely see anyone talking about Tiny in this channel, you better off asking in forums imo

#

Tiny should have their own forums

prime cipher
#

@opaque ledge alright thx. does that implicitly also mean, that tiny is not yet in a state to investigate?

opaque ledge
#

whole ECS is like that ๐Ÿ˜„

#

or DOTS rather

cursive cosmos
#

@prime cipher The only time I've heard people speak about tiny is in the use of 2D DOTS in Unity, but I would have no clue when it would be used with javascript at all. Especially if we are talking Unity since the last version of Unity that actively used JS is quite far back in the versions by now.

prime cipher
#

the mentioned sample .. I did not find though

cursive cosmos
#

Why do you wish to do this btw?

prime cipher
#

This is probably a bit of a different use case ... however I think with DOTS / ECS in tiny there might be a fast alternative to render big data volumes visually. The data would have to be injected from outside. Basically, injecting javascript (like e.g. a user name) would be probably easier than to double api calls in unity again.

cursive cosmos
#

Are you thinking of using unity to render like massive graphs or such things?

prime cipher
#

got me

cursive cosmos
#

hm...

#

Yeah, I don't know, unity games tend to be pretty closed for security measures.

prime cipher
#

web enabled, small footprint, components and systems, burst ... sounded like a match to give a try

cursive cosmos
#

I mean, you for sure can do this, but I don't know how it would work in a website.

#

Like making a desktop program that can render these kind of data super fast is no big deal, but to convert it to a webpage and take inputs from javascript may be a bit tricky.

prime cipher
#

that is what I want to find out, if there is an interlinkage possible.

#

or if it is to sandboxed

cursive cosmos
#

I don't really know if the web conversion of unity allows like startup parameters and such

prime cipher
#

so basically c# calling javascript to read a state that is set by the browser environment.

#

me neither, will try to check out ๐Ÿ˜‰

cursive cosmos
#

Yeah, the dllimport may work, but this is a very specialized area of expertise I imagine ^^; Might be difficult finding people who know about this

tawdry tree
#

noomie, you might want to look at existing javascript libraries, and better yet, libraries utilizing WebAssembly. I don't know of any free ones, though. In the end you need JS for interop anyway, so a decent JS library using webGL should be quite fast enough. For heavy calculations (if you're doing that for some reason), that could be offloaded to WebAssembly.

sudden comet
#

Hello guys, Iโ€™d like to instantiate object using GameObject.Instantiate in a SystemBase but recover the Entity converted as soon as possible to link it by ref to another object, any idea ?

tawdry tree
#

So you're spawning from a prefab?
First, consider doing this in OnCreate instead, adding a Prefab component, and then then using EntitManager.Instantiate(prefabEntity)

#

As for how to actually convert gameobject to entity, you could grab it by name, but it's cleaner to use GameObjectConversionUtility

sudden comet
#

Yes Iโ€ฏspawn from a Prefab.. If Iโ€ฏuse EntityManager.Instantiate, the GameObject is not instanced "old unity way" and then the NavMeshSurface cannot be computed ๐Ÿ˜ฆ

tawdry tree
#

Oh yeah, DOTS has no navmesh support yet

sudden comet
#

Yes Iโ€ฏknow it is why Iโ€ฏhave to use an hybrid approach

tawdry tree
sudden comet
#

I cannot wait for this feature to be released even in preview

#

The only problem is that I need to GameObject.Instantiate my walls .. to have them in the navmesh..

#

But Iโ€ฏalso need to link the entity created to an other one to be able to destroy it later

tawdry tree
#

Do you dynamically add and remove the walls?

sudden comet
#

sure ๐Ÿ˜‰

tawdry tree
#

That means less shortcuts are available

sudden comet
#

then navMeshSurface.BuildNavMesh();

#

what do you mean ?

tawdry tree
#

If you didn't change it after spawning you could just set it up correctly in editor

sudden comet
#

yes but it is generated ๐Ÿ™‚

tawdry tree
#

Or build just the navigation stuff in GO, and make entities to represent it

sudden comet
#

Yes Iโ€ฏkind of evaluated it

#

Thanks for you help .. I will try to hack a bit then ...

#

There is no way to recover the โ€™Entityโ€™ from the Instanced GameObject ?

tawdry tree
#

GameObjectConversionUtility.ConvertGameObjectHierarchy returns an Entity

sudden comet
#

Will try it ๐Ÿ™‚ thank you

undone torrent
#

Is there a way to draw gizmos which hybrid render ?

#

we only want to draw some cubes with a query ecs entity components

#

we also accept handlers

tawdry tree
#

You can poll the EntityManager from GOs

#

Which I assume would let you do it how you normally draw gizmos

opaque ledge
#

@undone torrent maybe check out DebugStream class

#

i have never tried it, but i heard some people using it to draw stuff

#

tho not entirely sure if it was gizmos

cursive cosmos
#

Got a question about DOTS and Burst in general, Would it make a loop that runs on a separate thread or would it be better to let all the single calculation of a loop work in a different thread?

I have a need for a triple for-loop since I am spawning a chunk of vertices which goes in each and every axis, but I think it would be nice to separate all the vertice calculations out on the worker threads, I heard burst compilers do this automatically with loops somehow, but how would I best go about this?

north bay
#

How do you determine if a subscene that you load with LoadSceneAsync has finished loading?

#

Nevermind found it, SceneSystem.IsSceneLoaded

mint iron
#

@cursive cosmos burst compiler doesn't do that but the jobs system can be used to schedule jobs in parallel. You could use either Entities.ForEach with .ScheduleParallel() or if your data is in your own structures use an IJobParallelFor https://docs.unity3d.com/ScriptReference/Unity.Jobs.IJobParallelFor.html as for if you should it depends entirely on how much work is being done - if you're over the threshold of scheduling overheads (both from the start and data consolidation afterwards).

signal sand
#

I have a large float array that I modify with jobs. I'm using a persistent native array since the size will not change.

Aside from the modifications and some other job utilizing queries on the array, I occasionally need to know the value of a particular index in theain thread.

Is there any need to keep a separate non native array for the value checking? I'm new to the job system and native arrays so I'm asking here.

mint iron
#

@signal sand i don't think there's a need to keep a managed copy because both managed and unmanaged code can use native collections without issues. Caveats being 1) that the default c# collections tend to be a bit faster when run outside of burst and 2) if you're reading and writing it from different threads.

signal sand
#

@mint iron No.2 is what I'm worried about. Unlikely to matter much since at most I'll be reading slightly old data.

#

I will not be modifying it at all in the main thread.

cursive cosmos
cursive cosmos
#

Anyone know how I can calculate this into a mathematical float3 instead?

for (int x = 0; x < xMax; x++) {
  for (int y = 0; y < yMax; y++) {
    for (int z = 0; z < zMax; z++) {
      //whatevs
    }
  }
}

The order it calculates is important, z > y > x.

#

I used something like this before:

var pos3D = new float3(index % xMax, (index / xMax) % zMax, (index / (xMax * zMax)) % yMax);

But I don't think this calculate it in the right order.

#

using this inside one IJobFor made my life earlier relatively easy, but I am no math genius...

mint iron
#

its not on the fly in the sense i'm thinking about. But if you mean can it in some circumstances compile vectorized assembly, then it can.

#
Gist

GitHub Gist: instantly share code, notes, and snippets.

#

if its really important that something get SIMD you'll have the best results by using int4/float4/bool4/math.select to queue the compiler as to what you need.

cursive cosmos
#

the first link ain't working @mint iron , but I need to look into this...

public int3 Get3DIndexes(int idx)
{
  int x = idx / (_yzLength);
  idx -= (x * _yzLength);
  int y = idx / _zLength;
  int z = idx % _zLength;
  return new int3(x, y, z);
}

This should be all I need

#

just need to make sure the math is right

#

yeah, no, that did not work...

mint iron
#

ahh it was private repo sorry, updated link.

cursive cosmos
#
var coords = new int3(index / (size * size), (index / size) % size, index % size);

This calculation works if my chunk is always the same size as a cube, but does not work as a rectangle. I just input the index of the loop and I get the right positions for the vector, something like this is what I would need for the IJobFor so I can just take that index and work through the coordinates.

#

I wish there was like a math forum here in unity x)

#

Maybe 3D could help...

cursive cosmos
#

Might have solved it with:

var coord = new int3((index / (ZMax * YMax)) % XMax,
                       (index / ZMax) % YMax,
                       index % ZMax);
safe lintel
#

huh new entities package

ocean tundra
#

WOOOOO

cursive cosmos
#

oh god, did they change a lot? D:

ocean tundra
#

i dont see it

safe lintel
#

seems pretty minor?

ocean tundra
#

still in the preview package source?

safe lintel
#
Fixed

    Prevented remapping of hybrid components during deserialization which caused IL2CPP builds to fail on a missing property bags.
    Fixed exceptions being thrown when inspecting an entity with a GameObject added through EntityManager.AddComponentObject
    Fixed load order of JobReflection static methods which were causing InvalidOperationException: Reflection data was not set up by code generation exceptions in player builds.

Changed

    An exception is now thrown during serialization if a shared component containing entity references is encountered.

Removed

    Removed expired API World.AllWorlds.
    Removed expired API EntityComponentStore.CreateChunks(Archetype*, ArchetypeChunk*, int, int).
    Removed expired API EntityManager.CreateChunk(EntityArchetype, NativeArray<ArchetypeChunk>, int).
    Removed expired API EntityManager.LockChunk(ArchetypeChunk).
    Removed expired API EntityManager.LockChunk(NativeArray<ArchetypeChunk>).
    Removed expired API EntityManager.UnlockChunk(ArchetypeChunk).
    Removed expired API ArchetypeChunk.Locked().
    Removed expired API struct NativeArraySharedValues<S>
#

0.11.1p4

ocean tundra
#

oh i thought a major version

#

0.12 maybe

#

๐Ÿ˜›

cursive cosmos
#

yeah, updating to the 0.12 now, let's see if it breaks something ๐Ÿ˜„

safe lintel
#

i always hope for a major version ๐Ÿ˜„

ocean tundra
#

i want that new component enabling/disabling thing

safe lintel
#

i want it all! dots team release the kraken!

cursive cosmos
#

what the, what is "mono cecil"?

#

Guess I'm updating that too!

ocean tundra
#

some sort of code rewrite/inspection thing

#

it looks at your compiled dlls and does things to them

#

๐Ÿ˜›

cursive cosmos
#

kinky

ocean tundra
#

haha

#

ive seen lots of unity games use it for modding

#

im hoping i should be able to dynamily load code during game start, so that i can have modding built in to the game

safe lintel
#

thats one thing i wish unity had far better support for

ocean tundra
#

anyone tried dynamic code loading and ECS? i worry that the Systems/burst wont like it

safe lintel
#

burst wont work with it

cursive cosmos
#

now the important part, to run the shit and hope it works

ocean tundra
#

but burst is a runtime compile step yes? so as long as the dlls are loaded before it does that it should work?

safe lintel
#

from what i understand modders wouldnt be able to write their own burst jobs

ocean tundra
#

well that will be a issue

#

oh well worry about that much later

#

already got data loadable as mods so maybe that will be enough ๐Ÿ˜›

safe lintel
#

nice

ocean tundra
#

theres a way to burst compile a function pointer on demand right? ive seen that somewhere

#

i guess i could have some sort of system that loops over a list of those function pointers that modders to make/add

#

it would actually be a very advanced modder who could even make burst compatable mods, like took me weeks to get my head around structs, they would need to do the same

#

its probably not even worth it

deft stump
#

Updating to new entities packages just to see if it breaks something...

opaque ledge
#

there is a new entities package ? ๐Ÿ‘€

spark glade
#

looks like a small maintenance/depracation update

opaque ledge
#

aww

amber flicker
#

yea - AddComponentObject fix is welcome and it looks like NativeList has a couple of new remove methods but that's about it

opaque ledge
#

what is the fix ?

amber flicker
#

mostly that it broke the entity debugger for an entity that you did AddComponentObject with

opaque ledge
#

ah okay

amber flicker
#
  • Fixed exceptions being thrown when inspecting an entity with a GameObject added through EntityManager.AddComponentObject
#

also I assume this will be important for some:
* Prevented remapping of hybrid components during deserialization which caused IL2CPP builds to fail on a missing property bags.

signal sand
#

I have a 2d array operation that I am converting to use jobs.
One of the things I'm doing with it is adding values from another 2d array at an offset postion.
I converted it to a flattened native array.
It's possible that one of the arrays is smaller. In which case I optimized via finding the common rectangular section and looping over that.
This means that I skipped over cols that do not need to be modified.
This is how that looked: https://pastebin.com/A5TfgJvW
Now if I use parallel for, I can't skip like that.
Parallel for jobs are scheduled with a startIndex and a length. Which means it will try to read the entire row sequentially.
Would a normal IJob be better?

sudden comet
#

Will try it ๐Ÿ™‚ thank you
@sudden comet It seems that conversionSystem.AddHybridComponent(_collider); during conversion did the trick
I also had to make this NavMesh update calls

                .WithChangeFilter<RenderEntityComponent>()
                .WithAll<RenderEntityComponent>()
                .ForEach((Entity entity) =>
            {
                NavMeshSurface navMeshSurface = GameObject.Find("NavMeshGround").GetComponent<NavMeshSurface>(); //:TODO: :HARDCODED: :FIX: this
                navMeshSurface.BuildNavMesh();
                Debug.Log($"{nameof(navMeshSurface.BuildNavMesh)}");
            }).WithoutBurst().Run();```
to be updated after
    `[UpdateAfter(typeof(CompanionGameObjectUpdateTransformSystem))]`
surreal sable
#

Is there a simple way to tell unity that I don't need the results of a job?

#

Like: The entity who requested it died. It was uding persistent native arrays.

#

And I have to keep track of evry job handle and complete them before disposing those.

viral sonnet
#

Anyone else gets URP 9.0 errors in Unity 2020.2.0a15?

dull copper
#

you use the ancient preview from package manager?

#

I wouldn't wonder if it's broken by now

#

if you dont mind extra git clone, I have a branch here that should work for URP, this is up-to-date with current master and hdrp/staging from github (so bleeding edge 10.x URP + HDRP)

#

I've reverted two changes on that branch that require c++ changes that haven't landed on a15 yet

#

other is for URP's 2D fixes and other is for HDRP's fast memory access

#

@viral sonnet ^

toxic mural
#

@ocean tundra I am using an asset UMod that Im able to load ECS mod code with (with a few manual stopgaps) but no luck with Burst so far

dull copper
#

do note that since it's bleeding edge, a lot of things can be broken + it also has upcoming shader graph change (so your SGs will look totally different)

toxic mural
#

but I also don't really understand Burst well enough to know how to approach getting it to work

viral sonnet
#

oh thanks ... didn't notice the URP package manager version is old ... why is unity doing this ...

dull copper
#

well, they simply haven't released a new version

#

there's a ton of work going on atm so I'm guessing they haven't gotten a setup that's stabilized enough for a new release

viral sonnet
#

yeah i see, not really a problem. i'll just stay on the current version which is stable for me (2020.2.0a13 and URP9)

pulsar jay
#

Can anybody help me brainstorming? How would you go about using a grid in ECS?

#

I am currently having CellPosition components and a System which reads from it and writes the resulting position into the Position component

#

But its kind of weird to access unitys grid in the system to read its values and then having to "copy" its CellToWorld method because I cannot use it directly

#

I am thinking if it may make sense to have a shared component which is basically a copy of the grid settings (size etc.)

cursive cosmos
#

@pulsar jay I personally don't think the grid is even needed, just create your own grid overlay and have positions/coordinates decide the rest. The gird I feel just makes it more complex.

pulsar jay
#

@cursive cosmos so you mean I do not need the Unity Grid component? I guess even if I dont use it I would need some way of authoring the custom grid

deft stump
#

Question: when and why do i want to use class icd's?

#

As opposed to struct icd's

eternal ice
#

Question: when and why do i want to use class icd's?
@deft stump store link to material, mesh, or texture. Any managed data...

#

and bake this managed data in SubScene

cursive cosmos
#

I mean, a custom grid component does not take too long to make.
In the end, the grid is only a visualization of a flat coordinate system.

tawdry tree
#

Class ICDs make their data effectively exists "outside" the DOTS system. the documentation suggests this might be useful while porting code from gameobjects. It might also be useful if you have a specific thing you want to do that isn't allowed for a struct ICD.

pulsar jay
#

@cursive cosmos Sure I was just wondering how to integrate it into ECS. I guess using the conversion workflow with an authoring component wouldnt make much sense would it? Because I would only have one grid and would have to access it together with each CellPosition component

#

So I thought maybe it should be a shared component? Haven't found much about the workflow with those though.

tawdry tree
#

@pulsar jay What are you trying to achieve here? What's the use case?
Have a grid of tiles or something?

pulsar jay
#

Yeah thats basically it. But it can be various different tiles which can be "painted" onto the grid

tawdry tree
#

Painted at runtime, or just in editor?

pulsar jay
#

in best case both

tawdry tree
#

At runtime you would need some system (as in mechanic, not necessarily ECS) to get the position of that and selected tile etc, and you'd design the system to be a bit more flexible. if it was editor only you could do a much simpler "convert once" from the gameobject tilemap or something like that.

cursive cosmos
#

@pulsar jay I prefer doing everything in code, so I actually stopped using the conversion system

tawdry tree
#

+1 I am not too fond of the conversion system. Good for quickly making things that work, but rather messy - if nothing else I would want custom IConvertgameObjectToEntity to get things exactly how I want it.

pulsar jay
#

I actually had a kind of conversion workflow going on before using ecs where it would use gameobjects in edit mode but DrawInstanced of custom batches at runtime

tawdry tree
#

Now, this is the Data Oriented tech Stack here, and my thoughts is that you need a good representation of the data (ie. grid), and some way to translate that to visuals

pulsar jay
#

But it adds some error potential and some stuff has to be implemented twice

tawdry tree
#

So more questions! Do you have a set size of the grid? Like, do you know when you spawn the entity it that it will be X*Y, and never change? There could still be multiple grids in the game, of course,.

#

If you either need infinite size or don't know how big it will be, you need chunking, ie. splitting into into "chunks" (non-ECS) of tiles

pulsar jay
#

atm it is basically a randomly sorted list of cell positions and indices

#

it is not limited

tawdry tree
#

So unlimited size grid?

pulsar jay
#

yep

#

I am also still torn between just serializing the entities or using my own (more compact) format

tawdry tree
#

There we're into very familiar territory... I have discussed and thought a lot about procedurally generating block/tile worlds. This, of course, first requires you to have a method to hold all that data.

#

Some conclusions, decisions and assumptions, which might not apply to you:
-I want to support an arbitrary sized world
-I want fewer entities to reason about
-I want to split systems into the smallest pieces that make sense
Thus I need:
-A good way to hold the data of a Chunk of my world.
-->This means flat collections
-->Each chunk is one entity, and one entity only (special cases allowed for pieces therein)
-->Sizes are constant during runtime, the same on all axes, and defined by some constant in the code so I can experiment with different sizes
-A system to create chunks around the player
-A system to load/generate the data as needed
-->And another to save
-A system to read the chunk data and create the visuals (in this case, create a RenderMesh)
-Helpers to make working within this easier (convert between world, chunk, and block-within-chunk("chunkInternal") coordinates
-Helpers to convert between 3D positions and flat array indices

#

This is for Minecraft-style 3D block(voxel) terrain - 2d makes things somewhat simpler.
Possibly the most complex part is creating the visuals from the data - I've done this before in gameobjects and will apply a similar method once I get there in my DOTS VoxelGen toy project.
The complexity is in working with RenderMesh, especially when it comes to textures - a texture atlas with all tiles and setting the UV coordinates is the way i'm gonna do it

pulsar jay
#

Sounds like its going in a similar direction. I guess chunks and loading/unloading at runtime wont be necessary for my current use case though as it will not get this big

#

I guess instancing will help a lot in my case as many of the tiles are the same mesh

#

Your use case sounds a lot like Minecraft btw.

#

That also came into my mind when I thought about interesting testcases for ecs

tawdry tree
#

In my case, each chunk (size not decided yet, but probably larger than 8x8x8) is one mesh, procedurally built, and the entire thing has one texture.

#

And yeah, I'm basically remaking Minecraft's worldgen systems in ECS. As I said, toy project ( to learn more about ECS)

#

Are you doing 2d or 3d?

pulsar jay
#

And yeah, I'm basically remaking Minecraft's worldgen systems in ECS. As I said, toy project ( to learn more about ECS)
@tawdry tree Sounds really interesting

#

I am doing 3d

tawdry tree
#

Blocks(+other simple models) or arbitrary models? because the latter means it becomes a lot harder to do one entity with one mesh like I'm doing

#

And if you suddenly need a entity for each thing in the grid... that gets real big real fast

pulsar jay
#

its arbitrary models. I figured the conversion worklow might work well for that case though. I can build the Tiles as prefabs, convert them to entities and than duplicate it all around the map based on the map data

tawdry tree
#

That sounds reasonable

pulsar jay
#

having on one entity for each tile is the current plan. The map is kind of "limited" btw. there is just no fixed limit

tawdry tree
#

In such a case you'd still want a helper to have world<->grid conversion in one place (to avoid different code leading to misplaced things

#

So arbitrary, but finite size

pulsar jay
#

So arbitrary, but finite size
@tawdry tree thats correct

tawdry tree
#

Then it should be fine-er to do one entity per grid position. At least if it's pretty flat (so not 100+ meshes per horizontal grid cell) and/or sparse (not every cell is occupied)

pulsar jay
#

yeah its more like a height offset + multiple layers than a complete grid in y direction

#

atm I have a system which sets the position component with the data it gets from the cellposition component

#

but I basically just read each of the values out of the grid into value types to get it into the lambda expression which feels wrong

#

because I cannot pass references into the lambda expression

ocean tundra
#

@toxic mural Sweet thanks for letting me know, at least you got some code loading

toxic mural
#

Yeah there are some "gotchas" I ran into, but I think if the ECS code is compiled with Unity, I dont know why Burst wouldn't work

tawdry tree
#

@pulsar jay Is this on conversion?
Because what I'd do there is to basically convert whatever your data source is into an array containing a little struct of int3 cellPosition and whatever data you need to place the cell contents - preferably an int, if or some other identifier to use against a lookup, if possible.

toxic mural
#

But I also barely/dont understand what burst is, so I dunno

ocean tundra
#

@toxic mural Full code based mod support is way down on my TODO list ๐Ÿ˜›

#

maybe by the time i get to it Burst can be called on demand

tawdry tree
#

It's a compiler. It takes human-readable code, and makes it into machine-runnable code.
The default C# compiler compile to a format which needs an interpreter to work (so you need to have .NET installed to run it), but other languages (and other C# compilers) go straight to usable machine-code

toxic mural
#

Personally I'd say just spend the $40 for an asset that does it, or 90% of it

pulsar jay
#

Yeah atm I have scriptable objects basically containing lists of int3 and int and have a MonoBehavour which reads it and creates all the entites. the system will just move them to the correct position afterwards

ocean tundra
#

hmmm maybe, my stuff feels pretty custom tho

tawdry tree
#

If the asset is done well and work, and is battle-tested, then for sure

toxic mural
#

@tawdry tree For Burst specifically, does it only ever happen at runtime? Like it takes the compiled stuff and redoes it into burst? Or is it a compile time thing where a DLL can contain bursted code?

tawdry tree
#

Whatevr you make would likely be a bit more specialized, but also inferior in most other aspects

ocean tundra
#

I thought Burst was runtime into a cache

tawdry tree
#

You mean compilation? That's on build. I don't know the specifics, but if I had to guess Burst either makes directly runnable code, or code which is hyper-optimized for the interpreter to use effectively. My understanding is that it bypasses a lot of the normal interpreter things to have more control (and also more danger)

coarse turtle
toxic mural
#

Thats cool

#

ty for the test

#

Someone was saying we wouldn't be able to have bursted code in mods so I've been trying to find out exactly why

#

but maybe we can it seems

ocean tundra
#

hmmm i thought it was runtime compiled for mono builds

#

but maybe you could grab that burst generated dll somehow and load that dynamicly?

toxic mural
#

Theres an article "analyzing burst generated assemblies" buts its about two years beyond what I understand

#

I should probably focus on making the game happen first rather than making it fast

ocean tundra
#

@toxic mural haha i keep doing the same thing too, wanting to play with optmization stuff instead of working on core game features

#

that article looks great, going to read it now

#

maybe a dumb question, unrelated to burst things.
Is it worth centering my game map so 0,0,0 is the Center? Currently its a corner

#

the maps are expected to become quite large but not insane

tawdry tree
#

What magnitude are we talking here? 100's of Unity units? 1000's? 10000's? Anything in that range should be fine unless you have things which needs really high precision

viral sonnet
#

@ocean tundra URP has relative rendering so it doesn't matter anymore as long as you stay in float min/max absolutely in coordinates

ocean tundra
#

Probably within 10k but its a RTS so would love to go MASSIVE ๐Ÿ˜›

#

@viral sonnet Didnt realise that had made its way into URP, thought it was HDRP only

cursive cosmos
#

If you find the width to be limiting, just go UP!

viral sonnet
#

in standard rendering lightning breaks further away long before float is exceeded

ocean tundra
#

maybe i will center it but it will likely only ever be 10k

viral sonnet
#

then it won't be a problem

ocean tundra
#

yea

unborn totem
#

@tawdry tree if all your blocks are going to have the same size texture, you can use TextureArrays instead of a sprite sheet, letting you keep all your UVs the same.

tawdry tree
#

Hmm, shader stuff.
I really should learn more about that, but my mind was pretty much fired after each session of the graphics programming course back in school, so I have no fond memories of it...

unborn totem
#

TextureArrays are pretty simple, and I think can be done in ShaderGraph now.

#

I think you still need an editor script in order to create a texture array asset, though.

#

as far as I know, Unity never provided a way to do it through the GUI

toxic mural
#

Is DefaultGameObjectInjectionWorld the most control we have over the hybrid conversion process? We can't like put a component on a gameobject that causes it to spawn in a specific world?

ocean tundra
#

If your using subscenes or gameobjectconversionutility you can control the target world

#

but that gameobjectentity thing you have to mess with that Default World variable

toxic mural
#

Oh hey gameobjectconversionutility sounds like it might do it

#

ty @ocean tundra

ocean tundra
#

there is a issue with it

#

its slow

#

so for every gameobject you want to convert, it will create/setup a whole conversion world. do the conversion, then clean it all up

#

so i've wrapped mine up in a mainmenu background process and then cache the results (world serialization)

#

but subscenes would be best if you dont need to convert at runtime

toxic mural
#

Oh ha main menu background process, so like while the user is clicking New Game you're in the background processing things and serializing them?

ocean tundra
#

on game start basicly

#

so when sitting in mainmenu, all game setup, any logos/splash things ill do my conversion

toxic mural
#

Yeah thats cool

ocean tundra
#

but i also store the caches in streaming assets, so when playing in editor it makes them all on play and then bundles them with the game

#

so they should only ever rebuild if the player messes with the mod lists or i do a data only update

toxic mural
#

Dang thats smart. I'll try and do that too actually

ocean tundra
#

sweet

#

i have some code that may help

#

the issue with world serialization is it just gives you a array of Unity Objects

#

things like mesh's and materials

#

saving those at runtime is a PITA

#

and is silly as they should be game assets

#

so i built a thing to take a asset and give me its Addressable address so i can load it next time

#

when you get to world serialization let me know and ill share it

toxic mural
#

Will do

ocean tundra
#

its my biggest annoyance with Addressables, why cant i get the address from something ive already loaded

toxic mural
#

I thought Addressables might be a solution to a different problem of mine, I took one look at making a custom resources locator and nope'd out

#

I mean at least the manual seems thorough

ocean tundra
#

a custom resources locator?? i barley know what that is, what will you use it for?

pseudo pollen
#

@toxic mural you made it groups?

#

there is that hosting thing on that

toxic mural
#

My problem is, the mod solution I'm using has its own LoadAsset() way of doing things, so I need a way to let Addressables see into the mod objects

pseudo pollen
#

on addressables groups made asset and add those to mod objects should it solve it in your case?

#

in your script it should find them from the mod asset group

toxic mural
#

The problem is all the Addressables meta data that gets generated, I can include it in the mod file but I'm not sure how to load it at runtime so addressables can add it to its catalogue

ocean tundra
#

there is a method somewhere in addressables to load a catalogue

#

i plan on using that for mods that add assets

plush stirrup
#

does anyone know why Entities 0.11.1/Burst 1.3.2 on Unity 2019.4LTS might be throwing 300+ errors of this nature on every single assembly recompile?

#

Looks like it is caused by an ExecuteAlways system we use to manager instanced renderer material properties, but I'm not sure why ExecuteAlways system would be invoked in the middle of solution rebuild. How can I stop this?

ocean tundra
#

are you using subscenes?

plush stirrup
#

Not that I'm aware of, just one traditional scene

ocean tundra
#

not sure why then

#

maybe put a application.isplaying if in your system

plush stirrup
#

it's an editor targeting system that's supposed to work on renderers even in edit mode so gating it by isPlaying doesn't make sense, sorry

ocean tundra
#

oh its only for in editor...

plush stirrup
#

it's for both, hence ExecuteAlways

ocean tundra
#

is there a bool somewhere in unity like is building/is compiling?

#

also im guessing your creating a bunch of native containers in oncreate and destorying them in ondestory?

plush stirrup
#

there is, it's EditorApplication.isCompiling. but what would I do with it? the fundamental issue is that OnUpdate of systems is called by Entities while that value is true, so gating individual systems feels like a bandaid. what's more, OnUpdate methods aren't allowed to bail or return null, they must return a JobHandle

ocean tundra
#

what??

#

are you using SystemBase?

plush stirrup
#

no, JobComponentSystem

ocean tundra
#

oh use system base

plush stirrup
#

is that something new? I just updated from 0.1 to 0.11 today

ocean tundra
#

**ComponentSystems are deprecated

plush stirrup
#

oh that's good to know

ocean tundra
#

they are only still around cause some conversion stuff needs them

#

my guess is the assembly reload isnt letting you finish safely or not calling on destroy so your native collections die

plush stirrup
#

I'll get to that then! could you tell me if 3 previous issues I hit with 0.1 to 0.11 upgrade sound right?

  • World.Active is no longer a thing. Since the only places where it was referenced were external utility things creating entities and not systems, I just replaced it with World.DefaultGameObjectInjectionWorld
  • SetFilter is no longer a thing. I'm assuming its equivalent is SetSharedComponentFilter (renamed to reflect its only intended for shared components?)
  • GetComponentVersion for chunks seemed to be renamed to GetChangeVersion
zinc plinth
#

you updated from 0.1 directly to 0.11 ? o.0

ocean tundra
#

World.DefaultGameObjectInjectionWorld yup thats fine, but not inside systems. just use World for that

#

SetFilter again that sounds right, i dont actually use any filters so not 100% sure on usage or anything

plush stirrup
#

yeah we were using 0.1 along with 2019.2 for a very long time and just updated to 2019.4 LTS today, so we figured it might be a good time to jump forward to latest entities package

#

haven't had time to follow every release over past year

ocean tundra
#

oh you should keep updating and go to 2020.1beta

#

they said after the next update all entities packages will be 2020+ only

plush stirrup
#

I don't think it's appropriate for a project on legacy pipeline that's supposed to release in 3-4 months and has lots of third party dependencies.

zinc plinth
#

where did they say this ? @ocean tundra

ocean tundra
#

oh yea no if thats your timeline dont update

plush stirrup
#

so we'll be sticking with whatever would be available for 2019.4 lts

ocean tundra
plush stirrup
#

am I understanding right that package manager would just ignore any versions higher than compatible ones and there is no need to keep track of exact releases that are last to support it?

ocean tundra
#

yea pretty sure thats right

zinc plinth
#

I find it pretty weird in a bad way that you have to be on a beta to get the latest versions..

ocean tundra
#

when making a package you have to say what version of unity it supports, as long as they update that correctly you wont see newer packages

#

@zinc plinth it actually makes sense to me, 90% of entities is all in the package, but a small bit needs unity core changes, they can only really make those in the latest betas

zinc plinth
#

I didn't say it didn't make sense, it really does

I meant that policy-wise

ocean tundra
#

its annoying tho

zinc plinth
#

yes

ocean tundra
#

i really need to update tho

#

im on 2020.1b7 and entitys v0.10 i think

#

always terrified of updates

plush stirrup
#

where can I find a reference page highlighting differences of new SystemBase vs JobComponentSystem? there is no information whatsoever in the package changelog

ocean tundra
#

and i dont even have far to go

zinc plinth
#

unless 0.12 fixes my weird af bug with broken physicscolliders I don't think I'll upgrade

ocean tundra
#

@plush stirrup i think the main docs is your best bet

#

oh wow it had a update

#

this bit is the main links

Entities.ForEach -- the simplest way to iterate over ECS component data.
Job.WithCode -- execute a lambda function as a single, background job.
IJobChunk -- a "lower level" mechanism for iterating over ECS component data chunk-by-chunk.
C# Job System -- create and schedule general purpose C# jobs.
#

umm the key things i remember
ForEach does magic code gen
you can use 'in' to mark a component type as read only, that means its change version number wont increase

plush stirrup
#

for JobComponentSystem/IJobForEach/JobHandle equivalent, is the Job.WithCode example the correct one, or is simple ForEach capable of doing same thing?

ocean tundra
#

you can do the same thing with ForEach

#

when you do .schedule there is a overload where you can pass a job handle

#

and it will return a job handel

plush stirrup
#

is that in addition to or instead of ScheduleParallel overload?

ocean tundra
#

ScheduleParallel should have the same option

plush stirrup
#

ah alright, I'll try that, thank you!

ocean tundra
#

you can also mess with the Dependancy property yourself

#

im unsure how good that is tho

plush stirrup
#

is there a way to post code snippets here or is this Discord usually using some code pasting website? I can't seem to get standard code shortcut (triple tilde) to work

ocean tundra
#

use 3 `

#

cs

plush stirrup
#

oh, it no longer shows up in post preview while you type, weird. sorry then!

ocean tundra
#

use cs after the 3 ` and it will format it as c#

plush stirrup
#

so I'm a bit confused about job handles and Schedule. previously what you did was declare a method like this, which was dependent on also declaring an IJobForEach struct:

{
    var job = new PropertyAnimationJob ()
    {

    };

    return job.Schedule (this, inputDeps);
}```

however if you use new SystemBase, you don't declare any structs, which means you can't be responsible for setting a unique job up (you just use that ForEach lambda thing), and can't really pass input dependencies through. does that mean I actually don't have to worry about providing any arguments to .Schedule () call?
#

is a reference to currently running system and input dependencies implicitly provided already?

#

here is a simple example of a system that does nothing but increment the version. is this a correct way to update it from JobComponentSystem to SystemBase?

[UpdateBefore(typeof(PhantomRendererSyncSystemV2)), AlwaysUpdateSystem]
[ExecuteAlways]
public class PhantomRendererPropertyAnimationSystem : JobComponentSystem
{
    struct PropertyAnimationJob : IJobForEach<AnimatingTag, PropertyVersion>
    {
        public void Execute([ReadOnly] ref AnimatingTag tag, ref PropertyVersion property)
        {
            property.version++; 
        }
    }
    
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new PropertyAnimationJob ()
        {

        };

        return job.Schedule (this, inputDeps);
    }
}

[UpdateInGroup (typeof(PresentationSystemGroup))]
[UpdateBefore(typeof(PhantomRendererSyncSystemV2)), AlwaysUpdateSystem]
[ExecuteAlways]
public class PhantomRendererPropertyAnimationSystem2 : SystemBase
{
    protected override void OnUpdate()
    {
        Entities.ForEach 
        (
            (ref PropertyVersion property, in AnimatingTag tag) =>
            {
                property.version++; 
            }
        )
        .Schedule();
    }
}```
ocean tundra
#

close

#
{
    protected override void OnUpdate()
    {
        Entities.ForEach 
        (x =>
            (ref PropertyVersion property, in AnimatingTag tag) =>
            {
                property.version++; 
            }
        )
        .Schedule();
    }
}```
#

missed x=>

plush stirrup
ocean tundra
#

oh wait

#

no that is right

#

๐Ÿคฆโ€โ™‚๏ธ

plush stirrup
#

๐Ÿ˜„

ocean tundra
#

you can also use Entities.WithAll<AnimatingTag >

#

instead of marking it as 'in'

#

but thats only if you dont use it

plush stirrup
#

does that also imply its read only?

ocean tundra
#

in = readonly

plush stirrup
#

yeah, and same with WithAll?

ocean tundra
#

withall = entity must have component

#

not if its pulled into your code

plush stirrup
#

ah

#

so WithAll is equivalent of generic arguments on old IJobForEach and signature within ForEach block is equivalent to old Execute method signature?

ocean tundra
#

look at the selecting entities bit

plush stirrup
#
{
    public void Execute([ReadOnly] ref AnimatingTag tag, ref PropertyVersion property)
    ...```
ocean tundra
#

with all is just about filitering to select just entities that have that component

#

but dosnt read/write to it

plush stirrup
#

ah right. that's a nice syntax, reminds me of Entitas queries

#

is specific order of these overloads important?

#

e.g. With* always first, Schedule* always last?

ocean tundra
#

i dont think so

#

but i try to have the with bits first

#

then the query

plush stirrup
#

ok then just for style consistency

ocean tundra
#

schedle probaly has to always be last

plush stirrup
#

is the body of ForEach lambda expression subject to any code generation shenanigans that might break if I skip curly brackets for a one liner content?

ocean tundra
#

haha

#

it probably is

#

you can try it and see

#

that whole bit is code gened

plush stirrup
#

ok I'll play it safe till I see everything works and I'll try then ๐Ÿ˜›

ocean tundra
#

you can see the code gen tho

plush stirrup
#

if nothing else, this is already a giant reduction in line count

ocean tundra
#

DOTS => Dots Compiler

#

yup[

#

way nice

#

theres also some sort of IEntityJob comming soon

#

for people who dont like the lamder

plush stirrup
#

EntityQueryDescValidationException: EntityQuery contains a filter with duplicate component type name PropertyVersion. Queries can only contain a single component of a given type in a filter.

{
    Entities.WithAll<PropertyVersion, AnimatingTag> ()
    .ForEach 
    (
        (ref PropertyVersion property, in AnimatingTag tag) =>
        {
            property.version++; 
        }
    )
    .Schedule();
}```

I guess that means that PropertyVersion is now always implicitly filtered for?
ocean tundra
#

so dont have the component is both with all and the foreach

#

the animation tag should be in with all (as you dont read or write)

#

and property version in just foreach (as you do read/write)

plush stirrup
#

ah, I see - the only reason to use in with that second one would've been actually reading something from that component in the body of the function

#

makes sense

ocean tundra
#

yes

plush stirrup
#

uhh, how about no, Unity:

error DC0032: Entities.ForEach Lambda expression exists in JobComponentSystem PropertyAnimationSystem marked with ExecuteAlways. This will result in a temporary exception being thrown during compilation, using it is not supported yet. Please move this code out to a non-jobified ComponentSystem. This will be fixed in an upcoming 2020.2 release.

#

it actually looks like no exceptions are being thrown on my side anymore, moving it to SystemBase nicely fixed all exceptions JobComponentSystem had

#

thanks for guiding me through it @ocean tundra !

ocean tundra
#

all good

#

so that says no jobs in editor systems?

plush stirrup
#

apparently, at least till 2020.2. they always seemed to work fine so I'm not sure what changed there.

ocean tundra
#

just do .Run instead then

#

Run instead of schedule is no job

plush stirrup
#

good to know!

ocean tundra
#

and you still get burst

#

๐Ÿ™‚

#

you have to do .WithoutBurst to not get burst ๐Ÿ˜›

plush stirrup
#

does it make sense to just wrap that in conditional compilation?

.Run()
#else
.Schedule()
#endif
ocean tundra
#

yea probably a good idea

plush stirrup
#

same warning. I think I'll just live with the warning, it seems to trigger no matter whether I use Run or Schedule.

ocean tundra
#

oh i thought those were the new compile errors

plush stirrup
#

good thing is, now that Entities have separate order version and change version and per array checks we might not even need this version incrementing system anymore. with those in place we can potentially change our rendering system to still detect chunk changes and upload parts of the buffer to GPU without having to manage a special tag and hijacking versioning.

#

it's awesome how far it came from 0.1

ocean tundra
#

for change filters theres WithChangeFilter

#

it only works on the internal component version

#

which only goes up when you use Ref

#

and if you use a job chunk thing you can manually control when that component version goes up (as its per chunk)

ocean tundra
#

I want to show the string of a guid there

opaque ledge
#

burst 1.3.2 is up ๐Ÿ‘€

#
## [1.3.2] - 2020-06-16


### Added

### Removed

### Changed

### Fixed
- Burst package has been upgraded popup could fire erroneously under shutdown conditions.
- Debug information for anonymous structs could be created partially multiple times for the same type.
- IntPtr.Size now correctly returns int32 size (rather than UInt64) - fixes an assert.
- Fix safety checks in editor to not log a warning. Safety checks are now restored to true when restarting the editor and are no longer stored as an editor preference.
pulsar jay
#

can anybody tell me what the advantage is of using reciprocal squareroot for normalization in math library: rsqrt(dot(x, x)) * x
just curious

gusty comet
#

since the dots math library is designed for vectorization, I assume they will take advantage of reciprocal sqrt instruction sets when you do things properly

#

some people still use that fast inverse trick, but that isn't faster anymore, its actually slower

pulsar jay
#

so there is a specific reciprocal sqrt instruction that will be used by burst compiler?

gusty comet
#

I don't know what burst does under the hood, but I would be surprised if it didn't

#

arm had that in their instruction set for years iirc

#

so did intel

#

I'm a bit fuzzy on intel though, I might be remembering their avx512 stuff

#

not really a simd guy myself

pulsar jay
#

good to know. I am not well versed in this simd and vectorization stuff

#

Btw. I am trying to extend math atm. At first I was happy that its partial because I thought I could just extend it. Figured that didnt work because of different assemblies ๐Ÿ˜‘ I guess this is more of a convention thing but how would you go about extending math? Making a new class in the same namespace with the same conventions (e.g. math_extensions) using a separate namespace etc.

#

It seems to be the intended workflow to use "using static Unity.Mathematics.math;" when using math but I guess there is no way of getting cutom methods into this without requiring a second using static for another class or is there?

stone osprey
#

Quick questions... hopefully someone can answer me my question fast

#

How do i listen for click events on entities using dots ?

#

For example... we have gameobject spawned in, we click on one... we wanna print a message... is this possible with dots ?

prime cipher
#

Did I miss something? I cannot see hybrid renderer package anymore in the package manager now using 2020.1.

dull copper
#

it didn't show up even before that by default @prime cipher

#

preview packages are hidden by default

#

what did change however is the way you enable preview packages visibility on package manager

#

in past it was on the package managers top menu dropdown, now it's enabled from project settings

prime cipher
#

@dull copper That was it, I missed that option. Was thinking it is enabled as I saw preview packages, but just the ones converted from older sdk, as I updated the project to 2020.1. Thx!

halcyon plume
#

how convert tilemap to entity?

deft stump
#

why?

deft stump
#

ah shit

#

I fixed it

dull copper
#

oh, there's been small entities update

#
## [Entities 0.11.1] - 2020-06-09

### Fixed

* Prevented remapping of hybrid components during deserialization which caused IL2CPP builds to fail on a missing property bags.
* Fixed exceptions being thrown when inspecting an entity with a GameObject added through `EntityManager.AddComponentObject`
* Fixed load order of JobReflection static methods which were causing `InvalidOperationException: Reflection data was not set up by code generation` exceptions in player builds.

### Changed

* An exception is now thrown during serialization if a shared component containing entity references is encountered.

### Removed

* Removed expired API `World.AllWorlds`.
* Removed expired API `EntityComponentStore.CreateChunks(Archetype*, ArchetypeChunk*, int, int)`.
* Removed expired API `EntityManager.CreateChunk(EntityArchetype, NativeArray<ArchetypeChunk>, int)`.
* Removed expired API `EntityManager.LockChunk(ArchetypeChunk)`.
* Removed expired API `EntityManager.LockChunk(NativeArray<ArchetypeChunk>)`.
* Removed expired API `EntityManager.UnlockChunk(ArchetypeChunk)`.
* Removed expired API `ArchetypeChunk.Locked()`.
* Removed expired API `struct NativeArraySharedValues<S>`.```
#

oh, new physics package also landed today ๐Ÿ™‚

#

changelog for the Unity.Physics 0.4.0-preview.5 is too long to paste here

opaque ledge
#

there are some good stuff at least ? ๐Ÿ˜„

halcyon plume
#

so no one know?

dull copper
hollow sorrel
#

ooo nice physics update

dull copper
#

I'm guessing this one has that solid stateless stacking now which they showcased on the Unite Now talk

hollow sorrel
dull copper
hollow sorrel
#

is it this?

PhysicsStep.SolverStabilizationHeuristicSettings to enable and configure solver stabilization heuristic. This can improve behavior in stacking scenarios, as well as overall stability of bodies and piles, but may result in behavior artifacts. It is off by default to avoid breaking existing behavior. Setting it to true enables the heuristic and its default parameters.
dull copper
#

I'm trying to thumbs up Scorr's forum link but discord keeps putting it into wrong messages ๐Ÿ˜„

#

I hate this current setup where they don't put reactions on the same line height

hollow sorrel
#

hahah

dull copper
#

there

#

havok update hasn't landed yet

hollow sorrel
#

how convert tilemap to entity?
@halcyon plume
are you talking about unity's 2d tilemap? you can't really convert that into entities but you can reference it from ecs or maybe add it as a managed component

dull copper
#

hmmmm... Havok.Physics 0.3.0-preview.2 that is compatible with the new Unity.Physics release is also out now!

#

it's not on the registry query

#

also PM only lists 0.2.2

hollow sorrel
#

@halcyon plume if you don't have to read it at runtime i'd prob use the tilemap as a 'baked' thing and convert anything you need to read from it (e.g. colliders if you're using ecs colliders) to entities at runtime when game starts (could also maybe bake it before game starts but that's more work)

#

woah that's a big post on heuristics

halcyon plume
#

I need for random map generation, which means working in runtime

dull copper
#

anyway, from that forum thread:

Here are some highlights from the release:

* NOTE: This update required making some changes to the authoring data layout for physics material settings. This change affects both PhysicsShapeAuthoring components and PhysicsMaterialTemplate assets. To ensure all your prefabs and scenes are upgraded correctly, back-up your project and then run the data upgrade tool immediately after updating Unity Physics. You can access this tool in the main menu under Window -> DOTS -> Physics -> Upgrade Data
* Added new settings for improved Solver Stability. Discussion thread here.
* Added Data Flow Graph nodes for querying objects in a collision world
* Changed various pair interfaces to direct accessors (ex. EntityPair is now EntityA and EntityB)
* New APIs and data protocol for joints to permit modifying constraints at run-time without using unsafe code. See the new Modify Joints scene in the sample project for example usage.
* Various new components and utility methods to simplify common operations, such as applying explosion forces (1c. Conversion samples), matching kinematic bodies to direct/animation input (5d. Kinematic Motion sample) and temporarily changing a dynamic bodyโ€™s kinematic state (5a. Change Motion Type sample)
* New AddInputDependency() and GetOutputDependency() methods on core physics systems to provide proper control over custom system scheduling
* Added support for multiple PhysicsShapeAuthoring components on a single GameObject to create a compound collider
* Reworked collision and trigger event samples with all-new DynamicBuffer-based approach for more robust stateful event handling.
* API compatibility with upcoming Entities 0.12.0. Unity Physics should be ready to use as-is once it is released!
* Bug fixes!
* General performance improvements!
opaque ledge
#

upcoming Entities 0.12.0 ๐Ÿ‘€

dull copper
#

well, it's likely to be 0.12 after 0.11 ๐Ÿ˜„

opaque ledge
#

i wonder what kind of improvement they are going to do

#

last few were.. very abstract to me, like.. stuff that only %1 of the users would do

#

hopefully we will see more juicy stuff

#

i REALLY would like to create entity prefabs

dull copper
#

I woudn't mind if they just actually... kept refining and stabilizing the api for 1.0

#

instead of redoing the API every second release ๐Ÿ˜„

opaque ledge
#

oh i forgot, enable/disable will come as well, at one point

north bay
#

Don't forget unmanaged systems

warm panther
#

I have multiple entities that each hold a DynamicBuffer with information (populated by a targeting system); I would already be elated to get this to work with a single IComponentData.

I want a system for multiple other entities, that each have a ComponentData referring to one of the other entities, to pick an element from that buffer and modify another ComponentData on themselves.

How do I do this in SystemBase, ideally parallelizable?

#

I tried something with chunks but that always results in the native arrays of the targeting (first) entities to be zero length.

#
    public class PickTargetsFromProviders : SystemBase
    {
        private EntityQuery m_Group;
     
        protected override void OnCreate()
        {
            m_Group = GetEntityQuery(
                ComponentType.ReadOnly<AimAxis>(),
                ComponentType.ReadOnly<LocalToWorld>());
        }
 
        //Aiming Entities observe TargetProviders as subjects and pick their favourite target
        protected override void OnUpdate()
        {
            var subjectType = GetArchetypeChunkComponentType<TargetProvider>();
            var targetType = GetArchetypeChunkComponentType<Target>();
            var chunks = m_Group.CreateArchetypeChunkArray(Allocator.TempJob);
 
#
           Entities
                .WithReadOnly(subjectType)
                .WithReadOnly(targetType)
                .WithDeallocateOnJobCompletion(chunks)
                .ForEach((ref Aim observer, in LocalToWorld localToWorld, in Owner owner) =>
                {
                    //Reset Aim positions...
                    observer.position = localToWorld.Position + localToWorld.Forward;

                    //Try to find targets and write fresh aim positions
                    for (int c = 0; c < chunks.Length; c++)
                    {
                        var chunk = chunks[c];
 
                        var subjects = chunk.GetNativeArray(subjectType);
                        var targets = chunk.GetNativeArray(targetType);

                        for (int i = 0; i < chunk.Count; i++)
                        {
                            if (subjects[i].entity.Equals(owner.entity))
                            {
                                //pick target provided from subject
                                observer.position = targets[i].position;
                            }
                        }
                    }
                }).ScheduleParallel();
        }
    }    
#

I'm generally having an annoyingly hard time to have entities communicate with each other.

#

(in high frequency scenarios)

#

This code even tries to do it with JUST a simple ComponentData, not even a Buffer. It doesn't work for some reason.

#

(well, the reason is I don't understand chunks in respect to Entities.foreach)

#

The problem is that targets is length == 0

#

Ah oh. I think I'm using the chunk array wrong.

#

The entity query describes an observer, but it would have to describe a subject.

#

If I change the entitiy query, it doesn't run at all - of course, because I have no entities that have both TargetProvider and Aim.

amber flicker
#

I haven't fully processed the above but quick question - are you familiar with GetComponentDataFromEntity (GetComponent in SystemBase) and GetBufferFromEntity?

warm panther
#

Yes,

#

I didn't realize it was GetComponent though.

#

But getComponent needs an entity.

#

That seems like it's one of these sync points going through entitymanager?

#

Yeah ok so I have a ComponentDataFromEntity, but I can't iterate over it.

#

That's why attempted something with chunks.

#

The original idea was to just look up the target provider directly (from ComponentDataFromEntity), BUT ... that leaves the exact same problem when I actually try to wire these connections up. (actually worse, because the hierarchy is kind of complex - so I'd have to change the structure of a lot of entities in a hierarchy, repeatedly, based on whether the parents are the same as in the original subject's component, which boils down to the same issue.)

#

I basically need a nested iteration over 2 entity archetypes.

amber flicker
#

sync point? no. I guess CDFE is probably what you want to be using.

prime cipher
#

Trying to look up best practices for save/load systems in the ecs way of things. Gโ€˜gling did not help, also in the forums search I did not find posts related to ecs. I thought there is maybe something I can use for my advantage instead of parsing and recreating entities according save file manually.

warm panther
#
    public class PickTargetsFromProviders : SystemBase
    {
        //Aiming Entities observe TargetProviders as subjects and pick their favourite target
        protected override void OnUpdate()
        {
            var subjects = GetComponentDataFromEntity<TargetProvider>(true);
            var targets =  GetComponentDataFromEntity<Target>(true);
            var lists = GetBufferFromEntity<TargetListElement>();
            
            Entities
                .ForEach((ref Aim observer, in LocalToWorld localToWorld, in Owner owner) =>
                {
                    //Reset Aim positions...
                    observer.position = localToWorld.Position + localToWorld.Forward;

                    //Try to find targets and write fresh aim positions
                    
                    //Trivial case.
                    var target = targets[owner.entity];
                    observer.position = target.position;

                    //List case
                    var list = lists[owner.entity];
                    // ... then do some selection math...
                    
                }).ScheduleParallel();
        }
    }    

So this is how I imagine it, but now I need a way to teach each observer in a hierarchy who their TargetProviders are. this is, effectively, the same problem as before (but lower frequency, so I guess I can afford a sync point).

pulsar jay
amber flicker
#

^ was just about to link that ๐Ÿ™‚

prime cipher
#

@pulsar jay wow, thanks. Will have a Look. Mmmh, should have used serialization as search term too ...

amber flicker
#

@warm panther It's hard to guess what the relationship between these things should be. 'teaching an observer.. who their targetproviders are'? What is this sync point you're worried about? There's nothing obvious I can see from your scenario that requires one.

warm panther
#

I have a multi-level hierarchy (4 or more levels deep) of entities (Parent and Child components); I know the "root" entity.
How do I iterate over all sub-entities that have a certain Archetype (componentdatas, tags, or otherwise), ideally without touching those that I don't care about?

#

(iterating this hierarchy is how I'd assign a TargetProvider to all the Aiming Systems, these are at different depths in that hierarchy)

#

Sync Point is: Code that must run on the main thread. Any time you need to ask the EntityManager for anything, you usually create a hard sync point. You then have to .Run your job instead of .Scheduling it.

#

Currently I'm considering, at conversion time, to create a registry of all these entities in the form of DynamicBuffers, and build a basic graph that way. It feels distinctly smelly, codewise. The hierarchy is right there, expressed in the entities. Why do I need a flat array that gathers them? And then, another array that gathers the arrays, etc. It feels... off.

These structures rarely change so maybe it will work, but there has got to be a better way.

#

I could build a selective structure somewhat like LinkedEntityGroup I guess.

safe lintel
#

i think what youre considering is the best or at least how I would address it, if your entity count is small enough you could try using the fixedlists components

warm panther
#

Entity count is up to ~100 per hierarchy.

#

But fixedlists could help with some stuff, good point.

#

(and often near ~100, not rarely)

safe lintel
#

i dont think theres another way currently and im not sure if they really plan to make the transform system as accessible as the old gameobject version was

warm panther
#

I don't think so either, actually. So... hmm. What I think other ECS like Entitas do right is that if you WANT, you could just do myEntity.hasTransformComponent or something, and decide on the fly, at no performance cost. (obviously the theoretical performance maximum of such a system is limited, as it lives entirely in managed code)

safe lintel
#

never used entitas or any other ecs personally ๐Ÿ™‚

dull copper
#

Havok Physics and physics samples on ECS samples repo both updated now

warm panther
#

It's quite nice but I think it could have drastically benefited from command buffers. Systems can change entity structure directly and it can be a mess, and most of your systems trigger on structural changes, which is very different from DOTS.

#

It's one thing I miss, I would like to have a reactive system that triggers when a component is added or removed from an entity, and doesn't do anything else. I think the ChangedFilter in queries can do that to some extent.

safe lintel
#

yeah was going through all the physics changes, i think i have tons of stuff to fix when i update the package

dull copper
#
## [Havok Physics 0.3.0-preview.1] - 2020-06-18

### Changed
- Updated minimum Unity Editor version from `2019.3.0f1` to `2019.4.0f1`
- Updated Unity Physics from `0.3.0-preview` to `0.4.0-preview.4`
- Removed expired API `HavokSimulation.ScheduleStepJobs()` signature without callbacks and thread count hint.

### Fixed
- Fixed a crash when number of solver iterations is bigger than 255.
- Fixed incorrect contact point positions reported through collision events.
- Fixed behavior of joints to properly incorporate provided `Constraint.SpringDamping` and `Constraint.SpringFrequency`.
amber flicker
#

@warm panther A couple of thoughts - you can iterate through the linked entity buffers and check presence of components. You can also link things up in the editor - either via an exposed field or by eg using scriptableobjects set on a component that gets converted (letting you preserve some hierarchal independence).

safe lintel
#

probably a good thing I never tried entitas as I had no expectations of how an ecs package is really meant to work. cant be too disappointed if youve never known any better ๐Ÿ™‚

warm panther
#

Timboc, thanks - that's kind of my thinking. I think I need to link it all up at conversion time. Later i want these lists to be editable (i.e. hardpoints to place turrets on, etc.), so... I guess lots of buffers. ๐Ÿ™‚

amber flicker
#

@warm panther In my case I have a component (just a fancy property draw that stores a reference to a subasset) then on conversion I add a component to the entity with just the instanceid of the asset. Later I have a system that recurses down linkedentity buffers to find ones that match the id. Obviously isn't the fastest method possible but it provides a nice editor experience I think. Depending on your own data structure you could do something similar but smarter (e.g. if you have ISCDs because of meshes for example). You can also very simply create an authoring component with a public Entity and it gets displayed as a GameObject field in the editor you can just drag a reference into. Not sure if that helps exactly, just some thoughts. A lot of it will also depend on when you know the structure - e.g. runtime vs edit time etc.

ocean tundra
#

Hey Guys, Are native Queues thread safe?
Like can i have JobA adding items to the queue and JobB reading them (if there are any there?)

ocean tundra
#

More context/questions, I have Job(s) producing messages every update, then putting those messages in a NativeList which are then read by other jobs, each message type is its own native container

#

The producer jobs and consumer jobs are in different worlds too

warm panther
#

I think they are not, and even worse, the "Concurrent" variant isn't either for most purposes.

ocean tundra
#

What about Native Streams?

storm ravine
#

Hey Guys, Are native Queues thread safe?
Like can i have JobA adding items to the queue and JobB reading them (if there are any there?)
@ocean tundra Yes you can. But if you need determinism - NativeStream.

ocean tundra
#

no i dont need determinism all i want is to be able to have the write and read jobs schedules and run at the same time

#

if no messages to read, just read them next frame

storm ravine
#

Simple sample

public class SimpleQueue : SystemBase
    {
        private NativeQueue<int> _messagesQueue;
        
        [BurstCompile]
        private struct Producer : IJobFor
        {
            public NativeQueue<int>.ParallelWriter MessagesQueue;
            
            public void Execute(int index)
            {
                MessagesQueue.Enqueue(index);
            }
        }
        
        [BurstCompile]
        private struct Consumer : IJob
        {
            public NativeQueue<int> MessagesQueue;
            
            public void Execute()
            {
                while (MessagesQueue.Count > 0)
                {
                    var val = MessagesQueue.Dequeue();
                    Debug.Log($"Consumed - {val}");
                }
            }
        }

        protected override void OnCreate()
        {
            _messagesQueue = new NativeQueue<int>(Allocator.Persistent);
        }

        protected override void OnDestroy()
        {
            if (_messagesQueue.IsCreated)
                _messagesQueue.Dispose();
        }

        protected override void OnUpdate()
        {
            Debug.Log($" --- FRAME --- ");
            Dependency = new Producer()
            {
                MessagesQueue = _messagesQueue.AsParallelWriter()
            }.ScheduleParallel(5, 1, Dependency);
            
            Dependency = new Consumer()
            {
                MessagesQueue = _messagesQueue
            }.Schedule(Dependency);
        }
    }

If jobs in different systems you of course should handle dependency between them by your self. But there is just simple general idea with NativeQueue.

ocean tundra
#

Wait so read is dependant on write? so it wont run till after the write is done?

storm ravine
#

Yes of course, otherwise it's race condition and for this sort of things it's very bad idea of trying to write and read at the same time, no matter which NativeContainer you're using.

ocean tundra
#

yea i figured it was a bad idea ๐Ÿ˜› but i want to have no dependency between these jobs

#

as its my Server world sending to my Local Client world

#

so weird im having more issues with not having networking going ๐Ÿ˜› when all the messages went via socket there were no issues

storm ravine
#

Even if you write your own container, based on interlocks for writing\reading in parallel at the same time (which is already hard to write this type of code) this will be very unpredictable in performance (as it like a time bomb which REALLY hard to predict, when and where it blows)

ocean tundra
#

yea... im thinking now ill separate the native containers, and then copy messages from the server container to the local player container

storm ravine
#

I don't get what you mean

#

If it's server and client world - they separate by default, by design etc.

#

With own containers

#

only connection between them is requests

ocean tundra
#

currently i share the same native container between worlds (server and local client)

storm ravine
#

and you anyway have its own queue of requests

ocean tundra
#

for my messages

storm ravine
#

currently i share the same native container between worlds (server and local client)
@ocean tundra It's pointless

ocean tundra
#

think that was a mistake

#

yea

storm ravine
#

When your server and client will be on different machines

ocean tundra
#

oh yea in this case its the same instance

storm ravine
#

They wouldn't have any shared containers etc

ocean tundra
#

like player is hosting and playing

storm ravine
#

only communication for them will be requests, that's all

#

Player hosting

ocean tundra
#

when networking between machines everything is fine

storm ravine
#

other players on other devices

#

For P2P (as it;s your case I guess) you anyway should separate Client and Server in the same way

ocean tundra
#

yea but i dont want to have serialization/local socket connection for single player/local player

#

but i see seperating the containers seems like a good idea

#

then having something to copy the messages between them

storm ravine
#

You don't need serialization etc. here of course, what I mean it's have the same queue mechanism for host client

#

how you fill that queue up to you

#

for remote it will be serialization\request\deserialization

#

for host client it will be just queue with raw request\response data

ocean tundra
#

yup ๐Ÿ™‚

#

sweet so at least i kinda know what to do

#

thanks ๐Ÿ™‚

spark glade
#

Probably a dumb question, but what is the current entity as I loop over a chunk in IJobChunk ?

#

Asking because I want to do something like this:

#
private struct FindTargetJob : IJobChunk {
    [ReadOnly]
    public NativeArray<Entity> TargetableEntities;

    [ReadOnly]
    public ComponentDataFromEntity<Translation> TranslationFromEntity;

    public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex) {
        for (var entityIndex = 0; entityIndex < chunk.Count; entityIndex++) {
            var translationOfCurrentEntity = TranslationFromEntity[???];   // <---
        }
    }
}
#

Note: The reason I'm not doing

[ReadOnly]
public ArchetypeChunkComponentType<Translation> TranslationChunk;

is because I also need to loop over the translation of OTHER entities in TargetableEntities.

#

I mean I could just mix the two approaches, but that doesn't feel right either.

wooden canopy
#

I am not using anything dots related yet, but since everyone here is someone might know, I am using unity 2019.4.0f1 and if I am on play mode, and open either a tab with asset store or the project settings, the console gets swamped with

Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak

Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 5)

no stacktrace or anything else to know where this is coming from

#

it keeps pumping the last warning

spark glade
#

@wooden canopy did you turn on the Menu->Jobs->JobsDebugger?

wooden canopy
#

no, because I don't even have the jobs package

#

not using it myself

#

seems to be something on unity side

ocean tundra
#

Entities depends on jobs...

wooden canopy
#

not using entities, nothing dots related

ocean tundra
#

oh then its a bug in unity somehwere

wooden canopy
#

asked here, because you all are using those, and the job system is core, so maybe you already saw something like this, or knew how to check

#

will try to add the jobs package and see if the debugger helps

ocean tundra
#

na dont think it will

#

thats a bug in unity or a package somewhere

#

ive seen it

#

but i just keep updating so it disapeared

spark glade
#

Probably a dumb question, but what is the current entity as I loop over a chunk in IJobChunk ?
@spark glade

Answering my own question from above, there is ArchetypeChunkEntityType if you need the Entity itself in a IJobHunk โค๏ธ

wooden canopy
#

well, no, added jobs package, have job debugger enabled and leak detection with full stacktrace and nothing was shown

#

now added full native logging for warnings in the console and shows this

#

Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 5)
#0 GetStacktrace(int)
#1 DebugStringToFile(DebugStringToFileData const&)
#2 ThreadsafeLinearAllocator::Deallocate(void*)
#3 ThreadsafeLinearAllocator::TryDeallocate(void*)
#4 MemoryManager::Deallocate(void*, MemLabelId const&, char const*, int)
#5 UI::UIGeometryJob(UI::UIGeometryJobData*)
#6 JobQueue::Exec(JobInfo*, long long, int)
#7 JobQueue::Steal(JobGroup*, JobInfo*, long long, int, bool)
#8 JobQueue::WaitForJobGroupID(JobGroupID, JobQueue::JobQueueWorkStealMode)
#9 CompleteFenceInternal(JobFence&, WorkStealMode)
#10 GeometryJobTasks::EndGeometryJobFrame(GfxDevice&)
#11 GfxDeviceWorker::RunCommand(ThreadedStreamBuffer&)
#12 GfxDeviceWorkerAutoreleasePoolProxy
#13 GfxDeviceWorker::RunExt(ThreadedStreamBuffer&)
#14 GfxDeviceWorker::RunGfxDeviceWorker(void*)
#15 Thread::RunThreadWrapper(void*)
#16 _pthread_start
#17 thread_start

ocean tundra
#

@wooden canopy your best best is to submit a bug report

ocean tundra
safe lintel
#

and new animation package ๐Ÿคฉ

ocean tundra
#

Yesss even better

#

Yay for Friday

deft stump
#

where do I place my subscenes so they can be part of the build?

#

resources?

safe lintel
#

shouldnt matter

#

you need to use the new build pipeline for them to be included

#

Platforms package and the sub platform(ie windows)

deft stump
#

so I need to take another trip to the package manager

deft stump
#

weid

#

I still get errors

#

maybe... I should add it to the build settings

spark glade
#

and new animation package ๐Ÿคฉ
@safe lintel whwaaaaaaaatttttttatatata???

#

no mention of URP in the changelog ๐Ÿ˜ข

deft stump
#

hrmmm

#

still gets me errors

safe lintel
#

kinda wondering if urp wont come til the api stabilizes a bit

deft stump
#

welp I dunno XD

ocean tundra
#

dam i always forget im URP so cant use some of this stuff

deft stump
#

roycon, how do I include subscene in the build?
I already tried adding the subscene in the build settings.
and also getting the platform Windows package

ocean tundra
#

im not sure.. i thought it was automatic when you had the windows package

#

i dont use subscenes

#

instead kinda made my own

#

@deft stump what unity version + packages?

deft stump
#

2020.1.0b12 + latest packges

ocean tundra
#

hmmm that sounds right to me

#

and you have Platforms + windows platform

#

im not sure if they are still 2 packages

deft stump
#

yep, I have them both.

#

still separate packages.

ocean tundra
#

not sure then sorry

#

someone said something about a checkbox on the scene

#

but ive only see one for live link

safe lintel
#

i have three platforms packages, Platforms, Platforms Desktop and Platforms Windows

deft stump
#

yep I have those

#

restarting unity. It might just be the editor derping me

deft stump
#

okay nope

#

it wont build properly

ocean tundra
#

i had so many issues with sub scenes

deft stump
#

I'm starting to feel your pain

ocean tundra
#

yea. the idea is really good... but just didnt like me

deft stump
#

soo

#

back tracking the chat

#

I need to use the new build pipeline...

#

but

#

I can't find it

#

is it in code?

#

if it is... why?

ocean tundra
#

the new pipeline is all via code now

#

i think

spark glade
#

I can't find it
@deft stump you can't find the new build pipeline?

ocean tundra
#

its controlled via attributes or a interface of some sort

deft stump
#

walk me through it Nicolas.

#

its controlled via attributes or a interface of some sort
@ocean tundra wait seriously?

#

I'm having an anime girl moment right now

spark glade
ocean tundra
#

yea i think so.. they did experiment with a asset based pipleine

#

but think they back tracked on that

#

i could be wrong ๐Ÿ˜›

deft stump
#

@spark glade thanks man.

#

SERIOUSLY? IT'S IN CREATE!?

spark glade
#

yeah, it took me a minute to find it myself, lol

deft stump
#

aaaah now i hate unity design decision mistakes everywhere

spark glade
#

Note the "Scene List" does NOT need the subscenes.

ocean tundra
#

yea i thought the backtracked on that>

deft stump
#

so I just need to add the "Main" scene, build, and it'll work properly now

spark glade
deft stump
#

Yeah I figured

#

siiiiigh...

spark glade
#

I keep doing it occasionally still ๐Ÿ˜„

deft stump
#

why are there 2 ways to build a game in unity now...

spark glade
#

well, this is the new way

#

until recently you couldn't even do the "BUild App BUndle" in the new system. So it's evolving rather quickly.

deft stump
#

At this point, I just wish they make a separate editor JUST for dots

spark glade
#

This is sooooo much more flexible.

ocean tundra
#

@deft stump thats project Tiny i think

spark glade
#

You can even inherit configs, so I set up mine like this:

ocean tundra
#

@spark glade have the confirmed thats the build system they are going to keep?

deft stump
#

i'm also going to guess that we cant use Ctrl + b anymore

spark glade
#

Touche, don't think I remember an official comment.

#

But by all logic this seems to be the right way to go.... ๐Ÿ™ˆ

ocean tundra
#

hmmm if its confirmed ill updaye

#

would be so nice to get subscenes working

spark glade
#

Yeah subscenes are pretty great but also quite the pain still. I'm planning to use it to "prebake" all my prefabs into "binary format" ๐Ÿ™‚

#

Biggest headache right now is that there is no easy way to force them to rebuild.

ocean tundra
#

yea i built all that myself

#

๐Ÿ˜›

spark glade
#

๐Ÿ’ช

ocean tundra
#

but i want to keep it as it allows easy modding

#

but some assets will make sense to be in a subscene

#

things that cant be modded

#

that way i dont need to build a 3rd custom conversion pipline

zinc plinth
#

god I feel so stupid rn

#

I spent the last 3 weeks trying to understand why my specific setup was making Unity Physics debug component to shit itself

deft stump
#

@spark glade is there a doc I can refer to about the new build pipeline?

zinc plinth
#

turns out the Physics Debug Display Component is supposed to be a singleton

#

and I had it multiple times in my scene

#

so it just threw NativeArray deallocated error because OnUpdate was exiting before actually updating that array

#

there should be a throw here instead of just quietly exiting >< protected override void OnUpdate() { //Debug.Log("drawing component OnUpdate"); if (!HasSingleton<PhysicsDebugDisplayData>()) { return; }

ocean tundra
#

make a post on the DOTS physics forum

#

they are even more active then the main DOTS forum

#

adding a debug.logerror or warning there will take 10 seconds

zinc plinth
#

did a thread

ocean tundra
#

sweet

zinc plinth
#

I kinda did the advanced stupid move by finding that "bug", because unity already tries to keep this component as a singleton and doesn't let you spawn multiple of them if you spawn them "normally"

ocean tundra
#

๐Ÿ˜›

#

I need to spawn those manually

#

would be very easy to fall into the same trap

zinc plinth
#

need to do a "singleton entity" go and throw eveything in there

ocean tundra
#

i cant use GO's

#

im trying to keep the game as 'pure' dots as i can

#

eventually ill need some GO's in the clients for effects and things

#

but server im sticking to the rule of no 'Old' Unity

#

as i dream of being able to use project Tiny for dedicated servers

zinc plinth
#

Ho lord

deft stump
#

okay

zinc plinth
#

I don't have thzt kind of dedication haha

ocean tundra
#

๐Ÿ˜›

deft stump
#

so I got it to build

#

AND attach a profiler to it

ocean tundra
#

yay

#

and subscenes?

deft stump
#

the subscenes are built properly now

ocean tundra
#

sweet

deft stump
#

it still boggers my mind why we need 2 build commands.

ocean tundra
#

yea thats why i thought it was all merged

#

are there any docs on it?

#

i will need to get it working with my build pipline after i upgrade

deft stump
#

I'm actually looking for it

#

hovering over the options on the build pipeline doesn't tell me what those are

spark glade
#

@spark glade is there a doc I can refer to about the new build pipeline?
@deft stump sorry, I did everything by trial and error ๐Ÿ™ˆ

deft stump
#

I give 3 claps for unity

#

๐Ÿ‘ ๐Ÿ‘ ๐Ÿ‘

spark glade
#

turns out the Physics Debug Display Component is supposed to be a singleton
@zinc plinth haha yeah i had it on almost every single entity at one point ๐Ÿ™ˆ

ocean tundra
#

dam it unity

#

just changing some random code, and unity explodes and dies

#

happening so often now

#

is there such a thing as too many asmdefs?

deft stump
#

is this normal?

#

I'm just moving sprites around

#

It is the rendering side soooo... do I assume that it's normal? since well ecs so fast that my gpu can't keep up?

opaque ledge
#

that means your job is waiting for another job to finish

#

most likely one of the Transform systems

#

ah nvm its gfx

deft stump
#

I'm looking at the profiler with question marks in my brain...

opaque ledge
#

i guess rendering is taking too much time

#

but it shouldnt i think..

#

do you have like 1 million sprite in your screen ?

deft stump
#

no

#

just 3 sprites

opaque ledge
#

is vsync enabled ?

deft stump
#

disabled

tawdry tree
#

I see not problem with that. Haven't seen it myself, but also haven't dug around in the profiler

deft stump
tawdry tree
#

Okay, that's... probably not entirely optimal

#

What's packages are you using? Gfx-related

deft stump
#

it flats out when I spam the movement buttons.

#

but when i just tap on it, it spikes up

#

And I'm just moving 3 sprites

#

XD

opaque ledge
#

there must be something else going on then

deft stump
#

looking at the forums it's like a long standing issue.

opaque ledge
#

when you disable your system that moves the sprite, what happens ? everything goes normal ?

deft stump
#

If I dont move it's normal

tawdry tree
#

@ocean tundra With asmdefs you want to minimize dependencies as much as possible, since everything depending on the assembly you're changing needs to be rebuilt. DOTS should make that pretty easy, though.
Apart from some common components and helpers, pretty much everything should be pretty separated.

opaque ledge
#

perhaps Unity thinks your sprite is static ? so when you try to move it, it gets broken

#

i mean you can see plenty of videos that moves 1 million sprite without any issue

tawdry tree
#

also, when you say sprite... what ECS components are in play?

deft stump
tawdry tree
#

I see nothing about visuals here, are you using linked gameobject?

deft stump
#

linked gameobject?

#

you mean hold a reference to the entity?

#

nope.

opaque ledge
#

Can you open Entity Debugger and observe what systems are taking long ?

deft stump
#

no system are taking that long

deft stump
#

fine I'll report a bug

#

then also go to forums for this

tawdry tree
#

Oh right, the linked gameobject (convert-and-inject) has SpriteRenderer (grayed out here), my bad

zinc plinth
#

can you specific DynamicBuffers inside a CreateArchetype ?

#

adding the element type doesn't seem to do anything and using DynamicBuffer<type> throws by the TypeManager

zinc plinth
#

?

amber flicker
#

I think it's just fine to do entityManager.CreateArchetype(typeof(bob)); where public struct bob: IBufferElementData; - are you saying that gives you errors? Compile time? Runtime? cc @zinc plinth

zinc plinth
#

if I create an archetype with a IBED, it doesn't create the buffer when I want to get it after setting the archetype for the entity

#

so I have to Add it again when I convert my entity

#

and that's kinda supid because the archetype is supposed to take care of that..

amber flicker
#

that does sound annoying - your IBED has an [InternalBufferCapacity] set to something reasonable?

zinc plinth
#

I set it to one & imediately set the size to what I really want (only known at runtime, and I want the buffer to be in heap and not in chunks)

#

but that shouldn't even matter

#

cuz the buffer simply doesn't exist after SetArchetype :/

#

is it just me having weird behavior again or do you know this ?

amber flicker
#

I haven't ever tried to create an archetype with a buffer - I've just been adding them later. Though at some point I might also want to do the same so let me know if you work it out. Could be worth posting on the forum unless anyone else here knows more.

prime cipher
#

I have a simply implementation of an ITriggerEventJob (no changes, component adds or anything in execute, nor do I use GetComponentFromEntity to access anything), resulting in the error shown. I understand, that TriggerJob might need to access this NativeArray behind the scenes, but that should not cause issues on my side, or? Don't get it

InvalidOperationException: The previously scheduled job NingrelTriggerSystem:TriggerJob reads from the Unity.Collections.NativeArray1[Unity.Physics.RigidBody] TriggerJob.EventReader.m_Bodies. You must call JobHandle.Complete() on the job NingrelTriggerSystem:TriggerJob, before you can deallocate the Unity.Collections.NativeArray1[Unity.Physics.RigidBody] safely.

prime cipher
#

Mmmhh, error is gon after adding physics bodies to the GOs before conversion. but no triggers seem to be handled.

zinc plinth
#

hoooo interesting

#

seels like I was wrong, buffers are create with archetypes

#

but

#

if you're handling a buffer, and in that time you set a shared component for anothe entity, it moves the buffer and thus makes the instance we have to point at freed memory

#

it's normal that it does this, I just didn't think about it >.>

pulsar jay
#

Did anybody else find the Build Manger in the Platforms package? Seems to be somehow connected to DOTS builds but I cannot find any documentation or anything ๐Ÿค”

deft stump
#

does... ML agents work with DOTS? Oh... unity is prototyping it

deft stump
#

Gfx.WaitForPresent is usually indicator that vsync is on or game is gpu-bound.

#

with ECS CPU is doing things so fast that it needs to wait for GPU to finish what its doing, hence its now GPU bound.
If thereโ€™s a call to Gfx.WaitForPresent in there and says โ€˜call is taking a considerable amount of timeโ€™, it means that the CPU is waiting for the GPU to finish processing all the rendering commands and, thus, weโ€™re GPU bound

#

Soooooo...

#

it IS normal

opaque ledge
#

30 ms tho

deft stump
#

Yeah...

opaque ledge
#

so thats more than just being GPU bound ๐Ÿ˜„

deft stump
#

ugh the profiler is really hard to read sometimes

#

hrmmmm I dunno maybe I should just accept it