#archived-dots
1 messages Β· Page 161 of 1
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
Ahh okay.
What happens when two threads writing to the same address at the same time?
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
hrm - well you have 1 other thread just overriding the data π€
which can result in unexpected behaviour
Right but all threads are writing the same value so it's fine if they overwrite each other.
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
I'm just wondering if something unexpected would happen and crash the app.
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?
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.
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
I think burst supports Interlocked
Okay, I'll keep it like this then.
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
Really? I thought interlocked was fast
will try and find it
hmm maybe it was this I was thinking of https://forum.unity.com/threads/could-componentdatafromentity-t-have-a-return-by-ref-version-of-indexer-for-atomic-operations.866524/#post-5705032
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]
Also is most likely a lot cleaner than using interlocked
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.
it might be fine just to do that.. I'd love to know 100% that there wasn't anything potentially unsafe about it
does anyone have Entity 0.13 and Hybrid Renderer 0.7 running?
yup
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
Yeah if someone knows I would like to know as well.
could be related to a custom bootstrap but i saw this error also on the forum so /shrug
restart the unity editor ?
yea perhaps custom bootstrap related - I haven't seen that error sorry
np, thanks anyway π
thats what happened to me when i change the type of shared static, when i restart the editor it fixes
oh, restarting fixed it. haha
π
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?
hmm you want to think about serializing everything - so having it converted at edit-time. Are you trying to tick physics separately to display?
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.
hmm but your physics will have fp issues too..?
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.
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
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.
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.
hmm have you tested physics in vr out at 2.5km?
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".
Once you have variance it's going to scale out of control and you'll have no valid actions after a few divergences.
Well, I don't even know what that is, and ignorance is bliss. So hopefully that won't be a problem. π
If only it worked that way.
I feel like I'm going to learn a lot about physics in a painful way.
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
is there a naming convention for flag structs
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.
not even installed physics yet sorry, can't help @maiden cape
flag structs @gusty comet ?
No, I mean structs that have no data but are used for pulling entities.
Ohhh.
Tags
which I've seen referred to as flags
ah - tags
oooops, right
Tags* π
okay, what's the naming convention for tag structs π€
I've seen them named same as components but I doubt anyone would complain if you actually threw tag in the name
I end all my tags with SlartyBartFast
Makes them easy to find

Okay, so my idea is full of holes and likely to explode - we've established that...
So how do I start implementing it? π€
Read lots and lots? Do bare minimum experiments.
Not that
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
Hahah nah I just meant my original question
yea ok I understand
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
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
@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?
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
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
I guess you want that entity to also be moved to another world
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.
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?
hm, hang on i'll make a video
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
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
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
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
ah thx
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
https://www.loom.com/share/8451f480fc264b0ca1dacc7e65ae27dc @amber flicker
Click the link and I kinda explain stuff.
Processing... π
Is this code outdated? I don't see an IJobProcessComponentData interface.
@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.
@gusty comet yeah I believe that's pretty old.
JobComponentSystem has been replaced by SystemBase (what you're probably used to, thankfully!)
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
https://www.youtube.com/watch?v=JxbvRhxeKTo <-- To understand the changes.
@gusty comet
@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.
Maybe I didn't understand your question.
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?
Yeah, I believe that was the only issue
and have you seen these or is it hypothetical?
Seen 'em
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)
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.
Haha, lamda functions are doooope. I come from javascript though and that's... pretty much all anyone ever uses anymore, haha.
javascript
say no more fam
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.
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?
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.
was just trying to google about the status
worth up-voting anyway - https://portal.productboard.com/unity/1-unity-graphics/c/9-camera-relative-rendering
I think it might be implemented in hdrp which might be what I was thinking of? Doesn't help you. Ok.. thinking.
Yeah, I hear the implementation is practically garbage
that's disappointing
Huge discussion of it here
https://forum.unity.com/threads/floating-point-errors-and-large-scale-worlds.526807/
I upvoted it though
Hmmm
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
Worth some investigation.
Does HDRP have higher overhead or anything if you use it the same way as URP?
I think it's quite a lot heavier even if you strip out a load of stuff
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.
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 )
Yeah I'll experiment with that before continuing with the ECS dual world code. Really changes the trajectory.
also fyi I'd try and move to subscenes and away from the 'convert to entity' components if you can
The only reason I didn't was for the "dual world" thing.
So i'll move it all to sub-scene if this works.
my guess is hdrp will just be too heavy sadly...
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.
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
Yeah the Oculus has the equivalent processing power of a Google Pixel 2. It's pretty... restrictive, haha.
well the good news is that by the time you release, it'll likely be 5x faster π
Hahah. Yeah, I'm not really sure how to apply that offset without having the objects duplicated.
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
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!
yes.. can't help much there - definitely post on the forums
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.
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!
Yeah thanks for the help! I'm fairly convinced there's likely a better solution at this point, haha.
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
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
@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
the linkedentitygroup ?
... never heard of it. Looking up now... hahah
Hmm, it has all it's children right in there.
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?
you use what you need, I only use oncreate or onstartrunning sometimes
Hey folks. Is there any way to force Livelink to reconvert an object or the subscene it's in?
Yeah, figured that might be more future proof than instantiating things with monobehaviours
No idea unfortunately, never used LiveLink. Looks cool though!
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
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
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)
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?
when you say children of, you mean componentData right?
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
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)
Yeah, it's confusing because the "Child" component here appears on the parent... that's what I'm trying to access. I figure that's just a normal component right? It's not magic?
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
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.
they work really similar
but buffers are always IBufferElementData structs and you access them like components
Thanks for the help! Saved me a ton of time.
Pretty sure it's working. I'll just have to figure out a way to make it only run once, but I'll save that for tomorrow, haha.
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)
It's pretty jank, but it allows me to to use the normal ScriptableObject asset workflow with entities.
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.
i dont quite understand
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.
ok
@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.
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
You can also manually execute systems, for example having a FixedTimestepExecutor that calls every system in a FixedTimestep update group on an interval
@tardy spoke latest everything
How do I delete a specific buffer or all buffers of a type from an entity?
@deft stump great. Looks like I have something to look forward to, haha.
@tardy spoke if you can make it work, ping me asap. I'm working on getting the On-screen controls right for my game
@deft stump yeah I'll keep you posted
Are you building for just Android or Android VR (Oculus)?
Android only, no VR
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);`)
afaik, yes
Do I have to worry about GC or anything?
@opaque ledge Ha! That's actually super smart. Sometimes it's best not to overthink things, haha. Just using a bool works fine.
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...
@gusty comet CodeMonkey tutorial on DynamicBuffers if you want some additional info https://www.youtube.com/watch?v=XC84bc95heI
Once upon a time there was a happy coding village. Everyone was happy and everything worked great.
Then one day I tried to remove the components with ECB, and the village completely lit on fire.
which index is out of range? also I think you should only be removing shared components via entity manager
what is dots?
baby dont hurt me no more..
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
@zealous scarab its unitys vision of the future, like of flying cars, moonbases, amazing computers that negate the need for work π
but actually https://unity.com/dots
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
its also very very work in progress so imagine its nowhere near as complete as that page might suggest
I'm hard on DOTS but I actually do think it's super cool.
Any videos / tutorials for explaining how ECS should work with 3D spaces and trigger collisions?
https://youtu.be/KwwHvH3GZsQ?t=1593 this may help
Shows some basic trigger event stuff in ECS
cheers, looks like the πͺπΊ for some reason
Dapper dino has an example with a trigger callbacks here
https://www.youtube.com/watch?v=68sUTX7rQiA
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
@minor sluice any idea how to delete shared components from a dynamic buffer?
It doesn't like the ECB being used like this on shared components.
Or an idea for a better approach!
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
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.
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
Yeah, like it would have to travel down the hierarchy, where as with my current code it's only selecting the parent's children.
In my code the DynamicBuffer is specifically that "Child" piece of data sitting on "physicsFacade", because of the .WithAll() tag
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.
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
Yeah, only the root parent is tagged uniquely "physicsFacade" so that's perfect
hope that works then!
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.
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)
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.```
if you filter for one specific reference of a shared component, this might work yeah
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.
yeah, that's what I wanted to refer to with my text above ^^
but there are usually multiple ways how to approach an issue
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
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.
@gusty comet no you can do it in the foreach with an entityCommandBuffer, but it executes at the end
I'll show ya
Note how you have to initialize, play it back and dispose of it as well
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
after seeing half of the video, I think this approach should be fine
https://cdn.discordapp.com/attachments/497874303463850004/737019114446389318/Screen_Shot_2020-07-26_at_12.49.44_PM.png
in the end the result should be that all rendermesh are removed from entities that were stored as a child buffer element,
at least I thought this would work
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
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
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.
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);
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).
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
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.
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
@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.
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
@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.
@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.
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
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)
What do you mean by "going to be implemented", exactly?
@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.
well currently you cannot download Entities from the package manager on 2020.1 @tardy spoke
Ah, yeah
or maybe i have gone blind
Throw it in the manifest.json
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.
@alpine shore I'll show ya. Im not sure why Unity did this, though, haha.
the manifest.json is by changing the framework to .Net4 and then opening the file right?
i did this but got some weird shit
yeah i know where it is, but i got that long list
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.
brand new
Yeah, give it a shot, should be fine
dumb question, paste it where? π
anywhere in the package manager, it's insensitive to positioning
ok
this migth explain where it went from the package manager https://forum.unity.com/threads/visibility-changes-for-preview-packages-in-2020-1.910880/
oh and make sure you have "view preview packages" enabled, etc
i already do
perfect, should be good to go!
@quasi trellis thnx
Hmm. Well, it "works" but then it has a huge memory leak for some reason... no idea why. Am I not disposing of the NativeArray from the Query properly or something?
These are the many errors it likes to freak out about after seemingly executing properly...
where are you storing the reference?
in an ICD?
Not sure what you mean? The reference for which?
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?
I'm actually not sure how that's done with Unity, haha. There's probably a way though?
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
Hmm, interesting. I'm in visual studio code, but I still can add those red breakpoints!
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
Something kinda like this?
There seems to be an extension for VS Code so I installed it, hopefully the functionality is similar haha
yeah
im not sure how VS Code works, as I'm using VS Community..I only know this π
also, I think this means it's in your NativeArray.cs script @ line 57
It's pretty cool! I'm not sure if it works with ECS though?
Hmmm, hahahah
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. π€·ββοΈ
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
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.
I thought your for loop looked fine too, but i don't know anything about the removecomponent<rendermesh> stuff
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.
I wouldn't know anything about it, and I hope I don't have to π
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.
lol
@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. π€
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.
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!
anyone else getting worse performance on Entities 0.13 than 0.11 with Physics 0.4?
and longer compilation time?
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
ArgumentNullException: A valid BlobAssetStore must be passed to construct a BlobAssetComputationContext
Parameter name: blobAssetStore wtf
this has just appeared out of nowhere
@spark glade thanks! Much appreciated. Any way to give +rep on here?
@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?
you are not destroying the entity, you are just removing a component
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.
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
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.
yea ecb prob hasn't run yet
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 usingmyEntityManager.CompleteAllJobs()) and ensure that the commandBuffer has run (I think you can update manually the EndSimulationEntityCommandBufferSystem for that, but never tried that).
World.CreateSystem<GasHeatDiffusionSystem>().Update();
m_Manager.CompleteAllJobs();
Assert.IsFalse(m_Manager.HasComponent<GasHeatInhomogeneousTag>(entity));
π thanks
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
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
I only want the result right away for testing.
then make your test run after the ecb updates
How?
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 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
DisableRenderingcomponent?
@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.
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
Haha, everyone working with ECS needs to drink imo.
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
How?
@gusty comet I believe that:
World.CreateSystem<GasHeatDiffusionSystem>();
World.Update();
Assert.IsFalse(m_Manager.HasComponent<GasHeatInhomogeneousTag>(entity));
Should work (or something similar)
no dice, no.
I have some working ECS test samples somewhere, I can dig into this later if you are still in trouble until then
it really does not help that I cannot Debug.WriteLine() in a job.
argh... I can't build my dots game on android... I dunno what's missing
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.
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?
I think its like a systemgroup or something
physics stuff is calculated in that group and then its fixed time step
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.
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
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.
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.
Typical ECS commit message
using collaborate over git 
madlad
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
oh and the physics body settings
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
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
yea that sounds like something weird going on
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
oh you are unit testing, didn't know the context when answering earlier
is ecb still the issue
Now I'd like to use FixedStepSimulationSystemGroup because it's physics, but I can't find any documentation on it
like any example system
dm me if u wanna make a game with me
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
Is there an example of this
yea this is a good post about it https://gametorrahod.com/ecs-testing-review/
man i'm sick of seeing that guy's anime avatar lol, sargon is everywhere when I google ECS stuff
lmao
You guys should take a break from your hard problems and solve my easy problem.
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.
You can grab the buffer by using EntityManager.GetBuffer<Child>
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 .
DynamicBuffer is special, the actual component is Child
The DynamicBuffer<T> is just a container
Yeah, @untold night I iterate through it below and grab the child components and add them to an array
And you'll need to use GetBuffer<Child> on entity manager, not GetComponentObject, that's for managed components
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.
It's actually GetBuffer, I got it mixed up
No worries, I found it.
Simply changing it to GetBuffer<Child> seems to have resolved that error... onto the next errors. π
Appreciate the help!
Errors... errors never end
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.
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 thanks! Much appreciated. Any way to give +rep on here?
@rigid cosmos not sure, but you can always play my game hahaha https://www.yeetstudios.com/legioncommander (Dots based, whoop)
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?
DynamicBuffer is for when you want a list/array associated with an Entity - all other times use NativeArray/NativeList I guess
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?
@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
@wise monolith maybe it isn't anything fancy, I thought maybe it was, haha.
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.
Yeah, like an O(1) vs O something haha.
hmm not exactly π
... 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 ?
Yah so a matrix is just a fancy name for a float[4,4] with some handy functions for transforming objects.
well, not "referencing" likely
is a dynamicbuffer a cache that points to the entity data in the various chunks?
@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
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?
hmm the first bit yes.. i may be doing a poor job of explaining here. Dynamicbuffers could just contain floats or whatever data.
Haha it's all good, I can do some research and figure out the rest now that you've laid the foundation!
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.
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.
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
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
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 π
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?"
well i think some of it is difficult because of changes to the api and theres almost zero documentation for anything beyond the basics
Yeah, totally. That definitely compounds the difficult greatly.
the rendering docs seem to have more info about hybrid stuff than the main entities docs
its not a lot but still π
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
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)
Gonna need some more practical shit.
but whenever i see ioc or mvcs stuff mentioned with unity my brain glazes over
lol, it could be Dunning-Kruger effect. Maybe you don't know enough to know what you don't know? π
possibly π
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.
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
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
Yeah, it's fairly "dead", but the concept is pretty interesting.
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.
In SystemBase, are there similar flags that can be set for multithreading, like ".schedule()" ? I'm not using a ForEach in there to use those methods
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();
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
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?
@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
@zinc plinth yeah thats what I figured! Thanks for the tip. I'll take a look into these "parent systems!" π
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.
and the start of the second system that updates after the first. I tried having it wait for displayFacade to exist but that doesn't seem to solve the problems, and seems pretty hacky.
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);
}```
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?
is there a built-in solution for converting children to Entities and the parent GO to be destroyed if children == 0?
## [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
Burst error BC1033: Loading a managed string literal is not supported
how and why is this a thing, i just want to debug.writeline
@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```
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
being able to use Debug.x from bursted stuff is relatively new thing too, not everything is supported
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
burst debugging in general is one reason Unity gave for Burst crossplatform determinism getting pushed further
or maybe I'd have more luck with IJob stuff?
they said they have more pressing issues like that debugging to fix
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
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
there's zero documentation for it, it came out last week and the manual page for it is just the autogenerated API page
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
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
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
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
the idea is that you build actual games and game specific tech, not general purpose systems that really should be there already
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
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
tru
Why doesn't my Unity.Rendering / Unity.Transforms have a Translation/Rotation data type?
missing assembly reference.
π€
they should live inside Unity.Transforms, you sure you dont have custom Translation/Rotation struct ?
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
rendermesh should be in unity.rendering.hybrid
There's no Unity.Rendering.Hybrid package
tried downgrading to entities 0.11 but no dice.
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)
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
a truly magnificent moment for humanity
Can one ever truly HAVE RenderMesh? π€
if a RenderMesh displays in the woods, does it still have vertices?
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? π€
they're still technically right
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.
I mean about the release being in 2020.1
They plan to have it documented by 2042.3
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
Go experience the explorable videos: https://eater.net/quaternions
Ben Eater's channel: https://www.youtube.com/user/eaterbc
Brought to you by you: http://3b1b.co/quaternion-explorable-thanks
Previous video on Quaternions:
https://youtu.be/d4EgbgTm0Bg
Nice explanation of Gim...
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
https://www.youtube.com/watch?v=zjMuIxRvygQ
the audio in that video is really quiet and muffled
okay, well if youve watched it and think its a good source, I'll fix whatever the issue Im having with watching it is.
That's super weird, it's a little quiet on mine, but on headphones the dialog is clear?
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
Yeah this tech is nuts hah
https://eater.net/quaternions/video/intro super cool
When dealing with ECS, are all transforms handled relative to the scene's 0,0,0 or is there relative positioning still?
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
ah okay
Might want to do a test with translation though just to be sure
Is there documentation for what each float4 represent
It's not immediately obvious looking at the debugger
a quaternion I would assume if it's a rotation? Or do you mean the LTW matrix ones?
LTW float4x4
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.
Is there documentation for what each float4 represent
@gusty comet you will.want to take a look into transformation matrices
so apparently IJobEntityBatch got sneakily added in at some point without any mention
nice, it will be great when we can do this automagically in a ForEach
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
the whole batch naming is a bit suspect through, IJobChunk always was processing an entire chunk of entities, nothing is really changing there.
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.
oo that does make sense
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
chunks on chunks on chunks
Can you run monobehaviours on GO's inside a subscene? Is that... alright? Hahah
Like ConvertGameObjectToEntity class kinda stuff
this is over 37,500 individual cubes and it spawns them in a second
It's beautiful.
i've worked very hard to get my cube maker working, better be beautiful
Time to throw it on the Steam store and start raking in the cash I guess?
Noobie question: Is it a good idea to use MonoBehaviours and ECS in one game? Or should one concentrate only on one of both?
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.
okay, thanks @tardy spoke
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)
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.
The added complexity is
-
Adding reference objects from outside world into ECS
-
Conversion of GO's to ECS
-
Addition of Unity's standard player loop affecting ECS through script execution times
Okay, that makes sense
In my opinion
its not confusing it just feels gross to still use monobehaviours and other non dots stuff π
Lol, i'm in the same boat. It's confusing af. These guys have been programming for more than 3 months. π
hahaha, yeah. I hear you.
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.
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
It's hard to learn it wrong because your code won't work. π
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.
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)
@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.
But isn't visual scripting extremely bad on the performance side? Especially when you are doing bigger projects or multiplayer games
Also I agree, I think mixing DOTS interface with hybrid old interface is... meh
yeah, its a long story. they abandoned the notion of "visual coding with DOTS" after drop 6
Ahh damn
and thats also when they dropped codegen
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
yeah. it was a really big let down.
Yeah, too bad.
lol, yeah, I hear that.
how many people work on a project like BOLT?
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).
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.
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.
which Unity version are you using currently?
the newest one seems to be a bit laggy, Idk if I should downgrade
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.
dude, all the versions of unity are broken
if you have on that even semi works, Id recommend being cautious about changing it
2020.1, which you pretty much will have to use minimally as they won't update DOTS on older versions.
ok
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
where do you guys look for DOTS related content/documentation
is that true? I've been using 2019.4 since it was the LTS
@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
2020.1.01f
huh. well maybe thats why my project is always so broken. I'll try upgrading to 2020.
the Entities package and the whole rework of the package manager pissed me off tbh
but I think they might rework it
@alpine shore https://www.udemy.com/course/unitydots/learn/lecture/18574798?start=0#overview this is a resource I found useful at first
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
nah, very much available in the package manager
Hmm, that may not be it then
if you had them installed before that, they will be shown in the package manager
I mean I didn't even realize there was a 2020 in LTS
I thought that was all still beta
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
oh really?
not that long ago
well, okay then
this has been a productive topic for me π
good tip on hybrid renderer being the top level package
Oh, I guess it's not an LTS, but it's not a beta anymore.
yeah, I was just seeing that
but I mean, I dont seem to be getting much value out of the LTS build
Haha, mine has been running really stable
on a Mac though. I bet the releases are all quirky for various platforms in various ways.
yeah, I imagine so.
is this course really worth the 10$? @tardy spoke
what course?
the one alex linked
I dunno, is saving like 100 hours of time worth $10 to you? Hahah
but it says I have to be proficient in unity
Nah you don't
Like, you gotta know how to import game objects and make new scripts
that's about it
I learned variables today and how to use them.
oh damn, theres a unity dots course? goot tip. Yeah, Drimm its worth 10$. I dont care how good it is.
It's worth $50 just for existing
okay
I am doing the C# survival guide on unity and after that I will dive into that
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
yeah exactly, and whats more I'd be genuinely grateful to the author for taking the time to wrap the dogshit
Hahaha totally.
we'll all make it through this together, somehow.
One of the most depressing and best tutorials is watching this guy make a game in ECS
https://www.youtube.com/watch?v=JkiJoAufH9A&feature=youtu.be
It's depressing because you're like "I fucking suck at this" when you watch him fly through code and troubleshoot shit like nothing
the most important part that i see is that there are actual project/challenges
nothing's as valuable as your time. spend the 10 bucks.
I am going to
I just need to finish a few other courses first
also my keyboard is coming tomorrow, F U laptop
π
Udemy is a strange place. there are rip off artists there and there are some of the most passionate teachers Ive ever met there
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.
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
I haven't used Udemy before, i got only experience with coursera
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.
that domain makes me... uncomfortable.
That site is wacky 90's
but her courses are good, haha.
I want to take her shader programming course at some point
nice. Well I'll definitely be bookmarking all of this. Good tip, Alex
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
I have a bunch if you want 'em. Not all ECS related, but the later ones are.
I was thinking of making a Google Sheet or a wiki of ECS resources or something.
why isn't this being pushed by youtube???!!
@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.
I cant see s*** from this picture, but yeah, hit me
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
and thanks for pointing me to this woman. damn that flex π
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.
Yeah, there's a unity forum post about it somewhere
i have it marked on my browser π
outstanding
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.
Whenever I hear this word, I see this @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
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?
sounds like something that would happen in response to a collision event
Oh wait ... the exercise is working in my head^^
@alpine shore @tardy spoke omggg where the hell do I find the latest version of these now hidden packages?
From me, of course
hahaha
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.
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.
I'm going to make all the tutorials that are missing from ECS such as "how the f*** do I just select one entity".
oh nice. I have some snippets I could contribute.
... 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.
great tip on 2020. this is working much, much better.
@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.
To compile hard to find Unity DOTS and ECS resources into one place.
and if anyone wants an invite to add stuff to it go nuts. I can give access to those spreadsheets as well.
@tight blade Please don't post memes/reaction things
Yeah, that could work
Would be easier to add content that way
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
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
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.
yeah, I think thats the way to go
https://sites.google.com/site/unityecsresources/home added some more stuff.
open up your package manager... are there any red exclamation marks? @odd cipher
nope
either way...
- ) close unity and unity hub.
2.) delete the library folder of your project.
3.) start unity hub, open project.
4.) see if that works.
idk how to fix it
looks like an outdated package, you updated something else recently?
How do i build my dots game for android with srb?
I dunno what component im missing
never built for android sorry
I updated entities and it broke everything
tried going back a few versions didnt help
version control?
i dont know what that is
you know what unity collab is right?
yes
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).
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
does anyone know how I can fix it
is creating six million entities a bad idea
no
based
as long as your pc can handle it it's all fine and good
i cannot figure it out..
@odd cipher if you have the latest entities installed, my guess is you haven't deleted your library folder as was advised above
I did
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
ill try and delete the library folder again then
nope same errors
deleting library folder doesnt help
Β―_(γ)_/Β―
did you manually copy the entities package into your packages folder at some point?
no?
in your project's Packages folder you should only see a manifest file
huh it seemed to have magically fixed itself after updating entities
so it is an incompatibility
@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.
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.
Why use entities at all? Sounds potentially better suited to a NativeArray?
video or documentation for that please
it's just an array.. if you're processing large quantities of data there's no need to create an entity for everything
yeah man, if you are getting into the millions, you absolutely shouldnt be using entities
entities have overhead
Unity Physics samples just updated at https://github.com/Unity-Technologies/EntityComponentSystemSamples
## [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.```
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?
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?
@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
@mint iron the actual tiles do not need to move. it is a uniform grid. they align with one another
yeah i agree vblanco, if you want to process millions of anything, it has to be SIMD or its going to turn out badly.
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?
Which tutorial are you following, out of curiosity?
Unity DOTS: System Base from Game Academy.school
what's the best approach to check if ICD-A of Entity-A and ICD-A of Entity-B has the same value?
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
what if I have N number of entities?
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?
the former, check every entity against each other
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 ))))
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? π
Hey guys is it possible to use Jobs System for editor script? i need to do a heavy mesh processing in editor
ok sorry nevermind it seems don't place it in a editorscript then it wont appear
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
how do I check if an entity has ICD-A?
O(nΒ²) ... that's like the anti-DOTS π€
That's like saying the anti-christ isn't very holy
k dot
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
@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.
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
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
Hash-based is basically linear access time regardless of how many you have right?
@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...
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
