#archived-dots
1 messages Β· Page 238 of 1
it's already my 2nd try. :/
1.7 now
did you restart after updating burst?
i closed unity and edited the package manifest. maybe that was dumb
"com.unity.burst": "1.7.0-pre.1",
yes
hrm, still stuck?
oh no
lol, yeah, I'm not getting this to run with 1.7. shit, I had it running once
it might be a 2021+ only issue. If it doesnt show up in 2020.3 package manager, it may not be supported yet
1.7 is still fairly raw
i'm still on 2020.3
I got 1.7 working on 2020.3 once. Before I worked on some graphics thing that required 2022. So it will work.
one more try with deleting the library folder
deleting the library folder fixed it but, no unroll
Doesnt even look like it vectorized
yeah
that is odd, post your code please
hrm.............
looks identical, right?
[BurstCompile]
public unsafe struct SpellCastJobSIMD_GCD : IJobEntityBatch
{
[ReadOnly] public ComponentTypeHandle<Census> GlobalCooldownEnding_ReadHandle;
public uint tick;
public NativeArray<uint> gcdEnding_Array;
public NativeArray<bool> ignoreGlobalCooldown_Array;
public NativeArray<bool> validSpell_Array;
public void Execute(ArchetypeChunk chunk, int chunkIndex)
{
int chunkCount = chunk.Count;
var globalCooldowns = chunk.GetNativeArray(GlobalCooldownEnding_ReadHandle).Reinterpret<uint>();
MethodReadOnly(chunkCount, (uint*) globalCooldowns.GetUnsafeReadOnlyPtr());
}
[MethodImpl(MethodImplOptions.NoInlining)]
private void MethodReadOnly(int chunkCount, [NoAlias] uint* globalCooldowns)
{
for (int i = 0; i < chunkCount; i++)
{
validSpell_Array[i] = ignoreGlobalCooldown_Array[i];
validSpell_Array[i] |= globalCooldowns[i] < tick;
}
}
}```
no difference
i tried with the GetUnsafeReadOnlyPtr but got the exact same result
oh fuck... i see it now ...
what?
bool4 validspell. from a previous test ... ahhhh
right, make sure you restart Unity as a whole if you think the burst inspector is wrong, it may not have updated
a bug with 1.7
perfect simd assembly now π
man, how can you work with 1.7. This update bug is already annoying me
can access to blob data be vectorized? like such an array: public NativeArray<BlobAssetReference<SpellBlobRoot>> spellBlobs. unlikely without manual vectorization
burst not understanding structs is making this exceptionally hard π¦
sorry for the delay, I've never tried burst with blobs. They are linearly unmanaged read only arrays so they should be burst vectorizable, should be
pain
but the colors of 1.7 is so nice
The array of blob asset references (which are pointers) are linearly aligned but the data they're pointing to are not aligned with each other, preventing vectorization
expected as much, kind of weird design
so any job that uses blobdata is not vectorizable?
Yea, it's a pointer to a value issue. The pointers are aligned but the data within them are not.
No. You can have a BlobAssetReference<BlobArray<SpellBlobRoot>> and that BlobArray is vectorizable.
Because it's an array. You cant vectorize one data, well unless that data has an array in it
ah, right! ok, gonna try it
Just store the Asset somewhere common, like a singleton, and then on the entity containing a SpellBlobRoot, store the index to that BlobArray<SpellBlobRoot> for the specific SpellBlobRoot... Wait
Another problem. You're randomly accessing that blob array
Vectorization requires linear access. You're using random access indices to determine spell blob root. Unless you somehow sort the source Entities by index, you wont be able to vectorize
spellBlobs.Value.ToArray() is a memcpy. no method to nativearray or to get a subarray to align
You need to construct the blob such that it's a single universal reference that points to a collection of spell blob roots
And, as I mentioned before, you're randomly accessing that array so you wont be able to vectorize it anyways
i could setup a linear access beforehand but yeah, it's not helping me much then.
That's called denormalization and yea, it'll require a lot of memory but you'll be able to vectorize it.
it's definitely the tradeoff you need to consider, performance or memory
i've tested memcpy on the data before and it was taking way too much time
im putting my minimum specs to 16GB, 32GB recommended and 64GB for best experience in my specs
so I think that won't work out
the denormalized method would be making a component that mirrors SpellBlobRoot and then whenever a new entity is created, you'll need to copy from a "master" version.
damn, I really didn't get far with this. sadly all my code is reliant on the spell data
it really is a question of performance over memory. And that's a design decision. I really cant help ya there.
*entities. everything else dots works
*hybrid renderer. Entities works on 2022.1A16 perfectly fine. The rest, no clue.
Well, not perfectly. And Entity Inspector broke on 2022.1A14. So RIP.
Oh it does? Gotta check instantly
But now I got actually readable inspector numbers rather than dark gray text on slightly lighter gray background (EntityInspector looked nice but god damn the color choices).
Yea, i'm working on my little project now
dat project name π€£
DOTS PROGRESS
I renamed it when the CTO reappeared and I upgraded from 2020.3 directly to 2022.1. I dont trust the auto-updater for major version changes so I create a new project then copy over the files by hand
Entities 0.21 31st December confirmed
I dont believe you
And the source is on 0.23 already anyways
they wont release an old entities version
Well......2022 works already, no?
"""works"""
XD
When 2022.2 comes out and still no DOTS news, Im renaming my project to UndeadDOTS
And then when it releases:. DOTS! ..... resurrection
That project has originated from 2019.2. Nearly 3 full years later and it's still chugging along
My camera code hasnt changed since the first iteration. Nearly everything else though has been touched a few times
What would make dots truly good? Fucking finally main camera support
no need, there's only gonna be 1 camera. Why would you need to process multiple (which will also murder performance)
true wizards would somehow find a way to make 1 camera do everything
You cannot render anything when you convert main camera to entity
My greatest accomplishment was a single multipass camera
Yea, thats why you dont convert a main camera to entity
Doubt that. You need 2 cameras for any scope or similar. Can't do that with only 1
triple pass camera code that also handles raycasting and click code
But then it's not pure dots and character controllers are becoming terrible
pure dots is a pipe dream. And you wont need more than 3 cameras at most.
But still can't do anything if an entity camera can't render anything
There is a flag for conversion of camera to entity but all it does is hide the entity in the hierarchy and then makes an entity that just copies its transform to the camera. Nothing else (so far)
Exactly. I don't like it
I think there are plans to expose more camera settings in HR 1.0 found in the github leaks but I dont recall what
Camera code is fundamental Render Pipeline structure. DOTS team cant do anything fancy in camera conversion unless they want to write their own RP. And as I said earlier, people are already breaking out in wars on the forums over the separation of URP and HDRP. Imagine DOTSRP
I'd be for it. But it needs dotshdrp first and then dotsurp
oh no. Unity will never release DOTS if they decide to do that
Or the render pipeline teams just implement dots support
Yea, thats the plan. That was what the DOTS Instancing checkmark in the shadergraph was. Didnt do anything but they were planning on big things before they went radio silent and DOTS Instancing was removed.
And look at how fucked DOTS is right now. Full or even partial camera integration will take years. Maybe 2025
I'm fine with that. Just get it done eventually
Hell when they upgrade to .net 6 monobehaviours will be mid grade racing cars themselves XD
So then the copying to transform isn't that bad anymore
how would net 6 improve performance? I would imagine any improvement is compiler side which is why burst is so good
But normal c# gets a huge increase
It's not looking too good π¦
meh, 'end of the year' we're not yet there, so i am hopeful π
i said it before, i'd just be happy with their patch notes
here's the patch notes: ... but guess what, you're still not be able to make use of them for another 6 months hahaha
was a JOKE
i still am
while that's true I think working around fundamental problems that are fixed is even worse
definitely
sure, we can't say more really, like how good a fix is but it would be something. for example, if it adding/removing ends up being really fast I can rewrite much of my architecture
adding / removing?
of icomps or tags
i would be surprised if they could get more performance there. it's a whole structural change afterall so i doubt it
well, not the full picture adding/removing via enable/disable
that could end up being quite fast and is now not really possible
but also niche? kinda. even with monobehaviours i pretty much always only need the whole gameobject or none of it so enabling / disabling whole works
if you could specify an example i'd maybe better understand why that is apparently so important for so many people
it has quite a few uses for event systems or state machines
i guess
might also end up being a good solution for creating many entities in a frame
because that has quite the shitty performance
also for disabling empty buffers
'many entities' well......but only if you're talking about a few hundred thousands
yes π
which i mean even in dots you don't do that often
depends on what is being simulated
or if we want to be stuck in the same games over and over π
because, I think, that is what's holding game design back
hm. maybe. although i can't quickly imagine new game's that need this. fps' for example will probably be here for a long time. need any 100k entities every frame there?
no but i just looked at a trailer. seems like a pretty standard multiplayer game to me
maybe at the beginning stages but it scales up dramatically
100s of enemies and spell effects with 4 players
imagine that with a 10x scale and you end up with possible 100k entities a frame
might be a bit overbearing for an fps / tps though
well could be a server where not everyone is in the same space at once
i'm pretty sure though that it could be programmed without spawning entities, sure. but the whole approach with entities is very clean and it's a shame there's a scaling problem
my spell system used spells as entities in the beginning but that didn't work out. code was amazing though
i mean you can also still use object pools. would probably make sense for this
it does, were it not for the problem that writing data back to the pool is way too costly
hm, haven't checked that cause i didn't need pools yet
there's no full memcpy of data to an archetype. at least none that I know of
well, I say full. at least the chunks
do nativearrays support bools yet?
yes
ok. was just checking cause i was reading the unity.transport package and the documentation is pretty non-updated yet. but i wasn't sure
i knew burst supported bools
not sure about unity.transport, what should hold it back of doing so?
nah. just in the manual they stated: know: you can't use bool in a native array so you have to use a byte. but like i said. seems the docs have not been updated since version 0.1.0
'cause nativearrays can only hold blittable types'
maybe they still have problems in serialization?
then I really don't understand why this line is still there
I'm using NativeArray<bool> for quite some time
also if you look all the way down that page at the last annotation you see another surprise
jobs 0.0.7? π
"days" hehe
XD
there is one thing i don't like about the mathematics library for dots
the devs have specifically hidden float4.xy float4.zx and all these niceties from intellisense. why. if i hadn't had checked the math library myself because i wanted to know some implementation details at some point, i would have never known these were even a thing and i'd had needed them already
yeah, interesting choice. swizzling rules
i mean i guess they made that choice because people could infer that these were there because shaders float4 etc have them too and unity designed these after shaders, but......usually c# only has things available that are picked up by intellisense
and i mean you only have to know about them once anyway but.......get to that point in the first place XD
true
i feel like this design sucks to have conditional writes in a job and prevent increasing the version of the chunk every time
no idea how to put this inline
quite annoyting that getting the nativearray automatically increases the version number of the chunk. that's what you get when you design for dummies
now I've a damn condition everywhere. π¦
there should be an advanced variant tbh
which is even more dummy like
I should get rid of this, I don't even use DidChange haha
sometimes I think, whoa CPUs are sooo fast and then I'm like, why is this so damn slow??
mostly it's down to, how much has the cpu to jump around in memory. none? enjoy your 100x speed up
but writing code to not jump around for game mechanics. damn ...
nah dude. i get 166 errors cannot take size of, or declare pointer to a managed type ("entitycomponentstore") and others
strange. just tested a blank project and it works there
@robust scaffold regarding the previous discussion about dynamic buffers / fixed buffers: did you take a look at growablebuffer? i figured maybe that's something you might be interested in
I'll take a look tomorrow.
what's growablebuffer?
i'm going to go out on a limb here and say.. it's a buffer that can grow
it's something i stumbled upon yesterday. this package is already used by a few dots things, so it's why i figured it might be nice to look into https://docs.unity3d.com/Packages/com.unity.media.utilities@0.1/manual/index.html
ahh interesting
lots of words for no other info than Q1 2022
Oh good they finally posted this
patch notes incoming! well that's something!
ββWeβre now confident that we have reached the point where we will be able to restart releasing public patches to our packages.ββ
it's not really giving much new info other than that they are continuing the previews soon
nobody really believes on that 2022 LTS target for 1.0 though
I can tell you that's very much their goal
yes, but their goal was to release DOTS 1.0 many years ago already as well π
I do hope I'm wrong but not feeling optimistic
yes, but at least we've got what most complaining posts was about: not zero communication
Note the part about old lts not working though
So if Iβm reading this correctly, the 0.5 will have substantial changes ?
workflow seems to be similar
wouldn't expect major changes really, other than maybe hybrid rendering working better this time
there better be substantial changes given the year of non public activity π
Was this past year more about integrating surrounding tools and packages to ECS?
π€
that post mentioned nothing about getting more packages to ECS
like rewriting large chunks to accommodate improved functionality would be a blessing imo, ill take that over the current stagnation
π₯Ί @rotund token
and IMHO, they better focus on just getting the core done so people can actually start using it
Hopefully look forward to rewriting all your code with ISystem!
weeeeeeee
im ready
(for good reason as the current ISystemBase is not great and doesn't even run faster)
Illl start reading docs
doubt its gonna be any worse than going from inject and component groups or transitioning off of the old componentsystem to systembase, or ditching IJFE
I'm not sure how and very curious if and how they implemented entities.foreach
There's a lot of patterns on the forums I've seen that do not work with ISystem
Wait what balled to entities.for each?
In isystem*
Happened
not sure if I'm gonna bother with ISystem. main thread code execution is not a problem but I'm only using struct based jobs, not sure if it's better for Entities.ForEach
entities.foreach currently doesn't exist in isystembase, how could it it its a call to an inherited stub
do wish they just released it now rather than talking about releasing it
i assume they'll just use a dummy struct setup like a factory or something
there's a couple of other issues with ISystemBase currently - you can flat out just not use Unity.Physics unless you use my hack for alternate access method that doesn't require accessing the system
i'm most curious if and how Unity.Physics has been updated
I like Unity.Physics but it suffers from being a really old release and i think needs modernizing
when you mention ISystem do you mean the current ISystemBase?
yeah i believe they've renamed it (could be wrong it's very early in the morning and I could still be dreaming)
that's all
I just assume ISystemBase was released half baked, theres really no way they could shrug off SystemBase in favor of how ISystemBase works now, with stuff like physics being incompat so im not worried about that
creating command buffers, allocating nativecontainers, etc... should see an improvement in bursted ISystem OnUpdates, right?
unless their vision of 1.0 means no physics and I doubt that
ok so i've recently realized the real cost of the main
GetComponentFromEntity() etc
on old devices, lets say last gen consoles
this was actually super slow
we have this like, super AI system with a lot of these in a system
oh really, never measured any slowness on my machine. you know the reason?
moving all these calls to a function pointer
HALVED the main thread cost of our system
on last gen consoles
oh wow, which ballpark were the main thread costs in ms?
i optimized our system from 2.45ms to 0.7ms by merging jobs (reducing scheduling and queries) then 0.7ms to 0.35ms by moving Get calls to a burst function pointer
originally this AI system was like 20 separate systems
then it was merged to a single system and split via partial classes
i've managed to take it from way back like 6-8ms combined to 0.35ms on main thread
this is not an issue at all on modern platforms, but on old consoles [maybe mobile i don't work there though] huge benefit
so yeah, ISystem could have saved me a lot of optimizing efforts over the past year ^_^'
coming too late - unlikely we'll update this project as it's already EA and full release is expected around the time 0.5
but yeah, i look forward to ISystem a lot. you don't notice main thread issues in small projects
it's not till you have like 600 systems that it really starts being an issue (only 0.1ms per system over 600 systems? 6ms main thread!)
wonder if we will have sound & navigation for 0.5-1.0? wanting 1.0 out some time in 2022 seems very ambitious given such silence on those two things and also how rough anim is.
pretty sure they said not long ago that the audio hasn't been worked on recently
yeah they did, but from the old keynotes audio was kinda mentioned as one of the key components to a 1.0 release
no idea about navigation
i ported the entire recast library and pathfinding to dots nearly a year ago now
because i gave up waiting
for some reason i read that as LSystem and thought 'uhh what'
god damn replied to the wrong thing then proceeded to copy/paste the wrong text
I had the same experience, that's why I don't understand having design that utilizes queries and 10s of jobs for 1 feature
so do we think there will be substantial refactorizations required with the next update
I wouldn't expect you'd need to do much
You can still use SystemBase and I believe most of that should be unchanged
(Except for under the hood optimizations)
What's the game called?
Beyond Contact - find it on your closest steam seller π
(that said, i actually recommend against playing it until we finish the first half of our roadmap)
looks cool! hope you have success!
just looked this up is it the open world space thing? looks really cool
yeah pretty much, open world space survival future base defending story game thingy
it seems an interesting candidate for leveraging dots, was that a choice for better mobile performance etc?
I don't know how much this game scales up, from the trailer it looks like a game that could go without DOTS. Where would you say you gained the most from DOTS?
haha ok so the story about dots is kind of amusing
so the game has been in development for a while, much longer than i've worked there (i started 2 years ago)
maybe 2.5-3 years ago (before I joined) it was a single player game and they were hitting real performance issues for some reason and they wanted to add multiplayer
so they did a short 2 day game jam to learn dots and decided to rewrite the (server) with it
anyway good devs but no experience so didn't turn out great
some point after i started I think I calculated our archetype count hitting over 1 million
you spend 2 days with dots and it kind of makes sense to just add/remove components freely as the best way to use it
yeah, the entities pitfall
anyway yeah basically hired to help fix stuff up
the server these days, except action system which I just refuse to touch, is in a reasonably good shape
but the client is just a huge mess of legacy code that is trying to interact with ecs
to answer your question, not a lot
in retrospect I think it would have been a better decision to just use burst to optimize specific things (world gen etc)
that said, in theory we can scale our actor count 10x+ and really don't notice any slow down
it's just not something we do
we don't use netcode either btw, we have our own custom networking
i think either way it's important to learn this stuff and get familiar and you have to get your hands dirty to really know how it integrates etc right\
if it's taught me anything, it's what not to do
also just moving towards a more DoD approach i think is massively beneficial and in general for individuals and maybe even games companies it's about time we climbed out of some of the trappings of OOP
but yeah i still spend a lot of time writing my own libraries outside of work
we have ambitious plans for our next project that I'm going to push for pure dots i'm hoping get to make use of some of these libraries ^_^'
not that i'm ragging on OOP because it's a wonderful thing, but it's kinda lead us down a path of recklessness in a lot of ways
so yeah the problem i've found is, if you have devs that work 5 days a week they don't have time to learn how to write good dots code
thanks for the insight tertle
you need have spend time available to experiment
even just using singleton managers in an oop context can be an amazing thing as an alternative to the usual instances of inherited classes/objects etc
which is kinda pushing towards more of a dod approach, but within an oop framework i guess
the biggest fear/problem I see with how unity communicates dots and examples, etc is that the whole focus is how do you handle 10343434324 entities, and most games don't care about that
ECS as an architecture is much more interesting than rotate 10000 cubes, or do a boids simulation with a ton of stuff
i think their tiny racy showed a pretty good example for a small game using entities
random advice: if you are ever trying to hire someone for a position at a company using dots, obviously it's hard to find someone with this specific experience. your best bet is to find someone who has general DOD experience (from say blizzard or other companies that use similar approaches) rather than someone with Unity experience.
much easier to teach someone unity than teach someone a way of thinking
that is kinda true yeah.. the current take on dots/ecs is def more geared to super optimization of extreme cases.. but the benefits are massive i'd say for every use case, in terms of reducing cpu time, energy and battery usage, etc, enormous gains
most talks about ecs were usually about managing complexity, Dungeon Siege 2, deus ex, all the roguelikes that use ecs since forever, overwatch
I'd never search for a programmer with just Unity experience
almost none of those focused on raw performance
while unity focuses almost exclusively on perf
after using entities for so long, i actually find writing entities code faster now than monobehaviours for anything but the most basic of examples.
also well written code is significantly easier to debug, note the caveat on well written.
so even if it wasn't for the performance, i'm a huge fan of the architecture it encourages
How should unity show complexity if their samples are simple? π I'm not sure what you are asking. When raw performance is good you can add complexity without much worries.
Just don't fall into the Entities pitfalls like too many systems, jobs or reliance on add/remove component
I think thats one of the symptoms of the problem
using a lot of systems, reliance on add remove, etc I don't. think are using ecs bad
I think not being able to handle that in dots is due to the focus on "performance by default" seen as we can handle 2100000 entities
that said, ISystem should allow a lot more systems without these issues
because having a lot of systems can actually be very nice
is there a limit or some reason not to use a lot of systems other than performance?
has anyone written simd code with blob data?
well i mean, is there a hit per additional system in terms of performance or something along those lines
that's a stupid question isn't it
entities will evaluate if the system should run based on your main query
the main cost is just dependency handling at the end of a system
if it doesn't run it's not too bad and avoids this cost
i have not seen much problems with having many systems, what's bombing entities though is if you split up your code in let's say, 10 queries and 10 jobs which could be merged into 1 or 2
scheduling overhead, especially parallel is quite costly
not so much for Run
yeah i was thinking that.. say if you have 5 systems and four of them query the same bunch of entities
worst you can do π
there's a temptation to think 'should i just roll all this logic into one system'
but then there's a sacrifice of modularity and readability etc
utilize struct based partial jobs
so you're moving into kinda premature optimization territory
ah yeah
so what's the thinking behind that approach in general terms?
it really depends what you're doing
if this logic is all related, does it actually make sense to be separate systems?
i was going insane when I refactored Entities.ForEach code into methods because of all the parameters. Turns out you can just use methods and use the local public variables in struct based jobs and split them up nicely into several files with partials
no need to use any static methods
pretty sure i've advocated for utility structs for years!
so what's the benefit of those struct based jobs over static methods? is it not more boilerplate or whatever for the same thing?
because you don't need to do this horrible constant data pass through
public static void DoWork(Entity entity, ComponentFromEntity<Translation> translation, ComponentFromEntity<Target> targets, int speed, float max range, float elapsedTime)
(and this is a small example)
{
public ComponentFromEntity<Translation> translation;
public ComponentFromEntity<Target> targets;
public void DoWork(Entity entity, int speed, float max range, float elapsedTime)
{
}
}```
yeah i get that part.. i guess i'm just not familiar enough with jobs to know how that'd work in place of the method approach
mainly this
and the methods are all bursted
no need to add [BurstCompile] to eveyr static method
also, sometimes burst likes to complain that it can't use the parameter data type in static methods which is no problem in public methods in struct jobs
why that is? i don't really know
you don't need to add [BurstCompile] to a static method if it's called from a burst job
ah ok, never noticed
i can only recommend to start using struct based jobs instead of entities.foreach. the payoff and flexibility is huge
i tend to use ref a lot to avoid copying data when in fact i'm not always sure if it is copying data, in say the context of passing stuff into a static method inside a foreach job
a bit of a black hole in my understanding there maybe
ref inside methods is different to ref as parameter in Entities.ForEach. in the foreach it will add a writehandle and increment the chunk version
which can be quite bad sometimes if there's no write happening
ah shit yeah that makes sense, just like ref and in in the foreach itself
i think it probably disallows passing a foreach in as a ref into a static method anyway
and yeah, you have to be quite mindful about utilizing refs or the pointer address in other words because local struct copies destroy performance
yeah that was my concern with that
this is all handled much nicer and clearer in struct based jobs
i hate this auto magic approach
i'd seen some odd behavior in a couple of cases with static methods inside foreach so i kinda generally just try and avoid when possible, makes the foreach code a lot bigger though
yeah def something i should consider
once you get the hang of it, believe me, you'll write struct based jobs as quickly as foreach
it's not just that, most jobs you don't even use changefiltering on
the real issue is if you aren't writing to it, it marks the component as if you're writing to it in the query. this means burst can't optimize as much (vs readonly) and also makes the job wait on other readonly versions of this component instead of running simultaneously
oh yeah! the scheduling also breaks down or gets unclear
ah yeah good observation also, that makes sense
i'd only recommend entities.foreach for beginners. once you get used to entities, move on to more advanced types, namely IJobChunk and IJobEntityBatch
One of my biggest problems with foreach is that compilation errors in the editor never link to the correct line. I assume this is because all of the magic codegen stuff foreach is doing. Do struct-based jobs suffer from the same issue?
no
that was also getting on my nerves. haven't used them for several months now. don't miss them π
Thanks, good to know. I've messed around a little with jobs but mostly using foreach right now. Definitely annoyed by how hard it is to factor out logic into helper methods with all the parameter passing. Sounds like a win-win
also debugging broke when hitting GetComponent<T>
tertle, how realistic is in a complex game, all the "dots checks dependencies and magically will run everything it can in parallel"
i mean i think it's possible to use foreach and i'd wager get similar performance to job structs, using carefully and within the parameters of the foreach system.. but point taken definitely
very
sure, but there are limits, those are not obvious but will be when you want to scheduleParallel everything. parameters that need [NativeDisableParallelForRestriction]
these days when I run across a situation where I need to use NativeDisableParallelForRestriction I usually think to myself, should this logic be inverted
those still run in parallel. you just have to make sure that you don't do anything stupid in the job
it's not always possible or the best, but a lot of the time you can
i dislike disabling safety, we've run into a lot of random issues from these attributes randomly
you write some system, NativeDisableParallelForRestriction
2 years later, some junior dev makes a small change and bam now it's no longer safe to write to this
exactly
and you have this really obscure rare bug popping up in your project
honestly, junior dev breaking things is not a real argument π
it definitely is for the company
do you just sit him there and let him monkey around? what about some proper onboarding?
it's not about that
it's about there's no way to know this was wrong
ok remove junior dev
what about some education before applying for a job?
2 years later, some senior dev makes a small change and bam now it's no longer safe to write to this
true
if the attribute is there, be careful, make a comment and things should be clear
the attribute alone screams DANGEr
you're missing the point, it might have nothing to do with this system
you could add a component to an archetype in a completely unrelated system
exactly
say for your AI, you have contributors. previously contributors only ever point to 1 target uniquely.
you decide 2 years later ok it'd be useful for contributes to have access to multiple targets for deciding between a choice.
I don't know, that's a very general multi threading problem. I can't imagine writing multi threaded code without ever needing the attribute
but you also have another contributor that says, what is targeting me in a completely unrelated system
(just an example, but not too far off a real world case)
as i said before, it's usually an inversion of logic problem
i have one race condition in my code and i'm using interlocked.add to handle it. no care in the world what anyone is doing in other jobs/systems
while that's true there's not always a good solution to handle it
let's say for example, you want your idle AI to locate a point of interest but only 1 should ever occupy each.
The default approach would be, loop AI, check if it's idle, find an empty point of interest, assign yourself to it
i could have solved my problem without interlocked but that would add several ms to frame timing
if you invert your logic, what you do is
Loop all points of interest, if unused, find an AI and assign it to yourself
it goes from a many to one, to a one to many
completely safe
(a common example of this approach is conveyor belts)
my concrete case is, spellcasters can damage the same entity in one frame. what do you do?
i write all damage instances as an event grouped by target then iterate each target in a separate thread to apply the damage
i do all damage in a single job because i find it more useful
that sucks for performance. π
then you can apply armor reductions, mitigations, death, etc
i don't believe so
i've had the same thought as you and written around 3 approaches. all sucked. interlocked wins π
where can we apply for the lets get these guys to give a talk or make a blog post detailing how they architect their game fund?
instead of applying local data you have to write to an array, sort it in some sense, iterate over it and then apply the damage amount. what's good design about this?
it's clean, yes. no doubt but it's way too much overhead
how do you apply damage reduction from another spell shield blocking damage
or a deferred damage ability that delays damage by X seconds and prevents health reducing by 1
or a spell that absorbs 5 hits of damage then reflects it
do you hard code every check in every damage source you have in the game?
i count 3 different mechanics π my spell system can actually handle all these
i have only 1 method which applies damage and that handles prevent dieing, absorbing, reflect, etc...
anyone know if theres a way to show gameobject conversion systems in the entity debugger?
in that sense, they are hardcoded, but that's also their one place they should be so no need to make several systems/jobs that would handle this
they don't exist in the world from memory
I just want to visualize which is updating after what, kind of annoying figuring it out
and to find out if the entity has any of these effects I need a lookup into a NHM. while I don't think that's great or perfect, it performs better than any other solution I've found
@viral sonnet how many damage sources vs targets are we talking per frame and what time to calculate
250k vs 1 π
not that it'll ever be that much but that's the amount I profile with
vs 1 seems odd but ok
sure, absolute worst case
actually thats the absolute best case
that you could optimize very well
you can perfectly invert it since you know all sources would come to you without checks π°
ok, it's funny because I'm on the other side now. I was pretty much on yours before I started arguing with Kornflaks about this π
so, how would you sort this?
oh a 250k vs 1 situation is not what i'd assume you want to optimize for
this seems like a very unrealistic approach
it was just amusing to me that you said that was worst case
because if that was your actual game it'd be great!
could be against more targets, I tried with a naive NMHM and a NativeStream. I think I had something else but I forgot
if you have a race condition on targets and you only have 1, why is it not the worst case?
250k fighting for the health of 1?
what i'm suggesting is not that spells deal damage to targets
instead i'm trying to suggest the idea of targets take damage from spells
i'm not saying you can get this to work, just to think about the inversion
how to model that though? that's a huge load of data?
imagine if you just looped all things that could take damage, check if the fireball was within range of hitting you, take damage from that
yea, sounds like it'd be a good idea to limit the search space
again, i'm not claiming this necessarily the best solution to this problem, but it has been to a lot of alternate problems i've stumbled upon once i wrapped my head around this concept.
my first iteration created the spells as entities but I realized that creating persistent data that needs an additonal iteration was actually worse
(I must credit DreamingImLatios for this concept though)
this post in particular. sometimes random posts on internet are enlightening. basically why i still read so much random code and forums
I don't know, once you go low level enough it's all about how much you read and write and you'll never get better performance with more writes
Not even being able to simd the code would solve this.
the pursuit of simd can often end badly
snippet of something i was working on last weekend
yeah, I've tried hard but I'm always running against a wall π have lots of blob data but that can't be simd'ed
(this is the before picture)
spent like 3 hours optimizing this to be all nice and simd
ended up running 30% slower
ok, that's strange though
usually simd has at least 4x speedup
so i decided to write a quick performance test to see the benefit i got
yeah that took me down to earth
do you have a screen of the simd assembly? was it using vpXXX?
for the most part yeah
its only 2 less instructions
i'm definitely no expert in this area, something i'm spending a lot of time learning/experimenting
if someone knows a way to do this faster, would greatly help!
var cornerMaterials = stackalloc bool[8];
for (int z = 0; z < voxelsPerChunk; z++, materialIndex += fieldSize)
{
for (int y = 0; y < voxelsPerChunk; y++, materialIndex++)
{
for (int x = 0; x < voxelsPerChunk; x++, materialIndex++)
{
// record the on/off values at the corner of each voxel
cornerMaterials[0] = this.State[materialIndex + MaterialOffsets[0]];
cornerMaterials[1] = this.State[materialIndex + MaterialOffsets[1]];
cornerMaterials[2] = this.State[materialIndex + MaterialOffsets[2]];
cornerMaterials[3] = this.State[materialIndex + MaterialOffsets[3]];
cornerMaterials[4] = this.State[materialIndex + MaterialOffsets[4]];
cornerMaterials[5] = this.State[materialIndex + MaterialOffsets[5]];
cornerMaterials[6] = this.State[materialIndex + MaterialOffsets[6]];
cornerMaterials[7] = this.State[materialIndex + MaterialOffsets[7]];
// record the on/off values at the corner of each voxel
int cornerValues = 0;
cornerValues |= (cornerMaterials[0] ? 1 : 0) << 0;
cornerValues |= (cornerMaterials[1] ? 1 : 0) << 1;
cornerValues |= (cornerMaterials[2] ? 1 : 0) << 2;
cornerValues |= (cornerMaterials[3] ? 1 : 0) << 3;
cornerValues |= (cornerMaterials[4] ? 1 : 0) << 4;
cornerValues |= (cornerMaterials[5] ? 1 : 0) << 5;
cornerValues |= (cornerMaterials[6] ? 1 : 0) << 6;
cornerValues |= (cornerMaterials[7] ? 1 : 0) << 7;
}
}
}```
is the crux of it
the only measurable improvement i've managed to make is use 2x bool4 instead of stackalloc bool[8] for some reason this gave about a 5% boost
MaterialOffsets is a static readonly int[8]
really i just wanted to find a way to shrink this section
cornerValues |= (cornerMaterials[0] ? 1 : 0) << 0;
things i tried that appear to generate nice code but run significantly slower
this.State[materialIndex + MaterialOffsets[0]],
this.State[materialIndex + MaterialOffsets[1]],
this.State[materialIndex + MaterialOffsets[2]],
this.State[materialIndex + MaterialOffsets[3]]);
var cornerMaterialsHigh = new bool4(
this.State[materialIndex + MaterialOffsets[4]],
this.State[materialIndex + MaterialOffsets[5]],
this.State[materialIndex + MaterialOffsets[6]],
this.State[materialIndex + MaterialOffsets[7]]);
var cornerValues = (math.bitmask(cornerMaterialsHigh) << 4) | math.bitmask(cornerMaterialsLow);
this.State[materialIndex + MaterialOffsets[0]].AsByte() << 0,
this.State[materialIndex + MaterialOffsets[1]].AsByte() << 1,
this.State[materialIndex + MaterialOffsets[2]].AsByte() << 2,
this.State[materialIndex + MaterialOffsets[3]].AsByte() << 3);
var cornerMaterialsHigh = new int4(
this.State[materialIndex + MaterialOffsets[4]].AsByte() << 4,
this.State[materialIndex + MaterialOffsets[5]].AsByte() << 5,
this.State[materialIndex + MaterialOffsets[6]].AsByte() << 6,
this.State[materialIndex + MaterialOffsets[7]].AsByte() << 7);
var cornerMaterials = cornerMaterialsHigh | cornerMaterialsLow;
var cornerValues = cornerMaterials.x | cornerMaterials.y | cornerMaterials.z | cornerMaterials.w;```
At the end of the day it's probably just the array lookups that are costly and not much I can do about it.
(sorry grav i'm done spamming code please speak =D)
Haha I was just trying to figure out how to ask this. The game I'm working on is all about conveyor belts so I'm curious about your approach. The main issue I've run into is that if a conveyor is full, it cannot safely accept an item unless the downstream conveyor also accepts the item. You can either find empty spots and recursively accept items upstream, or you move everything, find conflicts, and recursively reject items upstream. Is there some other idea I should try?
are cornerValues written back to an array?
I should add that my method works fine and can run in parallel, but I'm not a fan of how I have to keep these upstream dependency chains, or hop through entity references upstream
in the actual code added to a struct with other meta data but yes
never really implemented anything conveyor belt like except this https://forum.unity.com/threads/factory-grid-movement.769628/#post-5124929 when i was excited to see if i could move stuff safely
the whole post is quite interesting btw
yeah I've read that π
ah no worries! Your response in that thread has been helpful to me
I just saw your comment above about conveyor belts and was curious if you had some new insight.
(cant believe how long ago that was now)
but yeah, apart from that post never looked at it at all
same haha
Anyways, carry on with your simd optimizations. Afraid I'm of no help there.
I've a prototype running with 1 million transport belts. the secret is to not think in small chunks but whole lines where the only break is an intersection
i feel like the factorio blog must be the gold mine for conveyor belts though
i really should read that more
the lengths of optimizations from the small amount i've read was fascinating
factorio is also doing this, summing up their pieces in transport lines
i think he did something hugely weird to save space and not store the position of the belt nodes
and instead just the offset
for memory saving
getting this to run is the easy part, setting this up is the hard part π
i probably shouldnt quote from memory though
Yeah, I got something working with that but it got quite complicated for my game. The conveyor belts in my game can be moved around quite frequently, similar to something like Infinifactory. So I would have to be rebuilding my conveyor lines quite often
Was planning to look into it again as a future optimization
rebuilding doesn't take too long performance wise but yeah, it gets quite complicated. i'm crazy and my transport belt system works on hexagons
same...
i think it's quite easy on a 4x grid
haha maybe we need to chat more haha
my hex factory game: https://twitter.com/GravitonPunch
I'm a solo developer making Automation Station, a factory automation game made with Unity DOTS/ECS! He/Him. Discord: http://discord.gg/QHqgE9kujZ
171
387
why stop at 6 sides or even 3D space
4D factory sim game will get you some headlines π
(looks nice btw like the style)
Thanks! And yeah 4d would be cool but it makes my head hurt too much
Honestly, the initial motivation for hex was that I was having trouble making a 90 degree turn in the art style I was using
looks cool! π
just have a second world base in the future that sends back material to the past world base!
so I was like, how about 60 degree turns only
oh man now i have this idea of like multi time dimension conveyor belt game in my head
no time!
good news : https://forum.unity.com/threads/dots-development-status-and-next-milestones-december-2021.1209727/
so 4 hours ago
@whole gyro you have a similar name to my first game. was called Gravity Punch! π
its a giant news post with no news π
just read about it - fantastic !!!!
alright this is getting weird
haha
So when they say 2022 LTS for DOTS 1.0, does that mean that we will be seeing the new stuff in 2022.2 alphas and betas, or that we wouldn't see anything until the LTS version is out?
hmm so first quarter of 2022 for 0.5 for 2020LTS seems also 2021LTS but not sure exactly when - anyways better than nothing
i hoped till the end of this y tbh
we all did π
damn π¦
I mean entities 0.17 works with 2022
I've heard that it doesn't work with hybrid renderer or the animation package
Correct
did u try netcode too? (for 2022)?
I'm using both, although barely using the animation package right now
I would love to move to 2022 if I could. I've been wanting some of the new URP/shadergraph stuff.
out of curiosity what sort of stuff are people hoping to see in the next few updates?
i'd quite like to see easier skinning/animation support for dots
i have a pretty good idea what's coming in entities but actually no idea what package updates will have
which is both terrifying and exciting because it's kind of the most important thing these days
i'm keeping expectations low but hoping high though
seems like they've worked on a bunch of animation tools leveraging jobs, and some of these have looked amazing, but kinda feels like they're all pointing in different directions, it'd be nice to have some solid integration with all these technologies
especially for animations, team has basically been working on this for a year and it's such an important part to get a pure solution going
yeah i'm hoping
i have a pretty good idea what's coming in entities but actually no idea - spoilers please π
fx graph to me felt like this amazing tool using a ton of low level optimization stuff that kinda nods at ecs/dots but it's bound in gameobject world and not really integrated in any way with entities etc
vfx graph does it work entirely on the gpu doesn't it? kind of it's point
much smaller in size megacity demo would be nice(for desktop that works well on my i5-4c4t and rx 480 amd) π
aye it is, but you pass data into it often frame by frame, say for example triggering projectiles or hit fx.. so as it is atm you're running that data in managed code, and it seems it'd be a no brainer to hook that up into the native ecs stuff for more streamlined stuff
so again its kinda very cool performant stuff but, kinda disconnected and it's own little ecosystem
In addition to better animation support, I would love to see something related to audio and more editor improvements. Being able to click on an entity in the scene view and see both its authoring gameobject and the converted entity in the inspector. Somehow visualize system order dependencies and job dependencies. Custom editor support for entities in the inspector and someway to hide components I don't care about (I'm looking at you Builtin Material Properties)
i think the whole graphs concept will eventually bring everything together between the gui and native data stuff etc, maybe
i haven't really used it (far from the point of adding any type of effects yet) but i assume adding native access is something they'll do at some point
So also the animation rigging thing, i saw that and thought 'amazing' this is the kind of stuff we need.. but again, does it only work with gameobject characters and Animator component etc.. it's kindof it's own thing
So dots has nailed the performance stuff, it's incredible, but i think it needs to start integrating some of the low hanging fruit, like the obvious stuff, and having those things benefit from that architecture.. it all feels massively fragmented atm.. obviously it's still early, but it's just my thoughts on it all
They've said here they're running with the hybrid approach, which is fine and understandable.. but it would be cool just to have clearer integrations with all of the core stuff
Apologizes for being a successful early adopter π
Bring on pure!
this is seriously the worst type of bug to track down
huge 8k x 8k terrain and only 1 face on seam mesh is missing
and if i get closer to a higher resolution LOD it's fine
tempted to just ignore it π
If you ignore it.. i'm sure it'll go away
Guys, i have a question about DynamicComponentTypeHandle: should it be gathered from GetDynamicTypeHandle every frame OR can i get it once from system start?
every frame (i'm pretty sure anyway)
HOLY SHIT ITS A CHRISTMAS MIRACLE. Unity acknowledged our existence!
Now time to read the actual article while on so much headache drugs
We are targeting the first quarter of 2022 for this release.
And who doubted me when I said the next DOTS won't be releasing for another year or so. Probably realistically december 2022. Mark my words.
I mean they pretty much said it themselves lol
Reading through the new article, I'm kinda concerned. Theres a lot of emphasis on hybrid and integration with the game engine and render pipelines but as someone who doesnt use HR, I might not be getting anything at all from the next update.
you just need to pay your 48-96k/year for the enterprise license for them to acknowledge you
Also @rotund token figured out your simd issue? I'm on mobile stuck in bed and on drugs so I cant quite think straight for coding
oh nah, that was last weeks problem haven't looked at it since
Quick glance of the code, are you using byte as flags or full ints?
State is a bool array
.AsByte() uses a union to implicitly convert from bool to byte without branching
the final result is stored in an int (but only needs a byte in theory)
Also somewhat disappointed that the direction doesn't seem to be focused on pure DOTS runtime.
(i should say state will likely become a byte not a bool once I add the concept of materials, but for now it's air/ground, not air, grass, dirt, etc)
So you convert 8 bools to 8 ints, which is the proper length for vectorization. I think that's the main performance loss (assuming its been autovectorized by Burst). Bools are backed by bytes but the expansion into int has no simd equivalent I believe. If you were to instead store state as an int or do all logic without conversion, performance may improve
The problem with Byte is that there are very few simd commands that support int8 for fancy operations. Addition and multiplication definitely are supported but beyond that it becomes pretty barren. Same with short ints (int16). Full ints and longs though are fully supported by AVX2.
Unless this is on mobile using ARM. Then yes, int8 and int16 are fully supported
you've got me thinking actually
it's 2x bool4 worth of data which is only 2 int length
if i changed it to index += 2 and do 2 batches at once
to pack it into 4 ints
You will need to ensure that the length of entities or whatever you're storing this info in is divisible or you will need to do remainder operation, which is really annoying
Is there a way to limit number of entities per chunk or are you using shared components to enforce it?
Oh, the chunk terminology is throwing me off
Then yea, you'll be preferably fine.
It might be better if you're doing fancy things like packing flags into 8 x ints (the length of one packed vector) to manually vectorize. It's fairly simple
oh yeah my QEF is completely hand vectorized
plenty of manual stuff going on here
so it's not something i'm uncomfortable doing
Although if you're doing 3d voxel grids, it might be even better to shove this through a compute shader. GPU wavefront will knock Burst out of the park in terms of performance
haha you say that
but this is actually a conversion of a compute shader to burst
and i'm running nearly twice as fast (except the density function which is much slower)
the density function is something i will definitely keep on the gpu
Oh no. What happened? I know theres no bitwise operations on GPU so is that where you're getting performance from?
its not my gpu implementation
it runs fast
it's just this version i've done
runs very fast
Ah. Also skip the in parameter of the function. It doesnt help as Burst will need to memcopy the data before operation
i'm pretty sure in is passed by referenced?
i actually got unity burst team to fix multiple bugs with 'in'
Ah, I just know from personal testing that usage of in resulted in unnecessary memcopy of structs when removing the in resulted in identical functionality but no memcopy. This was back in 1.6 or 1.5 burst though.
Haven't tested with 1.7
I think it was something relating to restricted operation enforced by in of the pointer to the data that stopped Burst from properly operating on the struct. Even if all actions were read only within the code, burst needed to copy the struct into a local non-in variable to properly do vectorization.
Method(in int* ptr)
flat out broke burst until 1.7
obviously this is not code you actually want
just a random bug i found by a refactor and forgetting to remove in
i just changed a bunch of 'in' to 'ref'
and burst generated the literal exact same code
Yea. There are issues with in and Burst. Ref and out though I think are fine. I dont use them though, pointers are fine for me personally.
I need to check the tea leaves as that one unity poster so nicely put it to see if unity implemented a job accessible shared component data type. Or if I need to back together one myself
That does remind me, I do need to update my ancient image processing code with actual simd. But I really dont want to touch it because it's such a mess...
oh just realized that lts 2022 is their target 1.0 release timeframe, thats a crapton of time
Yea, knowing unity 0.50 is coming out December 2022 and 1.0 maybe 2024.
We really should've gotten together and pulled apart the source for Entities but unitys strategic ambivilance and the fact that DOTS community is microscopic probably wouldnt have lead to much
pulled apart to do what though? π
At the bare minimum fix the IJobEntityBatch bug. Integrate Dreaming's library. Better understanding of code and mechanics. Maybe even some actual documentation? Ha, not the last. I can't even document my own code.
dreamings library is definitely impressive
I feel like I could easily write beginner documentation π
i feel like i'm in the minority when i say this, but i'm actually not a fan of the idea of using this library
I dont like that it kinda hijacks all the default systemgroups, some of the command buffer additions seemed totally unnecessary. Its not really a drop in library like an official dots package is, there are some things it does on first install that I dont care for at all.
I was using myrri and basically extracted it from the repo to work as a standalone thing, but unfortunately although I had it working in editor, it wouldnt play audio in a build(my fault, on its own it built fine so some sort of conflict with my project I guess), so unfortunately had to stop using it. Despite my own issues its still a ton of impressive work, and now hes tackling some sort of animation system.
oh i'm not claiming it's not good, for him. but it doesn't play well with pretty much any of the other unity packages so i can't recommend anyone use it
there's a lot of good ideas in there but i feel like the whole library stems from a disagreement with unity's direction
yeah its definitely seems like his idea of what dots should be
what's dreaming's library?
@robust scaffold looked at growable buffers yet?
great, my memory layout thread got derailed and is now about adding/removing when it was about AoS and SoA. should have been more explicit about it
but dreaming has a very solid point in merging data with this problem.
still seems like it's so hard to get a good balance. on the one hand, auto vectorization needs a single field comp. but then you have jobs that are not simd'able and reading all these small IComps destroys read speed
I'm seriously looking foward to having disabled components that are understood by queries. That's probably one of the biggest boosts and way to get a cleaner codebase in my case
very simple example, a spellcaster can either cast instant spells or cast over several frames. in the case of true casting, I've to reset the auto attack swing timer. currently I have to utilize a conditional write handle that I only acquire on that state, which not only ends up in a useless and costly condition to check for this but also prevents being able to simd the code path. other alternatives would be have another iteration but then you also end up with a conditional check plus the additonal iteration which is worse performance wise
i have a lot of these conditions that would be archetype tags. hopefully this will be a big boost
what's that?
here
@viral sonnet
thanks! really interesting
AtomicsFreeList != Atomic free list
is there an easy way to read the source code of this package without downloading it from the package manager?
i'm confused, based on this post https://forum.unity.com/threads/ecs-culling.742538/#post-4965926 they seem bad
they are apparently used a lot in the dots packages already though
no i don't think so
that's why I'm so confused. NativeContainers all those Interlocked.
what's certainly true is that atomics sometimes destroy performance with threading congestion
learned this the hard way with NativeList.ParallelWriter
what do you feel about this post https://forum.unity.com/threads/archetype-memory-layout-alternatives.1209346/#post-7724272
treating entities more as fixed bags with all their components and using enabled or disabled in them instead of adding or removing components
It's probably not unreasonable in the real world, considering how often static gameobject prefabs work out, but it feels dirty to build entities that have the data for all the systems the entity might end up interacting with at some point in the game. Like the concept is that data used 7 hours into the game is present from the beginning.. assuming a game that has significant amount of entities around for that whole duration...
i would be massively against that design
So at the end of the day if the data doesn't end up being too bloated, which it probably won't in 99% of games, it's probably the most efficient way to go about it?
But yea, fundamentally pretty disgusting imo π
Like that 7 hour journey assumes no opportunities to do this relatively slow data mangling operation, so no menu interactions, no cutscenes, no level transitions...
great, my memory layout thread got derailed and is now about adding/removing when it was about AoS and SoA. should have been more explicit about it
haha
unity will provide a good solution for adding/removing via pre-allocated IComps and enabling/disabling
the thread was not about this problem though
it's about jobs/features that are not simd'able and suffer through bad memory layout. the answer is merging data but I'm still in the belief that's not a good solution because it has way too many follow up problems. fix 1 problem, now have 2 more kind of situation
as I had more time thinking about it it's kind of unsolvable right now. you can only have either or, not both
uhm, not really as enabling/disabling would only be used on IComps that change often during runtime. For anything else adding/removing is still reasonable
Well imo it either is okay to remove and add components during your simulation or it isn't. Like "well you only need to have the framerate hitch sometimes" isn't an ideal answer.
Obviously it isn't quite as clear cut in reality, but when talking about theory and design goals
@agile dome I dont think this is the case at all, my interpretation is that components should not be added/removed repeatedly per frame, ie you should not have a RunComponent added/removed whenever your characters need to run.
i think this has been discussed before in this channel(albeit a while ago) and other ecs frameworks are better for handling those types of granularity for changes, but unity's doesnt. he mentioned component changes when say picking up/discarding an item, and that would easily happen fairly often throughout a 7hour gameplay session of any number of types of games. but constantly adding/removing components for rapid changes like shooting, running, crouching is what I see as being recommended against
Yea so maybe the message is more about avoiding a game where X amount of component changes per frame is likely
I imagine those sorts of designs would cause issues with sync points anyway?
yeah, seems like enable disable could be what they intend for rapid changes
as i understand enable/disable component saves time of archetype changing and extra archetype creation, but i have no idea how they'll keep performance of gathering entities with this extra enable/disable component condition, because now every entity should be filtered based on component state. Or it can be done in more smart way?
from forum posts entities will be gathered by bitmasks
it's fast in that it can be vectorized
but of course, slight overhead
archetypes with no disabled comps will still perform faster on iteration
Nope. I'm stuck in bed due to an ear infection and antibiotics.
Unity forum threads and getting derailed, name a more iconic duo.
Oh damn. Get well
Get well soon!
any ideas for the fastest way to parallel write multiple data based on a key other than NMHM? (because NMHM isn't that great in parallel)
or some form of sorted list
If you can somehow develop a key to finite integer, interlocked exchange might be viable against an array or list.
Otherwise, the other options for parallel race conscious options are a lot slower.
afaik NativeList uses interlocked exchange and that worked out pretty terrible in parallel writing
on the other hand, my target health interlocked add was pretty good so some performance implications are really unintuitive to me
they key would be an entity, so I could use the integer entity.index
i might give this a try. if it turns out well we could shit on the CTO opinion about interlocked again haha
(making this a running gag)
what kind of game are you making enzi?
i've not decided yet while I'm building this (asset) π it will either be an incremental game or a dungeon crawler
I confess, i'm having too much fun building assets than actual games
tool making is a lot of fun
I try to focus everything I do in enabling content creation instead of being the one to create content
sometimes we can't escape it, but every new tool that we can give our artists or game designers has a way better return on investment than us making the content
DOTS 1.0 soonβ’οΈ? π found in the URP patch notes
https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@13.1/changelog/CHANGELOG.html
oh! news! i must've missed this. thanks!
@craggy orbit no, 1.0 is targeting 2022 LTS so that could be potentially 2025
also did anyone see the unreal matrix awakens demo? https://www.youtube.com/watch?v=izpSH6LUpm4 or played it? just watching the youtube video, damn it kinda blows megacity out of the water. full integration of all their new tech, lumen, nanite, metahumans, and more, city scale and AAA polish.
will a twitter image link work https://pbs.twimg.com/media/FGOB3mmUcAABZjf?format=png&name=medium
and yet epic sucks
eh whatever you need to tell yourself
I was wondering what mass was aside from crowd sim stuff, interesting
the tech is nice but the company is not
that's fine. but stealing, screwing consumers and ill intent against competitors is not something i will overlook
XD ea
and current game studios still do it
srlsy
fifa
do they have early docs on how mass works? π
no idea, first google result was setting unreal physics mass setting so maybe its yet to materialize π
also tf2 / csgo are FPS games which are not primarily targeted at children
the sole purpose of fifa is to get people to do microtransactions. there's even been a press article about it
that's nonsense. would've happened even if valve didn't 'promote' it
ah interesting
ah okay, yea sounds like that's the usual path a product/feature would go. No point in maintaining if it's not going to be used π€·
yea no worries, I haven't even touched unreal engine π (the size of the download is really what stops me from trying to download it lol)
seems like epic are better at pushing their pace of development faster if they have a definite need for it so i dunno mass might beat dots at the current rate
All I can say regarding epic is that they are very supportive to devs using their software
wdym? it's still c++ is it not
there'll be a pure workflow eventually
just not for 1.0
omg that looks kinda like javascript
i'm pretty sure it will since they kinda hinted at it in the update post
doesn't seem like it supports ecs paradigm. it's built as a functional and oop language
Random question, I noticed that the "Changed" state on chunks seems to reset after the frame, so if something changes and then I use "WithChangeFilter<>" on it on the next frame it doesn't get picked up, is there some way to persist this into the next 1-2 frames or maybe just a different way entirely it's supposed to be done?
it should persist as long as it hasn't been reset by any system afaik
gotcha, something might be resetting it then, will check that
Do you have a ref variable on the job? Every write bumps up the chunk version so if that is running every frame you have your answer
damn that matrix demo is epic ...
The entitie 0.5 will contain enable/disable function will ?
No. Thats for 1.0. Most of the code is in there but ifdef'ed out, since there were still corner cases to fix when we branched off 0.5.
π¦ π¦ π¦
2 year feature
no we don't want to make 2 memory layouts that would support it better
eh
I'd argue, devs who need add/remove enable/disable don't care about simd code paths
I am going to skip 0.5 entirely as it seems they are planning a fairly radical departure in 1.0. Obviously for projects that are already committed to how entities works today might not have that option π
i'm not sure anymore what 0.5 even has
I am assuming 0.5's has everything the current version has, but is more mature and they are attempting to get it to a state where in 2021 LTS its stable for early adopters, but that going forward dots will be going in a bit of a different direction.
then I don't know what they did 1 year and what was 1 year turns into 2 ...
pretty pissed honestly
So is 1.0 getting released in a year or during the next year?
this announcement was pretty much what I was hoping for to be honest.
not as far as the details of course, because there were few details. But the direction at least seems like something that has a hope of being deployable in the majority of games by 2022 lts.. prior to the announcement i had little hope that would be a reality.
dots as it exists now has a lot of gaps and I wasn't expecting all of them to be solved by the end of the year.
We will see what they actually announce about 0.5 and 1.0 here soon. Until then we don't have much to go off of other than they are not focused on a pure dots solution for 1.0 and are leaning heavily on an improved hybrid/conversion workflow
end of 2022
and I'd bet a few bucks that it will not hold π
All I wish for is fully compatible ISystemBase with all job types. But I doubt that will be in there.
than what IS in there? π
with their announcement that enable/disable will take them another year, I'm going back to my thread about the sparse memory layout and would argue that my idea was better than I thought at first
they are scrambling to solve 2 problems with 1 solution
and as programmers we should now, don't fucking do it
their focus on simd code is meaningless in most cases. low level features can profit a lot from it, but game code doesn't
and I say that as someone who mainly writes game mechanics and has some grasp of good data layout and performance.
My code right now is more bursted OOP than anything else and that moulded itself to this state. The first code was pure, this is how you should do it in entities, performance was ass. Every avenue to vectorize it is bound with unsolveable problems. One can always say, you are just not good enough but meh ... not that I've heard better ideas from anyone.
What I'm saying is, not everything can be forced into 1 paradigm. I may be in the minority here but that doesn't mean I'm wrong.
and with 1 paradigm, I mean, the memory layout and not relying on add/remove or enable/disable
as the cto put it
We don't see a reason why adding / removing components frequently at runtime is a useful pattern in the first place.
Then 95% of their samples use it. I don't know what's going on here anymore. Are they blind?
If we're doing something wrong I'd like to see how it should be solved then. No one has any answers. Frustrating ...
And before anyone comes at me, I don't use add/remove, which is mostly the reason why my code needs conditions and therefore not vectorizable. well, apart from the usage of blob data which is also one of those implemented brain farts
Does anyone know how some people have access to 0.20? Who are these people and where do I apply for this?
i had a look at the ue5 Mass stuff
its essntially more or less the same as unity ECS in core design. Archetype based with a job system like thingy
its meant to be used with hybrid stuff. There are lots of components specifically made to control an Actor
like read actor location into ECS location component and the reverse
but it can also render by moving instanced meshes directly
and it comes with a new crowd and AI system that is specifically made around it
the important part is that, unlike unity ECS, it has editor support, somewhat
you can put a component into an actor that connects it into the ECS, and edit ECS components off that. Much like Entitas
unreal is so many miles ahead now, it's not even funny π
just found out, even though blob data is immutable you can't pass it in as "in". otherwise you can't make local copies of the blob data. you have to use ref there. -.-
error MayOnlyLiveInBlobStorageViolation: You may only access .ResultIgnoreFlags by (non-readonly) ref, as it may only live in blob storage. try ref BlobPtr<SpellResultIgnoreFlags> yourVariable = ref yourSpellBlobRoot.ResultIgnoreFlags
unity internals
this specifically mentions 'frequently'. frequently means 5 or more times per frame.
more or less
ofc depends on the components on the entity
i'm pretty certain frequent means one once per frame, not several times. one structural change is enough per frame to tank framerate
you don't normally modify hundreds of entities (remove / add components) every frame. it shouldn't really tank performance a lot
even for a few hundreds the hit should actually be managable.
and unity doesn't consider 'once per frame' frequent. they stated that lots of times
whatever, we are arguing about the frequency of frame rates spikes π it should be 0
you say normally you don't which is right, but then you have a condition which prevents simd
there's no solution here
either you can't use simd or you have frame rate spikes. great options π
and if you use simd with add/remove the game scales less than without simd and conditions
this might get better with enable/disable but that also means waiting for end of 2022 which is the reason why I'm in a pretty bad mood since I've read this
this feature is in total development hell so I fear for the worst honestly
end 2022 seems very reasonable tbh. we're almost there anyway
would be but it's still far enough to not be realistic target
none of the predictions so far have been even remotely close
cause we were in an experimental state
I'm just skeptical
i'm confident
yeah, I don't think this date will hold π
it's not just DOTS, it's how Unity operates
we always see things that look like they are about to land any moment now and then year+ later it's still not there
that they need this long for this feature tells me there's something majorly wrong
I don't even talk about recent years now, but like past decade
I'm not salty or anything, I get things take their time, just less optimistic on any estimates they give π
I'm not in position to judge them either, considering my own estimates for dev time tend to suck even more π
unity's got lots of resources flowing into .net migration currently
of course features are slow
i don't care much about estimations but I judge what they can get done in a given timeframe
I'm actually surprised Unity gave that specific target TBH
usually they are more vague since they've learned from the past
saying we need a year and then 2 years is pretty unspecific π
from now to 1.0 is not so much work. it'll be just a little bit more than currently. they are working massively on editor integration and hybrid workflow
this was the assumption when they left us in the dark almost year ago too
so with same logic, it should be out about.. now? π
they didn't say what they'd be doing in the 1 year when they've gone silent
I'd be more optimistic on this if they didn't still plan to make 0.5 release in the middle and just went directly to 1.0 previews
i am so excited that there IS actually a 0.5 release
cause waiting another full year for the NEXT release....that would be bad
how can you be excited for something you don't know what it is? π I have no idea what 0.5 entails
in my book, 0.17 is already stable
its's progress
also they said that the patchnotes for 0.5 will release closer to when 0.5 actually releases
so 'not knowing what is in it' is just a crap argument right now
I rather have a crap argument than none at all. We were told enable/disable is in the next release. Now it's not. And what you don't seem to be aware of, entities being moved even further back means less early adopters. As someone that wants to make a dots asset, this target audience just got pushed back 1 year or even more, because now they are not even talking about pure ecs for 1.0 anymore but just hybrid. Less interest, less sales, less direction, more rewrites. This is not a good state no matter how you put it.
def. but they never made clear statements about what would definitely be in the next release
oh they did
nah. they never specified anything definite
'Agree. This approach works well with authoring & live link.
I expect this to land somewhere between 3weeks to 3 months.
It's unclear mostly because it just really changes a massive amount of assumptions in the internals of entities that it is hard to say exactly how long it takes to ensure all of them are handled robustly and as expected. '
maybe between 3 weeks to 3 months is still a maybe
that's not a fixed statement
'excpect' 'unclear' 'hard to say'
Hi,
Im currently using Raycastcommand to dectect obstacles(physics simulation disable). So I have to call physics.SyncTransform on every Update , and that takes so long when I have like 5000 moving objects. So I wonder if moving to ECS physics will solve my problems?
And in ECS if I have only Physics Shape and no Physics Body, will collisionWorld update when I move with Translation? (For Raycasting)
I m new to ECS though
Ecs will be faster but physics donβt sync to game objects at all and you will need to learn a whole new api and way of coding. Itβs not a simple undertaking to switch if youβre new to ecs @gilded palm
@safe lintel I write in that way, render/collider is still Mono and data in ECS and sync through IJobParallelForTransform
colliders get converted, you will need to be creating all colliders in code if you want this to work without accidentally also converting render gameobjects to entities. potentially wading into a can of worms
try a simple project to see if this is something you find feasible: a cube gameobject is driven by a dots physics rigidbody, while transferring data about collisions and transforms to its actual gameobject.
maybe between 3 weeks to 3 months
just saw the timestamp on that, may 2020 π
when your worst estimation is still factor 10 off π€£
I found that whenever I spawn an entity it is visible for just a flicker at the world center before adjusting to it's assigned translation.
I was testing my projectile and noticed that it will 'collide' at world center if its target entity happens to be at world center too because of this 1 frame world center position issue.
Is there any solution to this other than just not using world center in my game?
I believe it happens because TRSToLTW system goes only in next frame, so you can spawn entity and modify it's LTW directly. Also if you use hybrid components your entity can have gameobject attached to it, which will recieve LTW only when copy system will do work, so again you can modify gameobject's transform. Or you can spawn an entity before transform system group
Setting the LTW directly worked! Thanks a bunch
Is there a way to check ComponentDataFromEntity.HasComponent(Entity e) for SharedDataComponents?
Sorry, my meaning is, is it possible to make the ComponentDataFromEntity component? When I do it the normal way I get and error
What you mean >make cdfe component?
When I try
var sharedDataFromEntity = GetComponentDataFromEntity<SharedDataComponent>(true);
I get an error
Because it can't convert ISharedDataComponent into IComponentData
Yes, because shared component is a special one, it is not stored per entity (it is stored afaik per archetype or per chunk). You can use filtering with EntityQuery or Entities.ForEach. The idea is that you get entities whic has particular shared component value, but not vice versa
will IJobParallelFor work fine with NativeList's ? I'm thinking to build mesh data with it ( vert + triangle + uv's )
Thanks again for the help and explanation. The EntityQuery should do the trick in this case I think.
sure. as long as you don't write to the same in multiple threads
that's what im worried about , i will use list push for each vertex per Execute index , on the line below i was thinking to populate the triangle data using vertex list count - 1
not sure when using parallelism will mess up the count of that NativeList or not
i mean logically speaking when i use 8 threads and each will populate 3 vertices , that sounds like a disaster ...
just parallelise your different objects, not the generation of 1
i dont know what u mean by that
List has no concurrent?
trying to convert something like this
if you want to generate meshes for e.g. 3 objects, then 1 job for each object, not multiple (parallel) jobs for 1 mesh
hmmm this is going to be one big object per mesh
so 1 parallel job for a single mesh
would not recommend that. also there's no point. even if generating a huge mesh, burst gives you incredible performance so there is absolutely no need to parallelise it
sounds about right , still keen to use parallel jobs for each mesh so hopefully burst will work fast enough on the Quest when generating terrain mesh data in runtime π€
should still be enough even non parallel. also, you'll not have the mesh density on quest anyway so the generation job has much less work to do
mesh density ?
how much vertices your mesh has
how can I use access components as the same time ?
Entites.ForEach(...).ScheduleParallel (May write)
Entites.Foreach(same query).Run (Readonly)
Anyone checked the source for the new collection package out? Looks like dispose sentinel is going to be removed. I wonder how leak detection is handled then π€. But if it's actually going to be removed you could store native collections in components and maybe even nest them (?)
hopefully not
Nesting them would be huge
Writing complex structures with full safety π€©
nesting native lists is gonna destroy performance
Oh I'm thinking more about allowing stuff like this
NativeList<Snapshot> freeSnapshots;
struct Snapshot
{
public NativeList<GhostComponent> Ghosts;
public NativeList<byte> SnapshotData;
}```
This change would also allow storing native collections in ISystems
theyve been pretty clear buffers are for list type use cases, without any hints of that changing so i kinda doubt this will change
is this similar to what KornFlaks was talking about here:
#archived-dots message
That was fixed length arrays though
functional? as in functional programming? and its performant?
yes yes no
Does UITK + new Input work with entities - i read on forum that if both are present in the project errors appear - is this fixed for 2020.3.24?
new input does not work with entities, afaik
damn
you can't sample input in a job but you can sample outside and provide an input struct to the job
man, I want the promise of ECS/DOTS so bad, and I just feel so helpless about its state, especially if UE5 is building a competing workflow
sadly they(epic) do - plus some python like scripting language will be added but not sure for what it can be used
so they are building some kind of ECS like thing over there?
i think they do even api is similar lol from what i saw
and that's Mass? or is that something else and Mass uses that?
yes, afaik it started out as crowd simulation feature
I can see why they would need to use something like ECS to accomplish that. And now they're spinning off that API for customer use?
seems like it, yes. and they are quite far ahead because rendering and animation is already done
i dislike c++ this is why i love unity and also i think their new scripting language will not be replacement for c++(not sure 100% though)
Jesus. so not liking C++ is the reason to stay? I mean look, I'd love to be making games in Lisp and Rust, I would. But... I mean C# vs C++? To me that's like being stabbed in the eyes or having bamboo under my fingernails
xd
When I'm writing burstable code I'm pretty much circumventing all of C#'s abstractions anyway
its basically C++ that lives in C# files and uses C# libraries
I don't dislike c++ it's just much easier to get into an engine with C#. At the end, C# gets into it's own way when it comes to performance so it's a blessing and a burden at the same time. Main reason I like Unity is because of multiplatform
and yeah, burst is pretty much like C++ without stupid header files
Unreal has platform restrictions?
sorry, I'm pretty ignorant
I mean right now I'm restricted to "no platforms because the software will never be finished" with Unity
I mean Fortnite is on everything, right? and that's Unreal
btw rust has pure ecs engine called bevy - but its still a baby engine
yeah, I'm sure it does. I'm a thoroughly disillusioned programmer turned data scientist, and my opinion at this point is by the time we get Rust into a shape that it gets enough adoption to create a fully fleshed out game publishing engine, we'll be producing games NoCode style with AI producing jobified artifacts that run even faster
Rust is like the John Henry of programming languages. One, final, ultimate stand before AI gets sophisticated enough to replace human coding
it will be glorious. Rust in it's full glory. Peer 2 peer, webgl compiled applications that run securely on any device and don't track your data. they'll be built by teams of expert programmers in <50% of the time that large teams produce massive coorporate funded apps.
And then 1 year later, GPT-5 will be come out, and people will just have to describe their program to a chatbot and it will get pooped out, with all the data owned by google
The point is, what the hell am I doing with my life. For all I know at the rate we're going the world is literally going to end before Unity has a paradigm that fully enables me to create my vision
Epic might be the bad guys, by god I surely do believe that, but I'm trying to get my own revolution started in videogames, and I'm ready to buy weapons from Russia if that's all it takes
Lucas Meijer personal website
yeah that's pretty cool and the logic of that decision
makes sense to me.
Nice, good read
Yes
When i use interface inheritance with IJob interfaces i get this error Failed to create job reflection data for type $IGatherPropertyJob: is there some workaround for that, or job interfaces is not supposed to be inherited?
For example
interface IGatherPropertyJob : IJobEntityBatch {}
@tight blade i feel your existentialist pain π₯²
what's the best way to convert NativeArray<float3> to Vector3[] ?
Reinterpret<vector3> ?
what's that
this is what i got right now
can't use the second overload since float3 is not subtype of vector3
NativeArray.Reinterpret<T> will return wrapper native array with T type if it has same data layout AFAIK
ooo nice
vector3 and float3 is data same
What version?
Collections 0.9.0-preview.6
Hmm, native array is part of ue, maybe you miss using unity.collections?
not sure what u mean
I mean using namespace unity.collections