#archived-dots

1 messages ยท Page 113 of 1

gusty mulch
#

Just right now this is all preview. Really is surprising how many people are willing to sink a year or two of frustration with DOTS stuff into half-finished games rather than just go make something with Unity MonoBs or Unreal Engine.

#

Though its good if you want to be ahead of the curve to check in on the previews... but not sure why so many people are trying to actually dev with them like they are production ready.

valid haven
#

If your project has a 1+ year time horizon I think now is a good time to cut your teeth with dots. Starting new projects with tech that is clearly going to be legacy in a couple years has its disadvantages as well.

plush crystal
#

The DOTS API doesn't really scare me. If the concepts are sound that's all I really care about. A moving target for an API is probably ill advised but if the alternative is only being able to render 5% of what I could with DOTS then the choice is fairly simple.

valid haven
#

I also think the comment "basic programming tasks crushingly difficult" totally depends on your background. If your primarily a coder with a background in systems design its actually quite refreshing. If you are used to using unity with minimal low level coding then I can see that.

low tangle
#

anyone feel dots audio is remotely ready to use? last I checked it was rough as hell

dull copper
#

there's one big issue with that argument

#

there really isn't solid alternative for netcode built-in to unity right now

#

all you got basically are 3rd party offerings and half baked built-in solution

#

so when there's a promise of better, many are willing to take a gamble (altho we all here probably can agree it's super early atm)

#

and there's a notable risk on running 3rd party offerings too, it's not like it's some dream deal

low tangle
#

no framework even official is going to be a walk in the park

gusty comet
#

hmm, if i had a character controller using mono how would I get it to collide with the ground? which gets entitied...

dull copper
#

one thing with the 3rd party stuff is that they always lag behind the releases

#

and the direction unity is moving at, there's going to always be a ton of outdated 3rd party dots packages out there

low tangle
#

yeah which is why you should pick and choose what other peoples code your going to depend on

dull copper
#

asset publishers can't even keep up because there's no early access to upcoming previews

low tangle
#

I do almost everything in house to get around that

dull copper
#

yeah I don't really use 3rd party stuff anymore either

#

really prefer using built-in stuff

gusty mulch
#

That conversation pretty much went where expected.

low tangle
#

yeah which is why I dont talk here

#

the common shit is the truth

gusty mulch
#

are there any dots-based multiplayer titles that have been announced and have shown their work? I would be curious to hear the stories from the trenches by people trying to actually get a title out.

safe lintel
#

i think personally i would be spending way longer learning c++ in unreal than the time spent learning dots

dull copper
#

ue4's c++ is only tedious, it's not hard if you know c# well

#

and tedious because lacking c++ api docs

safe lintel
#

i dont consider myself thoroughly versed in c# either ๐Ÿ˜„

dull copper
#

that being said, it's not like their netcode covers all use cases there either

#

they basically have super bloated char controller that embeds all client prediction stuff in it

#

and for the rest of engine, you can just replicate stuff normally

#

if you want to do client side prediction for other things, you are on your own again

low tangle
#

my multi player game is based on dots transport

gusty mulch
#

netcode as I know it is just a very specific game type strongly coded as a demo, its not really meant to be a generic system.

low tangle
#

but not the high level framework they are building

#

I only needed a job compatible udp messaging lib so its a perfect fit

gusty mulch
#

How far along are you?

low tangle
#

released

gusty mulch
#

cool, what's the name?

low tangle
#

right now I'm reworking our voice network system a bit

#

eh, I dont like sharing it

#

got review bombed by haters

gusty mulch
#

um, k. Not really going to get a lot of buzz like that, but your biz.

low tangle
#

I'm finishing up a bit of work for a marketing round

#

so I'm just keeping it quiet till then

#

all of our media is out of date

#

dots was worth it if you were wondering

#

just dont do everything in it

gusty mulch
#

Looks cool, though not getting much of a sense of what kind of networking is involved

low tangle
#

its a vr sandbox

#

its 100% multi player

#

compressing full body tracked avatars and networking them was fun in dots

magic frigate
#

looks neat. how many fully motion tracked clients can you have running around at once?

low tangle
#

~100

#

this was from play testing last night

#

everything being driven from dots entities and what not

coarse turtle
#

Create and customise your entire games UI though HTML, CSS, JS. (Check the games folder, BrowserAssets) that's a pretty cool feature @low tangle

low tangle
#

yep

#

CEF

#

not trying to spam this chat though

magic frigate
#

I'm always down to see cool stuff made with DOTS

low tangle
#

works in runtime, il2cpp even

gusty mulch
#

I don't think anyone is going to complain if its on topic. its relevant to dots and netcode talk.

low tangle
#

true true

gusty comet
#

How big should subscenes be? should you make it a single buolding?a few? is there a difference?

#

building*

opaque ledge
#

i doubt it differs

floral crest
#

is this correct?

opaque ledge
#

yeah seems so

floral crest
#

am i supposed to dispose of the array in the first function or it doesnt need it

opaque ledge
#

I never tried such a thing but it shouldnt matter as long as you dispose it properly, also afaik you dont need to dispose Temp native containers, they will dispose themselves automatically

floral crest
#

ah ok

#

thank you

low tangle
#

the NativeArray<int> is a struct that is a pointer to the unmanaged memory

#

you can just copy it like that

#

just dont forget to dispose it

opaque ledge
#

oh June, congrats on releasing your game^^

#

hopefully mine will be released in 1-2 months as well ๐Ÿ‘€

#

tho mine is a small game compare to yours

sharp kayak
#

Hi all! I'm learning DOTS and I've encountred a couple of issues regarding jobs that I don't know how to solve.

#

First, how can I use a SharedComponentData as filter in a JobForEach? I have a "Dead" tag to mark the entities ready to be destroyed, but, in order to iterate them in a job, I've had to declare it as ComponentData instead of SharedComponentData

opaque ledge
#

SharedComponentDatas is more for.. very specific uses, you should use ComponentData in your case.

round summit
#

@sharp kayak
Also you probably dont need to learn jobs at first,
code monkey tutorials are pretty good imo
teaches the basics without jobs

floral crest
#

is it ok to use static methods from a static class inside burst jobs

#

if the methods are purely functional and dont access static variables

zenith wyvern
#

Yes it's fine and Burst will happily make them run super fast

sharp kayak
#

@digital scarab
@opaque ledge
Maybe I misunderstood the purpose of SharedComponentData. I assumed it was useful for components that don't change between entities. For that reason I used it for tags.

zenith wyvern
sharp kayak
#

Oooh, I understand. Thank you!

dull copper
#

so, you could use dummy SCD just for forcing bunch of entities into same chunk?

#

never thought about using it that way

zenith wyvern
#

If you're not using it for the value comparison there's no point in using it over a normal tag component

#

Same effect

dull copper
#

I was more of thinking about my use case where I have bunch of entities that I have to query components from using ComponentDataFromEntity

#

so if they are on the same chunk, it would result in less cache misses, right?

zenith wyvern
#

Maybe I'm not understanding the use case but adding a scd to them would just splinter them further from whatever archetype they were already in wouldn't it?

#

If you had two entities with two different archetypes, adding as single shared value to both of them just results in two new chunks

dull copper
#

basically I have component data which I'd prefer all to be in the same entity but can't because need multiple same type components (can I now do this with fixedarray sorta thing?)

#

so far I've just added these components then into separate entities

#

but in the end, there's a strong relationship between these data elements

zenith wyvern
#

Couldn't you just use a dynamic buffer instead?

dull copper
#

could

zenith wyvern
#

Where each element is a "component" as you're describing it

dull copper
#

I guess I could just try to do some brute force test without and with it

low tangle
#

it wont make two disjoint archtypes be in the same chunk though

#

only same sets

#

if you think of your data components as a 'stride' you can only have one kind of data in your chunk

#

you want to keep your strides minimal in order to get the most useful data in your chunk

#

a chunk is just a fancy byte pointer with whatever data you want to say it is

zenith wyvern
#

It sounds like all the entities have the same archetype, so scd will let them explicitly move related entities from within that archetype to their own chunk for specific processing.

warped trail
#

i learned a little bit of C++ and after hearing this statement a chunk is just a fancy byte pointer with whatever data you want to say it is thought appears in the back of my head. Isn't all this ECS thing just reinventing the wheel? Or am i just too stupid, to see the whole picture?๐Ÿค”

thick carbon
#

there is quite a bit of stuff going on in the background, such as managing systems & their memory, clever alignment strategies this kind of stuff.
It's basically just a framework that you can use.

#

ECS is actually quite an old architecture too, it hasn't been invented recently

bright sentinel
#

@warped trail As Life is Good said, it's not a new thing. Another thing is that it's definitely a regression in terms of abstraction compared to OOP. DOTS is definitely more close to C++, but that's exactly because it's a lot more performant in terms of data processing and memory layout. As for reinventing the wheel, Unity doesn't already have that kind of framework, so it's just their implementation of it.

low tangle
#

been used a long time for mmo's and is a great way to get memory performance

remote coyote
#

As far as I know it was the birth of the ECS system Unity is adopting now, where they separate components, systems and worlds.

#

Or at the very least the first public discussion of it.

low tangle
#

its even older than that really

#

remember reading a article on a mmo from 04 ish that used it

#

with ecs its in the details of how you manage them thats important

#

unity went with the rigid setup that lets you minimize memory and build a multi threaded safety system on top of which doesnt just work with each kind of ecs pattern

remote coyote
#

yeah, it must have been older, would be interesting reading something older

vale nymph
#

So I am trying out the net Entities 0.6 and I run into the issues that when I instantiate some of my entities that they don't have any component on them. Before the update it worked but now it doesn't anymore. Has anyone run into a similar issue?

hollow sorrel
#

my multi player game is based on dots transport
@low tangle
did you switch? thought you were using enet

mystic mountain
#

Is it possible to set default value for GenerateAuthoring ?

low tangle
#

I did yeah

#

@hollow sorrel

hollow sorrel
#

oo

#

what were your reasons for that

#

i'm curious

low tangle
#

I wanted something that would behave well inside the unity job system

#

I hadn't touched c interop inside of jobs yet so I went with unitys solution

#

I've done some c calls inside of jobs now for opus and its not bad, but I'm glad I used theirs for the networking

hollow sorrel
#

ahhh i see

#

how hard was it to switch over

low tangle
#

enet to transport was quite awhile ago

#

but it was easy since all network stuff was just entities

#

so I just had to go to the send receive systems and change from enet to transport deserialization

#

I used that same time to port to jobs using DataStreamWriter and reader

#

which is what transport uses

bright sentinel
#

@mystic mountain That's where you would use the explicit conversion from a MonoBehavior instead

mystic mountain
#

I see...

north bay
#

Is there a method which takes a prefab, converts it into an entity and returns it?

bright sentinel
#

Not as far as I'm aware of, because the conversion happens right at the start of runtime in an internal system

low tangle
#

GameObjectConversionUtility.ConvertGameObjectHierarchy()

mystic mountain
#

Note it converts into a prefab entity, so you'll have to use entityManager/commandBuffer to instantiate it afterwards

low tangle
#

you could RemoveComponent<Prefab>(ent) if it doesn't have children but you shouldnt

#

but yeah just instantiate it

round summit
#

How can i manually Update Unity.Physics systems?

bright sentinel
#

@round summit What do you mean manually update?

round summit
#

I want to call BuildPhysicsWorld's OnUpdate myself i mean

#

And StepPhysicsWorld etc

#

For multiplayer purposes

bright sentinel
#

Well, I'm not sure if there's some sort of API built for it. But you can always go into the source and look how they do it, disable that and then write it yourself

#

Since the source is available

round summit
#

ah

round summit
warped trail
#

i think one of the most ideal way to do this will be taking full control of SimulationSystemGroup

coarse turtle
#

Not necessarily you should be able to call system.Update() which calls the internal update and should call OnUpdate(JobHandle inputDeps) (but I might not know the full context of the situation)

warped trail
#

then you can use World.PushTime() and World.PopTime()

#

to update your group with desired deltaTimes

hollow sorrel
#

should i use FixedList (or just custom fixed arrays) instead of DynamicBuffer if the size doesn't change?

also i find it hard to grasp the internal capacity of DynamicBuffers
my current understanding is this: if you put internal capacity to 32, it'll always allocate size of 32 elements for each entity in the chunk
even if you use less than that, it'll still have 32 elements allocated
now if you change capacity to 33, all 32 + 1 get moved to a new array outside the chunk, but in the chunk it still has a buffer of 32 elements allocated, except that's now just unused memory

is that correct?

pliant pike
#

I dont think the buffer allocates that amount that would just be a waste

#

its only up to that amount then it goes into a new chunk I presume

hollow sorrel
#

i don't understand how it could not though
doesn't each entity (or rather component collection) in the chunk need to be the same size? and be known at compile time

warped trail
#

1 entity will occupy 2 chunks?

zenith wyvern
#

As soon as you exceed capacity it moves to the heap. Until then it exists in a chunk

hollow sorrel
#

but what happens to the part in the chunk

opaque ledge
#

whole thing will be moved to heap

#

not just exceeding parts

hollow sorrel
#

yes but i mean

safe lintel
#

I don't think its elements, its in bytes

hollow sorrel
#

let's say your entity in your chunk gets 32 bytes, 1 for each bufferelement and let's ignore the overhead bytes for example sake
wouldn't it be impossible to give each entity a different amount of bytes

zenith wyvern
#

The manual says it moves existing elements out of the chunk into the heap

hollow sorrel
#

since in order to get entity 10, it'd just do entity size * 10 for the offset in the chunk

safe lintel
#

Oh wait confusing when you said buffers and fixedlist nm

pliant pike
#

how would I even know the amount of bytes that I need?

hollow sorrel
#

unity knows how many bytes each component is

#

i assume

zenith wyvern
#

sizeof(type)*elements

opaque ledge
#

Yeah thats the case i believe Scorr

zenith wyvern
#

Probably minus a few bytes for overhead

opaque ledge
#

this is why if you exceed buffer limit, buffer will move to outside of the heap

pliant pike
#

I'm doing this for a buffer I guess that's wrong for a 1000 size dynamicbuffer csharp [InternalBufferCapacity(1000)] public struct GridBuffer : IBufferElementData { public Translation value; }

opaque ledge
#

i guess bytes in chunk that represented the buffer gets unused ?

hollow sorrel
#

so if your internalcapacity is 32 and you make a buffer with capacity 33 and it moves to the heap, won't it still have 32 bytes or whatever allocated in the chunk, just now unused because its real buffer is in the heap?

opaque ledge
#

yeah, that would make sense ๐Ÿค”

safe lintel
#

I would assume so

zenith wyvern
#

@pliant pike In that case if you want it to stay off the heap the capacity you want would be (sizeof(float) * 3) * maxElements

pliant pike
#

I have to use maths to work it out leahYTHO

zenith wyvern
#

Well that would be the bytes, I'm assuming InternalBufferCapacity means the elements

hollow sorrel
#

i don't think you have to do sizeof yourself, if you put [capacity(1000)] like above doesn't it just automatically allocate 1000 * size of component

zenith wyvern
#

Yes probably

hollow sorrel
#

also so changing your buffer's capacity to less than the internalbuffercapacity shouldn't matter huh

zenith wyvern
#

So just set capacity to the most translations you think you would have in that buffer

hollow sorrel
#

since it'll always be the same

zenith wyvern
#

The capacity is fixed at compile time from the perspective of keeping the buffer inside a chunk

pliant pike
#

cool so I was right

opaque ledge
#

Tho there is a 'weird' behaviour if you do internalcapacity a lot, since a chunk can have 16kb and your internal capacity exceeds that then it will give an error

hollow sorrel
#

ya but then you'd need to have 1 entity that takes up more than 16kb

zenith wyvern
#

I think you would only get that error if you tried to explicitly set internal capacity to be larger than a chunk

#

If you add to the buffer, rather than setting the capacity, it can grow larger than 16kb

opaque ledge
#

yeah thats.. what i tried to say

hollow sorrel
#

i just find it hard to see the use case then for DynamicBuffers
since if you want something inside the chunk you could just use fixed arrays
and if you want something outside then you could use fholm's unsafecollections (or maybe nativearrays? forgot if that works on components)

#

i can't think of a case where you sometimes want it to be inside the chunk and sometimes inside on a entity-by-entity basis

coarse turtle
#

NativeArrays don't typically work unless you have your own implementation that doesn't use the DisposalSentinel

zenith wyvern
#

The use case is if I just want a resizable buffer and don't 100% care if it's inside a chunk or not. I just want to iterate resizable buffers in a query in a relatively efficient way

pliant pike
#

its an array you can use anywhere and store permanently

zenith wyvern
#

The capacity just gives me a way to give a hint to unity to keep it efficient

coarse turtle
#

Also looks like you can call TrimExcess() if your length != Capacity

worldly pulsar
#

One nice thing DynBuffer has that unsafeCollections don't is that they get auto-deallocated when the entity is destroyed

hollow sorrel
#

ooo

zenith wyvern
#

If you absolutely need your arrays to always exist inside a chunk then yeah you're probably better off using a FixedArray, but then you can never exceed your capacity

hollow sorrel
#

yea i hadn't considered that, auto deallocation is pretty nice

zenith wyvern
#

Do the fixed collections not get auto disposed either?

hollow sorrel
#

i think those do because then it's still in the chunk

zenith wyvern
#

Yeah I guess they must, they are just allocated on the stack

worldly pulsar
#

yup, but then those have the downside that they can't grow to an arbitrary size

slim valley
coarse turtle
#
{
    public bool toRandomise;
}```
This should be a `struct`
slim valley
#

Doh!!

formal scaffold
#

How should I move my character with DOTS? Should I just set the Translation to the prefered direction and smoothe things or should I use velocity?

safe lintel
#

afaik if its physics driven, if you simply move via translation it may not be picked up in the physics systems properly

formal scaffold
#

What do you mean by physics driven?

zenith wyvern
#

If you're using physics move by velocity

formal scaffold
#

Right now I don't use a RigitBody or PhysicsBody

zenith wyvern
#

If you're not then you can do it however you want

formal scaffold
#

But I wonder if I should, I will need Physics Shape for sure

safe lintel
#

if you dont need physics then just modify the translation

zenith wyvern
#

Is anyone familiar with using the BuildConfiguration asset with ECS?

coarse turtle
#

sorry @zenith wyvern wish I was ): haven't played around with the build configs stuff yet

safe lintel
#

outside of the PhysicsVelocity there isnt a regular "velocity" component(which is what I thought you meant) @formal scaffold

#

well I use it but I cant say Im really familiar with it @zenith wyvern ๐Ÿ˜‰

zenith wyvern
#

It seems nice and I have it building properly but when I try to "run" from the asset it says there's no run step defined

safe lintel
#

yeah I think the latest update kinda borked it, run worked for me prior to 0.6

#

or whatever that updated the linked dependency to

zenith wyvern
#

Ahh okay, good to know, thank you

coarse turtle
#

@safe lintel how was the process of using the build configs? Was it simple when it worked?

safe lintel
#

Ive been recycling something I copy pasted from the samples which has served me well enough for just testing a single scene, im actually a little annoyed that the latest update made the namespace internal or inaccessible as I was calling it from the resources folder on a little editor ui script

#

i think if you arent using subscenes you can skip it for now

formal scaffold
#

Is there an equivalent to Mathf.SmoothDampAngle in Unity.Mathematics?

#

math.lerp seems good ๐Ÿค”

coarse turtle
#

Ah thanks @safe lintel i might hold off on it - not in the immediate need of using it but definitely want to down the road lol

round summit
#

So how can i update "SimulationSystemGroup" manually?
Instead of having it run automatically

opaque ledge
#

i think you have to create your own world for that

round summit
#

Is there any example about this?

#

I've seen something similar in the unity ecs example
But it just controls update of a user-made system
Haven't found one that controls update of physics system or its group

opaque ledge
#

i dont know any sorry, i never tried to create my own world

#

I generally control if my systems should update or not by creating singleton tags and i make my systems require that singleton.

#

for example to 'pause' the game when my player is in UI menu, i create "PlayerInUI" singleton and remove "PlayerIsPlaying" singleton, and my runtime has requireforsingleton<PlayerIsPlaying>, so when my player is in UI, my runtime systems wont update.

round summit
#

@opaque ledge Can you make the physics run like 30 frames in 1 frames time with that kind of setup?
(i need it for multiplayer prediction)

opaque ledge
#

No i dont think so

#

i use this to "pause" my systems, i dont think thats what you are looking for

round summit
#

@opaque ledge Oh, this actually worked

public void Simulate(int frames)
    {
        sysGroup.Enabled = true;
        for (int i = 0; i < frames; i++)
        {
            sysGroup.Update();
        }
        sysGroup.Enabled = false;
    }
#

Not sure it will be deterministic this way though
I need to see how to control the time delta

north bay
#

Pass your own delta time based on your prediction

round summit
#

Also i don't know if there's a chance it may update more than 10 times

warped trail
#

maybe you should look at netcode sample?๐Ÿค”

round summit
#

Hmm, i think i got it though.
I did some tests, it doesn't do this:

Also i don't know if there's a chance it may update more than 10 times

I just need to set the timedelta now

rough moon
#

Hi all, is there any way to animate skinned mesh models with DOTS?

#

the asset uses traditional Animator and Skinned Mesh Renderer, but if I use Convert To Entity, the object disappears when I press Play

#

so I reckon Animator and Skinned Mesh Renderer are not supported in DOTS

zenith wyvern
#

It's still very very early

rough moon
#

oh cool, somehow I missed it

#

thank you @zenith wyvern

zenith wyvern
opaque ledge
#

sees 'looking for feedback' YAY, sees 'from experienced ecs folks' awww

vagrant surge
#

@zenith wyvern ever heard of priority queue?

zenith wyvern
#

Yeah I've used it before for pathfinding. I don't know if it's relevant since I need to sort the buffer on every turn anyways in case any relevant state changes

vagrant surge
#

my thinking is... do not bother. its a rogelike, you are alredy pushing comical counts of objects

#

for rogelike type stuff, you wont deal with more than 100 actors basically ever

#

so feel free to do tons of structural changes, and to not have "thinking" stuff parallelized

zenith wyvern
#

Yeah I'm not too worried about the performance anyways, the biggest bottleneck right now is the sort, by far. I'm more concerned with having to basically abandon all the typical ECS workflow to make it work

vagrant surge
#

why sorting?

#

i also think you might be running into unity ecs issues (system overhead?)

#

if you are running the actor systems 1000 times per frame

#

the thing with a rogelike, is that it works somewhat in "reverse" from typical ecs

#

instead of being "one system runs thousand entities in lockstep". is "one entity runs N systems in order"

#

when its the time to act

#

you can still use all of the typical ecs patterns, and in fact they still work great

#

but i think you are being eaten by job launch overhead? and system overhead

zenith wyvern
#

Like I said I have to sort every turn in case state changes. So for 2500 actors that's 2500 sorts in a frame. I could reduce that by only doing it if I know there was a change but yeah, like I said not too worried about the performance anyways.

The actual calls to the systems are just a normal function call at this point, there should be basically no overhead there

vagrant surge
#

why 2500 sorts

#

i really dont get that

zenith wyvern
#

An actor takes a turn. The turn buffer has to be sorted before the next turn in case the actor changed any relevant state, like changing another actor's energy or killing them

vagrant surge
#

whats that turn buffer

zenith wyvern
#

All actor turns might happen in a single frame

vagrant surge
#

i know, thats normal

#

sorting 2500 times a frame isnt

zenith wyvern
#

TurnBuffer is an array where actors get put when they have enough energy to act

vagrant surge
#

priority queue that

#

instead of resorting

#

or at the very least run insertion-sort

zenith wyvern
#

I guess I could do that and re-insert after changing state

vagrant surge
#

as insertionsort should work well on a "definitely 99.9% sorted" array

#

now that i think about it

#

why are you sorting

zenith wyvern
#

And you think going back to relying on state changes is the right way to go? It just felt awkward and yeah there was definitely overhead issues once the entity count got really high

vagrant surge
#

just grab the smallest element

#

@zenith wyvern state changes make the code super easy to follow

#

in the systems

#

on normal rogelike counts, it shouldnt be a perf issue at all

zenith wyvern
#

Right I guess just iterating once and marking the right actor to act would be faster

vagrant surge
#

yeah

#

also faster than priority queue

zenith wyvern
#

Good idea

vagrant surge
#

roguelikedev reddit has TONS of stuff written about rogelikes with ecs

zenith wyvern
#

I guess I'm thinking of having DF levels of entities, potentially a few hundred at once. 100% putting the cart ahead of the horse in terms of where my roguelike is at but this is like a core system

vagrant surge
#

both "classic" oop ecs, and the modern data-oriented ones

zenith wyvern
#

So I want to do it right

vagrant surge
#

the truth is

#

unity dots sucks for tihs

#

Entt would be much better

#

so would Entitas

#

all ECS libs optimize towards sometihng. Unity ECS optimizes towards "scaling"

#

running million entities and stuff

#

Entitas optimizes towards "literally everything is static until something triggers"

#

and entt is somewhat middleground

#

for a rogelike, add/remove component being spammed to death is "normal"

#

and unity ecs main weakness is that add/remove is super expensive (in comparaison)

zenith wyvern
#

Yeah the Entitas way definitely sounds like a better fit for this specific use case if that's how it works

vagrant surge
#

Entitas is nowhere near as fast when running a single system over like 10k entities

#

but entitas add/remove component is faster than unity ecs

#

the main idea of entitas is that you would have a good amount of systems done as "reactive", that only run when something changes

#

like your turn systems. Systems that do nothing until they detect that an entity just got a "DoTurn" component added to it

#

entt can also do that

#

unity ecs can too, but that add is more expensive and i think launching systems has a bit of overhead (not sure how much)

zenith wyvern
#

Kind of a bummer to hear that Unity ECS is just not a good fit for the problem. No silver bullets as usual

vagrant surge
#

btw i still doubt you can have problems on a dwarf-fortress scale game on unity ecs

#

unless you do some seriously stupid stuff

#

in those sort of games you are much more bottlenecked by AI

#

than by send/act on events and calculate damage and things like that

#

DF itself main bottleneck is actually pathfinding

zenith wyvern
#

I was definitely hitting some slowdown when I got around 1k structural changes in a single frame

tawdry tree
#

Not just pathing itself, but the mega-possibility-tree of finding which job among any possibly job is the most optimal at this moment

vagrant surge
#

and thats a horrible use case for ecs

#

luckily unity has added support for attaching "normal" C# structs as components

#

so you can just link into a more "oop-ish" stuff

#

that makes sense for a decision tree

tawdry tree
#

TBF ECS would still be better than trying to make it in monobehaviors

vagrant surge
#

no one would do it on monobehaviors themselves, they would do some sort of BrainClass or similar

tawdry tree
#

True, but at that point you aren't really doing it in Unity as much as the code just happens to run inside unity

vagrant surge
#

i made that once on unreal ๐Ÿค” . I had my normal AIController actor, and then just linked into a pure Cpp class with a complex decision tree, outside of ue4 view

#

that ai was a masterpiece, havent done anything nearly as overkill since then

#

turns out basically all games dont need fancy AIs

#

they just need a dumb state machine or hardcoded behavior tree for attack patterns

#

but basically, you can do that on unity ecs now. Create a component that is C# managed, and it points into a decision tree class

tawdry tree
#

And I do believe hooking that up to ECS could be easier, if nothing else other than the strong separation/loose coupling it forces (this being by default, going by naive/normal solutions. Particularly poorly or well designed solutions always stray from that baseline)

vagrant surge
#

i like to keep on the ecs stuff that is basically "allways on", or defines the object

#

not everything has to be done on top of the ecs

zenith wyvern
#

Doing everything in a system makes it less clunky to use burst and jobs though. Now you don't even need to bother with function pointers or job structs for most things

vagrant surge
#

no such thing as needing burst or jobs for a think-component

#

or stuff that is turn based, as you are only doing things 1 at a time

#

nothing to parallelize

tawdry tree
#

Jobs could be a decent way to do thinking-logic, though. Maybe not necessarily ECS-linked jobs, but unless you have preexisting experience writing parallel code, working within the design patterns you're using for the rest of the game seems like a decent decision.

#

Also, I would argue that for at least some turn-based stuff you definitely want to parallelize what can be parallelized - after all, eveyrone hates slow CPU turns, which is a result of all that logic running in one burst

gusty comet
#

is dots's netcode good enough to make mmorpg

tawdry tree
#

Most modern MMOs use some form of ECS under the hood, as otherwise such massive scales become a nightmare of spaghetti

vagrant surge
#

they do

#

the ECS pattern (modern one) is extremelly OP for mmos

#

because in mmo you are doing crazy throughput. Some gameplay logic, but multiplied by 1000 players

tawdry tree
#

Add to that, the logic itself tends to be relatively simple, and as you might have realized from basically any ECS/DOTS demo/sample, DOTS is amazing at doing a little bit of work, for a crapton of 'things'

vagrant surge
#

yup

#

i was working with some guys on a research WoW server using ecs and stuff very similar to DOTS (job graph and stuff), and it was an amazingly good fit

#

it almost made it too easy

#

but DOTS networking isnt it

#

gotta roll your own networking

tawdry tree
#

As for netcode specifically, as your edit asks... Does anyone have experience with that yet?
At any rate, netcode for an MMO will almost definitely require some custom, standalone stuff. At least server-side - but the client is, again, pretty simple and could probably be done in DOTS, using the builtin stuff or otherwise

vagrant surge
#

im not sure now

warped trail
#

DOTS networking in general or this fps oriented staff?๐Ÿค”

vagrant surge
#

but i grabbed the sample

#

and it was terrible

#

first open the thing ran at 10 fps in editor

#

after disabling the checks, it bricked the project

#

had to reinstall

#

second time it did work. 60 fps now

#

but i was looking at the profiler, and the performance overhead for server with 1 client was atrocious

#

it was using like 10ms doing nothing

#

basically SIGNIFICANTLY slower than unreal engine ShooterGame

gusty comet
#

meh

vagrant surge
#

as in x3-x4 times slower

#

and shootergame isnt a masterpiece

gusty comet
#

so no mmorpg

vagrant surge
#

no, not yet

#

using DOTS for mmo? yes, good fit

gusty comet
#

we must wait

vagrant surge
#

but the networking gotta have to be yours

gusty comet
#

so they write OP networking

vagrant surge
#

DOTS networking will never be mmo worth

#

in the same way that ue4 networking isnt

#

its just not the focus

#

due to the amount of players and stuff, mmos need custom-built networking

tawdry tree
#

^

#

You might be able to do MMO-lite, but even then I would strongly argue that the backend should be custom

vagrant surge
#

and btw, any and all "generalized" mmo backends are not good

warped trail
#

i'm a little bit confused, isn't there low level DOTS network and high level DOTS network which they are using in DOTS tps sample?๐Ÿง

vagrant surge
#

because they will be much less effcient than self-rolled

tawdry tree
#

Unless you're makign a generalized MMO, of course. WoW clone #8223?

vagrant surge
#

even like that

#

a well optimized wow-like tab-target mmo can run 5000 players a server

#

i would like to know that software solution that reaches 500+ a server

#

couse stuff like Spatial OS cant

#

and actually, optimizing a tab-target mmo is not that hard. They have very lax latency requirements

#

WoW vanilla runs 2 updates a second

#

its basically turn based

tawdry tree
#

Some clever design helps there

#

Like, you can queue an ability to be used before its off cooldown or other abilities are finished

vagrant surge
#

in a wow-like server, you would have 2 main threadgroups. Some of them deal with the low level networking (syncing player movements for example), and the others run the actual game logic (damage/effects)

#

and they are NOT synced

#

WoW also did stuff like not checking anything server side

#

thats why stuff like fly-hacks and speedhacks exist

#

client goes "hey server, im at X,Y,Z", server goes "ok bruh" with some minimal checks

#

wow pirate servers do not do any checking

#

couse checking costs cpu, and they dont want to pay that cost

tawdry tree
#

Note: making the server non-authorative is generally not the greatest idea

vagrant surge
#

meh, just ban the guy

tawdry tree
#

Usually you can find at least basic checks for cheap enough, though. Stuff like "Is the player roughly within an area they could potentially have gotten to within this timeframe?"

vagrant surge
#

wow pirate servers dont even do that lmao

zenith wyvern
#

Not surprisingly getting rid of the stupid sort helped a lot, I can get around 4k monsters before I start to feel some input lag

tawdry tree
#

Which stops crazy teleporting and super-speedhacks, but by nature needs some wiggleroom - and if you choose 20%, then hackers have a 10% speedboost (with margins)

vagrant surge
#

mmos dont have much of a hacker issue because you just banhammer

#

hackers cant give themselves endless levels or items, couse thats server-auth

#

so what can they do, run around? they are level 1

#

will get inmediately swatted like a fly

#

(btw, i used to use cheat-engine to hack on f2p mmos)

#

was fun

#

most f2p mmos didnt even have anti-speedhack

gusty comet
#

so you are ruining other peoples fun

vagrant surge
#

which is as easy as it gets

gusty comet
#

nice

vagrant surge
#

nah, i wasnt griefing. Just doing dumb shit like speedhack to see if it worsk

#

in Metin 2 i once did a mistake where i increased the "range" of my weapon, instead of the "damage"

#

i then proceeded to aggro half the map

tawdry tree
#

Welp, regret

vagrant surge
#

and get inmediately destroyed after 100+ enemies come after me

#

i wonder if they patched that

#

last time i checked metin2 did fix the speedhack

gusty comet
#

lmao i speedhacked in metin to

#

but

#

it was kind of bugged

vagrant surge
#

it was just too easy

gusty comet
#

i think it was just animation and sounds

#

speeded

#

but not the dmg

twin raven
#

I am passing ComponentDataFromEntity to IJobParallelFor job with readonly false:

GetComponentDataFromEntity<IComponentData>(isReadOnly= false)

But I get error:

InvalidOperationException: SomeJob.ComFromEntity is not declared [ReadOnly] in a IJobParallelFor job. The container does not support parallel writing. Please use a more suitable container type.

Regarding performance, Should I use non parallel job, run it on main thread or use ECB? I understand that ECB comes with overhead but I am not sure should I avoid using it if I can?

Basically what I am doing is I have NativeStream of bullet hits and wanted to apply its effects to corresponding entity componentdatas.

#

At least that was the case with ECB, but I am not sure if it is more optimized now

zenith wyvern
#

There should be almost no overhead for just setting the value of a component

#

ECB would probably be faster, you should only use CDFE if you need it to be set immediately inside the job, or if you need to read a component that's not in your query

twin raven
#

Alright, thanks ๐Ÿ˜ธ ๐Ÿ‘๐Ÿผ

gusty comet
#

huhu

twin raven
#

Since the event is adding velocity to the target, I now had CDFE for reading the initial component and ECB for setting the updated velocity, which seems to work... but I just realized that if I have multiple events on same target, they are not going to add up and the last is going to override the components value.

From top of my mind I need collect all changes to list per entity and add up after everything that could be modifying those are done. Does this sound right? So adding those to DynamicBuffer with ECB and then post job cumulate the buffers to the end value.

#

Sometimes when I try to find a solution to something myself it feels like I am making stuff overly complicated. I guess partly it is true since I don't know all the tools I have available to me.

crystal helm
safe lintel
#

I feel like that image is applicable to my life๐Ÿ˜†

warm panther
#
   public class UpdateInterpolator : JobComponentSystem
    {
        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var translations = GetComponentDataFromEntity<Translation>(true);
            return Entities.ForEach(
                    (ref TargetBody target) => { target.position = translations[target.body].Value; })
                .Schedule(inputDeps);
        }
    }
#

There seems to be a fundamental misunderstanding I have.

#

The safety system says I can't parallel write the container.

#

but it's readonly. I cannot decorate it with a [ReadOnly] attribute, though.

#

I'm confused.

warm panther
#

Seriously.

#

๐Ÿค”

#

Wow, thank you @zenith wyvern

#

So, is this the order of systems that are schedules? Because this should happen before MoveRenderers.

#

I guess I got my reading work cut out for me

warm panther
#

Thanks again for your help, I'm getting the hang of it now.

dull copper
#

there's new tiny and platform packages

gusty comet
#

Anyone have any idea why Shader.GetPropertyCount() is killing my framerate?

zenith wyvern
#

Probably because you're calling it 40000 times

gusty comet
#

yeah just not sure what I change to stop it

#

theres about 60 meshes, all using a single shader and masks

zenith wyvern
#

Ah, this is using the new Batched rendering API?

gusty comet
#

im guessing thats what im missing then, since these meshes are ripped out of megacity as well as the material

#

im just importing them into a dots project to use

zenith wyvern
#

Yeah I'm not sure, there's like next to no information online about how to actually use that api

gusty comet
#

is there a way around it? possibly make a single material for each instead? just duplicate it?

zenith wyvern
#

I really don't know enough about it to say, sorry. All I can suggest is to really make sure they're sharing the same material. If you can set things to static that should help a lot too

gusty comet
#

i would but I thought using gpu instancing was better?, activating static disables that

zenith wyvern
#

I'm pretty sure the only reason MegaCity actually works is because 99% of it is static geometry

#

That's what it's optimized for

#

Well, 99% is an exaggeration but yeah

gusty comet
#

ah cool, also whats the best setting for material creation on meshes? remapping or set it to none and apply the materials to the LODs in the hierarchy?

frail seal
#

Welp, can anyone explain to me why am I having an error with these two lines of code?

#

InvalidOperationException: The NativeContainer GatherComponentDataJob`1.Data.ComponentData is allocated with Temp memory. Temp memory containers cannot be used when scheduling a job, use TempJob instead.

#

I am not scheduling job after all, am I?

zenith wyvern
#

In a any kind of system you can only allocate "Temp" containers inside a job. Otherwise you need to use TempJob/Persistent and manually dispose

#

Not sure why but that's how it is

frail seal
#

Oh right, I can dispose of persistent array after all

#

Thanks

mystic mountain
#

Does Schedule in SystemBase mean not in parallel? So basically ScheduleSingle? Or is it up to ECS to decide or something?

remote coyote
#

Agreed ScheduleSingle would be clearer if its single-threaded equivalent

opaque ledge
#

Yeah, Schedule is Single, ScheduleParallel is Parallel

opaque ledge
#

Yep, platforms package is also updated

remote coyote
#

any cool changes/features/fixes?

#

- Support for building testable players (`TestablePlayer` component) as a step towards integration with the Unity Test Framework.

#

- Enable Burst for DotNet builds on Windows

#

For netcode, looks like they moved some things over from dots sample

#

* Added integration with UnityPhysics, including the lag compensation from DotsSample.

#

* Ghost types are now selected based on the guid of the ghosts prefab asset instead of the archetype. This makes it possible to have multiple different ghosts with the same archetype. If a ghost is not a valid prefab you will get an error during conversion.

#

and some API breaking changes in Transport that bleeds into Netcode as well

remote coyote
#

Haha I knew that you must have posted on this already, I just couldn't find it during my scroll

round summit
#

Hmm, how can i modify the time interval at which physics systems get updated at?

dull copper
#

I think you can adjust the regular fixed timestep value on project settings Time

round summit
#

Okay, i'll try

dull copper
#

yes, I think it does

#

pretty sure you can set it from unity physics somewhere too but on my testing, that value seemed to update physics at right pace

#

like if I've set unity physics to update on fixedupdates and change that value, physics clearly runs at the same speed regardless of the fixed timestep value I put there

#

if it didn't take that value into account, physics would speed up/slow down accordingly (that value also affects fixedupdate inverval so if it didn't adjust the physics stepping, it would change the physics speed)

round summit
#

I see

#

Thanks @dull copper

warped trail
#

No, that will not affect Unity.Physics update rate ๐Ÿ˜…

#

physics systems are updated in regular update๐Ÿ˜•

twin raven
#

Regarding my messages yesterday about registering hits to entity DynamicBuffer (using ECB) and in another job sum the total change to velocity component and remove dynamicbuffer during the same frame.

I have read that this should be avoided since it changes the archtype back and forth during the same frame, but I don't really know any way around it ๐Ÿค”

dull copper
#

@warped trail it does seem to change the physics simulate value, or how else it would explain that the physics speed stays the same if you force simulation group to run at fixedupdate

#

I don't now talk about the stock setup

#

where simulation group is indeed tied to update

warped trail
#

every regular update StepPhysicsSystems advances simulation by UnityEngine.Time.fixedDeltaTime

#

by default๐Ÿ˜…

dull copper
#

yes

#

so what was discussed was correct, no?

#

oh, the systems update rate

#

yeah that will not change that

#

@round summit ^

#

but it does change the simulation timestep when the systems run

warped trail
#

did he tied his physics to fixedUpdate?

dull copper
#

no idea

#

I also haven't checked how netcode package does this

#

they have some separate scheme there

round summit
#

I'm going to call physics update in code

dull copper
#

netcode also has interpolation afaik

round summit
#

And whenever i call, i needed it to run with same intervals

#

So i think i'm good with fixedupdate interval from unityengine

dull copper
#

the point drUiD tried to make was that the out of the box unity physics setup doesn't run that physics simulation at fixed timesteps but if you handle that aspect yourself, it's all good

#

it's like half baked setup out of the box

#

the actual physics sim assumes there's fixed timesteps and it uses that time.fixedDeltaTime but the stepping happens on Update ๐Ÿ˜„

warped trail
#

world has very convenient methods like PushTime(), PopTime()

#

you can push your time to world and then call your system or whole system group and after update PopTime()

#

this is how built in systemgroups can update in fixed interval right now, but this functionality is internal, you have to edit componentsystegroup.cs to use it freely๐Ÿ˜•

round summit
#

thanks for info

dull copper
#

@round summit you plan to use this with the new netcode package?

#

I'm just asking because there probably are similar mechanism there already and latest netcode package added some code from DOTS sample to be able to use Unity Physics better

round summit
#

Um, no actually
I only want stateless physics from dots to help with my state switching issues

dull copper
#

ah ok

round summit
#

I am pretty much making a rigidbody mono that uses Unity.Physics backend

#

(I won't have too many bodies, game is not too complicated neither)

dull copper
#

you figured the transform sync already?

round summit
#

yeah

dull copper
#

the physics samples had really weird way of doing that

#

but I guess that works too

round summit
#

i followed a codemonkeys tut
about hybrid gameobjects with ecs

#

made it very simple

dull copper
#

no idea how he did it there

#

simplest way I know is to just use convert to entity with convert and inject gameobject and add this to your conversion script:

dstManager.AddComponentData(entity, new CopyTransformToGameObject());```
#

it's from the old GameObjectEntity workflow

#

of course you could just make new authoring component to that too and just slap that to the gameobject instead

round summit
#

you create a IDataComponent on a child object
that references its entity to its public field in OnConvert()*
and on the original gameobject you have reference to that to-be-converted-object

dull copper
#

so it's the same as the physics samples? you query the entity each update for it's current position?

round summit
#

No not at all

#

TestEntity is a gameobject that will be converted to an entity when prefab is instantiated

#

Thats how a gameobject can reference to its entity

dull copper
#

yes, and then how you get the transform?

round summit
#
Translation translation = entityManager.GetComponentData<Translation>(entity);
transform.position = translation.Value;

@dull copper

dull copper
#

this really sounds like the same thing I was talking about all along

warped trail
#

๐Ÿ˜…

round summit
#

Oh, sorry then ๐Ÿ˜„

dull copper
#

so it's the same as the physics samples? you query the entity each update for it's current position?

#

they do exactly that

round summit
#

I may not have paid attention to the sample ๐Ÿ˜… :

dull copper
#

anyway, that's fine if you don't have much to update, the CopyTransformToGameObjectSystem does update the transforms on jobs so it's more efficient

round summit
#

ah, a system for that

#

might do that actually

dull copper
#

it's really leftover from GameObjectEnitity workflow, they used to have that component with proxy setup there

round summit
#

i see it's how it's supposed to be the, data oriented way
(i don't think i can set transforms though since unityengine is supposed to be single thread)

dull copper
#

I've duplicated the system and modified it to work with interpolation system from @warped trail

#

getting quite hacky again

#

I've been evaluating the options on this because current hybrid isn't all that great with HDRP so would be alternative to just render things on the gameobject side

#

there's an update coming to hybrid rendering tho

warped trail
#

don't use that๐Ÿ˜…

dull copper
#

it's just a proto

#

ultimately, if the netcode package starts to become worthy, would need to make things work with it's strategies instead

warped trail
#

I wonder if i could make my silly interpolation system to not use "buffer" component๐Ÿค”

dull copper
#

yeah I was wondering about that

#

can't you just write to componentdata directly?

warped trail
#

im lerping from A to B and storing result in C

dull copper
#

also the time buffering on each entity was extra

#

like, it would always be the same for each entity anyway

warped trail
#

oh, i don't use dynamic buffers at all๐Ÿ˜…

#

what do you mean by " just write to componentdata directly"?

dull copper
#

I dunno, have just extra components there where you store the previous and current data which you now use buffers for

warped trail
#

buffers was bad idea, i just tried to copy thing from that blog about smooth motion๐Ÿ˜…

#

i don't want to use any additional component at all๐Ÿค”

#

translation is most recent data and LocalToWorld is data from previous frame. I don't need anything else๐Ÿค”

#

how can i do this easily A = math.lerp(A,B,t) with same result as C = math.lerp(A,B,t)?๐Ÿ˜…

round summit
#

Recreate A looking at the velocity, ang vel, etc?
Does that work at all?
You are talking about stateless frame interpolation right?

warped trail
#

i am just lerping two positions

dull copper
#

you need to have the previous transform data stored somewhere if you do interpolation

#

it's like the bare minimum

#

this is the only thing I add when I implement fixed timesteps myself

#

the last physics sim always gives you the current

#

so you don't really need duplicate for it unless you overwrite it

#

and in this case since the result goes to localtoworld, you only miss the previous physics sim data

warped trail
#

thats the problem, i want to store last physics sim at LocalToWorld, but not like the last physics sim more like already interpolated value๐Ÿค”

dull copper
#

well, technically you could just overwrite the local to worlds data as the last thing after the rendering is done, set the current physics translation and rotation to it there, and then use it as your source for previous physics step data on the next run

#

like, if you really don't want to add extra componentdata for previous translation and previous rotation

warped trail
#

this will work at firs render update after fixed update, but what to do next?

dull copper
#

oh right

#

yeah, just have the extra data there :p

warped trail
#

i don't want to๐Ÿง

dull copper
#

then some magic needs to happen somewhere ๐Ÿ˜„

warped trail
#

oh, i can calculate previous interpolation factor T at time- delta time. So LTW is interpolated value at T(time -dt), I know end position, so (EndPosition - LTW) / (1-(time -dt)) will be speed(V) at which im interpolating . So LTW + V*(T - T(time -dt) will be answer๐Ÿค”

warped trail
#

it works, but i still need component to block default TRS system๐Ÿ˜ญ

warm panther
#

Is there a way I can write to components and their fields programmatically?

I want to write a debug tool that takes input and writes it to a component. So it needs the entity/query, component and field names at edit time (exposed in the editor/inspector), and turn them into a system at runtime or compile time.

#

It's okay if that happens in a synchronous non-burst system. Just wondering how I can use reflection etc. in such a loop over the entities in a query.

static cradle
#

Can anyone tell me how ECS is called but without having systems? so you have Entities that are composed of components. Only found the short term CBE but couldn't find anything about it.

gusty comet
#

Hello, after updated Entities to 0.6.0 (latest version) the world is null so the convert Entity didn't work (nothing work), do you know anything about it?

opaque ledge
#

All types must be known at compile time, so i guess code regen ? @warm panther

#

@static cradle You can use World.DefaultGameObjectInjectionWorld.EntityManager to get the entity manager of default world, after that you can make your queries, set component, read etc.

static cradle
#

@opaque ledge That's not what i meant

opaque ledge
#

@gusty comet you might want to restart your editor if you havent already, also default world is now World.DefaultGameObjectInjectionWorld, World.Active is deprecated, if you are still using that

#

Entity Component Systems

gusty comet
#

@opaque ledge I've effectively replaced every World.Active but the DefaultGameObjectInjectionWorld is still null

opaque ledge
#

are there any errors and did you restart your editor ?

static cradle
#

@opaque ledge i am talking about OOB, not DOD. Like those MonoBehaviors. Just looking for the term of the principle

mystic mountain
#

Anyone know where the reference for the buildconfigs are?

gusty comet
#

thx @opaque ledge that was the editor effectively, I've restart it several times, but maybe not after updated all references changes, thank you ๐Ÿ™‚

dull copper
#

@mystic mountain you want to use that for implementing some build tool?

mystic mountain
#

I want to know e.g. what things like "Auto Load" on Scene List actually means

dull copper
#

that sounds like it'll automatically load those scenes on the build when it runs?

#

not really sure of the setting, never seen it myself

#

ah I see it now

mystic mountain
#

Yeah, sure it sounds like it could mean that, but you don't need to tick one to make the first scene load. So ambiguous, hence I want a reference.

dull copper
#

maybe it makes more sense with dots subscenes, like if you don't want to load the base scene at all on build etc

#

but could still want to load multiple subscenes automatically

#

no idea though, just throwing out ideas

mystic mountain
#

Yep, also what Source Build Configuration "Enabled" means. Couldn't find any info in the packet it was so. :/

dull copper
#

where is that setting even?

#

doesn't sound like a success to me

mystic mountain
#

heh

#

It was renamed to buildconfiguration , so might not be in the old one if you're using that.

dull copper
#

yeah, I'm on it already

#

just took the new ones from ECS samples ๐Ÿ™‚

#

hmmm, it doesn't show up on my list still

#

ah

#

it's additional thing you can add

#

I wonder if that just creates sln for it

#

lets try

gusty comet
#

I would like to update a materials of some entity, so I've created a JobComponentSystem, on the OnCreate I instantiate a EntityQuery, but the m_Group.CalculateChunkCount() is zero and the OnUpdate is never called do you know how can I do?

dull copper
#

I mean, in the old build tools, you could let the build tool just generate the solution and process the files but not compile it

#

and then just compile it yourself on VS etc

#

"Install In Builds Folder can only be used when building from source"

#

btw that error I got on new build tool... it's apparently because it can't find something in the end

#

actual build it there already and it runs fine

#
        static readonly BuildAction k_BuildAndRun = new BuildAction
        {
            Name = "Build and Run",
            Action = (config) =>
            {
                var buildResult = config.Build();
                buildResult.LogResult();
                if (buildResult.Failed)
                {
                    return;
                }

                using (var runResult = config.Run())
                {
                    runResult.LogResult();
                }
            }
        };```
#

it fails on that runResult.LogResult();

#

so I guess the build only would work

amber flicker
#

Joachim - ..the next version of Hybrid Renderer which will require Unity 2020.1 fully support motion vectors. Keep an eye out on the release notes the next couple of weeks. ๐Ÿคž

round summit
#

stepPhysicsWorld.Simulation.CollisionEvents
Is this deprecated? I can't find anything that says it's deprecated but i don't see the CollisionEvents in my step physics world

dull copper
#

I still can't get Joachim to comment if "full HDRP" support will include DXR

#

I mean, I'm 90% sure it will not

warped trail
#

i just want URP support, there is no performance by default for me in HDRP, 24fps in default scene is a big no no๐Ÿ˜ญ

dull copper
#

@round summit Unity Physics samples on ECS Samples repo has collision events example

#

I'd start looking there if you have issues with it

#

@warped trail 24fps? ๐Ÿ˜„

#

you mean the dots shooter thing now?

warped trail
#

i mean default scene with workbench and stuff

dull copper
#

for me somewhat empty hdrp level with plane and few test objects with unity physics runs near 2000fps on build

#

yeah the workbench one wouldn't ๐Ÿ˜„

#

I thought initially you meant by default the new empty scene you get when you make new scene

#

that's weird tho

warped trail
#

i have potato pc(660m)๐Ÿคทโ€โ™‚๏ธ

dull copper
#

did that workbench one have volumetric lighting enabled by default?

#

it's the single most expensive thing you can have on HDRP

warped trail
#

but Megacity is 17-18 fps

dull copper
#

it's also what makes most unity tech samples run really crap

#

like the old fps sample

#

or space ship demo

#

although should have profiled that before declaring it as root of all evil :p

#

if I remember right, megacity was quite cpu bound on my old i5 and gtx970

#

it didn't run much better there

#

I also have a potato PC for low end testing here that I have GT640 and GTX670 for, but I haven't really put it into test with proper HDRP scenes yet

#

I do expect it to be pain to get it scale that down tho

#

as another topic

#

they seem to have fixed IL2CPP build time regression on latest packages and 2020.1.0a24

warped trail
#

i feel that my pc is more than enough to the games i wish to make in the future. Because Inside and Ori runs perfectly fine and i consider this two as best games made on Unity๐Ÿ˜…

dull copper
#

when I last tested this (and made issue report) on a23, it took 20x longer on somewhat empty scene

#

I'm not disagreeing, I love well optimized games ๐Ÿ™‚

#

Hollow Knight is pretty cool as well but it's not technical marvel like the games you just mentioned, just cool gameplay and graphics

#

I think HK used like playmaker for AI

#

I mean, it worked still...

#

but ori and inside both got tons of cool custom tech

warped trail
#

haven't noticed any positive changes in compilation times๐Ÿ˜•

dull copper
#

oh I didnt mean like that

#

there was a HUGE regression on few earlier 2020.1 versions if you built with IL2CPP

#

took 20 minutes to build somewhat empty DOTS scene on my cpu

#

now it's little over 1 minute again, like it was on 2019.3

sour ravine
#

are there any channels for DOTS systems to write data for pickup by MonoBehaviour components? Example-- I want to do a more complex, almost database lookup-like operation to produce an asset reference and then use that asset reference with systems (Timeline) that do not have a DOTS binding

#

I was thinking I can save things out in a bridge component or muck around with shared components, but am unsure how I can examine that on the GameObject/MB end

mint iron
dull copper
mint iron
#

i read on the forums somewhere a comment from him about how they regretted splitting JobSystem/System, they considered it a big mistake and this seems to be the solution.

sour ravine
#

doing some reading, that's not exactly what I need (but is actually pretty valuable for the same system on the editor end)

#

the big thing is being able to change properties on a MonoBehaviour-derived component using ECS

amber flicker
#

@sour ravine you can do Entities.ForEach(ref MyMonoBehaviour mmb...)

sour ravine
#

hm

#

didn't know that was kosher to do

#

can I access that from a regular job?

zenith wyvern
#

No ref in that case

sour ravine
#

(i.e. a struct)

#

not the lambdas

amber flicker
#

yes, though the syntax is a bit different (can't remember off the top of my head) - and @zenith wyvern is right about ref

sour ravine
#

yeah it's a reference type anyway

#

ref is sort of redundant

zenith wyvern
#

You cant pass a managed type to a job, no. You can only do it WithoutBurst and .Run

sour ravine
#

that sounds like it would disallow the use of struct-based jobs

amber flicker
#

main thread access for any MonoBehaviour stuff but you can use it in a job as Sark says (using no burst and Run)

sour ravine
#

I mostly want to set the asset on a playable director here

#

that's the tricky data bit

zenith wyvern
#

Actually I think there are IJFE defined for UnityEngine.Object types

#

But yeah, you would still need to omit [BurstCompile] and call it with .Run

sour ravine
#

yeah already found all the component/bufferdata

round summit
#

Hmm, i was trying to grab some collisions like this in a ComponentSystem:

EntityQuery ImpulseGroup = GetEntityQuery(new EntityQueryDesc
{
    All = new ComponentType[] { typeof(CollisionEvent) }
});

But then i get this error:

ArgumentException: Unknown Type:`Unity.Physics.CollisionEvent` All ComponentType must be known at compile time. For generic components, each concrete type must be registered with [RegisterGenericComponentType].

Have you seen this error before? I thought this piece of code would get me the collisions from last step physics world?

spare raven
#

any clue if 2019.3.3f1 breaks dots for some reason? Some systems that used to work

#

now directly don't

opaque ledge
#

2019.3.3 came out ? ๐Ÿ‘€

spare raven
#

and fbx issue is still ther

warped trail
#

@round summit you have to use ICollisionEventsJob for collisions๐Ÿค”

round summit
#

Oh, i see thanks

zenith wyvern
#

CollisionEvent is not a component, that's why you saw that error

round summit
#

I see, i did some funky stuff in my desperate attempt

warped trail
#

@round summit ICollisionsEventsJob and ITriggerEventsJob are not multithreaded so you can use regular EntityCommandBuffer not concurent one

round summit
#

Can i also use these in ComponentSystem?

#

Or it needs to be JobComponentSystem?

#

All the examples i'm seeing now are using JobComponentSystems ๐Ÿค”

warped trail
#

you will have to sort events by yourself๐Ÿ˜…

opaque ledge
#

So, as systems we have 3 classes, ComponentSystem, JobComponentSystem, SystemBase.
ComponentSystem runs on mainthread so it offers no parallelism, if you are already using them consider 'upgrading' them to JobComponentSystem which is multi threaded.

#

ComponentSystem is more for debug stuff

round summit
#

I might eventually do that upgrade

safe lintel
#

@opaque ledge SystemBase should be the replacement for both

#

after switching some systems over last night, I like how jobhandles are handled(heh) now

opaque ledge
#

yep

scarlet inlet
#

Hello, what is the best way to convert prefabs without using subscenes?

opaque ledge
#

SystemBase is relatively new, and since Dependency is a property now i thought people with no experience with scheduling stuff could have "wtf" moment, thats why i didnt advise it.

#

using GameObjectConversionUtility

#
blobAssetStore = new BlobAssetStore();
GameObjectConversionSettings settings = GameObjectConversionSettings.FromWorld(World.DefaultGameObjectInjectionWorld, blobAssetStore);
Entity prefabEntity = GameObjectConversionUtility.ConvertGameObjectHierarchy(Prefab, settings);
safe lintel
#

well, they switched over all the samples to it, I think they think it should be encouraged over the previous solutions

scarlet inlet
#

yes I need to be careful about that tho, as it's very slow (creates a world every time) so what I did is to create a special monobehaviour that implements IDeclareReferencedPrefabs, IConvertGameObjectToEntity so that I can iterate over a list of prefabs at once

toxic mural
#

Yeah I am one who didn't understand the Dependency property. But I also didn't understand JobHandles either, soo..

#

Mainly I don't get where jobhandles come from, if they're not being passed in to Update()

safe lintel
#

@toxic mural so any job you schedule returns a jobhandle

opaque ledge
#

@scarlet inlet you can do that as well, thats what i do as well on some prefabs

safe lintel
#

oh so SystemBase now has a Dependency property where you stuff all jobhandles to

#

you also use that as the jobhandle for scheduling jobs
so like
Dependency = new RotateJob().Schedule(this, Dependency);

scarlet inlet
#

@opaque ledge if I got it right when I do

 public void DeclareReferencedPrefabs(List<GameObject> referencedPrefabs)
        {
            referencedPrefabs.AddRange(_prefabs);                
        }

_prefabs can contain hierarchical prefabs and the hierarchy will be properly converted

opaque ledge
#

@toxic mural think like this, Unity's internal Job Scheduler is calling every JobComponentSystem's OnUpdate method and passes the "inputDeps" JobHandle, so think like.. Job scheduler is a mailman, and it collects every JobComponentSystem's 'mail'(which is a JobHandle), and goes to post office and.. process them in certain order so every mail is sent to it's proper destination... and.. yeah, thats it

#

@scarlet inlet yeah

#

you have to have IConvert interface as well

#

like.. they work 'together' so to speak

scarlet inlet
#

@opaque ledge cool. However I recently noticed that some gameobjects in the hierarchy are converted in unused entities and I would like to prevent their creation (or destroy them later). IS there a way to do so?

opaque ledge
#

what do you mean unused entities ? I mean.. i am assuming you decide what entity is being used or not, if you dont want to convert certain gameobject and its' children you can put "Convert (Stop)" script on the gameobject

scarlet inlet
#

I need to convert all the prefabs, but some children are not needed

opaque ledge
#

you can put that Convert Stop script on that children then

scarlet inlet
#

I can check at run time what is not needed, I am not sure that Convert Stop is used by GameObjectConversionUtility

#

you think so?

opaque ledge
#

it should be yeah ๐Ÿค”

#

you can just try ๐Ÿ˜„

#

i havent tried it yet but i think it works

scarlet inlet
#

I did and didn't work, but maybe I was doing something wrong, let me try again

#

(checking the code it seems that that component is used only with the subscene flow, but I can still be wrong)

opaque ledge
#

if it doesnt work you can destroy them i suppose, parent should have Child component, you can access that and destroy them

#

But yeah like i said, i never tried so

scarlet inlet
#

testing...

round summit
#

Right now, this is the only system and the only piece of code i have in my project.
I wanted to print "collision" when a collision happens in the scene.

[UpdateAfter(typeof(BuildPhysicsWorld))]
[UpdateAfter(typeof(StepPhysicsWorld))]
[UpdateBefore(typeof(ExportPhysicsWorld))]
public class AllSimulationSystem : JobComponentSystem
{
    BuildPhysicsWorld m_BuildPhysicsWorldSystem;
    StepPhysicsWorld m_StepPhysicsWorldSystem;

    protected override void OnCreate()
    {
        m_BuildPhysicsWorldSystem = World.GetOrCreateSystem<BuildPhysicsWorld>();
        m_StepPhysicsWorldSystem = World.GetOrCreateSystem<StepPhysicsWorld>();
    }

    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        JobHandle jobHandle = new CollisionJob().Schedule(
            m_StepPhysicsWorldSystem.Simulation, 
            ref m_BuildPhysicsWorldSystem.PhysicsWorld, 
            inputDeps);

        return jobHandle;
    }

    struct CollisionJob : ICollisionEventsJob
    {
        public void Execute(CollisionEvent collisionEvent)
        {
            Debug.Log("collision");
        }
    }
}

But i get this error about job dependency problems?

InvalidOperationException: The previously scheduled job AllSimulationSystem:CollisionJob reads from the NativeArray CollisionJob.InputVelocities. You are trying to schedule a new job Solver:ApplyGravityAndCopyInputVelocitiesJob, which writes to the same NativeArray (via ApplyGravityAndCopyInputVelocitiesJob.InputVelocities). To guarantee safety, you must include AllSimulationSystem:CollisionJob as a dependency of the newly scheduled job.

Why is this?

opaque ledge
#

i think you should put "UpdateAfter(typeof(BuildPhysicsWorld))" attribute to your system

round summit
#

oh i did that too sorry

#

same error with that too

#

i updated the class attributes in the code

warped trail
#

try exportphysicsworld

round summit
#

i did this?
[UpdateBefore(typeof(ExportPhysicsWorld))]

warped trail
#

after

round summit
#

hmm, same error

#

this is only the first error btw

opaque ledge
#

can you try UpdateBefore(typeof(BuildPhysicsWorld))

#

thats what i have on my trigger job

round summit
#

@opaque ledge same error

opaque ledge
#

Where does InputVelocities coming from ?

round summit
#

Solver:ApplyGravityAndCopyInputVelocitiesJob this i think

#

something in physics systems i believe

opaque ledge
#

hmm ๐Ÿค”

scarlet inlet
#

inputDeps = JobHandle.CombineDependencies(inputDeps, _stepPhysicsWorldSystem.FinalSimulationJobHandle);

#

@round summit ^^

#

the unity physic ECS dependency system relies on the FinalJobHandle pattern

#

it doens't work just with the automatic component dependency system

#

actually you may need even to add this:

#
   //this is necessary because we must be sure that the extra jobs are completed by the end of the
                //final step
                _endFramePhysicsSystem.HandlesToWaitFor.Add(updateCollisionStateJob);
#

this is our code:

#
inputDeps = JobHandle.CombineDependencies(inputDeps, _stepPhysicsWorldSystem.FinalSimulationJobHandle);

                var updateCollisionFlagJob = new UpdateCollisionFlagJob
                {
                    CollisionsFromEntity = GetBufferFromEntity<CollisionEventData>()
                }.Schedule(this, inputDeps);

                var collisionEventJob = new CollisionEventJob()
                {
                    Bodies = _buildPhysicsWorldSystem.PhysicsWorld.Bodies,
                    PhysicsVelocityGroup = GetComponentDataFromEntity<PhysicsVelocity>(true),
                    PhysicsMassGroup = GetComponentDataFromEntity<PhysicsMass>(true),
                    CollisionsFromEntity = GetBufferFromEntity<CollisionEventData>(),
                    Counter = (int*) _counter
                };

                var collisionEventJobHandle = collisionEventJob.Schedule(_stepPhysicsWorldSystem.Simulation,
                    ref _buildPhysicsWorldSystem.PhysicsWorld, updateCollisionFlagJob);

                var updateCollisionStateJob = new UpdateCollisionStateJob
                {
                    CollisionsFromEntity = GetBufferFromEntity<CollisionEventData>()
                }.Schedule(this, collisionEventJobHandle);
                
                //this is necessary because we must be sure that the extra jobs are completed by the end of the
                //final step
                _endFramePhysicsSystem.HandlesToWaitFor.Add(updateCollisionStateJob);

                return updateCollisionStateJob;
#

but I think you can see this from their examples too

round summit
#

allright, i'm trying now

opaque ledge
#

Did it work ๐Ÿ‘€

round summit
#

still trying

warped trail
#

i guess ITrigerEventsJob different?๐Ÿค”

round summit
#

that would explain my situation i think

opaque ledge
#

Maybe, but i only have 1 triggereventsjob, raycast also works without problem if you only have 1, but gives errors if you have more than 1

#

with readonly collision 'hack' it works but not sure about itrigger or icollision job

scarlet inlet
#

ITriggerEventsJob are similar

warped trail
#

but im using ITriggerEventsJob without FinalSimulationJobHandle and there is no errors and everything works fine๐Ÿค”

opaque ledge
#

multiple trigger jobs ?

scarlet inlet
#

I am not sure how the JobDebugger works

#

but it may not detect problems due to the final job handle pattern

opaque ledge
#

yeah, come to think of it, everything related to dots physics is pain

round summit
#

Hmm, this class in the unity ecs sample has "unsafe" attribute:
https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/master/UnityPhysicsSamples/Assets/Demos/2. Setup/2d. Events/Scripts/CollisionEventImpulseBehaviour.cs
The one for detecting collisions.

But the one detecting the triggers doesn't have the "unsafe" attribute

scarlet inlet
#

the problem is that the job dependency systems starts to crumble once external dependencies (like the final handle pattern) are used

opaque ledge
#

well makes sense because trigger doesnt do any physics so

scarlet inlet
#

meaning that you have to pay much more attention

#

what's the relation with the unsafe attribute?

round summit
#

I just noticed that

opaque ledge
#

doing pointer stuff i suppose, i dont do any collision so i never tried it

scarlet inlet
#

yeah unsafe is related only to the use of pointers

#

it's unrelated to the job dependency system

#

note that the reason why I know this stuff about the final handle is because we checked the physic examples, you will find the same code there

#

if not, I am wrong ๐Ÿ™‚

round summit
#

Is the code you are referring to the one i just sent?
@scarlet inlet

pliant pike
#

I really wish jobcompsystems would run in a straightforward way

scarlet inlet
#

@round summit yes

round summit
#

It doesn't do any *ptr stuff but it still has the unsafe attribute?

pliant pike
#

like I create an entity in the Onstartrunning if I leave it like that its fine and it creates the entity

scarlet inlet
#

@round summit sorry that code proves that I am actually wrong

#

I can see that the Schedule<T> extensions does the FinalSimulationJobHAndle concatenation already

#

I need to check this with my colleagues tomorrow

pliant pike
#

but if I then use an Entities.foreach in Onupdate that checks for and uses that entity then the whole jobcompsys doesnt run at all and the entity is never created

scarlet inlet
#

so yeah that schedule should do already what I suggested to do, sorry about that

#

reagarding the unsafe, it's not necessary, not for the jobs to work

round summit
#

still get the errors though,
i'll try to run the example project as it is

#

I was just taking that code alone and try to make it print stuff on a collision

scarlet inlet
#

don't forget to disable burst if you want to use debug.log

#

I need to go now, good luck, maybe tag me with the solution if you find it

round summit
#

thanks, i will

warped trail
#

found the solution๐Ÿ˜…

#
var jh = new CollisionJob().
            Schedule(m_StepPhysicsWorldSystem.Simulation,
            ref m_BuildPhysicsWorldSystem.PhysicsWorld,inputDeps);
jh.Complete();
return inputDeps;```
#

will work like this๐Ÿ‘

opaque ledge
#

so just complete then ? ๐Ÿ˜„

warped trail
#

yes๐Ÿคทโ€โ™‚๏ธ

opaque ledge
#

yeah well fair enough.

warped trail
#

but you don't have to call complete on triggereventsjob๐Ÿค”

pliant pike
#

Does HasSingleton() not work with DynamicBuffers ๐Ÿค”

opaque ledge
#

nop ๐Ÿ˜ฆ

pliant pike
#

disappointed! ๐Ÿ˜•

opaque ledge
#

yeah, not a biggie tho i suppose, you just put a singleton component to it, and do getsingletonentity with that component and do getbuffer inside a job

#

kinda annoying but at least its not impossible to do

pliant pike
#

yeah just means I'm gonna have to use a tag as well

warped trail
#

aren't netcode samples are using buffer singlton for input?

round summit
#

@warped trail Did you see that the CollisionJob executes its code?

warped trail
#

yes

#

have you checked RaisesCollisionEvents checkmark?

round summit
#

oh, didn't know about that

#

ill do it

#

.
@warped trail thanks alot, this stuff is very hard to figure out๐Ÿ˜…

@scarlet inlet , drUID got it, i'll tag you here in case you miss it:

var jh = new CollisionJob().
            Schedule(m_StepPhysicsWorldSystem.Simulation,
            ref m_BuildPhysicsWorldSystem.PhysicsWorld,inputDeps);
jh.Complete();
return inputDeps;
#

Can we do OnCollisionEnters/Exits without caching anything extra (keeping it stateless)?
Probably not i assume

timid beacon
#

is it possible to call InitializationSystemGroup, SimulationSystemGroup and PresentationSystemGroup manually? I know I can create my own World and systems and call those at my discretion, but I'd like to use all the setup and systems from the default world and run that with my own custom update loop ๐Ÿค”

#

i looked into the PlayerLoop but it seems I can only add calls to the update delegate? instead of replace it with my own update delegate, so to say

bright sentinel
#

@timid beacon I'm sure there's an API for it, but you can always just go into the package source and disable the system from spawning

#

I also know that NetCode disables systems from spawning in the default world, maybe you can look into how they do it

timid beacon
#

thanks @bright sentinel !

#

yes I found the bootstrap too, but latest entity package ICustomBootstrap does not reflect whats on that page

  {
    bool Initialize(string defaultWorldName);
  }```
bright sentinel
#

@timid beacon That's odd. Maybe you can look at how NetCode does it then

#

Not sure why they decided to change it though

timid beacon
#

that does seem to be what I need

#

thanks so much!!

fallow kraken
#

hi! i started playing with dots today and have a question: how would i go about updating data of one specific entity? i could create a system that queries the data type and then loop through the result until i match the element i want, but there's surely a better way?

timid beacon
#

I got it! Basically just removing the UpdatePlayerLoop part gets me all the systems but without the unity update

{
  public bool Initialize(string defaultWorldName)
  {
      Debug.Log("Executing bootstrap");
      var world = new World(defaultWorldName);
      World.DefaultGameObjectInjectionWorld = world;
      var systems = DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default);

      DefaultWorldInitialization.AddSystemsToRootLevelSystemGroups(world, systems);
      // ScriptBehaviourUpdateOrder.UpdatePlayerLoop(world); <- don't update
      return true;
  }
}

however, getting the three main groups and calling Update() on those manually does not seem to cascade down to their children, so for testing purposes now I just did

        {
            sys.Update();
        }

which works! Not sure if it calls the systems in the right order though, but that's a problem to solve for tomorrow

also, you won't get the neat systems in the PlayerLoop tree view now, which is a bit of bummer but makes sense. I'll have to roll my own tree view and time measurement I suppose

zenith wyvern
#

@pliant pike @opaque ledge You cant call getsingleton with a buffer but you can call GetSingletonEntity with a buffer, so no tag is needed

pliant pike
#

you get errors with getsingleton/entity though if the singleton doesn't exist, also the entity has no designation I can find it with

zenith wyvern
#

If you have a dynamic buffer IntBuffer you can find a singleton entity with that buffer attached with GetSingletonEntity<IntBuffer>

coarse turtle
#

Hmm does anyone have an example for Entities.WithNativeDisableUnsafePtrRestriction(capturedVariable)? - I'm having a hard time getting that working ๐Ÿค”

odd ridge
#

did someone try the DOTS Sample multiplayer project?

#

the demo they're showing runs all good, but.. it runs at 5 fps on my PC

#

when I should get 60

solar spire
#

make sure you disable the burst/jobs safety checks

dull copper
#

@odd ridge do read the readme

lusty otter
#

I'm having issue with building my project (Android + IL2CPP)
After commenting out line by line I found the problem, and made a test project with the following code:

using Unity.Entities;
using Unity.Jobs;
using Unity.Collections;

public class TestSystem : JobComponentSystem {
    EntityQuery entityQuery;

    protected override void OnCreate() {
        entityQuery = GetEntityQuery(ComponentType.ReadOnly<TestComponent>());
    }

    protected override JobHandle OnUpdate(JobHandle inputDeps) {
        UnityEngine.Debug.Log("Test");

        int count = entityQuery.CalculateEntityCount();

        if (count > 0) {
            NativeArray<Entity> entities = entityQuery.ToEntityArray(Allocator.TempJob);

            Job
                .WithReadOnly(count)
                .WithReadOnly(entities)
                .WithCode(() => {
                    for (int i = 0; i < count; i++) {
                        Entity entity = entities[i];
                    }
                }).Run();

            entities.Dispose();
        }

        return inputDeps;
    }
}

public struct TestComponent : IComponentData {
    public int Value;
}
#

Error log when building:

il2cpp.exe didn't catch exception: Unity.IL2CPP.Building.BuilderFailedException: <project_path>\Temp\StagingArea\Il2Cpp\il2cppOutput\Assembly-CSharp.cpp:2468:25: error: no member named 'get_count_0' in 'U3CU3Ec__DisplayClass2_1_tB1AB7DCE86D48C186E19893AA18115C9CC3DA6A1'
                int32_t L_4 = __this->get_count_0();
                              ~~~~~~  ^
1 error generated.
#

I looked at the cpp generated, there is indeed no get_count_0 for that class for some reason.

#

Any idea what's the cause?

#

If I comment out the line Entity entity = entities[i]; then it builds fine.

#

I'm starting to think it's a bug related to code striping, but just in case it's something really obvious that I overlooked.

urban remnant
bright sentinel
#

@urban remnant Not other than the content of the job. Entities.Foreach() generates a job for you, so you don't have to write it yourself, but it's still possible.

#

Generally, ForEach is the new way and you'll probably be using that most of the time

#

And note that with the newest version of Entities, they have moved from JobComponentSystem to SystemBase, which combines ComponentSystem and JobComponentSystem

urban remnant
#

@bright sentinel how doe's that work? So it uses jobs or not when I use it?

bright sentinel
#

It does use a job, it just generates the code for you

dull copper
#
## [Platforms 0.2.1] - 2020-02-25

### Added
- Support for building testable players (`TestablePlayer` component) as a step towards integration with the Unity Test Framework.
- Add a UsesIL2CPP property to BuildTarget

### Changed
- Enable Burst for DotNet builds on Windows
- Revert namespace `Unity.Platforms.Build*` change back to `Unity.Build*`.

### Fixed
- Fix Build & Run fallback when build pipeline doesn't have a proper RunStep, BuildOption.AutoRunPlayer was being set too late, thus it didn't have any effect, this is now fixed.
- Build configuration/pipeline assets will now properly apply changes when clicking outside inspector focus.
- Fixed asset cannot be null exception when trying to store build result.```
#

that's from platforms 0.2.1-preview.5 despite the changelog hints it's final

urban remnant
#

Ahh cool

#

tanks @bright sentinel

bright sentinel
#

@dull copper How do you know it's final? ๐Ÿค”

dull copper
#

it's not

#

changelog is wrong

#

I'm guessing they planned next release to be final and forgot the add the preview tag back once they pushed it out or something

urban remnant
#
There are inconsistent line endings in the 'Assets/Scripts/Systems/Characters/Player/PlayerAnimationSystem.cs' script. Some are Mac OS X (UNIX) and some are Windows.
This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands.
#

Anybody know fast way to fix those in VS 2019?

opaque ledge
#

Edit->Advanced->Change line endings ->CR LF if you are on windows

#

also in project settings->Editor you can choose what endings new scripts will have, change to windows if you are on windows

urban remnant
#

Tnx

scarlet inlet
#

.
@warped trail thanks alot, this stuff is very hard to figure out๐Ÿ˜…

@scarlet inlet , drUID got it, i'll tag you here in case you miss it:

var jh = new CollisionJob().
            Schedule(m_StepPhysicsWorldSystem.Simulation,
            ref m_BuildPhysicsWorldSystem.PhysicsWorld,inputDeps);
jh.Complete();
return inputDeps;

@round summit you are not supposed to call complete. I understand why you are doing it, but it's not how the job system should be used.

#

Also Collisionjob doesn't work in parallel so using run instead of complete is faster

gusty comet
#

Hello, how is it possible to acceed to the MeshRenderer in a Job please? I would like to change the color of a mesh with a job, I though I should use IJobChunk but it seems to be impossible: "The type 'Unity.Rendering.RenderMesh' cannot be used as type parameter 'T' in the generic type or method 'ComponentSystemBase.GetArchetypeChunkComponentType<T>(bool)'. There is no boxing conversion from 'Unity.Rendering.RenderMesh' to 'Unity.Entities.IComponentData'."

gusty comet
#

thanks @warped trail I've already saw that, I don't want to use HDRP :/ I just want to change the color of a Mesh :/

warped trail
#

welcome to the club then๐Ÿ˜…

gusty comet
#

@warped trail Ahah, I didn't know it wasn't possible yet. Thanks you, you save me from an other day lost in search

urban remnant
#

PlayerAnimationSystem.cs(8,9): error DC0023: Entities.ForEach uses managed IComponentData Animator. This is only supported when using .WithoutBurst() and .Run().

#

Ghh

#

So if I want to use Animator, I can't get all the goodies

#

?

urban remnant
#

What overall the sate with Animations in ECS, some READABLE examples? ๐Ÿ˜„

warped trail
#

there is DOTS specific animation package๐Ÿ˜

urban remnant
#

@warped trail yeah I know that. But it's not very Readable

warped trail
#

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

dull copper
#

wait a year or two I guess?

opaque ledge
#

You might try to go hybrid tbh, its in very early stages

#

i remember Sark saying that only whoever wrote that package can understand it

warped trail
#

as a beginner programmer i can tell that all this DOTS ECS stuff is not beginner friendly at all. But a have feeling that if you know how to do stuff, DOTS gives you freedom to do whatever you like and how you like. But for us beginners there is only to ways, try to use some hack to bridge old unity staff with dots, or just wait until unity make everything friendly for beginners๐Ÿค”

urban remnant
#

Yeah

gusty comet
#

a year or two ago the best option was to wait a year or two, just sayin'

#

don't ever bet on unity's experimental features, always consider whether it is usable NOW

#

if it doesn't suit your purposes, move on.

round summit
#
public struct MonoReference: IComponentData
{
    public MyMonoClass myMonoClass;
}

Is this a bad idea?

#

I basicly want to call a public method in myMonoClass whenever a collision happens
I am making an "OnCollision" method in monobehaviour thats triggered in an ecs system

#

So i need the monobheaviours reference in ecs

#

.
But since unityengine stuff run in single thread, and collision detection is multithreaded, it's going to be weird
It also does let me set the reference in my MonoBehaviour, IConvertGameObjectToEntity

opaque ledge
#

do public class, instead of public struct, however whenever you are going to use that in your system's ForEach you have to run with .WithoutBurst().Run()

#

For example, i am using this to update my UI position according to my entity's position:

public class TradeFleetUIMono : ISystemStateComponentData
{
    public TradeFleetWorldUIMono Value;
}
        var cameraEntity = GetSingletonEntity<CampaignCameraTag>();
        var rotations = GetComponentDataFromEntity<Rotation>(true);

        Entities.ForEach(
            (TradeFleetUIMono mono, in Translation translation) =>
            {
                //logic
            })
        .WithReadOnly(rotations)
        .WithoutBurst()
        .Run();
round summit
#

oh, i needed to see how you were referencing to camera

#

ah nwm i see

#

public TradeFleetWorldUIMono Value;
@opaque ledge how is this field set initially?

opaque ledge
#

just wanted to show how you can work with reference class, so this way your monobehaviour doesnt need to access a specific Entity's information, you can simply use the example above to set all your monobehaviour's fields.

#
            var commandBuffer = endSim.CreateCommandBuffer();

            Entities.ForEach((Entity entity, in TradeFleetData data, in DynamicBuffer<FleetBuffer> buffer) =>
            {
                var worldUI = mainGameObject.AddComponent<TradeFleetWorldUIMono>();
                worldUI.MainText = "Trade Fleet";
                worldUI.SetCooperation(data.owner);
                worldUI.AddFleet(buffer);
                commandBuffer.AddComponent(entity, new TradeFleetUIMono { Value = worldUI});
            })
            .WithNone<TradeFleetUIMono>()
            .WithAll<TradeFleetTag>()
            .WithoutBurst()
            .Run();

            Entities.ForEach((Entity entity, TradeFleetUIMono mono) =>
            {
                Object.Destroy(mono.Value);
                commandBuffer.RemoveComponent<TradeFleetUIMono>(entity);
            })
            .WithNone<TradeFleetTag>()
            .WithoutBurst()
            .Run();

            endSim.AddJobHandleForProducer(Dependency);
round summit
#

your ecs has reference only to one monobehaviour instance?

opaque ledge
#

So whenever a tradeFleet is created this system creates the mono and assign it, when tradefleet entity is destroyed i destory that mono

dull copper
#

they updated https://github.com/Unity-Technologies/multiplayer/:

# 2020-02-24
## Changes
* Upgraded Unity NetCode to 0.1.0, see the [Unity NetCode changelog](https://docs.unity3d.com/Packages/com.unity.netcode@0.1/changelog/CHANGELOG.html)
* Upgraded Unity Transport to 0.3.0, see the [Unity Transport changelog](https://docs.unity3d.com/Packages/com.unity.transport@0.3/changelog/CHANGELOG.html)
* Added new sample demonstrating lag compensation.```
opaque ledge
#

well you can have multiple if you like, but for this specific case yeah

dull copper
#

A sample showing a way to implement lag compensation based on Unity Physics. In a game based on the Unity NetCode the client will display an old world state, lag compensation allows the server to take this into account when performing raycasts so the player can aim at what is actually displayed on the client.

opaque ledge
#

in TradeFleetWorldUIMono's Awake i have this:

#
        worldUI = Instantiate(CampaignManagerMono.instance.TradeFleetWorldUIPrefab, new Vector3(0, 100, 0), Quaternion.identity);
        controller = worldUI.GetComponent<TradeFleetWorldUIController>();
#

i instantiate the 'real' monobehaviour i want to manipulate

#

you can probably just insantiate from system as well but i rather do addcomponent there

#

and i also have other methods to manipulate the real mono, such as MainText, SetCooperation etc.

round summit
#

I'd like to assign this field (reference to mono i mean) in my "ConvertedEntityHolder : MonoBehaviour, IConvertGameObjectToEntity"
In it's "Convert()" method, but i get this error

ArgumentException: A component with type:RigidbodyMonoReference has not been added to the entity.
Unity.Entities.EntityComponentStore.AssertEntityHasComponent (Unity.Entities.Entity entity, Unity.Entities.ComponentType componentType)
private Entity entity;
private EntityManager entityManager;

public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        this.entity = entity;
        this.entityManager = dstManager;
        RigidbodyMonoReference rigidbodyMonoReference = new RigidbodyMonoReference
        {
            rigidbodyMono = GetComponentInParent<RigidbodyMono>()
        };

        dstManager.SetComponentData(entity, rigidbodyMonoReference);
    }
opaque ledge
#

do AddComponentData, i believe Set only works if it already exists

round summit
#

oh wait, i guess i

#

yeah i was about to say that

opaque ledge
#

๐Ÿ˜„

round summit
#

yeah, it works this way

opaque ledge
#

Knowing how to do 'bridging' from ECS to Monobehaviour world is a very useful knowledge, you can use that knowledge to overcome ECS's current incapabilities.

#

to a certain degree anyway, i dont do any 'special' stuff, i am current using it for world UI

round summit
#

this schedule() method, it only adds the jobhandle in to the given inputDeps right?
with the right order

opaque ledge
#

Schedule(inputDeps) means, the job you are currently scheduling depends on "inputDeps" jobHandle

round summit
#

When i call systemGroup.Update(); in monobehaviour, do you think it does the Comple(); thing?

#

Does it stop the main thread until everything is done i mean?

#

Or do i have to make it in a job and call Complete() on it?

opaque ledge
#

I never tried sorry

round summit
#

Hmm, if i use class instead struct when defining the ComponentData, it doesn't let me use

GetComponentDataFromEntity<MyDataComponent>()
#

But if use struct, it doesn't let me store a class reference in the MyComponentData

#

I don't think i can do this with Entities.ForEach like you are doing
because i need to do this in a "ICollisionEventsJob"

Should i store an integer id instead?
And then i can look up in a dictionary for the class i want to reference?

Is that the only way?

round summit
opaque ledge
#

Hmm ๐Ÿค”

mint iron
#

Is that the only way? thats the way i did it for ECS interacting with mono UI components. But uhh, have you looked at AddHybridComponent? thats a new thing since i evaluated the options.

dull copper
#

so..... with the new SystemBase, we can finally get away of this IJobForEachWithEntity_EBC nonsense

opaque ledge
#

you could do it with EntityQueries tho it would feel like its 'hacky', something like:

        var query = GetEntityQuery(typeof(MonoBehaviourClass));
        var queryEntities = query.ToEntityArray(Allocator.TempJob);
        var queryMonos = query.ToComponentDataArray<MonoBehaviourClass>();

Then in your collision job:

  //Do collision check and find hit entity
  var index = queryEntities.IndexOf(hitEntity);
  if(index>0) queryMonos[index].MonoMethod();
round summit
#

hmm, looks nice

dull copper
#

I do wonder when they'll solve the lack of ReadOnly tags with the Entities.ForEach though, there has to be better solution than making intermediate struct that has the component you want with readonly tag

opaque ledge
#

there is WithAll<Tag1, Tag2, Tag3>() method, thats enough for me ๐Ÿ˜„

dull copper
#

is the WithAll cheaper than the ForEach or is just for convenience?

#

there used to be cap on parameters you could feed on those in past too so I could imagine it's just easier to filter with two separate things if the others don't need ref

#

oh wait I remember now, tags don't work on foreach

#

it still feels bit weird that it's done separately IMO

opaque ledge
#

what do you mean by tags ? they are IComponentDatas without any data in it right ?