#archived-dots

1 messages Β· Page 142 of 1

grim walrus
#

Yes more or less

coarse turtle
#

ok - dont use angles - just use quaternion.LookRotationSafe(worldPosition - playerPosition)

grim walrus
#

@coarse turtle Ok thanks! I'll test it when I am back at my PC πŸ™‚

#

Really appreciate it

grim walrus
#

@coarse turtle LookRotationSafe requires two parameters apparently, float3 forward and float3 up.

dull copper
grim walrus
#

lol

#

@coarse turtle I've figured out that the second parameter is the look rotation

#

but I've tried with (1, 0, 0), (0, 1, 0), and (1, 0, 0). In all cases it looks, but rotates in 3D as well 😭

#

@coarse turtle FOUND THE ISSUE

#

Turns out ECS maths uses radians not degrees 🀦

#

ez fix

#

@ocean tundra Is there a math.all equivalent for "or"?

#

Since math.all is just and

warped trail
#

math.any

grim walrus
#

@warped trail Thanks!

grim walrus
#

How does one get the Euler angles from a quaternion?

#

@warped trail Any ideas? I've gone through the docs and I can't find anything

ocean tundra
#

@grim walrus what are you wanting the Euler angles for?

#

i think we are meant to go Eular angles ==> quaternion

grim walrus
#

@ocean tundra I want to add to the euler z rotation

#

Actually, scrap that

#

I just need to access the euler z rotation

#

Looked through every single thing and I can only find how to get a Quaternion from Euler angles, not the other way around

grim walrus
#

So you can access it the same was a Rotation?

ocean tundra
#

and the transform systems will read that and convert that into Rotation.quaternion

#

yup

#

but you need to add it first

#

not there by default

grim walrus
#

@ocean tundra How do I add it? I'm using convert to entity

ocean tundra
#

after convert

#

EntityManger.AddComponent

#

or inside a monobehaiver with IConvertToEntity

#

the monobehaviour convert option would probably be best

grim walrus
#

Wait so you can have a MonoBehaviour on an entity if you use IConvertToEntity?

ocean tundra
#

:/ I wish the docs were better

#

2 sec

grim walrus
#

All I want is to get the z rotation 😭

ocean tundra
#

Turns out im not even using it

#

:/

#

IConvertGameObjectToEntity

#

on a monobehavior attached to your gameobject

#

it will make you implement a convert method

#

inside that you can do entitymanager.addcomponent

#

ill take a look at maths again

#

:/

#

i think that component is the way

grim walrus
#

I'm trying to do it in System

#
    protected override void OnCreate()
    {
        EntityManager.AddComponent<AddRotationXYZ>();
        base.OnCreate();
    }

ocean tundra
#

you need to pass the entity to it

grim walrus
#

Where can I get a reference to the current entity in a system?

ocean tundra
#

there isnt a current entity

grim walrus
#

Oh yeah I forgot it doesn't work like gameobjects oops

#

Silly me

ocean tundra
#

yup

#

you could do a entities foreach tho

grim walrus
#

Oh ok just like in Update

#

I really need to get over my GameObject habits 😭

ocean tundra
#

Entities.WithNone<THAT_ROTATION_COMPONENT>().WithAll<SOME_PLAYER_COMPONENT_ON_YOUR_ENTITY>().Foreach(........ ADD COMPONENT HERE

grim walrus
#

@ocean tundra Sorry for being a pain. But how do get the Entity reference in the ForEach?

#

Add a ref/in like with the Components?

ocean tundra
#

.ForEach((Entity e) => {CODE HERE}

#

πŸ™‚

#

Entity is the first parameter

grim walrus
#

Ahh ok

ocean tundra
#

its optional

grim walrus
#

Got it

#

@ocean tundra Last problem for some reason it doesn't like it

#

error DC0002: Entities.ForEach Lambda expression invokes 'get_EntityManager' on a FaceMouseSystem which is a reference type. This is only allowed with .WithoutBurst() and .Run().

#

I am using .Run() though

ocean tundra
#

add Without Burst

#

you need both

grim walrus
#
    protected override void OnCreate()
    {
        Entities.WithNone<RotationEulerXYZ>().WithAll<FaceMouseComponent>().ForEach((Entity entity, ref FaceMouseComponent faceMouseComponent) =>
        {
            EntityManager.AddComponent<RotationEulerXYZ>(entity);
        }).Run();
        base.OnCreate();
    }
ocean tundra
#

Entities can use Burst on .Run methods

#

so even main thread can be fast

grim walrus
#

So .WithoutBurst().Run(); works? You can stack them?

ocean tundra
#

yup

#

you will have a issue

grim walrus
#

@ocean tundra Now a new error EntityQueryDescValidationException: EntityQuery contains a filter with duplicate component type name FaceMouseComponent. Queries can only contain a single component of a given type in a filter.

ocean tundra
#

FaceMouseSystem which is a **reference **type.

#

and 2

#

Dont need ref FaceMouseComponent faceMouseComponent

#

when its in a WithAll or WithNone or WithAny you cant use it in a ForEach parameters

grim walrus
#

So just Entity entity

ocean tundra
#

the FaceMouseSystem being a class isnt much of a issue, but good practice to make them structs whenever you can

#

yup

#

i always just call it e

#

πŸ˜›

#

cause i hate typing

grim walrus
#

Still broken though

ocean tundra
#

.WithStructuralChanges?

grim walrus
#

πŸ˜“ what's that?

ocean tundra
#

πŸ˜›

#

yet another thing

grim walrus
#

Sorry for wasting your time man

ocean tundra
#

na its fine

grim walrus
#

I really appreciate your help

#

I can't figure out why it doesn't work now though, it seems like I've done everything right

ocean tundra
#

WithStructuralChanges is needed when using entitymanager

grim walrus
#

Ah ok

ocean tundra
#

sorry when entity manager is making actual changes (add/remove/create/destory)

grim walrus
#

.WithoutBurst().WithStructuralChanges().Run(); then

#

Does the order matter there?

ocean tundra
#

na i dont think so

#

i end with run/schedule cause in my mind its the last thing

grim walrus
#

EntityQueryDescValidationException: EntityQuery contains a filter with duplicate component type name FaceMouseComponent. Queries can only contain a single component of a given type in a filter. still is getting me

ocean tundra
#

:/

#

heres another doc for later

#

umm system code again?

grim walrus
#
using UnityEngine;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;

public class FaceMouseSystem : SystemBase
{
    protected override void OnCreate()
    {
        Entities.WithNone<RotationEulerXYZ>().WithAll<FaceMouseComponent>().ForEach((Entity entity) =>
        {
            EntityManager.AddComponent<RotationEulerXYZ>(entity);
        }).WithoutBurst().WithStructuralChanges().Run();
        base.OnCreate();
    }

    protected override void OnUpdate()
    {
        Camera mainCamera = Camera.main;
        Vector3 targetVector = mainCamera.ScreenToWorldPoint(Input.mousePosition);
        float3 target = new float3(targetVector);

        Entities.ForEach((ref Rotation rotation, in FaceMouseComponent faceMouseComponent, in Translation translation) =>
        {
            float3 difference = target - translation.Value;
            rotation.Value = quaternion.Euler(0, 0, math.atan2(difference.y, difference.x) - math.PI / 2);
        }).ScheduleParallel();
    }
}
ocean tundra
#

oh move that entities foreach down

#

in the onupdate

#

beofre your other forech

grim walrus
#

Wait what? I only have one foreach in OnUpdate

ocean tundra
#

the with none means it wont try to add over and over

#

and you can have as many foreach's in a onupdate as you like

#

they will be created/scheduled to run one after the other

grim walrus
#

Wait what

#

There is nothing with none in OnUpdate

ocean tundra
#

Entities.WithNone<RotationEulerXYZ>(

#

πŸ™‚

grim walrus
#

That's in OnCreate though

ocean tundra
#

yea move it

grim walrus
#

To where?

ocean tundra
#

into onupdate

grim walrus
#

But then it wouldn't run every frame?

#

Or do I not understand how OnUpdate works

ocean tundra
#

yes and no :/

#

the with none will prevent it from doing anything

#

long term you probably want to do the add component in the IConvert... flow but this should get you going quickly

grim walrus
#

Should I get rid of the none?

#

I've moved the whole chunk into OnUpdate

ocean tundra
#

no leave it

grim walrus
#

Then what should change?

ocean tundra
#

nothing

#

it should be happy now

#

you have 2 entitys...foreach

#

first one only runs if your player dosnt have that rotation component

grim walrus
#
using UnityEngine;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;

public class FaceMouseSystem : SystemBase
{
    protected override void OnUpdate()
    {
        Entities.WithNone<RotationEulerXYZ>().WithAll<FaceMouseComponent>().ForEach((Entity entity) =>
        {
            EntityManager.AddComponent<RotationEulerXYZ>(entity);
        }).WithoutBurst().WithStructuralChanges().Run();

        Camera mainCamera = Camera.main;
        Vector3 targetVector = mainCamera.ScreenToWorldPoint(Input.mousePosition);
        float3 target = new float3(targetVector);

        Entities.ForEach((ref Rotation rotation, in FaceMouseComponent faceMouseComponent, in Translation translation) =>
        {
            float3 difference = target - translation.Value;
            rotation.Value = quaternion.Euler(0, 0, math.atan2(difference.y, difference.x) - math.PI / 2);
        }).ScheduleParallel();
    }
}
ocean tundra
#

and will add it

grim walrus
#

Still gives the error

#

EntityQueryDescValidationException: EntityQuery contains a filter with duplicate component type name FaceMouseComponent. Queries can only contain a single component of a given type in a filter.

ocean tundra
#

wtf

#

why

grim walrus
#

Maybe Unity is being stupid

#

I'll try restarting

ocean tundra
#

yea it looks fine to me

grim walrus
#

@ocean tundra Unity was being dumb. Restart fixed it πŸ˜…

ocean tundra
#

yay

grim walrus
#

Again, thanks for all the help

ocean tundra
#

all good

grim walrus
#

If there is anything I can do to help you out let me know!

ocean tundra
#

now you should be able to replace rotation with RotationEulerXYZ

#

sweet

grim walrus
#

Yeah

#

I owe you

ocean tundra
#

maybe one day testing over the internet

#

but im ages away from that

#

but fingers crossed a week or 2 away from a small lan test πŸ™‚

grim walrus
#

Ok! Best of luck on that

ocean tundra
#

thanks

#

if it works means the core networking is good

grim walrus
#

I'll swap out Rotation tomorrow it is getting late here

ocean tundra
#

and can begin to scale up πŸ™‚

grim walrus
#

I'm doing a networked game too actually

ocean tundra
#

haha

#

its hard πŸ˜›

grim walrus
#

Still not sure what to do for my networking solution though

#

The new Netcode seems to be really unstable

ocean tundra
#

well we can definitly chat about that

#

yup

#

im staying away

#

i went with ENet

grim walrus
#

But I'm familiar with Mirror, but that isn't directly integrateable with ECS

ocean tundra
#

yea i've used mirror too

#

very nice

grim walrus
#

How hard do you think it would be to get it working with an ECS project?

#

Or make some sort of bridge

ocean tundra
#

umm

#

i would say not worth it

#

they have some good things

#

their message router is very handy

#

and their network time

#

probably serialation as well (but i used Ceras)

#

but any of the high level stuff probably not worth it

grim walrus
#

Yeah

#

Anyhow I'm going to sleep now, good night!

ocean tundra
#

sweet

grim walrus
#

Maybe we can talk about networking later

ocean tundra
#

night

grim walrus
#

Thanks for everything!

mystic mountain
#

Is it possible to create a child/linked entity in the conversion, like in IConvertGameObjectToEntity? Simply creating an entity there seems not to do the trick, but seems to spawn it right away (even if prefabbed).

storm ravine
#

@mystic mountain Yep, conversion contain 5 major groups

#

You should run your own conversion system after conversion done in one of required systems

ocean tundra
#

Theres a way to add a entity

#

GameObjectConversionSystem.CreateAdditionalEntity

#

use that inside the IConvertGameObjectToEntity Convert method

mystic mountain
#

Will try

ocean tundra
#

i dont think it creates it as a "Child" with the child/parent relationship

#

but it should be added to the linkedentitygroup

mystic mountain
#

That's what I want anyway ^^

ocean tundra
#

sweet

#

let me know if it works

mystic mountain
#

Hmm, seems I need to specify a gameObject, I want to create it from scratch or archetype.

ocean tundra
#

oh

mystic mountain
#

ideally at least πŸ˜›

ocean tundra
#

thats really dumb

#

i guess you can try manually creating the entity

#

and then adding to the primary entities linkedentitybuffer

#

sometimes the DOTS api is really cleaver, like when it can rewrite our code for us

#

but sometimes such simple things just cant be found

#

i guess it would be easy enough to write a extention method for entitymanager

amber flicker
#

There should be a GameObject if conversion is taking place right? Just want to make it known that you don't want to be creating entities outside of CreateAdditionalEntity - even matching SceneID components etc it just becomes a mess πŸ™‚

mystic mountain
#

@amber flicker What I want to do is specify states/abilities in scriptableObjects, and on conversion create & add these as linkedEntities, instead of fiddling with each and every prefab if they are using same structure

#

What I might do now is to just add a gameObject for each of these and use the CreateAdditionalEntity, but it's just one unnecessary layer to setup.

amber flicker
#

If you want to do it 'on conversion' then it makes sense to have it associated with an object being converted. On the broader point of what you're trying to achieve though, how will other entities access the data? Is the data mutable?

#

e.g. do you plan on having a monobehaviour with a field for one of these scriptableobjects and then that gameobject later gets converted?

storm ravine
#

@mystic mountain Fingers were greasy, had breakfast. Ok. CreateAdditionalEntity it's your case, you don't need additional conversion systems as I suggested above (misunderstood your question initially). CreateAdditionalEntity takes GO and will return you new empty entity to which you can add your components, yep this is not created form archetype, but this is what you have in IConvertGameObjectToEntity. This entity will be in same linked entity group where your IConvertGameObjectToEntity called.

fringe sinew
#

I'm really confused about the Hybrid Renderer V2. It seems like it uses compute shaders of all things to upload data

#

Why even use a compute shader for such a thing?

#

So in the end, meshes are rendered under the unity's hood and the materials just pull data from the buffers that are created and managed by the C# side of Hybrid Renderer V2 and updated via a compute shader

#

Why such a convoluted thing? It's already a big problem if you use compute shaders to update the buffers.

#

Furthermore, such a restriction forces your ECS renderable objects to have struct only values. So, lightprobes, previous model matricies, light indicies and all that, cool and good. But now you can't setup reflection probes for instance, or lightmaps, because all of the data is updated via a compute shader.

bright sentinel
#

such a restriction forces your ECS renderable objects to have struct only values
Isn't that just a general burst restriction? I don't know much about how rendering works, but it sounds like they're just using the hybrid renderer with Burst

fringe sinew
#

You can do such stuff in default Unity. Unity already did it for you from the C++ side nicely. But now, because it's all data oriented and struct-based, you cannot update reference types. Now you can't update the lightmaps or reflection probes assigned to a renderer and only do hacks like indicies and texture arrays.

#

Builtin unity doesn't need such a thing, so it's a problem.

bright sentinel
#

It's all about the performance

#

Sure, you can do it that way, but it's not as performant

#

That's the whole idea of DOTS

fringe sinew
#

Again, builtin Unity already does this from its C++ side. It already can nicely cull and update lightprobes for renderers.

#

Reflection probes, I mean

wary anchor
#

Sorry if this is obvious, I didn't find it on a search - how do I SetSingleton() when calling for an entity command buffer system to create an entity + component?

bright sentinel
#

If you're just annoyed about the feature not being in Hybrid Renderer, then it's just because it's not supported yet - it's still a preview package

fringe sinew
#

It's not about it being supported or not. It's about the foundation. So far the foundation is that a compute shader is used to update the buffers from which the shaders pull data during the rendering.

#

This foundation is the problem, and it won't allow for stuff that I describe

#

Unless, again, stuff like texture arrays and indicies are going to be used, but those are hacks

bright sentinel
#

Well you're free to write your own renderer if you're unsatisfied with it

fringe sinew
#

And on the other hand, if lightmaps or reflection probes or any other reference types are going to be managed on the C++ side, then that also is a major problem, because the whole talk about "the line between the engine and game code disappears" is now a false claim.

#

I can't write a renderer for Unity, I don't have the access to the source code and I can't have components in the ECS to store reference types.

amber flicker
#

anyone know what the latest animation package version is or where I can find out?

opaque ledge
#

Burst .12 is up πŸ‘€

#

i think its in Package Manager

amber flicker
#

oh wait, it is now I added it to my manifest πŸ™‚ thanks

wary anchor
#

can you create a singleton entity from an ECB?

opaque ledge
#

there is no singleton entity, there is singleton component, which means there is only 1 of a kind of that component type in a world

amber flicker
#


### Fixed
- Fix an issue when changing the base type of an enum that would not trigger a new compilation and would keep code previously compiled, leading to potential memory corruptions or crashes.
- Fixed a subtle AArch64 ABI bug with struct-return's (structs that are returned via a pointer argument) that was found by our partners at Arm.
- Fix an issue that was preventing Debug.Log to be used from a Job in Unity 2020.1

### Changed
- JIT cache is now cleared when changing Burst version```
wary anchor
#

yes, you're right I chose my word poorly

opaque ledge
#

aww, i guess no enum equal check fix yet 😦

wary anchor
#

Currently I create a entity and add a component to it in an ECB, but I want to change my code so that that component is singleton Component.

opaque ledge
#

well i mean, as long as there is only 1 type of that component, that is a singleton component, instead of creating an entity, you could try to get the entity that has that singleton component

#

GetSingletonEntity<T> is the method you are looking for

#

so instead of creating new entity, you add the component to the entity that is returned from GetSingletonEntity

wary anchor
#

yeah I see, just have the component there all the time and use the data within it instead of its presence...

#

although that's more of a pain because I'm using RequireSingletonForUpdate to only run a game end system when I create the game end component with the relevant data on it

#

or rather, I'm not using that right now I'm using RequireForUpdate on the EQ but you get the idea

opaque ledge
#

you can have your end game system remove the singleton component/entity, therefore it will only run once and will stop working until you add your singleton component again

#

are you trying to implement a end game signal ?

wary anchor
#

well I have that implemented, but I am tidying up the code so I don't have to create a NativeArray of the components with ToComponentDataArrayAsync then check the length of the array and dispose

#

but I can't access the system on which to call SetSingleton from within a job via the ECB so that's put a bit of a spanner in the works

#

The problem I'm trying to resolve is working out why the component isn't getting destroyed when it should be - if I create the end game event on winning or pressing the quit button, it works and the quit game event data is read and the component destroyed, whereas if it's created on player getting caught, for some reason it's getting processed but not destroyed

opaque ledge
#

that does sound weird, but probably a code fault somewhere ?

#

assuming both cases are processed by same system

wary anchor
#

yes probably, I was rather hoping in tidying up the obviously-singleton-but-not-implemented-as-singleton it might also help me debug! πŸ™‚

opaque ledge
#

Perhaps you are adding 2 end game components at the same time ?

#

becaues you are doing RequireForUpdate on EQ right ? not on singleton

wary anchor
#

yeah

#

the event is getting created from other systems

#

and read by the one that destroys the EQ

#

so perhaps another is created on the frame after the first was created/then destroyed...

#

ayeeeeee silly roo fixed it by changing the system update order!

#

Thanks for engaging @opaque ledge appreciate the help!

storm ravine
#

@fringe sinew Unity NEED such a thing long time ago. Because CPU<->GPU is costly part of rendering pipeline. With ComputeShader and ComputeBuffers part they now operate directly with GPU memory pointers, and for that thing they added Begin\EndWrite as native array pointer to GPU memory instead of marshaling data from CPU to GPU. They getting GPU pointer of data buffers (matrices, etc.) and write directly to GPU and then in compute shader they process that data batches operations and store on GPU. It excludes requirement to pass batches of data to GPU every frame, because that data already passed and stored on GPU until you update it, or untill buffer lifetime in frames not ended up, moreover direct GPU pointers with nice batch ranges allow them easily parallelize process now, instead of being bottlenecked for CPU->GPU synchronization they now just write all data batches in parallel to GPU and main thread uses only for open\close write streams. it's huge rendering performance improvement. For supported platforms it use direct GPU memory pointer for other (D3D11 for example) it uses temp buffer (D3D11_MAP_NO_OVERWRITE) on CPU which will copy (through CS-readable buffer) then to global preallocated buffer to GPU at the end (which uses for all new rendering). Also why compute shader involved here - they reducing bandwidth (and they mentioned that on forum, that it's their intention, because bandwidth is one of common rendering bottlenecks), instead of passing two matrices (initial and inverted) to shader, which initially have huge cost, they pass only one matrix and inverse it in compute shader, where matrix inversion cost - zero in comparison to CPU inversion and passing in as additional matrix.
About lightmaps, reflection probes etc. They working on that now, don't forget - tech in preview and things not become magically converted by gods, they need time to rewrite that, at the moment, they rewrite all core rendering engine (!) πŸ™‚

#

I can't write a renderer for Unity, I don't have the access to the source code and I can't have components in the ECS to store reference types.
You can because class IComponentData was added 3 versions ago. But you can't use that in burst and jobs, and in the end you'll fallback to Unity legacy renderer and bottlenecked by main thread CPU->GPU synchronization.

fringe sinew
#

You can now create reference-typed IComponentData and access them in jobs?

storm ravine
#

Ahhh

#

I meant can't

#

misspell on my side sorryπŸ™‚

fringe sinew
#

So, yeah, I can't. It's still limited to the value types. I wonder how they're going to implement lightmaps or lightprobes without using texture arrays

storm ravine
#

Can't say more details here, sorry, but they working on that and investigating that πŸ™‚

#

We just should be patient here πŸ™‚

fringe sinew
#

But still, with compute shaders some of the platforms are out of the question and won't work. And moreover, I fear that if more and more things will start to be implemented on the C++ side the whole meaning of the DOTS will disappear, it won't be truly open for some stuff.

#

I'm patient, but I'm really worried about the future.

#

Besides, I don't think the default Unity ever needed such a setup.

storm ravine
#

Only thing now on C++ is BatchRendererGroup. All other things on C# side and passed to GPU through things I mentioned above, matrices other properties etc.. And about CS, most of hardware now support it, GLES 3.1 Vulcan for android, metal for ios, DX11\12. Consoles ps4+, xbox one+. (not sure about switch) CS requirements at these days not so high.

fringe sinew
#

Sure it's not the most performant thing in the world, but it could render a lot of objects nicely CPU-wise, without instancing and direct memory access

#

I'm saying: why even use computes when other solutions (and unity itself) could do relatively fine without using them?

storm ravine
#

And this is why big open worlds in unity was real pain for implement πŸ™‚ With current approach it become "performance by default". But for any conclusions we should wait a bit more detailed view to what will be implemented.

#

I'm saying: why even use computes when other solutions (and unity itself) could do relatively fine without using them?
@fringe sinew Of course it can, but it not scalable and performant.

#

If you don't need that

#

You can ignore HR that simple πŸ™‚

#

If built in cover your case

#

Has fine performance for you

#

Why you event thing about HR at first place πŸ™‚

#

You still can use DOTS for logic

#

and use built in rendering things

#

HR renderer is not complete replace for built-in rendering in long term

#

SRP not require HR too

opaque ledge
#

Why Unity listens to you anyway

#

you have a pretty face ? πŸ‘€

storm ravine
#

in "performance by default" here "by default" is matter πŸ™‚ You can implement huge amount of drawings on current rendering solutions, and it will works fine, but you need extra work for that (for example DrawMeshInstanced(Indirect) processing matrices, hand written shaders). And by default mean that regular Joe just putt many things on scene and they just will for out of box without all that 'weird for regular Joe stuff"

#

Why Unity listens to you anyway
@opaque ledge It's question to me?

opaque ledge
#

yeah

storm ravine
#

What do you mean?

opaque ledge
#

"Can't say more details here, sorry, but they working on that and investigating that "

#

so you guys are in contact πŸ˜„

storm ravine
#

Yes we in contact πŸ™‚

#

Why Unity listens to you anyway
Just confusing me πŸ™‚

#

I got it like "they listen and do what I say them" πŸ™‚

opaque ledge
#

i mean listen to your feedback πŸ˜„

#

but i am just teasing really πŸ˜›

mystic mountain
#

@storm ravine Hmm, I tried with CreateAdditionalEntity. But it doesn't seem to create the entity when it's part of prefab? Any ideas? πŸ€”

fringe sinew
#

If the CPU->GPU data copy causes so much performance bottlenecks, then what the hell was SRP Batcher for?

storm ravine
fringe sinew
#

That thing was specifically designed to solve this issue with many drawcalls and data transfers, and IIRC Frostbite was the pioneer behind a similar feature.

#

Never heard or saw it having performance problems.

#

Why use specifically computes now to upload the data? Besides the parallelism, what does it bring? And how fast is it on the GPU itself now?

mystic mountain
#

@storm ravine Doesn't get added as linked even though I use CreateAdditional πŸ€”

#

So would guess CreateAdditional can only work on the same gameObject or in the hierarchy that it is converting?

storm ravine
#

@fringe sinew SRP Batcher it's additional performance gain, in comparison to scale which HR can cover. But they work together and SRP Batcher will give additional performance boost to HR. Compute shader initially not for upload but processing, for creating inverse matrix, and because they already have data on GPU just use same compute shader for copy data to destination preallocated buffer on GPU memory which exclude transfer bandwidth at all. It fast as possible, because it already on GPU.

#

And as I told before they reduce main thread overhead here

#

you can even not use many worker threads, but just one worker thread for processing data, which already freeing your main thread

#

But because they can parallelize that and give much more performance - they do πŸ™‚

#

SRP Batcher thing not related to HR in common, but uses some features which used for HR. Like BatchRendererGroup with materials, meshes, culling info, material property blocks. BatchRendererGroup is bridge between them. And BatchRendererGroup itself not relates to HR and just used by this. Thus BatchRendererGroup with SRP Batcher is just different beast which used for GO, and provide some stuff for HR.

#

And what you mean about "more C++". Only C++ thing (and it's partially) which used by HR is BatchRendererGroup, that's all.

#

All other stuff is Shaders, CS and C#.

mystic mountain
#

Ok, I had it all wrong, I thought the parameter of CreateAdditionalEntity was the GO that would be converted. big thanks^

loud matrix
#

Dangit, I had such a clear idea on how I wanted to setup chunks to streamline my future physics engine, but 2 days back on my job and I;ve totally forgotten my idea

vagrant surge
#

Ive implemented the kindof techniques the SRP batcher uses

#

and more complicated ones

#

the thing is that usually, even today, the engine loop goes something like this

#

foreach(camera){

set_gpu_cam_settings(camera);

foreach(object){
set_gpu_material_settings(object.material)
set_gpu_object_settings(object)

set_vertex_buffer(object.vertices)
set_index_buffer(object.indices)
draw(object)

}

}


#

thing is. Every time you are setting those object and material settings, you are uploading to the gpu

#

even of the object is static or dynamic, doesnt matter. Every frame every object the data goes up for each object in the view

#

SRP batcher, and unreal engine, move to a "big ass buffer" approach

storm ravine
#

Same as HR, which uses big preallocated buffer

vagrant surge
#

instead of uploading the data per object and per material when rendering, at the begin of the frame, they upload this bigass array with the object data of ALL objects, and the material data of ALL objects

#

and then, rendering loop is very fast

#

bandwidth is reduced by only uploading the data that changed since last frame. It makes static objects stupidly fast because they basically upload nothing to the gpu per frame. They just stay on that buffer, and rendering them is super quick

#

they have also been adding some stuff to the ECS that basically memcopies ECS arrays to the gpu

#

so when it sees one of your component arrays has changed (version index) it uploads to gpu, and then you can read ecs data from gpu for your materials or shader

#

this opens you up to some absolutely crazy techniques, like what Frostbite and Ubisoft engines do, which is where you dont even do rendering on the CPU. The GPU uses compute shaders to calculate the rendering and culling

storm ravine
#

And reason why they can't get pointer to that big buffer is that things moving around in that buffer and pointer will point to wrong GPU memory in this case when you in opened write stream, this is why they populate buffers first and fill them through jobs and then copy that buffers data to big buffer on gpu when write stream closed

vagrant surge
#

yup

#

btw, the big ass buffer approach is actually very easy to implement

#

if you do it from the start

#

it simplifies rendering code quite a bit, + is much faster

storm ravine
#

Yep I know all that and this is what I decribed to @fringe sinew above πŸ™‚

bold sleet
#

how come the package manager is so buggy
i cant find the Platforms package
also unity beta 2020 doesnt allow to show preview packages
the option is gone
on unity 2019.3.13f1 i dont see the Platforms package

#

how do I find 0.3.0-preview.2

storm ravine
loud matrix
#

Can someone explain to me how the hell you debug compiler errors when updating packages in Unity, I've updated from 0.8 to 0.10 entities and now have 243 lovely errors all relating to Library\PackageCache\com.unity.entities@0.10.0-preview.6 but have no clue what the coflict is coming from

fringe sinew
#

But that's the case, SRP Batcher already takes care of that, that's the big-ass buffer.

bold sleet
#

as I said, 2020.1.0b8 doesnt have Show preview packages, and 2019.3.13.f1 doesnt see the platforms package

fringe sinew
#

I've never heard of any other tech to accelerate this particular thing via computes

storm ravine
#

Which used for different things - GO with which HR not work. And that not reducing send data size bandwidth, they still pass 2 matrices etc. speedup (and it's big speedup) here is frequency of uploading, it's very good optimisation. With CS in HR it not only frequency (with SRPBatcher) but reducing upload size bandwidth. As I told (and HR devs told) CS removes requirement for passing second inverse matrix to GPU, instead only one matrix passed in and processed in compute. And it become valuable at scale.

#

And in future it will be extended for other things

fringe sinew
#

But the compute shader isn't simply used for the sake of passing just one matrix. It's used for all the per-render setup, like light indicies, lightprobes, etc.

storm ravine
#

Yes and reason described above.

#

Before passing things to big buffer

fringe sinew
#

What's the point of SRP Batcher by that point is then? It also does the same job IIRC, both for material and per-renderer properties

vagrant surge
#

@storm ravine wait, SRP batcher uploads the bigass array every frame?

storm ravine
#

you should get finished write stream with data

#

@storm ravine wait, SRP batcher uploads the bigass array every frame?
@vagrant surge no. HR without SRP batcher pass data every couple of frames in parallel with Begin\End write

#

What's the point of SRP Batcher by that point is then? It also does the same job IIRC, both for material and per-renderer properties
@fringe sinew no, per-renderer properties is not SRP batcher same as not HR. All this handled by BatchRenderGroup which both things using

#

What's the point of SRP Batcher by that point is then? It also does the same job IIRC, both for material and per-renderer properties
@fringe sinew one more time - GO land. Reducing frequency bandwidth.

rancid geode
fringe sinew
#

But then we get back to the original topic: why even use compute? SRP Batcher didn't need any computes to work or to create such a scenario by not reuploading data constantly.

storm ravine
#

Ufffff

#

Upload siize

fringe sinew
#

Alternatively, if computes are so fast and efficient, why not use computes in the GO land?

#

For SRP Batcher I mean

storm ravine
#

SRP Batcher NOT reducing that - upload size

#

Alternatively, if computes are so fast and efficient, why not use computes in the GO land?
@fringe sinew Well because it already written long time ago and require huge rewrites underhood I guess

fringe sinew
#

Convenient

storm ravine
#

And one more thing - scale. SRP batcher doesn't give you performance gains if every thing will be dynamic. Because if every thing changes every time - everything will be reuploaded

#

And HERE where HR with CS and reducing upload size become a valuable thing.

#

Because in that case you can't have a boost of frequency, all dynamic all changes

#

And upload size it's only thing for reducing bandwidth here. And reduce upload size for thousands things for even one float4x4 is 128 bytes! and for 10k things for example - is 1.25Mb! and than size every frame is VERY big bandwidth reducing.

loud matrix
#

Bloody hell, I try to update Entities package one version and now i get 1fps lag spikes

storm ravine
#

Editor

#

You reloaded Unity?

loud matrix
#

I know, even after downgrading back to the same version of the entities package its still happening weirdly

storm ravine
#

You reloaded Unity?

loud matrix
#

Yup

storm ravine
#

And still persist?

loud matrix
#

Yeah

storm ravine
#

Switch to editor profiling

#

And check what causing that

loud matrix
#

Have been but its so inconsistent its hard to catch

storm ravine
#

What inconsistent? Just run and select frame spike

#

That's all

#

And if you speaking about that it not "pausing" editor profiling just uncheck profile record button

loud matrix
#

Editor shows constant frequent spikes, where as game profiler shoes infrequent big spikes

#

Which doesn't mesh with what the game profiler tells me about it being the editor

storm ravine
#

I see GC spikes in playmode

loud matrix
#

That's what i thought the cause was originally till i saw the big editor times

#

Oh you mean in the editor

storm ravine
#

If you disable profiler will spikes still persist?

#

GC in play mode expected of course if you have enabled jobs debugger, safety checks, full stack trace

loud matrix
#

looks like it still happens

storm ravine
#

Ah and switch form timeline to hierarchy and select EditorLoop to see full profiler spikes

#

It can show you additional spikes

#

which can match your player spikes

loud matrix
#

ah now that is a thing i did no know existed

#

I've always had player expanded

#

Yeah the only time my player spikes is GC collection, the rest is allll editor

#

Should probbaly do a deep profile to work out why im getting semi frequent player GC's though

storm ravine
#

Safety checks

#

Jobs debugger and full stack traces

#

disable them

#

and switch to release mode if you in debug mode

#

It will show you performance close to build in which GC spikes produced by safety checks wouldn't persist (if of course you haven't your own garbage for GC)

loud matrix
#

jobs debugger i had turned off, and my stack traces are on script only

storm ravine
loud matrix
#

Yup that makes it run a lot smoother, just the occasional 60ms spike on the editor

#

Which is just GC from the looks of it

#

I just cant work out why it's stated happening today

#

Oh well, mystery for another time, I wanna actually code something for once, thanks for the help πŸ™‚

gusty comet
#

Hey everyone. Quick question about dynamic buffers:
I''m trying to add 2 (or more) dynamic buffers to different entities in mono. I understand that structural changes like em.Add invalidates the data.
Is there a way around it?

storm ravine
#

Delay that calls by EntityCommandBuffer. Or add one buffer and process, add second buffer and process

gusty comet
#

I'm unsure what you mean by "process". It's not in a job/ system

storm ravine
#

If you not processing them what the point of avoiding structural change here?

#

by process i mean you add them and fill their values

gusty comet
#

Oh!

#

Yep... that worked..

#

didn't think of that i guess. thanks for the help

storm ravine
#

ECB still valid here ECB.AddBuffer return you buffer immediately which you can populate, but structural changes delayed, because you delay this structural changes at the end of frame for example (or what ever ECB you using\creating) and not interrupt jobs in a middle of dependency chain and frame.

fringe sinew
#

Alright, before I declare myself a terminal idiot, can I recap this whole argument to verify that I understand the whole thing correctly?

gusty comet
#

@storm ravine I see! Very good to know. I'll keep that in mind!

fringe sinew
#

HRV2 provides potentially better performance because the data is written by all jobs in parallel and only for those buffers that changed. It's not just the rendering thread that writes the data before rendering, but all of the HRV2 jobs.

They do this by using compute shaders to write directly into the memory adresses on the GPU in parallel. Additionally, some data is generated by them specifically, like the inverse of matricies.

Is that correct? @storm ravine

storm ravine
#

Not exactly. Give me a minute πŸ™‚

fringe sinew
#

I'm sorry if I'm an annoyance.

storm ravine
#

No problems it's discussion

#
  1. Parallel writings is bonus thing added by HR them in to Core Unity thing - ComputeBuffer. You can write to them in parallel from 2020.1, it's independent thing, but obvious reason why they added that is HR team want to get parallel writing performance here which gives you BIG boost. That BeginWrite give you array which points directly to GPU memory (for supported platforms like D3D12, Vulcan etc.) and to D3D11_MAP_NO_OVERWRITE buffer in other case when hardware doesn't support direct memory writing.
#
  1. SRP Batcher - reduce frequency of writing, and writes only when data changed and that works with HR same as for GO land. Goal - reduce upload to GPU frequency. Without that HRv2 will reupload to GPU often.
#
  1. HR uses CS for reducing Upload size. When you have many dynamic things which updates every frame. You can't get here SRP batcher frequency bandwidth reduce because of obvious reasons. How they reduce upload size with CS - they just moved inverse matrix calculation from CPU to CS and thus send less data to GPU by compute buffers. For CS they still using ComputeBuffer, because they should upload initial data to GPU and you can't write to big preallocated buffer directly, because when you write async that buffer can change it's content and you'll write to wrond memory stride which will corrupt your data. In CS their initial intention - process that data - like creating inverse matrix in CS. And because they have structured buffers on GPU with data, and CS dispatched it mean write stream closed, and they can safely write to Big Buffer, because it's main thread call which guarantee that no one will write to that big buffer at the same time (of course if not doing that manually by intention πŸ˜„ ) and content of that big buffer wouldn't change, and they copy that linear buffers data to appropriate memory parts of big preallocated buffer.
fringe sinew
#

Can you clarify what are the obvious reasons behind not being able to use SRP Batcher effectively in such a scenario? Is it that many dynamic objects will invalidate a lot of buffers/memory so a ton of it will need to be uploaded?

storm ravine
#

And well I asked Sebastian Aaltonen, He is lead of HR team about devices which doesn't support CS and ComputeBuffer (which connected, devices which doesn't support structured buffer usually doesn't support CS) If people want to make simple mobiles games (often 2d), then GameObjects usually is the right choice. Developers choosing DOTS often want to scale up to high entity counts and they require very high performance and scalability. So we made a decision to use ComputeBuffer to allow better GPU data persistence. This makes things much faster on current high end mobile phones and all desktop and console platforms. We can support around 3 generations old Androids and 4 generation old iPhones. That should be good enough for DOTS launch. It usually takes at least one year to develop a game, so there will be 1-2 more generations of new phones out when DOTS is mainstream. It's not optimal for early adopters who wish to ship their mobile games immediately with DOTS v1.0 and they want to reach maximum audience (meaning that the game is pretty simple), but this will be better for everybody else.

#

Can you clarify what are the obvious reasons behind not being able to use SRP Batcher effectively in such a scenario? Is it that many dynamic objects will invalidate a lot of buffers/memory so a ton of it will need to be uploaded?
@fringe sinew Well for example matrices again - you need them every frame if object moves

#

And instead of 2 matrices you send one matrix

fringe sinew
#

But that's just the model matrix. If we include the previous matrix too, then it's only two float4x4 that HRV2 saves by using the compute. But it's not just the inverse of matricies, there's the regular matricies, light probes and potentially more. Is it really a big save in the end?

#

But the other reason behind using computes is to be able to write to ComputeBuffers in parallel from multiple threads. Is that correct?

storm ravine
#

No

#

ComputeBuffers parallel writing - independent thing as I mentioned in 1

#

But that's just the model matrix. If we include the previous matrix too, then it's only two float4x4 that HRV2 saves by using the compute. But it's not just the inverse of matricies, there's the regular matricies, light probes and potentially more. Is it really a big save in the end?
@fringe sinew I showed example is ~1.25Mb savings for 10k entities

fringe sinew
#

if they're changed

storm ravine
#

And this IF is the point πŸ™‚

#

It's two beasts which solves two bandwidth problems πŸ™‚

fringe sinew
#

So, technically speaking, CS is used strictly for uploading less data to the buffers by generating additional data on the fly before writing, correct?

storm ravine
#

Yep

fringe sinew
storm ravine
#

Yep it's for copy data to big preallocated memory

loud matrix
#

Bah, started writing up my chunking system and forgot I can't use Lists, so now I'm stuck looping a entire DynamicBuffer on every entity which was what I was trying to avoid. I really should buy Fabians book to hammer this stuff home into my noggin.

storm ravine
#

BTW: SRP Batcher uploads materials once and caches them on GPU side. But it's not fully resident. For example all UnityEngine builtin properties (such as transform matrices) are uploaded for every viewport for every frame. In Hybrid Renderer V2 all of this data is also persistent, and delta updated. Also all per-instance material override data is persistent. In GameObject MaterialPropertyBlock, all of the overrides were uploaded every viewport. MPB actually disabled SRP Batcher for each affected GameObject. So everything was uploaded for objects with MBP.

#

We have plans to make things even more persistent. For example create persistent resource descriptors and descriptor sets on DX12/Vulkan/Metal/consoles. All the new APIs that make this possible.

fringe sinew
#

I don't get the first and third points then and who writes where.
Do I properly get that jobs write to a CS compute buffer and then that CS writes the data to the big persistent buffers?

safe lintel
#

why wouldnt you want to use a dynamic buffer in that instance @loud matrix ?

loud matrix
#

Because I forgot I can't use lists and wanted to use Linq for easy filtering

#

Nested Dynamic buffers with for loops it is

storm ravine
#

I don't get the first and third points then and who writes where.
Do I properly get that jobs write to a CS compute buffer and then that CS writes the data to the big persistent buffers?
@fringe sinew Jobs writes to ComputeBufers, that's all πŸ™‚ Depends on hardware it can be direct pointer to ComputeBuffer on GPU which used by CS or some intermediate buffer.

#

But in the end idea is write data to that buffers

#

And then merge them all to big buffer

amber flicker
#

@loud matrix want to describe the problem you're actually solving? Just wanted to note that a) to my knowledge you can't nest a dynamic buffer inside another (just in case you were thinking of it) and b) that sounds like an expensive problem - you may want to consider some kind of other structure ala boids potentially?

fringe sinew
#

But do I properly understand that, in the end, the CS writes data from the ComputeBuffers into the "big buffer"? I'm investigating the code and so far it looks like no job actually writes to the "big buffer" @storm ravine

storm ravine
#

Yes

#

Because you can't do that

#

In parallel async

fringe sinew
#

Alright, so the actual path of the data is to write to the ComputBuffer -> make the CS write to the persistent buffer

#

Correct?

storm ravine
#

Yes

fringe sinew
#

Alright, now I get it.
Thanks a ton for enduring me.

storm ravine
#

No problems, that's wide and interesting area

undone torrent
#

hello there where can i ask for some help about DOTS

storm ravine
#

No

undone torrent
#

thats the answer for me or the other guy

storm ravine
#

For you

#

It's was obvious joke wlgSad Yes you fell free to ask here about DOTS

undone torrent
#

oh thanks , can i share u a forum url that explain my problem and then u can try to solve or help if u want ?

#

i share it anyways,i hope u could help me, it is important for my degree final project
Thanks so much

safe lintel
#

cant get my stupid model to work with dots animation, rage rising

loud matrix
#

I have decided to shelve creating y own simple physics engine for now, hopefully by the time i come back to it the unity one won't eat 100FPs while doing nothing.

#

Time to see how it runs at scale with 1000 happy little entities crashing into each other

grim walrus
#

How would one implement something similar to how Mathf.LerpAngle works?

#

Because simply using the new math.lerp with an angle doesn't properly wrap the angle

#

Hold on I've got an idea, let me test it

#

Nope that didn't work

#

This is what I have at the moment πŸ€”

float3 difference = target - translation.Value;

float from = rotationEulerXYZ.Value.z;
float to = math.atan2(difference.y, difference.x) - math.PI / 2;

if (from > to)
{
    from -= 2 * math.PI;
} else
{
    to -= 2 * math.PI;
}

rotationEulerXYZ.Value = new float3(0, 0, math.lerp(from, to, deltaTime * faceMouseComponent.speed));
#

Well shoot, I tried using Mathf.LerpAngle instead of the stuff in the new mathematics package and it still does this weird behaviour

loud matrix
#

Yiiiiikes, from 450fps to 160fps for a single box collider entity. Perhaps I should dig out the old physics collision book

mint iron
#

I've been digging through the physics collider code for a couple of days, and it seems like there is a lot of room for improvement...

loud matrix
#

I'd only seen their truck demo in video before, I never realised how bad it was. The rear wheels were floating when I tried it

#

I think they focused on scale rather than performance at the moment as it is a massive hit, but scales at that level.

#

I'm still trying to see if I can dig down into it and disable collisions when needed as I don't need them on 99.9% of the time.

#

Issue I have is I know, when they're done with it, it will be better than my very scaled back version if I do build one, so trying to decide If i wanna just stick with it in jank mode till it improves.

hollow sorrel
#

the ecs physics?

#

what issues are you having with it

mint iron
#

yeah that sounds like a good move, im the same right now where my basic box/point box/box type collisions are much faster, but unity physics has nice authoring setups and more advanced types which i would struggle to implement, so its better to use as much of the unity physics ones as i can.

loud matrix
#

It's just not optimised at all yet. Just adding the package tanks 150fps (about 1/3 of my in dev fps)

hollow sorrel
#

how much is that in ms

loud matrix
#

And the docs are wrong in places

ocean tundra
#

@loud matrix You can step the physics world yourself, break things up into different worlds (or physics worlds) and only step them when you need them?

hollow sorrel
#

300 fps to 200 fps is different timings than from 200 to 100 fps

loud matrix
#

450 to 300

hollow sorrel
#

last i checked it was doing 10k moving rigidbodies in ~15ms on i7 8700k

loud matrix
#

Like i said, they focused on scale

vagrant surge
#

@loud matrix FPS is a horrible metric

#

do not use it to compare speeds

#

use MS

loud matrix
#

@ocean tundra I still need to look into doing that, I can easily step the sectors the user is not in, but with the speeds involved I'd need to switch between no and full physcis quickly if needed and I'm still not 1005 on my chunking system yet (and still need to look into splitting up my worlds)

vagrant surge
#

because "tanking 150 fps" is relative, it wuold be fine if you tank from 1000 fps, but horrid if you tank from 160

hollow sorrel
#

opps i meant 11ms for 10k rigidbodies

loud matrix
#

but ms is just a different expression of the same number

hollow sorrel
#

but ya

#

it def has issues but should be faster than physx from what i tested

#

also no it's not

#

200fps to 100fps is 100 fps difference
300fps to 200fps is 100 fps difference
but the timings in ms is different

loud matrix
#

You're comparing 2 different things though

ocean tundra
#

also ms matters less with DOTS as we have great things like Jobs, we should be aiming for 100% cpu usage πŸ˜›

loud matrix
#

Its the same as me saying "its tanked by 30ms" that's also missing context

vagrant surge
#

@loud matrix nope

#

because 30 ms is 30 ms

#

no matter what the baseline is

#

but FPS is a different length of time depending on baseline

#

so talking about FPS lost is 100% pointless

#

as an example

#

lets say i say "i lost 30 fps"

#

if my baseline was 60 fps

#

then that "30 fps" means 16 ms

#

but if i have 120 fps, and i lose 30

#

those 30 are instead 3 ms

loud matrix
#

That's not right though, if i say I lost 100 of 200 FPs that's me doubling my run time, if i gain 10ms from 10ms up to 20ms, same thing.

vagrant surge
#

no, because it also depends on how it goes with the rest of the frame, and the budget

#

if something takes 1 ms, thats 1/16th of a 60 fps frame

#

FPS cant be added together

#

but ms can

loud matrix
#

No, you're right

vagrant surge
#

so you can take your physics with 1 ms, + rendering 3 ms, and still know you have 12 ms left

loud matrix
#

I need a ******* drink apparently

#

after workign 2 19 hour days I forgot how to maths

hollow sorrel
#

if you're at 450fps your time per frame is about 2.22ms
i can imagine ecs physics taking up like 1ms base cost at low scale so that would tank fps by 1/3
but then if you double your colliders it should still be around 1ms (assuming low scale)
it doesn't scale linearly

vagrant surge
#

yup

#

system overhead in current unity is huge

#

so it might be 1 ms to activate purely on system overhead

#

but then 1000 physics colliders is maybe 1.2 ms

#

which, btw, i believe its bullshit, the current overhead in unity ecs is completely unnaceptable

safe lintel
#

dumb question but is ms relative to hardware? like 16 ms on a pentium gold vs 16 ms on a quad cpu xeon workstation?

vagrant surge
#

there should be a way to tell unity to run a number of systems with low overhead, with the job systems doing nothing, all singlethread

#

@safe lintel yup

safe lintel
#

ok just checking πŸ™‚

ocean tundra
#

@vagrant surge you can use .Run for that

vagrant surge
#

@ocean tundra still overheads

#

because it still checks if there are job systems touching those components

#

even with run()

ocean tundra
#

yea and they have said they are working on system overheads, but at least you get Burst so its better πŸ™‚

zinc plinth
#

if I have a job A and B, and I need to get the result of A to know how much job structs I need to create of B(I will scheduleParralel each B struct), is there a way I can do that without having to Complete the job A ? :/

vagrant surge
#

what i mean is that there should be a way to basically set a group of systems as "just run all of them togther as Run()"

#

and that would lower overheads to near zero

#

hell, my unity style ecs has near zero overhead

#

more than 100 times less overhead than unity

#

but it doesnt do multithread checking

ocean tundra
#

@zinc plinth Expose the JobHandle from A (Dependancy) and pass it into the schedule call of job B

vagrant surge
#

the thing is... what if you could tell unity to not even bother with multithread checking

hollow sorrel
#

how much overhead is there to run a system atm

vagrant surge
#

@hollow sorrel from my tests, unity tiny, on editor, with all debug checks disabled

#

0.2 ms for a 8 component system

#

linear

hollow sorrel
#

what

vagrant surge
#

4 components is 0.1

hollow sorrel
#

that's huge

vagrant surge
#

the entire logic of Tiny Racer takes about 2 ms or so

#

and tiny racer

#

is so tiny

#

that it shouldnt even take 0.1 ms for the entire thing

hollow sorrel
#

so 10 systems already = 1-2ms?

vagrant surge
#

yes

#

real build would be less

#

still huge tho

lusty otter
#

That's like 10% of the 60 FPS gone, just by doing nothing.

vagrant surge
#

red box is actual real execution

#

blue is overheads

#

of course, thats with profiler and editor. But even if its half that size in non-editor-build, thats completely unnaceptable

zinc plinth
#

@ocean tundra as in for now I have

var jobA = ...

var jobHandleA = jobA.Schedule()

jobHandleA.Complete()
for(int i = 0; i < jobA.someArrayThatIGetFromIt.length; i++) {
var jobB ...
}```

how do I avoid using `Complete` in this situation
ocean tundra
#

if thats in the same SystemBase

hollow sorrel
#

damn

ocean tundra
#

you dont have to worry

vagrant surge
#

btw, overhead being completley linear to however many components you access in your system

zinc plinth
#

wait wat

vagrant surge
#

i would like to try it on a build, but the samples are hella broken and cant build

zinc plinth
#

I can just use the length at the time of scheduling even if the array isn't allocated yet ??

ocean tundra
#

using SystemBase and OnUpdate, jobs and Entity.Foreach..... will automaticly be scheduled to run one after the other

#

only within the same SystemBase

zinc plinth
#

hodamn, that's rly nice

ocean tundra
#

between Systems is different, you need to get the jobhandle (like you did above) and pass it into JobB.Schedule(HANDLE)

#

yea was really nice when i discovered that

#

i think it was even in the docs πŸ˜›

zinc plinth
#

is there somewhere this is explained more in depth ? cuz from how I saw things at first all the stuff I do in OnUpdate is the scheduling of jobs

but does using this create a sync point or ? @ocean tundra

vagrant surge
#

@lusty otter the thing is that, from analyzing that trace, basically the entire overhead comes from job system checking dependencies

#

if you could remove that

#

by telling unity to execute a chain of systems singlethreaded (or as 1 compound job), you could lower the overheads HARD

hollow sorrel
#

i think job scheduling takes ~0.05ms too last i checked

ocean tundra
vagrant surge
#

so lets say you have the tons of systems on your physics

ocean tundra
#

cant find exactly where i found that

vagrant surge
#

but you dont need the multithreading until you go past 1000 objects

#

it would be great to tell unity

#

if less than 1000 objects, do not bother, execute all systems one after another as a single job for all that chain

#

at more than 1000, have proper multithreading

lusty otter
#

That's what I'm doing with my extremely simplified ECS too

vagrant surge
#

my own unity style ecs doesnt even cache archetype lists, its just not even needed with how stupid fast it is

lusty otter
#

My systems are supposed to complete their jobs before moving onto the next, it's calling complete anyways.

vagrant surge
#

i think i measured each system being like sub 0.01 ms

ocean tundra
#

@zinc plinth I'm not super smart about sync points, i think they come when your doing something with the EntityManager (adding/destorying) or using .Run

vagrant surge
#

and thats without caching things

lusty otter
#

I would like them to just not check multithreading safety stuffs, there's no need for it.

vagrant surge
#

with caching it would be literally 0

#

@lusty otter there was a lunatic on the Entitas github

#

that said he was running 1500 systems

zinc plinth
#

cuz using such array's length seems like it would hit spot on the definition of a sync point A synchronization point (sync point) is a point in program execution that waits for the completion of all jobs that have been scheduled so far. hence why I'm so surprised of this behavior, and have no idea how that would work in practice

vagrant surge
#

of course, thats entitas systems using change tracking, so its systems that only run when something changes

#

but still

#

1500 systems

#

good luck doing that on unity ecs

#

on a phone

lusty otter
#

😏

hollow sorrel
#

damn

lusty otter
#

It starts to make me think it's not even worth using Job system if the job itself isn't expensive.

vagrant surge
#

also 3000 components

lusty otter
#

The overhead might just be bigger than the benefit you get from Burst.

vagrant surge
#

@lusty otter because it isnt

#

thats in all languages except rust

zinc plinth
vagrant surge
#

rust has rayon for job systems that is crazy smart and wont launch the job if the worker threads are busy

hollow sorrel
#

it's so weird to read "0.05ms overhead isn't anything" in the forums when ppl were showing 1 million byte iteration+addition calc taking 0.05ms couple weeks ago here

#

could be doing 1 mil iterations per system overhead

ocean tundra
#

have you tried writing the jobs manually and not using SystemBase?

#

maybe that would be faster

hollow sorrel
#

i only checked jobs manually and that took 0.05ms

#

apparently systems take even more

vagrant surge
#

0.05 ms is super high

#

pretty sure cpp task systems arent so slow

#

i kinda wonder exaclty whats doing for that sort of overhead

mint iron
#

its probably just all the stuff they do in the wrapper around Update - running in normal c#. Its got multiple delegates, exception handling, bunch of branches its easy for that to add up.

amber flicker
#

They’re trying to make all the jobs structs that can be bursted which should hopefully help a lot. I also posted a suggestion on the forums for a ScheduleParallel that takes a chunk threshold - below which it uses Schedule

zinc plinth
#
    struct AJob : IJob
    {
        [WriteOnly] public NativeArray<int> test;
        public void Execute()
        {
            test[0] = new Unity.Mathematics.Random().NextInt();
        }
    }


    // Start is called before the first frame update
    void Start()
    {
        AJob aJob = new AJob
        {
            test = new NativeArray<int>(1, Allocator.TempJob)
        };
        JobHandle dep = aJob.Schedule();
        for(int i = 0; i < aJob.test[0]; i++)
        {
            Debug.Log("result: " + aJob.test[0]);
        }
    }``` https://i.imgur.com/YMBS6Ef.png 
idk what u read but that's wrong apparently, and makes alot more sense @ocean tundra
ocean tundra
#

thats cause schedule dosnt run right away

#

you needd a /complete i think

zinc plinth
#

yes I know; the question I asked was how can I modify this so that I dont need a Complete..

#

if it's at all possible

#

edit for what I actually want to be able to do: AJob aJob = new AJob { test = new NativeArray<int>(1, Allocator.TempJob) }; JobHandle dep = aJob.Schedule(); for(int i = 0; i < aJob.test[0]; i++) { BJob bJob = new BJob { }; JobHandle jobHandle = bJob.Schedule(dep); }

hollow sorrel
#

if I have a job A and B, and I need to get the result of A to know how much job structs I need to create of B(I will scheduleParralel each B struct), is there a way I can do that without having to Complete the job A ? :/
@zinc plinth
i don't think this is possible because you can only schedule jobs from main thread

zinc plinth
#

yea that's what I thought..

#

but it's so annoying, because I will need a lot of this kind of system, and throwing 10+ sync points right off the bat isn't the best :x

#

the A jobs will always be really small (3/4 entities) but still..

#

what happens exactly when you use Complete, does the main thread completly hangs or ?

hollow sorrel
#

yea it blocks

#

if you have a lot maybe you could batch them into one sync point

zinc plinth
#

hooo, you mean combining the sync points of all the systems into one ?

hollow sorrel
#

yea so you have one system near the end of your frame that calls complete on every of those A jobs and then does the scheduling of B

#

or something like that

zinc plinth
#

hmm, how do you pass job handles between systems ?

hollow sorrel
#

make them public and entityman.getsystem<>

zinc plinth
#

hem are u sure it's in the entitymanager ?

ocean tundra
#

why do you need that pattern alot?

zinc plinth
#

I have grids that can be flagged as to needed to being worked on, and members of each of those grids

#

I don't want to process all the grids that are not flagged

#

and each grid element has a shared component with the id of the grid

#

for the entityquery

ocean tundra
#

yup makes sense

#

so first job is to gather everything that needs to be worked on?

#

and 2nd is run per thing?

zinc plinth
#

ya

ocean tundra
#

i think you can get away with only 2 jobs

hollow sorrel
#

ops i guess it's world.getexistingsystem

ocean tundra
#

but the 2nd needs to be custom written as a IJobForEach (i think it is)

zinc plinth
ocean tundra
#

and it can be scheudledParrall

zinc plinth
#

@ocean tundra hemm, can you pseudocode that ? I don't see where you put the entityQuery.setFilter in there

ocean tundra
#

oh the 2nd Is not a Entities.foreach

zinc plinth
#

cuz I need to setFilter on each grid id I got from the first job

#

no

ocean tundra
#

so im actually doing simlar

#

i have a Entitis.Foreach () this builds a nativemultihashmap of PlayerIds, Messages

#

then i have a Job.WithCode that loops over that result and sends it to players, but due to reasons that has to be .Run

#

but somehow its possable to get a Job that will schedule many depending on the size of the input list

#

but pretty sure you have to write that 2nd job without using the SystemBase helpers

zinc plinth
#

I don't think our problems are the same

#

oi eizen

storm ravine
#

IJobParallelForDefer

ocean tundra
#

Oooo whats that?

storm ravine
#

If you need schedule job with dynamic range which unknown at schedule time

#

For example you have job which populates NativeList

#

You don't know how many item will be in that list

#

And you want schedule parallel job

#

with size of NativeList.Length

#

IJobParallelForDefer with NativeList.AsDeferredJobArray solves that problem

ocean tundra
#

sweet

#

that looks like what you need @zinc plinth

zinc plinth
#

well yes, except I would've liked to scheduleParralel on my second job :/

#

and I can't use my setFilter with this

storm ravine
#

And all what you're talking above was a bit wrong, because of @zinc plinth wants different thing, not what @ocean tundra tried to suggest πŸ™‚ it was like "I want juice" answer - "Go jump with dog"

#

You don't need any filters here

ocean tundra
#

pretty sure @storm ravine 's answer would allow that

#

πŸ˜›

zinc plinth
#

I don't ? ThinkMan

storm ravine
#

IJobParallelForDefer
@zinc plinth

zinc plinth
#

hemm, the array I get from the first job is the grid ids, I don't want to iter over all the grid members of my world

ocean tundra
#

ahhh i though you did

storm ravine
#

Who speak about whole grid? if you populate array with only required items which should be processed next you should use IJobParallelForDefer

#

Example:

#

Problem:

#
        {
            var listOfItemsForProcess = new NativeList<int>(Allocator.TempJob);
            Dependency = new JobA()
            {
                list = listOfItemsForProcess
            }.Schedule(Dependency);
            Dependency = new ProcessList()
            {
                listOfItemsForProcess = listOfItemsForProcess
            }.Schedule(?????, 10, Dependency); //<- you don't know how many items will be in listOfItemsForProcess and can't schedule parallel job for that count of items here, because it not yet known
        }

        public struct ProcessList : IJobParallelFor
        {
            public NativeList<int> listOfItemsForProcess;
            public void Execute(int index)
            {
            }
        }```
#

Solution:

#
        {
            var listOfItemsForProcess = new NativeList<int>(Allocator.TempJob);
            Dependency = new JobA()
            {
                list = listOfItemsForProcess
            }.Schedule(Dependency);
            Dependency = new ProcessList()
            {
                listOfItemsForProcess = listOfItemsForProcess.AsDeferredJobArray()
            }.Schedule(listOfItemsForProcess, 10, Dependency);
           // you pass listOfItemsForProcess as argument and use listOfItemsForProcess.AsDeferredJobArray() as field
        }

        public struct ProcessList : IJobParallelForDefer
        {
            public NativeArray<int> listOfItemsForProcess;
            public void Execute(int index)
            {
            }
        }```
#

Thus secong job will be scheduled properly and will run only for items populated in previous list

#

without completing dependency chain

zinc plinth
#

hoooooooo you mean by providing them in advance

but that blends all the grid members of the flagged grids together, and prevent to get a per-grid processing state Notlikeduck

storm ravine
#

And one more (again, which was mentioned by me here many times) Complete() - Not Sync Point. It just completes current dependency chain. Sync Point - complete ALL jobs in world

#

but that blends all the grid members of the flagged grids together, and prevent to get a per-grid processing state :Notlikeduck:
@zinc plinth rephrase that, I don't understand what you mean πŸ™‚

#

You populate list of elements. It can be indicies to grid, it can be some items etc.

#

You just take possibility schedule job with deferred array with appropriate length which unknown at schedule time

#

For example, I have 100 units with some their state in component, in first job I collect only units with required state, and then I want run parallel job for that units with required state and process it on 1 worker thread per unit (batch count 1) for AStar for example

zinc plinth
#

hemm, like for one system I did I need to iterate over specified grid elements and check if they are in range of eachother, if a "connected" grid member is in range of some other, that grid member will get turned into a "connected" one

I use 2 native arrays to store these(one for non connected members, and one for connected) and both are the size of all the members combined; this works because all the grid members are from the same grid

if I throw multiple grids in this, there is no way I can make it work without jumping everywhere in memory between the thousands of elements I need to sort, and I need to find a way to keep 2 arrays for all the grids in the same job somehow

storm ravine
#

You can even collect in parallel job first by parallel list writer or in to NativeHashSet\NativeHashMap and use intermediate IJob for remapping hash map\set to list which will be used as deferred array

#

I don't get what you want

#

I just can't understand what you trying to do from your explanation

zinc plinth
#

I'm sorry sadPepe

storm ravine
#

What you trying to say now completely different from what you asked before :)

var jobA = ...

var jobHandleA = jobA.Schedule()

jobHandleA.Complete()
for(int i = 0; i < jobA.someArrayThatIGetFromIt.length; i++) {
var jobB ...
}

zinc plinth
#

it's because all the detail lies in the jobB, that I thought I could avoid explaining at first but was crutial in the end facepalm

#

sorry for wasting your time

storm ravine
#

Well let's try again

#

You have some job A - what purpose of that job

#

abstracted from your exact logic, just in couple of words

#

I have grids that can be flagged as to needed to being worked on, and members of each of those grids
I don't want to process all the grids that are not flagged
and each grid element has a shared component with the id of the grid
for the entityquery

zinc plinth
#

first job is is getting grid ids;

storm ravine
#

Ok you have grids where ISCD is ID per grid right?

#

First job collect required ID's right?

zinc plinth
#

ISCD ? Wat

storm ravine
#

ISharedComponentData

zinc plinth
#

ho, ya it collects the ids & other metadata I need for each grid

storm ravine
#

Grid itself is entity?

zinc plinth
#

yes

storm ravine
#

Ok. You process in job all grids, collect for example with ID 5 and 7, then what you doing with them?

#

exclude Complete schedule part

#

Just intention

#

For every ID run parallel job

#

Which process items with same ID?

zinc plinth
#

yes

storm ravine
#

That items also has same SharedComponent with that ID?

zinc plinth
#

in the Grid it's just a ICD containing the id, in the GridMember it's a ISCD

storm ravine
#

Ok not a big difference

zinc plinth
#

I'm so retarded jeezus christ

#

I can just get the amount of entities from the original EntityQuery happy_cry_cat

#

because every Grid in the entityquery are going to be worked on

storm ravine
#

Well if they have some tag component which indicates that they should be processed, and EQ returns you not all grids - then yes

zinc plinth
#

I'm so sorry this shouldn't have taken so much time to figure out NotLikeThis

storm ravine
#

But what not clear for me in your case

#

EQ for grids contain tag or not?

zinc plinth
#

each grid can contain a tag that says "this grid needs to be worked on"

storm ravine
#

Well then all clear.

zinc plinth
#

thank you so much ❀️

loud matrix
tardy locust
#

It's clearly a cube made of rubber

ocean tundra
#

πŸ˜› super rubber

zinc plinth
#

rubber so efficient it has >1 elasticity fingergunspin

tardy locust
#

That's what we call "Just Right" game feel

zinc plinth
#

ehehehe

eager jungle
#

Hi guys, i have an issue with the following code using blob assets.
I have the following error: error MayOnlyLiveInBlobStorageViolation: You may only access .Name by(non-readonly) ref, as it may only live in blob storage.

mint iron
#

finally got this working after 3 days of trying things out

loud matrix
#

@eager jungle Where are you trying to access the data from and can you show the code of how you're trying to access it.

#

@mint iron So err, what is that then?

mint iron
#

they're volume modifers using the physics shape authoring. drawing the shape colliders at edit time (while not selected), doing collision test on the native colliders (outside of physics system) and marking up flags on the grid

#

the grid is a blobasset in a subscene, so it all gets baked but the volume modifiers could also be used at runtime in dots.

eager jungle
#

thank you @loud matrix !

humble mason
#

hey guys sorry for the newbie question, im trying to get started on dots and I just installed the dots editor package. It installs burst as a dependency but burst has been giving me a problem. I keep getting a pop-up saying "The version of Burst used by your project has changed. Please restart the Editor to continue."
The issue is that I restarted the editor multiple times, but it doesnt go away and also throws some errors in the editor itself.

#

apparently it cant find glibc? I know for a fact that i have it installed (im on linux btw)

#

DllNotFoundException: Unable to load the unmanaged library /home/bluebouris/Dev/Unity Projects/DOTStestproj/Library/PackageCache/com.unity.burst@1.3.0-preview.12/.Runtime/libburst-llvm-9.so Reason: /lib64/libm.so.6: version GLIBC_2.27' not found (required by /home/bluebouris/Dev/Unity Projects/DOTStestproj/Library/PackageCache/com.unity.burst@1.3.0-preview.12/.Runtime/libburst-llvm-9.so)

#

That's what I'm getting

#

Okay i'm getting at something. Apparently my distro provides me with glibc 2.26 while burst is looking for 2.27 according to that error

loud matrix
#

At this point I cant tell if the physics engine is cursed or what. It seems to demand i have a custom component in my archtype, one thats not used and doesn;t have any systems or data. But only sometimes, its iffy with it being there and sometimes just won;t work even if it is. And now I remember why i dropped this thing last time i tried it.

#

Ahhhnnnd now it won;t work at all, just makes my entity NaN on all WorldRenderBounds, LocalToWorld, Rotation and Translation

zinc plinth
#

@storm ravine the solution I thought was possible isn't in the end because beyond just needing the amount of grids it needs to work on, it actually needs the grid id for the setFilter sooo..

storm ravine
#

And what the problem? _q.ToComponentDataArray<T>_q.ToComponentDataArrayAsync<T> where T your component with ID and you have array of your ID's for SetFilter

zinc plinth
#

didn't they want to deprecate these ? Wat

storm ravine
#

No

zinc plinth
#

ho

storm ravine
#

And never was

#

They deprecated (and removed) AsComponentDataArray long time ago

zinc plinth
#

actually, what's the behavior of ToComponentDataArray if you use it to get arrays of 2 components on the same query, will the indexes align so that 1 index is the 2 component from the same entity or can it be random ?

ocean tundra
#

that way entity is the index not a number

#

bit i dont think its as fast

zenith wyvern
#

actually, what's the behavior of ToComponentDataArray if you use it to get arrays of 2 components on the same query, will the indexes align so that 1 index is the 2 component from the same entity or can it be random ?
@zinc plinth

They are guaranteed to align

zinc plinth
#

Nice!

dull copper
#

Unite Now talk for Kinematica was recorded 2 months ago and it only now got out

#

meaning, there are still chances they've stacked that Mike Acton talk on the queue πŸ˜„

remote coyote
#

the dream

sleek ember
#

is EntityManager.SetEnabled() intented for editor use only or both ?

storm ravine
#

Both of course it just add\remove Disabled tag to entity archetype (or for all LinkedEntityGroup if exist)

undone torrent
#

Hello there , I am trying on editor to fill a not main scene with gameobjects and then use it as subscene but when i try too close the scene unity crashes

  Scene aux = EditorSceneManager.GetActiveScene();
        Debug.Log(AssetDatabase.GetAssetPath(Subscene));
        Scene aux2 = EditorSceneManager.OpenScene(AssetDatabase.GetAssetPath(Subscene),OpenSceneMode.Additive);
       
        EditorSceneManager.SaveScene(aux2);
        

        Debug.Log(aux2.name);
        EditorSceneManager.SetActiveScene(aux2);

        // GameObject a = new GameObject("SubsceneGameObject");
        // Undo.RegisterCreatedObjectUndo(a, "Created SubsceneGameObject");

        EditorSceneManager.SaveScene(aux2);
        SceneManager.SetActiveScene(aux);
        

        subsceneGameObject.GetComponent<SubScene>().SceneAsset = Subscene;

        //if (aux2 != null)
         //EditorSceneManager.CloseScene(aux2, true);

I am sure is about a race condition but maybe u could help , i dont know much about scenesmanagent and subscenes

#

The code above its just a test

bold sleet
#

im using hybrid_renderer_v2 and ECS, my entities created in ECS are not being SHOWN being rendered, even with it showing that they are being detected. I can also render objects in scene, with the same mesh and texture, im not sure whats going on

#

the only thing i can think of in the debugger is that AddWorldAndChunkRenderBounds says "not run"

#

but the entities in the debugger show render bounds, world bounds, mesh as normal

#

HybridChunkInfo too

#

any thoughts

mint iron
#

HybridRenderer 0.5.0 package is present and you're using 2020.1+ ?

bold sleet
#

yes

mint iron
#

are you using a subscene or convertAndInject?

opaque ledge
#

you need to get URP/HDRP 9.0

#

if you havent already

bold sleet
#

uhh, neither, I am creating entities using entityManager.CreateEntity(EntityArchetype archetype, NativeArray<Entity> entities), im using defaultworld, and just the normal scene. I have URP 9.0.0-preview.14

#

im sure im doing something wrong

#

its just weird cuz I can render objects I add

pliant pike
#

are you sure they arent falling or flying off in a random direction?

bold sleet
#

yea

#

100% sure

#

i will check again

opaque ledge
#

i think someone asked this question before, does your entity have "RenderBounds" component ?

bold sleet
#

yea

pliant pike
#

that's what happened to me a few days ago

#

the position in the editor/debugger might not be updating correctly

bold sleet
#

that makes sense but let me check

opaque ledge
#

do you have physics stuff on your entity ?

bold sleet
#

no, actually I forgot to mention that everything stopped showing the second I enabled it, but works without it "ENABLE_HYBRID_RENDERER_V2" in project settings

#

but the code is working the same, and its still batching everything

#

just not showing anything

#

but it will show the same mesh and sprite being added post scene starrt

#

as game objects

opaque ledge
#

is translation NaN ?

bold sleet
#

translation is normal coordinates as intended

#

like therre are no errors for any entity

#

within camera

mint iron
#

i would try getting something to show up using a subscene - like create a subscene, drop a cube GameObject in it and hit play, if it renders you'll know the issue is related to how you're creating them in code.

bold sleet
#

yea i am going to have to

#

to narrow this down

opaque ledge
#

its advised to instantiate renderable stuff from prefabs instead of creating on code

bold sleet
#

yea i know

#

i just wanted to test the ability to create from code

coarse turtle
#

hmm off the top of anyones head, let's say I had this native list. It has a capacity of 100, with a few added elements so its length is like 3. If I memset from [3,99]

#

would the length property still be 3? πŸ€”

mint iron
#

yes, you'd have written the data but the length will only change using the default methods Add, AddRange etc

#

there's a method to set the length though, cant remember what it is off the top of my head

coarse turtle
#

Ah makes sense

#

thanks πŸ™‚

bold sleet
#

wow

#

not sure how but anything tied to ECS wont render at all

#

with hybrid_renderer_v2

#

enabled in project

#

even using other projects

#

is there another setting im missing

loud matrix
#

Sorry can you explain further @bold sleet so you start a new project, import the ECs packages, add a camera and nothing renders?

dull copper
#

@bold sleet are you using netcode package?

mint iron
#

why does rider just sit there saying 'evaluating' or 'processing' forever when i try to inspect serialized properties :S

solar spire
#

It's just a thing it doesn't support properly. There's an issue listed on their github

mint iron
#

awesome, ty sir!

winter depot
#

I am trying to clean up some old jobs I had where I was manually calling CompleteDependency() in order to read from the data elsewhere. Is the best approach to use [UpdateAfter] ?

#

I guess what I am saying is should I add them all to a group, and then order them inside that group with update before or update afters, or is there another approach that someone would reccomend

winter depot
#

I followed the approach listed above and it appeared to work out for me

sand prawn
#

So. Weird "bug" in the multiplayer sample (has anyone else seen this?) the CubeInput code all seems to happen for every connected client (in other words, all cubes are moving not just the cube from the currently "presenting" connection)

tardy locust
#

Might not be the right place to ask but here goes:
I'm trying to make a "floppy" stick using a Chain IK Constraints from the Rigging package (2.6). But the stick is very rigid in the way it bends. Is what I'm trying to do possible (the dark blue line is what I wanted to happen) with the Chain IK Constraints? Or no?

ocean tundra
#

@tardy locust Yea pretty sure thats not DOTs, isnt rigging just a animation package? Maybe try asking there?

tardy locust
#

Yeah I'll try that

bold sleet
#

@loud matrix yea for some reason having ENABLE_HYBRID_RENDERER_V2 active causes nothing relating to ECS to spawn, no subscene (with simple setup), no one elses stuff, nothing, but i remove ENABLE_HYBRID_RENDERER_V2 and it works again as normal, weird... but game objects load just fine. using same textures.

#

like i have ENABLE_HYBRID_RENDERER_V2 and use gameobjects, not ecs entities, and they work fine

#

idk!

ocean tundra
#

@bold sleet are you using URP or HDRP?

bold sleet
#

not spawn,l i mean render

#

i have URP installed

#

everything spawns btw, just doesnt render

ocean tundra
#

hmm me too but i havnt activated V2 yet

#

unity version?

bold sleet
#

beta available

#

2020.1.0b8

#

rev 3654

ocean tundra
#

yea im using that too

#

i just want to fix this build bug i have, and after that i can try activating V2

#

see if i get the same

bold sleet
#

is like, V2 worth it, using game Objects

ocean tundra
#

V2 without game objects should be worth it. the preformance boosts look great

bold sleet
#

oh, but with gameobjects its negligable?

#

hmm

ocean tundra
#

not sure about with game objects

#

what are the GOs for?

bold sleet
#

just hold entity data... which is what I wanted ECS for, since I get immediate preformance gains, like 100k entities working on screen with over 20fps, which is alot for me

#

for what i am doing

ocean tundra
#

?? they hold entity data?

bold sleet
#

no like

#

i'd use the game objects as entities

#

if i had to choose

#

but i'd have less of them since game object is slower

#

oh nvm

#

I see why ECS is faster, no game object overhead

ocean tundra
#

Anyone know how to track down Burst exceptions from a build?

#

I'm getting things like:

lib_burst_generated.dll caused an Access Violation (0xc0000005)
in module lib_burst_generated.dll at 0033:ca7e9f46.

#

makes zero sense to me 😦

#

pretty sure its happening when burst compiles a bunch of jobs needed for the first time

bold sleet
#

well thanks everyone for the help, i'll just mess with this in my spare time and be grateful for ECS working at all

ocean tundra
#

good luck πŸ™‚

#

I also get things like "Attempt to access invalid address." in my logs

opaque escarp
#

Is there an easy way to limit the number of entities a job runs on in a given update? Use case is loading chunk for a world, for example, not wanting it to hang on one frame

ocean tundra
#

I haven't heard of anything like that but you could probably do it yourself

#

but also with the JobSystem and Burst you can process crazy amounts of entities

#

your "start" system needs to find all your entities and add a component to them, but stop adding that component when a counter is too high

#

every other system only processes when that component exists

#

but again not sure you need this, unity has new ways of loading/unloading things (subscenes)

#

and pretty sure you can do it all in a background thread

opaque escarp
#

I might do the add the thing to only a few entities, just wish there was a simpler way of restricting the amount of processing done per frame, or earlying out in some way that wasn't obnoxious

#

I guess that wouldn't be deterministic though, if was based on processing time

ocean tundra
#

take a look at substreams

#

subScenes*

#

and exclusive entity transaction

#

pretty sure you can do all the loading in background threads into background worlds

#

then "pop" those worlds into the main one super quick

#

thats what that mega city demo did

opaque escarp
#

Thanks, I'll look into it

#

I don't know if subscenes work for complete procedural stuff

ocean tundra
#

yea i dont think so

#

my plan (still super early) is to create a few "generation worlds"

#

do all the procedural generation in those

#

then use that transaction thing to bring it all into the main world when ready

#

i also plan on ticking my systems manually

#

so not limiting number of entities, instead limit what systems can generate each frame

#

and maybe one day unity will support long running jobs for anything that i cant break up

#

but im still ages away from all that

wide fiber
#

How can I add something to a list in a Foreach.ScheduleParallel()?

#

The parallelWriter hasn't a function called .Add()

zinc plinth
#

I think it's AddNoResize @wide fiber

wide fiber
#

Ok ty, but if the list hasn't enough capacity and I use AddNoResize will it work?

storm ravine
#

No. It will throw overflow exception. Parallel native list version expect you have known capacity.

wide fiber
#

@storm ravine ok I've switched to Schedule() instead of ScheduleParallel ()

zenith wyvern
loud matrix
#

Trying to get my head around converting from a direct position system to a physics system is messing up my head. So simple to just say 10ms acceleration, 300ms max speed. but nope, now I need to define impulse acceleration and vehicular mass then work out the conversion to show what the max speed actually would be.

wide fiber
#

If I have an entity with a physics shape (a sphere) how can I get the radius in the code? In the entity debugger the only component that I can see is Physics Collider and it is empty

loud matrix
#

You can get the radius from the BlobAssetReference<Collider> SphereCollider that's created for the entity. Should be accessible from PhysicsCollider

#

Are you using convert to entity or making your entities and physics programmatically?

gusty comet
#

Hey. I'm trying to iterate over a dynamic buffer in quite the naive way to understand it better:
I'm trying to do int x = buffer[i] inside a loop. but the engine does not allow that.. how should I go about it?

loud matrix
#

Can you show your full code

gusty comet
#

It's really as simple as that:
IBufferElementData with int value.
Filled the buffer with ints as one would treat an array (works as expected)
Then just trying to do
for(int i =0 ;i < buffer.length ; i++)
intx = buffer[i]

loud matrix
#

That's why I suggest posting the entire thing, as it should be that simple.

gusty comet
#

"Cannot implicitly convert type (buffer) to int"

loud matrix
#

You need to access the property in the buffer int = buffer[i].Value Or what ever property that is a int in the buffer struct

gusty comet
#

yep. that was it... goddamn. Thanks man

loud matrix
#
               __
             <(o )___
              ( ._> /
               `---'  Rubberduckie to the rescue!
opaque ledge
#

Rubberduckie \o/

grave raptor
#

umm

storm ravine
#

Why can't I use https://pastebin.com/4wfpqFxY


Entities.WithDeallocationOnJobCompletition(list).Foreach(...); ```

@wide fiber because only native array support that attribute.

#

For other native containers you should use Dispose(JobHandle)

safe lintel
#

btw @storm ravine are you doing all of the rendering for you own game yourself or do you use any part of the hybrid renderer?

storm ravine
#

Already answered above πŸ™‚ Every thing with animation - render by myself through DrawMeshInstancedIndirect (units, buildings, animals). All other - hybrid renderer with custom shaders (trees, cliffs, ground)

loud matrix
#

Working with pure ECS with the physics engine is a new level of mind bending

wide fiber
#

Are you using convert to entity or making your entities and physics programmatically?
@loud matrix convetToEntity

#

@wide fiber because only native array support that attribute.
@storm ravine ok ty

loud matrix
#

It should still be accessible from the PhysicsCollider.Value as a BlobAssetReference<Collider>

wide fiber
#

Ok I'll try, thanks

mystic mountain
#

What would be the simplest way to run the same Entity Job with different queries (in different systems basically).

opaque ledge
#

hard to understand the sentence

#

what is Entity Job ?

mystic mountain
#

Entities.ForEach, could be chunk if req.

#

Well, I know you could do it with IJobChunk, but it's a bit messy to set up.

opaque ledge
#

but Entities.ForEach is a query

storm ravine
#

IJobChunk much cleaner for setup πŸ™‚

#

@opaque ledge Entities.ForEach is IJobChunk πŸ™‚

mystic mountain
#

Yeah sure. So doing a calling a method from the Entities.ForEach, but I need to specify it multiple times, it's just some tag that differs.

storm ravine
#

Well with Entities.ForEach you can write your struct with some method and call it struct from all your ForEach which should do that thing

#

Or write your own job πŸ™‚

#

Which do all boilerplate under hood πŸ™‚

mystic mountain
#

IJobForEach will be deprecated, hmm alright.

storm ravine
#

IJobForEach - yes

mystic mountain
#

I basically have a module I want to be able to run for both predicted, interpolated and client local entities. Hence for predicted they need to be in special group which can run multiple times.

wide fiber
#

I haven't understood the problem, can't you make a static function that takes the things that you need and call it from the Entities.Foreach?

mystic mountain
#

Yes, I figured that would be the best solution anyway. I thought I could use a EntityQuery with Entities.ForEach and on creation of the system feed in the additional components that would be appended on the query and later used. But realized I would either way need some additional code for ShouldPredict() on the client side anyway.

loud matrix
#

Why didn't they make math.select and math.step paramaters the same order as a ternary, I keep having to search the git repo to remind myself of the order.

graceful mason
amber flicker
#

You’re using light theme (jk πŸ˜…) - you need to put your code in a class that extends SystemBase to use Schedule etc - might be worth checking out the samples quickly first.

graceful mason
#

I thought I was following them, πŸ˜„

#

Thanks Ill look into that

loud matrix
#

I've seen something similar working