#archived-dots

1 messages ยท Page 271 of 1

solemn hollow
#

i have a makro that creates the entities for each loops for me and it fills the Dependency by default. so i never leave it empty

viral sonnet
#

I'm not sure where that comes from. AFAIK a system uses default instead of Dependency. I always got errors when I left it empty

#

so I tell everyone they should use Dependency

#

apparently there's some auto-magic but /shrug

solemn hollow
#

hmm i think it was in a changelog or sth. i remember reading it...

viral sonnet
#

yeah I remember it too but have forgotten where I read it

#

anyway, I think it's a bad habit to not explicitly write it out

#

fk auto magic

solemn hollow
#

i guess as soon as you return a jobhandle from a job you should manually manage all dependencies in the system

#

if you only use Entities.Foreach().Schedule() without parameters and returning jobhandles it works internally with the Systems Dependency

viral sonnet
#

the first example is pretty much unreadable. you'd never know the jobs run in a sequence

rustic rain
#

bruh, any tip how to solve this?
Basically I want to randomise positions of certain entities with certain rules, like "not closer than 50 units to any other certain entity".
I was thinking about simply changing Translations to some neutral position with max float value on all of them.
And then do random logic on each entity: check compare it's translation after random to translations of all other certain entities.

But here's the problem. Can I do it in same job?

            var translations = GetComponentDataFromEntity<Translation>();

            dep = Entities.WithAll<StarSystem.StarSystem>()
                .ForEach((ref Translation translation) =>
                {
                    var nextRandom = rnd.NextFloat2(MINRect, MAXRect);
                    translation.Value = new float3(nextRandom.x, nextRandom.y, 0f);

                    for (int i = 0; i < systems.Length; i++)
                    {
                        if (translation.Value -)
                    }
                })
                .Schedule(dep);
solemn hollow
viral sonnet
#

it's just confusing. I already see how much problems devs are having with dependencies. At first it's one thing you never care about and then boom, I don't get it, what's Dependency? Why do my jobs run after each other and not in parallel, etc...

solemn hollow
#

but honestly i am amazed how comparativly easy it was for me to get into dots (very early adopter). I did not have any experience whatsoever with multithreading etc and the errors guided me pretty well.

rustic rain
#

I never learnt OOP properly xD
Straight dive into DOTS ECS

#

kek

solemn hollow
#

id say complex worldgen generally runs in steps

rustic rain
#

Can I use read/write TypeHandle in system that also has write access?

#
           var translations = GetComponentDataFromEntity<Translation>();

            dep = Entities.WithAll<StarSystem.StarSystem>()
                .ForEach((ref Translation translation) =>
                {
#

basically just this

#

is that legal? xD

solemn hollow
#

well Transforms is an easy case. you can read from LocalToWorld.Position and write to Translation

rustic rain
#

I can't

#

I do it in one go

#

LTW won't be updated

solemn hollow
#

we are talking about worldgen here too right?

rustic rain
#

kind of, this is all just 1 step of randomizing positions

#

potentially that would be the only world gen xD

solemn hollow
#

then just only use the ComponentDataFromEntity. Its not a hot path so youd not need to squeeze out every little bit you can by liniar iteration.

viral sonnet
solemn hollow
#

@rustic rain ```var translations = GetComponentDataFromEntity<Translation>();

        dep = Entities.WithAll<Translation>

.WithAll<StarSystem.StarSystem>()
.ForEach((Entity e) =>
{

#

but why can you read from translation and not from localToWorld... why is translation set at this point

#

if you spawn entites and you want to read from them you need to have a sync point or manage their translation data in some other fashion

#

i mean you could maintain an array of translations you spawned entities at in that system and make sure you spawn no other entity close to another based on that array instead of reading from not yet fully created entities

#

i hope i do make sense here

#

Another way to go about it to just spawn alot of entites and delete ones that are too close to each other. that might be more multithreadable.

rustic rain
#

I can't read from LTW

#

because in job Z I assign Translation to some far far away

#

so when I do checks, it's not actually trigger by accident

#

and I don't wait till it's written to it

#

oh well, I think I crashed unity

#

xD

solemn hollow
#

sry i still dont get the problem you are trying to solve here. generate an array of correct translations in the first place and then spawn the entites?

rustic rain
#

Randomize positions of entities

#

with rules

#

just that

solemn hollow
#

yes but somehow your problem seems to be that you have not yet valid entites already spawned and then want to query from them in the same system. spawn them in the right location in the first place.

rustic rain
#

nah, they are all valid

#

problem I was trying to solve is simple - I am pepega, who doesn't know rules of ECS

#

xD

#

I don't need for each loop

#

I Just need Job With code

solemn hollow
#

hmm now i understand even less^^.

#

you want to check for each entity if there is another entity in a certain radius. so do a foreach and in that foreach iterate over the chunks of all those entites again.

#

can you just post some pseudo code?

rustic rain
#
                .ForEach((Entity e) =>
                {
                    float3 pos;
                    do
                    {
                        var nextRandom = rnd.NextFloat2(MINRect, MAXRect);
                        pos = new float3(nextRandom.x, nextRandom.y, 0f);
                        translations[e] =
                            new Translation() { Value = pos };
                    } while (CheckValid(translations, pos, systems));
                })
#

here's what I did

#
        private static bool CheckValid(ComponentDataFromEntity<Translation> translations, in float3 pos,
            in NativeArray<Entity> systems)
        {
            for (int i = 0; i < systems.Length; i++)
            {
                if (math.distance(pos, translations[systems[i]].Value) < 50f)
                {
                    return true;
                }
            }

            return false;
        }
#

it crashed kek

viral sonnet
#

protip: use math.distancesq ๐Ÿ™‚

rustic rain
#

why?

viral sonnet
#

square root is expensive and multiplying the needed distance by itself is fast

#

or can even be a constant in your case where it would be 250

solemn hollow
#

did it crash or just not respond anymore

viral sonnet
#

CheckValid looks okay, the other one, I don't see if the job runs on a translation query. I also don't understand why you write back to translations[e]

rustic rain
#
                {
                    for (int i = 0; i < systems.Length; i++)
                    {
                        var e = systems[i];

                        Start:
                        var nextRandom = rnd.NextFloat2(MINRect, MAXRect);
                        var pos = new float3(nextRandom.x, nextRandom.y, 0f);
                        translations[e] = new Translation() { Value = pos };

                        for (int j = 0; j < i; j++)
                        {
                            var s = systems[j];
                            var dist = math.distance(translations[s].Value, pos);
                            if (dist < 50f) goto Start;
                        }
                    }
                })
solemn hollow
#

hes randomly generating positions until he finds a place thats ok

rustic rain
#

yay, I did it

#

TIL: goto instruction

solemn hollow
#

wtf....

rustic rain
#

found an efficient way

#

to only check positions that are already assigned

viral sonnet
#

well, no need to write it back to chunk. leave the random position in stack until you know it's valid and then write back

solemn hollow
#

true

rustic rain
#

oh

#

ok

viral sonnet
#

dear lord, a goto. that the day will ever come that i see such code

rustic rain
#

ngl, it seems so good

solemn hollow
#

id kill my coworkers for that ๐Ÿ™‚

viral sonnet
#

that's just shameless ๐Ÿ˜›

rustic rain
#

saves me 50 lines of code

solemn hollow
#

?!

rustic rain
#

instead of having do while loop

viral sonnet
#

i can probably do it with a while and a bool

rustic rain
#

I just do goto

#

saving so many lines

#

and making it extremely more readable

#
            dep = Entities.WithAll<StarSystem.StarSystem>()
                .ForEach((Entity e) =>
                {
                    float3 pos;
                    do
                    {
                        var nextRandom = rnd.NextFloat2(MINRect, MAXRect);
                        pos = new float3(nextRandom.x, nextRandom.y, 0f);
                        translations[e] =
                            new Translation() { Value = pos };
                    } while (CheckValid(translations, pos, systems));
                })
                .Schedule(JobHandle.CombineDependencies(posDep, dep));
            dep.Complete();
        }

        private static bool CheckValid(ComponentDataFromEntity<Translation> translations, in float3 pos,
            in NativeArray<Entity> systems)
        {
            for (int i = 0; i < systems.Length; i++)
            {
                if (math.distance(pos, translations[systems[i]].Value) < 50f)
                {
                    return true;
                }
            }

            return false;
        }

Just compare this and

#

this

            dep = Job.WithCode(() =>
                {
                    for (int i = 0; i < systems.Length; i++)
                    {
                        var e = systems[i];

                        Start:
                        var nextRandom = rnd.NextFloat2(MINRect, MAXRect);
                        var pos = new float3(nextRandom.x, nextRandom.y, 0f);

                        for (int j = 0; j < i; j++)
                        {
                            var s = systems[j];
                            var dist = math.distance(translations[s].Value, pos);
                            if (dist < 50f) goto Start;
                        }

                        translations[e] = new Translation() { Value = pos };
                    }
                })
                .WithDisposeOnCompletion(systems)
                .Schedule(dep);
solemn hollow
#

you can inline in the first way too lol

cerulean pulsar
#

I didn't even know goto was a thing in C#. TIL

solemn hollow
#

kill it with fire

rustic rain
#

but why

viral sonnet
#

why is goto bad? assembler also uses it?

solemn hollow
#

i guess a single one is not too bad readability wise. thing is you dont have good formatting anymore

viral sonnet
#

ok, I'm just bored because webgl takes 11 minutes to export

cerulean pulsar
#

I like both these perspectives: kill it with fire and assembler uses it

viral sonnet
#

i'm just trolling, kill it with fire!

rustic rain
#

I don't get the hate

viral sonnet
#

compilers have a hard time with it. any optimisation is gone

rustic rain
#

oh

cerulean pulsar
#

That's a good point. Coding according to the conventions of the compilers

karmic basin
#

Dammit, thought my time machine finally worked

viral sonnet
#

it's not about readability, in that sense goto would win over pretty much anything. you could write gotos instead of loops. but yeah, to tell the real difference you'd have to look at the assembly. the goto one should always look much worse.

solemn hollow
#

@rustic rain report back on how that worldgen in conversion worked out for you. ill need to implement something similiar soonish

rustic rain
#

works fine, it does randomises positions xD

#
        public void RandomizeWorld(uint seed)
        {
            var rnd = new Random();
            rnd.InitState(seed);

            var translations = GetComponentDataFromEntity<Translation>();


            var systems = _starSystemQuery.ToEntityArrayAsync(Allocator.TempJob, out var dep);

            dep = Job.WithCode(() =>
                {
                    for (int i = 0; i < systems.Length; i++)
                    {
                        var e = systems[i];

                        Start:
                        var nextRandom = rnd.NextFloat2(MINRect, MAXRect);
                        var pos = new float3(nextRandom.x, nextRandom.y, 0f);

                        for (int j = 0; j < i; j++)
                        {
                            var s = systems[j];
                            var dist = math.distance(translations[s].Value, pos);
                            if (dist < 50f) goto Start;
                        }

                        translations[e] = new Translation() { Value = pos };
                    }
                })
                .WithDisposeOnCompletion(systems)
                .Schedule(dep);
            
            dep.Complete();
        }
solemn hollow
#

so the thing with spawning gameobjects early on worked?

rustic rain
#

oh, no

#

I didn't try it

solemn hollow
#

ah ok

rustic rain
#

I'm still not sure how I want to do it

#

the hardest part of development ngl

solemn hollow
#

also the most fun

rustic rain
#

eh, I have more fun when I know what I want to do

#

figuring out what to do is fun when you have people to discuss it with

viral sonnet
#

lots of trial and error when you don't have people with lots of experience

solemn hollow
#

@viral sonnet are you actively working on your ability system or is it just a casual sideproject? We recently talked about abilities and i later stumbled upon a short post of your system. I was wondering how you add new behaviours to your abilities.

viral sonnet
#

pretty active ๐Ÿ™‚

solemn hollow
#

Do you have extra components that handle the movement of the projectiles for example?

#

from the looks of it we have quite similar options.

viral sonnet
#

i have 2 projectile types, virtual and physical. physical has collisions and a direction, virtual is just following the player until it hits

solemn hollow
#

and how you handle thrown projectiles that move in an arc or projectiles circling a player?

viral sonnet
#

right now I don't. If I would add it would be another comp in addition to physical

solemn hollow
#

ah ok. i split my ability system in basically 2 parts. AbilityBehaviours and AbilityEffects. Effects are the things that effect other entities (targets) and behaviours are the things the ability itself does. RN i have building blocks of behaviour that stack to form whatever movement you want combined with the targeting component. So a projectile + heading component + non static target becomes a homeing missile. A projectile + parabola component + static target becomes a projectile traveling in an arc towards a position the target was when it was thrown

#

im not too happy with the authoring atm cause i have too many possible combinations :S

#

but this way its very easy to extend...

viral sonnet
#

my projectile is just an archetype. particles are its own comp with own system that's a GO that just follows the entity

solemn hollow
#

sadly i have to do the same because of sprite renderers and Particle systems beeing hybrid.

#

but where we differ i guess is that i convert the authored projectiles too

#

So you are probably developing it for the asset store?

viral sonnet
#

that's the plan ๐Ÿ™‚

solemn hollow
#

ill watch out for it! very curious

viral sonnet
#

thanks ๐Ÿ™‚ I've just taken a look at my loader system: ```public partial class ParticlePrefabLoaderSystem : SystemBase
{
public Dictionary<int, GameObject> particlePrefabs;

    protected override void OnCreate()
    {
        particlePrefabs = new Dictionary<int, GameObject>();

        var lala = Resources.LoadAll("Particles");

        foreach (var p in lala)
        {
            Debug.Log("loaded " + p.name + " " + p.GetType().ToString());

            particlePrefabs.Add(p.name.GetHashCode(), (GameObject)p);
        }
    }

    protected override void OnUpdate()
    {
    }
}``` it's really dumb but effective for hybrid. that way I can circle around the problem of having SharedComponentData and GameObject references
#

I need to go back to particles once I've finished another part. See if it will hold up

#

Right now I'm designing a way to have linear memory buffers for entities that work like a DynamicBuffer as array and hashmap

#

If I can manage to write it, it will be pretty dope

#

because I can't stress enough and @rotund token will correct me on that but DBs suuuuuck ... haha

#

access times are just ass

#

overall time:
none: 22ms
only boss: 24.66ms (250k entities on 1 DynamicHashMap, 250k lookups no writes in the measured time)
only casters: 56.21ms (1 entity on 250k DynamicHashMap, 250k lookups no writes in the measured time)
both: 62ms

#

a test I did yesterday, has to do with a dynamic hashmap that has data which entities are in combat with other entities

#

250k attack one boss monster

rotund token
#

160ns per lookup is slow ๐Ÿ’ฉ

viral sonnet
#

eh, could be 16 ๐Ÿ™‚

rotund token
#

What is that loader? Looks gross =D

solemn hollow
#

its still really impressive to me how many entities you guys are really try to get running at once xD

viral sonnet
#

loader for hybrid particles. that way I can only reference an int and spawn the correct one from entity

#

true, it's gross. what's even more gross is to have no animations or particles in ecs, so ... ๐Ÿ˜„

rotund token
#

It kind of loads all particles into memory permanently

viral sonnet
#

yeah, for now. obviously has to be refined but the gist stays the same I think

rotund token
#

I really wish they provided an unmanaged visual effect graph

#

The actual visual effect script is pretty much just a wrapper for native code so I don't think it's be too hard

viral sonnet
#

yeah, everything hybrid sucks right now

rotund token
#

(also this is only the second time I've seen use goto used in c#, kill it with fire)

rustic rain
#

๐Ÿ‡ท ๐Ÿ‡ฎ ๐Ÿ‡ต

safe lintel
#

such a letdown when they had a dots vfx graph on the roadmap as in progress for months, then changed it to under consideration

viral sonnet
#

I was under the impression that all I'm writing are for loops. Now I'm under the impression that all I'm writing are hashmaps ๐Ÿคฃ

white island
#

ok what. I have an entity being changed elsewhere, i can see the correct data reflected in the inspector when it should be, but when I get that same entity via query the data is wrong

viral sonnet
#

maybe it's overwritten?

viral sonnet
#

@rotund token reduced it from 66ms to 31ms. key lookup is now through a hashset with prime hashed entity1+entity2. write is done via NativeStream and a single threaded job builds the hashset and the multiHashMap. even with 500k items it just takes 1ms to build.

#

I have to say, the combination is pretty nice. Especially because I don't have to set the Capacity of the hashmaps which is a pain to know beforehand. If I manage this better the hashmap build job could even be faster. Only thing that's missing is to set the blockSize of the NativeStream that's allocated. 4k is okay but I could need some more ๐Ÿ™‚

rotund token
#

you might find my Write/ReadLarge

#

extensions for native stream

viral sonnet
#

thanks! ๐Ÿ˜„

#

I have only single writes right now. Don't know how I could batch them which seems like a requirement for the WriteLarge extensions, right?

rotund token
#

yes thats the point

#

if you need to write more than 4088 per allocate

#

nativestream is a lot faster if you can batch your writes

viral sonnet
#

huh, I have overlooked errors because safety checks were turned off. I set the chunk count as the ForEachCount for the writer and use the batchIndex of the IJobEntityBatch. seems pretty default usage to me. I could supress it with [NativeDisableParallelForRestriction] but I'm wondering what's wrong in the first place

rotund token
#

yeah you basically have to disable parallel writing safety if not using ijobfor

viral sonnet
#

Ah I see, I remember having to do that once but never quite figured out why. With IJobChunk and the entityIndexInQuery it was pretty straight forward. Seems like it's built for that

white island
viral sonnet
#

the inspector shows only the values from the end of the frame. you could read the value somewhere in between. I dunno, the question is, why should it be different? It's either overwritten or you read the wrong thing

#

Can't think of much more causes tbh

rotund token
#

break point on it?

rotund token
#

look at the speed!

#

655360 elements
WriteLargeBurst - 0.03ms
WriteBurst - 0.86ms

viral sonnet
#

damn!

white island
#

Ok so how do I properly work with entity queries, because some of these get the right data while others do not. im very confused and I don't even know where to begin debugging this.

EntityQueryDesc desc = new EntityQueryDesc
            {
                None = new ComponentType[]
                {
                    typeof(PlayerTag),
                    typeof(ChestTag),
                    typeof(DoorTag)
                },
                All = new ComponentType[]
                {
                    typeof(LocalToWorld),
                    typeof(RefIDComponent)
                }
            };
            EntityQuery q = eManager.CreateEntityQuery(desc);
            float3 pPos = PlayerInventory.pInventory.gameObject.transform.position;

            NativeArray<Entity> matchedEntities = q.ToEntityArray(Unity.Collections.Allocator.Temp);
            print((eManager.HasComponent<MobTag>(e)) + ", " + cInScene.inScene);

            foreach (var e in matchedEntities)
            {
                RefIDComponent cRefID = eManager.GetComponentData<RefIDComponent>(e);
                InSceneComponent cInScene = eManager.GetComponentData<InSceneComponent>(e);
                LocalToWorld cLTW = eManager.GetComponentData<LocalToWorld>(e);
                WorldComponent cWorld = eManager.GetComponentData<WorldComponent>(e);
                BaseIDComponent cBaseID = eManager.GetComponentData<BaseIDComponent>(e);

Like here I try to print both if it has a certain component and if it is in the scene, which prints what I believe is correct data, but then when I go into an if statement over cInScene.inScene and check again it never prints anything

white island
#

To be clear I am trying to read

molten flame
#

ummm, try explaining this again?

  • what you tried
  • expected result
  • actual result
white island
# molten flame ummm, try explaining this again? - what you tried - expected result - actual res...
  • This is in a Monobehaviour, looping through entities that fit a certain query, and reading data from them. In this case, I was going to perform some action on an entity if it had a MobTag component and if true was in the attached InSceneComponent.
  • It was supposed to do an if/else on InSceneComponent.InScene, and for debug purposes it is printing whether it has the tag or not.
  • Even when both conditions I am looking for are true, such as print((eManager.HasComponent<MobTag>(e)) + ", " + cInScene.inScene); printing true, in the if/else loop it never prints the right thing. Also, it seems as though sometimes it prints False for the InScene variable even if I can see in the inspector that it is true
#

i wonder if I could debug.log a get; set; in a component, to see if i'

#

m secretly setting it somewhere

#

is that allowed

molten flame
#

I think you are a bit stuck in your train of thought...

What you should do is make 2 minimum examples in code to compare
e.g.
Always works:

print((eManager.HasComponent<MobTag>(e)) + ", " + cInScene.inScene);

Never works:

if(cInScene.inScene){
    print((eManager.HasComponent<MobTag>(e)) + ", " + cInScene.inScene);
}

Now also, what is cInScene?
Seems pretty important but there is no information in your question showing exactly how it comes to be (other than it being some component data)

#

To me it looks like the entity query is fine, but maybe you have some issues with this InSceneComponent

white island
#

(Also I tested my Get Set idea to make sure it wasnt secretly being set every frame. It wasn't.)

molten flame
#

Your original question was about entity queries but from your post there is nothing to suggest that the entity query shown plays any part in your issue.
So it seems that you are getting lead down the garden path by your train of thought.
If you can reduce the number of possibilities you will be able to figure it out easier.
This is just some advice to help you get to solutions quicker.

If those above snippets I posted are your issue then then only things it can be are:

  • the whole block of code isn't getting called, in which case, why?
  • cInScene.inScene is false, in which case why is it false (i.e. how does it come to be)?
white island
#

In the inspector and in the debug Get Set the inScene should be true.
The code block is being called, if I put something in there it floods the console.

#

but InScene seems to be false in the code block

white island
white island
#

The odd thing is when 1 prints true, true, which means 2 and 3 should pass, 4 never prints

print((eManager.HasComponent<MobTag>(e)) + ", " + eManager.GetComponentData<InSceneComponent>(e).inScene); //1


                if (eManager.GetComponentData<InSceneComponent>(e).inScene) //2
                {
                    if (eManager.HasComponent<MobTag>(e)) //3
                    {
                        print("Mob in scene"); //4
                        print(cRefID.refID);
                        print("---");
                    }
molten flame
#

yep you're right, so there is something else going on
is it sequential like this or in separate functions

white island
#

I believe the only place it is changed in earlier in this function. This is a loop that processes certain events in the world and changes some entity data, and then this section of the loop checks the newly updated data and sees if the object needs to be despawned, spawned, etc

frosty siren
#

What the difference between EntityManager.CreateEntityQuery() and SystemBase.GetEntityQuery() ?

rustic rain
rustic rain
#

Any tip what are my options to restore Entity connections during save/load worlds?

I assume I can restore randomly generated positions through random seeds

#

but what about entities data

#

how do I know, which one is which

white island
#

ok so I have this code:

foreach (var e in matchedEntities)
            {
                RefIDComponent cRefID = eManager.GetComponentData<RefIDComponent>(e);
                InSceneComponent cInScene = eManager.GetComponentData<InSceneComponent>(e);
                LocalToWorld cLTW = eManager.GetComponentData<LocalToWorld>(e);
                WorldComponent cWorld = eManager.GetComponentData<WorldComponent>(e);
                BaseIDComponent cBaseID = eManager.GetComponentData<BaseIDComponent>(e);

                NativeArray<ComponentType> types = eManager.GetComponentTypes(e); //get all component types
                print((eManager.HasComponent<MobTag>(e)) + ", " + eManager.GetComponentData<InSceneComponent>(e).inScene); //1

                if (eManager.GetComponentData<InSceneComponent>(e).inScene) //2
                {
                    if (eManager.HasComponent<MobTag>(e)) //3
                    {
                        print("Mob in scene"); //4
                        print(cRefID.refID);
                        print("---");
                    }

These are entities being read during a LateUpdate loop.
The odd thing is when 1 prints true, true, which means 2 and 3 should pass, 4 never prints. What?

gusty comet
#

What is the idiomatic way to get the camera (or its translation) into an ECS system every frame? I have a float3 camerasPosition property in my system (:BaseSystem) but I'm trying to figure out how to pass a reference to or retrieve the camera's position since the System is auto started. Is it better to not create the system manually in my MonoBehavior or is there another idiomatic way to pull data out of the rest of your scene?

last ridge
gusty comet
#

How would it know which GameObject to copy the transform from? Also, I need the position in a system.

rustic rain
last ridge
#

the object you want to copy the transform from has be "Hybrid" so Convert and Inject to have both of them, the component is for the entity

rustic rain
#

What I mean is that this is recommended way

#

to communicate with GO from ECS, not other way around

gusty comet
#

Yes okay so after that I have some entity C that has a component with the camera transform in it. How do I get the value of that component into a system that by default queries for the entities at play here?

last ridge
#

yes this recommended way

#

other can be painfull ^^

#

@gusty comet add en empty component to easy tag as "cameraEntity" for query this entity

#

the position of this entity can be saved as camera like that

gusty comet
#

So to be clear, this is the full context :

  • Have a main camera in the hierarchy
  • I have some GO that as one of its serialized fields has a reference to that camera
  • I have 10k entities for which one of the systems queries for a tag "billboard"
  • Matching entities are rotated towards the assigned camera

I get from the above how to turn a GO value into an entity component but does that mean the above system would have to first query for the camera tag, get that value, then query for the entities it's actually interested in to do the actual iteration?

rustic rain
#

just have camera entity

#

that will have camera position

gusty comet
#

So basically if I understand correctly after doing the convert on a GO with the camera I end up with this situation :

  • 1 entity with a camera tag
  • 10k entities that need rotating
last ridge
#

Issue got it

gusty comet
#

Yes I get that

#

But how do I get that into a system that is querying for other entities.

#

Or well, I clearly don't get it.

rustic rain
#

aaaand grab that value before doing your 10k loop job

gusty comet
#

A system according to the docs should query for one specific set of entities.

#

The above would break that pattern/suggestion/idiom

last ridge
#

for the system part, you will have to get organized to filter your queries by tags

#

it can become very custom depend of your "tag"component" and the design of a game

#

I think you mean you have to break a job to get the camera transform stored in the entity, but no

#

there is some job than can be executed with specifics orders

gusty comet
#

I still think we're disconnecting here or I have a fundamental misunderstanding ๐Ÿ˜„

I'll have 1 "camera" entity, and 10000 "billboard" entities, for a total of 10001 entities. The "billboard system" is tasked to query for the "billboard" tagged entities and rotate them towards "camera". If I understand idiomatic ECS correctly I shouldn't use a single system to query for two different collections of entities (if I even can). So the "billboard system" is not every querying for the camera tagged entity because it's only allowed one "query". Again, if the idiom is to be followed. I get I can force the issue but that seems horrible software design.

rotund token
rotund token
gusty comet
#
[BurstCompile]
public partial struct BillboardJob : IJobEntity
{
    public float3 cameraPosition; // <-- I need this to be set or some way to get it into the below

    void Execute(ref Rotation rotation, in Translation translation, in Billboard billboard)
    {
        float3 position = translation.Value;
        float3 forward = cameraPosition - position;
        float3 up = new float3(0, 1, 0);

        quaternion lookAtCameraQuaternion = quaternion.LookRotation(forward, up);

        rotation.Value = lookAtCameraQuaternion;
    }
}
gusty comet
rotund token
#

GetSingletonEntity

rustic rain
#

btw, does it cause sync point?

last ridge
#

yes or a job that look for the only "camera entity" and stored it

gusty comet
#

store it where?

#

and how does my system get to it?

rustic rain
#

I just started to wonder, whether using all that is even safe to avoid sync points

gusty comet
#

Is there really no such thing as a formal inter-system data exchange?

rotund token
#

You exchange data between systems using entities and queries

gusty comet
#

Yes but idiomatic ECS apparently doesn't want you to make systems that executes multiple queries within the same system.

rotund token
#

Yeah that's bs

last ridge
#

I think I will write you an exemple for tomorrow morning @gusty comet if it can help, i am sleepy

gusty comet
rotund token
#

Unfortunately running tiny systems in entities is terrible for performance

gusty comet
#

The expectation is I invoke a single query to just get the entity with a camera tag, then pass the translation component of that into the next one.

rustic rain
#

@rotund token btw, do you happen to know if it's possible to have a conversion system that runs before GOs are registered?
Basically I want to generate all GOs hierarchy through code in conversion system, so then it all converts it as if I created them by hand.

#

I tried to make it update in that first group before entities are created

#

but it seems like new GOs aren't registered or smth
so... no conversion is run, nor entities are created.

gusty comet
#

Thanks for input all. I shall continue my hacking and forehead rubbing.

last ridge
#

so just chain your two query here to share the float 3

rotund token
gusty comet
#

Yeah I'm using IJobEntity but that should be roughly the same.

rustic rain
rotund token
#

Whole point of conversion is to convert game objects, if you don't have game objects to convert why not just create the Entities directly yourself?

rustic rain
#

not only most things are attached themselves

#

but also you have easier time with authoring components

#

and all that stuff

last ridge
#

@gusty comet if it can reassure you, they is exemple from Unitys staff with a lot of queries shared data

rotund token
#

Anyway, it doesn't work because your original game object had to exist for live linking etc

rotund token
#

If you just create a ghost go it just breaks that

rustic rain
#

feels bad

#

so I assume

rotund token
rustic rain
#

I'll have to create all entities myself, while also generating them by attaching to that original game object?

rotund token
#

Sounds like it. Though this also sounds like a terrible 1.0 workflow!

rustic rain
#

this is a disgusting workflow

last ridge
rotund token
rustic rain
#

because it's about random world gen

#

not something you do in editor

rotund token
#

Wait. So this isn't subscene conversion?

rustic rain
#

It is, but it can be not

#

if that can help

#

kek

last ridge
#

@rustic rain you are killing me it's like to reverse enginering the world haha

rotund token
rustic rain
#

Basically I have this:
I need about 70-80 rooms (star systems)
about 10 of them will be totally unique and authored in editor.
While everything else should be randomly generated upon starting new game.

Sooo, I'm basically figuring out my options

last ridge
#

@gusty comet GetComponentDataFromEntity<CameraTag>() on top of your job

viral sonnet
last ridge
#

to define the job to run after the one who sync with the GameObject use a header which look like [UpdateAfter(typeof(CopyTransfromFromGameObject)] or a thing like that

gusty comet
safe lintel
#

@viral sonnet thats tertle's recommendation - which I agree with ๐Ÿ™‚

frosty siren
#

Anyone use adressables with dots?

last ridge
#

yes add this component with the camera convertion and get it from the camera like that

gusty comet
#

Alright, cheers. I suspect that's all I need to progress. I'll either make it work or throw my PC out of the window. Whichever happens first.

last ridge
#

it will act as a tag for you to get easy this entity position from a query

viral sonnet
#

Ah ok, thought a Unity dev made that recommendation. np, I also agree, just think there are exceptions

rotund token
#

we had a horrible time communicating in reverse at work. completely shit show of lifecycle management.

north bay
viral sonnet
#

having no strict direction can quickly start to get you into trouble.

#

I see mainly 2 problems, - where is my code? - scheduled jobs that suddenly need a sync point because some MB wants to read/write something

viral sonnet
#

ha nice, there really is a unity statement ๐Ÿ™‚ nice find

#

I need to rewrite some interface elements to achieve that rule. As GOs don't really work in subscenes, we'd need to use Convert and Inject in a scene, right?

viral sonnet
rotund token
#

our client is 80% mb ๐Ÿ˜ข

#

basically taken from before it was converted to dots (and multiplayer)

#

just a mess

viral sonnet
#

and you'd also recommend convert & inject? my target frame is still a lazy MB that gets the components of health/resource/etc...

rotund token
#

no

#

i do not think anyone should use those conversion scripts

#

borderline deprecated

viral sonnet
#

so create an entity and AddComponentObject in a conversion MB?

last ridge
#

agree with turtle for one object or one component it's ok but don't sync mass thing like that

rotund token
#

WithNone<MB>.WithAll<MBC>.CreateGO

rotund token
viral sonnet
#

Hm, I have to think about that. creating at runtime sounds horribly annoying for interface elements

gusty comet
#

@last ridge I have it mostly working now except that the Translation component of the camera tagged entity is not bound to the GO transform (so, I can move the camera without the component value changing). Do I need to wire something up?

safe lintel
#

@rotund token hmm, do your "conversion" during normal runtime for things that cant fit in subscenes?

rotund token
#

no, i only convert in subscenes

#

i actually put all my authoring in editor only asmdef

#

to stop anyone doing it at runtime

last ridge
#

@gusty comet try to add in the camera gameobject in the inspector's tab, a new component on the object, look for CopyFrom..

#

its will feed the component during the convertion for you

viral sonnet
safe lintel
#

i mean for things that would otherwise require Convert&Inject?

last ridge
#

@gusty comet you should see the new component (copyfromgo) on the entity, in the entity debugger

gusty comet
#

Ahh, it's a new component rather than it setting the Value on Translation component?

#

Ok

last ridge
#

yes

#

and a job will modify the entity translation for yoyu

#

as it use this component as a Tag to act on Translation

rotund token
last ridge
#

yes ECS foreach or a scheduled job

viral sonnet
#

why would I do that over a conversion script? I mean it's nice to keep and edit things in the editor. Especially some UI scene

last ridge
#

ah UI

rotund token
gusty comet
last ridge
#

if you have hit play?

rotund token
#

a) because runtime converison is incredible slow
b) it doesn't let you do ecb.Instantiate(entity)
c) runtime conversion doesn't work with packages like netcode

gusty comet
# last ridge if you have hit play?

Yes. I can move the camera but the translation isn't being synced with the camera.transform.position value. I do see the GO copy tag on the camera.

last ridge
#

hmm there must be something I have forget

#

I'll try to open my hybrid project tomorrow then I get back to you powcode, hope to help further

#

ah look for the local to world

gusty comet
#

Ah that'd be great, no worries.

last ridge
#

does it react

#

if you move the camera?

gusty comet
#

It does not, no

last ridge
#

ok we will found why

rotund token
#

but apart from that enzi

#

Warning: Although there are APIs that you can use to convert GameObjects to Entities at runtime (such as GameObjectConversionUtility), these will be deprecated in the future because you should never use them in runtime code. They are far, far too slow. As such, you should convert authoring data to runtime data in the Unity Editor during the build process, and Unity should load and use only the runtime data at runtime.

#

they'll be going away

safe lintel
#

@rotund token wait how do you handle animated gameobjects? just dont convert them?

last ridge
#

oula animation

rotund token
#

i only convert the entity, i just instantiate presentation gos at runtime when required

last ridge
#

its become a mess to sync transform at some point

viral sonnet
#

@rotund token yeah, I totally get the point ๐Ÿ™‚ Just trying to figure out how to best apply that to my UI elements

last ridge
#

I have cry with VFX graph added on weapons

gusty comet
safe lintel
#

ah ok

rotund token
last ridge
safe lintel
#

yeah im seeing this would potentially ease certain things for me

gusty comet
last ridge
#

why don't you go for a simple shader so?

#

which could like process rotation regarding camera angle

#

or even more tricky, use a VFX graph Bilboard that fetch some position

#

but it go out of DOTS channel sorry

gusty comet
#

Hm, well, if that's possible I'd be open to it. I have my entities in DOTS/ECS but the actual rendering is essentially a glorified particle system. I just wasnt sure how to efficiently get 10k-100k-ish entity positions and colors on the screen.

#

Meaning, my first inclination was to dynamically generate a mesh and render the entire cloud with a single draw call, then I got distracted by looking into instanced draws and...well...here we are.

#

(so, I'd have a CloudMeshCompilerJob that'd convert all queried entities into a point mesh of some sort and just render that, but seemed suboptimal)

#

If there's a good way to get the entity component data for the position and color components efficiently on the GPU side for a shader solution that'd be nice(r).

last ridge
#

yes like materials property block, i guess

#

but you shall keep it on GPU side only, entity should not have to inject camera properties

#

a shader can fetch camera position

#

directly

gusty comet
#

exactly, I think it's just the blit from cpu to gpu for the positions and colors would be prohibitively slow. And I can't easily keep the position data in gpu memory and manipulate it there given the amount of logic needed to adjust those positions each frame.

#

In shader world the camera position is given so that'd be a non issue thankfully.

#

Well, bedtime for me. Thanks for all the input.

#

I may have to conclude I'm just in way over my head with all this ๐Ÿ˜„

last ridge
#

ur welcome

solemn hollow
#

oof 200 unread messages. sometimes its quite busy here ๐Ÿ™‚

#

I wonder about that recommendation with writing from ECS to GameObjects. Unitys statement is based on Companion Gameobjects not on normal unlinked monobehaviours. I believe having a query with managed components generates garbarge. im not so sure if it might be better to poll a singleton entity from a monobehaviours update to avoid that garbage

viral sonnet
solemn hollow
#

im already in bed. ill check it tomorrow. i think i have that problem in one of my systems right now

viral sonnet
#

And yeah, I'm never too sure about absolute rules. I have written a new system for some UI value updates but now I can't really figure out how I would continue creating the reference. Canvas or UIElements can't be in a subscene. Right now I'm trying a subscene object that references the UI Elements then. But then the UI already has to be in the scene. I dunno, it's just annoying right now. Guess I'll just go back to reading from entities ๐Ÿ˜„

white island
rotund token
#

the system is responsible for loading the asset and writing to it

#

the UI has no knowledge of what is writing to it

#

why would it? it's presentation

#

if your UI is reading your entities you've fallen back into the old go trap of coupling your model and presentation!

#

in fact im not even sure where you're reading your entity data from if you're using UIElements

#

UIelements doesn't use a gameobjects (except the root document) so where is your script attached?

viral sonnet
#

I'm still on canvas. How are you placing the interface elements? Do you reference an anchor?

rotund token
#

each 'panel' is independent

#

usually only 1 panel is shown at a game but it's not a requirement

#

can certainly have them layering

#

whole thing is just mostly just setup via uxml

#

instantiated in the system

#

and the elements that require updates and just kept as references in the system whenever something changes

#

most UI rarely needs updating

viral sonnet
#

ah so yours already uses UIElement? Guess that works a little better with xml layouts

rotund token
#

yes i use uielements

#

it works much much much better with dots projects

#

because you dont need gameobjects!

#

if you really want to be gross, you can use Marshal.GetFunctionPointerForDelegate to write to them much easier from burst jobs as well

viral sonnet
#

can you dispel the myth that companion objects in ForEach generates garbage?

rotund token
#

no idea

#

it's not 2012 anymore and i don't work on mobile devices, i care a lot less about garbage these days so i rarely profile for it

#

(mostly because it requires making a build and i cbf)

safe lintel
#

they still do @viral sonnet

#

well the companion transform update system does

#

I hate it, its a linear increase for the amount of companion gameobjects you have

rotund token
#

down with companion gameobjects! ๐Ÿ˜ข

#

just going to make a game style with no animations

#

problem solved

#

or like 1 basic animation loop i can do with a shader

safe lintel
#

im reworking animated characters for I think the 5th or 6th time, I feel that its like trying to push a square peg into a round hole

#

at least making it with dots๐Ÿ˜ก

viral sonnet
#

ok, gonna test later when I make a build. The targetFrameSystem also generates garbage for me now. Is this a bug or something not really supported? I can't keep references from a subscene object to the GOs from the scene where the subscene is in. It's only working once and when I go out of play mode they are gone.

rotund token
#

can you rephrase ๐Ÿ˜„

#

are you saying you have a subscene with references to another scene?

safe lintel
viral sonnet
#

hehe, sure. pictures are better I guess

rotund token
#

yeah you cant do that

viral sonnet
#

huh, so I can't really set this up then?

#

quite stuck on this TBH

rotund token
#

well this is why every panel is separate for me is handled individually

#

my entities just reference the prefab and instantiate it at runtime (onto the document or canvas)

viral sonnet
#

do you use an authoring comp at all for this?

#

for the panel?

rotund token
#

kind of? it's on my settings components

#

let me load up my project

#

on my navmesh project atm

#

wrote this ui stuff 18+ months ago and havent really touched it since

viral sonnet
#

in my case, I can't even set an anchor with no references working where I could instantiate to as parent

rotund token
#

it's just worked perfectly for me, but i can't remember exactly how its setup so let me look

viral sonnet
#

thanks! ๐Ÿ™‚

#

and yeah, as stated previously. this really comes down to right now for having no layout outside of the scene hierachy

rotund token
#

ok thats right

#

so my entire game only has 2 gameobjects in the scene

#

a directional light, and a uidocuments

#

i have a single settings file with all my panels (in this demo only 2 but you get the idea)

#

literally stored in a single component just for reference

#
    {
        public VisualTreeAsset[] Assets;
    }```
#

this is only accessed once to instantiate

#

it's never queried per frame

#

in my UISystemBase I just have this to start instantiating

#
        {
            if (this.panelElement == null)
            {
                var windows = this.EntityManager.GetComponentObject<UIAssets>(this.GetSingletonEntity<UIAssets>());
                var asset = windows.Assets[this.StateKey];

                Assert.IsNotNull(asset, $"No UI asset set for {this.StateKey}");

                this.panelElement = asset.CloneTree();
                this.panelElement.name = this.StateInstanceComponent.ToString();
                this.panelElement.pickingMode = PickingMode.Ignore;
                this.panelElement.AddToClassList(RootClassName);
                this.OnLoad(this.panelElement);
            }

            this.OnShow(this.panelElement);
            this.AddToParent(this.documentSystem, this.panelElement, this.Priority);
        }```
#

so i set it up once per play and that's it

#

every panel has it's own system that instantiates what it owns

#

i have a whole state system i use in my project to handle what panel is visible when etc

viral sonnet
#

pretty elegant so far. how are values updated?

rotund token
#

panels implement OnLoad

#

(as you see above)

#

and just get all the elements they need to write to

#

and then they just write on query when data changes if required

#

i avoid writing unless data has actually changed - this is mostly a habit from UGUI

#

which is super slow to update values

#

i think uielements is much better at handling this but i just avoid it from habit

viral sonnet
#

do you achieve this with DidChange filter or some tag?

rotund token
#

depends what i'm writing

#

the system can store the past state if it needs, it can be a separate component

#

it can be change filters

#

i can simply read the current UI value

#

depends entirely on the situation

viral sonnet
#

alright, thanks a lot. got to invest into UIElements it seems ๐Ÿ™‚

rotund token
#

oh its hell in 2020.3 though ๐Ÿ˜„

#

i am dying for 2021

#

every time i load my project i get compile errors and have to reimport files to fix it

viral sonnet
#

ah right, we talked about this once. I remember that was what was holding me back ๐Ÿ˜„

rotund token
#

it also breaks burst building in development builds for some reason

#

well it makes burst build like it's release even when development is set

#

so if you have condition #if UNITY_DEVELOPMENT tags in there bad things happen

#

yeah the way they implemented it in 2020 is problematic with their dll replacement stuff

#

thankfully all fixed in 2021 and working nice

#

it was a sad downgrade though

viral sonnet
#

not many weeks now until Q2 ends ๐Ÿ™‚

#

looking forward to the day I can ditch 2020.3 for good. Never used a version for that long

rotund token
#

most of the time unless i need a specific feature i like to stick to lts these days

#

but yeah i also like to switch when a new lts comes out

viral sonnet
#

what do you think of that? ```public class UpdateUIValue_Authoring : MonoBehaviour
{
public UpdateUITargetType targetType;
public UpdateUIValueType valueType;
public TMP_Text tmpText;
public Slider slider;

    private void Awake()
    {
        var barrier = World.DefaultGameObjectInjectionWorld.GetExistingSystem<EndSimulationEntityCommandBufferSystem>();
        var commandBuffer = barrier.CreateCommandBuffer();

        var entity = commandBuffer.CreateEntity();
        commandBuffer.AddComponent(entity, new UpdateUIValue()
        {
            targetType = targetType,
            valueType = valueType,
            tmpText = tmpText,
            slider = slider
        });
        
        Destroy(this);
    }
}```
rotund token
#

it works but it isn't very flexible

#

i mean if it's just for your own project or sample it's fine

#

but this doesn't really work for a multiplayer game

#

if this was part of say a library

#

that said, not even sure why you bother with ECB here

#

just create it with EM?

viral sonnet
#

I'm alright with that for now, multiplayer is a long way off. Well I figured so it can never run into any scheduling problems

rotund token
#

is this not just happening once though at start of game?

viral sonnet
#

pretty much, unless some jobs are running while the interface is loading on transitions

#

any downsides of the ecb?

pliant pike
#

ecb is bad mkay

viral sonnet
#

anything less dogmatic? ๐Ÿ˜„

white island
viral sonnet
#
{
    // Using a custom bootstrap that returns false lets you set extra data (such as the total address space you want to reserve for ECS Chunks) before worlds are default initialized.
    public bool Initialize(string defaultWorldName)
    {
        // ICustomBoostrap runs for all scenes in a project, so to gate this sample to a particular scene, we have to use this hack that checks the active scene's name.
        //if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "DemoScene")
            EntityManager.TotalChunkAddressSpaceInBytes = (1024UL * 1024UL * 16UL) * 4;

        return false;
    }
}``` does this actually work for anyone?
safe lintel
rotund token
#

oh i can fix it by simply making a build

#

for some reason that fixed it for me

#

all my code is in asmdef though

viral sonnet
#

the chunk size stays at 16k. in game and in editor

rotund token
#

this doesn't change chunk size

#

the default value here is 1GB, haven't you just shrunk it?

#
        /// The total reserved address space for all Chunks in all Worlds.
        /// </summary>
        public static ulong TotalChunkAddressSpaceInBytes```
`        static readonly ulong DefaultChunkAddressSpaceInBytes = 1024UL * 1024UL * 1024UL;`
#

that said, s_TotalChunkAddressSpaceInBytes doesn't seem to be used anywhere atm anyway

viral sonnet
#

lol, my bad ๐Ÿ˜„ the sample name threw me off. not sure what it's for then when it's not used

#

anyway, I read some long time ago that chunk size could be changed with an ICustomBootstrap

#

public const int kChunkSize = 16 * 1024; computer says no

#

what is this funky thing? in EntityComponentStore

#

hm, this seems like a long array of pointers to the chunks

viral sonnet
#

no one, I misremember ๐Ÿ˜„

rustic rain
#

Sooo, in order to restore entity-data connection during save/load I need some kind of unique identifier for entities in components?

rotund token
#

you know what's a unique ID?

#

Entity

#

that is your unique ID

plain hatch
#

I have a question regarding the [BurstCompile] attribute and job system
When using methods inside the Job, e.g. an overloaded == from a custom struct, do I also have to attach [BurstCompile] to this method?

As in:

public struct CustomStruct 
{ 
  [BurstCompile] // <---- Is this neccessary?
  public static bool operator ==(...) { ... } 
}
rustic rain
rotund token
#

oh you want to save subscene entities?

#

then yeah you need to give them a unique id

rotund token
#

anything called from burst code is bursted

rustic rain
#

hmm
What about entities that will be created during runtime?

plain hatch
rustic rain
#

I guess I'll need to recreate them somehow

rotund token
#

to handle all these cases

#

turns out there are a lot

rustic rain
#

well, yeah

#

pretty much anything that needs to be saved

rotund token
#

but i think i got them all

rustic rain
#

will have it's own method for that

rotund token
#

subscene entities, instantiated from entity prefab, instantiated from subscene reference, etc

rustic rain
#

so, how do you handle saving entities created during runtime?

rotund token
#

managed to set the the whole thing up through the same conversion system

#

and setup them different depending on their state

rotund token
#

and it just instantiates from the same prefab on load

#

you can make changes to prefab etc between save sessions to change it

#

and it'll all be reflected

rustic rain
#

prefabs...

#

Hmm

rotund token
#

by prefab i mean entity prefab

rustic rain
#

I get it

#

it's just that in my case, those entities will be let's say AI ships

#

NPCs

#

hmmm

#

maybe prefab is enough

#

to handle component recreation

rotund token
#

anyway saving is complex and people leave it way too late

rustic rain
#

I want to start on it rn

rotund token
#

hence i wanted to build a complex and complete save + migration system before i had even started building game

#

so yeah props to you

rustic rain
#

but UI Toolkit is broken on 2020.3

#

xD

rotund token
#

most people wait like 3 years about to release

#

and realize they have to refactor their entire gmae to do it

rotund token
#

but it works

rustic rain
#

it gives me errors that it tries to access classic Input

#

unsolvable

#

I guess I'll have to just enable classic input

#

rip perfomance

rotund token
#

you're using the wrong input thingy

rustic rain
#

I use New Input

rotund token
rustic rain
#

yep

rotund token
#

you need to switch to inputsystem ui input module

#

oh

#

hmm

#

well i have no issue

rustic rain
#

I even removed Library

rotund token
#

i assume old input system was disabled from project settings

rustic rain
#

and I get this

#

yep, it is

rotund token
#

hmm just keep the old one enabled at the same time maybe?

#

any harm in just leaving it on while you develop in 2020.3

rustic rain
#

yeah, but that rips perfomance for some reason

rotund token
#

only for a month

#

๐Ÿคž

rustic rain
#

btw

#

could you suggest a pattern with UI documnets?

#

how do you handle different screens? Switching between them?

rotund token
#

i only have 1 ui document

rustic rain
#

I am so lost, no manual gives any detail into this

rotund token
#

i actually reported a bug when i used to use multiple

#

and ui guys were like, wtf do you have more htan 1 ๐Ÿ˜

rustic rain
#

lul

#

so, you literally just make a huge hierarchy

#

in one UXML?

rotund token
#

i had a second because i wanted a universal console that i could just drop in a project ok!

rotund token
#

i have a lot of panels each their own uxml

#

and they just all get added to the UIDocument

#

the base panels all use absolute positioning

rustic rain
#

so each panel with it's own C# script

#

added on one main "manager" UXML?

rotund token
#

each system sets up and maintains its own panel

rustic rain
#

yeah, that's the way I managed it

#

from feel

rotund token
rustic rain
#

but I don't like it at all

rotund token
#

i actually went through it a bit this morning

#

i really like how i've set it up

#

what concerns you?

rustic rain
#

requires to set up manager to enable/disable screens

rotund token
#

i have a state system i use for a lot of things

rustic rain
#

and even then perfomance is eaten by disabled screens for some reason

rotund token
#

i dont turn off visibility of panels that are hidden

#

i remove them from the uidocument

#

so i only ever have visible panels

rustic rain
#

oh

#

how do you remove them?

rotund token
#
        /// <param name="visualElement"> The panel to add. </param>
        /// <param name="priority"> The draw priority. </param>
        public void AddPanel(VisualElement visualElement, int priority = 0)
        {
            var e = new OrderedElement(visualElement, priority);

            this.elements.Add(e);
            this.elements.Sort();

            var index = this.elements.IndexOf(e);
            this.view.Insert(index, visualElement);
        }

        /// <summary> Removes a panel from the UI. </summary>
        /// <param name="visualElement"> The panel to remove. </param>
        public void RemovePanel(VisualElement visualElement)
        {
            var index = this.elements.IndexOf(new OrderedElement(visualElement, 0));

            if (index < 0)
            {
                Debug.LogError($"Removing {visualElement} that isn't added.");
            }
            else
            {
                this.elements.RemoveAt(index);
                this.view.Remove(visualElement);
            }
        }```
rustic rain
#

hmm

rotund token
#

not the most ideal way of managing order/priority but it works

rustic rain
#

so your World keeps those panels outside of UI render component
and upon need it adds it to hierarchy?

#

that's interesting

rotund token
#

its added in OnStartRunning() and removed in OnStopRunning()

#

in my UI systems

rustic rain
#

ahem, that's a weird one

rotund token
#

these systems running depending on my state tag component which is handled by a completely different state system

#

i've realized you can kind of use systems as state machines ๐Ÿคฃ

rustic rain
#

you handle it through RequireSingletonToUpdate()?

rotund token
#

i used to

#

i have a state group system now

#

that prevents requiring checks on each system

#

but yeah pretty much that was the first approach until recently

#

and fundamentally that's still how it works i just dont have to do all checks for each system

#

really an over optimization

rustic rain
#

that's really interesting

#

hmm, so how do you switch from 1 screen to another?

rotund token
#

let me load my states

#

this.UIStateSet(K<UIStates>.NameToKey("menu"));

#

for example my client menu state looks like this

#
    {
        /// <inheritdoc/>
        public override uint StateKey { get; } = K<ClientStates>.NameToKey("menu");

        /// <inheritdoc/>
        public override ComponentType StateInstanceComponent { get; } = typeof(StateMenu);

        /// <inheritdoc/>
        protected override void OnCreate()
        {
            this.RequireSingletonForUpdate<StateMenu>();
        }

        /// <inheritdoc/>
        protected override void OnStartRunning()
        {
            this.UIStateSet(K<UIStates>.NameToKey("menu"));
        }

        /// <inheritdoc/>
        protected override void OnUpdate()
        {
        }

        private struct StateMenu : IComponentData
        {
        }
    }```
#

very simple, not much happens in my menu

#

so the actual 'game' level state doesn't need to do much

#

but say if the join game button is hit in my menu it runs this

#
        {
            var state = this.GetSingleton<ClientState>();
            state.Value = new BitArray256 { [K<ClientStates>.NameToKey("join-game")] = true };
            this.SetSingleton(state);
        }```
#

which triggers my jonigamestatesystem

#
//     Copyright (c) BovineLabs. All rights reserved.
// </copyright>

namespace Shattered.Game.States
{
    using BovineLabs.Core;
    using BovineLabs.Game.App;
    using BovineLabs.Game.States;
    using BovineLabs.Game.UI;
    using Unity.Entities;
    using Unity.NetCode;
    using Unity.Networking.Transport;

    public class JoinGameStateSystem : ClientStateSystemBase
    {
        /// <inheritdoc/>
        public override uint StateKey { get; } = K<ClientStates>.NameToKey("join-game");

        /// <inheritdoc/>
        public override ComponentType StateInstanceComponent { get; } = typeof(StateGoInGame);

        /// <inheritdoc/>
        protected override void OnCreate()
        {
            this.RequireSingletonForUpdate<StateGoInGame>();
        }

        /// <inheritdoc/>
        protected override void OnStartRunning()
        {
            this.SetSingleton(default(UIState)); // TODO this is just to hide the menu, we need to show in game UI but that doesn't exist
            this.ClientStateSet(K<ClientStates>.NameToKey("build")); // TODO

            var network = this.World.GetExistingSystem<NetworkStreamReceiveSystem>();
            var ep = NetworkEndPoint.LoopbackIpv4;
            ep.Port = 7979;
            network.Connect(ep);
        }

        /// <inheritdoc/>
        protected override void OnUpdate()
        {
        }

        private struct StateGoInGame : IComponentData
        {
        }
    }
}
#

which triggers new ui state (this demo project has no in game UI)

#

but then if i want to enter my build game state

#
        {
            this.RegisterPhysicsRuntimeSystemReadOnly();
            this.UIStateEnable(K<UIStates>.NameToKey("build"));
            this.InputEnable("build");
        }
#

shows the build UI and enables the build keys

#

etc

#

i've really fallen for my application level state machines

#

but yeah, i dont have time to actually develop games because i spend my whole time experimenting with and designing architecture for dots apps ^_^'

rustic rain
#

kek, weird approach ngl

rotund token
#

oh its very unique

#

and weird

#

i doubt anyone has done something similar

rustic rain
#

I lean a bit more towards direct assigning of what Visual Element to add

#

and remove

radiant berry
#

The next step in the DOTS roadmap right now is 0.51 right?

viral sonnet
#

yep

radiant berry
#

ok sounds good

devout prairie
#

so essentially a kind of custom layer on top of systems that allow you to group switch them on/off like states

rotund token
#

yeah i basically wrote application level state machines out of systems

#

things like, UI, Input, current game state

#

i don't use this for anything except high level stuff

devout prairie
#

i've been away from dots for a few months and just looking at 0.5 now, was attempting to port the old physics ragdoll demo and just realised the physics samples have actually been updated

#

i'm curious also if the skinned character samples actually work, afaik mesh deformation is still active in AR2, but the animation package isn't supported ( in 0.50 )

#

i wonder if anybody has manually ported the animation package to work in 0.50

karmic basin
#

I think thelebaron tried but get furious against it ๐Ÿ˜›

last ridge
#

the next release of animation package, I would like to have the animation package aligned with graph foundation package : in some first release of animation, I was pretty close to get a nice DOTS state machines, made with the nodal viewport (they were few nodes for animation packages available) but it was acting nicely overall, I have even scripted a Nblend Node Drawer to get some advanced stuff working because there was only linear Blend node available basically. With all that stuff, with all the nodes available in a cleaned Animation package and graph tool aligned, I will forget about hybrid for good and get my animation in dots for Main Characters

haughty rampart
#

yeah that'll still take years^^

devout prairie
haughty rampart
#

it's still at least a year before 1.0 releases and work on animation only resumes after that

devout prairie
#

I would consider the option of continuing your custom extension of the old animation package, personally i think it's worth it.. although i'm not sure what headaches are involved in porting Animation to 0.50 compatibility

haughty rampart
#

i'm not sure it makes a lot of sense investing time into that. animation will probably have a big api redesign

#

i would guess at least

devout prairie
#

yeahh.. i'm pretty certain it will.. just wondering in the meantime 'what would it take to get the old package working again'

haughty rampart
#

not sure

devout prairie
#

i wonder if lebaron did attempt it

haughty rampart
#

i've only extracted parts of it because some of my code was using AnimationCurve
i didn't have to change anything to make that work

devout prairie
#

i think maybe the clips and graph stuff could have some entanglements

last ridge
#

I let it in a corner get some dust

devout prairie
#

visual scripting graph, vfx graph etc

#

playable graph

last ridge
#

it was a drawer to hold GUI component that came from DOTS, it was use to draw node in the DOTS visual scripting, before it get kill

devout prairie
#

editor.graphs

last ridge
#

it was playablegraph+ some stuff i think

devout prairie
#

was it a graph written just for dots or

#

ah right

#

to me, it would make sense just for all graphs in all contexts just to refer to one single graph package

#

too much confusion

haughty rampart
#

but they are fundamentally different to each other

viral sonnet
#

noone talking about DreamingImLatios animation package?

haughty rampart
#

i'd always take native over 3rd party

viral sonnet
#

there's no native, so?

haughty rampart
#

will in the future

last ridge
#

We are asking for

devout prairie
#

i do remember there was a custom physics thing by someone

haughty rampart
#

? no idea

devout prairie
#

ah sorry i replied to the wrong comment, meant Enzo's comment

#

ah yeah that was the same one, Latios Framework

#

seems he's working on skinned animation for it

#

if one guy can do this..

#

but then, he's not dealing with LTS and four thousand different package and editor versions etc

karmic basin
#

I'm quite sure he's hardworking on this and not getting much sleep

worldly isle
#

I am having an issue with collisions. I have read the documentation and I can't seem to figure this out that feels really simple... What is the correct way to add a Tag to an entity when it collides with another... in Entities 0.50

karmic basin
#

Did you try through an ECB in a collision event job ?

#

I don't think it's even documented

#

download and look at the physics samples

worldly isle
#

I feel confused and concerned that one of the most basic and the main things people do with a physics system is not documented...

haughty rampart
#

it's not difficult

karmic basin
#

but should give you a better idea how it's done

karmic basin
#

That's when they'll start on better documentation

haughty rampart
#

exactly

karmic basin
#

and better samples and so on

haughty rampart
#

i just hope 0.51 releases soon

devout prairie
#

To be fair, the docs explain doing casts but there's no mention of how you'd do something like the old OnCollisionEnter, but yeah it's in the samples

worldly isle
#

It makes it sound like it's only a raycasting lib

devout prairie
devout prairie
#

Unless you just want to look at the code, which you could just do by looking at the code on github

half jay
# devout prairie if one guy can do this..

Im with my friend did same thing. Also i released VR game which use our technology. It was about almost 3 years ago
if i attach a link to steam with game it will probably look like an ad

devout prairie
devout prairie
#

So you created a custom animation/skinning system for DOTS for this?

#

Audio also?

half jay
devout prairie
half jay
#

I meant that we made our own similar animation/skinning system for DOTS. We have nothing to do with DreamingImLatios

devout prairie
#

Because i'm thinking, if devs have access to all the juice of DOTS, but it's another two years or something until an official Animation package becomes available, that's a pretty big gap to fill

half jay
#

we made it and put it on the shelf in fact. So I'm unlikely to be able to provide this in some form of asset

hot basin
devout prairie
hot basin
#

as everything is ๐Ÿ˜„

#

integrating others solution also is

devout prairie
#

yeah this is true also

safe lintel
#

any way to exclude gameobjects from conversion or destroy their converted entities before conversion ends?

rustic rain
safe lintel
#

eh how

rustic rain
#

dstManager.DestroyEntity(entity);

safe lintel
#

thanks, i dont remember this working earlier? a bit funky with a hierarchy though ๐Ÿ™ƒ

rustic rain
#

as long as you don't try to access PrimaryEntity afterwards

viral sonnet
#

I gotta say, NativeStream proofs to be a beast in my tests. What throws me off is that a temp allocated NativeList with chunk.Count as capacity is slower than a NativeStream. I don't get that TBH. Write amount is the same. The list is filled to the max and yet it's behind NativeStream that is allocating in small blocks (I think 4k)

drowsy pagoda
#

My next step is to persist data to storage. I used to use Newtonsoft when it was strictly MB. What is an optimal json serializer for DOTS?

haughty rampart
#

......any.....json serializer? they all work more or less the same

drowsy pagoda
#

Ok

#

What do you use?

haughty rampart
#

i solely use System.Text.Json these days

drowsy pagoda
#

Ok. Thanks for input.

viral sonnet
#

InvalidOperationException: The previously scheduled job SpellCastSystem:SpellCastJob writes to the Unity.Collections.NativeStream SpellCastJob.JobData.createSpellsStream. You must call JobHandle.Complete() on the job SpellCastSystem:SpellCastJob, before you can read from the Unity.Collections.NativeStream safely. What's going on here? This happens on the first schedule. The static method gets called by a job that writes to the stream, I reference the given jobHandle yet it keeps on telling me I've to complete the job first. Completing the handle indeed fixes the problem and everything works fine then. Anyone sees the issue?

#

oh wow, it's the forEachCount. huh, I thought was set on the nativestream init

#

well, it's not. mb then ๐Ÿ˜„

void wadi
#

hi guys, basic quesiton but.. Burst error BC1349: Invalid argument. Expecting a string literal or a string.Format or a fixed string. how do i debug.log a string in a job method?

viral sonnet
pliant blaze
#

how do i get my data wjhen OnUpdate is called on a system?

#

chatmessagesystem.GetComponent<ChatMessageEvent>(b).MessageType.ToString()

#

is that right?

rustic rain
pliant blaze
#

@rustic rain get the messagetype

#

UnhollowerBaseLib.Il2CppException: System.ArgumentException: Unknown Type:ProjectM.ChatMessageSystem All ComponentType must be known at compile time.
For generic components, each concrete type must be registered with [RegisterGenericComponentType].

rotund token
#

is ChatMessageEvent a IComponentData?

haughty rampart
pliant blaze
#

its a public struct

haughty rampart
pliant blaze
#

:/

#

any idea

#

does that help?

haughty rampart
#

no? that has not really anything to do with chatmessageevent

#

chatmessageevent is NOT an IComponentData, so you can't GetComponent<>() it

pliant blaze
#

mhh

#

@haughty rampart if its not an IComponentData how come GetEntityQuery(ComponentType.ReadOnly<ChatMessageEvent>()) returns something

rotund token
#

its clearly not an icomponent data

rotund token
#

you can even return gameobjects etc

pliant blaze
#

how can i get the component's data attached to that entity then

#

if i dont know the type

rotund token
#

if you dont know the type, what are you getting?

pliant blaze
#

i have that entity that i know is the one i need to get my data

#

i just dont know how to grab the data from here

haughty rampart
pliant blaze
#

i dont have the code btw

#

im modding a game, if that ok to talk about here?

haughty rampart
#

oh tell me more. i've been dying to know how to make a ECS game moddable

#

(or any game really)

pliant blaze
#

Bepinex/MelonLoader

#

you patch into methods basically

rotund token
#

oh i think mindstyler is talking more official

pliant blaze
#

they make it pretty simple to use, i just dont know much about C# or Unity

rotund token
#

because ecs games using bepinex/melon tbh kind of sucks

#

too hard to inject burst/jobs imo

pliant blaze
#

why?

rotund token
#

you really want the game to officially support loading them

pliant blaze
#

im just modding the server, try to add a !command system to the chat

#

just can't get to read the chat

haughty rampart
#

what game is it anyway? there are not so many ecs games out there yet

pliant blaze
#

V Rising

haughty rampart
#

ah

pliant blaze
#

just came out

rotund token
#

sad not my game ๐Ÿ˜„

haughty rampart
#

so maybe inject some code to view the entity archetype and go from there?

pliant blaze
#

so is there a way to know what type of component an entity goes with?

#

yeah i just got no idea how to do that

rotund token
#

sec

#

NativeArray<ComponentType> components = this.EntityManager.GetChunk(entity).Archetype.GetComponentTypes();

pliant blaze
#

lets try that

#

ive been stuck on this for way too long

#

[Message: Unity] FromCharacter
[Message: Unity] NetworkEventType
[Message: Unity] ChatMessageEvent
[Message: Unity] ReceiveNetworkEventTag

#

ChatMessageEvent is in there...

haughty rampart
#

doesn't make sense

rotund token
#

i think its attached as a component object

pliant blaze
#

like not ECS style?

rotund token
#

try entitymanager.getcomponentobject<ChatMessageEvent>(entity)

#

ive never considered attaching a struct as a componentobject

#

but i assume it'd just box and work fine

pliant blaze
#

[Message: Unity] Exception UnhollowerBaseLib.Il2CppException: System.ExecutionEngineException: Attempting to call method 'Unity.Entities.EntityMana
ger::GetComponentObject<ProjectM.Network.ChatMessageEvent>' for which no ahead of time (AOT) code was generated.

#

same ๐Ÿ˜ฆ

haughty rampart
#

well that's too bad

#

seems you have to patch that one in too. maybe if that's possible

karmic basin
pliant blaze
#

i dont get why im getting this error

#

can i just dump the content of the components i get from the archetype list?

#

see whats in them

rotund token
#

they are componenttypes right?

#

you can get the data from the component type

pliant blaze
#

i mean i just tried..

#
                {
                    var entitymanager = v.GetExistingSystem<ChatMessageSystem>().EntityManager;
                    var chatmessagesystem = v.GetExistingSystem<ChatMessageSystem>();
                    EntityQuery m_Group = chatmessagesystem.GetEntityQuery(ComponentType.ReadOnly<ChatMessageEvent>());
                    var entities = m_Group.ToEntityArray(Allocator.TempJob);

                    
                    Debug.Log($"Entities: {entities.Length}");
                    
                    foreach(var entity in entities)
                    {
                        try
                        {
                            Debug.Log($"Entity: {entitymanager.GetDebugName(entity)}");
                            Debug.Log($"EntityType: {entity.GetType()}");

                            NativeArray<ComponentType> components = __instance.EntityManager.GetChunk(entity).Archetype.GetComponentTypes();
                            foreach (var component in components)
                            {
                                Debug.Log("Current Component Type:" + component.ToString());

                                ChatMessageEvent message = entitymanager.GetComponentObject<ChatMessageEvent>(entity);
                                Debug.Log("Text:" + message.MessageText.ToString());
                            }```
rotund token
#

yeah component object wont help

#
var dynamicHandle = this.EntityManager.GetDynamicComponentTypeHandle(componentType);
var typeInfo = TypeManager.GetTypeInfo(componentType.TypeIndex);
NativeArray<byte> a = chunk.GetDynamicComponentDataArrayReinterpret<byte>(dynamicHandle, typeInfo.ElementSize);```
will you get you the raw bytes
#

but what i've just realized is

rotund token
pliant blaze
#

it does

#

public FixedString512 MessageText;

rustic rain
#

hmm, so if I upload dll through AppDomain will that do?

#

before creating world

#

for modding

#

I wonder if you can harmony patch bursted methods btw

haughty rampart
#

BEWARE AppDomain is deprecated in future .net versions

rustic rain
#

oh

#

how do you upload mod dlls then?

haughty rampart
#

afaik, (haven't researched a whole lot about it yet) it's gonna be with assembly load context iirc. (which people say is even nicer for mod purposes)

rustic rain
#

Oh my god, imagine spending a day to make some system just to realise it won't work

#

I do feel relieved that I realised it sooner than later though xD

viral sonnet
#

Anyone familiar with this? ArgumentException: NativeStream.Writer must be passed by ref once it is in use I have a struct container with 5 NativeStream.Writers and when writing to those I get this error message. Is this somehow not allowed? The container is passed by ref

rustic rain
#

kind of like how buffers become dirty during structural changes

viral sonnet
#

lol, I think I just forgot to BeginForEachIndex

#

yeah, that was it, just an odd error message

viral sonnet
#

nah, that was not it, error is back once I fixed some other broken code.

#

well that's weird. I can't use ref in a container struct

#

had to use pointers to get around that :/

rustic rain
#

hmmm

#

I really wonder how to setup unique ID tracker

#

for saving/loading

rotund token
#

But yes native containers must be passed by ref, they write local data to themselves

viral sonnet
#

looks like this right now. so you say with a method that returns them as a ref it would work without pointers?

rotund token
#

Ah

#

Are you passing that to a parallel job?

#

If so that's going to break

#

Each job needs its own unique instance

#

It stores its current state in the local container and only writes it in on end index

viral sonnet
#

I build that struct in the Execute of a parallel job. It's just so I don't have to pass each own to the method

rotund token
#

Well ok of your building it in the execute that's fine

#

But yes it's you just passed them by ref it'd work

#

Just like the error says =D

viral sonnet
#

Yeah, some safety complains even when it's technically still correct.

#

well I'm just testing if I can get rid of the NativeListExtended blockWrite method but the perf really tanks sadly :/

#

a part that should work out pretty great isn't ๐Ÿ˜ฆ the rest seems better than expected. odd behaviour. I write to several NativeStream.writers now instead of the list and timing has nearly doubled from around 48ms overall to 105ms

#

eh, damn safety checks were on. still 90ms

rotund token
#

From what you said you passed the outer container by ref

#

Then probably used the actual native stream locally

#

This check on the native stream I'm pretty sure is always valid

viral sonnet
#

no, I still use the writer from the container but the address which is checked in this safety check changes of course because I put it in the container.

#

it's okay though, I'm glad the check is in place. would be a lot more troublesome if it weren't

#

I hope the write speed is better in builds. 90-130ms is really not great to the 50ms. Must be the allocations. If that's it I'll test a custom NativeStream where I can set the allocation size

#

at least I could bring it down to 1-2 allocations in one Execute. That would already be a lot better

#

zero difference loooots of FallbackAllocations

rotund token
#

From using native stream a lot the cost is checking if it needs to allocate more then the allocations

#

Hence the large allocator I wrote, still allocates the same but 100x faster

covert lagoon
#

For a first-person shooter, should I make players be kinematic physics bodies and manually implement basic physics for them using collision queries?

#

The terrain is blocky and I won't have to handle angular velocity or slopes

viral sonnet
#

the question is if you want to bother writing your own character controller

#

otherwise, yeah, fps controllers are kinematic

viral sonnet
covert lagoon
#

Implementing walking, jumping and collisions shouldn't take much more than a day, should it?

viral sonnet
#

how new are you to this?

covert lagoon
#

I took a quick look at the DOTS sample's character controller code

#

That's about it

viral sonnet
#

you can have something functional pretty quick but overall it's quite the rabbit hole. takes several weeks

covert lagoon
#

I did study how to make basic AABB physics 2 years ago

#

For now I really just need walking, jumping and not falling through terrain nor falling slower when going against walls

viral sonnet
#

I would recommend you take a look at the Rival asset if you want to stay with dots or modify the DOTS sample character.

rustic rain
#

@covert lagoon here's my fork of some other char controller I found on web

viral sonnet
#

the dots character controller sample should take that simplicity to heart ๐Ÿ˜„

#

code is such a mess

rotund token
viral sonnet
#

this isn't working out ๐Ÿ˜ฆ I would need a NativeStream with persistent memory layout that can be cleared and then an Indexable NativeStream so I don't have to create an array and from that a NMHM

#

although there isn't a lot missing. eh, I'll keep trying for a while ๐Ÿ˜„

#

@rotund token Did you ever write a NativeStream with persistent block memory that can just be cleared?

rotund token
#

no

#

how are you setting up your foreach indices of your streams?

viral sonnet
#

I use chunkIndex. Thought about that being a bad idea and I should just use threadIndex

rotund token
#

you can't really use threadindex

#

you can't start the same index again

#

you'll override the previous threadindex data

viral sonnet
#

ah yeah, right.

rotund token
#

if you want to use thread index get my eventstream

#

from my eventsystem

#

that uses thread index, you don't need to do BeginForEachIndex

#

(or pass by ref)

#

that said it is marginally (few %) slower by the extra write

#

so wont really help that performance of yours

viral sonnet
#

I don't mind, chunkIndex. I'm currently studying the code to find out which implications the forEachIndex has on writing. Answer is none. it's just for writing data back in EndForEach

rotund token
#

well you dont want to use like entity index

#

because then you are allocating 4k per entity

#

instead of 4k per chunk

#

but yeah chunk index is usually fine

#

as long as you aren't running like 2 entities per chunk ๐Ÿ˜„

viral sonnet
#

see that's what I want to find out right now. If any usage screws with the block amount but they use MaxJobThreadCount anyway

#

so a bad forEachCount is only relevant for the allocated UnsafeStreamRange

#

and subsequent reading. but blocks stay the same parallelized 128

#

I quickly tried with other block sizes. 8k seems like a sweet spot for me. even 16k gives some boost. at 32k it gets slower

#

what I want to find now is the sanest way to keep the allocated blocks persistent. I can clear the UnsafeStreamRange. It's even easier when they don't have to be maintained

rotund token
#

native stream was really not designed to be persistent

#

you'd basically have to pool the blocks

#

and you'd still not be able to change the foreach index, anytime your chunk count changed it'd break

viral sonnet
#

I mean, I'm talking about a total rewrite of NativeStream from scratch. Probably wouldn't even use the ForEachCount concept and just threadIndex. Even with NativeStream, I don't see the problem of the foreach index. The block data and Ranges data is decoupled and just referenced with pointers. What am I missing?

#

what I read from the code is that 2 or more ForEach indices can even be in one block as long as there's enough space

rotund token
#

it's like exactly what you're talking about (except without memory reuse)

viral sonnet
#

yeah, thanks. I have the UnsafeParallelBlockList as baseline

bright fossil
#

this is my channel

viral sonnet
#

@rotund token that was pretty much a success. 53ms with ExtendedList 57ms with persistent block list

rotund token
#

thats still a long time ๐Ÿ˜ฌ

viral sonnet
#

overall thread time ๐Ÿ˜‰

#

i'm dealing with some insane load here. if I manage to ever get this to 60fps you can really call me king of performance. right now I'm in ~30fps land

#

this method has the advantage of not overshooting like the block reserve in NativeList when the overall count is unknown. and it's better than 100-130ms nativestream. you said yourself the extendedList method is pretty much the fastest thing you can do, so I think it's pretty cool. I'm not looking for your approval. But I also don't need snarky comments. If you're not interested, just say so, I don't mind.

rotund token
#

im not trying to be snarky

#

im just pointing out 57ms is <20 fps which was concerning

viral sonnet
#

ok then, I'm just taking the overall times now because thread times don't mean as much. It's 6.9ms multi threaded.

safe lintel
#

dont suppose anyone else noticed if joint conversion changed from 0.6 to 0.50? my character/configurable joints dont appear to get set any limits ๐Ÿ˜ฌ

safe lintel
viral sonnet
#

still love the video ๐Ÿ˜„ bug aside, looks cool

rotund token
viral sonnet
#

yeah, it's built on his code. it was easier than I thought. Just the enumerator gave me some trouble ๐Ÿ˜…

molten flame
#

I'm curious, any other Australian DOTS devs out there?

rotund token
#

i am

rustic rain
#

Is there a managed alternative to NativeMultiHashMap?

#

I need to store this kind of data NativeMultiHashMap<Entity, IComponentData>

#

nvm, I figured this will do new Dictionary<Entity, List<IComponentData>>();

rotund token
#

yeah that's pretty much what NativeMultiHashMap replaced

rustic rain
#

hmm, any tip regarding what kind of pattern to use for saving?

#

as in, where do I put that interface

#

ISavable

#

that returns serialized data

#

rn I choose between: Systems, Authoring

rotund token
#

not really sure what your interface is

rustic rain
#

it's nothing yet

#

just figuring out how to do it...

rotund token
#

i detailed my saving pretty thoroughly on the forum

rustic rain
rotund token
#

starts here and i go into a bunch of implementation later

rustic rain
#

GetDynamicComponentDataArrayReinterpret
huh, didn't know it was possible

#

nice

#

I have this idea:
For each piece of data I want to save, I'll create a new system, with only method - return managed list of serialised data and jobHandle.
So this way I potentially can make bursted saving.

The only question - how to handle component types