#archived-dots

1 messages ยท Page 10 of 1

rustic rain
#

so basically

#

example
type: "Asteroid"
name: "Default"

#

and then I assign blob reference to that entity

#

aaaand after I load subscene
I have prefab with blob asset reference that points to that "Asteroid" or name "Default"

#

so if I instantiate it, I always know what prefab it was instantiated from

#

now if I want to add that prefab to some database

#

I CreateAdditionalEntity()

#

and assign Entity reference to it

#

reference to that main prefab

#

and then my runtime system loops over those additional entities and adds them to dynamic database

devout prairie
#

well what i'm doing is fairly simple, but it's just giving me problems at every turn

rustic rain
#

no blobs needed

devout prairie
#

i could find a way to not use blobs but there's really nothing wrong with that approach, and when i'm not using subscenes, it works perfectly

#

in fact the problem isn't even related to the blobs themselves..

rustic rain
#

there's problem with blob database

#

it's static

#

you can't make it bigger

#

or smaller

devout prairie
#

GetPrimaryEntity for the prefab is returning the wrong Entity

rustic rain
#

did you reference your prefab?

devout prairie
viral sonnet
#

because that's normal sadly

#

what i mean it's different to the runtime entity

devout prairie
# rustic rain did you reference your prefab?

yeah it references and creates the prefab, it just doesn't return the correct primary entity for this particular prefab, whereas for the other prefab it does return the correct entity

rustic rain
#

Entities are remapped only if you assign them to Components

#

so if you assign them to blob

#

they won't be remapped

devout prairie
#

hmm let me think this one out

#

so why is one working and not the other

rustic rain
#

because if you convert in runtime

#

you create entities in actual World

#

subscene conversion is done inside it's own conversion worlds

#

at least that's what I assume

#

could be wrong

devout prairie
#

i wish i could demonstrate without flooding the chat will all of the code

viral sonnet
#

post the file :)

#

i mostly create blobs at runtime start.

#

pretty easy and you just have to put them in your own blobassetstore which needs to be disposed

devout prairie
#

well i could but that then introduces problems with the order because the subscene is loaded after systems OnCreate

#

so i'd need to create a system which looks for subscene to be loaded, and then builds the blob in OnUpdate

#

and then tell my other systems to wait until this is done

rustic rain
#

why OnUpdate

devout prairie
#

or, manually create/add my systems only once subscene data is loaded

rustic rain
#

OnStartRunning works too

devout prairie
#

hmm

viral sonnet
#

i'll ask something else. why blobs?

rustic rain
#

but I feel like you overcomplicate things xD

devout prairie
#

is that guarenteed to be after the subscene is loaded though?

rustic rain
#

if you define RequireForUpdate

#

it is

devout prairie
#

kinda going in circles tbh

#

i think i'll just not use subscene, and avoid all of these problems

#

๐Ÿ˜›

rustic rain
#

rip perfomance

#

I mean

#

loading time

devout prairie
#

i'm going to give it one more shot

#

but i'm not happy about it ๐Ÿ˜›

#

so, GetPrimaryEntity is clearly not working as expected inside my subscene

#

the thing is, the exact same code works perfectly outside of subscene, this is the annoying part

#

i literally take my authoring object, out of the subscene, and my blob is built perfectly and as expected

rustic rain
#

that doesn't get remapped

#

it's as if you grabbed index and version from Entity

#

and expected them to change after conversion

#

Entity references are remapped once subscene is loaded

safe lintel
#

shouldnt be storing entities inside of blobs

devout prairie
devout prairie
rustic rain
#

because when you inject game object

#

you are converting during runtime

devout prairie
#

i'm literally just storing a struct containing an Entity field inside a blob

rustic rain
#

welp

#

you are literally just storing int2

#

in a blob

#

and you expect it to be valid entity reference xD

devout prairie
#

exactly

#

no the point is that it works fine, during conversion, when not in a subscene

rustic rain
#

because during conversion

#

you create blob

#

in actual world

#

so the entity reference you put in there

#

is valid for this world

#

but subscene world only exists during conversion

#

that's why entities must be remapped

#

and it's done on components

devout prairie
#

there's no issue with storing the GetPrimaryEntity to the blob struct during conversion and then it failing to remap correctly, if it's not in a subscene

rustic rain
#

you can just store all your entity references in component

#

that creates blob in runtime

#

because this way

#

this component will be remapped with valid references

safe lintel
#

as issue said entities can be remapped but when stored inside of blobs they wont be

devout prairie
rustic rain
#

because in runtime

#

you create in actual your world

#

not in temporary world

devout prairie
#

i'm guessing it could be what you're hinting at above

#

yeah that

#

that makes some kind of sense

rustic rain
#

think of them as relative and absolute references

#

subscene references are relative to subscene

#

runtime conversion references are absolute

devout prairie
#

the prefabs once converted do still exist within the subscene

rustic rain
#

so when you load subscene and read references as absolute you are certainly getting an invalid result

devout prairie
#

so i guess by my logic, that relative reference inside the subscene's Convert would resolve in exactly the same way as when it's not in a subscene

rustic rain
#

if you serialize it

devout prairie
#

but i guess in the case where, a subscene creates it's own conversion world it possibly makes some kind of sense

#

tbh, i'd still expect it to work as is

rustic rain
#

how can you expect pointers created on one machine

#

work on other?

devout prairie
#

conversion that is not in a subscene still uses it's own conversion world, this is why i don't get there's a difference

rustic rain
#

can you actually check?

#

read dstWorld

#

in your runtime conversion

#

and compare

#

to your actual game world

#

is it same reference?

devout prairie
#

right so i'm guessing it isn't

#

is, sorry

#

but in subscene, dstWorld is not the same

rustic rain
#

yep

#

thus references are invalid

#

when you wrap them

#

in blob

#

store them in component instead

#

and they will be valid

#

because they will be remapped during subscene loading

devout prairie
#

haha okay i think i get it

#

damn

rustic rain
#

man, I just realised

devout prairie
#

still infuriating though

rustic rain
#

that Unity has entity remapper

#

and they didn't expose it

#

sadkek

#

would make creation of save/load so much easier

safe lintel
#

why the desire to store in blobs anyway? I sort of get it when I want to do something one way and it doesnt work, its sometimes hard to let go

rustic rain
#

I don't get it either

#

in fact

#

you could probably just use chunks as your database

#

and use temporary queries

#

to get all lists of prefabs

devout prairie
#

well why not use blobs?

rustic rain
#

hehe

devout prairie
#

they are specifically for static data

safe lintel
#

well the whole no remapping thing ๐Ÿ˜…

rustic rain
#

and your prefabs aren't

safe lintel
#

yeah but entities themselves arent necessarily static

devout prairie
#

well the idea is, once the prefabs are created by conversion, they are static at least until they are destroyed

rustic rain
#

so

#

why can't you just do

devout prairie
#

so all i'm doing is storing my unit data ( health etc etc ) along with the prefab entity

rustic rain
#

query.GetNativeArray()

#

if it's static

#

you will have persistent array

#

of any valid component you want

#

health, entity, etc

devout prairie
#

again, why not use blobs

#

it's what they're for

rustic rain
#

I wouldn't agree

devout prairie
#

say i have 10 types of unit right..

#

each one is basically similar, but have different health, etc etc

#

i could create an entity/component setup just to store all of those templates yeah

#

or, i could just store it in a blob

#

i don't get the problem

#

it's literally just a struct of all of the unit data, that i can dip into when i'm spawning a unit

rustic rain
#

well, the obvious problem is that you create blob at the wrong time xD

devout prairie
#

spawn system says 'ok i need to spawn x unit', it then dips into the blob and pulls the data for x unit, gets the prefab entity, gets the health, etc, and spawns it

rustic rain
#

why store health differently?

#

shouldn't be it's on prefab already?

devout prairie
#

there's not a separate prefab for each unit

#

there's lets say a base model prefab, which applies to all units

stone osprey
#

Btw does anyone here knows any good quadtree library ?

All i find are pretty outdated and not "high performance"... Wanted to use one in tie with dots basically

devout prairie
#

and then there's different attributes for each unit type

rustic rain
#

ah

#

I plan to have spawn pipeline for this kind of thing

#

where I could have simple

#

Spawn method

#

with prefab name

#

and settings struct

#

in which I define my desires hehe

devout prairie
#

it's really not difficult, complicated or unusual

#

it's an analogue of using ScriptableObjects in mono

#

but as you said, i'm basically creating the blob at the wrong time, in the case of subscenes, which was my whole frustration

#

subscenes seem to be buggy, they don't update until you've coaxed them in multiple ways to do so, they seem determined to cause problems, and now the blob problem comes along ๐Ÿ˜›

#

i don't often get annoyed, but when i do ๐Ÿ˜›

rustic rain
#

well

devout prairie
#

the blob thing was of course my problem, not a problem with subscenes themselves

rustic rain
#

subscenes is future

#

so better learn how to work with them

devout prairie
#

but after several attempts and constantly being tripped up by subscenes, i was a tiny bit annoyed

rustic rain
#

runtime conversion is slow

devout prairie
#

it is

#

i mean i get it, i understand the benefits of using subscenes etc

#

that's literally why i decided ok i have everything working, i'm going to convert it to a subscene

#

the way i did this previously was probably more in line with what you're suggesting, and i did use a subscene for the prefabs

#

so i had an authoring component inside the subscene, which had a list of all of my GameObject prefabs

#

i then created a single prefab holder entity, and added a dynamic buffer, with data on my prefabs etc

#

i'm pretty certain the buffer also contained references to the prefab entities

rustic rain
#

buffers get remapped

devout prairie
#

so i think the problem in this case is exactly as you're saying, inside the blob they're not getting remapped

#

whereas inside a component or buffer yeah they do

rustic rain
#

ComponentType has a field HasEntityReference

#

pretty sure for this exact reason, hehe

viral sonnet
#

i'll ask again. why blobs! what do you gain?

devout prairie
#

i think for simplicity, i'll just switch back to that, but inside the buffer i'll hold a reference to the prefab entity alongside a blobassetreference which will hold the actual data for each unit type

narrow field
#

Trying to install the Jobs package by itself but get this error immediately.

#

I'm using unity 2020.3.12f1

rustic rain
#

wrong version

#

at least

devout prairie
viral sonnet
#

unit data makes total sense, i just don't get the need for an entity in there

#

and I'm pretty certain you could split that

devout prairie
#

simply just to hold the prefab entity that the spawner will spawn

#

again, it's just when i'm creating the blob, because the entity isn't remapping

narrow field
devout prairie
#

the idea of storing the entity in a blob in itself i think is fine

#

alongside the rest of the unit data

viral sonnet
#

i don't agree with that.

#

a spawner can consist of a prefab + blobAssetReference

#

it doesn't have to be all in the blob

devout prairie
#

of course it doesn't have to be

devout prairie
#

but why split that up

viral sonnet
#

because a blob is not designed for entity remapping ๐Ÿ™‚

#

or any kind of dynamic data

narrow field
#

Error happens upon trying to install any of these previous versions too

viral sonnet
#

(unless you build at runtime)

#

use 2020.3.30+

devout prairie
#

well exactly, i was building at runtime, which was fine, it worked perfectly

viral sonnet
#

i'm confused, i thought you had the problems at conversion stage?

devout prairie
#

yes basically, it worked perfectly when building at runtime

#

but once in a subscene, not

narrow field
devout prairie
#

because the subscene wasn't remapping to the runtime entities i guess

devout prairie
safe lintel
#

@narrow field can you paste the contents of your package manifest json somewhere?

viral sonnet
robust scaffold
#

On the topic of blogs, I haven't found a reason to use any personally. If I could encode textures, maybe, but currently I just have all may data in components.

#

It helps that in 2d, all the meshs are very simple

narrow field
#

Got it installed now, however it seems I cannot use Unity.Mathematics? It's appears in the package manager as installed however I cannot use it in any of my scripts

rustic rain
#

why are you using static?

#

just do using

#

and leave .math

deft stump
#

using static is for later versions of unity I believe

narrow field
#

I'm literally just following what the official documentation on my current version is doing

rustic rain
#

do you have Assembly Def?

narrow field
#

no.

#

no mathematics or math in the Unity namespace

rustic rain
#

I mean

#

if you have defined an assembly def

#

you need to reference it manually

robust scaffold
#

If you have one of these defined, you need to add Unity.Mathematics to the Reference list.

#

I've gotta say, this is one of the most beautiful burst outputs I have ever seen.

rustic rain
#

how does it look in c#?

robust scaffold
dreamy glade
#

In an ECS for each loop, how would I go about getting entities WITHOUT a certain tag? Thanks.

dreamy glade
robust scaffold
#

Ive gotta hand it to the 3 guys working on dots physics over at unity, combining 4 AABBs into a single node is ingenious.

#

The issue is that from what I can tell, everyone working on DOTS physics were either reassigned or fired. The last response from a DOTS physics programmer on the forums was during the 0.17 days and 0.50 brought no new changes to the API.

balmy thistle
#

I don't think you're correct

robust scaffold
#

I think it got "deprioritized" like DOTS animation and audio.

viral sonnet
#

a shame, physics could need some love. but due to the big code changes further extensive development was halted

#

dots physics is one of their best releases without much patching needed

narrow field
#

Trying to fix a bottleneck in my system. I'm trying to set a bunch of points in a nativearray and then setdata on a computebuffer using the nativearray. Issue is that I'm using 1 million points and currently most of the CPU frame time is going to SetData on the compute buffer

robust scaffold
narrow field
#

I'm using half3s

robust scaffold
#

Then that's 6 MB, not much better.

#

You need to get really creative in packing bits or space it out over multiple frames. 1M points is a lot of data being transferred.

#

Modern video games have thousands of MB of textures in the GPU because they only transfer the data once at loading, or stream it in over multiple frames. If you're trying to transfer 1M points every frame as update, that's physically impossible.

#

I recommend transferring in the source data at startup to the GPU and computing whatever you need in a compute buffer. Dont try computing things in a Job and then transferring it over.

umbral veldt
# narrow field Trying to fix a bottleneck in my system. I'm trying to set a bunch of points in ...

You can try using some time in the cpu end to tightly pack the data and send it to the gpu, and then also take some time on that end to unpack them. You'd be transfering less bits, but I don't know if you'd manage to compress it that much, and then, compression also adds some overhead. But you can check some articles about demo scenes, those guys really know how to compress things. For example, check Inigo Quillez's website.

devout prairie
robust scaffold
devout prairie
#

yeah that was what i kindof assumed

narrow field
#

Also, I'm not updating the entire nativearray per frame, but I'm having trouble figuring out how to only set a certain amount of data in the computebuffer

#

I tried using BeginWrite/EndWrite but it ended up not working and I wasn't sure why (yes I had it set to ComputeBufferMode.SubUpdates)

robust scaffold
#

Otherwise, set data seems pretty self explanatory

#

@viral sonnet How does one go and find where a component is being changed for debugging change filters?

robust scaffold
#

I have a change filter on a job (the chunk.HasChanged(Comp, Version)) and it's being activated despite nothing moving. I need to find out why.

rustic rain
robust scaffold
#

Apparently yes. And I need to find out what is.

rustic rain
#

just search for

#

GetComponentTypeHandle();

#

with type of what you think is the reason

viral sonnet
viral sonnet
#

what also helps, some job that will debug.log when the comp has been changed and then disabling systems one by one. when the line stops outputting you're nearly there

robust scaffold
#

Well, I dont think I need this change filter anyways. There's gonna be one BVH for the entire world so if anything moves, it gets rebuilt.

viral sonnet
#

riggt, the unity one. yeah no change filter needed

robust scaffold
#

It's not that expensive, only 1.5ms for 10,000 entities. Scales linearly though so it's pretty bad at 50,000 since I use a better splitting algo than unity. If I were to use the same split as Unity's I get similar 0.75ms performance for 10,000.

#

Yea, there's refitting and incremental reconstruction of the BVH tree but.... is it really needed?

viral sonnet
#

do you need that much or just optimizing for optimizations sake

robust scaffold
viral sonnet
#

bullets shoukd be raycasts

robust scaffold
#

They might be slow bullets though

viral sonnet
#

i think even in that case raycasts are more performant

robust scaffold
#

Probably, hrm. Now with a BVH, I can get back to actually programming physics.

robust scaffold
rotund token
#

oh yeah saw this the other day relating to 2022.2

There are also some exciting changes to support newer Burst versions, e.g. the groundwork to switch Burst off dynamically when you set breakpoints with a managed debugger

robust scaffold
#

At least assert works in burst.

#

I think burst is in a great position right now. I cant think of anything that it can improve on atm. I dont have that many methods so I havent hit the iteration speed wall let.

rotund token
#

my only request is always compiled burst jobs but break points switching to mono my remove my need for that

robust scaffold
#

A stretch goal maybe would be a hover over tooltip on the inspector over all the commands. A small blurb when hovering over an operation that says what it does, what the throughput is. The stuff that can be found on the Intel Intrinsics database so I dont need to keep going back and forth to see if any improvements actually improved anything.

rotund token
#

oh inspector could have a bunch of improvements

viral sonnet
#

yeah burst inspector is pretty bare bones

robust scaffold
#

And trimming out all the unity code as well

viral sonnet
#

amd uprof made it right. it shows the c# lines on top and in the bottom window the assembly. when you click on a c# line it highlights the corresponding assembly lines

#

exactly, there's soooo much bloat

rotund token
#

great to be able to see changes between compiles

#

so i can stop copy/pasting it into notepad++

viral sonnet
#

then i need a simple ctrl+f

robust scaffold
viral sonnet
#

oh yeah! change highlights between compiles. mmhhh ๐Ÿ˜„

robust scaffold
viral sonnet
#

you what mate? ๐Ÿ˜„ do you run on a terminal or smth? ๐Ÿ˜„

robust scaffold
#

And maybe hints about why this loop couldnt be unrolled or vectorized. What's blocking the magical purple VP from occurring.

viral sonnet
#

we can make quite the list for the inspector ๐Ÿ˜…

#

the compiler itself ๐Ÿ‘Œ

robust scaffold
#

I'm sure they've got their own. There's little they can actually improve with the compiler IMO.

#

Like the method hierarchy is currently just a flat list. There needs to be some foldering and ordering by file.

viral sonnet
#

it's at a really good place already

robust scaffold
#

And maybe a burst option that allows a method to be hidden in the burst inspector list (with an additional toggle in the inspector to show the hidden methods). That way unity can hide all of their shipped methods and the inspector can focus on the user's code.

viral sonnet
#

i maybe have a dumb question about float precision. if i have a high number, like 1.0e52 and add +1 to it e52 times. is the result 2.0e52?

#

i have test it with e10 but the loops is too big lol

rotund token
#

1e5 = 100,000
2e5 = 200,000

#

i.e. 2.0e52 = 2x1.0e52

rotund token
#

but yeah you are way past max float

viral sonnet
#

oh sorry, ignore the limit. take e31 or smth in range

robust scaffold
#

This question is possible with double.

viral sonnet
#

point is, is something that high even precise enough to pick up such a small number

rotund token
#

that's your precision table

rotund token
#

at 16.7million (16e6) your precision is 1
anything above that and you're precision is worse than 1

#

so adding 1 does not guarantee changing the value

viral sonnet
#

so at one point if the numbers are big enough i'd need to store 2 values to even catch an increment of 1.

#

one variable just for precise accumulation

#

one to store the big number

rotund token
#

anything above 16,777,216 you need doubles for accuracy for 1 increments

#

but if you're goal is int accuracy, why not just use an int ^_^'

viral sonnet
#

because it doesn't go that high ๐Ÿ™‚

#

incremental games struggle with data types ๐Ÿ™‚

robust scaffold
rotund token
viral sonnet
#

simple example. you have a metric, you get +1 every 0.1 second (or something very small). you want to accumulate this. now the game is played for a year 24/7. it shouldn't stop working at some point is what i'm thinking about.

rotund token
#

yeah

#

this is why time is stored in double

#

not float

robust scaffold
viral sonnet
#

incremental games often go over the double limit and need custom implementations

robust scaffold
#

just reduce the incremental factor then

#

Pull a zimbabwe and chop off a few of the digits on the increments and then restart the count.

rotund token
#

if you increment +10/second
it will take
5.696113e+299
years
to exceed double max value

viral sonnet
#

it will stop working long before that. the above screenshot shows a double precsion of 1 with e15 or smth that I counted

rotund token
#

yeah so

#

the max value of 9007199254740992 for 1 precision
is 285,580,191 years if incrementing +1/second

viral sonnet
#

but yeah, at some point the increment has to get higher otherwise it's unrealistic to take any meaningful effect

#

haha, yeah if you put it like that ๐Ÿ˜„

#

as I said in the opening. maybe a dumb question ๐Ÿ˜„ anyway, the precision table helped to wrap my mind around it where it starts breaking down

rotund token
#

i have that table saved

#

it's super useful

#

especially when deciding if i want to use half

#

though its missing a few steps not hard to do the maths yourself

viral sonnet
#

yep, saved it too now. i remember you posting this some time ago

#

i want to add more stat data types now. i already have half and float. need double too and bring it all together

#

double for health and damage amount is super useful

#

at least as option

rotund token
#

haha i only offer half and short for modifiers

#

in a union

viral sonnet
#

and i need to find out how good burst is with jump tables. could get somewhat annoying to first get the data type and then the corresponding array of values

#

ah right i remember. yeah pretty cool. so you had an extension or how did you determine which stat is which data type?

rotund token
#

this is for modifiers

#

add is always short (+5 int)
increased/more is always half (30% increased damage etc)

#

the actual final stat is stored in an int always

#

i don't think it'd be healthy for a game to have a single stat modifier 8000% increased

#

๐Ÿ˜„

#

nearly always going to be <1

viral sonnet
#

depends on the type of game

rotund token
#

i was struggling to find any example

viral sonnet
#

those korean grinders i played went nuts with numbers

rotund token
#

8000% is still only a value of 80

#

which still has 0.5 precision

#

and at those crazy scales you don't need fine precision anyway

#

also personally i hate games with stupid numbers so i dont need to worry about that ๐Ÿ˜„

viral sonnet
#

eh, most shit the bed with bad number formating ๐Ÿ˜„

#

WoW did a huge stat squish because numbers were in the million range.

#

and they were sooo happy when numbers were again in the 1k range

#

i just thought. why not show 1234k? readable. good enough

#

but there are other reasons and those are all solid

#

it just went on for a very long time like this

#

and it always ended in the same way every expansion so everytime they needed a stat squish which also means numbers are totally relative and don't mean anything over the course

#

which makes me sad

robust scaffold
#

Dynamic buffer accessor is so big. Adds nearly 400 bytes to the thread's stack. I can't fit my own stackalloc in there.

viral sonnet
#

that's why i always saw such a performance decrease. what are those 400 bytes?

rotund token
#

i only see 20 bytes + 41 from safety

viral sonnet
#

and how did you see how much it puts on the stack?

robust scaffold
#

With and without

viral sonnet
#

are you talking about the size in the archetype ?

#

ah, nice

robust scaffold
#

300 bytes, not 400. Still, big.

#

Unity stackalloc 256 + 512 in their AABB overlap test. I just move mine to a native array. Not like I'm doing any vectorization on the actual nodes.

#

For comparison, this is 456 bytes.

viral sonnet
#

haha my biggest job has 936 in its execute

#

so methods that are inlined don't need an additonal stack alloc, right?

robust scaffold
viral sonnet
#

i see thanks

robust scaffold
#

There's one stack alloc per method (not inlined) and all of them summed up equals the thread's stack alloc. Which is finite so dont use too many variables.

#

Too many as in stackalloc int[512] like what unity is doing...

viral sonnet
#

ok i see, i haven't accounted for that the memory is just moved to the parent method. what about variables that are calculated in the main method and then used as parameter for a sub-method. does this occupy 2 times the memory or will the method just read from the register of the main method?

rotund token
#

512 is not particularly large, 0.05% of the stack

#

oh wait 0.2%

robust scaffold
#

multiplied by 4 because of int

#

Probably depends on the comp running it as well. My shittop dies at 256 max for that screenshot bove.

viral sonnet
#

wait, is my math off. what cache size did you take? i get 6,25% for l1 with 32.768

rotund token
#

stack has 1MB

#

per thread on x64

viral sonnet
#

ah ok

rotund token
#

1mb = 1024x1024=1,048,576 bytes
he's allocating 512x4 bytes
2048/1,048,576 = 0.001953125 or 0.1953125%

#

hopefully my math checks out ^_^'

#

(I originally missed the x4)

viral sonnet
#

so uhm, how does the stack size differ from L1/2/3 cache?

balmy thistle
#

stack is just a section of main memory that employs a well understood convention of growing down and automatic cleanup

viral sonnet
#

oh man, why did i assume stackalloc puts data on l1 ... ๐Ÿ˜„

rotund token
#

stack is stored in ram but it has a high probability of matching in cache

robust scaffold
#

And if you shift the pointer off stack, you get the dreaded stack overflow!

viral sonnet
#

i was a master of stack overflows when i learned programming in c++. those damn recursive learning tasks ๐Ÿ˜„

minor sapphire
#

They called you the great flooder

balmy thistle
#

I used to effect magical memory optimizations back in the day by editing the default link script to shrink the stack size from 1mb to 64k

viral sonnet
#

those were the times when you had to restart your pc on some stack overflows or wrong pointers. and don't get me started on the dos IDEs. Borland C++ was it called

timber ivy
#

what exactly is burst doing to make my code run faster?

#

because I get very little performance gains using it. Infact im seeing an overall loss in performance just having dots installed before adding any user code

#

my editor stays at 90 fps vs the 600ish i would see before

timber ivy
#

yeah

#

but

#

even before installing that

robust scaffold
#

Thats why. It has quite a bit of overhead rendering nothing. That's why I dont use it.

timber ivy
#

How do you render then?

robust scaffold
#

Manual draw calls. SRP.

#

Not too difficult. That section of code draws circles.

timber ivy
#

is unity working on a better renderer?

robust scaffold
viral sonnet
#

short answer, yes

timber ivy
#

Awesome

viral sonnet
#

hybrid renderer will be in version 3 (soon)

robust scaffold
#

As for Entities, the other half of DOTS, it's a storage medium. It shouldn't impact your FPS any more than using List<>s or Dictionary<>s

#

What burst does is translate the C# code into direct machine intrinsic operations. Making it faster and better.

#

Well, C# IL code.

timber ivy
#

so its basically an il to native jit compiler

robust scaffold
#

AOT in build. JIT in editor. But yes.

timber ivy
#

ok cool

#

maybe I should try a build mode and see what my fps is

viral sonnet
#

not needed. turn off safety checks and leak detection. there's little difference then to builds

#

at least when it comes to burst jobs

timber ivy
#

maybe dots not optimized for cpus that make use of efficiency cores?

#

I got one of the new i7s with 8p+4e cores

robust scaffold
timber ivy
viral sonnet
#

when you mention performance issues. best to just post a screenshot of the profiler here with the timeline

robust scaffold
timber ivy
timber ivy
viral sonnet
#

but you also don't need HR really to do something with burst, jobs and entities

timber ivy
#

entities jobs and burst installed alone reduces fps in the editor in a blank project by 50 fps for me

#

thats with safety checks and leak detection turned off

#

thats with a urp project

viral sonnet
#

there's something else going on. burst and entities itself don't do anything

robust scaffold
timber ivy
#

if you install entities the default systems run

#

but

#

according to profiler

robust scaffold
#

The checks though are just boolean

timber ivy
#

they aren't taking that much time

viral sonnet
#

they shouldn't run really with no entities present

#

anyway, 50 fps don't mean anything when the framerate is 300 or 350. what counts is the milliseconds spent in cpu

#

fps is a reciprocal number and therefore relative

elfin spire
#

anyone knows of a compression repo that uses burst/jobs?

rotund token
#

unity just uses l4z

#

via CodecService

#

works in burst but it's just a native call - not burst optimized or anything

winged bane
robust scaffold
#

3ms just to find overlapping AABBs for 10,000 entities simultaneously. Not good.

winged bane
#

ouch

robust scaffold
#

I press multithread and it halves the time (cant multithread BVH building) but I dont know if it's valid.

robust scaffold
#

I think the main issue is the adding of the entity that it overlaps with to the dynamic buffer. That isnt vectorized.

winged bane
#

Im allergic to dynamic buffers

robust scaffold
winged bane
#

I havent found a use case where I needed something dynamic yet I guess

robust scaffold
#

An alternative option would be a fixed buffer struct and it'll allow for vectorized writes of the target entity, but that decimates chunk capacity.

winged bane
#

fixed buffers only good if you can control the size

#

but they are my bread and butter

robust scaffold
#

I have 10,000 entities, each with a fixed Entity[16]. I want to be able to record every possible overlap but only in rare cases where all 16 would be used. Rest of the time, it's just sitting there empty

winged bane
#

my use case lets me fill them up pretty good

#

can every entity overlap with every other entity?

robust scaffold
#

Yea. I havent implemented collision flags yet so they can overlap with any other entity with a physics component

winged bane
#

what are you doing with the results of the job?

viral sonnet
robust scaffold
robust scaffold
robust scaffold
viral sonnet
#

yes, i use them for stats. inlined in chunk at fixed size

robust scaffold
#

I dont know why but setting internal buffer capacity for a buffer component to 0 results in unity hard crashing on launch.

rotund token
#

o_O

viral sonnet
#

are you doing something weird with it? setting to 0 means data is allocated outside of chunk. not sure if you want to do this in that kind of algo?

robust scaffold
#

I dont think this is because I'm abusing pointers everywhere. I dont even run anything until play.

robust scaffold
viral sonnet
#

writes will be slow though if you do it single

robust scaffold
#

That's the stack trace when I set the capacity to 0 and launch unity.

viral sonnet
#

how do you get the ptr?

robust scaffold
viral sonnet
#

hm, that's very unusual then

robust scaffold
#

Top of the SS is the access. Bottom is the write.

winged bane
#

I havent had a chance to dig into physics much but there are some options for passing the data into your narrow phase

viral sonnet
#

never ever had a crash because of it

rotund token
#

where's the free occurring in entities

#

we have over 100 buffers or something stupid at work all 0 size

robust scaffold
#

Top of the SS is the componenttypes containing the buffer (Overlaps). Bottom is the add components. It works, if I set the IBC to anything above 0.

viral sonnet
#

and the struct of the buffer only has Entity in it?

robust scaffold
rotund token
#

oh

#

i think i know your bug

#

can you make that a property =>

robust scaffold
rotund token
#

these here

robust scaffold
#

Oh, the components?

rotund token
#

yeah i had this bug a long time ago

robust scaffold
#

Why would properties change anything, these are all managed objects

#

Nope

rotund token
#

it's because typeof(X) => ComponentType.ReadWrite<X>() which requires using TypeManager
return FromTypeIndex(TypeManager.GetTypeIndex<T>());

robust scaffold
#

And it crashed...

rotund token
#

and typemanager doesn't get setup in time

#

oh you doing this in burst?

#

yeah that won't work

robust scaffold
rotund token
#

i'm pretty sure what's happening is outside of burst, your component has 0 size and exists outside the chunk

#

inside it has the default size

#

so thinks its putting it into the chunk

robust scaffold
#

But if I make it 4, no crashes

rotund token
#

yeah because that still exists in the chunk

robust scaffold
#

Oh fuck, the conversion system really does not like any dynamic buffers of size other than 4

#

Well then, I guess I'll be using a fixed buffer. Thanks unity for making the choice for me

viral sonnet
#

huh, i use 33

rotund token
#

you can't use ComponentType

#

before TypeManager has been initialized

#

a static field can cause this to happen

robust scaffold
#

And then convert that to componenttype[] inside the foreach

rotund token
#

yeah that's what i was suggesting because that's instantiated on use

robust scaffold
#

hrm

#

that didnt fix it

#

It's creating the component types inside the Entities.ForEach()

#

So this has to be after TypeManager been initialized.

#

Huh, same issue with my other dynamic array also created at conversion.

#

Seems that dynamic buffers can not have a size other than default (4) during conversion. After startup, it's fine.

viral sonnet
#

i have no idea why you have these errors, only thing i can say is that i can set all kinds of internal caps in and out of conversion

rotund token
#

all my buffers are setup during conversion

#

a wide variety of sizes

#
    [InternalBufferCapacity(6)]
    public struct ClusterConnection : IBufferElementData
    {
        public Entity Value;
    }```

```        void IConvertGameObjectToEntity.Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
        {
            dstManager.AddComponent<Cluster>(entity);
            dstManager.AddComponent<ClusterDirty>(entity);
            dstManager.AddComponent<ClusterConnection>(entity);```
#

that's a 6

#
    public struct BuildPreviewData : IBufferElementData
    {
        public Entity Value;
    }

        protected override void CustomConvert(EntityManager dstManager, Entity entity, GameObjectConversionSystem conversionSystem)
        {
            var previewData = dstManager.AddBuffer<BuildPreviewData>(entity);```
giant 128
robust scaffold
#

I'm making mine in a GOCS, not a IGCOTE

#

Im gonna see if it changes anything if I try a IGCOTE

rotund token
#

i have a bunch in conversion systems

#
    public struct SavableLinks : IBufferElementData
    {
        public Entity Entity;
        public ulong Value;
    }```

```#if UNITY_PHYSICS
    [UpdateAfter(typeof(EndColliderConversionSystem))]
    [UpdateAfter(typeof(PhysicsBodyConversionSystem))]
#endif
    [ConverterVersion("tim", 1)]
    public class SavableConversionSystem : GameObjectConversionSystem
    {
        protected override void OnUpdate()

// ...

            var savableLinks = this.DstEntityManager.AddBuffer<SavableLinks>(entity);
robust scaffold
#

hrm

#

None of my scripts touch conversion though, what did I break?

#

Alright, i tried a IGCOTE and it didnt crash... huh

#

What I have, which might be the issue, is a duplication script.

#

I think I might be overflowing whatever internal system they have for clearing memory during conversion

robust scaffold
#

Yea, it's the duplication. I'll need to do that on awake instead of during conversion it seems like

robust scaffold
#

hrmmm, actually. I think it's DOTS Hierarchy in the editor (before pressing play) that is crashing unity

#

Alright, nevermind. Just changing the IBC crashes unity. To fix, reopen unity, clear entity cache, and hope

robust scaffold
timber ivy
#

doesn't unity handle this internally?

robust scaffold
robust scaffold
viral sonnet
#

nice, pretty good

chilly crow
#

sooo apparently this system queries for SettingsMenuState in order to run (I assume because of the GetSingletonEntity call), but I want it to run regardless.
should I be going about this a different way? I'm basically just using the component in another system with RequireSingleton and OnStart/StopRunning to control my UI state

public partial class ToggleSettingsMenuStateSystem : SystemBase
{
    protected override void OnUpdate()
    {
        if (HEVS.Input.GetKeyDown(KeyCode.Escape))
        {
            Debug.Log("derping");
            if (HasSingleton<SettingsMenuState>())
                EntityManager.DestroyEntity(GetSingletonEntity<SettingsMenuState>());
            else
                EntityManager.CreateEntity(typeof(SettingsMenuState));
        }
    }
}
rotund token
#

Add
[AlwaysUpdateSystem]

chilly crow
#

pog thank you

robust scaffold
#

I think this works. It should hopefully without exploding.

#

Yep. It does. Nice. Love it when code works first try.

viral sonnet
#

what's going on here? not seeing the use of this

#

might have to do that i have no context what compIdx, compDat is

robust scaffold
#

Compression is basically is vectorized select that also shuffles the true components to the left.

viral sonnet
#

hm, i don't think you need to pin them btw

robust scaffold
#

These are random hardcoded array sizes and if any of them overflow, span will throw an error whereas a pointer will do random things until it hard crashes unity (learned that the hard way).

viral sonnet
#

and that works with pinning the ptr to it?

#

wouldn't that require using the actual span struct?

robust scaffold
#

Yea. Span is built into C# and has neat properties. It's basically a wrapper around a pointer.

#

And you use fixed to get the original pointer out of Span.

viral sonnet
#

i know, but you are using pointers then and not the span. how can that be safe?

robust scaffold
#

hrm, true. I dont actually index the span.

#

Used to before I wrote that memcpy stride section

#

but then I rewrote it, and now I dont use the span...

#

Well, guess I dont need the span.

viral sonnet
#

yep, for that kind of safety. hardcode a const somewhere convenient

#

and use an assert

robust scaffold
#

I was originally using it alongside this span as well (which is being indexed here)

viral sonnet
#

oh wow, math.compress is left packing. i actually have a simd left packing in my code that's not working because i have no idea how to actually write such a thing and the lookup table

#

great name ... who calls something like that compress

robust scaffold
robust scaffold
viral sonnet
#

oh i know, leftpacking was too verbose ... oh wait

rustic rain
#

Sooo, span is like reference to stack memory structure?

viral sonnet
#

it's a convenient (safe) struct for a stackalloc

#

so yes. no idea if it can resize. never used it really

robust scaffold
#

And apparently the other "hidden" neat math functions are countbits and tz/lzcnt for bitwise ops.

robust scaffold
#

Span can also be used to fix regular arrays but that will never come up in burst as you can not make managed arrays.

rustic rain
#

So stackalloc just let's you allocate any amount of data and span let's you to cast this allocated data to your chosen type?

viral sonnet
robust scaffold
rustic rain
#

Hmm

#

So span is like unsafelist?

robust scaffold
#

Since I'm not indexing into the span (and using it's safety), i changed the stackalloc back to int pointers.

rustic rain
#

Just a fixed sized pointer to allocated memory?

robust scaffold
viral sonnet
#

dat leftpacking must be nice for early outs on something. that at least was the use case i wanted to tey but failed

rustic rain
#

Oh, so it is size of arraycount multiplied by type size?

viral sonnet
#

why are you making this complicated. it's like a nativearray but allocated in stack

robust scaffold
#

It's a NA(Allocator.Temp) that disposes automatically at method return, instead of whenever unity feels like it.

rustic rain
viral sonnet
#

it's really fast and on par with preallocated mem. should be used instead of temp nativearray in jobs

robust scaffold
viral sonnet
#

i have tested it comparing stackalloc with a pre-allocated nativelist and there was no real improvement

rustic rain
viral sonnet
#

no dispose needed, when the method returns it's gone

rustic rain
#

Hmm

viral sonnet
#

float* arr = stackalloc float[16]; for example

rustic rain
#

Is there a limit to amount of data?

viral sonnet
#

i wanted leftpacking for these kind of tests

robust scaffold
viral sonnet
#

yeah ๐Ÿ˜„ the stack size

robust scaffold
rustic rain
#

So, 1 mb is size of stack?

viral sonnet
#

what do you say, would this work for my case?

#

to at least simd this test

rustic rain
#

Ok

#

Now it finally makes sense

#

Just temp native array but faster hehe

#

Combined with span

robust scaffold
viral sonnet
#

ok, i can do this with 2 loops then. i don't always have multiples of 4

#

thanks, i need to go to bed ๐Ÿ˜„ o/

robust scaffold
rustic rain
#

stackalloc byte[MaxStackLimit]

#

Huh

robust scaffold
rustic rain
#

I feel like I'm learning cpp at this point xD

robust scaffold
#

Yep. Burst is C++ brought to the world of C#.

#

At least you dont need to write header files.

rustic rain
#

But span is indeed a nice learn

#

Along with stackalloc

#

Microoptimizations for performance critical applications

robust scaffold
#

This aint just micro. This is how you can conduct physics on thousands of individual objects simultaneously in real time.

#

Might be micro for each entity but summed up over 10,000 or 50,000, it's a lot.

rustic rain
#

I assume this means crash?
Security

The use of stackalloc automatically enables buffer overrun detection features in the common language runtime (CLR). If a buffer overrun is detected, the process is terminated as quickly as possible to minimize the chance that malicious code is executed.

robust scaffold
#

And you hard crash unity as well. I spent 7 hours yesterday figuring out that I mistyped j instead of k inside a for loop indexing a raw pointer. It kept crashing unity with no error messages outside of Null reference exception (buffer overrun). And slowly walking back to where the issue is.

rustic rain
#

Hehe

#

Btw. Native array allocated to heap?

robust scaffold
rustic rain
#

Welp

#

Smth I didn't know

robust scaffold
#

You can tell because adding additional capacity to a NA doesnt change the stack allocation quantity inside burst.

robust scaffold
# rustic rain Smth I didn't know

Span's not just limited to stackalloc. I've wrapped NativeArrays around these to get a pointer like access with the buffer overrun safety of a NA.

timber ivy
#

Is there away to set an entity as a navmeshmodifier?

robust scaffold
timber ivy
#

I was under the impression navmesh was compatible with dots

#

im using the expirimental ai package if that makes a diff

robust scaffold
timber ivy
#

is it good?

robust scaffold
#

Never used either nav systems myself. I use flowfields for my pathfinding.

#

I plan for a few thousand entities and flow fields scale better.

timber ivy
#

I just need something simple for pathfinding tbh. My game is a top down 3d game and the ground is 100% flat

robust scaffold
#

Cant go wrong with A* with a few dozen at most pathfinders. Beyond that, nav meshes are faster up to about a thousand. Then flowfields win out.

timber ivy
#

Id have about 250 units pathfinding at most

#

thing about a* is I can't understand how I go about marking area of my world as unwalkable

robust scaffold
#

make your world a grid. Larger grid sizes mean faster A* performance but worse quality of path.

#

Unity's nav mesh query, i think the thing you're looking at, seems to be a burst accelerated GO system, not a DOTS system.

#

If you want to use the nav package, you'll need to go hybrid and dip into GO land to update the nav mesh using monobehaviors

timber ivy
#

yeah I dont want to mess with game objects so that isnt an option

rustic rain
#

Pretty sure there's a navmesh in dots

#

Since tertle discussed it with someone else

#

@rotund token could you clarify?

robust scaffold
#

dots nav was someone in the dots community, it's fully featured and very robust but not Unity's package

rotund token
jaunty hornet
rotund token
#

^

timber ivy
rotund token
#

yes

timber ivy
#

how do I add them to the navmesh modifier list?

#

cause right now I got this and it works fine for a gameobject but once things got put into subscenes it stopped generating the navmesh

rotund token
#

i told someone how to do this hte other day

timber ivy
#
private IEnumerator RebuildNavMeshAsync()
    {
        Bounds navMeshBounds = new Bounds(new Vector3(observer.transform.position.x, 0, observer.transform.position.z), new Vector3(boundsSize, 20, boundsSize));
        modifiers = NavMeshModifier.activeModifiers;

        for (int i = 0; i < modifiers.Count; i++)
        {
                markups.Add(new NavMeshBuildMarkup()
                {
                    root = modifiers[i].transform,
                    overrideArea = modifiers[i].overrideArea,
                    area = modifiers[i].area,
                    ignoreFromBuild = modifiers[i].ignoreFromBuild
                });
        }

        NavMeshBuilder.CollectSources(navMeshBounds, surface.Value.layerMask,
                        surface.Value.useGeometry, surface.Value.defaultArea, markups, sources);


        var navMeshUpdateOperation = NavMeshBuilder.UpdateNavMeshDataAsync(
            navmeshData, surface.Value.GetBuildSettings(), sources, navMeshBounds);
        yield return navMeshUpdateOperation;     
    }
rotund token
#

and it was you >_>

timber ivy
#

no you didn't tell me how to add entities to the navmesh modifier list

rotund token
#

you just have to add your rendermesh

#

to the list of meshes

#

you can't use CollectSources

#

you have to collect them yourself

timber ivy
#

Ok thank you

rotund token
#

just build a list of NavMeshBuildSource

#

from your entities

#

sourceObject is the mesh from RenderMesh

#

transform is LocalToWorld

#

think that's all you need from memory

#

Area I guess

timber ivy
#

I am sorry if you did mention this when you helped me build the code before I may have overlooked it cause I wasn't using unities ecs at that time. Decided to switch a few days ago after seeing how much better the api got

rotund token
#

for bounds, you can either use a known area

#

or you can calculate it from combining all your WorldBounds

#

apart from that, it just takes the same navmeshdata and buildsettings

timber ivy
#

so the navmeshmodifiers aren't needed when using entities then?

rotund token
#

i don't think they're require for game objects either

#

they just let you override the area with a different type if you want

#

if you don't use them it'll just use the default area

rustic rain
#

Has anyone touched FMOD with Dots?

#

any idea how can you call Events with entities?

rotund token
#

we use fmod

rustic rain
#

any general tip how is it structured in project?

rotund token
#

fmod is basically native

#

you can just call it

rustic rain
#

yeah, but it has string field in Editor

#

which kind of makes it a bit harder

#

for type EventReference

#

so it comes to resolving guids manually

timber ivy
#

cant you just marshal the string to a ptr?

rotund token
#

you dont pass fmod the string though

#

(i dont think, could be wrong on that)

#

but the wrapper is literally just

#

native calls with a ptr and values

rustic rain
#

oh wait

#

it's FMOD library?

#

not your advanced helper utils? xD

rotund token
#

i have no utils for fmod

#

this is work

#

i dont use fmod in my own project

#

this is just the default fmod sdk

rustic rain
#

yeah, interesting

#

I still wonder about how you structure it in entities

#

if you even do

rotund token
#

we don't

#

our audio was written before entities even existed

rustic rain
#

ah

rotund token
#

all the fmod string convert to guid

#

and you can pass those direct to fmod to get eventids etc

rustic rain
#

fmod has it's own ID manager?

#

interesting

rotund token
#

i'm no expert

#

audio guy asks me to hook up some data

#

i do

#

that's about the extent i've used it

#

apart from setting up the audio device switcher i think

rustic rain
#

I see

rotund token
#

i just know it's pretty much a native library

#

which has the nice benefit of being callable from burst

#

and the c# wrapper they provide is really tiny

rotund token
#

so should not be that hard to add your own little burstable wrapper instead

rustic rain
#

I cannot really find any actual examples of being called from burst

#

All I found are managed solutions

rotund token
#

just go into fmod_studio.cs

#

and look at the external calls

#

and call them directly yourself

rustic rain
#

and even some dud who made a guide of how to use it with entities also used Managed systems

rotund token
#

or just go look at a tutorial

#

for c++

#

instead of c#

rustic rain
rotund token
#

burst can call native libraries

rustic rain
#

huh

#

so you can make a cpp method and call it from burst?

#

that's really interesting to know

rustic rain
#

I'd assume as long as parameters are unmanaged and burst compatible

rotund token
#

my navmesh library is in c++

#

and just called from burst

rustic rain
#

and so is return type

rotund token
rustic rain
rotund token
#

?

rustic rain
#

it's managed and it's external call

rotund token
#

this is not a DllImport

timber ivy
#

oh nvm

rotund token
#

^

timber ivy
#

i misread

#

Transform is an object type

rustic rain
#

even github is 404

#

kek

#

oh found it

#

I think

#

hmmm

#

So the key to native calls

#

is System class

#

with only field of IntPtr

#

I am guessing this is similiar to EntityManager

#

as I can get reference to it in OnCreate

#

and then call it in bursted code

#

looks like true

#

private void Update() { Debug.Log(_system.isValid()); }

#

not a single false

#

very interesting

#
    [StructLayout(LayoutKind.Sequential)]
    public struct PARAMETER_DESCRIPTION
    {
        public StringWrapper name;
        public PARAMETER_ID id;
        public float minimum;
        public float maximum;
        public float defaultvalue;
        public PARAMETER_TYPE type;
        public PARAMETER_FLAGS flags;
        public GUID guid;
    }

They even have their own string wrappers kek

rustic rain
#

hmmmm

#

how would conversion work with it though...

rustic rain
#

UNITY_DISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP_RUNTIME_WORLD
Where do I need to define it so it works?

#

it still compiles with automatic bootstrap

#

oh

#

maybe # is wrong one

#

Does World get's disposed on SceneChange?

#

Can I keep it?

dreamy glade
#

System.ArgumentException: Unknown Type:`{0}` All ComponentType must be known at compile time & be successfully registered. For generic components, each concrete type must be registered with [RegisterGenericComponentType].
Anyone know how to fix this issue? In my code, I'm attempted to add a custom dynamic buffer to an entity: ecb.AddBuffer<BlockBuff>(entityInQueryIndex, ent); //Add new block data array. but the error then occurs. From what I've seen online, I have to add an AssemblyInfo.cs in the same directory as the script to define it prior to compile time: ```using Chunks;
using Unity.Entities;

//Used to define component types prior to runtime.

[assembly: RegisterGenericComponentType(typeof(BlockBuff))]
[assembly: RegisterGenericComponentType(typeof(DynamicBuffer<BlockBuff>))]```

I would appreciate some help on the matter if anyone knows any solutions! Thanks.

rustic rain
#

declaration

dreamy glade
rustic rain
#

ahem

#

looks fully legit

#

Remove RegisterGenericComponent...

#

that shouldn't do any good

#

hmmm

#

are you certain that this exact buffer is causing error?

#

I'd also recommend clearing cache and restart editor

dreamy glade
rustic rain
#

entities, especially subscenes are really buggy lately

agile cradle
#

Hi. Does dots have any instruments(api) to detect in systems removing or adding new components? I've used State Components and custom tag components to detect this actions but it is clunky solution.

rustic rain
#

no

#

might want to figure out better solution

#

structural changes like these are very expensive

#

when there's a lot of entities

#

that require such reaction

viral sonnet
#

in job structs, chunk.DidOrderChange detects structural changes

agile cradle
solemn hollow
rustic rain
#

not of certain component

solemn hollow
#

very true. a built-in feature to run systems when certain components are added/removed would be quite nice.
Sure you could do that initialisation when you add a component right at that point where you add it but youd not be able to split up systems in a clean way. like if an entity gets a health component id not want to initialize the HP bar right away where i spawn the entity. id want an extra system for UI decoupled from the gamesystems.

#

what i currently do is adding one "Initialized" component to entities that need to do some stuff in the first frame on spawn. likewise i have tags that request initialisation of certain components (which was @agile cradle clunky solution). havent found anything better :/

rustic rain
#

potentially

#

I see a way it can be done

#

if you quite literally write your own ECB

#

which detects it and stores in some container

#

as events

rustic rain
#

Unbelievable

#

FMOD is burstable

#

holy

#

btw, physics stutters doesn't exist in build

#

I have no idea, what is causing this nonsense in editor

robust scaffold
rustic rain
#

no, I mean stuttering due to changing translation value in update

robust scaffold
#

Is the camera following the moving entity?

rustic rain
#

yes

robust scaffold
#

Oh, that's just camera update issues.

rustic rain
#

doubt

#

works totally fine if I set physics body type to static

robust scaffold
#

Like the update of the position of the camera should be located in late simulation group so it pulls the correct position from the target entity

rustic rain
#

position of camera is done by cinemachine

#

and it follows companion link

robust scaffold
#

Uh, no clue then

rustic rain
#

it's some kind of weird physics doing

whole gyro
#

I gave up on cinemachine due to camera stutter issues. Switched to a custom monobehavior for the camera controller running in late update and it works fine now

rustic rain
#

you can even manually update it

#

but once again, those stutters are from physics

#

not from camera

whole gyro
#

Its been a while but I remember messing with all of those settings and couldn't get rid of the stutter completely. Didn't try manually updating though so maybe that would have worked.

#

I'm not trying to say that the problem is from cinemachine necessarily. Never figured out the root cause. But switching to a custom camera controller fixed the stutter issue for me.

robust scaffold
#

Finally, after hours of digging through the Entity source, I have converted my tilemap:

#

All you need is some asmref to pull out unity's neat function that extends supported companion object types:

#

And conversion from there is straight forward and works.

rustic rain
#

usually things like that worked for me by default

#

if you simply AddComponentObject

robust scaffold
rustic rain
#

oh

#

that explains why I need to update Animator manually

robust scaffold
#

Yea. I do not want to roll my own tilemap and Unity's tilemap depends on the existance of a grid and tilemap component. So companion GO is the only way for it to work.

#

I think I finally understand the conversion system, after all these years

robust scaffold
#

Finally converted my tilemap. Took.... weeks.

#

Burst 1.8.0 Pre-2 is out. Key changes I've noticed:

  • Setting a breakpoint in an attached managed debugger (Rider/VS Unity Debugger...) on a method that is burst compiled, will switch off the burst code path for that method, allowing it to be debugged as normal.
  • Added toggle to filter Unity tests on and off.
  • Assembly is now searchable either through CTRL + f or the contex menu associated with the inspector view. Search options include case sensitivity, whole word match, and regex.
  • Added focus on current job in the burst inspector.
    @viral sonnet @rotund token
#

I think they ported the burst compiler not detecting changes from 1.7.2 to 1.8.0pre2 as well. Gonna upgrade now and see this new inspector

#

Holy shit, it's so clean. No more unity tests clogging everything

robust scaffold
#

A bit more looking around, havent noticed anything else immediately

rotund token
#

not per job

#

that's even better

#

good thing i have an ultrawide o_O

#

search is new right

#

can actually find the code i'm looking for like instantly so nice

rustic rain
#

hmmm

#

how do I quickly find

#

Lambda's code?

#

what is key word for that search?

rotund token
#

in burst inspector?

#

just search for a line of your own code

rustic rain
#

oooh

#

hm

#

nope, didn't work

rotund token
#

oh yeah they don't always properly generate the line stuff

robust scaffold
#

Switch between full debug and then back to minimal debug (default) to refresh the yellow line comments

rotund token
#

=S

#

Already logged

robust scaffold
rotund token
#

interesting it was in my 1 entities.foreach in the entire library

#

coincidence? probably not

#

but maybe

#

maybe it was just entities codegen corrupted

#

i didnt actually test if restarting without nuking cache would fix it

viral sonnet
#

you guys made me excited to update. guess i'll wait ๐Ÿ˜…

#

nice to find a ctrl+f feature!

robust scaffold
#

Did you know, a rectangle has 4 points? That's 4 floats for X, and 4 floats for Y. 4 means vectorization.

winged bane
robust scaffold
#

@viral sonnet Needed the ptr CDFE. Hope ya dont mind me taking a copy of ya repo. What's the improvement for BufferTypeHandleFast?

viral sonnet
#

you're welcome ๐Ÿ™‚ i should update the repo again. it's nothing big tbh, uses a lookup cache.

robust scaffold
#

The type names get longer and longer and longer

viral sonnet
#

haha, yeah I think it would be worth it to just rename it to CDFEX ๐Ÿ˜„

robust scaffold
#

Or CdfeUnsafe

#

UnsafeCDFE. There ya go

viral sonnet
#

yeah, good one

robust scaffold
#

I dont remember, is this mixing of CDFE and CDH possible?

viral sonnet
#

yes, but you need to disable safety

rotund token
#

you will get alias errors if you are writing

viral sonnet
#

on the cdfe

robust scaffold
#

All of these are readonlys

rotund token
#

it's obviously not safe if you're reading from cdh and writing cdfe to same entities ever

viral sonnet
#

ah yeah, then it should work

#

but if it complains, you know what to do ๐Ÿ™‚

robust scaffold
#

The massive disable safety tags.

#

Im pretty sure Unity made the tags so ungodly long to discourage people from using it.

#

or at least the peasants without ultrawide monitors

viral sonnet
#

in times of auto completion i have not much issue with them. all start with Native

robust scaffold
#

unsafeCDFE makes the tower of properties slightly better

viral sonnet
#

it does

#

forum post suggested they will add the cache to the buffer but it's not in 0.51. just checked

viral sonnet
#

the lookupCache

robust scaffold
#

Oh, maybe in 1.0 then. BufferAccessor should just be an array of pointers though.

rotund token
#

the Update() on CDFE/BFE will be nice to have as well

viral sonnet
#

i have added my collections now to the repo

#

parallel list and array hashmaps

#

the array hashmap work on either one array with a key offset or 2 arrays. fastest hashmap i could make ๐Ÿ™‚ parallel list is basically a multi threaded list writer with 128 nativelists to write to

#

usage is like a nativestream, just that it expects chunkIndex and don't foget to set the chunkCount before the job is scheduled

#

the index can be abused for whatever ๐Ÿ˜„

#

i should probably make the name more generic. BeginForEachChunk doesn't suggest that any kind of index can be used

rotund token
#

curiously what's the advantage of your array hashmap

#

over just writing to the key/value arrays directly in a regular hashmap

#

is it just api convenience?

viral sonnet
#

pretty much, yeah. easier to setup and the biggest difference is the 1 array option that only uses value but no key array

#

the parallelList can also be indexed with ParallelListHashMap. not using that though in my project

robust scaffold
# viral sonnet i should probably make the name more generic. BeginForEachChunk doesn't suggest ...

Another suggestion:

public bool TryGetComponentRefRO<TUser>(Entity entity, out TUser* ptr) where TUser : unmanaged
{
#if ENABLE_UNITY_COLLECTIONS_CHECKS
    AtomicSafetyHandle.CheckReadAndThrow(m_Safety);
#endif
    CheckComponentIsZeroSized();

    var ecs = m_Access->EntityComponentStore;

    var hasComponent = ecs->HasComponent(entity, m_TypeIndex, ref m_Cache);
    if (hasComponent)
    {
        ptr = (TUser*)ecs->GetComponentDataWithTypeRO(entity, m_TypeIndex, ref m_Cache);
    }
    else
    {
        ptr = null;
        return false;
    }

    return true;
}``` Allow for the the pointer returns to be cast designated as whatever the user wants. For easy inline reinterpretation but no safety checks.
viral sonnet
#

ah, yeah. makes sense

robust scaffold
#

Here's my use case. CircleReal is just a IComponentData wrapper around a single float. I can now inline the reinterpret without having to use another var.

viral sonnet
#

no need to explain. good idea. ๐Ÿ™‚ i have added it

robust scaffold
#

This is what happens when you have 9 components in a single job.

#

I dont know, should I split this into separate jobs or have one megajob