#archived-dots

1 messages ยท Page 284 of 1

viral sonnet
#

i just skimmed over your problem, I actually have no idea what you want to do. just read you want to set z to 0

late mural
#

ah no, that is not what i want lol

#

i have an entity with a desired z axis rotation, i have a gameobject that needs it

#

turns out that is a nightmare to do

#

i know im being an idiot and that there is a simple solution to my issue somewhere, but what the solution is has evaded me for 3 days now

#

im going a tad insane at this point

viral sonnet
#

you want to rotate to this z axis or just set?

late mural
viral sonnet
#

and the xy from the entity doesn't matter?

late mural
#

it does not

#

the x y from the game object needs to stay the same though

viral sonnet
#

do you have a Rotation comp or just quat?

late mural
#

on the entity, i am using the rotation component yes

#

seems a lot more accurate than the rotation from any of the tranform components

viral sonnet
#

so that means you also have a LocalToWorld comp. (makes it easier to get the forward

late mural
#

yes i do

#

wait i think i have a potential idea for something, let me try

viral sonnet
#

the go rotation xy should stay the same?

viral sonnet
#
                Transform goTransform;

                float3 forward = entityLTW.Forward;
                float3 goForward = goTransform.forward;

                var newRot = quaternion.LookRotationSafe(new float3(goForward.x, goForward.y, forward.z), new float3(0, 1, 0));```
#

you can apply the newRot to your go.transform.rotation then

late mural
#

there was something i want to try first, incase im a huge idiot, as i made an assumption that because transform rotation when converted to euler angles was broken, that rotation to euler angles would be aswell, but this may not be the case i realise, so let me try incase i am an idiot first

viral sonnet
#

don't calculate with euler angles. it will start to drift no matter what

#

quaternion exists for a reason

#

basically you can't go from quat to euler and then from euler to quat without float inaccuracy

late mural
#

float innaccuracy doesnt matter too much here, i think, as long as it is only within .01 inaccuracy it will be fine

viral sonnet
#

feel free to try ๐Ÿ™‚

late mural
#

ill try, and if it doesnt work, ill come back and try your solution

viral sonnet
#

float is funny ๐Ÿ˜€

late mural
# viral sonnet

hmm that is inaccurate, im getting an accuracy that is randomly wrong by anywhere from 0.01 to literal hundreds of numbers wrong, i mean how do we go from 1 to 203, that is an insane floating point error to the point of stupidity

robust scaffold
late mural
robust scaffold
#

gotta love them floats

late mural
#

they are the worst, how do you floating point error with over a 100?

#

at that point even ints can have better precision!!!

robust scaffold
#

fixed point is good, and bad

viral sonnet
#

float absolute are fine but relative, over severl frames the inaccuracy quickly adds up

late mural
#

as im telling them the same value, so logicaly it should have the same innaccuracy each time?

late mural
viral sonnet
robust scaffold
#

it's jumping between 0.0001 and 0.9999 every other pixel

#

because frac causes a wrap around at 1, normally it's 1.0001 and 0.9999.

#

hitAngle = hitAngle > 0.99 ? 0 : hitAngle; I just clamp high enough values to 0 to prevent that visualization

#

it's also partially due to floating point error emerging from ddx() as well so it's floating point error^2.

late mural
viral sonnet
#

yeah

late mural
#

i mean it did something

#

not exactly what i had wanted though

#

it changed the x and y rotation, didnt change the z rotation

#

so kinda the opposite of what was wanted

#

oh it is way weirder though than just being the opposite though

viral sonnet
#

how can it change the xy rot of the go when the same xy rot is applied?

late mural
#

i dont know

#

but it is

#

and it is weirder than that though

#

i change the y value of the rotation of the game object in the inspector, it resets to 70 or 250, whichever is closest, and then changes the x angle to something random

viral sonnet
#

whats your code now?

late mural
#
var new_rot = quaternion.LookRotationSafe(new float3(sync_forward.x, sync_forward.y, ent_forward.z), new float3(0, 1, 0));
sync_objects[sync_comp.sync_id].transform.rotation = new_rot;
#

these are how the ent forward and sync forward are defined:```csharp
float3 ent_forward = pos_transform.Forward;
float3 sync_forward = sync_objects[sync_comp.sync_id].transform.forward;

#

dont worry about my weird naming schemes, they make sense to me, although probably no one else

late mural
#

imma probably go make breakfast now, so ill read your answer afterwards, sorry lol

viral sonnet
#

hm, i'll have to think about it

#

wasn't thinking hard enough about it because when you want to get the z-axis(roll) the up vector is actually not 0,1,0. you can get the Up from the LTW too and use instead of the 0,1,0

#

another try: var new_rot = quaternion.LookRotationSafe(new float3(sync_forward.x, sync_forward.y, ent_forward.z), pos_transform.Up); assuming pos_transform is your LTW

late mural
late mural
#

Thank you so much!!!!!

#

you are the best!

viral sonnet
#

๐Ÿฅณ

#

happy to help ๐Ÿ™‚

late mural
#

thanks lol so much

#

im trying to create a water gun, to do this im instantiating some spheres with a lot of initial velocity in the z direction, this should cause them to go flying in the z direction as soon as they spawn right?

#

that is what i would assume, unfortunately this does not appear to be the case

viral sonnet
#

seems to be missing the rotation, isn't it? i'm actually not sure is this is in local or world space. i'd assume it's world space

late mural
minor sapphire
#

Does anyone know why Variable Rate Simulation System Group was added? Was there a problem they are solving with it? Just curious cause it's empty apart from the command buffers

#

perhaps just a bunch of people were asking for it or something..

late mural
#

wondering, to burst compile adding forces to rigidbodies is there anything special i need to do, or will burst auto do it?

#

also how do i add transforms to a component?

minor sapphire
#

if you're in a burst compiled job, then it will do it

late mural
#

oh nice!

#

now i just gotta figure out a way to have a transform in a component

minor sapphire
#

everything in a burst compiled job is run by burst (as long as burst is enabled)

late mural
#

unless it is a structural change that is

minor sapphire
#

if you're trying to do something burst can't do, it will complain at you ๐Ÿ™‚

#

if you haven't specified (without burst) or anything, and burst is enabled, then you can assume burst is running

#

and if you want to know for sure you can check the burst debugger

#

if you want to make structural changes, you are probably using EntityManager directly. Burst will complain if you try to do that in a burst job

#

otherwise you are probably using an entity command buffer, which is burst compatible cause the structural change happens later

late mural
#

woah cool, thanks for the knowledge!

#

is there a primitive or bittible way of getting a game object or transform?

#

specifically for icomponentdata

minor sapphire
#

transforms and gameobjects are managed, that's monobehaviour land. You can work with these things in ECS if you REALLY want to but to work with burst you need to used unmanaged types

late mural
#

ah that is annoying

minor sapphire
#

So you can put them in an IComponentData, as long as it is a CLASS IComponentData, and you dont' try to access it with burst

late mural
#

welp, i need burst so that is unfortunate

minor sapphire
#

I can't remember if you can jobify class icomponentdata

late mural
#

cause my player is a game object, and i need the camera's tranform.forward, to use for aiming a water gun that is an entity

minor sapphire
#

ok wel

#

you want to get that data OUTSIDE of the job

#

and use it inside the job

late mural
#

oh that is clever!

minor sapphire
#

instead of trying to pass in the entire transform

late mural
#

ok, so how would i do that though?

minor sapphire
#

are you using systems, or just jobs in monobehaviour code?

late mural
#

systems unfortunately

minor sapphire
#

either way, in the 'update', before the actual job code, just get a float3 cameraDirection

minor sapphire
#

from, for example, Camera.main.transform.forward

late mural
#

you can just grab cameras like that?

#

didnt know lol

minor sapphire
#

camera has that property

#

which is nice

late mural
#

cool lol, i had no clue, this shall be a lot easier, thanks so much!

minor sapphire
#

No problem

rustic rain
#

Careful

#

Camera.main

#

Is just

#

Object.FindObectOfType Camera and then compare tag for MainCamera

minor sapphire
#

not anymore ๐Ÿ™‚

#

that was improved ages ago

rustic rain
#

Hm

minor sapphire
#

lemme find evidence for you ๐Ÿ˜„

rotund token
#

In contrived test cases containing 50,000 objects, we saw speed increase by 21,000x to 51,000x.
only slightly improved

late mural
#

lol

#

how does main camera work now, as i want to make certain that i dont accidentally choose my main menu camera instead of my player camera

#

also what do i need to import with using to get Camera.main?

minor sapphire
#

It's efficient enough for your needs ๐Ÿ˜›

#

just write the line and if you need a using your ide will tell you, pretty sure it's UnityEngine though

late mural
late mural
#

huh i always thought that on update ran automatically but apparrently it does not in system bases, how do you make something run every frame in a system base?

rustic rain
#

it runs only if there's required query (if it exist), which added automatically through code

#

but can be overriden through RequireForUpdate

#

also

#

there's attribute

#

AlwaysUpdateSystem

late mural
#

ooh how can i use that, cause i have a query and multiple debug logs, and it aint running any of them

rustic rain
#

which bypasses that

late mural
#

i just want to use a for entity loop

rustic rain
#

then it will run only if there are entities for loop

#

assuming

late mural
#

oh that is annoying, that means that i have no physics objects in my scene

rustic rain
#

you call it only through foreach lambda

late mural
#

hmmm, how do i add physics object, real ones, not rigidbodies which dont count as physics objects for some reason?

rustic rain
#

colliders?

#

PhysicsShape

late mural
#

physics shape aint real physics objects though

#

same with physic body

rustic rain
#

I'm not sure what you mean by that

late mural
#

i mean like how do you create a real physic object that can be detected by Unity.Physics

rustic rain
#

ahem

#

do you know that ECS Physics and Classic Physics exist in 2 different dimensions?

late mural
#

yes, and im using ecs physics, atleast i hope so

rustic rain
#

then I have no idea what is your problem

late mural
#

neither do i, but apparrently physics bodies are not physic objects

rustic rain
#

what defines physics objects?

late mural
#

anything with physics velocity and physics math

#

as components on it

rustic rain
#

then they are

late mural
#

?

rustic rain
#

physics shape and physics body

late mural
#

not according to my for each entity loop they aint

rustic rain
#

what is your loop?

late mural
#
            Entities
           .WithName("fluid_destroy_system")
           .ForEach((Entity particle, ref PhysicsVelocity physics_velocity, ref PhysicsMass physics_mass, ref shoot_particle_component shoot_comp) =>
           {
               if (!shoot_comp.has_fired)
               {
                   shoot_comp.has_fired = true;
                   var force_vector = direction * shoot_comp.force_amount; //* delta_time;
                   physics_velocity.ApplyLinearImpulse(physics_mass, force_vector);
                   Debug.Log("added force");
               }
           })
           .Run();
rustic rain
#

and how do you know

#

your particles have all that

late mural
#

exactly i have no way of knowing

rustic rain
#

hierarchy debugger

#

?

#

literally look at all comps it has

late mural
#

ooh ill try that

#

cause currently all i know is that they have the shoot particle component and a physics body and shape

#

i think i have bigger issues

#

over 999 likely leaks

late mural
#

it just does not want to run the for each loop for some reason

#

weird

#

you got any ideas?

#

hmm it seems nothing i try has any different results, odd

#

although the whole leak thing appears to randomly happen sometimes, and not others

rustic rain
#

are you sure it's not running?

#

your log is under conditional

#

you can see whether system is running or not

#

in debugger

#

if system has time instead -

#

in profiler

#

that means OnUpdate is called

late mural
#

and it never runs

rustic rain
#

still

#

take a look at

#

system

#

in debugger

late mural
#

ok i shall, where on earth is the debugger thing?

rustic rain
#

it will at least tell you all relationships with entities

late mural
#

sure

#

anyway, how?

late mural
#

thanks

#

now which one?

#

ok found it

#

here:

#

how does this help us?

rustic rain
#

relationships tab

late mural
rustic rain
#

now you know

#

there are no entities

#

with these components

late mural
#

nice, how do i give them those components

late mural
#

i know how to add i component data components, that is the 1 component they do have

#

it is the 2 physic's components they dont have

#

and i dont know how to give it to them

#

any ideas?

rustic rain
#

there are 2 built in authoring components for go

#

physics shape and physics body

late mural
#

yes, mine have both of those

rustic rain
#

just look at them in hierarchy then

#

and see what they actually have

late mural
#

sure

#

they have it all

#

all 3 components

rustic rain
#

can you show it?

late mural
#

ill try

#

and now suddenly it loses the 1 component i was certain there would be, let me recompile it, and restart unity, due to how annoying components are to make

#

wish components were easy, but they are nightmares to make

rustic rain
#

components are literally just structs with fields, hehe

late mural
#

yes, but it way more complex than that

rustic rain
#

it shouldn't be

late mural
#

half the time they compile incorrectly and you have to restart unity, and then change something in them so that it then attempts to recompile

#

they are nightmares

rustic rain
#

๐Ÿค”

#

that is certainly not smth I ever encountered

late mural
#

lucky

#

example of a component that unity says it cant compile for seemingly no reason, cause there is no error: ```csharp
using Unity.Entities;

[GenerateAuthoringComponent]
public struct shoot_particle_component : IComponentData
{
public bool has_fired;
public float force_amount;
}

rustic rain
#

that is certainly not smth most people from here encounter either

late mural
#

i dont get it

rustic rain
#

are you using ctrl+R hotkey?

late mural
#

no?

rustic rain
#

it'll force recompile

#

no need to do restarts

late mural
#

oh, thank you so much!

#

i wish i had known of that hot key earlier

rustic rain
#

it's also reimport option through right click in folders

late mural
#

welp thank you!

#

and sometimes like now, i just cant seem to get the component to work

#

it just wont

rustic rain
#

File must be same name as component

#

or else MonoBehaviour

#

will not be created

#

or actually, it won't be seen by Editor

late mural
#

i think they are the same name

late mural
#

i dont get how to make components

#

i just dont get it

#

they are nightmares

#

i avoid them when possible, but in cases like now, they are useful, even if they are a pain

#

that is one thing that ecs needs to fix fast

#

cause the longer components are a pain, the less i like using ecs

#

mono behaviours might be slow, but atleast they work first try, rather then the hours or days i have to spend getting a single component to work

rustic rain
#

๐Ÿค”

#

they work first try for me, sir

late mural
#

welp they dont for me

#

never have

rustic rain
#

there's just smth wrong with your workflow

#

which I can't figure out what

late mural
#

exactly, hence why i hate components

#

they work randomly

#

never consistent

#

you get a game object, you tell it to conver to an entity, you attatch a component to it, what happens next can go 1 of 2 ways:

#

a: it works and the entity has a component

#

b (more likely): the entity has no component

#

it is pointless to try debugging, because there is no issue to solve, randomly removing and adding the component and changing the order of lines in the component code, and eventually it solves itself

#

problem is this takes hours, sometimes days

rustic rain
#

that is exactly what debugging is supposed to solve

late mural
#

yet is doesn't

rustic rain
#

debugging is tool

#

and it is user which defines how well it'll behave ๐Ÿ™‚

late mural
#

and i dont get how to debug

#

caue the debugger tells me obvious stuff only, such as the component being or not being there

#

nothing else

#

if there is more to the debugger which i dont get, speak now, or forever hold your peace

rustic rain
#

are you familiar with breakpoints?

late mural
#

somewhat, i crashed my computer the first 3 times while attempting to use them, then never touched them since

late mural
minor sapphire
#

it is a somewhat essential tool for debugging ๐Ÿ™‚

rustic rain
late mural
#

ok, welp im gonna have to set up a new ide then

#

cause my current ide when doing break points freezes my computer to the point where i have to power button it

minor sapphire
#

ok well that's not good lol

late mural
#

ye, my computer is a tad old

#

the only reason i even started using and learning dots was to try and get decent framerate

minor sapphire
#

motivated by your old hardware. interesting ^^;

late mural
#

yup lol

#

oh well if i can optimize my games on this computer, imagine how well it will run on normal and good computers

#

i suppose i better go now do some research into which ide uses the least proccessing power for break points

minor sapphire
#

oh god please don't pick your ide on this criteria ๐Ÿ˜†

late mural
#

i install multiple ides, each one optimized for a certain purpose in developing my game

#

it is a tad annoying sure, but required in my case

minor sapphire
#

terrifying

late mural
#

i hate omnisharp with a burning passion

minor sapphire
#

I get using different IDEs if you need a feature another doesn't have, but like "which one processes breakpoints the fastest*

#

T_T

late mural
#

yup lol

#

old computer goes brrr

minor sapphire
#

none of them should be freezing your computer something else is going on

#

dm me

late mural
#

sure

muted star
#

Yea that would be cool, don't know if it's possible though. You could create a script template in your IDE so you don't have to write as much boilerplate.

rustic rain
#

oh man

#

I just came up with a nice way for workflow, heh

#

Imagine creating world instance as GameObject, where you can define serialized System Instances that will direct references to assets/objects

rustic rain
#
            Assert.IsTrue(catalogData.IsCreated, "The scene catalog has not been loaded yet");
            return catalogData.Value.GetGUIDFromPath(scenePath);
#

hmm

#

why is it getting triggered?

#

android build

#

SceneSystem

#

also this
Failed to load native plugin: Unable to lookup library path for 'lib_burst_0_0'.

misty wedge
#

I have an abstract system that implements methods to automatically get an ECB and register dependencies, and then systems can inherit that system

rustic rain
#

put it in fixed update group

solemn hollow
rustic rain
#

huh

solemn hollow
#

So i dont have to write any AI systems anymore. i just define a system in that SO and it works

rustic rain
#

yeah I kind of want to do that too.

#

Instead of creating world through custom bootstrap

solemn hollow
#

i never looked at DOTS scritping but id imagine it was kinda similar

rustic rain
#

use some Mono that will instantiate it in Awake

#

and add systems serialized

devout prairie
#

How many entities?

#

Hey folks, i'm destroying some child entities during Convert, but the parenting system is throwing an error about the entities not existing - is there a proper way to destroy during conversion?

#

Yeah one thing i noticed with havok is it has sleeping, which will give some gains where bodies aren't moving around

#

Only thing is the determinism thing if it's going to be networked

#

What kind of colliders are they and are there joints?

#

30k is quite a lot tbf

#

last test i did was around 12k i think with reasonable rates

#

haven't looked at optimizing though

#

that was literally just a quick, dump a bunch of objects in a scene and test

#

this is i think around 12k bricks and 800 ragdolls

devout prairie
#

with that particular test, the sleeping capability of havok definitely had an impact, over unity physics, but i've found unity physics to be quite decent and in some cases better

#

other thing is maybe tweak iterations, but beyond that i'm going to start looking into some optimizations myself pretty soon

#

i'm not exactly sure on that, but definitely by default unity will respawn the whole build world system etc multiple times per frame if things invalidate the world or need rebuilt

#

something interesting with the physics samples is they set the fixedrate manager to null, which i think kinda forces a single build world per frame

#

i think application target framerate might have some impact, but still not sure on this tbh

viral sonnet
#

how is it possible that the mere existence of entities can bring down the whole playerloop? (around 6ms) I thought that's not possible. There's no work done on these entities. (and they are a LOT 7.25 million) - still, should only be memory?

#

my ai job alone goes from 0.6 to 2.2ms - I don't get it, timeline looks very similar so it's not that some thread seems clogged up

devout prairie
#

are they maybe part of a query even if the work is not being done?

viral sonnet
#

good thinking, i removed the query. still the same. also closed the dots hierarchy window (wasn't focused) and also still the same

devout prairie
viral sonnet
#

updating a system in FixedStepSimulation group

#

it's a sub group of Simulation system group

pliant pike
#

are burst safety checks on and jobs debugger

rustic rain
devout prairie
rustic rain
#
            RequireForUpdate(
                GetEntityQuery(new EntityQueryDesc
                {
                    All = new[] { ComponentType.ReadOnly<PlayerTag>() },
                    Options = EntityQueryOptions.FilterWriteGroup
                }));

hmmm

#

I wonder how that would work

viral sonnet
#

so? you can put as much as you want in there. Simulation System Group will always run on every frame.

#

what the? am I the only one having broken BuildConfiguration? If I want to Add Component the window doesn't update.

#

is this a 2021.3.5f1 thing?

rustic rain
#

yep

#

it's 2021 thing

viral sonnet
#

god damn

rustic rain
#

annoying

#

you can try create whatever assets you want in 2020

#

and then import them into your project

viral sonnet
#

yep, I see no other way ๐Ÿคฃ

rustic rain
#

you can also use search

#

if you know exactly name of component

#

it'll just be on top

#

of hiearchy

#

and you can blindly pick it

viral sonnet
#

ah good thinking. I want to set the build to what was it called, smaller buildsize or smth. so the generics bug isn't happening

#

Have you tried select IL2CPP build type to Faster(Smaller) Build??
Where do I set this in a BuildConf?

devout prairie
#

is there a built in way to tag a child object to not be converted, say a child of a prefab

#

i'd like to use a child gameobject as a reference for position, store the value during Convert, but not have that dummy child object be converted to entity

#

tried destroying the entity with dst manager during Convert, throws an error because the parent system is expecting that entity, tried Object.Destroy but it doesn't like it much either.. final solution is tag it with a custom DestroyThis tag and have a LateDestroy system which runs after Transform and destroys the entities

#

final solution works but just wondering if theres, like, a way already for this

rustic rain
#

converted subscene won't have it

devout prairie
#

it's not in a subscene as yet.. and as i say because the conversionSystem has already picked up the object and marked it for inclusion in the parenting system, destroying the primary entity during Convert causes an error when the parenting system then looks for that entity

#

so if there was some way to mark that child object to be ignored by the conversion system it'd save some work

#

so kinda like the opposite of applying a ConvertToEntity component to the gameobject

viral sonnet
#

screw it I'm going back to 2020.3. They have really botched this release

rustic rain
viral sonnet
#

huh? 2020.3 was totally stable for me.

#

i like the snapiness and speed of 2021 but with those weird ui glitches and build problems I'll have to postpone it somewhat. Hopefully next Wednesday they have a fixed version.

#

but I doubt it. Probably too minor on their list and fixed in 1.0

rustic rain
#

can't wait for 2022

viral sonnet
#

with their rare updates I'm not too hopeful that it'll have the expected quality

#

it'll have a ton of new (untested) features

#

eh, I'm just salty right now. (and hungry) ๐Ÿ˜…

safe lintel
#

@devout prairie are you using GameObjectAfterConversionGroup? also tbh im not sure if destroying actually works, I recall having issues with it myself but need to test again

#

actually a quick test showed it worked

#
    public class DestroyDuringConversionAuthoring : MonoBehaviour { }

    [UpdateInGroup(typeof(GameObjectAfterConversionGroup))]
    public class DestroyDuringConversionSysten : GameObjectConversionSystem
    {
        protected override void OnUpdate()
        {
            Entities.ForEach((DestroyDuringConversionAuthoring authoring) =>
            {
                var entity     = GetPrimaryEntity(authoring);
                DstEntityManager.DestroyEntity(entity);
            });
        }
    }
karmic basin
viral sonnet
#

I saw it there. Is this setting used in my buildconf?

#

I assumed those pipelines are split

karmic basin
#

Yeah the build config is just an override for the usual build

viral sonnet
#

ok, i see. thanks

karmic basin
#

Mainly to add subscene support as far as i'm aware

devout prairie
solemn hollow
#

is it that big of a deal to delete it in first frame? i got some problems with the current conversion too but most of it is solved with systems just running once in first frame and afterwards removing some Tag to never handle them again

viral sonnet
#

is conversionSystem.CreateAdditionalEntity the only way to create an entity during conversion? dstManager.CreateEntity doesn't create one

#

if so, is it possible CreateAdditonalEntity adds performance baggage that's not directly visible in the Inspector?

solemn hollow
#

somewhere in the conversion docs it says that CreateAdditionalEntity should be the only way to create Entities in Conversion reliably

solemn hollow
viral sonnet
#

and build has the same perf

#

so it's not just some editor thing

solemn hollow
#

i mean all that bookkeeping and filtering is iterating over chunks somehow. if you got too many of them maybe it scales bad at some point?

devout prairie
solemn hollow
#

do you use changefilters?

solemn hollow
#

for now i do it in first frame and as soon as you can have Systems running in conversion after EVERYTHING is done (LinkedEntityGroups) ill just plug it in there

devout prairie
#

maybe it would be better for you to create one prefab of your object, and then in a later system instantiate them?

solemn hollow
#

@viral sonnet what does the profiler say? anything in particular got slower or just every single system?

devout prairie
viral sonnet
#

everything isl ike 15-20% slower

devout prairie
#

maybe clear entities cache and/or restart the editor?

viral sonnet
#

i've tested this now in 2021, 2020.3 and in build ๐Ÿ™‚

solemn hollow
viral sonnet
#

that should be the characteristic. I've removed the system query too

solemn hollow
#

you removed all queries or just the one handling your additional entities?

viral sonnet
#

I only have 1 query that's using those entity comps and that was removed

rotund token
viral sonnet
#

even if those are not in the same archetype?

rotund token
#

Yes

viral sonnet
#

๐Ÿ‘Œ design

rotund token
#

A query has to iterate all chunks to see what chunks match the query

viral sonnet
#

oh boy

#

well thanks for the answer, makes sense then. kind of fked though

solemn hollow
#

yes that was what i thought :S is there a way to make it faster? like grouping/sorting queries or chunks somehow before checking?

#

chunks beeing sorted into chunkchunks

viral sonnet
#

why are entityqueries not associated with archetypes and cached. i mean whoa I'm baffled how bad this is

solemn hollow
#

cause why check 1000 chunks if the first one of that archetype doesnt fit

devout prairie
#

that's kinda what i woulda thunk tbh

rotund token
#

99.9% of projects don't just have, your archetype and some random archetype

#

they have 8000 different archetypes

#

you're optimizing a benchmark not for real world conditions

viral sonnet
#

and how can you even make a proper game with this when you'd have millions of rendermeshes and all are affecting other system speed

solemn hollow
#

but to be fair all of unities demos had like 5 archetypes ๐Ÿ˜„

#

wait. breaking it up into a diffrent world could work?

rotund token
#

you open/close subscenes as required

#

and most large games implement some form of relevance

#

for the record

#

entity queries do cache their it does cache their ArchetypeChunk list now

dreamy glade
#

I was attempting to install the DOTS packages, first starting with Hybrid (as I've seen recommended online) and these errors occurred:

Library\PackageCache\com.unity.entities@0.51.0-preview.32\Unity.Scenes\Hybrid\CompanionSceneUtility.cs(62,37): error CS0103: The name 'PreviewSceneFlags' does not exist in the current context
Library\PackageCache\com.unity.entities@0.51.0-preview.32\Unity.Scenes\Hybrid\CompanionSceneUtility.cs(62,82): error CS0103: The name 'PreviewSceneFlags' does not exist in the current context
Library\PackageCache\com.unity.entities@0.51.0-preview.32\Unity.Scenes\Hybrid\CompanionSceneUtility.cs(62,82): error CS0103: The name 'PreviewSceneFlags' does not exist in the current context```
I hope someone may be able to help me or at the very least direct me in the right direction! I attempted to clear/delete my library folder and reinstall the packages, but neither worked. Thank you.
solemn hollow
#

hmm still this scales worse than i expected. they market it with render millions of the same stuff on screen and have 1000 fps and yet the more systems you have and the more entities you have it gets exponentially worse :S

rotund token
#

more entities you have it gets exponentially worse
a) pretty sure it's linear b) it's more to do with archetypes than entities

#

archetype changes invalidate the queries cache

solemn hollow
#

no its not archetype count for enzi (its chunkCount). he has a single archetype entity in the millions which he doesnt do anything with.

rotund token
#

as for why a job would be slower

#

it's probably just because the ai chunks are further away in memory than before or something

#

people have been complaining about job schedule performance for a long time, but really the big benefit of ISystem is query lookup + dependency handling

#

this all said, without seeing what enzi entire project is doing it's hard to speculate

#

i'm currently testing 10,000,000 entities and my simulation system group is 0.15ms

#

now my presentation is nearly 1ms without having a single renderer in the scene

solemn hollow
#

but you are testing with a low amount of queries running right?

rotund token
#

not really

solemn hollow
#

hmm ok

rotund token
#

probably 25 systems atm

#

but only 3 have valid queries atm

#

obviously that's small for a full application

devout prairie
#

i take it just having a query inside RequireForUpdate could potentially slow things down

#

in the above case of lots of archetypes and millions of entities

rotund token
#

instead of checking potentially every query in your system to run

#

it only has to check 1

devout prairie
#

yeah that makes perfect sense

#

i wonder if, in the above example ( Enzi's case ) if he has say just one system and it uses RequireForUpdate, that single query could still cause the slowdown, even if the system doesn't run.. would it then be better to hypothetically just have say a bool flag that early exits the system rather than a query

rotund token
#

how would you update the flag

#

no amount of entities should require you to run at 2ms for a query

#

even on old consoles when we had an archetype explosion issues the worst case we were having was like 3ms for queries/frame

devout prairie
rotund token
#

please don't misunderstand me, i'm not saying enzi's entire performance woes are from increased query lookup time. he simply asked

how is it possible that the mere existence of entities can bring down the whole playerloop?
and I pointed out a case

devout prairie
#

yeah

#

i think the issue is it seems millions of entities is kinda the whole point ( or to have that capability ), so what is actually causing his issue

#

just thinking out loud here

dreamy glade
# karmic basin Which Unity version ?

Yeah- updating it right now. I'll be sure to let you know if that was the cause! I finally saw in the docs the necessary versions. I had 2021.3.3.

karmic basin
#

Great ๐Ÿ‘Œ

viral sonnet
rotund token
#

i have no structural changes in this, so if i was doing some per frame it could get worse

#

but just as a default systems executing with perfect caching etc the overhead is negligible on my small system set

#

oh except presentation where even though i have 0 presentation entities it just has this giant overhead ^_^'

#

hopefully goes way a bit in builds i haven't tested - though in reality any build would have actual rendering entities

#

it's just an interesting amount of overhead for 0 renderers

viral sonnet
#

what do you have without the millions of entities?

#

where it's getting strange I think is when a job struct takes longer. the system overhead of getting queries, etc... shouldn't affect the job itself, right? unless that's accounted for in the timeline

rotund token
#

1000 entities - exactly the same

rotund token
#

i wouldn't have expected that much of a difference though

devout prairie
#

How come NativeArray doesn't have AsParallelWriter? Whereas like NativeList etc do..

viral sonnet
#

Why would it need one?

devout prairie
#

i'm having this problem, when writing to a nativearray inside a parallel foreach job:

viral sonnet
#

what's your code here? you have it pre-allocated and are using valid indices, right?

devout prairie
#

previously as far as i can remember, where i've passed in NativeList or NativeHashMap i can pass them in AsParallelWriter and it circumvents this indexing problem

#

yeah

#

let me show the setup

viral sonnet
#

list and hashmap have a ParallelWriter for adding and because they can change their length

devout prairie
#

yeah in this case i'm literally just writing to existing indexs

rotund token
#

the safety system supports writing to native array in parallel to the same index as a ijobfor

devout prairie
rotund token
#

apart from that you have to turn off safety

#

and promise that you aren't causing threading issues

devout prairie
#

it only allows the job index which is, a bit stupid given it's an external array using completely different indexing/length

rotund token
#

how can the safety system know what you're doing is safe?

#

you could be writing to anything

devout prairie
#

so if i turn off safety in the player settings it will allow this?

#

mm yeah seems a conflict of interest to me

rotund token
#

[NativeDisableParallelForRestriction]

#

is how you turn off the parallel safety

#

but then you're on your own to not fuck it up

devout prairie
#

i can understand it where it applies to indexing the entity query and it's related components, but not to an array that's passed in

devout prairie
#

thanks

rotund token
#

it's not safe to write to an array in parallel unless you can guarantee to never share indices

#

so of course it's blocked!

devout prairie
#

well yeah i can see the thinking there

#

so it restricts to the job's index range

#

even for arrays that are external to the query

viral sonnet
#
    //[ChunkSerializable]
    public unsafe struct StatReferenceBuffer : IBufferElementData
    {
        [NativeDisableUnsafePtrRestriction] 
        public AvatarStat* StatPtr;
    }``` one culprit down. uncommenting the tag costs me 4-5ms for 250k entities
rotund token
#

hmm wouldn't that just mean the component would no longer be serialized in a subscene and left out of the archetype stopping systems from updating?

viral sonnet
#

there's no system using it so ๐Ÿคท

#

and yeah, I've added it because unity complained about serializing the pointer. I've done this before and builds were broken if I not use ChunkSerializable

rotund token
#

should just break in editor generally

viral sonnet
#

again it's a case of, what happens to my performance?

#

the buffer is empty on all entities and not used. how can 4-5ms get lost

devout prairie
#

kinda loosely wondering about this atm:

#

say you have a parallel job and it needs an array of say 13 slots to write to, and then read from

#

would it make more sense to make one bigger persistent array of 13 * threadcount, and pass that in

#

or have the job create its own little array of 13 on each thread when it runs and then discard

#

i would guess creating the arrays on the fly would be more time consuming

#

than just accessing an existing persistent array

viral sonnet
#

you'd be better off with a NativeStream

devout prairie
viral sonnet
#

it's a great parallel writer out of the box. of course you could allocate 128 arrays with 13 elements. just takes more effort

#

you know what's great when doing performance timing tests. windows updating and failing all the time -.-

safe lintel
#

btw @devout prairie it shouldnt be the case because using GameObjectAfterConversionGroup the parenting should be completed

devout prairie
devout prairie
#

Well damn

solemn hollow
#

pretty sure at that point a job is nicer to read :S

devout prairie
#

hehe i refuse to accept that

dreamy glade
rotund token
#

ijobentity would be so much cleaner

devout prairie
#

for now, i'm converting a prototype into an ecs prototype

#

which i now have working, so i'm converting to parallel

#

as it is tbh i love ForEach it's just really simple and easy

#

but i'll definitely look at using struct jobs at some point

#

just seems more typing for the same thing

late mural
#

hey im quite new to the way adding forces works with dots physics, as such im watching a couple tutorials, most are old from 2020 or earlier, just checking, is the current method still the same as these old tutorials?

safe lintel
#

yeah sadly still the same

late mural
#

ok, thanks!

late mural
safe lintel
#

I think it was released in 2019, and hasnt really changed a whole lot since. the initial release and patches were really fast, but theres been nothing significant since 2020

late mural
#

oh unlucky

safe lintel
#

i just want faster development ๐Ÿฅฒ

late mural
#

ye it would be nice, oh well im sure they are doing their best

devout prairie
late mural
#

one thing i am wondering, if you have a prefab (the fake kind), and you then tick convert to entity, would it become an entity?

safe lintel
#

well some core stuff would be official joints, I personally want the unification of shapes and body authoring because I find it tiresome to add both, better trigger/collision workflow and parallel processing would be nice. then my wishlist is some sort of destruction workflow, ala unreal(probably a pipedream though)

#

better debug systems(current is ass)

#

better api tbh, and modifying colliders at runtime isnt really supported

late mural
#

ye those could i nice i suppose

safe lintel
#

report a bug and post about it in the dots graphics forum, not sure what else you can do at the moment

late mural
#

i had something similier, although i had no error, but i have had the invisible entity bug before, for me i just kinda ignored it and one day it just stopped happening, but i wish you luck finding a solution in your case!

late mural
#

congratz!

viral sonnet
#

was just feeding the baby when windows was updating. now i came back and my pc is dead

late mural
viral sonnet
#

sure, it's just a veeery weird coincidence

late mural
#

perhaps try downgrading to the previous windows update?

viral sonnet
#

no the pc is dead. no lights, nothing ๐Ÿ˜…

late mural
#

oh, that is very unfortunate, and power button aint even attempting booting?

viral sonnet
#

nope, guess the power supply is fried or smth

late mural
#

unlucky, hope you manage to fix it!

viral sonnet
#

thanks :)

late mural
#

wish you luck!

late mural
#

im trying to implement a water gun, as such im trying to detect when a button is pressed inside a system base, im wondering is there any special method to do this, or do i just use the on update and just tell it to always run?

safe lintel
#

like a keyboard/mouse button?

#

simplest is to poll it in update just before schedule/run the job, i personally have an input system that takes all mouse/keyboard and stores that button press info in a component, and then query that component in jobs

late mural
#

thanks so much!

#

first i have to figure out how to make the on update function run every time then in this system!

#

apparently there is something called AlwaysUpdateSystem, but i cant seem to figure out how it works

#

aha i think i got it working!

late mural
#

ok almost got it working, just tryna work out how i get something to run once at the start, something like a monobehaviour's start()

#

google says that OnCreate() would be what im looking for, although im pretty sure that is old outdated info, as it isnt working

#

hmm i really cant figure it out, anyone who knows what im looking for pls tell me, as i cant find any info

coarse turtle
late mural
#

but i shall try OnStartRunning!!!

#

Thank you so much, it works!!!!

rustic rain
#

look at manuals

#

they have according syntax

#

which has changed a lot through versions

rustic rain
#

yeah, like these

#

entities also has it's own page

rotund token
#

why use pre-50 anyway

rustic rain
#

bruuuh, feels so bad I can't get query outside of foreach with filter group

#
            Entities.WithEntityQueryOptions(EntityQueryOptions.FilterWriteGroup)
                .ForEach((ref PlayerGravityTag pgt) =>
                {
                    _curMov.X -= 0.5f * Time.DeltaTime;
                    _curMov.Y -= 9.81f * Time.DeltaTime;
                    Debug.Log("keked");
                })
                .WithoutBurst()
                .Run();
#

hmmm

#

why is it running

#
    [WriteGroup(typeof(PlayerGravityTag))]
    [WriteGroup(typeof(PlayerRotationTag))]
    [Serializable]
    public struct PlayerFlyingUpTag : IComponentData
    {
    }
#

I have this

#

which should ensure it won't run

#

bruuuuuh

rotund token
#

What is player gravity tag

#

You're not writing to anything?

rustic rain
#

I only need it for filtering

#

causing writing is done to managed component

#

but seems like system failed me with it

rotund token
#

You can't write group a tag

rustic rain
#

I guess I can just add a field, kek

#

empty one

rotund token
rustic rain
#

and desc will contain FilterWriteGroup

#

so entities in query will only contain entities without write group

rotund token
#

Yeah? I'm not getting problem

rustic rain
#

hmm

#

Could you show how it looks?

#

Even in codegen it transforms desc Options to Default

#

for some reason

rotund token
#
            {
                All = new[]
                {
                    ComponentType.ReadWrite<EffectActive>(),
                    ComponentType.ReadOnly<ConditionActive>(),
                },
                Options = EntityQueryOptions.FilterWriteGroup,
            });```
#

is this what you mean?

rustic rain
#

yeah

rotund token
#

(also ah, did they fix the bot)

rustic rain
#

so, this filters EffectActive?

rotund token
#

(i didn't get deleted from face of earth)

rotund token
#

it'll filter on anything with write

rustic rain
#

so if there's any component with writegroup typeof EffectActive entities are filtered?

#

why it doesn't work for me

#

bruuuh

#

lemme check again

rotund token
#

Because it was a tag component

#

Or managed component

#

Or something like that

rustic rain
#

managed components work with write group though

#

I did check

#

they can't contain attribute

#

but they can be affected

rustic rain
#

ahem

#

HR2 should work fine on mobiles

rotund token
#

pretty sure it supports mobile

#

but android only supports Vulkan

#

Currently, Hybrid Renderer does not support desktop OpenGL or GLES. For Android and Linux, you should use Vulkan. However, be aware that the Vulkan drivers on many older Android devices are in a bad shape and will never be upgraded. This limits the platform coverage Hybrid Renderer can currently offer on Android devices. OpenGL and GLES3.1 support are planned for a future version of Hybrid Renderer.

#

depends how old your phone is

#

hmm thought s7 was first to support it

rotund token
#

i don't do mobile development anymore

#

i just know devs making games for mobile

frosty siren
#

Did anyone solve the problem with state machine design in ECS? I have seen few approaches

  • use tag component per state + component with ComponentType field which stores current added state tag type to be able to remove it without knowing actual state: the problem with data copying still exist when state changes are frequent. (also using ComponentType in components may break deserialization process if type set in assembly was changed, but experienced devs recommend to write simple save system and don't try to use ecs serialization)
  • use shared state component, so you can change it. Writing to this component by itself moving entity to another chunk: the problem is data copying + filtration by shared component in every system which handle state
  • 1 component for state and a god system which handles all possible states
  • other solutions which leads to breaking a rule that system have only logic and entities have only data.
rustic rain
#

then I have helper method for EntityManager/ECB which lets me remove all IGameState ComponentTypes from state entity

#

and add whataver is picked

#
    public static class GameStateUtility
    {
        static GameStateUtility()
        {
            GameStates = new ComponentTypes(TypeUtility.GetAllAssignableFromComponentTypesArray());
        }

        public static readonly ComponentTypes GameStates;

        public static void SetGameState<T>(this EntityManager em, in Entity stateEntity)
            where T : GameState.IGameState, IComponentData
        {
            em.RemoveComponent(stateEntity, GameStates);
            em.AddComponent<T>(stateEntity);
        }
    }

Kind of like this

frosty siren
#

so you just gather all your state tags and remove it brutally

#

have you tested this with lots entities?

rustic rain
#

nope

#

I don't have too much states

rustic rain
#

it's native way of removing ComponentTypes

#

a lot of iterations for the cost of 1

frosty siren
#

i mean for N state there would be N-1 unnecessary checks if component exists on entity

#

also AFAIK ComponentTypes may contain only ~6 types

rustic rain
frosty siren
rustic rain
#

it literally just switches archetype

frosty siren
#

Hmm, ok. But still can't store lots of components inside one ComponentTypes struct

rustic rain
#

that's true

#

allthough

#

I just figured

#

why even use components switching

#

when you can just change archetype

#

@frosty siren

#

just store archetypes somewhere

#

and change state entity archetype

#

that's it

#

no need for component types switching or smth

#

I only wonder how to access those archetypes statically

rotund token
#

what if you have another component added/removed at runtime?

#

i have pretty clean state machines

#

but that auto register components in the state

#

but it's a bit hard to explain

#
    {
        byte Value { get; }
    }
    
    public interface IStateFlagComponent<T> : IComponentData
        where T : unmanaged, IBitArray<T>
    {
        T Value { get; }
    }```
can either be unique or flag based (up to any size flags you want)
rustic rain
rotund token
#

because an entity can change state?

#
  • flee
  • follow
  • avoid
    etc are all movement states an entity might have
#

but you can use states for a lot of other things

#

current UI, input, etc

rustic rain
#

hmm, I actually meant states for game

#

on which systems rely

#

not what's inside system, hehe

rotund token
#

oh that's fair

#

i actually use the same underlying system for this

#

but i use systems for each state

#

and OnStartRunning

rustic rain
#

yeah

rotund token
#

as like, state enter

#

think i've shown that off before

#

it's an, interesting approach

rustic rain
#

I copied it from you, kek

devout prairie
#

Curious about this.. Just changing system/ecb order, the second is about twice as fast as the first:

rotund token
#

the timings on this window are close to useless

#

if you have 234123423 systems before your system, and then your system causes a sync point
all the timing data goes tot hat 1 system instead of the million before it

devout prairie
#

So i've selected my main system, and highlighted in green the ecb it's targeting.. The version which delays ecb until the next frame seems to be doubly fast than the one which plays back in the end sim ecb

rotund token
#

that's not surprising at all

#

you've let your jobs run while rendering

#

the frame doesn't end at endsimulation

#

it then has the entire rendering part to do

#

if you use end simulation you are just triggering a sync point then

devout prairie
#

hmm ๐Ÿค”

rotund token
#

and then during rendering threads are empty

#

at work endsimulation is banned

#

we use begin presentation - though this is because we slice like
client int, server int, client update, server update, client presentation, server networking

#

this way server/client can execute jobs while the other is updating

devout prairie
#

ok so i figured, each ecb is basically a sync point anyway, so it's not going to make a difference which one i choose per say

rotund token
#

the later the sync point the better

devout prairie
#

well end sim is the latest right

#

you mean earlier?

rotund token
#

it's not hte latest

#

as your own diagram above shows you

#

using the ecb on the next frame is later

devout prairie
#

ah right i get you

rotund token
#

than using the ecb at the end of current frame (and it's only the end of simulation, not end of frame)

devout prairie
#

yeah that's interesting, thanks

#

hmm

#

something to think about

#

good point re doing some work while rendering

#

rather than trying to do it all inbetween all of the other system work

#

not trying to over optimize at this point but was just wondering as the differences were really noticeable

#

worst case i'll get like 10fps compared to best case of 29fps just by changing job/ecb ordering

rotund token
#

you should never use endsimulation really

#

on server you should use begin init, on client begin presentation

#

the pain comes from them being different ecbs

#

which is a huge pet peeve of mine

hot basin
#

so isn't postponing new values to next frame best you can do and you should always target this behaviour?

#

I was wondering about this a while ago

#

why we don't render previous frame while calculationg next one

devout prairie
hot basin
#

I read this as same as I wrote

rotund token
hot basin
#

you should have presentation at the beginning of the frame, and then calculations

#

and you should use on init/presetnation one whichever is first

#

in this way you can calculate next frame why rendering so both CPU and GPU have something to do

#

schedule is on ONE thread and scheduleparallel is on many threads

rotund token
hot basin
#

yeah, I mean it from perspective of using ECB not actually moving systems

rotund token
#

you can't

#

what do you mean?

#

hmm, if you have to ask that question i'm going to stick with you can't

#

dots time can only be pushed in a system

hot basin
#

all I can add is that you probably want to pause game between frames not actually in random point

hot basin
rustic rain
#

rendering is in Presentation

#

between them there's ecb which causes sync

#

so

#

if you want to manually cause Update on system : .Update(); method

devout prairie
#

there is a DisableAutoCreation flag i think, so you can then manually create the system ( which will then start it running )

#

'[DisableAutoCreation]' attribute

hot basin
rustic rain
#

why would you?

#

Presentation is mostly managed anyway

hot basin
#

to move calculations of next frame after presentation

#

so you would calculate things while rendering

rustic rain
#

that would mean

#

it's impossible

hot basin
#

why?

#

you can schedule calculations for next frame

#

and then do rendering

rustic rain
#

what's the point?

#

you are still scheduling and rendering on main thread

hot basin
#

but you are calculating next frame in background

#

if you are using end simulation ECB the current frame needs to be calculated before actual rendering

#

so you will get more of: SCHEDULE -> RENDER -> SCHEDULE -> RENDER

#

instead of: SCHEDULE -> WAIT -> RENDER -> SCHEDULE -> WAIT -> RENDER

rustic rain
#

ahem

#

but wait before render is literally calculation of jobs

#

if you don't wait - data will be corrpu

#

you can't calculate components while rendering

rustic rain
#

when running all on single thread becomes not worthy

#

scheduling into parallel is costly

#

so either do it when there's too much entities or when processing chunks is super expensive

solemn hollow
#

for me default is ScheduleParallel. only if i have some algorithm i need to run singlethreaded i go with Schedule

#

throughput vs speed i guess. scheduleparallel will complete the work faster for heavy loads than a single thread even though schedule will take less overall time summed over all threads. so if you want short delays between when the job is scheduled vs when its finished scheduleparallel should be better after some workload threshold

devout prairie
#

Yeah i think basically if you're doing a lot of work, parallel will be faster, but if you're not, it might not be any quicker

rustic rain
#

which is probably not free

devout prairie
#

Like if the work to do already takes less than the time to schedule etc, you're not going to gain anything

solemn hollow
#

well at that point youd probably use Run() though

rustic rain
#

Adds an IJobChunk instance to the Job scheduler queue for parallel execution. Note: This method is being replaced with use of ScheduleParallel to make non-sequential execution explicit.

#

hmm

devout prairie
# solemn hollow well at that point youd probably use Run() though

Yeah i guess the problem with Run is it's blocking the main thread and more importantly isn't part of the dependency chain of scheduled jobs.. So i think that needs to be considered ie order of what you're changing/updating with a Run and how it slots in to other stuff that is being Schedule'd

solemn hollow
rustic rain
#

kind of odd comparison

solemn hollow
# rustic rain kind of odd comparison

not sure i understand what you think im comparing. i am talking about mainthread here. if you want to do a very simple operation like 1 sum why would you schedule it. schedule would be way more expensive for the mainthread. the job does the same work as the mainthread would (the 1 sum) but you got all that scheduling overhead on mainthread too.

devout prairie
#

i take it there's no guarantee of the order that Run will execute in comparison to scheduled jobs

#

or does it always run before or always run after scheduled work, no idea

rustic rain
#

Run runs now

#

exactly the moment you do run

#

kek

solemn hollow
#

AFAIK when there are Dependencies to be resolved before Run can execute you'll get a Dependency.Complete call. basically a syncpoint for the components involved

north bay
rustic rain
#

I wonder

#

why double buffer is not a native thing

north bay
rustic rain
#

I mean, why wouldn't Unity add second buffer in vanilla

north bay
#

Well, how would it know what data you want?
The one that you are writing to in the previous system or the one from the last frame

rustic rain
#

that's the point

#

you pick it yourself

rotund token
#

Buy new hardware

rustic rain
#

better PC?

#

xD

solemn hollow
#

Disable Physics

safe lintel
#

it was meant only for project tiny(rip) so expect headaches trying to use it at this point

rustic rain
#

0.17 only

tired glade
#

Is there any trick to getting Entity collision working?
I have a Sub Scene with 2 GameObjects. Each has a nested object containing the Physics Shape. When I run it, they pass right through each other. Is there something else needed to have them not do that? or does it just not work with nested game objects?

rotund token
#

Colliders are always root objects

#

If you put a collider on a child it will unparent the child during conversion

solemn hollow
#

oh i thought thats only for bodies not for shapes

rotund token
#

Hmm potentially

#

But I'm pretty sure it's anything non static

tired glade
#

ok, I just moved the Physics Shapes to the top level objects, but they still aren't preventing a passthrough

solemn hollow
#

shapes dont collide when none of them is also a body i think

tired glade
#

I'm not quite sure what that means

solemn hollow
#

i really fucked up writing a coherent sentence there^^. atleast one of the two colliders involved in the collision must also have a physicsbody component

tired glade
#

Ahh - ok, that partially worked. I have my player now set up with a static body, and the wall set up with a Dynamic body. It seems if I switch the wall away from Dynamic the collision no longer happens. I was hoping for the wall not to move, lol

solemn hollow
#

xD should be the other way around. why is the player static

tired glade
#

I switched it to static to stop him from falling over with dynamic, lol

#

even Kinematic does nothing either

solemn hollow
#

kinematic triggers collisions but doesnt force the collider out of the collision.

#

well mabye if you move with forces it works. idk didnt test the phyiscs alot

#

but to avoid falling over people used joints i think

tired glade
#

I'm just using a capsule for testing

#

a capsule and a cube, lol

worn kindle
#

@surreal pagoda you should probably ask about DOTS here

surreal pagoda
#

yeap

rotund token
#

you kind of need to explain why it doesn't work well

robust scaffold
#

Restart? As in reset all variables to initial?

robust scaffold
#

That process is identical to restarting in mono / game objects. Have a storage containing an initial game world state then regenerate all variables using initial values

#

how else do you first start up the world then?

devout prairie
#

but it should still react to collision ie if you move it towards a wall the wall should block it

#

( actually need to double check that last statement ie blocking )

robust scaffold
#

Ideally, your systems are stateless and thus doesnt care if there's a restart or not. As for your entities, you can use the SerializeWorld function to save the current entities existing at round start (saving the binary to a file somewhere) then clear all entities and then Deserialize the world to completely restart.

#

Systems can have cached component handles and entity queries but should not have any variables as private properties that rely on the state of the entity world. That should be the role of singletons and entities.

rotund token
#

you are disposing world, have you recreated it?

devout prairie
#

Just realised that JobsUtility.MaxJobThreadCount returns the thread limit (128) whereas JobsUtility.JobWorkerCount returns the actual available threads for scheduling.. Which on a 6 core machine is of course 11 ( (cores*2) - main thread )

rotund token
#

yes

#

but just not, annoyingly your thread indexes might not be 0-11

#

(you can actually set JobsUtility.JobWorkerCount to limit workers etc)

devout prairie
rotund token
#

99% of the time

#

just go debug our your indices it's sometimes weird

#

like if you got 24 cores

#

gives you 0-14, 16-24

#

or something weird like that

#

it's consistent, you'll only get the same thread indices

#

but thread index behaviour i would say should currently be considered undefined

devout prairie
#

ahh

#

was just thinking, it used to be possible in task manager to set affinity i think of cores to specific processes

#

maybe beyond certain core counts the OS or application might allocate a different main thread other than zero

full epoch
#

i have subscene(dots 0.51, latest 2021lts unity) and use ss for prefab=>entity conversion (empty game object on ss with authoring component (field is Entity where i put simple cube prefab)) - this works when ss is open - when i close ss i get weird err : AssertionException: Assertion failure. Values are not equal. Expected: 0 == 1 - is this some bug or what i am doing wrong here?(code i used is similar to this : https://forum.unity.com/threads/prefab-workflow-and-managing.968299/#post-6675886 )

rotund token
#

Do you have the full error?

#

Where is the assert failing?

#

What's the authoring component

half jay
#

What a best practice to add entity to array after syncpoint happens ? if i do it directly in system its add entity with id = -1

rustic rain
half jay
#
 protected override void OnUpdate()
  {
            var ecb = _syncSystem.CreateCommandBuffer();
         
            var blockStorage = ObjectStorage.BlockStorage;
            
            Entities
                .ForEach((Entity currentStateEntity) =>
                {
                   
                    var blockEntity = ecb.CreateEntity();                
                    blockStorage.Add(blockEntity);

                }).Run();
}

blockEntity EntityId = -1

rotund token
#

best practice would generally be don't

half jay
#

ok, but i really need use this storage so only way to create another system with filling storage after sync

rotund token
#

What happens if another systems deletes an entity

half jay
#

its clearing storage

rotund token
#

There's no way to do it outside if using entity manager or a multiple jobs with some type of tag component or hashmap

#

It's just not designed to be done

#

But if you're already creating a sync point why not just use entity manager

half jay
#

but this system can be burstable

rustic rain
#

Some EntityManager methods are also burstable

#

but ngl, if it's that simple

#

you will lose more trying to burst that

half jay
#

my system more complex and have SetComponents/AppnedBuffers and so on. Ok, so if im writing Entities.WithStructuralChanges.Foreach().Run() so some methods calling by EntityManager will be call burstable?

rustic rain
#

no

#

WithStructuralChanges = no burst

hot basin
#

which versions of Vulcan API does DOTS support?

full epoch
rotund token
#

In a subscene?

#

You shouldn't use that script at all in a subscene

full epoch
#

for GameObject which holds prefab

#

yes seems you you right i removed it and it works now - thanks

surreal pagoda
#

hey guys I got some problems installing dots, any one can help me?, I made a new project with urp, and installed the dots package with all the components

#

but now I am getthing a few erros

#

unity version 2022.1

solemn hollow
surreal pagoda
#

humm was following htis page

#

2019.3.0f1 and later (recommended)

solemn hollow
#

the easiest way to get everything going is to install the hybrid renderer package. it pulls in all other necassary packages through its dependencies

surreal pagoda
#

yeah was doing that

#

guess the problem was the editor version

#

thanks man

solemn hollow
#

So i got this pattern i often have to use. I wonder how you guys handle it.
I need to do work on a Prefab that i just spawned but that work only has to be done to setup certain aspects of that prefab. So lets say i have a Component that holds a RandomSeed on a Prefab. I cannot initialize that randomseed in the conversion since then my prefab has the seed and everything spawned from that prefab has the same seed. So what i do is having an InitializeTag Component that is removed in the first frame an entity exists. so all systems with WithAll<InitializeTag> will only run once and setup specific components (in the example i initialize the RandomSeed with the EntityIndex to guarantee a unique seed).
Are there better pattern that are equally as easy to implement?

#

It is very similar to the SystemStateComponents usecase of cleaning up after EntityDestruction. Of course i could also do it the other way around and add a tag once the entity is initialized but that would mean an extra useless permanent tagcomponent on every entity.

rustic rain
#

I don't really get, why conversion is not an option?

#

you can always init random from entity index

#

which will most probably be unpredicted

solemn hollow
#

if you do it in conversion you do it for the prefabentity.

#

and when you then spawn an instance of it and not again initialize then the seed will of course be copied

rustic rain
#

oh

solemn hollow
#

so you need to initialize the randomseed after you spawned the prefab

rustic rain
#

why not manually init random?

#

during instantiation I mean

solemn hollow
#

thats exactly what i do. the question is what is the best pattern to do something in the first frame only

#

oh when spawning i dont want to have a system i have to touch everytime i add some new component

rustic rain
#

I'd just make some static helper method that does it for EntityManager and ECB

left kindle
#

Is the prefab instantiated from being in a (sub-)scene or are you spawning it manually? I'd probably have different approaches for each.

rustic rain
#

ooor, tbh it's way simpler than it needs to be, heh

solemn hollow
rustic rain
#

well, if you know for sure

solemn hollow
#

like spawning abilities

rustic rain
#

what is getting instantiated

#

then just

#

AddComponent with inited random

solemn hollow
#

well my AbilitySpawnSystem doesnt know about the actual ability that is spawned. it only knows that it needs to spawn whatevery is queued next

#

so it would be a huge pain to add all initialization logic for every possible component into that system and check if that spawned ability needs the setup for certain components

rustic rain
#

when you spawn

#

do you have any sort of component along that spawned prefab?

left kindle
solemn hollow
#

But what if that system can spawn all kinds of diffrent entities and is mainly there to spawn at the right locations? not every entity will have a randomseed component on them but still will be spawned by that system.

solemn hollow
rustic rain
#

I mean you could potentially give additional data to whatever is holding your prefab entity

#

wrap Entity around struct of AbilityPrefab

#

which will contain all data about what needs to be setup during instantiation

solemn hollow
rustic rain
#

no I mean

#

you keep entity prefab reference

#

but along with it you will have bool

#

hasRandom

#

so if it exists - you add inited random

solemn hollow
#

well thats the same as checking HasComponent<Randomseed>

rustic rain
#

yeah

#

but cheaper

#

as it will be done in conversion

solemn hollow
#

still that would be so much overhead to setup and not very modular

#

but i guess faster

left kindle
rustic rain
#

it's pretty powerful pattern in case you require a lot of setup things around instantiation

left kindle
solemn hollow
rustic rain
#

basically Def, hehe

solemn hollow
#

yes i figured others would do the same. i was just wondering if there are some things you learned that improved that pattern somehow

left kindle
#

Yeah. When I started learning ECS I tended to make to many teensy, tiny components. But often, packing the data as a bool in an other component leads to way simpler systems

solemn hollow
#

hm yes i agree. not everything should be split up. however in case of the ability example i do need alot of small components because the combination of them defines the ability itself.

Projectile + Heading + TargetNotStatic -> homingmissile

#

i just have a lot of very small building blocks that stack additively to create any ability i need

#

and of course i cannot have a dedicated spawner system for every single combination of those that handles setup. i need to somehow distribute that setup over multiple systems (one system can setup more than one component if it makes sense of course)

solemn hollow
#

i am too stupid to figure out how to HasBuffer<LinkedEntityGroup>(entity) in a Systembase without needing to go through entitymanager

#

do i need to just use getbuffer?

#

if (HasComponent<LinkedEntityGroup>(entity)) does not work

rustic rain
#

HasComponent should work though

solemn hollow
#

well it doesnt work with Buffers

#

The type 'Unity.Entities.LinkedEntityGroup' must be convertible to 'Unity.Entities.IComponentData' in order to use it as parameter 'T' in the generic method 'bool Unity.Entities.SystemBase.HasComponent<T>(Entity)'

#

i feel stupid now. how did i never stumble upon this until now :S guess i need to write it as a job and use the BufferTypeHandle to check

rustic rain
#

Wait

rustic rain
solemn hollow
#

i was using a small Entities.ForEach and needed it to run in parallel. so cannot do EntityManager.HasComponent which would work fine with buffers...

rotund token
#

Yes has component doesn't have a buffer method yet

#

You need to just pass in the get buffer from entity