#archived-dots

1 messages ยท Page 19 of 1

misty wedge
#

Is it possible to use EntityCommandBuffer.AddSharedComponent with a struct component inside of a burst context yet?

rustic rain
misty wedge
#

It didn't in 0.17, I never checked for 0.50+

#

Still doesn't seem to be doable :[

rustic rain
#

you can achieve it by custom system

devout prairie
#

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

rotund token
#

If you've already precomputed the collider isn't it just setting a component

#

No slower* than setting translation

devout prairie
#

essentially yeah, just thought i'd ask if anybody had any experience

#

yeah i should think so

rotund token
#

I switch colliders to turn off layers

devout prairie
#

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

rotund token
#

Yeah I like just having an alternate collider stored on a component

#

Which is created during conversion

devout prairie
#

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

devout prairie
#

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

devout prairie
rotund token
#

i just store another BlobAssetReference

devout prairie
#

right yeah

rotund token
#

all i do is
PhysicsCollider.Value = MyOtherComponent.NewCollider

#

swapped

devout prairie
#

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;
rotund token
#

yeah

rustic rain
#

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

devout prairie
#

just having to add an additional ref PhysicsCollider to my job in order to change collider

#

where previously i didn't require that

rustic rain
#

Might combine it with other component you use

#

It doesn't have to be separate struct

devout prairie
#

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

rustic rain
#

Nothing is rebuilt

rotund token
#

(assuming he's not using havoc)

devout prairie
rustic rain
#

Or more like, it has to be rebuilt every step

devout prairie
#

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

rustic rain
#

Different approaches

#

Don't remember details

#

But in manual Unity had wrote s detailed explanation why physics is the way it is

devout prairie
#

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

rotund token
#

dynamics are rebuilt every frame

#

statics are only rebuilt on change

devout prairie
#

that's my understanding yeah

devout prairie
#

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:

viral sonnet
#

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? :/

supple quartz
#

how to upload captured image to IMGUR from unity webgl integrated to React?๐Ÿฅบ

rotund token
rotund token
viral sonnet
#

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

rotund token
#

you'd have to manually create them and register them with burst

#

because burst couldn't compile them without manual registration

viral sonnet
#

yeah shit, that's what I expected :/

rotund token
#

ISystem laughs at our OOP concepts

viral sonnet
#

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

rotund token
#

which I assume is an instance variable unless you're a monster who names classes/structs with lower case

viral sonnet
#

in the screenshot yes ๐Ÿ™‚ i tried with both actually. i can access it only in an instance.

remote crater
#

Semi silly question: Do entities have an inherant .index property?

#

I mean one you can access on standalone, not just some debug thing.

viral sonnet
#

the entities struct has index and version

remote crater
remote crater
viral sonnet
#

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)

remote crater
remote crater
remote crater
#

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

errant hawk
rustic rain
#

Besides, keeping pointer to component data is dead end

#

Unless your archetypes are persistent

tropic venture
#

well here goes nothing

rustic rain
tropic venture
#

why do you say so? i have actually

rustic rain
#

I see

tropic venture
#

i do mention that "...Performance is not great at the moment... Profiler is showing highest work happening in Draw Opaque and Draw Transparent..."

rustic rain
#

Do you have parts of world yet?

tropic venture
#

do you mean subscenes? or like do i have a map and content in the map altogether?

rustic rain
#

Map with actual stuff on it

#

At least some test one

tropic venture
#

the former - not yet, trying to dabble & test with that, the latter yes

#

here's a random horrible screenshot

rustic rain
#

Seems like no much culling possible here

#

Just lod

tropic venture
#

why not other distant islands off to the sides ? or farther away past the view frustum end

#

or behind

rustic rain
#

If you implement some fog maybe

tropic venture
#

how/why/in what ways would it be different than mgeacity's culling & lods potential

rustic rain
#

Otherwise would be odd to see island reappear

tropic venture
#

i do have some fog actually, maybe set too low

#

or maybe i turned it off in editor when i took the screenshot

rustic rain
tropic venture
#

true ๐Ÿค”

rustic rain
#

While your screenshot only shows horizontal map

#

Have you played crysis original?

#

Very similar to fc1 design wise

tropic venture
#

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

tropic venture
rustic rain
#

Do you remember their map?

tropic venture
#

1st mission map?

rustic rain
#

And how you progress through it

#

I mean whole island

tropic venture
#

i think so... more/less

#

could look up some screenshots to refresh

rustic rain
#

Large mountain in the middle

#

Player can only see parts of beach around

tropic venture
#

true ๐Ÿค”

rustic rain
#

Or sometimes you go inside island and it's mostly jungle mountains

#

With rocks to left and right

tropic venture
#

right, a sort of path inside a valley kinda thing

rustic rain
#

Yeah

#

Even though world seems open, levels were very linear

tropic venture
#

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

rustic rain
#

Yeah

tropic venture
#

when morning breaks in that mission

rustic rain
#

No culling here, only lod

tropic venture
#

so indeed there are areas that are a bit "tunneled" that's true, but there are also rather wide large view areas too?

tropic venture
#

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?

rustic rain
#

Yeah, GPU culling itself stuff out of ciew

#

But it's CPU overhead, which supplies GPU with stuff to draw which gets discarded

tropic venture
#

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?

rustic rain
#

No idea what crysis is doing xD

tropic venture
#

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

rustic rain
#

But Hybrid Renderer indeed has some culling implementation

tropic venture
#

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...

tropic venture
#

The answers seem too good to be true ๐Ÿคฉ

#

Apparently it's mostly all automagic now

tropic venture
#

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 ๐Ÿ˜†

rotund token
#

just setup your lod how you set it up in unity normally

#

it converts fine

tropic venture
#

๐Ÿ‘Œ๐Ÿ‘Œ

#

Ah yes? LOD groups have already been ported over for ECS?

rotund token
#

yes

tropic venture
#

Awesome

#

Awesome all around

rustic rain
#

until you get to the point of animation

rotund token
#

LODGroupConversion

#

handles converting LODGroup

#

in HR

tropic venture
#

Nice

#

Oh also he mentions "HLOD"s in the talk

rotund token
#

HLODGroupConversion

tropic venture
#

Couldn't find that concept in unity docs

#

So it's ecs specific?

rotund token
#

add a HLOD component

#

yes

tropic venture
#

ah ok makes sense then

rotund token
#

if i recall

tropic venture
#

I see

rotund token
#

very simple example from me testing setting up LOD group in entities/subscene

#

just works

tropic venture
#

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?

rotund token
#

from what i understand yes

#

though i am not super familiar with it

tropic venture
#

cool

rotund token
#

and have not implemented it myself

tropic venture
#

I was playing with the ecs example project about it

dense crypt
#

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?

rustic rain
#

DynamicComponent ?

#

Never heard of it

pliant pike
#

do you mean a dynamicbuffer?

viral sonnet
#

guess he's talking about GetDynamicComponentTypeHandle

dense crypt
rustic rain
#

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

olive kite
#

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?

rustic rain
olive kite
safe lintel
#

anyone getting Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 5) ?

rustic rain
safe lintel
#

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
tropic venture
#

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

rustic rain
#

and you'll pretty much see

tropic venture
#

๐Ÿ‘Œ ok thanks will try that

#

this "Convert to entity" right here?

rustic rain
#

this or subscene

#

subscene is actually more convinient

#

because you don't even need to run game to see

#

converted entity

tropic venture
#

cool

#

what if.... i put a whole Unity Starter Assets First person Controller in there?

rustic rain
#

I have no doubts, they won't be converted

tropic venture
#

right

coarse turtle
safe lintel
#

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

rotund token
#

Are you using unsafe containers?

#

If you're using netcode you need to cap your fps (vsync)

safe lintel
#

no netcode

rotund token
#

Are you using command buffers from fixed update?

safe lintel
#

fairly certain not using unsafe containers

#

you mean fixedstepsimulationsystemgroup?

rotund token
#

Yes

#

Or any other fixed update you've setup

safe lintel
#

yeah probably

#

didnt actually realise there was a EndFixedStepSimulationEntityCommandBufferSystem but switching my buffers to use that!

rotund token
#

I'm not sure that'll fix the issue, it's usually the reverse way that causes problems

safe lintel
#

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

safe lintel
#

bah still getting it

viral sonnet
#

was there any word of the job system and entities eventually working in webgl?

safe lintel
#

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

rustic rain
#

Subscenes don't

#

Game simply doesn't load them after compile

viral sonnet
#

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.

safe lintel
#

if they get rid of runtime conversion it will be a problem

viral sonnet
#

guess i have to wait that out. subscenes are essential ๐Ÿ˜„

unborn totem
#

hello. is there a way to visualize Unity.Physics colliders in the editor?

rotund token
#

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)

unborn totem
#

sell it to me lul

rotund token
#

?

unborn totem
#

your significantly better system, I want to buy it ๐Ÿ˜›

#

so is physics debug draw component a game object component, not an entity component?

rotund token
#

it's an entity component

unborn totem
#

ok

#

i found one that is also a monobehaviour component

rotund token
#

just attach it to something and convert it

unborn totem
#

maybe an authoring one, yeah

#

i hate when they don't have the word authoring in them lul

rotund token
#

can turn things on/off through dots inspector at runtime

unborn totem
#

is that a DOTS .50 thing?

#

haven't upgraded to that yet

rotund token
#

hmm cant remember if ti works in 0.17 or not

pastel rivet
#

Just figuring out some of these channels. What's dots?

rotund token
#

we're a collective of people fixated on attempting to draw the perfect dot

vagrant lotus
#

multiple

balmy thistle
#

you have to connect the dots

#

to understand the dot product

rustic rain
#

Webgl is single thread

rustic rain
rotund token
#

@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.

devout prairie
#

@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 ๐Ÿ˜

rotund token
#

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

devout prairie
#

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

devout prairie
#

Any idea if it's possible to have a CollisionFilter be serialized and show up in the inspector for a ScriptableObject?

rotund token
#

nope

#

they didnt give it the attribute

devout prairie
#

( and reflect the categories defined in the Physics Category Names )

#

ah

rotund token
#

they use something different for this

devout prairie
#

annoying

#

i can't be bothered reverse engineering the fusion reactor for this one

rotund token
#

PhysicsMaterialProperties

#

is what they use

#

but it includes all material properties

devout prairie
#

ahhh

rotund token
#

public PhysicsCategoryTags BelongsTo

#

public PhysicsCategoryTags CollidesWith

devout prairie
#

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

rotund token
#

they have a custom drawer for them i believe

#

yeah that's what i use

devout prairie
#

superb using those 'just works'

#

thanks again

#

it shows up all of my defined categories

rotund token
#

yep they have a custom property drawer for them

devout prairie
#

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

rustic rain
devout prairie
#

So here's my as-elegant-as-possible workaround to convert my scriptable data to blob data:
So the actual struct used in systems:

rustic rain
devout prairie
#

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:

rustic rain
#

I was talking about ref local kek

#

Not sure if it's relevant to what you show now

devout prairie
#

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..

devout prairie
#

i was referring to the problem serializing collision filter

devout prairie
#

you can't initialize a ref variable in that way

rustic rain
#

Uhm

#

What you are doing here is s bit weird

devout prairie
#

sorry' i'm being thick

rustic rain
#

Why do you need ref?

#

Will pointer work instead?

devout prairie
rustic rain
#

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

devout prairie
#

How do i get the pointer?

rustic rain
#

UnsafeUtility

#

Take a look

#

Should probably have itility

devout prairie
#

So if i do this, for example:

#

i still get an error for 'use of unassigned variable weaponData' later

devout prairie
rustic rain
#

ooor

#

do a fancy cast

#

var weaponData = new IntPtr();

#

and then to assign value you have to cast pointer to (IntPtr)

devout prairie
#

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?

rustic rain
#

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

devout prairie
#

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

rustic rain
#

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

devout prairie
#

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

rustic rain
#

no

#

you will return

#

return ref new YourType();

#

and you should probably log error here or smth

#

assuming it's not meant behaviour

devout prairie
rustic rain
#

try to create local

#

and return ref of it

devout prairie
#

you'd also be returning a reference to a local object which would be deallocated

rustic rain
#

but null ref

#

is pretty much same thing

devout prairie
#

it doesn't allow this for example:

rustic rain
#

what does it say?

devout prairie
rustic rain
#

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

devout prairie
#

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)){ }
rustic rain
#

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

devout prairie
rustic rain
#

what AsRef(null) does

#

is that it creates ref to null pointer

devout prairie
#

indeed

rustic rain
#

and I have no idea what null pointer is pointing to

devout prairie
#

nothing, cos it's a null reference ๐Ÿ˜›

#

tbh, you make a good point, it's definitely something to look into at some point

rustic rain
#

it's not null reference

#

that's the thing

#

you create value reference

#

which will read bytes

#

from memory

devout prairie
#

for now, i don't need to worry about it being null, because it never is

rustic rain
#

I do wonder tho

#

what would be result

#

if you read value

#

of some large sized struct

devout prairie
#

i can't see what AsRef is doing, trying to look at the code in Collections

rustic rain
#

from null pointer

rustic rain
#

and since your ptr is null, it's ref to some unknown memory location

devout prairie
#

very dangerous business

rustic rain
#

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

devout prairie
#

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

rustic rain
#

this is the moment when you simply don't know, unless you tested or dug somehwere deep

#

xD

devout prairie
#

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

rustic rain
#

not really

#

in your case you read it

#

and you compare it to default value

#

aaaand

devout prairie
#

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 ๐Ÿ˜›

wide thicket
#

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)?

rustic rain
#

if your game is simple

#

I won't suggest doing full ECS

#

jobs + burst should be enough

wide thicket
#

Ah so you can choose which of the three areas to use within your game?

wide thicket
rustic rain
#

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

wide thicket
#

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

robust scaffold
#

Which is what I'm doing TBF.

safe lintel
#

@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

balmy thistle
#

also the product board

safe lintel
#

2d not under consideration ๐Ÿ˜ฉ

rustic rain
#

using 3D as 2D is fine

#

with a couple of extensions

safe lintel
#

I want unity to invest in dots like they do with their ads and other acquisitions

rustic rain
safe lintel
#

uh like?

viral sonnet
#

i don't know specifics either. some parts have been converted to jobs and burst. entities though, none that i know of

viral sonnet
balmy thistle
#

But with pipelining you can have a woman deliver a baby a month for nine months

viral sonnet
#

the only thing i wonder is why animations isn't more active. it doesn't seem to me entities is changing drastically

uncut rover
#

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

rustic rain
#

also Particle system is jobified probably

#

or at least bursted

wide thicket
#

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

devout prairie
viral sonnet
#

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

safe lintel
#

you mean tiny @rustic rain? afaik all that was mainthread burst

rustic rain
#

it was rewritten on C# with burst

safe lintel
#

thought 2dphysics was box2d and I dont recall them revamping it?

rustic rain
#

take a look at project settings

#

there's an option to use jobified experimental physics

safe lintel
#

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

rustic rain
#

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

safe lintel
#

"it was actually better than c++ implementation" where did they say this?

rustic rain
#

but tbh, I'm not sure

#

it was awhile ago

safe lintel
#

thats not gameobject 2d physics ๐Ÿ™‚

safe lintel
rustic rain
#

ah, this is getting into speculation zone

safe lintel
#

weta and ironsource were 6billion, its a safe assumption that dots doesnt have anywhere near that level of spending behind it

rustic rain
viral sonnet
#

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

safe lintel
#

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

viral sonnet
#

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

devout prairie
#

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

viral sonnet
#

really? i got so used to implementing IConvertGameObjectToEntity - i don't even think about it anymore

devout prairie
#

but, at least people can stop constantly saying 'its experimental use at your own risk' finally

viral sonnet
#

will it change anything being 1.0? the same stuff applies ๐Ÿ˜„

#

i'm really more interested in hybrid tbh

devout prairie
#

technically not 'experimental' i guess ๐Ÿ˜„

rotund token
#

Love waking up and reading a bunch of speculation ๐Ÿฟ

devout prairie
#

you're on the wrong side of the planet tertle

rotund token
#

Just need some drama thrown in

safe lintel
#

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

viral sonnet
#

i doubt unity will make a big fuss about 1.0 when missing so many essential features.

devout prairie
viral sonnet
#

i don't even know what that means but it sounds dirty

safe lintel
devout prairie
#

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

viral sonnet
#

that would be such a mic drop moment

safe lintel
#

dont get my hopes up! ๐Ÿ˜…

viral sonnet
#

changes are pretty much zero ๐Ÿ˜„

devout prairie
#

well if that's the case - where's all the work going

viral sonnet
#

that's what i've been wondering for a long time.

devout prairie
#

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

safe lintel
#

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

rotund token
#

I must be the only one who wasn't impressed with that matrix demo

#

Except the opening character scene

viral sonnet
#

wtf is wrong with you ๐Ÿ˜„

#

dat shit is crazy

rotund token
#

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

viral sonnet
#

afaik nanite has issues with dynamic objects. they will figure it out

rotund token
#

Frame budget for 1 character is its current limitation

viral sonnet
#

the matrix demo is not only impressive from a large scale point of view but how detailed it is

safe lintel
#

i think thats focusing on the minutiae instead of the whole picture of everything working together seamlessly

viral sonnet
#

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

devout prairie
#

i wish unity fog wasn't shit

#

that's all i ask for

#

just that

#

then we'll have movie quality games

viral sonnet
#

hdrp fog is alright.

devout prairie
#

who uses hdrp tho am i right ๐Ÿ˜›

viral sonnet
#

yeah ...

devout prairie
#

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

viral sonnet
#

but hey the scriptable render pipeline makes it easy to change rendering pipelines... oh wait

devout prairie
#

last time i tried it i lost 10-20fps right off the bat but that was quite a while ago tbf

viral sonnet
#

fps mean nothing when you have 200 overall fps ๐Ÿ™‚

#

i have a 1080 so hdrp is not that impactful

devout prairie
#

that was in the editor tbf

rotund token
#

now you just a nice 50%

#

still like it ๐Ÿ˜„

devout prairie
viral sonnet
#

yeah

devout prairie
#

must be one of the best cards that ever was

#

i never owned one but i think they're still competitive right

rotund token
#

as long as you keep raytracing off

viral sonnet
#

best gpu i ever bought. bought it when it was new and that's, god, i dunno how many years ago

devout prairie
#

i don't know the statistics but i'd guess the average desktop gpu will be like a 5-700 level

rotund token
#

but yeah 1080 in hindsight super value

viral sonnet
#

nvidia 2xxx series was really shitty. i pity every fool who invested into it ๐Ÿ˜„

#

at least when it released. it got much cheaper

devout prairie
#

cough rtx 2060s

#

i just needed an upgrade tbh at the time, was long overdue ๐Ÿ˜›

viral sonnet
#

yeah sorry, i'm mostly taking about the xx80s - the xx60s mostly have good value

devout prairie
#

yeah i think generally the top tier cards are way overpriced

#

the 1080 was expensive but it was without a doubt worth it

viral sonnet
#

exactly, starting with the 2080 it was absurd though

devout prairie
#

it outperformed everything i think right up to maybe the 2070/2080 and held ground with those?

viral sonnet
#

and don't get me started on the fking 3080

rotund token
#

worst thing about the 3xxx

#

was their RRP was really good

rustic rain
#

what's up with 3080?

rotund token
#

then mining/covid/etc

viral sonnet
#

right, msrp was, sure i'll insta buy - and then you looked at the REAL prices

#

are you kidding me

safe lintel
#

and then the damn gpu vendors marked them up as well

rotund token
#

nvidia certainly weren't happy

#

they weren't getting the extra $$

devout prairie
#

i take it there's still a chip shortage affecting gpus etc atm?

viral sonnet
#

haha if i was nvidia i'd be pissed too ๐Ÿ˜„

rotund token
#

oh no

#

excess stock, large discounts

safe lintel
#

dont get me started on how evga had their queue that only rewarded recent purchasers

rotund token
#

they seem to have delayed the 4070/4080

#

to allow 3xxx stock to ship

viral sonnet
#

3080 prices are still too high, i check every week since it relased. it's depressing

rotund token
#

it's cheaper than rrp now isn't it?

viral sonnet
#

not in europe

rustic rain
#

what do you consider fair price?

devout prairie
#

everything is more expensive in europe, software/hardware

#

and we pay more taxes

rotund token
#

3080 been as low as $999AU ($675 euro)

viral sonnet
#

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

devout prairie
#

maybe at points there were though, not sure

#

maybe that was the ti or something

viral sonnet
#

likely

rotund token
#

you pay 20% vat instead of our 10% gst (i think?)

viral sonnet
#

yeah

rotund token
#

so the base price is only 25euro more than cheapest it's ever been in aus

viral sonnet
#

yeah i'm strictly talking about consumer prices. if you buy it for the company you can shave off 20%

open shore
#

I have a capsule physics shape on my entity. Is it possible to use it to do collisionWorld.CapsuleCast?

rotund token
#

im just looking here

open shore
#

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

rotund token
#

i think yo uneed collidercast or something from memory

open shore
#

CastCollider doesn't let me set filters and other useful options

rotund token
#

because the filters is based off your physics shape

#

becase you're casting that collider

viral sonnet
rotund token
#

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

open shore
#

well, that solved my problem. ty!

rustic rain
#

that actually made me wonder whether there's way to use only shape of collider and custom filter

#

in case shape is unknown

open shore
#

Can't you clone the PhysicsCollider, modify the filter, and then cast it?

rotund token
#

Or giant switch statement ๐Ÿ˜„

open shore
#

yeah either this or that XD

rustic rain
open shore
#

and don't forget to update that switch statement if they ever add more shapes :p

rustic rain
#

or maybe I'm confusing it and filters are stored outside of blob?

open shore
#

...not that I know how to do that but it sounds like something that should be possible

rustic rain
#

yeah, but what if you were copying a very large amount of data in that case?

#

in case it's mesh collider

open shore
#

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

viral sonnet
#

you'd have to do a memcpy i think

open shore
#

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

rustic rain
#

nah, it's 1 collider per all

#

BUT

#

how do you expect to copy pointer

#

and not modify all objects

open shore
#

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

rustic rain
#

I think we're not on a same page

open shore
#

probably not

viral sonnet
#

uhm, what's this about?

viral sonnet
#

a copy from a pointer would just point to the same data

rustic rain
#

do you know whether filter of physics collider is stored on blob or not?

rotund token
#

Pretty sure it is

viral sonnet
#
  {
    public ColliderType Type;
    public CollisionType CollisionType;
    public byte Version;
    public byte Magic;
    public CollisionFilter Filter;
  }``` it's in the header the blob uses
rustic rain
#

yeah...

#

so you can't modify collider filter without copying it

viral sonnet
#

i'm not too much into physics but it seems like a flaw to have this data stored in the blob

rustic rain
#

yeah

#

pretty huge one I'd say

viral sonnet
#

love the byte Magic ... haha

#

set to 0xff - can't find any other usage

rustic rain
#

that's why it's magic

#

kek

devout prairie
#

so it allocates some unmanaged memory and memcpy's the struct data you pass in to it

#

and returns the blob reference

rustic rain
#

wha

#

SphereCollider?

devout prairie
#

yeah just as an example

rustic rain
#

no I mean

#

I don't get it xD

#

is that Unity code?

rotund token
#

That's how colliders are built

rustic rain
#

I mean, SphereCollider is probably very small size

viral sonnet
#

funny they don't use a BlobBuilder

devout prairie
#

that's how the physics library creates and allocates a collider

rustic rain
#

so, do they just store pointer to another memory?

rotund token
#

?

viral sonnet
#

physics already has a dependency to entities so why allocate it manually. weird

#

maybe a relic

devout prairie
rotund token
#

Collider (shared data)
[Sphere|Box|etc]Collider

devout prairie
#

there's a thread somewhere about how slow it is tbh

rotund token
#

Is how it's stored

#

It's basically unmanaged inheritance

devout prairie
#

haha yeahhh

rustic rain
#

wait, you mean collider contains fields for all collider types?

devout prairie
#

they use a common header struct i think

#

and some unique data for each type

rotund token
#

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

rustic rain
#

Morph structs

#

basically

#

but I'm a bit confused still

#

mesh colliders aren't supported yet?

rotund token
#

Yes they are

devout prairie
#

they are all mesh colliders i think underneath

rotund token
#

They aren't

rustic rain
#

so I don't quite get, how it's allocated

rotund token
#

Blobarray

rustic rain
#

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

open shore
#

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?

devout prairie
elfin spire
#

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

rotund token
twin raven
#

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.

elfin spire
viral sonnet
#

tertle, do you know of any sample that creates an ISystem manually?

devout prairie
#

i think the general concensus for that is have a separate physics world not running on fixed step which is manually stepped forward etc

viral sonnet
#

maybe i found it with: World.DefaultGameObjectInjectionWorld.AddSystem

rustic rain
#

And worst part - you can't go back easily

open shore
viral sonnet
viral sonnet
#

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

rotund token
#

IJobFor really your only option

rotund token
#

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

viral sonnet
#

i will change it to a systembase. this looks like i could waste hours and I'm way over my head here ๐Ÿ˜…

rotund token
#

If it makes you feel better system base should be faster in 1.0 (then again I system as well)

viral sonnet
#

it's a light system anyway. not much to profit ^^

#

i haven't even got to the thing i actually want to test

twin raven
rotund token
#

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

viral sonnet
#
    {
        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 ๐Ÿ˜…

elfin spire
rotund token
#

well you schedule it to only use 2 indices

#

then it will only use 2 threads

hot basin
#

wtf is AllocatorHandle?

rotund token
#

new allocation system in 0.5x

hot basin
#

is there any info about how to use it? quick look at entities docs gives me nothing

rotund token
#

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

hot basin
#

oh you're right

#

thanks!

twin raven
elfin spire
rotund token
#

IJobParallelFor is the deprecated version

#

It's just called IJobFor now

elfin spire
#

oh i didn't know, thanks

rotund token
#

(It's because they standardized the Schedule/ScheduleParallel calls and changing it on IJobParallelFor would break existing code)

elfin spire
#

welcome to DOTS, don't blink

#

do you use job dependencies?

rotund token
#

Of course

elfin spire
#

what are the advantages over scheduling sequential jobs by hand? in mono

rotund token
#

Automatic dependency management is an entities feature. If you're just using jobs in mono all your scheduling and dependency management is manual.

viral sonnet
#

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 ๐Ÿคฃ

elfin spire
delicate swan
#

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

rotund token
#

are you assigning the dependency but not using the returned one?

#

without code we can't really help you much

delicate swan
#
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;
    }
}```
rotund token
#
   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

delicate swan
#

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

rustic rain
#

๐Ÿค”

#

What if it's possible to create unmanaged wrapper for ecb

#

So you can use it in ISystem

rustic rain
#

And also during dependency resolving

rotund token
rustic rain
#

I wasn't able to run them

rotund token
#

you mean ECBS then

rustic rain
#

Yeah

rotund token
#

i would just wait for 1.0p1 soon

rustic rain
#

How else can you obtain ECB in Isystem

rotund token
#

new EntityCommandBuffer(Allocator.TempJob)

rustic rain
#

And how will ecbs know about it

rotund token
#

it doesn't

rustic rain
#

Exactly

rotund token
#

what's your point?

#

you can use ECB in ISystem

#

just like Ben Otter just posted

rustic rain
#

Can't ship structural changes somewhere else

rotund token
#

there are plenty of legit uses to use an ECB on the spot

#

ISystem works great with Run

rustic rain
#

I know

#

But I want to use Isystem with schedule

rotund token
#

yes but that isn't what you asked ^_^

rotund token
#

seems weird to spend a bunch of time trying to solve a problem that will be solved for you soon

rustic rain
#

Hopefully

devout prairie
#

Just curious as it's kinda anathema to the paradigm which is avoid that at all costs

rustic rain
#

And do structural changes

#

You can't do them during query

rotund token
#

from what i hear, a lot of people don't use schedule at all

#

made their entire app Run()

rustic rain
#

It would invalidate chunks iterators

rotund token
#

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```
rustic rain
#

I personally just fill native lists usually

#

Instead of using full ecb

rotund token
#

about 12% of the frame is dependency management and job scheduling

rustic rain
#

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

rotund token
#

you can already do that

rustic rain
#

Wha

#

How

#

Wait

#

Lemme guess

rotund token
#

it works better with whole worlds

rustic rain
#

Is that includes custom update on groups?

rotund token
#

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

rustic rain
#

Hmm

#

Id rather

#

Update systems manually in parallel

#

Make specific abstract group

#

And introduce maybe some interface

rotund token
#

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.

rustic rain
#

That's the point

rotund token
#

these overheads i posted above are significantly improved

rustic rain
#

Group gets to update

#

And instead of updating systems one by one

rotund token
#

it would be slower

rustic rain
#

You launch parallel execution

rotund token
#

you still have to sync your threads

#

for job scheduling

rustic rain
#

No job schedulinf

#

In parallel systems

#

It's for things that simply run on main thread

rotund token
#

i'm confused what the hell you're trying to achieve then

rustic rain
#

Maybe it's my own thing

rotund token
#

you can't make changes in parallel

#

it'd be read only

rustic rain
#

But I have quite a lot of things that don't do structural changes

#

Simply modifying some component values

rotund token
#

but you can't do that in parallel safely without a lock

rustic rain
#

Oooe

#

Oor

#

Predetermined locks

rotund token
#

you're basically creating a system for yourself

#

that is worse than the default

#

that no one else needs

rustic rain
#

Basically update order is resolved during creatiknf

rotund token
#

soon as you say order

#

the whole concept is back to locking

rustic rain
#

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

rotund token
#

the current system requires dependency completion

#

i still don't get what you're achieving with this

rustic rain
misty wedge
#

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

rustic rain
misty wedge
#

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)

elfin spire
#

Why not Nothing stops you from using

misty wedge
rustic rain
#

hmm

#

that makes me wonder

#

why pointer to pointer

#

for native collection

#

is not a thing, so you could store it in native collection

viral sonnet
#

otherwise you just get copies

misty wedge
#

Yeah, like I mentioned higher up, this is only true for lists though right?

#

e.g. UnsafeParallelHashMap should be fine

viral sonnet
#

yes those are fine because they have a pointer in the struct

misty wedge
#

Call GetUnsafeList on a NativeList?

viral sonnet
#

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 ๐Ÿ˜„

misty wedge
#

Ah, nevermind, there's another overload that's not internal ๐Ÿ‘

viral sonnet
#

ah cool. GetUnsafeList would also work fine

misty wedge
#

Is it possible to schedule an IJobParallelForDefer with an UnsafeNativeList?

hot basin
#

is performance of IJobParallelForTransform job still a garbage?

safe lintel
#

isnt it the allocation of the transformaccessarray that is the cause of gc?

hot basin
#

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

misty wedge
#

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...

hot basin
rustic rain
#

Been there for a while

hot basin
#

sadge

safe lintel
#

@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)

rotund token
misty wedge
#

Could they somehow be in the wrong order in the console? It's the first error I get

rustic rain
#

Can you show code?

dreamy glade
#

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)

misty wedge
viral sonnet
rotund token
#

It's always the second exception

misty wedge
#

I see, good to know ๐Ÿ˜…

rotund token
#

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

delicate swan
#

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!

misty wedge
#

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

rotund token
#

That seems fine

misty wedge
#

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

rotund token
#

Not without turning off safety

misty wedge
#

Alright, I think I tried it a long time ago but wasn't sure if it was ever changed

misty wedge
#

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).

viral sonnet
#

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

misty wedge
# viral sonnet however, i would always ask yhe question: do you really need the grouping from a...

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...

viral sonnet
#

i see, sounds like a job for enable/disable actually. enable/activate entities when you enter a world

misty wedge
#

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

misty wedge
#

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

viral sonnet
#

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?

misty wedge
#

Lots of different stuff. Generated textures for worlds (this is a class component), currently active chunks, world generation data, various lookups, etc

viral sonnet
#

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

misty wedge
#

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

viral sonnet
#

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?