#archived-dots

1 messages ยท Page 36 of 1

deft pilot
#

exactly who cares?

#

why do you care?

haughty rampart
#

about how much data you send....

deft pilot
#

i mean in general

#

implementation wise it shouldn't matter what i decide on how to network

haughty rampart
#

the system as a whole just sounds majorly wonky and confusing

rotund token
#

I feel like your prediction layer is going to be very tough

haughty rampart
#

likely very hard to track down bugs

deft pilot
#

that sounds like a you issue thou?

#

like if i do run into those problems sure thats on me

haughty rampart
#

exactly, it's gonna be a you issue

deft pilot
#

but it shouldn't matter to you

#

this isn't a library

#

i built for this game

#

so its not like it hasn't been tested

haughty rampart
#

is it a library built for entities?

rotund token
#

Just out of interest what player count does it handle up to

deft pilot
#

unfortunately i've never stress tested that

rotund token
#

And what network conditions

deft pilot
#

i've never considered making a mmo

#

or anything with large mp design

#

(so at most 4 player testing)

rotund token
#

Will it handle say mobile conditions of say 5% or even 10% packet loss

#

Just curious

deft pilot
#

yeah packet loss isn't a problem

#

it does packet replay

#

and has a way internally to resync where possible

#

but thats assuming non-corrupted state

rotund token
#

There's a point where that causes more issues by adding an ever increasing delay

haughty rampart
#

going back to your previous issue: sync a timer over the network

rotund token
#

We've had issues resending world data when missed

deft pilot
#

oh just to confirm

#

this isn't a realtime library

#

or not designed for realtime

#

ie/you wouldn't use this for a fps

haughty rampart
#

?? so a turn based game or smth

deft pilot
#

doesn't have to be turn based

#

but high paced real time sync isn't the design in mind

#

anyway

#

like i said

haughty rampart
#

you can just sync every 5 seconds or so

deft pilot
#

this isn't a you problem

#

its a me problem if it has any problems

#

i just wanted to know how to change / cap the simulation speed

haughty rampart
#

told you that already

deft pilot
#

i'm not asking you to tell me again

#

i was just reiterating what the question originally was

haughty rampart
deft pilot
#

that doesn't seem to work

#

i tried that as a first option

haughty rampart
#

where?

deft pilot
#

with vsync 0 / target framerate w/e

#

in some awake mb script

haughty rampart
#

entities has a own clock on framerate and stuff independent of mb things

deft pilot
#

the targetframe adjustment is context sensitive?

haughty rampart
#

there's a framerate for MB and a independent one for entities

deft pilot
#

so how do you change the entities one?

haughty rampart
#

am trying to find it currently.

deft pilot
#

fair enough

haughty rampart
#

haven't needed that for a while

haughty rampart
# deft pilot fair enough

i'm still searching, and unfortunately i don't have any pre 1.0 projects anymore, but iirc, in the entities Time class (not UnityEngine.Tme) you can say Time.timestep = 0.2f or similar.

deft pilot
#

i'll see if i can google around

#

thanks

haughty rampart
deft pilot
haughty rampart
deft pilot
#
            var timeStepGroup = World.DefaultGameObjectInjectionWorld.GetOrCreateSystem<FixedStepSimulationSystemGroup>();
            timeStepGroup.Timestep = 60;
haughty rampart
deft pilot
#

yeah for the ones that require syncing

#

anyway thanks for the info

haughty rampart
#

yep

#

np

alpine elm
#

hi... is the dots system fully ready and we as users should starting using it or is it still in beta?

haughty rampart
alpine elm
haughty rampart
alpine elm
haughty rampart
alpine elm
#

thank you

#

I will start learning ๐Ÿ˜„

#

thank you again

dense storm
#

How come if I change the scale with Scale component data, it does not change the mesh graphic's scale?

#if ENABLE_TRANSFORM_V1
            EntityManager.AddComponentData(e, new LocalToWorld());

            EntityManager.AddComponentData(e, new Translation
            {
                Value = transform.position
            });
            EntityManager.AddComponentData(e, new Rotation
            {
                Value = transform.rotation
            });
            EntityManager.AddComponentData(e, new Scale
            {
                Value = _bulletData.Scale
            });
#else
            EntityManager.AddComponentData(e, new LocalToWorldTransform
            {
                Value = new UniformScaleTransform
                {
                    Position = transform.position,
                    Rotation = transform.rotation,
                    Scale = _bulletData.Scale
                }
            });
#endif
#

But if I change it in LocalToWorldTransform it scales the mesh's scale

#

What's going on why? @@

deft pilot
#

now its decoupled from fps woot

dense storm
rustic rain
dense storm
deft pilot
haughty rampart
dense storm
rustic rain
dense storm
#

Ok cool

dense storm
rustic rain
#

Show what you do

dense storm
#
            _combatEntityManager.AddComponentData(e, new LocalToWorld());

            _combatEntityManager.AddComponentData(e, new Translation
            {
                Value = transform.position
            });
            _combatEntityManager.AddComponentData(e, new Rotation
            {
                Value = transform.rotation
            });
            _combatEntityManager.AddComponentData(e, new CompositeScale
            {
                Value = _bulletData.Scale
            });
#

_bulletData.Scale is float

rustic rain
#

Composite scale is 4x4

#

You need only 3 values of it

#

I don't remember which

dense storm
#

I found that changing the y rotation value scales the projectile

#

Rotation.y is the new scale component y'all bamboozled me

rustic rain
#

๐Ÿค”

#

I think having physics package messes it up

rotund token
#

just sounds like it's scaled in wrong direction

dense storm
#

Jokes aside it isn't solved, I'll just brute force it

#

4x4 means 256 possible combination, I'll try it all

rustic rain
#

and see

#

how it's done

#

lol

dense storm
rustic rain
wicked trout
#

Unity 2022.2.0b11 has fixed the player crashing when containing a subscene in the scene. When having set the compiler to IL2CPP

rustic rain
#

new patch?

#

pog

wicked trout
#

Yep

dense storm
#

So, setting Composite Scale does not change the LocalToWorld scale matrix

rustic rain
#

hopefully subscene baking doesn't require running game anymore

#

Burst: Support for detecting managed breakpoints in code compiled with burst, and automatically switching the affected code to the mono execution path to allow managed debugging. Requires Burst 1.8

#

from the patch notes

#

cool

wicked trout
rustic rain
#

now you can attach breakpoint

#

and it'll disable burst for this job

#

if you use managed debugger

wicked trout
#

Cool ๐Ÿ‘

rustic rain
#

UI Toolkit: Improved UI Builder inspector.

#

wonder what's that

gentle gyro
wicked trout
#

Odd, I do have a problem with with one of my objects which appears pink for some reason. And if you have the Android build set to "Release" instead of "Develop" it will appear invisible. Maybe you have it set up this way?

gentle gyro
#

Nope, Dev...

#

I believe someone else had issues with materials as well but don't remember who...

wicked trout
#

Hum

gentle gyro
#

Well, magenta anyhow...

wicked trout
#

Well this material has its texture generated on runtime so maybe for some reason it doesn't like that

#

On the editor works 100% fine though

gentle gyro
#

Maybe a syncing issue?

wicked trout
#

Wait, are you waiting until the subscene is loaded?

gentle gyro
#

I mean on your issue...

wicked trout
#

Oh

gentle gyro
#

I'm not waiting, should I?

wicked trout
#

To make sure its loaded I infinitely check for one of the necessary entities to appear with the EntityQuery function

#

If it doesn't find it, it waits a frame and then it repeats

gentle gyro
#

Actually this simple test has Zero scripts...

wicked trout
#

When it finds it it turns on all scene objects

wicked trout
gentle gyro
#

Is there no callback for it?

wicked trout
#

No clue

#

I imagine your object does bake in the editor right?

gentle gyro
#

I assume so...

#

Shows up in editor also...

#

I'll try a mono build...

#

Mono works...

wicked trout
#

Ok, btw I have updated from 2020.3 and since then my right eye on the Quest 2 has a lot of visual glitches on the edges of objects. (Lots of flickers and Magenta pixels) Do you by any chance have the same problem? I'm running vulkan.

wicked trout
#

Just checking (I don't know if it matters) have you also set the compiler to IL2CPP on the project settings or only in the build configuration?

#

Also I have set it to only compile for ARM. 64

gentle gyro
# wicked trout Odd

I kind of expected it to work with Mono as it seems to be an IL2CPP thing...

wicked trout
#

This is my configuration if you want to compare

rotund token
#

not sure why it was added again

dense storm
#

Resizing with old transform Entities 1.0ex8

gentle gyro
#

What is this?

rustic rain
wicked trout
rustic rain
#

also for some reason prefab instantiation doesn't work for me in baking

wicked trout
rustic rain
#

what's worse - Editor gets corrupt and requires restart

gentle gyro
rotund token
#

^

rotund token
#

it was added in like ~b6

#

sometimes the IDE disconnects weirdly though and the breakpoints stop working, usually requires a resync of projects

covert lagoon
#

Is experimental Entities 1.0 only for Unity 2022? Should I still use Entities 0.51 and Unity 2021 LTS to make a full game?

rotund token
#

1.0 will only work in 2022.2b8+

#

do not expect it to be backported

#

full release should come with support for 2022.3 LTS

#

so it depends entirely on your timescale

#

if you aren't aiming for a release for say 2 years the you should definitely use 1.0

#

but if you were looking at a release in next 6-12months then i would definitely consider staying on 2021/0.51

wicked trout
covert lagoon
#

I would be making the game from around this December to June 2023.

wicked trout
#

To use it Right Click your project > Create Build Configuration

#

And then configure the same way I did

gentle gyro
rustic rain
#

oh god, I'm getting so done with all these bugs ๐Ÿ˜ฅ

#
                    var planet = buf.Instantiate(planetSetting.planet);
                    buf.AddComponent(planet, new Parent { Value = e });
                    buf.SetComponent(planet,
                        new Translation { Value = new float3(planetSetting.distanceToStar, 0f, 0f) });

this causes error in baking resulting in errors spammed until editor restart

covert lagoon
#

How stable is Entities 0.51.x at this point?

gentle gyro
wicked trout
#

Alright ๐Ÿ‘Œ

rustic rain
gentle gyro
rustic rain
#

too many changes compared to 1.0

#

so

#

I wouldn't start project on 0.51

#

unless you are ready to fix entities package yourself

covert lagoon
#

I doubt stable 1.0 will release early next year though.

frosty siren
#

is there a simple way to calculate chunk capacity in query?

rustic rain
frosty siren
frosty siren
#

like currently possible count of entities

#

how much space i have for entities with current set of chunks

rustic rain
#

all chunks * capacity of archetype

frosty siren
#

yes, but query can include various archetypes

rustic rain
#

get chunks for your query

#

and just calculate it one by one

frosty siren
#

yes, so how to do it quickly?๐Ÿ˜

rustic rain
frosty siren
#

i guess in 1.0, when all chunks have 128 entities (or somewhat) i can just multiply chuck count to 128 without checking it's capacity, but maybe in some future updates some chunks can again exceed 128 capacity, because they will have no switch state components

rustic rain
#

128 is a cap

#

it can be lower

frosty siren
#

oh, yes, lol, stupid mistake ๐Ÿ™‚

#

i remember there was some unity's example of custom native container which was a simple parallel sum writer, so i can try to implement parallel sum container for such purposes.

#

what i'm trying to achieve is:
i have some number wich is current count of entities. and i want to detect new chunks and resize current count to chunks summary capacity

rustic rain
#

๐Ÿค”

#

why?

#

changing count of entities would be removing/adding

#

and I doubt you want to fill unwanted archetypes

frosty siren
#

like if there is some count exceed, i want to detect what chunk it was and expand compute buffer to it's cap

rustic rain
frosty siren
rustic rain
frosty siren
#

maybe i'm over complicating, so i can just have const step

rustic rain
#

if (bufSize < entCount) { bufSize = entCount;}

frosty siren
rustic rain
#

this way at some point you'll reach some highest value

#

and buffer will be fixed size for a while

frosty siren
deft pilot
#

hmm

rustic rain
frosty siren
#

like spawning some units in strategy game without killing old ones

rustic rain
#

well then, you're gonna run out of memory anyway soon, so does it matter? ๐Ÿ˜…

deft pilot
#

good luck reaching entity limit

frosty siren
#

theoretically if your entity has lots of components with lots of data you can reach your memory limit

deft pilot
#

of course

frosty siren
#

but still spawning one entity in frame will take so much time to reach any limit

deft pilot
#

but chances of that is pretty low

rotund token
#

I struggle to handle 100m entities on 32gb ram in editor

deft pilot
#

i should try that for fun

#

did you just spawn 100m entities?

#

or did they also have components

rotund token
#

50:50 crash

rotund token
deft pilot
#

ahh

#

fully rendered as well?

rotund token
#

No they aren't renderable entities

deft pilot
#

ahh okay

rotund token
#

I was stress testing my effect and condition system

deft pilot
#

lets see...

rotund token
#

Technically 110m entities

deft pilot
#

whats the max size tilemaps handles

rotund token
#

10m being targeted by 100m effects

deft pilot
#

welp

#

nativearray has a max length

#

it looks like

#

doesn't like 50,000 * 50,000 length

rustic rain
deft pilot
#

ahh its int.maxvalue sure

#

that makes sense

#

welp that was easy

#

is the editor window only 32bit?

#

(aka does it only allocate 4gb of ram)

#

oh shit nvm

rotund token
#

Haha yeah nah unity editor only using 4gb of memory is a really good day

deft pilot
#

this thing doesn't free resources

#

wtf

#

anyway to flush unity cache or something

dense storm
#

How to fix this? structs cannot be passed to or returned from external functions in burst. To fix this issue, use a reference or pointer.
Trying to create extensions.

#
    public static class Float2Extensions
    {
        [BurstCompile]
        public static float3 ToFloat3XY(this float2 position)
        {
            return new float3(position.x, 0, position.y);
        }

        public static float2 MoveTowards(float2 current, float2 target, float maxDistanceDelta)
        {
            return current + MoveTowardsDelta(current, target, maxDistanceDelta) ;
        }

        public static float2 MoveTowardsDelta(float2 current, float2 target, float maxDistanceDelta)
        {
            float2 toVector = target - current;

            float sqDist = toVector.x * toVector.x + toVector.y * toVector.y;

            if (sqDist == 0 || (maxDistanceDelta >= 0 && sqDist <= maxDistanceDelta * maxDistanceDelta))
                return target;

            float dist = math.sqrt(sqDist);

            return new float2(toVector.x / dist * maxDistanceDelta,
                toVector.y / dist * maxDistanceDelta);
        }
    }
#

Why these can't be burst compiled?

#

Nvm I found out they will be bursted if the calling method is burst compiled.

rustic rain
#

for every parameter

#

burst only works with pointers

dense storm
spice vale
#

Anyone know how we access the destination world in baking systems?

rustic rain
#

property

spice vale
#

doesn't seem like it

#

my entity index/version is different between baking system and runtime system

dense storm
rustic rain
spice vale
#

If you want to burst compile static methods you can't have a return I think. All arguments must be either ref, out or pointer.

spice vale
#

didn't work for me last time I tried, but maybe they changed it idk.

rustic rain
#

actually

#

not sure

dense storm
#

Extension methods usually are a lot of operations right

#

I'll do some more research and see if someone alrd encountered it

rustic rain
#

you don't need to compile such methods specifically

#

just call them from jobs

#

or burst compiled code

#

they will be compiled authomatically

#

you attach compile attribute on methods only if you want to call Bursted method directly in your code

dense storm
brave field
#

๐Ÿฅฒ windows il2cpp build still not working properly yet but seems like it's better now at unity 2022.2b11

rustic rain
#
[Worker0] ArgumentException: DestroyEntity(EntityQuery query) is destroying entity Entity(64:1) 'Pluto' which contains a LinkedEntityGroup and the entity Entity(64:1) 'Pluto' in that group is not included in the query. If you want to destroy entities using a query all linked entities must be contained in the query..
Unity.Entities.EntityComponentStore.ThrowDestroyEntityErrorFancy (Unity.Entities.Entity errorEntity, Unity.Entities.Entity errorReferencedEntity) (at Library/PackageCache/com.unity.entities@1.0.0-exp.8/Unity.Entities/EntityComponentStoreDebug.cs:592)
Unity.Entities.EntityComponentStore.ThrowDestroyEntityError (Unity.Entities.Entity errorEntity, Unity.Entities.Entity errorReferencedEntity) (at Library/PackageCache/com.unity.entities@1.0.0-exp.8/Unity.Entities/EntityComponentStoreDebug.cs:582)
Unity.Entities.EntityDataAccess.DestroyEntitiesInChunksDuringStructuralChange (Unity.Entities.EntityQueryImpl* queryImpl, Unity.Entities.SystemHandle& originSystem) (at Library/PackageCache/com.unity.entities@1.0.0-exp.8/Unity.Entities/EntityDataAccess.cs:596)
Unity.Entities.EntityManager.DestroyEntitiesInChunks (Unity.Entities.EntityQueryImpl* queryImpl) (at Library/PackageCache/com.unity.entities@1.0.0-exp.8/Unity.Entities/EntityManager.cs:4763)
Unity.Entities.EntityManager.DestroyEntity (Unity.Entities.EntityQuery entityQuery) (at Library/PackageCache/com.unity.entities@1.0.0-exp.8/Unity.Entities/EntityManager.cs:3338)
Unity.Entities.RemoveEntityInBakeDestroyEntitiesSystem.OnUpdate () (at Library/PackageCache/com.unity.entities@1.0.0-exp.8/Unity.Entities.Hybrid/Baking/RemoveEntityInBakeDestroyEntitiesSystem.cs:21)
solemn hollow
#

i wasnt aware of this behaviour 0.o is this new?

rustic rain
#

idk what's up with it

#

but it's super annoying

#

and I don't know how to deal with it

#

looks like

#

I can't instantiate anything

#

which sucks

solemn hollow
#

baking only allows to instantiate additional entities right? not entities spawned from a prefab

rustic rain
#

yeah

#

thing is

solemn hollow
#

is that true even for baking systems?

rustic rain
#

ah nvm

#

yeah, everything I create in baking

#

is casuing this erorr

solemn hollow
#

well you could let the linked entities match the query in RemoveEntityInBakeDestroyEntitiesSystem

#

@rustic rain instantiating gameobjects inside bakers to then let their bakers run doesnt work right?

solemn hollow
#

you'd need a prebaking step ๐Ÿ™‚

deft pilot
#

anyway from the editor to tell how many entities exist?

#

(also can you custom name your entities)

rustic rain
brave field
#

๐Ÿฅฒ omg. This baker behavior differently

muted star
#

Hi, is there a way to check if burst is enabled in code?

rustic rain
#

and use [BurstDiscard] method

#

to change it's value

#

if changed - no burst, if not changed - burst

muted star
#

cool, I'll give it a try ๐Ÿ‘

gray nest
#

Hey guys, what's the proper way of loading/reloading a hybrid ECS level? I run into errors no matter what I try, here's the closest I've gotten:

   SceneSystem m_SceneSystem = World.DefaultGameObjectInjectionWorld.GetExistingSystem<SceneSystem>();
   manager.DestroyEntity(manager.UniversalQuery);  
   manager.CompleteAllJobs();
   SceneManager.LoadScene(0);
   m_SceneSystem.LoadSceneAsync(m_SceneSystem.GetSceneGUID("Assets/Scenes/World1.unity"));```
I get this error:
solemn hollow
brave field
#

๐Ÿฅฒ

Unity.Entities.IBaker.CheckValidAdditionalEntity (Unity.Entities.Entity entity) (at Library/PackageCache/com.unity.entities@1.0.0-exp.8/Unity.Entities.Hybrid/Baking/Baker.cs:1383)
Unity.Entities.IBaker.AddComponent[T] (Unity.Entities.Entity entity, T& component) (at Library/PackageCache/com.unity.entities@1.0.0-exp.8/Unity.Entities.Hybrid/Baking/Baker.cs:1556)```
solemn hollow
brave field
solemn hollow
#

I feel you. Took 4 days to just get to the point where i could press play again. Now i have to rewrite some systems to match the baker workflow too.

rustic rain
#

Where unity devs when you need? ๐Ÿ˜…

urban ore
#

So I've been reading over the new DOTS guide, and reading through the ECS tutorial, and I've noticed that it doesn't ever actually use state.Dependency when scheduling jobs. My impression (from reading the documentation it's made quite clear) is that you should always use/set state.Dependency whenever you schedule a job in a system. Is this excluded in the tutorial just because their jobs don't happen to overlap? Is it still the best practice to use/set state.Dependency anyways?
https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/master/DOTS_Guide/ecs_tutorial/README.md

GitHub

Contribute to Unity-Technologies/EntityComponentSystemSamples development by creating an account on GitHub.

proud jackal
#

You should always pass in state.Dependency for jobs, HOWEVER. IJobEntity has automatic implicit dependencies (as the exception). So when you pass your own JobHandle into an IJobEntity you'll take control, however if you don't pass in a jobhandle, it will complete the dependency for you, so:

new MyJobEntity().Schedule();
// is equal to:
state.Dependency = new MyJobEntity().Schedule(state.Dependency);

// but this is not equal, and since you passed a jobHandle yourself, you have to set state.Dependency yourself:
new MyJobEntity().Schedule(state.Dependency);
urban ore
#

Huh, okay! The other page on SystemState.Dependency (https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/master/DOTS_Guide/intro/intro-entities.md) doesn't mention that, and I don't see any other docs on that, but maybe that's excessive information for that section. I know it's all WIP. But that's really good to know - thanks!

GitHub

Contribute to Unity-Technologies/EntityComponentSystemSamples development by creating an account on GitHub.

#

I think what's really confused me is that many of the examples I've seen online just kinda do it anyways.

proud jackal
#

No worries! I'll take that into account for the IJobEntity docs, thx for the feedback! ๐Ÿ˜„

urban ore
#

I suppose maybe that's what the (directly or indirectly) bit means, and I just wasn't aware of the indirectly bit!

proud jackal
#

Potentially ๐Ÿ˜†

rustic rain
#

What would be the intended way to instantiate additional GameObject (or entities) during baking?

#

let's say I want to have one MonoB with fields for prefabs and then spawn them through code during Baking. Is there even a possibility to do that atm?

brave field
rustic rain
brave field
#

I guess it's different. What I want is able to add component to child entity at baker

rustic rain
#

oh, little confused

brave field
#

Now with baker it's not possible anymore

rustic rain
brave field
#

๐Ÿฅฒ

proud jackal
#

Well, baking can't spawn GOs, as SubScenes can't contain GOs, but you can have baking create the runtime rdy format to spawn them as soon as the scenes load think

class MyAuthor : MonoBehavoiur {
  public GameObject[] prefabsToSpawn;
  class PrefabsToSpawn : IComponentData {
    public GameObject[] prefabsToSpawn;
  }
  class Baker : Baker<MyAuthor> {
    protected override Bake(MyAuthor myAuthor){
      foreach (var go in myAuthor.prefabsToSpawn)
        DependsOn(go);
      AddComponentObject(myAuthor.prefabsToSpawn);
    }
  }
}

partial struct MySystem : ISystem {
  //..
  public void OnCreate(ref SystemState state) => RequireForUpdate<PrefabsToSpawn>();

  public void OnStartRunning(ref SystemState state){
    Object.Instantiate(state.EntityManager.GetComponentObject<PrefabsToSpawn>(SystemAPI.GetSingletonEntity<PrefabsToSpawn>()))
  }
  public void OnStopRunning(ref SystemState state){
    Object.Destroy(state.EntityManager.GetComponentObject<PrefabsToSpawn>(SystemAPI.GetSingletonEntity<PrefabsToSpawn>()))
  }
}

I think will do the trick

rustic rain
#

bakers are run in parallel and meant to only add data or temporary data to main or secondary entities

rustic rain
#

I suspected that this is the only way rn

#

but I didn't want to accept it ๐Ÿ˜…

#

btw

#

is there any baking specific components rn

#

so for example

#

I create additional entities

#

in Baker

#

and then I just copy archetype and all component/sharedComp data from prefab entity to that additional entity

proud jackal
#

Do pls write you message in one message haha ๐Ÿ˜†

rustic rain
#

can it break anything?

proud jackal
#

I mean that sounds right but I wouldn't be the person to go to there, depends on the behavoiur you want? think

rustic rain
#

question is:
there used to be conversion specific components that were removed after conversion and they also used to be entity specific.

So is there anything like that in Baking so that maybe I should avoid it for certain Component Types?

proud jackal
#

When baking happens there can be baking comps, if you were to copy an entity's data from one to the next inside a baking system, then both entities will now contain the same comps including baking comps, and any subsequent baking systems dependending on those comps will take affect run their baking stuff, just like how it works in runtime. This said, the baking comps won't be there if you were to copy in normal runtime, as baking comps are only present in baking systems.

The baking comps (components not serialized) are marked by [BakingType] and [TemporaryBakingType]. If I were you I would just search for those and see which comps use them.

rustic rain
#

I'm talking about internal comp types

#

which currently we can only find out by debugging baking execution

drowsy pagoda
#

When detecting when an entity is instantiated within a system, is CleanupComponent the way to go? I understand how to use it for detecting destruction, but creation, I just do With<SomeData> and None<Cleanup> ? Is that the new convention now?

spice vale
solemn hollow
#

if you dont have to cleanup i guess you could just use a normal IComponent to mark it

drowsy pagoda
solemn hollow
#

you need to be aware that you specifically HAVE to cleanup the component then when you destroy the entity.

drowsy pagoda
#

Yeah I'm aware ๐Ÿ˜‰

#

Just like the good ol'IStateComponent ๐Ÿ˜‰

#

RIP

urban ore
#

As a somewhat more complex extension of my previous dependency question - The automatic (implicit) dependency system seems to automatically operate on entities/components and figures out the right depedency chaining. Is there any way to build on top of this automatic system? Is it attribute based? Or completely internal to components?

In my case, I'm basically trying to pass a few NativeQueues to a number of systems that spin off jobs, and I want those jobs to complete prior to the job that processes the queues. I can certainly handle this explicitly (seems like Tertle's event system takes this approach?), but I'm just wondering if there's any way to be implicit about it to avoid the duplicate code?

solemn hollow
#

that basically works automatically. just order the systems with the [UpdateAfter/Before] attributes

spice vale
urban ore
#

My impression is that that doesn't imply job ordering in the way I'd want it to?

#

That is, the UpdateBefore/UpdateAfter attributes.

spice vale
#

UpdateBefore/UpdateAfter is just the order the systems update, it doesn't affect the dependency directly

urban ore
#

Right.

#

So, I did consider using a component as a placeholder. My concern is how that would order the using systems. If they're all on one component, and I want (A,B,C) as generators with (D) as a consumer, then you'd end up with an A -> B -> C -> D dependency chain or something like that.

solemn hollow
#

im pretty sure it does. one systems dependencies are resolved before other System that is depending on it runs. Dependency = new job.Schedule(Dependency) basically tells the next systems to wait for this Systems Dependency

urban ore
#

So you'd have to create a separate component per-queue to get the chaining right. Which... works. But honestly isn't much better (or maybe worse) than the explicit dependency management approach. Maybe it would look nicer.

spice vale
rocky dove
#

Dumb question, can ECS systems be run in Edit mode? ie non-playmode? I saw there is a WorldFilterFlags.Editor

spice vale
#

If system A reads and writes Comp1 and system B reads/writes Comp2 and they update after eachother, then their jobs will run in parallel.

solemn hollow
rocky dove
#

Thank you

urban ore
#

So, maybe to get back to my initial question - is it possible to tie into the automatic/implicit dependency system at a deeper level? Or is that automatic/implicit system strictly for IComponentData?

spice vale
urban ore
#

Well, I'd generally say that I'm okay with type-based granularity. My queues do have types, after all. But they're not IComponentData types.

urban ore
#

I suppose that's not really true. What I'm really trying to avoid is the "this.Dependency bookending" in every Update method that something like Tertle's event system seems to require:

        protected override void OnUpdate()
        {
            this.Dependency = this.eventSystem.GetEventReaders<TestEventEmpty>(this.Dependency, out var readers);
            ...
            this.eventSystem.AddJobHandleForConsumer<TestEventEmpty>(this.Dependency);
        }

But the automatic/implicit system that exists for entities isn't really a bookending system. The dependency property for entities is generated each time from the dependent data. I'd prefer that approach. But I'm pretty sure it's entirely internal and can't be tied into.

urban ore
#

How?

rotund token
#

Same way command buffer systems don't need it anymore

rustic rain
#

you access singleton

#

which is dependency

#

for the system you access

urban ore
#

Or am I just totally misunderstanding how it works. Probably just misunderstanding.

rotund token
#

It won't be a single singleton, each event type will have its own

urban ore
#

Yeah, okay. That's what we were discussing up above. My main concern was that I wasn't sure how the boilerplate would look, and if it would be much better. Do you know of any examples of it?

My other concern was that you'd still end up dependency chaining if there were multiple systems that could trigger the same event type, I think.

rotund token
#

There's no chain of access via read only singleton

urban ore
#

I'm just misunderstanding, then. I'll look more into the ECB singleton implementation. Thanks a lot!

rustic rain
solemn hollow
#

where can i enable live conversion? i want to see the result of baking

viral sonnet
viral sonnet
viral sonnet
urban ore
#

Yep, that definitely makes sense. But the Entities package also includes its own dependency system for helping get your job system dependencies right. That Entities dependency system is based purely off of components. If I have a custom thing that I need to make sure gets dependency chained (like a queue), the only way to do that automatically is through components. I think Tertle's suggestion is the only possible one - just wrap whatever that data is in an entity and then let the entities dependency system sort it out.

robust scaffold
rustic rain
#

from what I understand:

  1. GetSingleton writes to Dependency
  2. Dependency is written into job's JobHandle
#

then if next system does same GetSingleton, it's RO == no completing previous job

viral sonnet
#

jobhandles and dependencies are from the job system. you can declare a chain of dependencies just as easy with native containers

rustic rain
#

meanwhile as soon as some system does GetSingleton RW - sync point, chain completes

#

I'm just trying to understand how it works, so I can implement similiar feature

viral sonnet
#

so what works is declaring GetSingletonRW in oncreate and then just use GetSingleton in onupdate. the job system figures it out

rustic rain
urban ore
# viral sonnet jobhandles and dependencies are from the job system. you can declare a chain of ...

Well, the base concept of job handles and dependencies are from the job system. The entities system then seems to add an additional automatic-dependency-management layer on top of that that's based on entities. And only on entities. I was wondering if you can get the automatic-dependency-management layer from the Entities package to react to something other than entities. I'm pretty sure you cannot.

solemn hollow
#

WTF happened to physics? Before with 0.51 i had 80 fps. now im down to 8 and im not even running my heavy logic... physics takes 80ms

viral sonnet
#

though the sync point can be circumvented when declaring GetSingletonRW in OnCreate
as you said, calling GetSingletonRW in OnUpdate calls .Complete on the jobs. it has that built in to resolve dependent jobs. doing it as i mentioned will leave it to the job system dependency and the job will get scheduled (with no .complete) and just runs after the system jobs that have RW depdency.

viral sonnet
viral sonnet
robust scaffold
viral sonnet
#

also, afaik leak detection is enabled by default to full trace. all in preferences now

robust scaffold
solemn hollow
#

ah damn its in a jobs tab

urban ore
robust scaffold
solemn hollow
#

so allocs are not the reason

#

NarrowPhase is just extremely slow. but i wonder why. there shouldnt be alot of collisions happening.

robust scaffold
drowsy pagoda
#

Should I use BoxOverlap over BoxCast where I can? I assume overlap is cheaper or no?

solemn hollow
#

hmm i give up for today... for me CreateContactsJob somehow is 500x slower in 1.0.

remote crater
#

Is there a quick way to replace a Mesh/PhysicsShape/Physics Collider on an entity?

solemn hollow
#

i got the same amount of colliders in the scene and they are all correctly disabled as far as i can tell

viral sonnet
remote crater
#

๐Ÿ“Œ Download the full project files: https://www.tmg.dev/MaterialOverrides ๐Ÿ“Œ
๐Ÿ‘จโ€๐Ÿ’ป Code/Scripts from this video: https://www.tmg.dev/MaterialOverrides-Code ๐Ÿ‘จโ€๐Ÿ’ป
๐Ÿ’ฌ Come chat with other DOTS/ECS devs: https://tmg.dev/Discord ๐Ÿ’ฌ

๐Ÿšง Resources Mentioned ๐Ÿšง

Using Random in Unity ECS: https://youtu.be/s-nr9EMmhfo

๐Ÿ’ป My Game Development Setup: https://tmg.dev...

โ–ถ Play video
solemn hollow
#

i do spawn ProtoTypeAbilities on a far off location. they are excluded from physics. when i instantiate copies of them i enable the physics

viral sonnet
#

so first thing I'd say is that all disabled physics entities are actually calculated. best explanation why the job takes so long now

#

maybe test the query of the job

solemn hollow
#

but under relationships the physicssystem is not listed

#

no query hits them

remote crater
#

Sorry, I have this fielded.

rustic rain
#

to modify meshes you need Mesh advanced API

remote crater
#

I actually just spawn gameobjects, change mesh and let it roll, it's not that big of hit ATM

#

I'll look into Mesh advanced API tho

#

Its good to become cultured! Thank you man of culture, Issue bro.

rustic rain
remote crater
#

Looks like what I did was had a special case to not access my Entity datapool

#

It returns a handle to the gameObject instantiated before it was converted

#

Then surgeries the Mesh etc etc

solemn hollow
#

the mainability got both disable and physicsexclude. Subabilities only got the physicsExclude component because they still have to run in some systems. now all those subabilities are colliding like crazy

robust scaffold
#

I can see why Unity placed a 128 entity max cap, I add DOTS physics to an entity and the cap falls to 32 per chunk:

#

They throw bytes at components like it's free.

solemn hollow
#

i dont want to talk about my chunk utilisation... at some point i had it down to 2 entities per chunk.

#

how do i best get the physicsworldindex?

robust scaffold
solemn hollow
#

sry i meant the uint i need to put in there.

robust scaffold
solemn hollow
#
                {
                    Value =  ???
                });```
#

i mean where do i get the index from the physicsworld to enable physics on an entity that had physicsworldindex component removed at some point

rustic rain
#

unless you setup multiple physics worlds per Entity World

#

it'll be just 0

robust scaffold
#

I think values other than 0 are used for smoothing and alternate worlds

solemn hollow
#

ah so more a netcode thing

rustic rain
#

no

#

they are used to different simulations

#

you can have as many physics worlds as you want

#

or maybe yes, maybe that's what is required for smoothing

#

kek

viral sonnet
#

16!

rustic rain
#

what the

viral sonnet
#

12 bytes per element. ridiculous

rustic rain
#

what is even purpose of this, lol

viral sonnet
#

if you use 208 reserved bytes per entity you have a DAMN good reason

#

so i hope you don't have 1 entity pair with 1 collider ๐Ÿคฃ

robust scaffold
viral sonnet
#

what's the cap if you add a LEG too?

robust scaffold
viral sonnet
#

math says 25 haha

robust scaffold
#

I added a child game object and then disabled them both. Didnt show up

viral sonnet
#

there's a LEG authoring mb

robust scaffold
viral sonnet
#

i mean, this problem here is salvageable very easily. the cap puts a bit of a damper into it but i'm often coming back to the idea of parallel chunks. (as unity isn't keen on making chunks bigger or modular) anything physics or transform related has huge data implications but often isn't accessed that frequently or none at all from game mechanics. however, moving them to a seperate entity would require random acess and i have tried it more than enough times with different methods, it's a hassle and slows everything down with the amount of random access required. if you would have a parallel chunk the you could directly access this would be much faster, i just haven't found a good way to do this yet.

robust scaffold
viral sonnet
#

I'll take a look at it. seems interesting

robust scaffold
#

Wait no, it's for physics shape authoring. Primarily the compound mesh authoring

#
  • A new CompoundCollider.Child.Entity field is automatically populated through the conversion system, to point at the converted Entity associated with the GameObject that contacted the PhysicsShapeAuthoring component.
    * This default setting can be overriden by adding a PhysicsRenderEntity component data. The common use case for this is where no MeshRenderer component is on the converted child Entity, and it is desirable to redirect to another Entity with a graphical representation in a different branch of the hierarchy.
    • Added a PhysicsRenderEntity component data. This is primarily used for populating a CompoundCollider.Child.Entity field where there was no graphical representation on the same GameObject that has a PhysicsShapeAuthoring component.
viral sonnet
#

anyway, if you go below 32 entities per chunk the job overhead really eats into it

#

mainly the small iteration count and GetNativeArray

robust scaffold
viral sonnet
#

yeah not much you can do other than editing the physics package and lower the buffer capacity

robust scaffold
#

Im sure if I spend several hours / days / weeks slowly combing over the physics package manually and instituting 2D components, I can half the component byte utilization.

#

But for now, I just want things to work. Optimization hopefully whenever 1.0 enters pre-release in december

viral sonnet
#

unity should do the same thing that I did and make a config struct that has constants to define the InternalBufferCapacity. hardcoding this is just bad practice

brave field
#

Is that possible to create child entity and add component to child entity at custom baking system?

viral sonnet
#

yes, it's even possible in a baker

brave field
#

I mean custom baking system using [WorldSystemFilter(WorldSystemFilterFlags.BakingSystem)]. Not Baker<xxx>

viral sonnet
#

yeah you're right. not working for me either. it does work though in a Baker

#

very odd, baking systems should have all the same freedom. did anyone have a baking system that can successfully create entities or childs?

solemn hollow
solemn hollow
#

Docs say :
"Baking systems are updated on every single Baking pass."

does that mean all entities are getting rebaked every time? or is there some mechanism to ensure that only entities that had their data changed are present in the baking world?

solemn hollow
#

Oh man i just found out the baker keeps its internal state even between entering and exiting playmode. I somehow assumed each bake would have its own baker instance. instead they all share the same baker.

rustic rain
#

to track changes

#

for live conversion

solemn hollow
#

i used state inside the baker to aggregate a list of distinct components to add to avoid the error of adding the same component multiple times from one baker.
This list of components is different for each entity i bake.
So imagine my surprise when all entities came out the same way except for some of the early baked ones ^^

frosty siren
#

what Chunk.DidOrderChange do?

#

docs says: Reports whether a structural change has occured in this chunk since the specified version.

#

does it mean Creating/Destroying/Moving entities?

viral sonnet
#

yes

frosty siren
#

and no matter what happened with values

viral sonnet
#

yep

frosty siren
#

looks handy

#

by the way is there a way to check DidChange for chunk components?

rustic rain
#

if there is version checking for it

#

it will write to it

#

during RW operation

frosty siren
#

@viral sonnet i remember some time ago you were linking guide about creating custom parallel native container on an example of parallel sum. Do you have a link, i'm struggling to find it through google

viral sonnet
#

ah yeah that's it. the safety implementation is outdated though.

spice vale
#

is class based IBufferElementData possible?

rustic rain
spice vale
#

just wondering

#

I bet the baking won't track changes in a list but might do it for Dynamic buffers

rustic rain
#

there's a semi unmanaged solution to this

#

store index to some collection instead

spice vale
#

There are so many pitfalls with baking I feel like, what works what doesn't? Apparently "AddComponent" in a baker doesn't add the component if it was removed during runtime.

rustic rain
#

are you talking about live baking?

spice vale
#

yes

#

I just want my runtime system to rerun once the baker runs, but it seems impossible.

#

the component is never added, so my runtime system doesn't run again.

rustic rain
#

you mean you add comp in baker which gets removed in runtime, and then component is not readded if you modify it?

spice vale
#

yes

#

baker runs, but no comp added

rustic rain
#

try add DependOn

#

if you haven't yet

spice vale
#

DependOn what?

rustic rain
#

it's a method

#

in baker

#

according to manual

#

it's a way to track changes

spice vale
#

yes ik, but what should it depend on

#

The issue is not making the baker run, the issue is the comp is not added.

#

even though the method is named "AddComponent"

rustic rain
#

does your baker even run then?

#

with changes

#

have you checked?

spice vale
#

yes

#

I debug.log in Bake

rustic rain
#

๐Ÿค”

spice vale
#

I think they assume something like: "Oh this comp is not present on the target anymore, I bet he doesn't want to add it anymore, lets skip it"

frosty siren
#

all works though

solemn hollow
spice vale
#

inside baking system the component is indeed added, but that change is not propagated to the runtime world.

#

And as far as I can tell there is no direct way of accessing the runtime world from the baking system.

solemn hollow
#

and you did use Entitmanager.AddComponent in baking system?

spice vale
#

yes tried that too.

solemn hollow
#

oof thats good to know. ill run into those problems too for sure

spice vale
#

What I'm resorting to now is to never remove the component during runtime, and poll for changes instead. Sucks we cannot take advantage of structural filtering here.

rustic rain
#

๐Ÿค”

rustic rain
#

for a quick fix

spice vale
#

I do, but I still have to poll since change filter gives false positives.

#

Random thought: now that we have enabled components, I wonder if it would be feasible to do change filter per entity with same bitmask logic.

whole gyro
# spice vale Random thought: now that we have enabled components, I wonder if it would be fea...

Do you mean enabling a component temporarily every time you modify a component?

I suppose you could create an aspect that hides the enabled component as an implementation detail:

[Serializable]
public struct MyData : IComponentData
{
    public float3 Value;
}

[Serializable]
public struct Changed : IComponentData, IEnableableComponent { }

readonly partial struct MyDataAspect : IAspect
{
    private readonly RefRW<MyData> _myData;
    private readonly EnabledRefRW<Changed> _changed;

    public MyData MyData
    {
        get => _myData.ValueRO;
        set
        {
            _myData.ValueRW = value;
            _changed.ValueRW = true;
        }
    }

    public bool DidChange
    {
        get => _changed.ValueRO;
    }
}

Then you could have a separate system that disables the changed component at the end of the frame. You could even query for changed components by including the Changed comp in the query.

spice vale
#

Actually do we even need the tag? can't we reuse the component for enabling?

whole gyro
urban ore
#

So here's an odd collections question - Many of the native collections use [NativeSetThreadIndex] and m_ThreadIndex to have things write into different buffers. From a bit of testing and searching online, this value is 1-indexed. That is, I get 1-32 for my 16c/32t. That's great, presuming 0 is for the main thread, and the collections seem to operate under that assumption. But I've noticed that most of the allocations made in the native collections use JobsUtility.MaxJobThreadCount (=128) when allocating. Doesn't that leave the collection logically 1 entry short? Or are there actually only 127 jobs allowed? Or can index 0 actually be used by a jobs thread in some scenario?

whole gyro
#

It also depends on how you want your queries to work. If you combine MyData and Changed into a single component, normal queries for the data won't return unchanged entities. You would have to remember to use the IgnoreEnabledBits option in your query.

#

By separating them into two components. Systems that don't care about changed bits can just query for MyData. And those that do can query for MyData AND Changed. So for a more flexible and less error-prone workflow, I would keep them separated. But it really depends on the use case I think.

spice vale
#

true

spice vale
urban ore
#

I did find a unit test somewhere that ranges to MaxJobThreadCount-1, so I guess that must be it!

gusty comet
#

Is one usecase for sharedcomponentdata to make ComponentLookup less likely to experience cache missed? I have a StatComponent that may have tens of thousands of entities with it, and many systems like StatAdd, StatSubtract, etc. each one of these โ€œoperation systemsโ€ always reference three entities - A, B, and Output, and itโ€™s highly likely that those 3 entities will only ever be used by one of StatAdd, StatSubtract, etc. so if I attach a sharedcomponentdata called UsedByStatAdd, then all StatComponents that will be used by StatAdd will be grouped together. That way when the StatAdd job executes and uses the ComponentLookup for StatComponent, the relevant statcomponents will be highly likely to be grouped together in the same chunk

whole gyro
gusty comet
#

The Stat entities have just StatComponent

#

The Operation entities have 3 component, each one just having one field referencing a Stat entity

#

The Opertaion job will do a component lookup and write to the 2 input Stats and 1 output Stat, respectively

#

I know it sounds convoluted/overkill, but Iโ€™m only interested in if sharedcomponentdata couldโ€™ve used to group entities together in a cache friendly way

whole gyro
#

I'm not sure if there is any value in using an empty shared component over simply using a tag component

gusty comet
#

Oh no, Iโ€™ll assign the sharedcomponent a single integer

#

1 means used by adder, 2 means used by subtractor

#

This can be extended further if needed

whole gyro
#

I honestly have never had to use shared components, but I'm pretty sure different shared component values (yes even just changing the integer inside) will mean different chunks.

#

So it effectively is the same as a tag in that each chunk will only have the entities with that specific shared comp value

gusty comet
#

Yes, I want that to happen to group all Adder-used Stats into one chunk, and all Scaler-used Stats into another

whole gyro
#

So why not use a UsedByAdd tag? Just seems simpler than a shared comp

gusty comet
#

Right, but I want a generalized way of doing this for my use case. Youโ€™re right about the component tags, but Iโ€™d have to create a new one for each partition. With a SharedComponentData I just inject an integer

#

Again, thereโ€™s not just Stat, but also DecisionMaker and a bunch of others that could benefit from this

#

So a single UsedBy shared component to be useful across different domains

viral sonnet
whole gyro
whole gyro
# viral sonnet that's nice but honestly changes very little. a chunk can be skipped with change...

You only have to iterate over the enabled bits in IJobChunk. Maybe I'm a minority but I mostly use IJobEntity which does that all automagically (actually I mostly use Entities.ForEach in SystemBase but I'm slowly migrating). I know enabled comps are basically equivalent to a bool comp, but being able to write the code as if its a tag component without paying the cost of a structural change is really nice imo

rustic rain
robust scaffold
whole gyro
# rustic rain I don't quite get what it does

In writing systems, you use the MyDataAspect to write changes. Internally, this also enables the Changed comp on the entity. Then in reading systems, you can query for changed values by querying for MyData and Changed. Or if you don't care about changes, you can just query for MyData.

So its just a nice way to do change filtering per-entity without any false positives.

rustic rain
#

๐Ÿค”

whole gyro
#

Here is some sample usage code using the idiomatic foreach.

// Write new values:
foreach (MyDataAspect dataAspect in SystemAPI.Query<MyDataAspect>())
{
    dataAspect.MyData = new MyData { Value = float3.zero };
}

// Iterate only changed values
foreach (MyDataAspect dataAspect in SystemAPI.Query<MyDataAspect>().WithAll<Changed>())
{
    // ...
}

// Iterate only unchanged values
foreach (MyDataAspect dataAspect in SystemAPI.Query<MyDataAspect>().WithNone<Changed>())
{
    // ...
}

// Iterate all values
foreach (MyDataAspect dataAspect in SystemAPI.Query<MyDataAspect>()
        .WithEntityQueryOptions(EntityQueryOptions.IgnoreComponentEnabledState))
{
    // ...
}
        
// Alternate way to iterate all values.
// By not going through the aspect, we don't have to ignore the disabled Changed
// component since it isn't in the query.
foreach (MyData data in SystemAPI.Query<MyData>())
{
    // ...
}
robust scaffold
#

Is there a way to access aspects in IJC?

ripe parrot
#

At what point does DOTS become a requirement for entities? Could you remake Vampire Survivors without DOTS for example, or would that amount of entities on the screen at once always require it?

robust scaffold
#

It's honestly not that hard either IMO.

#

I just use DOTS because I'm lazy.

ripe parrot
#

I'm not trying to stay away from DOTS, just wondering where the line is drawn between 'I should use DOTS for this' and 'I shouldn't bother'.

#

Unless that line doesn't exist at all ๐Ÿ™‚

rustic rain
robust scaffold
ripe parrot
#

That's what I'm saying with the line maybe not existing.

#

I'm still just looking into it now -- "Why would anyone not use DOTS" sort of tells me what I want to know ;p.

robust scaffold
#

And it's impossible to tell the difference unless you already know what DOTS / ECS coding is and dont need to tutorials.

ripe parrot
#

What are people waiting for? Figured there'd be a bunch of half decent tutorials with how slow the release has rolled out. I thought it's been in the making for quite a while with another update recently(?)

rustic rain
robust scaffold
#

Experimental 1.0 released earlier last month. That's practically yesterday in the world of DOTS release schedule.

rustic rain
#

everything else is already part of Unity in a way

#

several classic components were remade with burst and jobs

viral sonnet
ripe parrot
#

I've seen VS clones without DOTS whatsoever, so I'm quite sure its good enough. I'm quite interested in DOTS though and I hope there's better training infrastructure in the future.

viral sonnet
viral sonnet
naive eagle
#

Hiya. Any tips on how to let a component know of its children? I'm working on a ship multiplayer game and would like to rotate all of its cannons according to user input. The input is in the form of DynamicBuffer<ShipInput> which is placed on the root Ship object.

robust scaffold
robust scaffold
naive eagle
#

That's an idea but that too requires me to be able to differentiate the user's cannons from other users' cannon in order to add that tag, right? I know which root is controlled by the user, but I'd need to know which cannons belong to that root.

robust scaffold
#

Assign each cannon a ISCD with a property index indicating which player that cannon is controlled by. Then use the SCD value within the job to access an array of relevant input controls for that frame to change the direction of the cannon.

naive eagle
#

Okay thanks! I'll look into SharedComponentData

viral sonnet
robust scaffold
viral sonnet
#

that's really simplifying it. the query iterates over fitting archetypes and creates a list of valid chunks. then each chunk is checked for the state. this could be all merged into 1 loop instead without any information lost.

robust scaffold
#
// Pointer to velocity values.
void* vel = chunk.GetRequiredComponentDataPtrRW(ref Velocity);

// Shift pointer to access velocity.linear.z.
float* linear = (float*)vel + 2;

// Mem-copy zero out all Z linear velocities.
UnsafeUtility.MemCpyStride(linear, sizeof(PhysicsVelocity), &zCl,
    0, sizeof(int), chunk.Count);

// Fixed float2 zero value.
float2 xyC = float2.zero;

// Shift pointer to access velocity.angular.
float* angular = (float*)vel + 3;

// Mem-copy zero out all XY angular velocities.
UnsafeUtility.MemCpyStride(angular, sizeof(PhysicsVelocity), &xyC,
    0, sizeof(float2), chunk.Count);``` I am shocked this works.
robust scaffold
rustic rain
#

oh

#

is that system

#

to set 3rd axis to 0?

rustic rain
#

mind sharing whole system?

robust scaffold
#

Im sure if I dug into ToEuler I can optimize constraining rotation to Z axis only but eh.

whole gyro
naive eagle
# robust scaffold Assign each cannon a ISCD with a property index indicating which player that can...

Do you have an idea of how to figure out which player that cannon is controlled by? I did find the Parent component which I could use to traverse the hierarchy but I wonder if there's a better way to set up this relationship.

My first idea was to set it up during baking, but the network id ofc isn't available then yet. Maybe I could pass a reference to the Ship to the Cannons during baking, though ๐Ÿค”

robust scaffold
#

Spawn the player and all entities related to it at bake and on network connect during runtime you spawn the entities related to other players.

#

This is where Subscenes will probably help. Make a generic "player" subscene containing bare minimum entities required to make a player function. Then spawn that repeatedly for every network connection then populate per instance properties and classes later.

remote crater
#

Hey if I wanted to change the Mesh of an Entity, how do I do that? I can't find my question from the other day.

rotund token
#

i believe you're talking 0.51?

remote crater
#

sure

rotund token
#

it's changed a lot in 1.0

remote crater
#

I hear 1.0 isn't working for a lot of people. I'll wait til it works to upgrade.

rotund token
#

just set RenderMesh

remote crater
#

Thank you

rotund token
#

how so?

remote crater
#

Its a conglomerate of information sources I use.

#

Don't worry about it, I judge my upgrade times based on if the steps of upgrading is easy or hard.

#

When they become very hard to upgrade one step,I just park on an old tech and wait til there is a feature I'm missing. A long jump later is shorter than many long jumps before.

rotund token
#

1.0 is a long jump for an existing product

remote crater
#

Its just general software engineer stuff, would have saved about 400 hrs dev time if I just stayed on 2021.5.f1 instead of going 2021.11.f1. upgrading for the sake of upgrading ain't always good

rotund token
#

we won't be upgrading at work

remote crater
rotund token
#

but it is nice to finally be on what should be a reasonably stable api going forward finally

remote crater
rotund token
#

haven't programmed in 6 days

#

time to go see what broken state i left things in =\

remote crater
remote crater
#

If you want to fly, you don't start.

#

If you want to run, you're disappointed if you can't.

#

If you want to walk, that isn't for sure either.

#

Start every session with the mentaily,"Let me grunt pick and shovel this."

#

If you do that, you'll be flying and running more often than you'd think.

#

Tell yourself,"The thing I like doing the most is organizing my design documents."

rotund token
#

design documents? ๐Ÿ˜„

remote crater
#

And you'll stumble over stuff you want to implement.

#

TODO/NOTEs

#

Between starting every day with grunt coder attitude and saying your passtime is organizing todo lists and design docs... You'll get more timeclocked

#

Ok, good talking with you, back to grind, gonna have an AWESOME release this Friday

#

Putting in anime boys

#

who give a MADlib about their backstory noone cares about

#

before they attack

#

randomized madlib anime backstory

#

Should be in within a few hours

#

but need more enemies, random loot boxes dropped and a inventory system of some sort by Fri

robust scaffold
#

Does anyone know the setting to change how unity names duplicated GOs? from (1) to _1 or something?

rustic rain
#

use search by keywords

robust scaffold
rustic rain
rotund token
#

it's under project settings

#

editor

robust scaffold
#

Ah, hrm. Doesnt seem to be working for me? Duplicating a GO inside a subscene doesnt increment the (X).

robust scaffold
#

It does so outside a subscene but not within it. Huh.

viral sonnet
#

damn, i tested LEG and physics keypair with optimized cap bringing the chunk capacity from 17 to 29. my machine has way too many threads to see anything noticeable ... ๐Ÿ˜…

rustic rain
#

without velocity it won't ever change

#

I use Z value for depth

#

same for rotation

robust scaffold
rustic rain
#

I'v been doing same thing

#

without modifying anything but velocity

#

it worked out great, no glitches related to 3rd axis at all

#

your approach is just way faster it seems ๐Ÿ˜…

robust scaffold
#

I've been chucking it against spheres and other objects. Just enforcing 2D on PhysicsVelocity seems to work okay.

viral sonnet
rustic rain
robust scaffold
rustic rain
#

can also reduce 5 lines

#

by using SystemAPI.QueryBuilder

robust scaffold
rustic rain
#

but it's just less boiler plate

#

if it wasn't for type handle

#

could leave OnCreate empty

robust scaffold
#

Yea. I really hope unity will make a codegen for type handle and updating. Would be incredible.

robust scaffold
rustic rain
robust scaffold
#

Yea. I use CreateMesh() from a composite collider 2D of a tilemap collider and feed that into a physics shape mesh.

robust scaffold
#

Sliding a box collider along the surface of it works for a while until it somehow decides to roll over it.

rustic rain
#

Should make a system

#

That modified world during step

#

Doing same thing - nullifying z value

robust scaffold
#

Enforcing 0 z axis fixes the rollover. No need for rotational setting so that's good.

rustic rain
robust scaffold
rustic rain
#

Hold up

#

Have you considered physics step modification?

robust scaffold
#

Infinite inertial dampers? I mean, that could work.

rustic rain
#

Before it's data written to entities

rustic rain
#

I mean modifying translation inside physics world

robust scaffold
#

This is what it's doing. I think

rustic rain
#

Point is to do it before data is written to chunks

#

Also should be way faster

#

Since it's all giant array

#

Vs chunks

robust scaffold
#

I havent really dug into what's going on in there. Give me a minute to see if I can find it

rustic rain
#

Just look at physics world

robust scaffold
#

ugh, that is pain

#

To modify that, we would need to write our own ExportPhysicsWorld.

robust scaffold
#

Huh, anyone else having a build issue where any level of managed stripping above None for Mono result in companion GOs not having their transforms changed?

#

Scene 700485ca34f7b45488702c50add65ebf - Data length mismatch: Dependencies: 39, Types: 41, Paths: 39. I think it might have to do something with this error?

viral sonnet
#

well, this focused test on PhysicsColliderKeyEntityPair turned out more interesting than I thought. just look at this alone. the left part has a cap of 16, the right part after the huge init spike runs on internal cap 0

#

the same job for a heavy object (57 chunk cap) takes 11.4ms, the other light object (99 chunk cap) 3.01ms. i have no clue what's going on right now. seems a bit too extreme

#

i should take out physics of this test. on that note, i can't get a static physic object to not run any CreateRigidBodies jobs. all frames are full of it which shouldn't be the case. all are spawned on the same position so maybe that's the problem

rotund token
#

spawning a lot of things on the same place in physics goes poorly

deft pilot
#

if the goal is to add alot of elements to alot of entities

#

whats the goto to do that

#

otherwise it would just freeze on that frame

#

ie/need to add 2000~ elements to n * m entities at the start of the game

#

where n / m is anywhere between 1~50 so we could be talking about 2500 entities with 2000 elements each which is 2500 * 2000 elements

rotund token
#

entityquery variation is very fast at this

#

because it can work at chunk level

deft pilot
#

how does entity query help me add elements?

rotund token
#

oh sorry by elements i thought you meant components

deft pilot
#

buffer elements i should say yeah

rotund token
#

do they already have the buffer? can't you just do it in a parallel job

deft pilot
#

they already have the buffer

#

wait you can modify buffers in a job?

rotund token
#

5 mill elements would only be 2 digit MS

#

yes

deft pilot
#

-facepalm what

rotund token
#

DynamicBuffers work fine in jobs

deft pilot
#

i thought you could only do value type calculations

#

okay

viral sonnet
dense oriole
robust scaffold
robust scaffold
#

GCMA is real simple, just calling CreateMesh and saving it as an asset:

#

From there, I constrain movement in the world to 2D and it works.

#

Runtime changes to tilemaps though are still an unsolved problem. So eh

ripe parrot
# viral sonnet so what's your question then? ๐Ÿ™‚

Sorry for the late reply, but I was trying to figure out if there was a hard line to look for when transitioning a project to DOTS based architecture.

I didn't mean I know it's possible based on seeing VS clones because I actually assumed they were leaving a lot out (that may require DOTS).

I think I got my answer though in that DOTS wouldn't be required for this project and that there is not necessarily any one scenario where you should not use DOTS, let alone a scenario where you should.

viral sonnet
tropic venture
mild ledge
#

"Changes:

Removed unsafe requirement in Standard Characters" doesnt seem like it

dense oriole
dense oriole
long adder
#

I encountered a problem. I got the behavior tree variable of AI in the game and could be accessed, but it could not be modified.
Why is this? Is there any way to modify it, thank you

spice vale
#

Am I missing something or, when we use the idiomatic foreach, we can't actually set the component we are iterating over?

dense storm
#

Is a System's update framerate independent like fixed update?

rustic rain
#

use RefRW<T>

#

or smth like that

spice vale
rustic rain
spice vale
rustic rain
#

why do you need ref for managed comp?

spice vale
#

must be non-nullable

#

I want to set it. ๐Ÿ™‚

rustic rain
#

but it's already reference

#

just set it

spice vale
#

it becomes angry at me Cannot assign to 'instance' because it is a 'foreach iteration variable'

rustic rain
#

mind showing code?

dense storm
spice vale
#
            foreach (var instance in SystemAPI.Query<CompanionGOInstance>())
            {
                instance = CreateNewInstance(); <- Compile error here
            }
rustic rain
#

you are supposed to modify instance instead

spice vale
#

That works but it's annoying.

#
            {
                var newInstance = CreateNewInstance();
                instance.a = newInstance.a;
                instance.b = newInstance.b;
                instance.c = newInstance.c;
                instance.d = newInstance.d;
            }
rustic rain
#

๐Ÿค”

dense storm
#

I am using BaseUnit : MonoBehaviour in a system.

Entities.ForEach((Entity e, BaseUnit unit) =>
{
  unit.SomeUnitMethod();
}

Can I make it query Hero : BaseUnit as well? or even Interface?

dense storm
#

This the new one?

foreach (var (rotateAspect, speedModifierRef) in
                SystemAPI.Query<RotateAspect, RefRO<SpeedModifier>>())
rotund token
#

that or IJobEntity

#

since they kind of do different things

dense storm
#
            foreach (var (e, transform) in 
                SystemAPI.Query<Entity, RefRO<WorldToLocalTransform>>())
                {
                    
                }
#

How do I ref entity?

#

Gets error

rotund token
#

add WithEntity or something at end

rustic rain
#

WithEntityAccess()

rotund token
#

yeah that one

dense storm
#
            foreach (var (transform, e) in 
                SystemAPI.Query<TransformAspect>()
                .WithEntityAccess())
                {
                    
                }

It ends up way uglier than Entities.Foreach

brave field
#

๐Ÿ‘€ Actually it's so much better than Entities.Foreach

rustic rain
#

can't agree

#

yeah, query is way cleaner

brave field
#

It's damn lag when using Entities.Foreach lol

#

Not to mention need to create bullshit local var just to pass into Entities.Foreach

spice vale
#

I like this formatting:

foreach (var (transform, e) in SystemAPI
  .Query<TransformAspect>()
  .WithEntityAccess())
{

}
dense storm
#

Ah yes that's better

#
var queries = SystemAPI.Query<TransformAspect>().WithEntityAccess();

foreach (var (transform, e) in queries)
{
  // Do Stuff
}

How do I tell it not to run with burst, and what about Run/Schedule/ScheduleParallel?

rustic rain
#

it's not running with burst

rotund token
#

it's main thread only

dense storm
#

oo

rotund token
#

it's not a job

#

it will run in burst if you have it in a bursted ISystem

#

but it's still main thread

rotund token
#

think of it as a replacement for EFE.Run

brave field
rotund token
#

EFE.Schedules should be replaced by IJobEntity

rotund token
#

it's always withoutburst

dense storm
#

Okay I see

brave field
dense storm
#

So jobs still the same syntax :)

rotund token
#

you can't turn burst off if burst isn't running

brave field
#

I mean with Entities.ForEach u can put .WithoutBurst to make the code at Entities.ForEach not burst compiled to debug

rotund token
#

foreach (var (transform, e) in SystemAPI.Query<TransformAspect>().WithEntityAccess()) { }

Entitys.ForEach((Entity, in TransformAspect) => { }).WithoutBurst().Run()

#

these are the same thing in SystemBase

brave field
#

but now with idiomatic foreach u can't do tat anymore

rustic rain
#

๐Ÿฅด

rotund token
dense storm
#
var queries = SystemAPI.Query<ManagedType>().WithEntityAccess();

foreach (var (managedType, e) in queries)
{
  managedType.SomeMethod();
}

I can't query a monobehaviour with this

rotund token
#

SystemAPI.ManagedAPI is coming next release i believe

brave field
brave field
dense storm
#

Can't convert ManagedType to IQuery something

#

Welp, Entities.Foreach for now

spice vale
#

Its working for me to query managed comps

dense storm
#

What ok, I'll try again tomorrow

brave field
#

Oh so only query classic unity component like Monobehavior cannot work?

spice vale
#

or wait, maybe it doesn't work for monos

#

I have only tested with class IComponentData

rotund token
#

yeah it might only work for that

dense storm
#

Yes it was a MonoB

#

It still works with Entities.ForEach

brave field
#

๐Ÿฅฒ I just upgrade my production project to able to enter play mode state but there's still lots of runtime errors need to fix

dense storm
rotund token
rustic rain
proud jackal
brave field
#

@proud jackal ๐Ÿฅฒ Can u make sure next version fix this issue? Entities Hierarchy is completely broken at my side

spice vale
proud jackal
frosty siren
#

what is alignment in UnsafeUtility.Malloc method?

spice vale
#

Data structure alignment is the way data is arranged and accessed in computer memory. It consists of three separate but related issues: data alignment, data structure padding, and packing.
The CPU in modern computer hardware performs reads and writes to memory most efficiently when the data is naturally aligned, which generally means that the da...

brave field
spice vale
# frosty siren what is alignment in `UnsafeUtility.Malloc` method?

essentially alignment of 1 means allocation can happen anywhere, alignment of 4 means it can happen only at addresses divisible by 4, and so on. Computers can read and write data faster if it is aligned correctly. An int for example wants and alignment of 4. UnsafeUtility.AlignOf<T>() can check what the alignment is for your type.

frosty siren
rustic rain
#

this API is codegen

#

what you do is basically just give hints to code generators made by Unity to generate correct code

proud jackal
rustic rain
#

we really need some tutorial or explanation how to make our own very simple implementation of this

brave field
# proud jackal Indeed,.. oh Issue got it way before me ๐Ÿ˜‚

For idiomatic foreach, is there any plan to bring back .WithoutBurst() and .WithStructuralChanges and .WithName("Foo") Entities.ForEach equivalent? I guess those are method builder or something? I forget the formal naming of it. Btw have u see the Entites Hierarchy window issue I posted above?

rustic rain
#

smth that caches field in OnCreate and uses it in OnUpdate

proud jackal
brave field
brave field
winter depot
#

I'm not sure if here or in graphics, but currently I am disabling hybrid rendering on entities by adding and removing <Prefab>. Is there a more efficient way to be doing this?

viral sonnet
#

yes, Disabled comp. you should not remove or add prefabs for no good reason.

dense storm
#

But why disable it? It looks way neater & readable in a variable.

#

And is actually in line with the usual foreach usage. Create a list, then iterate on it. Rather than creating the list in the for loop declaration.

proud jackal
#

I mean, not wrong, but we didn't want to open that can just yet (the more we initially restrict it, the better support we can make sure to give once we open the can)

#

That said, it shouldn't really be thought of as creating a list, more so retrieving one, as most of it is cached and not created :3

dense storm
#

I see, that's cool, thanks!

winter depot
viral sonnet
#
    /// Disables the entity.
    /// </summary>
    /// <remarks> By default, an <see cref="EntityQuery"/> ignores all entities that have this component. You
    /// can override this default behavior by setting the `EntityQueryOptions.IncludeDisabledEntities` flag of the
    /// <see cref="EntityQueryDesc"/> object used to create the query.</remarks>
    /// <seealso cref="EntityManager.IsEnabled(Entity)"/>
    /// <seealso cref="EntityManager.SetEnabled(Entity,bool)"/>
    public struct Disabled : IComponentData
    {
    }``` It's a standard Entities component.
#

Do you just want to disable rendering?

winter depot
#

Yeah, I guess I could disable entity if I instead dropped them on a child linked entity, but for now its on the primary entity I wanted rendered

viral sonnet
#

hm, I'm not aware of any way to just disable rendering. the query operates on RenderMesh and LocalToWorld, both are not enableable components. maybe someones else has an idea to achieve this without structural changes.

rustic rain
#

just like Disabled

viral sonnet
#

haha, nice ๐Ÿ˜„

winter depot
#

Thanks!

#

Still add/remove, but at least I feel better. Maybe it can be a bitflag one day

viral sonnet
#

yeah, Disabled comps could really profit from the enabled comp feature

rustic rain
#

just on query level

brave field
#

Anyone know how to fix this android crash? ๐Ÿฅฒ

lib_burst_generated.Unity.Entities.EntityQueryImpl.GetSingletonChunk(Unity.Entities.EntityQueryImpl* this, Unity.Entities.TypeIndex typeIndex, ref int outIndexInArchetype, ref Unity.Entities.Chunk* outChunk) -> void_af0ee2df0b1e2158fa5c6d394d81afa0 from Unity.Entities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null(Unity.Entities.EntityQueryImpl.GetSingletonChunk:120)
lib_burst_generated.Unity.Physics.Systems.BroadphaseSystem.OnCreate(Unity.Physics.Systems.BroadphaseSystem* this, ref Unity.Entities.SystemState state) -> void_af0ee2df0b1e2158fa5c6d394d81afa0 from Unity.Physics, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null(Unity.Physics.Systems.BroadphaseSystem.OnCreate:600)
whole gyro
brave field
brave field
rustic rain
#

Entities is experimental after all

brave field
balmy thistle
brave field
#

Oh yeah I realized that it's probably caused by system singleton entity that has long name . I still want to keep the naming. I hope next release official can fix it. For now I guess can I modify the FixedString64 to like FixedString128 to make it larger?

whole gyro
dense oriole
#

does anyone know how to deal with NavMeshLinks in DOTS? the characters nicely "jump" to the other navmesh, but I wish them to teleport :p
any clever way to find out when they're traversing a link so I can speed things up?

winter depot
#

I am attempting to instantiate a prefab with a nested linked entity group. My issue is only the linked child of the instantiated prefab is being generated, the children of that prefab which are also linked do not. Is this not possible? Or is this something that the original prefab needs to have each child of child linked manually? Or is it possible and I am making a mistake.

winter depot
robust scaffold
#

Does anyone know what happened to firstEntityIndex in IJobChunk?

#

Oh boy, now query.CalculateBaseEntityIndexArrayAsync is required...

robust scaffold
robust scaffold
#

I havent been this confused about DOTS in years. My god is netcode so confusing.

#

Why are all my ghosts disabled? How do I properly enable them? Why are there a quarter billion components tacked onto everything?

#

I am so confused. Is this how people look at DOTS starting out? I see why people just give up after spending a few hours on this

viral sonnet
#

hehe, i remember schnozzle showing a screen with 4 or something chunk capacity ๐Ÿ˜…

robust scaffold
#

like god damn, i wish I knew what was going on

viral sonnet
#

i sound like a broken record. 16k chunk size is not enough

#

i don't know how much has changed in 1.0. the doc was good enough to get me started

robust scaffold
robust scaffold
viral sonnet
#

have you found the get started tutorial?

robust scaffold
#

In the docs? That's still using 0.5X components

viral sonnet
#

hm, yeah i see no upgrade guide for 1.0. that would be helpful when lots has changed

rotund token
#

Oh yeah netcode documentation is lacking

#

There are a lot of features or helpers that are just unknown because no mention

#

I think the getting started basic setup kind of works

robust scaffold
#

my ghosts are all spawning in disabled for some reason. They're all enabled on the GO side... ugh

viral sonnet
rotund token
#

Just in a subscene?

robust scaffold
#

Yea

rotund token
#

Subscene ghosts are kind of special