#archived-dots

1 messages Β· Page 161 of 1

lusty otter
#

Would something like, a thread that didn't write so its local copy is still false, is the last one and it copies the false result to the final return?

coarse turtle
#

well since it's a native array, the local copy of it is just a local cpy of the same pointer inside the NativeArray, so if the last thread didn't write to that pointer, it's whatever the previous threads have written into that pointer address

lusty otter
#

Ahh okay.

#

What happens when two threads writing to the same address at the same time?

minor sluice
#

usually race conditions I think?
if you disable container safety checks, and you have 2 parallel jobs that write to the same index/address, you don't know which value will be written lastly

coarse turtle
#

hrm - well you have 1 other thread just overriding the data πŸ€”

minor sluice
#

which can result in unexpected behaviour

lusty otter
#

Right but all threads are writing the same value so it's fine if they overwrite each other.

minor sluice
#

that's fun, since a native array is just something like a reference/pointer to an address, it can be used like a regular array despite it being a struct type

lusty otter
#

I'm just wondering if something unexpected would happen and crash the app.

minor sluice
#

okay,
then it should be fine, but that doesn't sound like a well thought through code structure to write the same value multiple times to the same target index?

lusty otter
#

Basically what I'm trying to do is, each thread would execute some logic, and I want to know if ANY of the threads had a positive result.

#

I don't need to know which thread had a positive result, or how many of them had, I just want to know if any of them had.

coarse turtle
#

It was a suggestion of mine since I originally suggested to use a bitflag and have each thread write to a particular index into the bitflag, but if Burrito only cared about whether the result was true done by any thread, i suggested to just check if the condition is true and write to a bool ptr / NativeArray

north bay
#

I think burst supports Interlocked

lusty otter
#

Okay, I'll keep it like this then.

amber flicker
#

apparently interlocked is generally terrible for perf? remember a post where Joachim said something along the lines of there's almost always a better alternative /shrug

north bay
#

Really? I thought interlocked was fast

amber flicker
#

will try and find it

#

one 'safe' way to do the above (sorry if it was already mentioned - lots to scan) is to store bit/bool in nativearray[JobsUtility.MaxJobThreadCount]

north bay
#

Also is most likely a lot cleaner than using interlocked

lusty otter
#

Do I need to explicitly do something to make sure it uses interlocking?

#

Because right now I'm just doing a normal 1 element long native array and it seems to work fine.

amber flicker
#

it might be fine just to do that.. I'd love to know 100% that there wasn't anything potentially unsafe about it

viral sonnet
#

does anyone have Entity 0.13 and Hybrid Renderer 0.7 running?

amber flicker
#

yup

viral sonnet
#

interesting, i get: "InvalidOperationException: Unable to create a SharedStatic for this key. It is likely that the same key was used to allocate a shared memory with a smaller size while the new size requested is bigger" in world creation

lusty otter
#

Yeah if someone knows I would like to know as well.

viral sonnet
#

could be related to a custom bootstrap but i saw this error also on the forum so /shrug

opaque ledge
#

restart the unity editor ?

amber flicker
#

yea perhaps custom bootstrap related - I haven't seen that error sorry

viral sonnet
#

np, thanks anyway πŸ™‚

opaque ledge
#

thats what happened to me when i change the type of shared static, when i restart the editor it fixes

viral sonnet
#

oh, restarting fixed it. haha

amber flicker
#

πŸ™‚

tardy spoke
#

I can't figure out the best approach for this problem.

I have my game "map", as in, every object for my game that is part of the "level" or whatever as a gameObject called "GameWorld".

I need to create two Entities from it.

Physics World and Display World.

Physics World is a copy that has the RenderMeshes entirely removed.

Display World needs physics (bodies or masses or shapes or whatever) entirely removed.

What's a good tool to use to create an entity recursively from a gameObject prefab, that allows control over the components recursively?

amber flicker
#

hmm you want to think about serializing everything - so having it converted at edit-time. Are you trying to tick physics separately to display?

tardy spoke
#

It's for a somewhat confusing reason, haha.

The display world keeps the players origin at 0,0,0 to avoid floating point rounding errors when you get 2.5km+ from the origin.

The physics world is actually the player moving around in the normal "static" world - but it's all "invisible".

So the displayLayer and physics layer "see" exactly the same thing, but the physics layer player is actually moving and interacting with physics objects while the display layer player stays at 0,0,0.

amber flicker
#

hmm but your physics will have fp issues too..?

tardy spoke
#

Yes, but they're not great enough to be problematic I believe.

When I translate the physics layer to the display layer I will have to do something like "if the object's position doesn't move more than the potential floating point error, keep it still on the display world".

#

The physics layer is also what the server will see as it keeps track of the location of everything, etc, since it's just a "normal" game world.

amber flicker
#

hmm imo I think your display and physics precisions/issues may scale in a similar way to each other - this can be quite a hard problem.. are you simulating anything below e.g. 1m?

#

I mean I assume you have somewhat normal human scales involved

tardy spoke
#

Well, it's a VR game so there will definitely be some human scaled physics involved. This part is basically just a test so I can jump into VR again and see if this even "solves" the issue to begin with.

maiden cape
#

Okay, I'm going to ask this again, because I don't really understand how the example I was given helps me solve my issue. I'm trying to convert my client-prediction/reconciliation system to DOTS but I can't find anywhere in the documentation that allows me to manually step the physics.

amber flicker
#

hmm have you tested physics in vr out at 2.5km?

tardy spoke
#

No, but I plan to rely on client side physics like a psycho path.

#

So I can probably use physics calculations from the "display world"

#

which will be very accurate... I guess I could verify them on the server as well on the "physics world" and be like "if this is within this range of possible error it's probably a valid action".

maiden cape
#

Once you have variance it's going to scale out of control and you'll have no valid actions after a few divergences.

tardy spoke
#

Well, I don't even know what that is, and ignorance is bliss. So hopefully that won't be a problem. 😎

maiden cape
#

If only it worked that way.

tardy spoke
#

I feel like I'm going to learn a lot about physics in a painful way.

amber flicker
#

Yea I wouldn't take this that lightly. If your player was always at 0,0,0 locally, I think that makes sense. You could simulate physics locally and sync transforms back to a server version (that might not even simulate any physics) for important objects?

#

All this depends hugely on what threshold you have for game-breaking stuff and gameplay mechanics that involve the physics

gusty comet
#

is there a naming convention for flag structs

maiden cape
#

I'm beating my head against the wall trying to figure out the new physics. My old server didn't scale for crap, so I converted everything to DOTS and now I can't figure out the rollback functionality.

amber flicker
#

not even installed physics yet sorry, can't help @maiden cape

#

flag structs @gusty comet ?

maiden cape
#

I think it's talking about [Flags]

#

If so, it's just a regular enum.

gusty comet
#

No, I mean structs that have no data but are used for pulling entities.

maiden cape
#

Ohhh.

tardy spoke
#

Tags

gusty comet
#

which I've seen referred to as flags

amber flicker
#

ah - tags

gusty comet
#

oooops, right

maiden cape
#

Tags* πŸ˜›

gusty comet
#

okay, what's the naming convention for tag structs πŸ€”

tardy spoke
#

I've seen them named same as components but I doubt anyone would complain if you actually threw tag in the name

maiden cape
#

I haven't seen them with a naming convention, tbh.

#

Just like components.

amber flicker
#

I end all my tags with SlartyBartFast

tardy spoke
#

Makes them easy to find

maiden cape
tardy spoke
#

Okay, so my idea is full of holes and likely to explode - we've established that...

So how do I start implementing it? πŸ€”

amber flicker
#

Read lots and lots? Do bare minimum experiments.

tardy spoke
#

Not that

maiden cape
#

I can explain the implementation process, but not the how. I'm looking into how for my own project.

#

I can tell you how to do it without DOTS lol

tardy spoke
#

Hahah nah I just meant my original question

amber flicker
#

yea ok I understand

tardy spoke
#

How do I instantiate the same entity two times πŸ˜‰

#

One step at a time.

#

What's a good tool to use to create an entity recursively from a gameObject prefab, that allows control over the components recursively? was the original question, hahahah

amber flicker
#

so I asked my original question because the important part is which data exists in which place - do you actually want an entity twice or do you want physics somewhere and render data somewhere else with just a transform in common

maiden cape
#

You should check out CodeMonkey's DOTS videos.

#

Also, for prefab, 1sec

tardy spoke
#

@amber flicker Hmm, that's an interesting question. My approach is likely pretty naive, but it might be the best approach for me because it's without the wheelhouse of things I understand. There are probably more elegant* solutions, but they likely involve a deeper understanding of mathematics/comp sci/physics concepts than I currently have.

#

Do you think there's an easier solution in terms of elegance AND complexity?

amber flicker
#

You can write a monobehaviour that sits on your gameobject and when it gets converted (e.g. being in a subscene) you can do things like call CreateAdditionalEntity() to .. create another converted entity as well as the original gameobject

tardy spoke
#

The other reason I liked my approach is I figured that it's easier for a server later on to understand a game world in the way that it "normally" does, so you're not reinventing the wheel there

amber flicker
#

I guess you want that entity to also be moved to another world

tardy spoke
#

Why would it need to be moved to another world? Hahah

#

CreateAdditionalEntity() , yeah that sounds like something I'm after. The main issue I'm having is majority of tools that do recursive conversion to an entity are built for "one-offs" and they remove the game object after or something. And often executing the same script twice seems to not work, only the last executes, weird issues like that.

amber flicker
#

what would the 'two entities' actually do for you? if you just want all the physics interactions to be translated relative to display you could maybe just add a layer of hierarchy?

tardy spoke
#

hm, hang on i'll make a video

amber flicker
#

the conversion process is full of bugginess right now.. at least that's how it feels

#

in particular open subscenes often aren't the same as closed and sometimes when you close a subscene it goes back to an previously serialized version

hollow sorrel
#

I'm beating my head against the wall trying to figure out the new physics. My old server didn't scale for crap, so I converted everything to DOTS and now I can't figure out the rollback functionality.
@maiden cape
rollback functionality for networking or for physics?

#

oh just read your other post about stepping physics

minor sluice
#

I would really be curious how well rollback architecture would work yet with dots,
it seems to be a good use case but I haven't seen it in practice so far

hollow sorrel
#

in the physics samples there is demos/6/immediatemode that shows a pool example for manually stepping physics

#

from what i remember example there is for future prediction but should be same principle for rollback

minor sluice
#

ah thx

hollow sorrel
#

dunno how rollback architecture is done without ecs but ecs makes it pretty straightforward

#

generally you're able to just serialize the entire world and deserialize it back when needed

#

but you still need to use deterministic architecture

#

and seperate the sim from presentation

tardy spoke
#

Click the link and I kinda explain stuff.

amber flicker
#

Processing... πŸ˜†

gusty comet
maiden cape
#

@hollow sorrel Thanks I'll take a look!

#

I didn't have a proper rollback system outside of DOTS, I just used generated triggers that follow the character during movement for X frames then use those colliders in combination with client latency for hit detection.

#

Worked quite nicely.

tardy spoke
#

@gusty comet yeah I believe that's pretty old.

#

JobComponentSystem has been replaced by SystemBase (what you're probably used to, thankfully!)

gusty comet
#

oh what the fuck

#

that's 0.4

tardy spoke
#

lol

#

Yeah take that code and use "SystemBase" and "intellisense" or whatever will basically tell you the changes you need to make. Just removing the job handles and stuff really.

#

The Execute() becomes the entities.ForEach

maiden cape
#

@gusty comet

tardy spoke
#

@maiden cape I don't think any of these CodeMonkey approaches will quite work for what I'm trying to do, but I could be wrong. It'd be nice if he duplicated a used a gameObject hierarchy instead of a simple gameObject to see the difference between the conversion methods.

maiden cape
#

Maybe I didn't understand your question.

amber flicker
#

Ok @tardy spoke I just wrote a long paragraph and then thought I'd just ask - is all this because of visual artefacts at extreme distances, correct?

tardy spoke
#

Yeah, I believe that was the only issue

amber flicker
#

and have you seen these or is it hypothetical?

tardy spoke
#

Seen 'em

amber flicker
#

in what form? I ask because I think at least some of the render pipelines attempted to make a lot camera relative to avoid floating precision issues (except physics)

tardy spoke
#

Well, there's this map here which is about I believe 20km per side, so you can get about 10km away from the origin max.

I was using URP on Oculus Quest. Wish I had recorded a video, it was pretty crazy at around maybe 6km from origin. I just assumed it would get even crazier further.

gusty comet
#

im just gonna say it

#

lambda functions are hideous and I hate them

tardy spoke
#

Haha, lamda functions are doooope. I come from javascript though and that's... pretty much all anyone ever uses anymore, haha.

gusty comet
#

javascript
say no more fam

tardy spoke
#

hahaha

#

If you look up lambda calculus it's so cool you start to like the lambda functions.

#

I hated 'em at first also. But I grew to love them.

amber flicker
#

so in the first person view you were getting a bunch of artefacts right? probably flickering / bad shadows kind of stuff? On URP I assume?

tardy spoke
#

Yep, totally

#

@amber flicker pretty much exactly I believe

#

and interestingly if you got "closer" to the object the flickering decreased as the object was "bigger" in the view. If that makes sense.

amber flicker
#

was just trying to google about the status

#

I think it might be implemented in hdrp which might be what I was thinking of? Doesn't help you. Ok.. thinking.

tardy spoke
#

Yeah, I hear the implementation is practically garbage

amber flicker
#

that's disappointing

tardy spoke
#

I upvoted it though

#

Hmmm

amber flicker
#

Yea I saw that - I think most people's issues there are to do with physics and not HDRP? Thinking about it if you haven't already I'd post this question on the dots physics forum - you also want to I guess run a main physics world on the server in a static frame of reference and then local translated versions on the client

tardy spoke
#

Worth some investigation.

Does HDRP have higher overhead or anything if you use it the same way as URP?

amber flicker
#

I think it's quite a lot heavier even if you strip out a load of stuff

tardy spoke
#

lol, yeah for a VR game on Oculus Quest that is going to SUUUUUCK.

My game literally uses a single shader I made, no lighting and vertex coloring.

#

HDRP hardly seems necessary hahaha

#

but if it can solve this problem which will obvious massively increase the difficulty of creating the game, I'm all for giving it a shot

#

And who knows what the overhead of my own solution would be.

amber flicker
#

I think maybe 0lento here did quite some experimenting with making hdrp lightweight.. if you see him online might be worth asking him (and/or in #archived-hdrp )

tardy spoke
#

Yeah I'll experiment with that before continuing with the ECS dual world code. Really changes the trajectory.

amber flicker
#

also fyi I'd try and move to subscenes and away from the 'convert to entity' components if you can

tardy spoke
#

The only reason I didn't was for the "dual world" thing.

#

So i'll move it all to sub-scene if this works.

amber flicker
#

my guess is hdrp will just be too heavy sadly...

tardy spoke
#

actually... I bet you could still do the "calculate physics from player origin" hack even with the HDRP way. You may be able to calculate physics from the camera's "0,0,0 camera"'s location to the location of objects averaged out over a few frames or something to "stabilize" them.

amber flicker
#

anyway... I don't think there's much going on with your set-up other than all objects being at a different translation from the physics representations - and as I think these positions are all copied from the physics world in the export physics step or something, I'm thinking you may very simply be able to just apply a relative offset at this point and still keep all the physics and meshes in the same scene/hierarchy

tardy spoke
#

Yeah the Oculus has the equivalent processing power of a Google Pixel 2. It's pretty... restrictive, haha.

amber flicker
#

well the good news is that by the time you release, it'll likely be 5x faster πŸ˜…

tardy spoke
#

Hahah. Yeah, I'm not really sure how to apply that offset without having the objects duplicated.

amber flicker
#

like if you have a job that runs after the physics sync on all Transforms and offsets the Translation... aren't you basically done?

#

oh you would need a job that ran before physics though to reset the Translations

tardy spoke
#

That sounds like it would work

#

The trick is I'm not at all familiar with the physics systems, so I'd have to do a bit of research there to figure out how to hook into them. I doubt what I'm doing is difficult, but I literally have barely touched physics in Unity at all!

amber flicker
#

yes.. can't help much there - definitely post on the forums

tardy spoke
#

It's part of a course I'm taking on Udemy though so while I'm watching that section I'll think about the solution.

That does sound a lot better than the copying the entire world solution though, haha.

amber flicker
#

yea - you may have to directly set the LTW rather than Translation at some point and there may be other things I haven't considered - gtg but good luck!

tardy spoke
#

Yeah thanks for the help! I'm fairly convinced there's likely a better solution at this point, haha.

dull copper
#

re: floating point accuracy

#

with dots you could essentially make your own game world with doubles (would be a ton of work to mod it all though) and handle rendering camera relative with HDRP

#

most would probably just do origin shifting though

#

burst does give nice perf gains on double math too (I've tested this few months ago)

#

as for HDRP perf, there's initial overhead you can't overcome (in comparison to say URP)

#

I can make HDRP run almost as fast on my high'ish end rig but if I test on weaker computers, URP just destroys it there perf wise

minor sluice
#

I was thinking about something similar for longs instead of floats (fixed points), for determinism,
they said they offer compiler options to make calculations deterministic but not sure how safe/reliable that is

#

for stuff like rollbacks in fighting games etc

#

although, considering the amount of characters (usually 2, not many more) and the complexity of the game, it might not be worth it, not sure,
maybe it could help with the physics though

tardy spoke
#

@dull copper yeah, the target platform is Oculus Quest so HDRP unfortunately seems like it's out of the running. 😦

#

What's the proper way to process all children of an entity?

#

That is auto-converted by a subscene

zinc plinth
#

the linkedentitygroup ?

tardy spoke
#

... never heard of it. Looking up now... hahah

zinc plinth
#

ho it doesn't have one

#

guess the behavior is diferent then

tardy spoke
#

Yeah, it sounds interesting though. πŸ€·β€β™‚οΈ

#

haha

tardy spoke
#

Does a System actually need to make use of the OnUpdate method? Is it normal just to initialize things with OnCreate() or OnStartRunning() and leave OnUpdate() blank?

pliant pike
#

you use what you need, I only use oncreate or onstartrunning sometimes

cerulean sand
#

Hey folks. Is there any way to force Livelink to reconvert an object or the subscene it's in?

tardy spoke
#

Yeah, figured that might be more future proof than instantiating things with monobehaviours

#

No idea unfortunately, never used LiveLink. Looks cool though!

cerulean sand
#

I'm trying to create simple tweakable sharedComponentData authoring components (with data in scritableobject assets) but I can't figure out how to apply those changes to the entity when the asset has been modified

tight blade
#

could anyone help talk through this problem with me

#

well. ill just jump into the middle so that you guys can say "back up, what are you trying to accomplish here" --

im trying to determine the angular velocity of an object in worldspace that is, if the object is rotated 90degrees so that its z axis is facing downward (+z in local space is -y in world space), and its rolling with force F counterclockwise along its z axis, then in its local space it has an angular velocity of 0x,0y,Fz. but in worldspace it has an angular of 0x,Fy,0z

#

I guess maybe I could just treat it just like that - as a position

cerulean sand
#

general representation of angvel is to take a vector3 that is the direction of the axis of rotation with a magnitude of the rotation in rad/s

#

(that's how torque forces are represented in any case)

tardy spoke
#

Anyone know an easy way to access the children of an Entity?

I'm not sure if you're just supposed to access them through the "Transform" component which seems to hold them or what the proper approach is.

They seem to work with GetComponentObject vs GetComponentData, but I'm not sure exactly what that entails. Do they need to be stored in a NativeArray or something to be happy?

cerulean sand
#

when you say children of, you mean componentData right?

tardy spoke
#

Yep! I think I might be going down a strange path here and be grabbing the wrong child data or something haha

#

That code is just gibberish of some experiments trying to figure out what is going on

cerulean sand
#

Ok so... really important to not think of the entity as a parent object but more as a unique id. And each component type has a hash table which may or may not have that Id

#

(it's more optimised than that, but that's kind of the conceptual model)

tardy spoke
cerulean sand
#

Oh I see whatyou mean.

#

That one's a dynamic buffer

#

so you'd go var childBuffer = entityManager.GetBuffer<Child>(entity)

#

Buffers are basically the 'array component' primitive

tardy spoke
#

Ah, thanks for that. That would've taken me a while to figure out.

Plus I get NativeArrays/lists, dynamic buffers confused. Sometimes even with the entity command buffer. πŸ˜‰

#

It's so simple once you see the answer, haha. I've been trying to figure out how to work with that component for like an hour, hahah.

cerulean sand
#

they work really similar

#

but buffers are always IBufferElementData structs and you access them like components

tardy spoke
cerulean sand
#

yeah that should work fine

#

I also figured out how livelink flags things that are changed. It's watching the UndoPropertyModifications callback

#

so if you want livelink to spot any changes from editor scripts you need to make a serialized property change using SerializedObject and then call ApplyModifiedProperties (not ApplyModifiedPropertiesWithoutUndo)

cerulean sand
cerulean sand
#

It's only a first pass though... This only works for livesync entities (those in open subscenes).

I'm guessing I'll need to build some sort of initialization system on the game side that can make the same workflow work for instanced entities.

vagrant lotus
deft stump
#

hrmmmm

#

what am I missing?

tardy spoke
#

i dont quite understand
@vagrant lotus Not sure, but it to me it seems to be complaining about something along the line that two things are named the same or referring to the same thing.

vagrant lotus
#

ok

tardy spoke
#

@deft stump Not sure, but I'll be trying an Android build at some point soon... what version of Unity/render pipeline is that?

#

@cerulean sand That stuff looks pretty handy. ECS could use some tutorial videos on cool stuff like that... πŸ˜„

#

Also if I want to run something just ONE time, and it can't be done with something trivial like adding a tag with a system, what's the ideal interface to use for that?

Is there something that will run a job once upon initialization?

It seems as though the Entites.ForEach can't simply be stuffed into SystemBase's OnStartRunning() , etc, haha. Maybe I did it wrong, though.

opaque ledge
#

hmm, you can make a bool field in your system, like "isDone" which starts with false, then make if statement for isDone, if its false you run/schedule your job and set isDone to true, if isDone if statement is true then you simply return

cerulean sand
#

You can also manually execute systems, for example having a FixedTimestepExecutor that calls every system in a FixedTimestep update group on an interval

deft stump
#

@tardy spoke latest everything

gusty comet
#

How do I delete a specific buffer or all buffers of a type from an entity?

tardy spoke
#

@deft stump great. Looks like I have something to look forward to, haha.

deft stump
#

@tardy spoke if you can make it work, ping me asap. I'm working on getting the On-screen controls right for my game

tardy spoke
#

@deft stump yeah I'll keep you posted

#

Are you building for just Android or Android VR (Oculus)?

deft stump
#

Android only, no VR

gusty comet
#
                        contents[i] = new ChemicalContent {
                            Chemical = contents[i].Chemical,
                            Matter = contents[i].Matter,
                            Temp = mixtureEffTemp
                        };
                    }```
Is this the appropriate way to update a struct in a dynamic buffer? (where contents is the result of `EntityManager.GetBuffer<ChemicalContent>(entity);`)
deft stump
#

afaik, yes

gusty comet
#

Do I have to worry about GC or anything?

deft stump
#

you're just changing values anyway.

#

so no

tardy spoke
#

Interesting caveat though - this simple change makes it so it DOESN'T work - so I could see some people potentially banging their heads against the wall, haha... I'm actually interested in why placing it there doesn't work. I wonder if I have a syntax error somewhere because it seems though it should...

tardy spoke
safe lintel
#

which index is out of range? also I think you should only be removing shared components via entity manager

zealous scarab
#

what is dots?

opaque ledge
#

baby dont hurt me no more..

tardy spoke
#

DOTS is a lifestyle

#

of pain

#

@safe lintel I'm pretty sure all those errors are introduced by the ECB.

#

Removing them and no errors. Just throwing the removal in with EntityManager instead of the ECB gives the expected error where it's just like "hey yo, can't use EM in forEach loop use the ECB."... so really it's all good up to there, I believe

safe lintel
#

@zealous scarab its unitys vision of the future, like of flying cars, moonbases, amazing computers that negate the need for work πŸ˜‰

tardy spoke
#

Yes, a lot can be achieved with the Difficult Obscure Tech Stack!

#

Something that's a little weird in the code I'm working on though, that feels pretty magic-y, is that I'm literally pulling that <Child> dynamic buffer out of thin air. I'm guessing it's always "present", but is that... good practice? Haha

safe lintel
#

its also very very work in progress so imagine its nowhere near as complete as that page might suggest

tardy spoke
#

I'm hard on DOTS but I actually do think it's super cool.

gusty comet
#

Any videos / tutorials for explaining how ECS should work with 3D spaces and trigger collisions?

tardy spoke
#

Shows some basic trigger event stuff in ECS

gusty comet
#

cheers, looks like the πŸ‡ͺπŸ‡Ί for some reason

minor sluice
#

basically you have a special job to handle trigger or collision callbacks, other than that you just need to setup your physics world properly,
basically a PhysicsCollider component for colliders, if there is only this, you have a static collider

and a PhysicsVelocity and optionally some other components for dynamic colliders

#

but you can also just assign the the right components onto colliders on gameobjects and unity will handle the conversion to ecs colliders for you when you press start

tardy spoke
minor sluice
#

is that foreach query valid? haven't really worked with dynamic buffers but I think other than that, how the removecomponent method is called is fine

#

do you know which components have dynamic buffers with children?

#

if so, you could iterate through them and then use entityManager.GetBuffer<Type>(entity);

I'm going to watch this video, because I haven't worked with them yet, maybe this could be of help?
https://www.youtube.com/watch?v=XC84bc95heI

tardy spoke
#

lol, surprisingly it appears to be

#

I was surprised by that as well

#

@minor sluice yeah that video is cool, if you look at around 7 minutes that's pretty close to the implementation I'm attempting

#

Damn, I also just noticed you have a point with iteration. Even if my method worked it wouldn't be recursive.

minor sluice
#

recursive?
you mean if those childs had childs themselves?
so some might be removed before they are iterated over? I think it might not happen in this particular case but not sure,
there are certainly situations where it could be an issue, but also, you use a command buffer, so the query should still be consistent,
not even sure if it is valid to remove data that the current query applies to while still in the query

tardy spoke
#

Yeah, like it would have to travel down the hierarchy, where as with my current code it's only selecting the parent's children.

#

If I removed that it would work actually work globally, but that may not be ideal, haha. πŸ™‚

#

Yeah, it could be a problem with it overwriting the data it's working on, the errors seemed along those lines.

minor sluice
#

if only the upper parents had a specific component, you could query for them in foreach, use GetBuffer on those entities and then iterate through all the entities in the buffer and repeat the logic

#

and the component on the parent could still stay

tardy spoke
#

Yeah, only the root parent is tagged uniquely "physicsFacade" so that's perfect

minor sluice
#

hope that works then!

tardy spoke
#

I shall look into this! Thanks. 😎

#

I'm also just not sure if you can remove shared components the same way you remove regular components - but there must be a way haha.

minor sluice
#

in this case a recursive method might work

like
a method that takes an entity as parameter
if entity has no buffer, exit the method
if it has, get the buffer, add it to be removed into the command buffer and call the same method again with alll the entities you found in the buffer

#

(that is if it isn't possible to do it like you had it already, because I never tried something like this)

tardy spoke
#

Yeah. I'll give that a try!

Another one idea I was going to give a shot was one I read about on the forums


, this will make it so your query only matches entities with that SCD value. You can then pass that query to entityManager.RemoveComponent or ecb.RemoveComponent.```
minor sluice
#

if you filter for one specific reference of a shared component, this might work yeah

tardy spoke
#

I guess you would make a query that finds the children, then finds their children to query, then delete's the components that are on the "parent" query and keeps going, haha.

#

Guess it's experiment time.

minor sluice
#

yeah, that's what I wanted to refer to with my text above ^^
but there are usually multiple ways how to approach an issue

tardy spoke
#

Also what interface would you use for this? I've just been throwing pretty much everything in SystemBase and it's available methods instead of the actual job interfaces or anything like that, which may be more suitable

gusty comet
#

If I want to remove a tag from an entity, do I have to do that outside the ForEach?

#

EntityManager.RemoveComponent<GasHeatInhomogeneousTag>(entity); throws an error because the EntityManager is referenced within the burst function lambda.

tardy spoke
#

@gusty comet no you can do it in the foreach with an entityCommandBuffer, but it executes at the end

#

I'll show ya

gusty comet
#

Thank you, I see what it's doing. This ECS stuff is hard but I really need my stuff working multicore so I've gotta deal with it

minor sluice
tardy spoke
#

I can show you the errors the ECB generates

#

Though I'm not sure if they're really from the ECB, or the ECB's interaction with something else, etc

#

but if you remove the ECB they ALL go away

minor sluice
#

oh, no idea, maybe the stored entity in the dynamic buffer doesn#t exist in the current world of the entitymanager anymore,
but really no clue

tardy spoke
#

Those errors definitely read as though it's "overwriting itself" or something crazy is going on.
Either way, I'll probably try a new approach just because I have no idea what's going on there, haha.

gusty comet
#

Wait on that same note, if I am editing a struct in a DynamicBuffer in the ForEach, do I need to do anything special?

#
    for (int i = 0; i < contents.Length; ++i) {
        contents[i] = new ChemicalComposition {
            Chemical = contents[i].Chemical,
            Matter = contents[i].Matter,
            Temp = mixtureEffTemp
        };
    }
}

// Heat is now homogenous, queue entity to remove tag.
entityCommandBuffer.RemoveComponent<GasHeatInhomogeneousTag>(entity);
tardy spoke
#

Special? Haha

#

Like changing the value of a component?

#

If you have a "ref" in the ForEach for that component I think it's alright and doesn't need an ECB or anything. I think ECB is just for "structural" changes that actually require entities to be shifted around in memory (because you've actually added/removed data from them instead of just modifying what's there).

gusty comet
#

Yea, to change a property of a buffered data component, do I need to do anything inside a burst lambda other than what I do in that snippet

#

ohhhhh I see, that makes sense

#

because the memory allocation doesn't get modified the cores can do it without buffering

tardy spoke
#

Yeah, and I think it has internal logic to handle the threading even though you can read/write (ref) the same component from multiple "Systems" (SystemBase) at the "same time" (I believe it figures out an order of operations between systems somehow, but I think with some kind of system flags you can modify Systems execute before/after). It somehow figures out how to handle that - but I guess it can't figure out how to do that PLUS have the data simultaneously shifting in memory. My guess is that that would be some pretty complex stuff, or possibly just would break laws of physics or something, haha.

minor sluice
#

you could also do it completely synchronous outside a foreach query I assume,
you have your entityQuery, then you form the ToEntityArray and then just iterate over those results and do the entityManager. removecomponent stuff

#

I thought it would be synchronous when you call Run

tardy spoke
#

@minor sluice yeah my code example is running synchronously, but does the ECB allow you to run parallel operations you otherwise couldn't? I thought that was the point of it, even though it does force a "sync" point, so maybe not. I can't remember. My focus is so much more on just getting code to run at all than whether it runs parallel or synchronously at this point, hahah.

minor sluice
#

the ecb can be used in jobs to schedule structural changes to apply after the job I think, but I already read that doing them directly on the entityManager in a synchronous way is faster, not sure about sync points - I thought the changes were all applied after the job is done

if you don't have a job context, you could just use the entityManager itself

tardy spoke
#

@minor sluice I kind of figured out what's going on here.

The array is empty on the first go around of OnUpdate(), causing all sorts of weird problems.

tardy spoke
#

@minor sluice https://www.loom.com/share/ca79cd3a903f4862a86cac44070a444e made a quick vid of another test - it seems like the command buffer and shared components are probably just not friends or something. It DOES remove the rendermeshes before it has all the weird memory leak errors though, which is weird. Maybe the leaks are from other shared components that were relying on that data or something odd.

I guess I'll have to see if I can figure a way out to do this just using the entityManager instead.

Check out a video I made via Loom

β–Ά Play video
#

Actually, it may be from the instantiation of extra ECB's and NativeArrays for when it loops around that first part twice. I think that would make sense... I gotta figure out how to delay this System from executing properly, haha

alpine shore
#

hey guys, sorry to bother. does anyone know when the ECS is going to me implemented to the newest version of Unity 2020.1 approx?

#

And is it going to make a huge difference if I start my project on let's say 2019.4 (I believe that is the last that supports ECS)

tardy spoke
#

What do you mean by "going to be implemented", exactly?

spark glade
#

@alpine shore IIrc entities 0.11(?) is the last one supposed to work with 2019.x. All versions later than that are 2020.1(?) only.

alpine shore
#

well currently you cannot download Entities from the package manager on 2020.1 @tardy spoke

tardy spoke
#

Ah, yeah

alpine shore
#

or maybe i have gone blind

tardy spoke
#

Throw it in the manifest.json

spark glade
#

There are publicly released games that use Dots (most of them <= 0.11 still I'm extrapolating), but to my knowledge there aren't too many, given that some functionality just isn't supported yet. So depending on what you're planning to do, YMMV.

tardy spoke
#

@alpine shore I'll show ya. Im not sure why Unity did this, though, haha.

alpine shore
#

the manifest.json is by changing the framework to .Net4 and then opening the file right?

#

i did this but got some weird shit

alpine shore
#

yeah i know where it is, but i got that long list

tardy spoke
#

I think if you just add the hybrid renderer, it's dependencies are all the other stuff.

#

Yeah, you just have to paste a package in manually

#

"com.unity.rendering.hybrid": "0.5.2-preview.4",

If you paste that in I think you'll see all of them appear in the package manager (and it'll install them once it detects that change). Just update them to the most recent versions.

#

I wouldn't recommend this for an existing project though, it may break it

#

But if it's a brand new project this should work no problem.

alpine shore
#

brand new

tardy spoke
#

Yeah, give it a shot, should be fine

alpine shore
#

dumb question, paste it where? πŸ˜„

tardy spoke
#

anywhere in the package manager, it's insensitive to positioning

alpine shore
#

ok

quasi trellis
tardy spoke
#

oh and make sure you have "view preview packages" enabled, etc

alpine shore
#

i already do

tardy spoke
#

perfect, should be good to go!

alpine shore
#

@quasi trellis thnx

tardy spoke
deft stump
#

where are you storing the reference?
in an ICD?

tardy spoke
#

Not sure what you mean? The reference for which?

livid anvil
#

This might be a super noob question, but can you put stops in and follow the code line by line to see what values are as they execute?

tardy spoke
#

I'm actually not sure how that's done with Unity, haha. There's probably a way though?

livid anvil
#

Im gonna be honest, i've literally just started using unity..but when I have issues, you can click to the left side of the code and it inputs red dots and lines across the code which i assume are called 'stops' and once that line of code executes, it literally freezes the program at that exact point in time, and you can execute line by line by pressing F11

#

im not sure if ur using visual studio, but you can actually click a button @ the top that says attach to unity

tardy spoke
#

Hmm, interesting. I'm in visual studio code, but I still can add those red breakpoints!

livid anvil
#

while attached, i can run my program, and as soon as my code executes, it will stop it @ the stops and i can skip through line by line and watch in real time at my own pace what is happening, what values are being passed, etc

#

I honestly don't know what's happening with your program, i can only assume that 'index out of range' means you're trying to access part of an array that doesn't exist, maybe because of your RemoveComponent shifts the other component that you're trying to remove on the 2nd pass, and now youre accessing a null position? not sure, again, im a noob lol

tardy spoke
#

There seems to be an extension for VS Code so I installed it, hopefully the functionality is similar haha

livid anvil
#

yeah

#

im not sure how VS Code works, as I'm using VS Community..I only know this πŸ˜…

tardy spoke
#

It's pretty cool! I'm not sure if it works with ECS though?

#

Yeah, NativeArray is a datatype in ECS, that's some of Unity's script for handling it. It's a good indicator that I'm using and disposing of it wrong though, somehow. πŸ€·β€β™‚οΈ

livid anvil
#

its been a very helpful feature lol. Sometimes when I get errors its just syntax things that I messed up, but iterating through the code line by line has helped me see what is happening at that exact moment and helped me clear up some things. It would essentially run through your for loop and update [i] in real time, and you'd be able to see every value

tardy spoke
#

It's weird though, the first error just looks like a simple off by one error but I'm not seeing that.

#

Yeah, that'd be an awesome tool to have for sure.

livid anvil
#

I thought your for loop looked fine too, but i don't know anything about the removecomponent<rendermesh> stuff

tardy spoke
#

It might only work with normal MonoBehaviours though because it's not populating variables or anything for ECS stuff - or I'm using it wrong. πŸ™‚

#

It all does work fine with that line commented out - so it's something to do with how Unity handles that, or something to do with how I'm using the command buffer to replay it/disposing of it. I think. No idea. ECS is fickle.

livid anvil
#

I wouldn't know anything about it, and I hope I don't have to πŸ˜…

tardy spoke
#

Haha, it's pretty cool to get into. Challenging, but fun. Try it out sometime.

#

Well, if your idea of fun is having regular for loops not even work... then it's fun.

livid anvil
#

lol

tardy spoke
#

@deft stump not sure which reference you mean exactly. PhysicsFacade is just an ICD tag.

What the script is supposed to do is delete the RenderMeshes for any Entity tagged with PhysicsFacade that also has a Child component - which it does do - but then it freaks out with all the leaks and stuff.

I will gladly PayPal a beer to whoever can solve this. It's probably just something simple that I've missed. πŸ€”

mint iron
#

I'm not too familiar with shared component data, but from the stack trace the rendering system is trying to do a chunk iteration and get the shared component (the RenderMesh) and its not there, or the ordering/mapping is botched so it can't find it.

So I'd look at the render mesh v2 system and see what they're doing; it might be that they're caching a list or chunks or RenderMesh entities or something, since that system sort of owns that component it probably expects them to not be messed with.

If that leads nowhere, why are you removing them? can you just disable the rendering of the entity instead? You could also try using a standard buffer outside of the rendering area, like start initialization buffer, you might be able to get your changes done before/after the rendering system does whatever its doing and avoid a conflict.

tardy spoke
#

since that system sort of owns that component it probably expects them to not be messed with.

I'm thinking that might be the case. I couldn't find much info on properly removing shared components / the potential implications.

I've looked into disabling the renderers, but there actually doesn't seem to be too many simple solutions for that. Some interesting ideas to investigate like moving them to other worlds and stuff, though.

start initialization buffer

I haven't read much on that, but that sounds like a promising lead!

Thanks for the help!

craggy orbit
#

anyone else getting worse performance on Entities 0.13 than 0.11 with Physics 0.4?

#

and longer compilation time?

rigid cosmos
#

Anyone know how to change the name of entities? I see a box which I can change at runtime, but I don't see anything in the actual Entity class

spark glade
#

EntityManager.SetName

#

but it's editor only

#

so wrap it in a #if UNITY_EDITOR

alpine shore
#

ArgumentNullException: A valid BlobAssetStore must be passed to construct a BlobAssetComputationContext
Parameter name: blobAssetStore wtf

#

this has just appeared out of nowhere

rigid cosmos
#

@spark glade thanks! Much appreciated. Any way to give +rep on here?

mint iron
#

@tardy spoke yeah you can just grab a buffer from the ECB systems, useful if you want to do something next frame for example, you can use a buffer that your system is already ahead of and it won't be executed until the next cycle. Did you try adding DisableRendering component?

gusty comet
#

Why is this not removing the component from the entity* at the end of the job?

opaque ledge
#

you are not destroying the entity, you are just removing a component

gusty comet
#

sorry, that's what I meant.

#
            World.CreateSystem<GasHeatDiffusionSystem>().Update();
            Assert.IsFalse(m_Manager.HasComponent<GasHeatInhomogeneousTag>(entity));
#

This is the test. It's failing because HasComponent returns true.

opaque ledge
#

hmm, have you tried to run on main thread ? (.Run())

#

maybe it might be possible that job didnt finish yet ?

#

or entity command buffer havent been playback yet

gusty comet
#

maybe? Can I order the test to wait for job completion? Let me try run.

#

If I convert it down to a single core job it still has the component.

hollow sorrel
#

yea ecb prob hasn't run yet

rancid geode
#

If I convert it down to a single core job it still has the component.
@gusty comet for you assert to be true, you need both to complete the job (either by switching to .Run() or using myEntityManager.CompleteAllJobs()) and ensure that the commandBuffer has run (I think you can update manually the EndSimulationEntityCommandBufferSystem for that, but never tried that).

gusty comet
#
            World.CreateSystem<GasHeatDiffusionSystem>().Update();
            m_Manager.CompleteAllJobs();

            Assert.IsFalse(m_Manager.HasComponent<GasHeatInhomogeneousTag>(entity));

πŸ‘ thanks

hollow sorrel
#

does that really work?

#

weird

gusty comet
#

no I was wrong :---DD

#

he says I also need to ensure the command buffer has run but I don't see any methods for it

hollow sorrel
#

if you really want to remove it right as soon as your gasheatdiffusionsystem updates then just don't use the ecb

#

remove it on main thread with structural changes

#

you'll get a sync point but that's unavoidable if you truly want the result right away

gusty comet
#

I only want the result right away for testing.

hollow sorrel
#

then make your test run after the ecb updates

gusty comet
#

How?

hollow sorrel
#

for example a testing system that is scheduled after the ecb

#

if you don't want that then i guess maybe you could update the ecb manually since it's just a system, but then you'd get two sync points so would only do it if it's temp code

tardy spoke
#

@tardy spoke yeah you can just grab a buffer from the ECB systems, useful if you want to do something next frame for example, you can use a buffer that your system is already ahead of and it won't be executed until the next cycle. Did you try adding DisableRendering component?
@mint iron oh, weird, I googled about something like that for like 30 minutes yesterday but all the forum posts were like "that's not a thing". Apparently that's been a thing since hybrid.renderer 0.3.6.

#

Lol, yep, it works perfect now! Thanks! DM your PayPal link and I'll send you $5 for a beer.

ECS is easy when you know how... πŸ€·β€β™‚οΈ

@minor sluice ^ that ended up being the solution. Can't remove RenderMeshes without hybrid render freaking out about - at least, not the way I did it.

#

Someone should make a website of commonly used ECB code and stuff for "everyday" things.

IE throw up the script I just wrote for "Create a query and disable rendering".

#

A repository like that would be so useful until there's more tutorial content, etc.

minor sluice
#

haha, I don't usually expect anything like that, but thanks ^^
I'll send it, but you don't have to send me anything, am just here because I have some questions myself too to this community ocassionally

tardy spoke
#

Haha, everyone working with ECS needs to drink imo.

minor sluice
#

oh, sorry, nevermind what I wrote

#

I was just reading this wasn't aimed at me

#

I'll appreciate all the help from this server/channel too though πŸ™‚

#

never worked with hybrid renderer, so I had no clue about that

rancid geode
#

How?
@gusty comet I believe that:

World.CreateSystem<GasHeatDiffusionSystem>();
World.Update();
Assert.IsFalse(m_Manager.HasComponent<GasHeatInhomogeneousTag>(entity));

Should work (or something similar)

gusty comet
#

no dice, no.

rancid geode
#

I have some working ECS test samples somewhere, I can dig into this later if you are still in trouble until then

gusty comet
#

it really does not help that I cannot Debug.WriteLine() in a job.

deft stump
#

argh... I can't build my dots game on android... I dunno what's missing

tardy spoke
#

Judging by most movies I've seen, the missing ingredient is pretty much always love.

#

Can't find it in the package manager though. Unity must of hid it on 2020.1.

tardy spoke
#

If I'm not mistaken, wasn't there some news about DOTS Physics/ECS and a fixed time step system or something that just came out?

pliant pike
#

I think its like a systemgroup or something

#

physics stuff is calculated in that group and then its fixed time step

tardy spoke
#

Interesting

#

In the Unity manual somewhere they said not to program logic in those systemgroups and to literally use them just for grouping or something, haha. I'm not even sure what they are, but I remember reading that.

pliant pike
#

yeah I haven't got around to messing with that stuff yet

#

I'm hoping it's a lot simpler by the time I do

tardy spoke
#

Hahah yeah, I feel ya

#

Can't find what I saw yesterday where it said not to cram logic into them, but maybe that was for a different grouping system or something. No idea.

north bay
#

It's only about the OnUpdate of the ComponentSystemGroups, i think you mean this: Avoid putting custom logic in ComponentSystemGroup.OnUpdate(). Since ComponentSystemGroup is functionally a component system itself, it may be tempting to add custom processing to its OnUpdate() method, to perform some work, spawn some jobs, etc. We advise against this in general, as it’s not immediately clear from the outside whether the custom logic is executed before or after the group’s members are updated. It’s preferable to keep system groups limited to a grouping mechanism, and to implement the desired logic in a separate component system, explicitly ordered relative to the group.

tardy spoke
#

Right, that's what I read the other day

#

Thanks for clarifying that, haha

tardy spoke
zinc plinth
#

using collaborate over git Wat

deft stump
#

madlad

craggy orbit
#

physics seems to be less performant than it used to be. am i doing something wrong with these settings, or are there more settings im missing? or is it something i've probably done? even just 500 entities causes the game to slow down when it didn't used to. i see a lot of waiting on ParallelCreateContactsJob and ParallelBuildJacobiansJob

hollow sorrel
#

those authoring components seem fine but not much unusual that can go in there anyway

#

what does slow down mean

#

we talking 2ms or 20ms?

#

also did you check with safety checks off / leak detection off / jobsdebugger off

craggy orbit
#

7.5ms to complete the jobs. 12.78ms for the frame, so under 60 fps. ill try with those things off

#

it's fine at first but it builds up over time as i instantiate more entities. still having issues with those things off

hollow sorrel
#

yea that sounds like something weird going on

gusty comet
#

I am still struggling to get unit tests to work and I don't know how i'm going to progress without them

#

like it's physics based code, I need to check and make sure my math works

#

I can't just gauge it by eye

hollow sorrel
#

oh you are unit testing, didn't know the context when answering earlier

#

is ecb still the issue

gusty comet
#

Now I'd like to use FixedStepSimulationSystemGroup because it's physics, but I can't find any documentation on it

#

like any example system

tacit idol
#

dm me if u wanna make a game with me

hollow sorrel
#

yea that group is pretty new, haven't updated yet so haven't looked into it

#

regarding unit testing though, instead of testing systems seperately like with the system.update stuff you posted earlier, i think you'd be happier if you did world testing

#

as in a world with all the systems, put in the components you wanna test, run world update, check if output components are what you want

#

it's not "real" unit testing but saves some headache like with the ecb thing

gusty comet
#

Is there an example of this

hollow sorrel
gusty comet
#

man i'm sick of seeing that guy's anime avatar lol, sargon is everywhere when I google ECS stuff

hollow sorrel
#

lmao

tardy spoke
#

The error is pretty descriptive. In fact, it may even be telling me what to do! I'm just not sure what it means or how to add that tag - or if I need to add my own buffer because those two DynamicBuffer<Child> are somehow referencing eachother or something.

north bay
#

You can grab the buffer by using EntityManager.GetBuffer<Child>

tardy spoke
#

I also wonder if it might be related to burst compiling.

This is in a SystemBase by the way.

#

Ah, so I've just structured it wrong somehow. I'll check out the manual on that. Thanks @north bay .

untold night
#

DynamicBuffer is special, the actual component is Child
The DynamicBuffer<T> is just a container

tardy spoke
#

Yeah, @untold night I iterate through it below and grab the child components and add them to an array

untold night
#

And you'll need to use GetBuffer<Child> on entity manager, not GetComponentObject, that's for managed components

tardy spoke
#

Well, I don't because it errors out. But that's the idea, haha

#

Right! I was wondering about that

#

I noticed GetComponentData errored out, and GetComponentObject didn't, so I just figured that was the right one because I forgot/didn't know GetComponentBuffer existed, haha.

untold night
#

It's actually GetBuffer, I got it mixed up

tardy spoke
#

No worries, I found it.

#

Simply changing it to GetBuffer<Child> seems to have resolved that error... onto the next errors. 😎

Appreciate the help!

opaque ledge
#

Errors... errors never end

wise monolith
#

Is there some way to have some type of native array or list inside another one, or just to have a muti-dimensional array? I tried NativeMultiHashMaps but they have some "quirks" like like returning the same key twice that I would have to code around. I also tried creating an object that had just an int and a nativeList but when I put that in a nativeList unity complained that the NativeList is not bittable.

tardy spoke
#

Hmm, isn't there matrix arrays like how local to world works?

#

If you look at local to world I believe it's a 4x4 array

spark glade
tardy spoke
#

I finally got it working. Wow i've spent like a week just trying to get this functionality to work. Which is sad because I know I'm going to replace it later with a better solution down the road... but still... huzzah!

I actually am considering throwing up a wiki for ECS script examples or something. I think that would be super useful as a repository.

#

Also, I can't seem to figure out when to use a NativeList vs DynamicBuffer? They seem to function similarly?

amber flicker
#

DynamicBuffer is for when you want a list/array associated with an Entity - all other times use NativeArray/NativeList I guess

wise monolith
#

If I understand correctly a matrix is just 16 values so an array of matrices would just be an an array of objects with 16 vars each, correct?

#

Or are you saying a matrix of arrays that is a matrix that its vars are arrays?

tardy spoke
#

@amber flicker interesting. If you can use DynamicBuffers in place of ArrayLists or whatever they're kinda nice because they don't seem to need the manual memory de-allocation

amber flicker
#

hmm.. I think most people probably like the manual memory allocation / life cycle management πŸ™‚ - so.. e.g. NativeList allocates a contiguous block of memory... if you add to it and it exceeds capacity it will double but basically if you then iterated it, it would be very efficient from a cache perspective. Whereas, dynamicbuffer / per entity means you usually only want a small number of elements as you want to keep many entities in a chunk where possible - so iterating 1000 entities with a dynamicbuffer[1] would be many times slower than iterating a nativelist[1000]... that make any sense? wrote it out quickly.

tardy spoke
#

Yeah, like an O(1) vs O something haha.

amber flicker
#

hmm not exactly πŸ˜…

tardy spoke
#

... Shit... agree to disagree I guess. πŸ€·β€β™‚οΈ

#

Hahaha

#

Hmm, yeah I think I get what you mean. One is making a new block of it's own memory where it lives contiguously, the other is referencing entities that are living in various chunks ?

wise monolith
#

Yah so a matrix is just a fancy name for a float[4,4] with some handy functions for transforming objects.

tardy spoke
#

well, not "referencing" likely

#

is a dynamicbuffer a cache that points to the entity data in the various chunks?

amber flicker
#

@tardy spoke yea pretty much - when you iterate a chunk, all entities are contiguous in memory so v efficient cache-wise... so it is still very fast.. if the dynamicbuffer length 1 was the only component associated with the entity, it may actually approach the same speed as the nativelist - but in reality entities have more components and so you end up with less in the chunk.

#

as far as I understand it (so take with a large amount of salt), the dynamicbuffer handles pointing to the elements within the initial capacity of the buffer (which reside in entity alloc memory) and then point into managed memory for the remaining elements - allowing you to seamlessly iterate

tardy spoke
#

Hmm.

Alright so, NativeList data is one big chunk since it's generally not entity related, because if you use a DynamicBuffer which IS related to entities, the entities it contains typically need to reference other components that exist in other chunks outside of it?

amber flicker
#

hmm the first bit yes.. i may be doing a poor job of explaining here. Dynamicbuffers could just contain floats or whatever data.

tardy spoke
#

Haha it's all good, I can do some research and figure out the rest now that you've laid the foundation!

amber flicker
#

small aside: Unlike monobehaviours I'm quite careful about saying an IComponentData or buffer is associated with an entity - rather than 'on an entity' as in a sense an entity is just an index into an array of components. Not sure if that's helpful.

tardy spoke
#

Yeah, you get a glimpse of that when you debug.log an entity and it's just like 8:1 with no other data, haha.

amber flicker
#

yea - it's a bit confusing that it doesn't map conceptually from the components and gameobjects we're used to yet has some similar terminology and e.g. the conversion workflow

tardy spoke
#

And how you can't access any component through any methods or anything. That's when your brain starts switching to being like "oh yeah...it's all just blittable data"

#

Haha yeah it's an unnatural abstraction for sure. I'm sure it's really difficult for people that have done OOP for a long time.

#

Well, yeah the conversion workflow is a bit odd. Especially because components is a term in both worlds.

#

And scenes are not in ECS but subscenes are... haha

amber flicker
#

yea... I'm still trying to work out the cleanest way to have an example code & scene in my asset without the code accidentally running in someone's game πŸ˜…

tardy spoke
#

Haha, yeah I'm finding with ECS sometimes the things you take for granted are the hardest to figure out. You don't even think about them because they weren't a problem in OO structures, haha.

#

I literally did spend like a week figuring out that "select a parent entity and disable rendering on all children" problem. I'm not a very strong programmer, but if someone asked me how long I thought that would take I would've been like "... I dunno, an hour?"

safe lintel
#

well i think some of it is difficult because of changes to the api and theres almost zero documentation for anything beyond the basics

tardy spoke
#

Yeah, totally. That definitely compounds the difficult greatly.

safe lintel
#

the rendering docs seem to have more info about hybrid stuff than the main entities docs

#

its not a lot but still πŸ˜„

tardy spoke
#

There's documentation for either moving a zillion cubes, or extremely difficult crazy math experimental simulations, but not for practical things you'll need to do for EVERY game like the patterns around selecting one entity and pulling in info from others.

#

Like every game has a singular player/person playing it, so that seems like a massive oversight to me.

#

I don't think "10 million cubes in VR" is going to be a hit seller on the Steam store

safe lintel
#

imo as someone who hasnt been programming too long ecs was kinda easy to understand? like i didnt have a tough time reconciling it with oop(some of the api like chunk iteration took a while to unpack mentally)

tardy spoke
#

Gonna need some more practical shit.

safe lintel
#

but whenever i see ioc or mvcs stuff mentioned with unity my brain glazes over

tardy spoke
#

lol, it could be Dunning-Kruger effect. Maybe you don't know enough to know what you don't know? πŸ˜‰

safe lintel
#

possibly πŸ˜„

tardy spoke
#

I do agree though, I find it easier to learn ECS than OOP, but I've never even worked in OOP previous to like a month ago.

The thing that makes ECS easier is at least it's structure is "opinionated". But more so than OOP. OOP is like building things out of lego blocks and you could end up with anything - good or bad. ECS is like... there's really only one way to do things, haha.

#

Like if all of us worked on an ECS project together, we would all know exactly how to structure it.

If we all worked on an OOP project together, we would spend a month talking about how to format it.

#

That's obviously a bit of hyperbole, there are some features in ECS and stuff and runtime orders, etc, that could make projects unique in their structure, but still, less than an OO project I feel.

vagrant surge
#

the thing with ECS is that it really is a disguised data-oriented-design thing

#

in OOP, you code around the objects, creating abstractions

#

in data-oriented-design, you look at what you want to do, what kind of data you have, and the transformations needed, and you do exactly that

#

for me learning that stuff made me a better coder lol. on oop you distract yourself far too much on creating object hierarchies and object graphs, while on data-oriented you slap an array of your data and pass it trhough an algorithm, and not really care about abstraction because you dont need it

tardy spoke
#

Agree

#

If you want a weird one, try Prolog.

vagrant surge
#

ive used it

#

its basically useless outside of toys

#

maybe as a data-query language, or to keep track of relations and query those dynamically

#

but its not a general programming lang at all

tardy spoke
#

Yeah, it's fairly "dead", but the concept is pretty interesting.

mint iron
#

sadly as far as documentation goes, I've resigned to just reading the source code, its probably easier than trying to find information about it in the form of documentation, tutorials, sample code or searching the forums. Although so far ive refrained from the animation package, because that scares me.

tardy spoke
#

Hmm looks like it has to be done like this ``` Job.WithCode(() =>
{
for (int i = 0; i < randomNumbers.Length; i++)
{
randomNumbers[i] = randomGen.NextFloat();
}
}).Schedule();

humble mason
#

I create an archetype during the first frame of the game, like this:

{
    protected override void OnStartRunning()
    {
        EntityArchetype machineArchetype = World.DefaultGameObjectInjectionWorld.EntityManager.CreateArchetype(
            typeof(Translation),
            typeof(Rotation),
            typeof(RenderMesh),
            typeof(RenderBounds),
            typeof(LocalToWorld)
        );
    }```
**How can I use that archetype to create entities later on from other systems?**
`Entity machine = entityManager.CreateEntity(machineArchetype);` this, rightfully, throws an error that `machineArchetype` doesnt exist because it won't be created until runtime
tardy spoke
#

I also have a question about system timing... ECS is straight up lying about this entity having children. :O

I don't think a query with RequireForUpdate will cut it because I'm instantiating the Entity that says it's missing it's children in the System.

I guess I probably break it out into two systems, a system that instantiates the copied Entity and then a separate system that executes on them?

Then I somehow specify the order to run them in? Not sure how to do that, but I think I saw some stuff in the manual. If I'm not mistaken you can tag systems to run before/after other systems? Is that a workaround or a best practice?

zinc plinth
#

@tardy spoke thats because your log is before any ParentSystem could fix it and apply Child

#

you can create ParentSystems yourself by just extending the class and using UpdateBefore/After/InGroup

tardy spoke
#

@zinc plinth yeah thats what I figured! Thanks for the tip. I'll take a look into these "parent systems!" πŸ˜„

tardy spoke
#

Hmm, yeah I split the two up using the simple before/after execution mechanism, but the problem persists.

How this stuff executes is a huge gap in my knowledge but there doesn't seem to be too much info out there on it. Not really any examples.

I take it instantiating that entity copy is going to take a while and it starts running the second part too soon.

I do have it waiting on a query for the PhysicsFacade entity to exist, which I believe it needs or it just claims it can't get the singleton because that entity doesn't exist yet, haha.

Not sure where to go with this. Will continue researching.

tardy spoke
#

This hack actually makes it all work, but only because it's delaying it's initialization slightly I'm sure.

    {
        delayTillReadyQuery = GetEntityQuery(ComponentType.ReadWrite<Child>());
        RequireForUpdate(delayTillReadyQuery);
    }```
novel pike
#

I'm getting a full editor crash with Unity 2020.1.0f1 and Unity NetCode 0.2.0-preview.5 when I add a child entity to a ghost prefab.. anyone else had this?

deft stump
#

is there a built-in solution for converting children to Entities and the parent GO to be destroyed if children == 0?

dull copper
#
## [Unity Physics 0.4.1-preview] - 2020-07-28

### Changes

* Run-Time API
    * Added the following members:
        * `FloatRange.Mid`
        * `AABB.ClosestPoint`
    * Changed the following members/types:
        * All systems now inherit `SystemBase` instead of `ComponentSystem`.

### Fixes

* When using Unity 2020.1.0b13 or newer, it is now possible to convert mesh colliders inside of sub-scenes when their input meshes do not have read/write enabled. Meshes converted at run-time must still have read/write enabled.
* Stopped emitting warning messages about physics material properties being upgraded when creating new objects from editor scripts.
* Fixed warnings from exceptions thrown in Bursted code paths when using Burst 1.4.0.
* Fixed issue with static layer not being rebuilt when order of entities in chunk changes.
* Fixed issue with invalid colliders with empty AABB breaking bounding volume hierarchy and making objects "disappear" from the world.
* Fixed an editor crash when maximum level of composite collider nesting is breached.
#

apparently there's also new DOTS Editor but changelog states it's from 24th? (0.9.0)

#

changelist is just package updates but why bump from 0.8.2 to 0.9.0 for that alone

#

also re: physics package.... finally this:
When using Unity 2020.1.0b13 or newer, it is now possible to convert mesh colliders inside of sub-scenes when their input meshes do not have read/write enabled. Meshes converted at run-time must still have read/write enabled.

#

this has bugged me a lot every time I've used this package

gusty comet
gusty comet
#

Burst error BC1033: Loading a managed string literal is not supported

#

how and why is this a thing, i just want to debug.writeline

dull copper
#

@gusty comet could be related (from Burst changelog):

#Known Issues

* Output of Debug.Log is temporarily disabled in Burst Function Pointers/Jobs to avoid a deadlock on a domain reload. A fix for the Unity editor is being developed```
gusty comet
#

ya that must be it. I was just really hoping that this stuff was more polished. I'm going to try going ahead with just building a scene and not worrying about very specific math, or finding a way to do this without invoking systems at all

dull copper
#

being able to use Debug.x from bursted stuff is relatively new thing too, not everything is supported

gusty comet
#

makes me wonder if there's a way to take ForEach code and move it into a static class or something but that sounds like it'd not work

#

so that that way I can unit test the logic and invoke it programatically via systems in live environments

dull copper
#

burst debugging in general is one reason Unity gave for Burst crossplatform determinism getting pushed further

gusty comet
#

or maybe I'd have more luck with IJob stuff?

dull copper
#

they said they have more pressing issues like that debugging to fix

gusty comet
#

the unit testing, debug logging, and fixed rate update jobs are like

#

a must, an absolute must

#

the whole reason I want to adopt ECS is to make my physics simulations fast

#

and that requires all three of those things to do right

dull copper
#

especially that last part is something Unity has been postponing as they need it to work across different systems

#

there's fixedrateutils now but it still feels very early

gusty comet
#

there's zero documentation for it, it came out last week and the manual page for it is just the autogenerated API page

dull copper
#

as for unit testing, pretty sure Unity has a ton of test coverage of all dots packages themselves

#

you could check how they did their tests on entities etc package

#

yeah, many packages are just autogenerated docs crap

#

I absolutely hate the person who ever invented that

#

it basically forced devs write documentation and now majority of docs just state the obvious we already knew just by looking at the function/method

#

Unity docs used to be really nice, with plenty of examples

#

and now I specifically mean scripting API docs

#

if you look same for about any package out there, they are useless

hollow sorrel
#

fixed rate update jobs not sure what fixed rate has to do with jobs or burst
you could always run your systems at a fixed rate even a year ago, then recently they added fixedrateutils a couple months ago but it just does what you could do yourself in couple lines of code, and now there's the new fixedupdategroup but not sure how that works since i don't use it

dull copper
#

it has everything to do with dots if you use physics and don't have target device with fixed refresh rate

#

it simply has to be built-in for all different packages play ball together

#

otherwise every user reinvents the wheel and fights same fights

#

like, we can make all kinds of things ourselves but that's not really why we pick game engines like Unity

hollow sorrel
#

you'd just put the physics systems in a seperate group that you tick at a fixed rate, i assume that's what the new fixedupdategroup is doing anyway

dull copper
#

the idea is that you build actual games and game specific tech, not general purpose systems that really should be there already

hollow sorrel
#

yea i agree it should be built in, framerate dependent physics was a weird choice to ship in the first place, but the workaround is simple

dull copper
#

well, it wasn't really designed to be framerate dependent, hence the issues πŸ˜„

#

if they actually did it like unreal does (every main update is physics update), it would have worked for majority of users at this stage

#

but of course fixed timestepped physics are always more predictable

#

the issue was that the physics team did expect Unity (DOTS) Physics to run at fixed update, it probably did that during their development but then Unity changed simulation group to run on update right before physics package released

#

and they took like one full year to even come up with built-in solution (which isn't even today enabled by default)

#

there's been x amount of user made workarounds, some which take few lines and some take more

#

but time stepping is just one small part of the puzzle, you have to have your entities interpolated for smooth visuals too

#

which itself isn't super complicated thing but it would require nice structure and should be thing that Unity would provide us out of the box as well

#

I'm suspecting that coupling this all with dots netcode is the major reason why it's taking so long

#

that + it not being any kind of priority to Unity yet since this all is experimental

hollow sorrel
#

tru

gusty comet
#

Why doesn't my Unity.Rendering / Unity.Transforms have a Translation/Rotation data type?

#

missing assembly reference.

opaque ledge
#

πŸ€”

#

they should live inside Unity.Transforms, you sure you dont have custom Translation/Rotation struct ?

gusty comet
#

very

#

I had to add Unity.Transforms to my assembly and I still can't find RenderMesh

#

There's no Unity.Rendering DLL

#

ecs is really quite miserable, after 3 days I have absolutely nothing to show for it lol

hollow sorrel
#

rendermesh should be in unity.rendering.hybrid

gusty comet
#

There's no Unity.Rendering.Hybrid package

#

tried downgrading to entities 0.11 but no dice.

dull copper
#

you have to install hybrid renderer package

#

like, it's a literally separate package in package manager etc (altho it's now hidden by default)

gusty comet
#

can you copy it from your manifest json

#

Copying assembly from 'Temp/Unity.Rendering.Hybrid.dll' to 'Library/ScriptAssemblies/Unity.Rendering.Hybrid.dll' failed

#

ffffffffffffffff

#

ladies and gentlemen we have it, we have rendermesh

#

I had to disable all my unittesting to get it, I guess there were namespace conflicts

opaque ledge
#

a truly magnificent moment for humanity

tardy spoke
#

Can one ever truly HAVE RenderMesh? πŸ€”

mint iron
#

if a RenderMesh displays in the woods, does it still have vertices?

tardy spoke
#

is there a built-in solution for converting children to Entities and the parent GO to be destroyed if children == 0?
@deft stump I don't think so? But you could tag and have a System just delete 'em, no?

HasComponent returns a bool which would be an easy way to tag them I think. Or just make them linkedEntities and delete anything that doesn't have the linkedEntities component?

#

@mint iron thoughts like that keep me up at night.

And also how last night I was watching some Unite Copenhagen 2019 videos and they said they expected all Entities packages to be production ready for Unity 2020.1... how could so many smart people be so wrong? πŸ€”

deft stump
#

they're still technically right

tardy spoke
#

Yeah i'll just pop into my DOTS audio and animation

#

and network code

#

πŸ˜‰

#

I can't remember if they just said Entities or DOTS. If it was just Entities they're ... kinda right, haha.

deft stump
#

I mean about the release being in 2020.1

tardy spoke
#

They plan to have it documented by 2042.3

tight blade
#

does anyone know what the w term in a quaternion indicates? or know of a good source for me to look that kind of thing up?

#

I'm still engaged in this rather difficult task of attempting to translate the Euler velocity of one space into the Euler velocity of another space

tardy spoke
tight blade
#

Im basically trying to neutralize the roll of a ball along a particular dimension, but because the ball is rolling, I can't just say "physicsVelocity.Angular.z = 0" because the balls orientation is now such that it has angular velocity on its local Y axis which causes it to roll along the world's Z axis

tardy spoke
#

... no it's not?

#

lol

tight blade
#

okay, well if youve watched it and think its a good source, I'll fix whatever the issue Im having with watching it is.

tardy spoke
#

That's super weird, it's a little quiet on mine, but on headphones the dialog is clear?

tight blade
#

maybe the channel its using isnt working on my audio device

#

oh yeah. crystal clear on headphones. real washed out on speakers. must be the balance

#

nice, yeah wow these explorable videos are rad

tardy spoke
gusty comet
#

When dealing with ECS, are all transforms handled relative to the scene's 0,0,0 or is there relative positioning still?

tardy spoke
#

I think the translation and rotation components are local, no?

#

This code in my project rotates the entity locally wherever it is in the world so πŸ€·β€β™‚οΈ

#

I'm pretty sure how it works is you get LTW if you have no other positioning components. You can edit LTW directly if it's the only one.

But then it's translation (local) --> LTW <-- Rotation (local) (and probably a bunch of other systems like physics, etc)

So you always have the ability to use global positioning/rotation by reading that LTW data (you can't write to it if you have translation or rotation component, it becomes read only in that case), but I think those translation and rotation ones are local

gusty comet
#

ah okay

tardy spoke
#

Might want to do a test with translation though just to be sure

gusty comet
#

Is there documentation for what each float4 represent

#

It's not immediately obvious looking at the debugger

tardy spoke
#

a quaternion I would assume if it's a rotation? Or do you mean the LTW matrix ones?

gusty comet
#

LTW float4x4

tardy spoke
#

Ah, yeah I know nothing about how that shit works.

Generally it seems that you just never touch that and only touch the components around it, which then affect it.

rancid geode
#

Is there documentation for what each float4 represent
@gusty comet you will.want to take a look into transformation matrices

hollow sorrel
#

so apparently IJobEntityBatch got sneakily added in at some point without any mention

mint iron
#

nice, it will be great when we can do this automagically in a ForEach

hollow sorrel
#

i'm not sure of when you'd actually use it tho
seems the use case is that you can run a function on smaller than a chunk, but bigger than per-entity
but when would you want that

mint iron
#

the whole batch naming is a bit suspect through, IJobChunk always was processing an entire chunk of entities, nothing is really changing there.

hollow sorrel
#

yea IJobChunk seems to already fill its purpose

#

weird to have an inbetween

mint iron
#

internally they introduced the concept of batches for copying blocks of entities within a chunk, which makes perfect sense for that.

#

so like, if you wanted to split a chunk and take out 20 consecutive entities and do somethign with them (add component or wahtever) all at the same time.

hollow sorrel
#

oo that does make sense

mint iron
#

oh i think i get it now, batchIndex - The index of the current batch within the list of all batches in all chunks found by the job's EntityQuery. If the batch count is one, this list contains one entry for each selected chunk; if the batch count is two, the list contains two entries per chunk; and so on.

#

so there can be chunks that have 1-n sub-groups of entities, its like a virtual chunk

tardy spoke
#

chunks on chunks on chunks

#

Can you run monobehaviours on GO's inside a subscene? Is that... alright? Hahah

#

Like ConvertGameObjectToEntity class kinda stuff

gusty comet
tardy spoke
#

It's beautiful.

gusty comet
#

i've worked very hard to get my cube maker working, better be beautiful

tardy spoke
#

Time to throw it on the Steam store and start raking in the cash I guess?

alpine shore
#

Noobie question: Is it a good idea to use MonoBehaviours and ECS in one game? Or should one concentrate only on one of both?

tardy spoke
#

Best to do what you can in ECS land, but you'll likely end up using some monobehaviours for hybrid things you can't do in ECS things.

According to Unity it's fine to use both, but for complicated systems I think the interaction between the two different paradigms could get a bit confusing.

alpine shore
#

okay, thanks @tardy spoke

tight blade
#

thats good advice for newbie developers who want to start working in ECS. FWIW, @tardy spoke I'm pretty sure the official advice from unity since they pulled back on getting ECS into 2020 is that you should use GO/Mono for everything and use ECS for the few performance critical systems that require it

#

but of course thats kind silly, because if you're going that route, you might aswell just use GO/Mono and then use jobs for performance bottlenecks. Drimm I know its all confusing. as a newb, your only real choice is to go head first into ECS, because by the time you understand GO/Mono fully it will be deprecated

#

(that last part isn't official advice, thats me editorializing the situation I feel we are in)

alpine shore
#

Well I have a long term project of an MMO and I believe that ECS is going to be way better for the performance. BUT, since I have just started out (literally had to learn what classes and variables mean), I wanted to make a plan for myself. I have planned to work on different projects along the way and test both systems out, and at the same time learn them.

tardy spoke
#

The added complexity is

  1. Adding reference objects from outside world into ECS

  2. Conversion of GO's to ECS

  3. Addition of Unity's standard player loop affecting ECS through script execution times

alpine shore
#

Okay, that makes sense

tardy spoke
#

In my opinion

safe lintel
#

its not confusing it just feels gross to still use monobehaviours and other non dots stuff πŸ˜„

alpine shore
#

I honestly understand dots

#

not to sound smug or anything but the basic concept

tardy spoke
#

Lol, i'm in the same boat. It's confusing af. These guys have been programming for more than 3 months. πŸ™‚

tight blade
#

hahaha, yeah. I hear you.

tardy spoke
#

It would be easier if you were really familiar with the monobehaviours and OOP, but for me I haven't done much OOP nor am I big fan of it, so that whole additional layer is a bit of a bitch.

alpine shore
#

Everything is an entity, and you can attach certain stuff to this data, but the data itself doesn't store them in any way

#

If I am not mistaken

#

And when you want to recall something, it just recalls 1 thing

#

and not the whole object, like with Mono

#

because Mono contains more stuff in it

#

If I am wrong, please correct me, so I don't learn it wrong

tardy spoke
#

It's hard to learn it wrong because your code won't work. πŸ™‚

tight blade
#

yeah, thats a really important point, alex. code just not compiling doesnt tell you much about how to get better

#

I so sorely wish visual scripting hadn't abandoned the "DOTS first interface" approach. Both for folks like you who havent been programming long and folks like me who have, visual scripting would have been the perfect way to roll out the concept as it was being developed.

alpine shore
#

What I meant is how I view the system, in other words get a better understanding, which will help with the code. The biggest problem I have is that the information that is available is very scarce atm/or the sources that provide it are a bit foreign to me at this point (gitlab and some of the forum threads)

tardy spoke
#

@tight blade they showed in the visual scripting for DOTS that you could see the code it generated but it didnt' seem to be there in later versions when i tried it which... sucks, would've been an excellent learning tool.

alpine shore
#

But isn't visual scripting extremely bad on the performance side? Especially when you are doing bigger projects or multiplayer games

tardy spoke
#

Also I agree, I think mixing DOTS interface with hybrid old interface is... meh

tight blade
#

yeah, its a long story. they abandoned the notion of "visual coding with DOTS" after drop 6

tardy spoke
#

Ahh damn

tight blade
#

and thats also when they dropped codegen

tardy spoke
#

It seems a really, really suitable structure for a visual interface due to it's layout. Just like shadergraph, etc, data based design.

Like it must be a hell of a lot easier than visual scripting for OOP

tight blade
#

yeah. it was a really big let down.

tardy spoke
#

Yeah, too bad.

alpine shore
#

Program it yourselves? πŸ˜„

#

jk

tight blade
#

lol, yeah, I hear that.

alpine shore
#

how many people work on a project like BOLT?

tardy spoke
#

I do notice a pattern of people come in here all stoked on DOTS, then it grinds them down and rebuilds them. It really tests your mettle, that's for sure.

It's not just understanding the concept, it's dealing with the lack of (mainly recent) documentation and the changing interfaces (which isn't so bad anymore).

alpine shore
#

Well it is the future of coding from what I read and judging what everyone says. Also apparently a lot of MMORPGs are coded using ECS.

tardy spoke
#

If you can grind it out, it's likely a pretty quick way to learn a lot of programming concepts. It gives you that overwhelmed fuzzy head feeling where you have to take a break every couple hours because you're learning so much shit and making so many connections.

alpine shore
#

which Unity version are you using currently?

#

the newest one seems to be a bit laggy, Idk if I should downgrade

tardy spoke
#

Not to mention be prepared to recreate every System you program 5 times as you learn better ways to do things. They start with like 50 lines of code then end up at like 5 once you figure out the proper way, hahah.

tight blade
#

dude, all the versions of unity are broken

#

if you have on that even semi works, Id recommend being cautious about changing it

tardy spoke
#

2020.1, which you pretty much will have to use minimally as they won't update DOTS on older versions.

alpine shore
#

ok

tardy spoke
#

I have 2020.1 beta 16 working well for me on an Mac, I want to try upgrading to 2020.1LTS though

#

2020.1 LTS is probably what you want

alpine shore
#

where do you guys look for DOTS related content/documentation

tight blade
#

is that true? I've been using 2019.4 since it was the LTS

alpine shore
#

i think I am on the beta 16 as well

#

gotta check

tardy spoke
#

@tight blade is what true?

#

They're not updating dots for less than 2020.1? I think that's what I heard

#

or maybe it was just the Entites package, but I thought it was the whole thing

alpine shore
#

2020.1.01f

tight blade
#

huh. well maybe thats why my project is always so broken. I'll try upgrading to 2020.

alpine shore
#

the Entities package and the whole rework of the package manager pissed me off tbh

#

but I think they might rework it

tardy spoke
#

and still do, though it's getting a bit dated

#

@tight blade well I think you shouldn't of been able to update to the newer versions that are incompatible? I imagine you wouldn't even be able to see them in the package manager?

#

If you threw them in your manifest and went around the package manager I could see that breaking shit pretty good

tight blade
#

nah, very much available in the package manager

tardy spoke
#

Hmm, that may not be it then

alpine shore
#

if you had them installed before that, they will be shown in the package manager

tight blade
#

I mean I didn't even realize there was a 2020 in LTS

#

I thought that was all still beta

tardy spoke
#

I find least glitchy install is get a version of unity, and just put the hybrid renderer package in the manifest. It's dependencies are all the other DOTS packages, and it seems to auto install them in a config that works.

#

@tight blade as of like... last week or something

tight blade
#

oh really?

tardy spoke
#

not that long ago

tight blade
#

well, okay then

#

this has been a productive topic for me πŸ˜‚

#

good tip on hybrid renderer being the top level package

tardy spoke
tight blade
#

yeah, I was just seeing that

#

but I mean, I dont seem to be getting much value out of the LTS build

tardy spoke
#

Haha, mine has been running really stable

#

on a Mac though. I bet the releases are all quirky for various platforms in various ways.

tight blade
#

yeah, I imagine so.

alpine shore
#

is this course really worth the 10$? @tardy spoke

tight blade
#

what course?

alpine shore
#

the one alex linked

tardy spoke
#

I dunno, is saving like 100 hours of time worth $10 to you? Hahah

alpine shore
#

but it says I have to be proficient in unity

tardy spoke
#

Nah you don't

#

Like, you gotta know how to import game objects and make new scripts

#

that's about it

alpine shore
#

I learned variables today and how to use them.

tight blade
#

oh damn, theres a unity dots course? goot tip. Yeah, Drimm its worth 10$. I dont care how good it is.

tardy spoke
#

It's worth $50 just for existing

alpine shore
#

okay

#

I am doing the C# survival guide on unity and after that I will dive into that

tardy spoke
#

It could literally be dog shit wrapped in tinfoil with "ECS" written on it and it'd be worth buying just because it's content related to ECS.

#

Which is rare.

#

Good idea

tight blade
#

yeah exactly, and whats more I'd be genuinely grateful to the author for taking the time to wrap the dogshit

tardy spoke
#

Hahaha totally.

tight blade
#

we'll all make it through this together, somehow.

tardy spoke
#

It's depressing because you're like "I fucking suck at this" when you watch him fly through code and troubleshoot shit like nothing

alpine shore
#

the most important part that i see is that there are actual project/challenges

tight blade
#

nothing's as valuable as your time. spend the 10 bucks.

alpine shore
#

I am going to

#

I just need to finish a few other courses first

#

also my keyboard is coming tomorrow, F U laptop

#

πŸ˜„

tight blade
#

Udemy is a strange place. there are rip off artists there and there are some of the most passionate teachers Ive ever met there

tardy spoke
#

Lol, it's all projects/challenges with ECS. Even when it's not supposed to be.

I'm simply trying to instantiate the same object two times with two different components tagged on each version recursively. I've spent a week on this. It works, but not even properly.

tight blade
#

The guy who taught the Docker Mastery course is one of the most sincerely passionate software teachers Ive ever met

#

Its been years, Im not sure if he still does it

alpine shore
#

I haven't used Udemy before, i got only experience with coursera

tardy spoke
#

Penny DeByl or whoever is the teacher, she has a zillion udemy courses. Some free ones on YouTube as well if you want to see if you like her style. Her site is www.holistic3d.com . The amount of stuff she knows is nuts.

tight blade
#

that domain makes me... uncomfortable.

tardy spoke
#

That site is wacky 90's

#

but her courses are good, haha.

#

I want to take her shader programming course at some point

tight blade
#

nice. Well I'll definitely be bookmarking all of this. Good tip, Alex

alpine shore
#

alex, have you watched all streams that this guy has made?

#

it seems like a game built from scratch, wtf 15hours streams πŸ˜„

#

i am in

tardy spoke
alpine shore
#

why isn't this being pushed by youtube???!!

tardy spoke
#

@alpine shore I stop being able to follow his code at all after a couple hours. Dude has so much more intuition for code than I do it's just magic to me after that. I can't follow, haha.

alpine shore
#

I cant see s*** from this picture, but yeah, hit me

tardy spoke
#

Sure, it's a google doc so DM your emails or something and I'll invite you to it

#

then we can figure out a better solution or something later if you find you're referring to stuff on it. I've been meaning to keep it more organized

alpine shore
#

and thanks for pointing me to this woman. damn that flex πŸ˜„

tight blade
#

so I know I'm late to the party, but, whoa what happened to the package manager?

#

lol. so you add it to the manifest directly yeah? Alright, I can do that.

tardy spoke
#

Yeah, there's a unity forum post about it somewhere

alpine shore
#

i have it marked on my browser πŸ˜„

tight blade
#

outstanding

pliant orbit
#

Hey ho, how would you design you a interactable system where a player could interact with different things. But the interactable should also have condition which have to be meet, before the player can interact.

In my understanding a interactable should have some kind of condition components. Like InventoryEmptyCondition, for example if the player want to get stuff out of a chest. But The InteractableSystem don't know how to check all the conditions because by design components are raw data and i can't say look at all condition components on the chest entity.

alpine shore
tight blade
#

@pliant orbit as an exercise, think about it the reverse way. rather than checking every entity for the presence of a condition component. you're just getting a list of every entity that does have the condition component.

#

its still not ideal to design it that way, because blah blah blah, but just to get you moving, you can could certainly just stick a component on them that marks them as being eligible for interaction.

#

I think when you get into the nitty gritty of it, you'll find that to be the least of your problems

pliant orbit
#

Okay that sounds good. But than i need a System that marks the entity as eligible. If I'm standing in front of a chest and the chest is inside of a list of possible entities. When and where should the marking happens?

tight blade
#

sounds like something that would happen in response to a collision event

pliant orbit
#

Oh wait ... the exercise is working in my head^^

tight blade
#

@alpine shore @tardy spoke omggg where the hell do I find the latest version of these now hidden packages?

tardy spoke
#

From me, of course

tight blade
#

hahaha

tardy spoke
#

"com.unity.rendering.hybrid": "0.7.0-preview.24",

#

enjoy

tight blade
#

actually, apparently Unity figured it out. I used the "add from git repo" and it gave no visual feedback at all, but I just checked again (after like 5 minutes) and its now installed

#

oh Unity.

tardy spoke
#

Also I think I'll turn the resources into some kind of crappy Google wiki we can use. It can load Google sheets and stuff into it, could be handy for cataloguing resources and code snippets, etc.

https://sites.google.com/site/unityecsresources/

#

I'm going to make all the tutorials that are missing from ECS such as "how the f*** do I just select one entity".

zinc plinth
#

you make it a singleton

tight blade
#

oh nice. I have some snippets I could contribute.

tardy spoke
#

... well yeah I know that now

#

I loop get singletons in dynamic buffers now to game objects I convert on the fly to entities.

just kidding.

tight blade
#

great tip on 2020. this is working much, much better.

tardy spoke
tardy spoke
#

and if anyone wants an invite to add stuff to it go nuts. I can give access to those spreadsheets as well.

glacial bolt
#

@tight blade Please don't post memes/reaction things

tight blade
#

my apologies

#

thanks for keeping the space clean

safe lintel
#

you could host it on github too

#

if you know markdown

tardy spoke
#

Yeah, that could work

north bay
#

Would be easier to add content that way

tardy spoke
#

This is easy and allows easy collaboration, not sure which is better.

Though it's pretty old google tech, sucks their new sites thing doesn't have a wiki type page.

#

let me look into these github sites

#

Do you just mean doing it on readme.md on a github repo or actually using github pages

tight blade
#

you could do either! id keep it simple to start and if we want to move it to pages later we can. Youre doing some good work here and we dont want to overload you

#

not that pages is that difficult, but we're several layers deep in yak shaving already

tardy spoke
#

We can MVP it with the terrible Google site and move it over if people actually use it. Would make sense. The info in the Google Sheet is easy to update/move.

tight blade
#

yeah, I think thats the way to go

tardy spoke
deft stump
#

open up your package manager... are there any red exclamation marks? @odd cipher

odd cipher
#

nope

deft stump
#

either way...

  1. ) close unity and unity hub.
    2.) delete the library folder of your project.
    3.) start unity hub, open project.
    4.) see if that works.
odd cipher
#

nope same errors

#

@deft stump

odd cipher
#

idk how to fix it

safe lintel
#

looks like an outdated package, you updated something else recently?

deft stump
#

How do i build my dots game for android with srb?

#

I dunno what component im missing

safe lintel
#

never built for android sorry

odd cipher
#

I updated entities and it broke everything

#

tried going back a few versions didnt help

safe lintel
#

version control?

odd cipher
#

i dont know what that is

safe lintel
#

you know what unity collab is right?

odd cipher
#

yes

safe lintel
#

anyway version control allows among other things you to roll back any changes youve done ie updated to a new package that broke everything? simply revert the change if you are using version control.
you can even have multiple versions(branches) of a project stored, allowing you to test new things in isolation. its what unity and pretty much every other big organization use to develop stuff(see the graphics github repository). id personally suggest looking up github desktop and following a quick tutorial to get it running. if not that, use unity collab(but its not as good as what its based upon).

odd cipher
#

well.. I don't have that then

#

so its kinda too late

safe lintel
#

as to your problem i would personally: make a copy of the project(zip or archive it) as it is currently, and then experiment with updating all out of date packages to the current stuff. if you didnt keep a record of what packages you were using prior to updating, it would be really easy to be changing things to an incompatible group of packages

odd cipher
#

all of them are current

#

not out of date

#

is there no way to fix it?

deft stump
#

@sand ivy

#

this???

odd cipher
#

does anyone know how I can fix it

gusty comet
#

is creating six million entities a bad idea

deft stump
#

no

gusty comet
#

based

deft stump
#

as long as your pc can handle it it's all fine and good

odd cipher
#

i cannot figure it out..

amber flicker
#

@odd cipher if you have the latest entities installed, my guess is you haven't deleted your library folder as was advised above

odd cipher
#

I did

amber flicker
#

what makes me believe that is your errors are about entities 0.8 - a very out of date package and there are only two ways I know of for a project to know about that - you used to have it installed and it was cached in your library files, or that's the current package installed

odd cipher
#

ill try and delete the library folder again then

#

nope same errors

#

deleting library folder doesnt help

amber flicker
#

Β―_(ツ)_/Β―

#

did you manually copy the entities package into your packages folder at some point?

odd cipher
#

no?

amber flicker
#

in your project's Packages folder you should only see a manifest file

deft stump
#

what does the error even say?

#

it might be an incompatibility?

odd cipher
#

huh it seemed to have magically fixed itself after updating entities

deft stump
#

so it is an incompatibility

odd cipher
#

I guess it was

#

huh. well atleast it fixed itself

alpine shore
#

@tardy spoke that

@tight blade @alpine shore I've started creating a resource centre here on a crappy Google page for DOTS/ECS stuff. I'll keep adding to it.

https://sites.google.com/site/unityecsresources/
@tardy spoke that is awsome, thanks. You can add this one as well: https://www.udemy.com/course/unity-ama/ It is not entirely about DOTS, but there are two parts including DOTS.

Udemy

Student-requested topics including ECS, Job System, Databases, Augmented Reality, Procedural Animation, AI and more.

gusty comet
#

I need to iterate over 16,384 'tile' entities and create an additional 375 'space' entities per tile resulting in a total of 6,144,000 space entities representing an atmospheric simulation. Can I use a parallel schedule to populate each tile? I don't see a way to both create an entity and populate it with data in a single lambda. I feel like I could schedule one job to create those entities and the parallel writer job to fill in the component data, but that'd put 6,144,00 create entity iterations on a single core.

amber flicker
#

Why use entities at all? Sounds potentially better suited to a NativeArray?

gusty comet
#

video or documentation for that please

amber flicker
#

it's just an array.. if you're processing large quantities of data there's no need to create an entity for everything

vagrant surge
#

yeah man, if you are getting into the millions, you absolutely shouldnt be using entities

#

entities have overhead

dull copper
#
## [Samples Project for 0.4.1-preview] - 2020-07-28

### Changes

* Added simple `1b. Respresentations` sample highlighting graphical and physical representations of the world.
* Added simple `1c. Conversion` sample, along with worked examples moving from GameObjects (Data & Logic) to DOTS.
    * New `1c1. GameObjects GravityWell` sample - showing Data conversion working but not Logic conversion.
    * New `1c2. Covertible GravityWell` sample - showing Data & Logic conversion.
    * New `1c3. DOTS GravityWell` sample - showing same scene without GameObject conversion.
* Updated `2a2. Collider Parade - Advanced` sample with extra setup samples involving multiple graphics mesh and/or multiple physics shapes.
* Updated `4. Joints\Ragdoll` demo to use new ragdoll joint interface and allow modification of joint limits.
* Added `5d. Change Velocity` demo showing a local velocity change.
* Added `5f. Change Surface Velocity` sample highlighting a conveyor belt use case with no moving parts.```
gusty comet
#

The problem I have with refactoring this from entities to something faster like a native array is that there is a many to one association with chemicals.

If I split a tile (1x1x3) into cubes where 5 cubes fit into one meter I get 5x5x15 or 375. Each of those cubes is going to be, initially, 79% nitrogen, 21% oxygen. More chemicals can be added later, or the temperature can change.

I feel like this should be achievable if I can work out the structure. Maybe drop it to 3x3x9 instead to save several million spaces at the expense of complexity.

My problem is, like okay, lets say I drop having entities in favor of defining a single struct attached to the tile that contains a lot of data and just update that. How would I then say that TileAtmos{0,3,6} has Oxygen and Nitrogen while keeping my resource consumption down and being able to network that later on?

#

I suppose I could convert this into a similar native array?

    {
        public Chemical Chemical;
        public float Matter;
        public float Temp;

And instead make those Chemical{x,y,z}, etc. Would having to replace those structs every time anything changes effect performance worse than having 1m entities?

mint iron
#

I don't see a way to both create an entity and populate it with data in a single lambda.

its not setup that way because it would be slow for this scale; you want to create all the entities you'll need first in one step because creating them is fairly cheap - it just allocates new chunks in an archetype and fills them from a template. Setting the data is harder because you actually have to iterate every element if they're potentially unique.

The worst thing you can do is create empty entities and then add each of the components one by one, try to avoid that instantiating with an archetype or entity prefab.

If they're not unique you can use an entity prefab with the data already setup on components and it gets used as the template. Ideally it would configure a chunk once, and then block copy the whole chunk but I'm not sure how its setup internally.

You can also have an entity prefab, modify its values, then use it to instantiate a group, change some of the values on the prefab entity, and use it again to instantiate a slightly different variant.

#

@gusty comet how often do you need to access a specific tile or space coordinate, or is the work mostly looping through everything to do the simulation? and do the tiles or spaces need to move? are they perfectly densely packed or there can be gaps between them / are arbitrarily placed? do you always update all of the data together, or would you for example change a chemical without touching matter/temp? is each space typically unique sequentially or can many be assigned the same values sequentially?

vagrant surge
#

@gusty comet using 1 entity per bunch of tiles is a fairly popular approach

#

like for example 1 entity for 8x8x8 of those chemical entity thingies

#

but really tho, when you start getting into those numbers of stuff, entities just have too much overhead

gusty comet
#

@mint iron the actual tiles do not need to move. it is a uniform grid. they align with one another

mint iron
#

yeah i agree vblanco, if you want to process millions of anything, it has to be SIMD or its going to turn out badly.

gusty comet
#

hi, I'm having some problem with the profiler, I have one custom system running, it doesnt appear in the profiler timeline but it does on the hierarchy. I'm following a tutorial from yt. Any ideas?

tardy spoke
#

Which tutorial are you following, out of curiosity?

gusty comet
#

Unity DOTS: System Base from Game Academy.school

deft stump
#

what's the best approach to check if ICD-A of Entity-A and ICD-A of Entity-B has the same value?

minor sluice
#

usually, structs are compared by value, not by reference, like class instances,
so if you get both component datas, you should be able to just do

if (data1 == data2)

#

unless unity intercepts with some weird custom behaviour, but that shouldn't be the case here

deft stump
#

what if I have N number of entities?

minor sluice
#

how do you want to perform the check? checking every entity against every other or?

#

checking if all components are the same as one specific one?

deft stump
#

the former, check every entity against each other

sour sorrel
#

Can anyone point me towards the most efficient solution in hybrid render for blob/circle shadows? I can't seem to find anything projector-like in there atm.

My current solution is..... less than ideal, and before going and trying to make a shader with no transparent overlap and that always renders over terrain I would love to know if there are alternatives ))))

pliant pike
#

kind of an off topic question but if I declare an enum outside any class then it should be accessible by any other script surely? πŸ˜•

misty void
#

Hey guys is it possible to use Jobs System for editor script? i need to do a heavy mesh processing in editor

pliant pike
#

ok sorry nevermind it seems don't place it in a editorscript then it wont appear

minor sluice
#

checking every entity against each other seems to be an O(nΒ²) operation, sounds kind of bad, for what use case do you need it?
sadly I don't really know how to approach it

#

the enum could just live in a namespace or in no namespace (global namespace) like in the same scope where you would do class declarations, that's fine

#

and yes, should be possible to use jobs for editor scripts, they work in the editor so I don't see a reason why editor scripts should be an exclusion

deft stump
#

how do I check if an entity has ICD-A?

tardy spoke
#

O(nΒ²) ... that's like the anti-DOTS πŸ€”

deft stump
#

it's not anti-dots

#

its just very inefficent

tardy spoke
#

That's like saying the anti-christ isn't very holy

deft stump
#

k dot

tardy spoke
#

I hate when people say stuff like this because it always sounds patronizing, but Is there a way to take the problem, ask what the true job to be done is and restructure the solution?

#

@sour sorrel if you come up with an answer to that i'm interested to know as well

sour sorrel
#

@deft stump if the value you want to compare is keyable (can be a key to a hashmap) you can perform an operation on a (native)multihashmap over multiple jobs. Eg. you populate the multihashmap with the keys in one job (in parallel with parallelwrite) and then in another job you try to extract the values and check if any of the keys have multiple entries. The values in this case would be references to the entity the has the key.

Seems like a hack but it should be an O(2*n) operation only from my understanding of how hashmaps work. There are some awkward areas here like how to iterate over a multihashmap but there are some resources on how to do it on the googlenets.

pliant pike
#

Isn't it simpler than that, your just checking a list of a list I've done that before, its not that hard it just will take a while depending on how many there is now way around that

sour sorrel
#

If you are checking a list of a list it's a O(n^2) operation instead of O(2*n)

#

O((n^2)/2) to be specific I believe since you are not repeating the checks for past entries

mint iron
#

Hash-based is basically linear access time regardless of how many you have right?

vagrant surge
#

@mint iron really not so easy as linear access

#

couse cache trashing, having to retry when stuff is occupied, etc

#

hashmaps are kinda unpredictable honestly...

mint iron
#

good point, now i remember working on an implementation, and depending on the quality of the hash, some values could have a long linked-list to find the value when there are many with the same resolved key / bucket

spring hare
#

Anyone know off-hand the average main thread time for calling Schedule on a single job?

#

I realize it varies but I’m just looking for a sample rule of thumb number, preferably on Xbox/PS4 base units but can be whatever