#archived-dots
1 messages ยท Page 19 of 1
doesn't it work? if struct itself is burst compatible
if you really want such functionality
you can achieve it by custom system
anybody tested to see if switching colliders is particularly slow
current method i have for melee weapon is just continuous collide and raise events with stateful event collector
but for reasons, i'm looking at only raising events during weapon swing/attack
different approaches i could use, but for now just trying out swap to an identical collider with differnt material ( collide only with no events )
i would doubt if it's particularly slow, given i'm doing it right before build physics world, i'm guessing it just needs to update the pointer in the colliders array before building etc
If you've already precomputed the collider isn't it just setting a component
No slower* than setting translation
essentially yeah, just thought i'd ask if anybody had any experience
yeah i should think so
I switch colliders to turn off layers
some forum results on changing the collision response pointing at grabbing the pointer to the collder then changing the material
buuuuuuuuuuuuuuuuut
that means all weapons sharing that collider would change
Yeah I like just having an alternate collider stored on a component
Which is created during conversion
other option is just change the physics body tag, and ignore the event if it doesn't have that tag
but then i lose the benefit of not raising events constantly
yep that's basically what i'm gunning for right now
main objective right now is - not have the weapons damage other units when not actually attacking
so i guess by swapping collider i'll get the benefit of not raising events as often
but i'll have the additional overhead of swapping colliders often, hence the question
but yeah, should be negligable i think
do you store the collider pointer directly on the component?
i just store another BlobAssetReference
right yeah
yep
i do this elsewhere during instantiation of certain entities but i've never stored the collider actually in a component
basically just exactly how PhysicsCollider does it though right
public BlobAssetReference<Unity.Physics.Collider> ColliderBlob_NoEvent;
yeah
Why is that even an overhead
Physics build dynamic world every step
So one step they build x collider
Other step they build y collider
No structural changes or anything even
just having to add an additional ref PhysicsCollider to my job in order to change collider
where previously i didn't require that
the only possible overhead in terms of the physics build/iteration i could possibly think of was triggering a change on the bodies/colliders arrays, forcing them to rebuild - not sure if this happens or if they just rebuild every step anyway
Physics is stateless
Nothing is rebuilt
(assuming he's not using havoc)
indeed, i still require the PhysicsCollider ref however
Or more like, it has to be rebuilt every step
i'm assuming those arrays are rebuilt every step yeah,
but it would make some sense for example for them not to rebuild, if bodies/colliders don't actually change
which is regardless of state really
more of an ecs concept
Different approaches
Don't remember details
But in manual Unity had wrote s detailed explanation why physics is the way it is
if there was a non-zero chance of a physics dev in the forums we could ask these questions
or just dive into the code and check if those arrays are indeed rebuilding each step
that's my understanding yeah
so Unity.Physics.Material is a struct so i can happily get that struct, change it, and apply it elsewhere without worrying about affecting others right
hopefully this'll do it:
bit more sensible:
implementing an ISystem is not as straightforward. how would i implement this? public unsafe partial struct StatChangeSystem<TStatsConfig, TStatsIndexer> : ISystem where TStatsConfig : struct, IStatsConfig where TStatsIndexer : struct, IStatsIndexer
do i need to model this around an interface? :/
how to upload captured image to IMGUR from unity webgl integrated to React?๐ฅบ
seems like the wrong channel to be asking
oh you're trying to do a generic ISystem?
yeah I'm trying. ๐ little stuck right now how to proceed
might need to change to a SystemBase if I can't find a solution
you'd have to manually create them and register them with burst
because burst couldn't compile them without manual registration
yeah shit, that's what I expected :/
ISystem laughs at our OOP concepts
haha, structs really trip me up. might need to codegen this
i don't get some things. i can have consts in an interface, a struct implements the interface but then i can't access the const from the struct
i'm just puzzled ๐
this gets pretty meh. the nice thing about this approach was that the constants where directly compiled in the code. now i have to use a getter method in the interface. no idea if that compiles in the same way
you're using statsConfig
which I assume is an instance variable unless you're a monster who names classes/structs with lower case
in the screenshot yes ๐ i tried with both actually. i can access it only in an instance.
Semi silly question: Do entities have an inherant .index property?
I mean one you can access on standalone, not just some debug thing.
the entities struct has index and version
OOOOOH, the claw. I mean the index.
Thanks much
i dunno, maybe it was a dumb idea to make the stat system generic. right now i see 2 flaws, a) all stats are recalculated when only 1 stat change occured. b) i have to bunch up all stats in there, even stats that have actually nothing to do with each other. like combat/crafting/gathering etc... maybe that's not really an issue, they have to be saved anyway somewhere and the only problem is a)
As long as you have less than like 1000 integers, assigning them all at once doesn't take significant processing unless you changing em every frame.
Only slowdown is the rate of typing your code.
wait, wha, what is .version?
Entities can't change version
Structural changes don't cause entity version to change
The version only bumps when an index is reused when creating a new entity
tertle answered it
That's a cool and sufficient way to watch out for index reuse
if you know the size of the type(s), you can serialize it into a byte* that is big enough to house all your values. When a stat changes, you update only the portion of the memory instead of copying the entire struct, modifying it, then writing it back every time.
Don't think that'll work in any complex scenario
Besides, keeping pointer to component data is dead end
Unless your archetypes are persistent
well here goes nothing
Judging by your post you haven't even created a project yet
why do you say so? i have actually
I see
i do mention that "...Performance is not great at the moment... Profiler is showing highest work happening in Draw Opaque and Draw Transparent..."
Do you have parts of world yet?
do you mean subscenes? or like do i have a map and content in the map altogether?
the former - not yet, trying to dabble & test with that, the latter yes
here's a random horrible screenshot
why not other distant islands off to the sides ? or farther away past the view frustum end
or behind
If you implement some fog maybe
how/why/in what ways would it be different than mgeacity's culling & lods potential
Otherwise would be odd to see island reappear
i do have some fog actually, maybe set too low
or maybe i turned it off in editor when i took the screenshot
Megacity is as vertical as it's horizontal
true ๐ค
While your screenshot only shows horizontal map
Have you played crysis original?
Very similar to fc1 design wise
mine is indeed mostly intended to be horizontal. altho i havent fully played around with how high i want mountains/hills to go, but overall its a heightmap for a horizontal world yes
i have in fact
Do you remember their map?
1st mission map?
true ๐ค
Or sometimes you go inside island and it's mostly jungle mountains
With rocks to left and right
right, a sort of path inside a valley kinda thing
but then you pop over the hill and you have very far distance view of beach head village and continues all around the beach up until a very distant mountain
Yeah
when morning breaks in that mission
No culling here, only lod
so indeed there are areas that are a bit "tunneled" that's true, but there are also rather wide large view areas too?
i hear
would you say the same when in the megacity the car pops over a corner and you see like huge "downtown" or "center marketplace" kind of area with many distant buildings visible in the background
it's still culling all the other parts of the world though, no? everything left behind, everything out of view frustum, it's always culling no? and isnt crysis also? when you pop over the hill it culls away all the past areas and all the upcoming areas out of view etc thats called something other than culling?
Yeah, GPU culling itself stuff out of ciew
But it's CPU overhead, which supplies GPU with stuff to draw which gets discarded
so isn't the idea of the megacity Culling & LOD through ECS to pre-cull stuff already from CPU land? and isnt crysis also doing so probably?
No idea what crysis is doing xD
this is why i'm wondering how much of that logic is applicable to my kind of scene, and how can i implement the same
But Hybrid Renderer indeed has some culling implementation
i'm scanning the MegaCity project code but can't find more than half of what the guy is talking about in his talk...
unless maybe i'm totally missing or misunderstanding something... i'm just an aspiring Unity developer and aspiring ECS/DOTS developer trying to prototype something using lessons they gave a talk about, but finding it extremely hard to make useful sense out of the talk & out of the MegaCity project code...
The answers seem too good to be true ๐คฉ
Apparently it's mostly all automagic now
โ๏ธ
just put it all in ECS and let the hybrid renderer do most of those optimizations for you
Once again it seems my rant of the other day was unfounded - ECS is very much first class after all ๐คฉ once you do things in ECS, good assumptions & optimizations are already put in place for you, performance by default ftw
Just make your game in a sub-scene = done. You are 1st class ECS awesomeness ๐
yes
until you get to the point of animation
HLODGroupConversion
add a HLOD component
yes
though it's based off https://github.com/Unity-Technologies/HLODSystem
ah ok makes sense then
if i recall
I see
very simple example from me testing setting up LOD group in entities/subscene
just works
I was wondering if i could make huge triangle savings by doing something like replacing a whole lot of bushes on a distant hill with 1 big "bushy hill" LOD, which apparently is the idea of HLOD?
cool
and have not implemented it myself
I was playing with the ecs example project about it
Nice
Where can I find info on DynamicComponentXXX (if there is any)? I'm looking at resolving a string array to an archetype and collect all the component data. I presume that DynamicComponentXXX is what I'm looking for?
do you mean a dynamicbuffer?
guess he's talking about GetDynamicComponentTypeHandle
Yeah that one and its friends, it seems it's the only way to resolve a Type to a ComponentType, if.. I understood correctly
Type to ComponentType coversion is simply ComponentType.ReadOnly(type)
and regarding your question - you'll work with byte arrays
so you need to get struct size of each component you want to dynamically copy
potentially you can even modify fields this way
When a box collider is added manually by using (PhysicsShapeAuthoring).GetBoxProperties(); and then BoxCollider.Create, it seems to ignore the bevel used, the result just shows as a non-beveled box.
When using bevel, does it change the actual collider type?
are you looking at result through debug view?
yeah using PhysicsDebugDisplayData : DrawColliders
anyone getting Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 5) ?
why not enable full stack trace?
doing that now, not actually sure what triggers the warning tbh
yeah full trace not terribly helpful, seems to be something that occurs maybe when ive alt tabbed away from the editor for an unspecified amount of time
Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 9)
0x00007ff6dd97930d (Unity) StackWalker::GetCurrentCallstack
0x00007ff6dd97ffe9 (Unity) StackWalker::ShowCallstack
0x00007ff6de8ed613 (Unity) GetStacktrace
0x00007ff6def8223d (Unity) DebugStringToFile
0x00007ff6dd20dafc (Unity) ThreadsafeLinearAllocator<0>::Deallocate
0x00007ff6dd209801 (Unity) ThreadsafeLinearAllocator<1>::TryDeallocate
0x00007ff6dd1fc32c (Unity) MemoryManager::Deallocate
0x00007ff6dd2058aa (Unity) free_alloc_internal
0x00007ff6df00d95e (Unity) GfxDeviceWorker::RunCommand
0x00007ff6df0102ed (Unity) GfxDeviceWorker::RunExt
0x00007ff6df010408 (Unity) GfxDeviceWorker::RunGfxDeviceWorker
0x00007ff6dd706437 (Unity) Thread::RunThreadWrapper
0x00007ffb04927034 (KERNEL32) BaseThreadInitThunk
0x00007ffb05ea2651 (ntdll) RtlUserThreadStart
is there a reference somewhere where I can check which kind of gameObjects/components are ECS-ified? Like right now i'm wondering if Cameras and/or Cinemachine components have been ported to 0.51 yet or not
just try to convert gameobject with them
and you'll pretty much see
this or subscene
subscene is actually more convinient
because you don't even need to run game to see
converted entity
cool
what if.... i put a whole Unity Starter Assets First person Controller in there?
I have no doubts, they won't be converted
right
maybe your editor pauses when it loses focus? I've no idea how Unity tracks something like that ๐ค
something like that i guess, sometimes it does it(and its like 10 warnings immediately) and other times nada. could be a runtime script but then again it doesnt give me any real info to track it down
Are you using netcode?
Are you using unsafe containers?
If you're using netcode you need to cap your fps (vsync)
no netcode
Are you using command buffers from fixed update?
yeah probably
didnt actually realise there was a EndFixedStepSimulationEntityCommandBufferSystem but switching my buffers to use that!
I'm not sure that'll fix the issue, it's usually the reverse way that causes problems
im surprised my stuff wasnt throwing other errors for that mixing of ecb systems but none of those systems were run in the editor(and not playmode) which I think sometimes has the warnings, but its so random
bah still getting it
was there any word of the job system and entities eventually working in webgl?
I dont keep a close eye on webgl or 2d but its kinda surprising to see them almost abandon the 2d area with dots and the lack of anything firm regarding webgl plays into my perception of abandonment
It works
Subscenes don't
Game simply doesn't load them after compile
thanks, cool. great to hear. i haven't kept up with webgl too much. last time i used it you couldn't even multithread. huh, subscenes. weird. that might get fixed at some point. doesn't sound too much of a roadblock.
if they get rid of runtime conversion it will be a problem
guess i have to wait that out. subscenes are essential ๐
hello. is there a way to visualize Unity.Physics colliders in the editor?
physics debug draw component i think it's called (i have my own significantly better system to visualize this so it's been a while since i've used it)
sell it to me 
?
your significantly better system, I want to buy it ๐
so is physics debug draw component a game object component, not an entity component?
it's an entity component
just attach it to something and convert it
maybe an authoring one, yeah
i hate when they don't have the word authoring in them 
can turn things on/off through dots inspector at runtime
hmm cant remember if ti works in 0.17 or not
Just figuring out some of these channels. What's dots?
multiple
You can't multithread
Webgl is single thread
Why would they? There are some core things that require runtime conversion
@rustic rain well they specifically stated in their best practices a good 12+months ago they were intending to remove it
(and nothing requires runtime conversion)
however i'm not sure that's still the plan - though it was still in their 0.50/0.51 documented after they updated it
Warning: Although there are APIs that you can use to convert GameObjects to Entities at runtime (such as GameObjectConversionUtility), these will be deprecated in the future, because you should never use them in runtime code. They are far, far too slow. As such, you should convert authoring data to runtime data in the Unity Editor during the build process, and Unity should load and use only the runtime data at runtime.
@rotund token is there anyway to assign a null ref or something to this 'ref weaponData' ( it's complaining the ref has to be initialized ):
I could just do this i guess:
Actually no it's still complaining about that
i'll just cache the index ๐
i dont know
it is an annoying c# limitation that i have run into a few times
you /could/ try this
ref var weaponData = ref UnsafeUtility.AsRef<WeaponBlob>(null);
i've never tried though
and i don't know how the compiler is going to handle it
interesting thanks.. no complaints with that approach:
tbh i could just as easily store the index, but it would be a useful shortener in many cases to just have it as a variable
i briefly looked at BlobPtr but i think that can only be created by the blob builder when constructing blobs
Any idea if it's possible to have a CollisionFilter be serialized and show up in the inspector for a ScriptableObject?
they use something different for this
PhysicsMaterialProperties
is what they use
but it includes all material properties
ahhh
i was even thinking just use LayerMask but i'd have to manually set all the std physics layers to match
ahh okay thanks i'll try that
superb using those 'just works'
thanks again
it shows up all of my defined categories
yep they have a custom property drawer for them
beautiful
( ignore the layers, just randomly selected there )
what i was gunning for which would be nice is basically i use same structs in my Scriptable objects that i use in my Blob data when i convert the scriptable stuff over to blobs
then i can just assign that data straight over when i'm constructing the blobs
bloody CollisionFilter had to throw a spanner in that
Create normal VAR and assign it through ref
that doesn't work it complains blob asset can't be stored as blah blah blah
So here's my as-elegant-as-possible workaround to convert my scriptable data to blob data:
So the actual struct used in systems:
Ahem, what are doing exactly?
The version of this used in my Scriptable to account for being unable to serialize CollisionFilter:
And applying this during blob construction:
So it shows up in the inspector okay:
The whole idea being, if i add some new data to my struct or weapon or whatever, i don't have to go through an extra bunch of steps updating the scriptable -> blob data conversion etc..
yeah you interrupted
i was referring to the problem serializing collision filter
So here's the problem:
you can't initialize a ref variable in that way
sorry' i'm being thick
Originally i wanted this:
#archived-dots message
Yeah, the problem is that you can't have null ref
I suggest to cache pointer
This way
You can get ref from it afterwards
How do i get the pointer?
So if i do this, for example:
i still get an error for 'use of unassigned variable weaponData' later
Assign it as default
i think tertles suggestion works fine, but if you could show me what you suggest it might be helpful
var weaponData = default(WeaponBlob*);
ooor
do a fancy cast
var weaponData = new IntPtr();
and then to assign value you have to cast pointer to (IntPtr)
that works yeah:
although it is overall more typing than what tertle suggested
is there any particular reason you prefer this over just using UnsafeUtility.AsRef?
i mean this, to me, is simpler:
but the idea of initializing a pointer to a default object is handy to know i guess
i would guess it's allocating memory in the creation of the default struct tho right?
well, this is pretty odd
and I'm not sure
what you actually achieve here
you either assign value to local
or you assing reference to local
so, I simply suggest smth that makes sense to me xD
haha fair enough
tbh i assume it's just getting a ref to the address of the object
and interpreting it as the object type
btw
I just realised
that you can do this
with separate method
that returns ref T
so instead of assigning some null value to local
assign ready ref value through method
meanwhile in method
assign default if no value was assigned
yeah i considered using a method
actually the only reason i didn't initially was looping back to the original problem 'how do i assign a null to this' - but yeah either returning default in your case or AsRef<>(null) would work there
no
you will return
return ref new YourType();
and you should probably log error here or smth
assuming it's not meant behaviour
could you expand on that i briefly tested and it doesn't seem possible to do that
you'd also be returning a reference to a local object which would be deallocated
yeah
but null ref
is pretty much same thing
it doesn't allow this for example:
what does it say?
hm, I see
welp
I think it's simply not meant for C#
so I suggest doing pointer approach
at least that's something that is supported
and not hack
also an obvious pro here is that
you can compare pointer to default pointer
to see whether it was assigned or not
mm i suppose pass a null into AsRef could be considered hacky ๐
but it's cleaner and it does work
i don't require a null check but i think this works:
ref var weaponData = ref UnsafeUtility.AsRef<WeaponBlob>(null);
// .... //
if (weaponData.Equals(null)){ }
but it's not gonna equal null
probably never
you compare reference to null pointer
which might potentially be smth other than actual null
or maybe null pointer is reserved somehow, in which case it will
not sure tbh
well, your struct is not nullable
what AsRef(null) does
is that it creates ref to null pointer
indeed
and I have no idea what null pointer is pointing to
nothing, cos it's a null reference ๐
tbh, you make a good point, it's definitely something to look into at some point
it's not null reference
that's the thing
you create value reference
which will read bytes
from memory
for now, i don't need to worry about it being null, because it never is
I do wonder tho
what would be result
if you read value
of some large sized struct
i can't see what AsRef is doing, trying to look at the code in Collections
from null pointer
public static unsafe ref T AsRef<T>(void* ptr) where T : struct => ref (*(T*) ptr);
and since your ptr is null, it's ref to some unknown memory location
very dangerous business
that's what I meant by, it won't be equal null
because potentially
size of null pointer is 4 bytes
standard reference size
so if your struct is bigger, than you will read other bytes
i don't think it matters, it's part of using unsafe or in fact unmanaged pointers in any way right?
the rule is - know what you're doing
well yeah, that's exactly why it matter
this is the moment when you simply don't know, unless you tested or dug somehwere deep
xD
so for example - the microsoft reference for Unsafe.AsRef says:
the only case where you would have a problem there is if you tried to write to it
which would just be silly
no i just did that to demonstrate
i know the data is not a null
maybe i should deliberately throw a null at it and find out when i try to read it ๐
I understand that this is somewhat a subjective question as to what I want out of my game, but having just seen a quick intro to DOTS, is it overkill to refactor my 2D game to use DOTS?
I haven't gotten far enough into development that I can start properly testing performance (as of right now, it's not an issue)
However, I plan on having quite a few enemies on screen at once, many with custom behaviours, most of which will path-find. Am I correct in understanding that it may be more suited to DOTS?
And if so, is it worth both learning DOTS from the ground up, and then refactoring what I have so far (not a whole game, but still a fair chunk of work)?
2D is not supported in DOTS by default, so you'll have to figure hacks to overcome it
if your game is simple
I won't suggest doing full ECS
jobs + burst should be enough
Ah so you can choose which of the three areas to use within your game?
Also, as for the lack of 2D support, do you know what areas are unsupported?
To me I would assume that there wouldn't be much difference between 3D and 2D, excluding the obvious graphical side of things, is it perhaps pathfinding related or something else entirely? :)
all of them are independent packages
that work very well together
but ECS is alpha
and no built-in 2D support so...
ah yes, pathfinding... there is no built in pathfinding in ECS
๐
if your game is simple, I won't suggest you use ECS for it
allthough, nothing is impossible
I rewrote my simple 2D platformer 5 times in totally different approaches
Ok, thanks for your response!
It's probably me overthinking stuff, I guess I just don't want to fall into the trap of poor performance later on
And pathfinding, as of right now I'm using the A* package which is nice, I may have to look into making a custom one later on
:D
Dots with 2d is... pain. Don't recommend unless you get a kick out of reinventing the wheel.
Which is what I'm doing TBF.
@wide thicket unity has seemingly abandoned 2d for dots, best bet is to complain on the forums and let em know its vital for you
2d not under consideration ๐ฉ
it's ok
using 3D as 2D is fine
with a couple of extensions
I want unity to invest in dots like they do with their ads and other acquisitions
they do. A lot of existing non-dots parts are actually getting converted to dots
uh like?
i don't know specifics either. some parts have been converted to jobs and burst. entities though, none that i know of
i think they already do. it's just the 9 women can't make a baby in 1 month problem
But with pipelining you can have a woman deliver a baby a month for nine months
the only thing i wonder is why animations isn't more active. it doesn't seem to me entities is changing drastically
Entities need some big changes under the hood for enabled components apparently.
And I suspect that animations waits for both that and improvement to the hybrid renderer.
There was a post briefly in the dots forum saying that the hybrid renderer would change name to something like dots graphics but only one person e managed to respond to it before it was locked and deleted. I unfortunately could not access it, I would have kept a screen cap otherwise :p
2d physics at very least ๐
also Particle system is jobified probably
or at least bursted
lol, thanks for the input
i dont think my game will be as demanding as some and therefore need all the work put it in terms of DOTS, but i reckon i have lofty visions of it idk
Yeah pretty sure I read that for Entities 1.0 release hybrid will be renamed i think Entities.Graphics, old namespace will redirect or something to the new one for compatibility but will be removed thereafter
i don't see that as a big change. at least not one that would be such a blocker for animations
tbh, I think unity will acquire dreamings animation framework. at least they have the compute buffer animations ready then
non-compute buffer animations is still open though
you mean tiny @rustic rain? afaik all that was mainthread burst
no, i mean go physics
it was rewritten on C# with burst
thought 2dphysics was box2d and I dont recall them revamping it?
take a look at project settings
there's an option to use jobified experimental physics
while the job system has been around since prior to DOTS was a thing, I'm skeptical as if this were really possible to rewrite them as dots we wouldnt actually need ecs. im sure they are taking advantage of burst and jobs where they can but its like mecanim animation, it too uses jobs but its kind of really terrible at fully utilizing it compared to the actual dots animation package
they did it a while ago
though
and they said it was actually better than c++ implementation
ECS integration lies with ECS development
DOTS integration lies with integrating jobs + burst in classic Unity
"it was actually better than c++ implementation" where did they say this?
I think it was this
https://youtu.be/yuqM-Z-NauU
Hear about the journey of taking Havok's AAA physics engine from C++ to the land of C# and the Data-Oriented Technology Stack (DOTS). Learn about the architecture and features now available in Unity Physics, see it in action, and learn how Unity Physics and Havok Physics can work together to maximize dynamism in your games.
Speaker: Rory Mullan...
but tbh, I'm not sure
it was awhile ago
thats not gameobject 2d physics ๐
also I don't think the dots engineering team's collective salary(across all the packages) gets anywhere near the the billions that was put into acquiring ironsource, ziva, weta, speedtree, etc
ah, this is getting into speculation zone
weta and ironsource were 6billion, its a safe assumption that dots doesnt have anywhere near that level of spending behind it
assuming Unity dev gets 4k usd per month and there's a team of 20. They will get 960k in a year altogether.
dots is apparently around 50
most are European. much much more taxes
(i don't know if this is still true, most being from europe)
ironsource was a merge btw
but anyway, i see what you mean. i just don't think DOTS being 200 people would help much
i mean im totally salty its taking so long ๐ง and that areas that are currently breadwinners for unity are being ignored in dots land so just venting I guess
the longest wait up to 1.0 is done ๐
i don't know how much 1.0 means for the continued development. how fast it ramps up etc...
i'm looking forward to 1.0, i just don't see that much exciting features. i mean that in a positive way because entities is already pretty great. so authoring gets a bit nicer and more streamlined and enabled/disabled comps get introduced which i not care much about. maybe "event" systems will be great with it. i have to test this then. going the roundabout way with dedicated nativeContainers is something i do to get the most out of it but i'm also just someone who wants to be lazy and throw things at entities and have no bottlenecks. i don't imagine any enabled/disabled comps will improve my mostly optimized project but we will see
that said, i mostly look forward to the "other" stuff that will be in 1.0 - when authoring and enabled/disabled is everything ... l o l
changes to authoring are what i'm least looking forward to haha
unless they genuinely tidy things up etc and don't just change it just cos
authoring/conversion is to me by miles the most tedious and annoying part of dots
so the thought of it changing makes me think, damn, more hoops to have to jump through
really? i got so used to implementing IConvertGameObjectToEntity - i don't even think about it anymore
but, at least people can stop constantly saying 'its experimental use at your own risk' finally
will it change anything being 1.0? the same stuff applies ๐
i'm really more interested in hybrid tbh
technically not 'experimental' i guess ๐
Love waking up and reading a bunch of speculation ๐ฟ
you're on the wrong side of the planet tertle
Just need some drama thrown in
i agree that 1.0 doesnt really bring anything tangible to me, hopefully a less convoluted api for conversion ๐ but im personally looking forward to dots going from some hidden skunkworks project, to something where the majority of the public has eyes on, and hopefully getting timelines sped up a bit for other essential packages
I know unity doesnt work that way but I can dream
i doubt unity will make a big fuss about 1.0 when missing so many essential features.
"hidden skunkworks project" haha
i don't even know what that means but it sounds dirty
i was kinda thinking, maybe they pulled animation to really annoy everyone, and they intend to use it as a big surprise to elevate the launch and get everybody going 'wow animation is epic'
but i very, very much doubt that
that would be such a mic drop moment
dont get my hopes up! ๐
changes are pretty much zero ๐
well if that's the case - where's all the work going
that's what i've been wondering for a long time.
i mean, if there's around 50 devs on dots
and entities 1.0 doesn't bring 'much' in terms of changes
i doubt they're sitting around eating sandwiches all day for the past year
The Economist notes that the expectations for the products developed by skunkworks have changed in the 21st century from "something that makes their competitors say 'Wow'" to "something that makes their competitors' customers say 'Wow'". dots kinda had this going for them until nanite and lumen and that matrix demo just kinda took all the wind out from their sails
I must be the only one who wasn't impressed with that matrix demo
Except the opening character scene
The actual open world was not impressive compared to existing tech. There are lots of poor tiled buildings
The character stuff was good until your realise they could only have 1 well rendered on screen at a time
Soon as more than 1 appear quality dropped a lot
afaik nanite has issues with dynamic objects. they will figure it out
Frame budget for 1 character is its current limitation
the matrix demo is not only impressive from a large scale point of view but how detailed it is
i think thats focusing on the minutiae instead of the whole picture of everything working together seamlessly
yeah, artisticially i've seen better things
the previous demo, that was in that cave/temple was much cooler to look at. i give it that. i'm also no fan of games that take place in a city haha
that aside, everything around it blows my mind what they are pulling off
i wish unity fog wasn't shit
that's all i ask for
just that
then we'll have movie quality games
hdrp fog is alright.
who uses hdrp tho am i right ๐
yeah ...
i'm joking really, but yeah i never really saw it as an option for anything other than AAA level stuff or at least with having the option to seriously throttle it back for what are probably the vast majority of low/mid tier pc's
but hey the scriptable render pipeline makes it easy to change rendering pipelines... oh wait
last time i tried it i lost 10-20fps right off the bat but that was quite a while ago tbf
fps mean nothing when you have 200 overall fps ๐
i have a 1080 so hdrp is not that impactful
that was in the editor tbf
gtx 1080?
yeah
must be one of the best cards that ever was
i never owned one but i think they're still competitive right
as long as you keep raytracing off
best gpu i ever bought. bought it when it was new and that's, god, i dunno how many years ago
i don't know the statistics but i'd guess the average desktop gpu will be like a 5-700 level
but yeah 1080 in hindsight super value
nvidia 2xxx series was really shitty. i pity every fool who invested into it ๐
at least when it released. it got much cheaper
yeah sorry, i'm mostly taking about the xx80s - the xx60s mostly have good value
yeah i think generally the top tier cards are way overpriced
the 1080 was expensive but it was without a doubt worth it
exactly, starting with the 2080 it was absurd though
it outperformed everything i think right up to maybe the 2070/2080 and held ground with those?
and don't get me started on the fking 3080
what's up with 3080?
then mining/covid/etc
right, msrp was, sure i'll insta buy - and then you looked at the REAL prices
are you kidding me
and then the damn gpu vendors marked them up as well
i take it there's still a chip shortage affecting gpus etc atm?
haha if i was nvidia i'd be pissed too ๐
dont get me started on how evga had their queue that only rewarded recent purchasers
3080 prices are still too high, i check every week since it relased. it's depressing
it's cheaper than rrp now isn't it?
not in europe
what do you consider fair price?
3080 been as low as $999AU ($675 euro)
879 euro is the cheapest asus 3080
and yeah, i'm not paying those exact 200 euros
especially not when the 4xxx is around soon
my 1080 was around 700 euro on launch. lots of money but fair
i don't remember ever seeing a 1080 for less than 1k gbp tbh
maybe at points there were though, not sure
maybe that was the ti or something
likely
it seems to be 790-799?
you pay 20% vat instead of our 10% gst (i think?)
yeah
so the base price is only 25euro more than cheapest it's ever been in aus
yeah i'm strictly talking about consumer prices. if you buy it for the company you can shave off 20%
I have a capsule physics shape on my entity. Is it possible to use it to do collisionWorld.CapsuleCast?
im just looking here
i believe so
how? that function takes two points and a radius as parameters, I'm not sure how to extract that information from the component
I'd use CastCollider but it is very limited
i think yo uneed collidercast or something from memory
CastCollider doesn't let me set filters and other useful options
because the filters is based off your physics shape
becase you're casting that collider
filter for asus. same price on the site
well why buy the same gpu for more ๐
if you don't want to actually cast your collider
just grab the values off it and pass it to capsule cast
oh right. for some reason I was under the impression that it only stores the shape and position
well, that solved my problem. ty!
that actually made me wonder whether there's way to use only shape of collider and custom filter
in case shape is unknown
Can't you clone the PhysicsCollider, modify the filter, and then cast it?
Or giant switch statement ๐
yeah either this or that XD
it would modify all colliders that point to it
and don't forget to update that switch statement if they ever add more shapes :p
or maybe I'm confusing it and filters are stored outside of blob?
how so? if you just copy the properties into a new blank component, there won't be any connection between the clone's pointer to the original
...not that I know how to do that but it sounds like something that should be possible
yeah, but what if you were copying a very large amount of data in that case?
in case it's mesh collider
I don't think it stores the entire mesh inside the component, just a pointer to it
so it'll copy the pointer and everything will be fine
you'd have to do a memcpy i think
If I have 10 physics shapes that all use the same mesh it sounds unreasonable for unity to store 10 copies of that mesh in memory
and if you have 10000 physics shapes... well.. good luck XD
nah, it's 1 collider per all
BUT
how do you expect to copy pointer
and not modify all objects
pointer is just an integer that stores an address
and that address is the address of the mesh, it has nothing to do with the meshes that use it
I think we're not on a same page
probably not
uhm, what's this about?
started here
a copy from a pointer would just point to the same data
do you know whether filter of physics collider is stored on blob or not?
Pretty sure it is
{
public ColliderType Type;
public CollisionType CollisionType;
public byte Version;
public byte Magic;
public CollisionFilter Filter;
}``` it's in the header the blob uses
i'm not too much into physics but it seems like a flaw to have this data stored in the blob
was just looking at this:
so it allocates some unmanaged memory and memcpy's the struct data you pass in to it
and returns the blob reference
yeah just as an example
That's how colliders are built
I mean, SphereCollider is probably very small size
funny they don't use a BlobBuilder
that's how the physics library creates and allocates a collider
so, do they just store pointer to another memory?
?
physics already has a dependency to entities so why allocate it manually. weird
maybe a relic
they copy from the original struct passed in to the unmanaged allocated blob memory
Collider (shared data)
[Sphere|Box|etc]Collider
there's a thread somewhere about how slow it is tbh
haha yeahhh
wait, you mean collider contains fields for all collider types?
Collider is pretty much an interface
It just has switch statements for all things that 'inherit' it
And casts itself to that type than calls the method
It's actually an awesome pattern btw
How I built my Ai graph
Without codegen
Morph structs
basically
but I'm a bit confused still
mesh colliders aren't supported yet?
Yes they are
they are all mesh colliders i think underneath
They aren't
so I don't quite get, how it's allocated
Blobarray
oh wait
nvm
bruh
I didn't notice that this is for Sphere only
I thought it was for all colliders
That's why I was so confused xD
so I just noticed that ColliderCastHit doesn't store values like the distance, the "origin" of the collider at the moment of impact, and the normal of the collider at the impact point (only the normal of the surface is returned). Is there a way to access (some of) those values without recalculating them?
sorry i think i was referring to convex collider underneath
Hello DOTS people, is there a way to throttle job taking up cores? I'd like to limit something things to 1 or 2 cores
Yeah a lot of them use this but not all
All jobs or just 1
I am experimenting with dots physics. How can I simulate physics f.e. 10 seconds forward? I tried setting world time forward (World.SetTime), expecting physics to catch up to it, but it didn't work.
just certain jobs
tertle, do you know of any sample that creates an ISystem manually?
i'm just speaking loosely here as it's not something i've done - but as i understand it there's a method to manually trigger simulation steps
i think the general concensus for that is have a separate physics world not running on fixed step which is manually stepped forward etc
maybe i found it with: World.DefaultGameObjectInjectionWorld.AddSystem
Uughm. You gotta do 10 seconds worth of steps
And worst part - you can't go back easily
bumping this. It feels inefficient to calculate everything twice
getting ArgumentException: System type is not registered with it :/
ok, this parameter list is too much for me public static unsafe void AddUnmanagedSystemType(Type type, long typeHash, ForwardingFunc onCreate, ForwardingFunc onUpdate, ForwardingFunc onDestroy, ForwardingFunc onStartRunning, ForwardingFunc onStopRunning, ForwardingFunc onCreateForCompiler, string debugName, int burstCompileBits)public static unsafe void AddUnmanagedSystemType(Type type, long typeHash, ForwardingFunc onCreate, ForwardingFunc onUpdate, ForwardingFunc onDestroy, ForwardingFunc onStartRunning, ForwardingFunc onStopRunning, ForwardingFunc onCreateForCompiler, string debugName, int burstCompileBits) there has to be an easier way to setup a damn ISystem
well, AddSystem works fine for an ISystem. i run only into this problem because I want to make a generic ISystem
๐คฃ fun times
Just a heads up. You might get this working in editor but there's a good chance it won't work in il2cpp
Definitely need to test your solution there
i will change it to a systembase. this looks like i could waste hours and I'm way over my head here ๐
If it makes you feel better system base should be faster in 1.0 (then again I system as well)
it's a light system anyway. not much to profit ^^
i haven't even got to the thing i actually want to test
How do I manually step dots physics? Can I somehow call update on physicsworld, or am I able to call update on FixedStepSimulationSystemGroup?
Hmm if you aren't ticking whole world your time is going to be out of sync
You need to look at the rate updater in fixed step simulation group
And see what requirement it has for ticking
You probably need to just push a custom time to the world
{
public int value1 { get; }
}
public struct GenericStructImplementation1 : IGenericInterfaceTest
{
public int value1 => 200;
}
public struct GenericStructImplementation2 : IGenericInterfaceTest
{
public int value1 => 300;
}
public partial class ConstantGenericISystemTestImpl1 : ConstantGenericISystemTest<GenericStructImplementation1> { }
public partial class ConstantGenericISystemTestImpl2 : ConstantGenericISystemTest<GenericStructImplementation2> { }
[BurstCompile]
[DisableAutoCreation]
public partial class ConstantGenericISystemTest<TGeneric> : SystemBase
where TGeneric : struct, IGenericInterfaceTest
{
private TGeneric generic;
protected override void OnUpdate()
{
Debug.Log($"from system const: {generic.value1}");
Dependency = new GenericJob().Schedule(Dependency);
}
[BurstCompile]
private struct GenericJob : IJob
{
private TGeneric generic;
public void Execute()
{
//const int val = IGenericInterfaceTest.value1;
int startValue = 15;
int finalValue = startValue + generic.value1;
if (finalValue > 100)
Debug.Log($"from job const: {finalValue}");
}
}
}``` the burst assembly has a hardcoded 215 and 315. so it seems it works to use that as constants
another big โค๏ธ for burst
now i can continue with implementing different sets of stats and still have hardcoded lookup indices. very cool
i just have no idea how to get the same to work with an ISystem ๐
how?
wtf is AllocatorHandle?
new allocation system in 0.5x
is there any info about how to use it? quick look at entities docs gives me nothing
the samples shows you how to use the rewind allocator
instead of TempJob
but you can just pass Allocator.X to them and it casts fine
Thanks for pointing me to the right direction. Seems to be working with setting FixedRateCatchUpManager to FixedStepSimulationSystemGroup, setting time with World.SetTime and calling Update for FixedStepSimulationSystemGroup
is that IJobParallelFor?
oh i didn't know, thanks
(It's because they standardized the Schedule/ScheduleParallel calls and changing it on IJobParallelFor would break existing code)
Of course
what are the advantages over scheduling sequential jobs by hand? in mono
Automatic dependency management is an entities feature. If you're just using jobs in mono all your scheduling and dependency management is manual.
the best coding sessions are when you write 100s of line and your only hope is that it works exactly the same at the end ๐คฃ
ah yeah you're in ECS land so you wouldn't know if there are performance benefits in mono
Heyo, I think I am missing something or confused about the dep system; I am getting an explicit error message that I am failing to assign the this.Dependency property in a system, but I am, not really sure how to even investigate this as there is only the one system
are you assigning the dependency but not using the returned one?
without code we can't really help you much
using Unity.Collections;
using Unity.Entities;
using Unity.Jobs;
using Unity.Mathematics;
using Unity.Transforms;
[UpdateAfter(typeof(TimerSystemGroup))]
public partial class PinballSpawnerSystem : SystemBase
{
protected override void OnUpdate()
{
EntityCommandBuffer ecb = new(Allocator.TempJob);
var pcb = ecb.AsParallelWriter();
JobHandle x = default;
x = Entities
.WithName("SpawnPinballsAtPinballSpawners")
.ForEach((
int entityInQueryIndex,
in PrefabTarget prefab
) =>
{
var prefabEntity = prefab.prefabTarget;
pcb.Instantiate(entityInQueryIndex, prefabEntity);
}).ScheduleParallel(this.Dependency);
this.Dependency = x;
ecb.Playback(EntityManager);
ecb.Dispose();
return;
}
}```
ecb.Playback(EntityManager);
you can't do this here
your job is still running
you'd need to complete your dependency before this
Dependency.Complete();
ecb.Playback(EntityManager);
generally you'd use a CommandBufferSystem instead to defer the playback of the command buffer
to avoid having to complete your dependency creating a sync point
Thank you so very much, that was it, I had an assumption that the Playback method automatically accounted for the local dependency being completed, and thank you for the pointer about ecbs, this is mostly me messing around and getting the hang of order of opts, I've yet to really dig deep in with larger ecb start/stop systems and system group stuff
๐ค
What if it's possible to create unmanaged wrapper for ecb
So you can use it in ISystem
Why not? Nothing stops you from using burst during scheduling
And also during dependency resolving
you can use ECB in ISystem already
Your unmanaged ECB requires some your private libraries kek
I wasn't able to run them
you mean ECBS then
Yeah
i would just wait for 1.0p1 soon
How else can you obtain ECB in Isystem
new EntityCommandBuffer(Allocator.TempJob)
And how will ecbs know about it
it doesn't
Exactly
Can't ship structural changes somewhere else
there are plenty of legit uses to use an ECB on the spot
ISystem works great with Run
yes but that isn't what you asked ^_^
anyway ^
seems weird to spend a bunch of time trying to solve a problem that will be solved for you soon
Hopefully
This is curious do u have any examples
Just curious as it's kinda anathema to the paradigm which is avoid that at all costs
Sometimes you need to run query
And do structural changes
You can't do them during query
from what i hear, a lot of people don't use schedule at all
made their entire app Run()
It would invalidate chunks iterators
i profiled this in our own project
179/frame - Median 1.23ms, Mean 1.24ms, Min 1.02ms, Max 1.41ms
m_DependencyManager->AddDependency
171/frame - Median 0.20ms, Mean 0.24ms, Min 0.17ms, Max 0.48ms
JobHandle.ScheduleBatchedJobs
171/frame - Median 0.62ms, Mean 0.61ms, Min 0.47ms, Max 0.69ms```
about 12% of the frame is dependency management and job scheduling
Yeah, scheduled simulation should be on the heaviest parts
I hope at some point Unity will introduce parallel systems
Systems that don't do structural changes
But can run in parallel
you can already do that
it works better with whole worlds
Is that includes custom update on groups?
have a bunch of systems that use Run()
create a world with these systems
and just tick the world in a separate thread
have a dedicated thread for a separate world
use a lock to copy data forward/back
i don't really suggest this
but there are some interesting use cases for it
Hmm
Id rather
Update systems manually in parallel
Make specific abstract group
And introduce maybe some interface
just don't put anything on main thread
easy
also if you haven't been paying attention to 2022.2 betas
Core: Improved the Job System to better scale as core counts increase and reduced the cost of scheduling jobs and combining dependencies.
That's the point
these overheads i posted above are significantly improved
it would be slower
You launch parallel execution
No job schedulinf
In parallel systems
It's for things that simply run on main thread
i'm confused what the hell you're trying to achieve then
Maybe it's my own thing
But I have quite a lot of things that don't do structural changes
Simply modifying some component values
but you can't do that in parallel safely without a lock
you're basically creating a system for yourself
that is worse than the default
that no one else needs
Basically update order is resolved during creatiknf
no
the concept is same as current systems dependency
but
key difference is that it's done not every frame
but only once
so dependencies are pretty much the same
the current system requires dependency completion
i still don't get what you're achieving with this
parallel system Update
Is using (in this case setting a shared component filter and calculating entity count) allowed inside of a job if I pass the EntityQuery to it? Or is it locked to the main thread
queries are not allowed in job at all
Modifying the Capacity of an unsafe collection inside a component should be fine even without a reference to the struct right?
(or writing it back to the component for that matter)
Why not Nothing stops you from using
Actually If I'm not mistaken this seems to depend on the collection. From what I can tell UnsafeParallelHashMap stores a pointer to the UnsafeParallelHashMapData, while UnsafeList stores a direct pointer to the memory location of the first element, and would then modify the copy of the pointer, making it unsafe to change the capacity on a copy...
hmm
that makes me wonder
why pointer to pointer
for native collection
is not a thing, so you could store it in native collection
nope, you need to get the ref struct and then the ref UnsafeList. it's way easier to just put an UnsafeList<T>* in the IComp
otherwise you just get copies
Yeah, like I mentioned higher up, this is only true for lists though right?
e.g. UnsafeParallelHashMap should be fine
yes those are fine because they have a pointer in the struct
What's the easiest way to initialize the variable in this case? Stuff like UnsafeList.Create is all internal
Call GetUnsafeList on a NativeList?
UnsafeList<Entity>.Create(0, Allocator.Persistent, NativeArrayOptions.ClearMemory)
shouldn't be internal i think. is it for you?
i can't say in my project anymore ๐
ah cool. GetUnsafeList would also work fine
Is it possible to schedule an IJobParallelForDefer with an UnsafeNativeList?
is performance of IJobParallelForTransform job still a garbage?
isnt it the allocation of the transformaccessarray that is the cause of gc?
don't know, I just remember it's beeing not good ๐ that's why I'm asking. Maybe someone is using it so can share experience
I'm a bit confused by this error message:
The system X reads component Y via Job Z but that type was not assigned to the Dependency property. To ensure correct behavior of other systems, the job or a dependency must be assigned to the Dependency property before returning from the OnUpdate method.
But I'm only requesting the component in an Entities.ForEach and writing that to the Dependency property of the system...
nice https://docs.unity3d.com/Packages/com.unity.rendering.hybrid@latest redirects to 0.60 version, sign of a new dots version?
Nah, just bug
Been there for a while
sadge
@hot basin not sure if what you're asking is in relationship to the CompanionGameObjects, but iirc every frame the array is reallocated and the number of companions seems to affect how much memory is allocated, so more companions = more gc when the system runs(using IJPFT)
This actually usually means you have another exception in the system and it turned early without writing a dependency back
Could they somehow be in the wrong order in the console? It's the first error I get
Can you show code?
How do I go about modifying, say, the 2nd material on an an ECS entity's rendermesh? It seems that 'materials' does not exist for the component. Thanks.
rM.materials[1] = ...;
(Something like this is what I was hoping for)
I'll try something else first and post some if I can't fix it, I think it's something else
the best indication for this error comes out of where the error is thrown in the stacktrace
๐ฏ
It's always the second exception
I see, good to know ๐
The exception is caught then jobs debugger runs throws that first exception
Then the caught exception is debugged out
Which is why they come out of order in the log
tertle, I just want to say thanks again for helping me out yesterday, that little bit of correction on my code helped me grok the order of operations and a bunch of other things fell into place and whatnot, I was able to quickly snap together a custom world and system ordering with proper ecb systems, no more dependency errors and things are just sailing, Thank you!
What's the best way to properly schedule a Job.WithCode that relies on previous writing of some data? I'm currently using a GetBufferFromEntity and grabbing the data inside the job, instead of calling GetBuffer outside. Is that fine?
Or should I rather manually complete the job handle and then get the buffer normally
That seems fine
Something I was wondering, can you schedule multiple entities foreach jobs at the same time that write to some component data they have, but all jobs use a different shared component filter? Or is that something that is not supported
Not without turning off safety
Alright, I think I tried it a long time ago but wasn't sure if it was ever changed
Would it make more sense to use a chunk component for something like this?
For example, say I have X unique shared component data. I could optimize my job by getting some data from that shared component once per archetype chunk that is iterated. However, shared component data can't be accessed from the archetype chunk inside the job. If I write the shared component data to each chunk as a chunkcomponent I could grab the data for the entire archetype chunk inside the job once, since I know the archetype chunk being iterated all share the same sharedcomponent data (by definition).
yeah that works
however, i would always ask yhe question: do you really need the grouping from a sharedcomp?
sounds like a good solution to bridge the gap when we get burstable sharedcomps
the downside is that you get data redundancy. also updating the sharedcomp data is not as straight forward anymore
I probably don't, ideally I'd like to get rid of them.
What I currently use them for is, basically I have multiple "worlds" (not ECS worlds), which are just a place where an entity can be, e.g. one of many overworlds, a dungeon, etc. I implemented this (poorly) a long time ago, and used shared components to pass collections to jobs that update various bits of data, using a shared component filter to only collect entities that are "in" that world.
But shared components have so many limitations that I really don't like them. I've moved the majority of those collections out of systems and onto components that are on the "world" entity, which makes it much easier to access inside of jobs, but I still have some stuff left over...
i see, sounds like a job for enable/disable actually. enable/activate entities when you enter a world
The reason why my approach is terrible is that it probably even hurts performance more than it helps, since I can't schedule a lot of these updates in parallel. That's why I asked this earlier
^
So say I have 3 "worlds", and I need to update stuff, I have to schedule "World 1 Update" -> "World 2 Update" -> "World 3 Update" as a dependency chain, since I can't schedule them at the same time without disabling the safety system
I'd assume it's probably faster if I just remove the shared component grouping and update all worlds in parallel, even if that means I need to use more CDFE inside those jobs to fetch the data for the "world" the entity is on
ah so they really should run in parallel. i assumed only 1 world is active
can't you get rid of the world concept?
what data do you store there?
Lots of different stuff. Generated textures for worlds (this is a class component), currently active chunks, world generation data, various lookups, etc
ok, then the suggestion to just turn off the safety system for these jobs is probably for the best
i assume the data will be contained to these worlds so nothing can really go wrong
Yeah, it should be fine. Is there a reason why this isn't possible with the safety system on? Or just something it cannot detect currently
the safety system doesn't know about the group, just that you want to write to comp X which is used in 3 parallel jobs. makes sense it would complain there, right?