#archived-dots

1 messages ยท Page 74 of 1

stuck saffron
#

The NativeContainer is already deallocated seems to be the issue

#

Do you have a container passed into a previous job and within it the [DeallocateOnJobCompletion] attribute is on the container?

golden heron
#

No

#

At least, i dont think so.

#

The script is here, @stuck saffron

stuck saffron
#

Try disposing the entitiesarray after scheduling the job

#

Maybe not. Skimmed too quickly and entitiesarray isn't the one its complaining about buuuuut

golden heron
#

any ideas why a convert of a prtefab seems to be stripping off the mesh renderer?

safe lintel
#

is it something made with probuilder? had some issues there

golden heron
#

its a unity default sphere

safe lintel
#

i assume you have the hybridrenderer package installed?

golden heron
#

yep

#

its just been tested with a mesh identical to the one already being spawned and visible successfully, still not visibl

safe lintel
#

if its just a blank sphere and converttoentity it should work, if you are doing something in the conversion process like swapping components it may be missing something that the render system needs

#

i would check the entity in the debugger and see if it has everything that a working entity has

golden heron
#

Thats how i know its stripping off the renderers

#

This one's proxy is real simple too

#
public class ParticleProxy : MonoBehaviour, IConvertGameObjectToEntity
{
    public ParticleData GetData()
    {
        ParticleData data = new ParticleData();
        data.lifeTime = 5;
        return data;
    }
    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        var data = GetData();
        dstManager.AddComponentData(entity, data);
    }
}
#

Also, can anyone answer - is there any particular reason that var is used so much in ecs? is it gonna cause problems if i define my types more clearly?

safe lintel
#

its just simpler

#

if you remove the proxy does stuff still get stripped?

golden heron
#

yep, in fact, its kinda acting like its ignoring the prefab entirely, in spite of my references all being linked up.

safe lintel
#

so if you were to drag the prefab into a blank scene on its own, it doesnt get stripped?

golden heron
#

that works fine, its getting passed the prefab through from the spawner

#

like the example spawner did

#
public class ParticleSpawnerSystem : JobComponentSystem
{
    EndSimulationEntityCommandBufferSystem entityCommBuffer;

    protected override void OnCreateManager()
    {
        entityCommBuffer = World.GetOrCreateSystem<EndSimulationEntityCommandBufferSystem>();
    }
    struct ParticleSpawnJob : IJobForEachWithEntity<ParticleSpawnerData, LocalToWorld>
    {
        public EntityCommandBuffer CommandBuffer;
        public void Execute(Entity entity, int index, [ReadOnly] ref ParticleSpawnerData spawner, [ReadOnly] ref LocalToWorld location)
        {
            
            for (int i = 0; i < spawner.particlesPerSecond; i++)
            {
                Entity instance = CommandBuffer.Instantiate(spawner.prefabObject);
                CommandBuffer.AddComponent(instance, new LocalToWorld { Value = location.Value });
                CommandBuffer.AddComponent(instance, new ParticleData { lifeTime = spawner.particlesLifetime });
            }
            
        }
    }
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new ParticleSpawnJob
        {
            CommandBuffer = entityCommBuffer.CreateCommandBuffer()
        }.ScheduleSingle(this, inputDeps);

        entityCommBuffer.AddJobHandleForProducer(job);

        return job;
    }
}
safe lintel
#

shouldnt it already have localtoworld and particledata?

golden heron
#

Yes

#

wait... maybe its the spawners proxy

#
public class ParticleSpawnerProxy : MonoBehaviour, IDeclareReferencedPrefabs, IConvertGameObjectToEntity
{
    public GameObject particlePrefab;
    public float particlesPerSecond;
    public float particlesLifetime;
    public bool stickToParent;
    public void DeclareReferencedPrefabs(List<GameObject> gameObjects)
    {
        gameObjects.Add(particlePrefab);
    }
    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        var spawnerData = new ParticleSpawnerData
        {
            prefabObject = conversionSystem.GetPrimaryEntity(particlePrefab),
            particlesPerSecond = particlesPerSecond,
            particlesLifetime = particlesLifetime,
            stickToParent = stickToParent
        };
        dstManager.AddComponentData(entity, spawnerData);
    }
}
safe lintel
#

im surprised that doesnt give an error if the spawner.prefabObject is the same prefab as it should already have the ParticleData and a LocalToWorld

golden heron
#

yeeah i thought it was wierd too... but take away the add component, and they have nothing...

#

the system is simply copied from my ship spawner.... which the only difference is that the ship spawner destroys itself.

#

If that made a difference, i should still get one particle on the first frame at least, i guess

#
for (int i = 0; i < spawner.Ecount; i++)
            {
                for (int i2 = 0; i2 < spawner.EcountRows; i2++)
                {
                    var instance = CommandBuffer.Instantiate(spawner.prefabObject);
                    var pos = math.transform(location.Value, new float3(i, 0, i2));
                    CommandBuffer.SetComponent(instance, new Translation { Value = pos });
                    float x = 0; //rnd.Next(0, 10) - 5;
                    float y = 0; //rnd.Next(0, 10) - 5;
                    float z = 0; //rnd.Next(0, 10) - 5;
                    AISeedTracker.Ais += 1;
                    System.Random rnd = new System.Random(AISeedTracker.Ais);
                    int seed = rnd.Next(0, 2147483645);
                    CommandBuffer.SetComponent(instance, new MoverData { velocity = new float3(x, y, z), maxSpeed = 20 });
                    CommandBuffer.SetComponent(instance, new UniverseShipAIData { seed = seed });
                }
            }
            CommandBuffer.DestroyEntity(entity);
#

this is the other spawner... almost identical.

safe lintel
#

is this a prefab in a prefab for the ParticleSpawnerProxy?

golden heron
#

ffs...

#

think i found the issue.

#

no i didnt i suck hehe

safe lintel
#

๐Ÿ˜„

golden heron
#

I cant understand it, two identical systems, but one works and the other doesnt...

safe lintel
#

its not the nesting?

golden heron
#

nesting?

#

What do you mean @safe lintel ?

#

Im completely stuck.

#

ive even tested spawning the particle with the usual ship spawner.

#

works fine, and, i can spawn the ship with the particle spawner, but i cant spawn the particles and the ships both at once. Well, if i do, it works, but the entities have no mesh.

safe lintel
#

ah thats super strange you can do either one or the other in each others system but not the way you intended

#

i thought it was a nesting issue with the prefab references but im out of ideas ๐Ÿ˜ฆ

winter veldt
#

@golden heron is the working test on the same project? i was trying to figure out why my stuff wasn't loading, turned out i didn't import the hybrid renderer package

#

it was a similar issue too, if you don't have hybrid imported, no conversion added a mesh renderer

golden heron
#

same project

#

during testing both systems still existed.

#

all i did was swap the prefabs around

#

all i want to do, atm, is be able to spawn from more than one system, and, to be able to keep spawning...

#

it makes no sense ๐Ÿ˜ฆ

#

the system is in fact nested in the prefab, but even when i ran them side by side it still failed

winter veldt
#

hrm, so 2 systems spawning the same prefab? i haven't tried that yet

golden heron
#

no

#

two seperate systems, duplicated from the same code, now provided with independent appropriate data and files, including seperate prefabs, now failing to work alongside each other.

#

the particle system ends up ripping off the meshes, or, its beginning to look like if i run them together its creating an empty entity rather than actually converting the one i give it, which, the other system is using fine.

#

so.. progress

#

i got them spawning seperately.

#

I do, however, now need to figure out how to overcome what seems to be the issue when i have the spawner attached to my ship, and attempt to move its entity around, using standard parenting. It appears, according to the internets, that this method...

#
public void DeclareReferencedPrefabs(List<GameObject> gameObjects)
    {
        gameObjects.Add(particlePrefab);
    }
#

frm the proxy script isnt being called, due to the nesting.

safe lintel
#

ahh as i thought

golden heron
#

Is there some way to call this manually on child objects? Or, to place the prefab on the parent entity, maybe, and have it be called there?

#

beets hed agenst wall

safe lintel
#

ive just put them on the main prefab, i think it might be possible if you were to dig into the convert script to mess around with traversing the hierarchy but thats too much for a possibility for myself

golden heron
#

Its starting to seem it might just be easier to make a gameobject particle system just follow the damn ship hehe but that defeats the point of this.

safe lintel
#

I kinda hope these things get sorted out in the (near)future, the roadmap for this is still super vague/non existent

golden heron
#

yeah

#

far too much fumbling in the dark.

safe lintel
#

yeah i had problems nesting prefab refs when trying to come up with a destruction system, kinda gave up on it for the moment due to that peculiarity

golden heron
#

i stopped enjoying that when i stopped going to nightclubs hehe

#

Well, i was intending a method of having the hiearchy consisting of a group of objects, each with its own heath.

#

Dont know how that'll end up now, but, to be honest, i could do that in oldschool monobehaviours, its the universe ships i need ecs for

#

goes to cry quietly in a corner hehe

urban rivet
#

Prefab variants aren't the time saver they're promising to be in real world projects, at least mine.

#

End up micro managing and making mistakes

safe lintel
#

its not so much a variant problem, more of a nesting ecs problem

golden heron
#

Yeah, an object is nested in a hiearchy, during its conversion... damn... I just had a damnably daft idea...

#

You can call methods? those overrides replace methods? Only thing missing is an event trigger, basically>

#

?

#

Can you call the method manually in the convert function?

#

Or, at least move its code there?

safe lintel
#

if you figure out a way, do share ๐Ÿ˜ƒ

golden heron
#

Well, its quite simple...

#

The code in the function not being called, can it be moved into the convert part? That seems to work, i get all my ints and floats properly

#

Ill try when i finish my cigarette.

#

It needs the input list reference :(

#

I am gonna look at finding that list

gusty comet
#

I'm using the new Unity Physics package with ECS but for some reason the entities I'm creating (with EntityManager.CreateEntity) are invisible despite adding or setting the RenderMesh to it (with a material and mesh). I can even Debug.Log(EntityManager.GetSharedComponentData<RenderMesh>(entity).mesh.name) and it outputs the mesh name correctly
They're appearing in the Entity Debugger

safe lintel
#

do you have a localtoworld along with translation and rotation(not sure if those two are needed but might as well add em if not already there)

cunning perch
#

Did you add the hybrid renderer package?

mystic mountain
#

Anyone know where I could find examples/point me in the direction of the ideal way to deal with pairs of entities that needs to check some data vs each other?

mystic mountain
#

I feel like I always end up in these situations where I have like one Entity, keeping track of a second entity, and then need data from both to do something, like Collider from A, and damage from B.

#

One way I guess would be to add the data needed to a component on the second entity and calculate everything from that component and entity...

#

And since Collider is hybrid Object in this case, the easiest way would actually be to add a WriteDamageBackData to the second Entity with reference to the first Entity to write the info back to a component on Entity A, and then do the calculation... some messy stuff ._.

winter veldt
#

you can link entities, but i am also at a loss as to a good way to figure out this stuff.

#

it would be nice if there was a way to just have the linked entityB saved as a ref in entityA, and then be able to say something like GetComponentsFor(entityB) or something

#

as is, i've done it, but seems like it's pulling a lot of data for 1 thing... my example would be a timer. i wanted it possible to link multiple action entities to the same timers, in case i wanted everything to run in the same time-frame. so a moveTo entity links to a timer entity. to get the actual timer component, i send timers = GetComponentDataFromEntity<Timer>(true); through to the job, and use timers[moveTo.timerEntity] to get the actual value for that timer. seems strange to get ALL timers then find one entity, but it works.

#

that said.. i just got my guy moving! progresssssssss!

amber flicker
#

GetComponentDataFromEntity's just a pointer though right? So you don't 'get' all the timers - the issue is more that if a chunk has just filled the l1 cache, going off and getting timeres[moveTo.timerEntity] causes a cache miss mid-chunk-iteration- at least that's my understanding - would like to be corrected if wrong!

winter veldt
#

we'll just say that's over my head at this point, but if there's a better way to do it, let me know! i'm just learning this stuff.

amber flicker
#

That's the way I do things and I think for now it's the best way (that I know of anyway!)

#

There is one trick I do though which from benchmarking I think mildly helps with large numbers.... which is let's say you had 5 timers for one entity but only one was active at a time, have a 'current timer' component that sits on the entity and is populated (copied from one of your other entities), when it becomes active... then when you iterate over that entity the data is linearly there

soft mist
#

@mystic mountain Try decoupling the entities by using a manager that both register to.

winter veldt
#

@amber flicker added an active tag to things to state the actions and timers currently running. now not only do i have movement, but chain-able actions... which is what i was looking to do. thanks!

dull copper
#

I don't get it, why they keep updating the old version, afaik this isn't DOTS version either

#

I can't see any way to create new assets with this to check it for sure, it only has blank editor window now

#

but it doesn't have Entities as dependencies so it's probably not a DOTS thing

winter veldt
#

yeah i feel like that was an old thing that's been coming for a while. DOTS visual scripting would be great tho

#

i feel like it might have been one of those.. purchased and implemented in core things?

dull copper
#

I still don't get why they keep updating the old thing if it's never going to be released

#

I guess they could still update the framework if it's resusable

winter veldt
#

yeah, but if it's something that's been in the pipeline for a while, seems a shame to drop it when it can be of some use

#

hopefully. i'm looking forward to seen the editor for DOTS

safe lintel
#

maybe its just the visual editor gui part and the actual nodes are in another package

#

did you try the dots animation package 0lento?

dull copper
#

only installed it to see the menu entries

#

never tried it

#

I don't really plan to do much rendering on DOTS at this stage

#

would love to but it's just too raw for production right now

#

maybe in few years :p

safe lintel
#

yeah its kinda a rocky road, was hoping you had figured out the clip/rig conversion

dull copper
#

I have another project that could benefit from megacity style streaming

#

but it's not active project right now

worn stag
#

new DOTS datapipeline is using this old vs editor still

safe lintel
#

huh

winter veldt
#

is there a way to send an array of entities from an entityquery to a job? i specifically want a list of entities with componentA but without componentB

stuck saffron
#

EntityQueryDesc has All, Any, and None. You can then use m_QueryGroup.ToEntityArray(Allocator.TmpJob) inside OnUpdate() and pass it into the job

        // m_QueryGroup is of EntityQuery class
        m_QueryGroup = GetEntityQuery(new EntityQueryDesc
        {
            // Entity MUST have these components
            All = new ComponentType[] { ComponentType.ReadWrite<ComponentTypeGoesHere>() }, 

            // Entity CAN have these components
            Any = new ComponentType[] { ComponentType.ReadWrite<ComponentTypeGoesHere>() },

            // Entity CAN'T have these components
            None = new ComponentType[] { ComponentType.ReadWrite<ComponentTypeGoesHere>() }
        });
#

You can specify if the components are ReadOnly, ReadWrite

#

You don't have to use the Any or None

winter veldt
#

ah i'm running to the issue of setting them read only.

stuck saffron
#

Also, you can do m_QueryGroup.ToEntityArray(Allocator.TmpJob, out JobHandle jobHandle) which you can pass the jobhandle as a dependency to the job. Or call .Complete() on it to make sure it finishes before scheduling the job

#

Hopefully that helps and I didn't just completely miss what you were asking

gusty comet
#

@safe lintel adding LocalToWorldProxy didn't fix it

winter veldt
#

@stuck saffron i keep getting "NativeArray Job Iterator must be marked [ReadOnly]" error when i send the entity native array through. i marked it with the [ReadOnly] tag, what else do i need to do?

stuck saffron
#

Where did you mark it as [ReadOnly]?

#

Inside the job?

winter veldt
#

basically everywhere i could think of trying to get rid of the error.

#

i can't make the entityquery readonly can i? i have the elements of the query set using ComponentType.Readonly<Component>()

#

then the nativearray<entity> is marked readonly as well inside the job

stuck saffron
#

Can you post a code snippet?

winter veldt
#

embarassing ๐Ÿ˜› but ok

stuck saffron
#

Haha you can PM if you prefer

safe lintel
#

@gusty comet can you screenshot what the entity looks like in the debugger?

icy matrix
#

whats the difference from using "ref component" and "component" in the entities.foreach?

#

and is there a way to title entities?

safe lintel
#

because structs, all of your IComponentData are value types but using ref allows them to be used like a reference, so any changes you make in ForEach will in a sense stick

#

and by title entities you mean in the debugger or something else?

icy matrix
#

yeah, in the debugger

#

just so i know whats what

safe lintel
#

EntityManager.SetName("name");

#

doesnt work in builds though so you might need the #if UNITY_EDITOR #endifthing

icy matrix
#

ah thanks

gusty comet
#

@safe lintel I figured it out by looking in the debugger at an entity instantiated with a prefab, added RenderBounds, WorldRenderBounds, PerInstanceCullingTag, and LocalToWorld but I'm going to start removing them one by one to figure out what's necessary and what isn't

safe lintel
#

coolio

gusty comet
#

@safe lintel well for reasons I don't understand yet, removing WorldRenderBounds, RenderBounds, & PerInstanceCullingTag, but keeping LocalToWorld and rearranging it so Translation and Rotation were above RenderMesh did it ๐Ÿคท

#

using 2019.2.0a13 with all up-to-date packages btw

#

oh I see, RenderBounds and WorldRenderBounds are getting auto-added now ๐Ÿค”

golden heron
#

Anyone interested in helping me test my new maths library?

#

its an addon the unity.mathematics package, with lots of its missing maths replaced with new Methods! Includes, for example, a new FromToRotation, and all methods are summarised for vstudio autocomplete descriptions

#

@me if interested!

crystal zephyr
#

Hey guys,
just another question. How you accessing data from a different entity or do you have a concept to avoid that? I would to link entities together. Let's say I want to spawn a movement point entity and this should have set it's owner entity. And in a system which is processes the movement point data I need position data from the movement owner entity.
I read about ComponentDataFromEntity<T> which will give you access to a component from another entity. But I also read this is slow.
While I found a post from Joachim Ante, where we suggested to add components to the entities which should receive the event. But will that not ruin the chunk utilization even more?

golden heron
#

ArgumentException: AIMonitorData contains a field of System.Collections.Generic.Queue`1[Unity.Entities.Entity], which is neither primitive nor blittable.

safe lintel
#

my understanding is ComponentDataFromEntity is just a table lookup with the entity as the id

golden heron
#

Oh noes

safe lintel
#

so I would use that and profile performance if things werent going as expected

golden heron
#

any solution for how to use a queue in this case?

safe lintel
#

i mean before I knew to use componentdatafromentity I was plugging an entire array in and iterating until I found the entity as a match so it has to be better than that ๐Ÿ˜ƒ

#

havent used queues sorry

golden heron
#

๐Ÿ˜ฆ

#

i needs dat fifo action!

safe lintel
#

but that sounds like one of the fields is incompatible for its useage?

golden heron
#

yeah

#

but...

#

short of rebuilding arrays of thousands of objects every frame im not sure its gonna be possible...

ember moth
#

After the change from UnityEngine.Quaternion to Mathematics.quaternion I am kinda lost.
Can someone hint me towards how to move an entity based on its rotation and translation? Or based on camera direction.

stuck saffron
#

You can do something like newPos = translation.Value + (deltaTime * speed) + math.forward(rotation.Value) or pass the camera rotation into the job instead of using rotation.Value. And then assign it to the translation

#

in the job

potent cape
#

Hey guys.... my brain hurts i try to do AABB collision detection within a IJobParallelFor

public struct AABBCollisionJob : IJobParallelFor
    {
        [ReadOnly] public NativeArray<IdleZombie.Components.AABB> Colliders;
        [ReadOnly] public NativeArray<int> objectindex;
        [ReadOnly] public NativeArray<Entity> allEntites;
        public void Execute(int i)
        {
            for (int j = 0; j < Colliders.Length; j++)
            {
                if (j != i && IZPhysics.Intersect(Colliders[i], Colliders[j]))
                {
                    // DELETE ENTITY ?!?               }
            }
        }

As you see i want to remove the entity on collission. I cant remove it in the job as it seems, because you can't add a EntityManager in the job. How do i send a signal outside to remove it? Is there any way?

stuck saffron
#

You can pass in an entity command buffer

#

So something like public EntityCommandBuffer.Concurrent commandBuffer; in your job

potent cape
#

Ahhh I see... I'll check it out tomorrow. For now is sleeping time. Thanks @stuck saffron

kindred compass
dry nymph
#

@potent cape

  1. I think you will need to use disable parallel for restriction (to allow accessing all indexes)
  2. You only need to loop over j = i + 1 (do not check same pair twice)
  3. command buffer
potent cape
#

yes @dry nymph ?

dry nymph
#

i edited above...

potent cape
#

ah ok ๐Ÿ˜ƒ

#
  1. ummm i don't really understand what you mean? like not using the ParallelFor and just For?
  2. yeah... i realized that after posting yesterday too ๐Ÿ˜…
  3. thanks again ๐Ÿ˜ƒ
dry nymph
#

1 - [NativeDisableParallelForRestriction] attribute on the Colliders array

golden heron
#

@ember moth i wrote some extra maths functions i could do with testing, covers your use case by adding in a fromto using direction vectors, and you can use the lookrotation of quaternions with it.

#

Let me know if you'd lile to test, if anyone would like to - it handles a lot of basic maths stuff unity usually does but in float3, float2, and unity.mathematics.quaternion especially for ecs.

#

And, any suggestions for additional functions to add would be greatly appreciated - i want to make maths for ecs great again! hehe Also, it inlines properly too, so nice and efficient.

#

I also intend to make it very programmer friendly, when you pop up the vstudio autocomplete, it'll give full details, inclusive of the method's use, if i can help it.

golden heron
#
//This is line 27 and 28,
        AIMonitorData monitorData = EntityManager.GetComponentData<AIMonitorData>(monitor);
        monitorData.entities = new NativeQueue<Entity>(Allocator.Persistent);
#
//-----------------First file, ComponentData
public struct AIMonitorData : IComponentData
{
    public NativeQueue<Entity> entities;
}

//-----------------New File, for proxy
[RequiresEntityConversion]
public class AIMonitorProxy : MonoBehaviour, IConvertGameObjectToEntity
{
    NativeQueue<Entity> entities = new NativeQueue<Entity>(Allocator.Persistent);
    private AIMonitorData GetData()
    {
        AIMonitorData data = new AIMonitorData();
        data.entities = entities;
        return data;
    }
    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        var data = GetData();
        dstManager.AddComponentData(entity, data);
    }
}

#

Any ideas why im getting an allocation error (which is what i assume is happening) on the entities NativeQueue ? The line (27) is attempting to access the queue, in the system, i have solved the longer term effect of the error, in such that it only appears once, and on the systems creation, it fixes the allocation, but it still leaves me with an ugly red error...

amber flicker
#

It looks like it isn't yet supported for a NativeQueue to be a property of IComponentData

safe lintel
#

not sure if tyou will ever be able to put native stuff in pure components

dusk relic
#

Hey, how can I add classic MeshRenderer component to an entity?

amber flicker
#

@dusk relic that doesn't make much sense - what you can do is add a RenderMesh component if you import the hybrid render package

dusk relic
#

Yeah, that being said one user on unity forums discovered that MeshRenderer is far faster than RenderMesh if the mesh is different on each instance

amber flicker
#

yea I think I know the post you're referring to - you have to be mindful that each RenderMesh is a shared component and will break chunks up accordingly - you may be better off with gameobjects with many different meshes

dusk relic
#

Hmm yeah, the thing is that creating GameObjects and doing calculations on them is awfully slow

#

However I know there is a way to add MeshRenderer, I just don't knopw how to

amber flicker
#

ok so you can probably add it as a component object

#

so AddComponentObject(theMeshRenderComponent)

dusk relic
#

oh great thank you

amber flicker
#

I've not tried it - not sure how it would get it's position etc... if you're after pure speed you may prefer to send buffers to gpu somewhat directly

dusk relic
#

I had a look on that one, but then I would not be able to have colliders right?

amber flicker
#

I don't see why not?

dusk relic
#

Uhm

#

You can do collision detection on the gpu on unity?

amber flicker
#

no but you can just have gameobjects + colliders or entities + ecs physics colliders and then build an array of the resulting matrixes with the meshes you want .. no?

dusk relic
#

Oh yeah, that sounds pretty nice I didn't come to think of that, thanks again

amber flicker
#

No problem - good luck ๐Ÿ‘

dusk relic
#

Thanks, I will need it

coarse turtle
#

hmm, has anyone tried to use a blob before in ecs? I'm trying to find an example since I'd like try and convert some sharedcomponentdatas to a blob asset instead

safe lintel
#

afaik theres not any official documentation on creating blob assets

coarse turtle
#

yea - I was hoping there was some obscure example I could find so I can get started exploring it ๐Ÿค”

safe lintel
#

hey Timboc do you have any links to the RenderMesh performance thing regarding many different meshes?

#

that is a gut punch as I really wanted to make destruction a feature with ecs ๐Ÿ˜ฆ

urban rivet
#

render mesh perf with different meshes is really "does SRP batching work with this?"

#

and do you really need different meshes or that amount of accuracy? I mean it's always going to be a problem doing destruction for any software

#

(I'm also tackling destruction)

safe lintel
#

dont need destruction at all, but it does add an extra element of fun

urban rivet
#

same, I'm doing the old all or nothing approach at the moment with some "hidden bits that were always there that smash off"

#

i can afford the draw calls having basic destruction on env there all the time, but for small objects i just swap them with broken version and send bits flying

safe lintel
#

the further i get the more I think I shouldve stayed in monobehaviour land

urban rivet
#

i recommend dots for actual production in constrained titles that really need it like rts or 2d

#

for general games i think we really do need the full dots editor and another year on top

#

until then... we can still benefit from it

#

it can accelerate our rendering of environments for sure, for example culling. drawing, all these should be fast enough that you can run your game in mono land but handle the rendering of lots of bits in ecs land

#

for this title i'm just going to see if Unity can accelerate a largely monobehaviour based game by rendering the level itself more efficiently, ie unity's own internal optimisations

#

maybe audio too? i dunno

#

I'm definately not going full in on it

safe lintel
#

i still want to go full tilt, audio and animation are really the two big keys that are holding me back and assuming the stars align, preview packages will be released sometime this year

#

but

#

i thought i could have my cake and eat it with destruction, it makes sense why there would be a slowdown

urban rivet
#

the destruction thing should be possible - afaik unity have a ring buffer for meshes etc

#

should be super high perf to calculate the destruction then generate the meshes, but I don't know how far along unity is with their api for mesh manipulation with ecs

#

its the intention you can do this though

#

it's not much different to streaming in 200k things on main thread under 0.2ms

safe lintel
#

not sure what a ring buffer is, but I was just using that nvidia blast plugin someone ported to unity

#

meshes premade in editor

urban rivet
#

I see

#

if you're doing premade, what's the problem?

safe lintel
#

but i had a hell of a slowdown with point lights

#

not sure at the end of the day if it was hdrp, my use case or ecs

urban rivet
#

this is with SRP?

#

ah hdrp

#

in HDRP with how many?

safe lintel
#

give or take 1k unique meshes, only like 6 or 7 point lights were slowing things down

urban rivet
#

what did ECS frame time look like? it should show it on the debugger

#

did you turn off safety checks?

safe lintel
#

it was under the renderpipeline part of the debugger which was the slowdown

urban rivet
#

this is just using hybridrenderer?

safe lintel
#

yeah hybridrenderer and hdrp

urban rivet
#

huh... hmmm thats 100% supported :/

#

dare I ask how many objects? :D

#

1k shit i'm reading up sorry

safe lintel
#

i think like 1k unique meshes and more from multiple instances

urban rivet
#

6-7 point lights with HDRP (which is deferred by default) is nothing

#

for 1k meshes

#

(with mono)

#

I push way more at 60fps 4k res

#

with monobehaviour

#

on 4 year old hw

#

so this is good news though, it means you're probably just blocked somewhere

tawdry tree
#

I was about to say, it sounds to me like this might not be a graphical issue, but rather CPU. Have you profiled, thelebaron? If you have premade models that you spawn in on destruction using ECS, you should be able to wreck a lot of stuff before you wreck your FPS, I believe. Though, in my experience lighting related lag (if it's that) can often be fixed by toning down what casts and receives shadows.

safe lintel
#

i do believe it was a shadow issue with the emissive radius setting

#

disabling shadows for those chunks isnt really ideal though but i guess more investigating is waranted

golden heron
#

@amber flicker @safe lintel i dont think thats really true, about the nativecontainers not being compatible - it appears that the only limitation is that the initial struct construction cannot have its value set in a proxy properly, but the initialisation of the nativecontainer in a system works(with the container being present on the componentdata)

tawdry tree
#

Does it really lose visual fidelity that much from turning of shadows on those?
Is this casting and/or receiving shadows?
Unless you're going for crazy photorealism, something like destruction chunks, which are there for 'juice' and probably won't be on screen for very long and is not something the player would normally focus on, are exactly the kind of things where you can easily 'cheat' and do the easy way and get away with it, visually speaking.

safe lintel
#

Well I wasn't doing any swapping of unbroken to broken, the chunks just form the entirety of the model and get enabled by physics when they take damage

tawdry tree
#

Ah, yeah that sounds... suboptimal

golden heron
#

When you make a system, can you put private and public variables into it like a normal class? Will that then persist through frames?

amber flicker
#

sure - useful for creating native collections and sharing them between systems

tawdry tree
#

You can, but AFAIK it's not considered good practice for pure ECS.
The usual rule of thumb applies though: If it makes your code better (easier to make/read/maintain/whatever is important to you) and there is no reason not to, then go ahead.

golden heron
#

Ok, what would you suggest for a method to gain access to a persistent nativequeue? I need it to be fully persistent, it needs to stay until the system stops running.

#

i need to iterate it in my system, pull out some entities and process them without losing the position in the queue

amber flicker
#

just public NativeQueue<> blah; initialized OnCreate, disposed in OnDestroy or whatever

golden heron
#

ok, in the system itself?

tawdry tree
#

Sounds like this is definitely a case where the rule of thumb applies and you can just put it directly in the system instead of slavishly follow pure ECS

golden heron
#

Yeah, this is a central part - the queue defines what will get processed this frame, so that i can extend the delays between updates.

amber flicker
#

I quite commonly use the pattern System1 - public NativeQueue blah, then in System2 entityManager.GetExistingSystem<System>()` in OnCreate, then in the job of System2 pass through system1.blah

golden heron
#

I dont follow the need for two systems?

amber flicker
#

well... I assumed that was the part you were struggling with? otherwise yes, just simply declare in the system like you would any c#

golden heron
#

my problem i suppose is being self taught, one of the things i never read up on was how overrides work, and so i didnt realise i could put the variables into the outer scope properly, otherwise i likely never would have tried using the component data.

tawdry tree
#

If you realize that's a weak point of yours, I suggest looking up some videos or other information sources about that specifically, they might point out some things you didn't know.

golden heron
#

If anyone does need to put a container in component data, i think i know how you could... If you made a dummy component, like a tag, you could replace the dummy with the real one in the system at the same point you initialise its array. Judging by how i only got an error during the first frame, that should work i think.

#

I only just realised that was a missing bit of info as i said it, i should certainly read up on it

tawdry tree
#
public class SomeSystem : ComponentSystem
{
  private object _someVariable;
  protected override void OnCreate(){
    _someVariable = new Object(); //As normal
  }
 //remember to dispose any native containers OnDestroy, though
}
golden heron
#

I was thinking that, is the nativecontainer properly disposed by exiting the game?

tawdry tree
#

Preetty sure exiting the game free sup all the memory it used, yeah, but it's good practice to dispose of unmanaged resource you make, where you make them.

#

for that matter, systems can get destroyed even while the game runs and you don't specificalyl tell it to

golden heron
#

yeah, i tend to apply the most appropriate of the allocation types as well, but to be honest being able to forget seems impossible, the compiler is really good at throwing red errors at you if you fail to deallocate hehe

#

Ooh, can i define somehow that i want a system to never be restarted then? Its crucial that the list stays in order and persistent...?

tawdry tree
#

Yeah, they've made a big deal about making things work by default and tell you when you do Bad Stuffโ„ข

golden heron
#

That part at least, is done fairly well. I wish theyd put some more info in the code summaries tho hehe

#

most of those wierd big long named classes and components from ecs say nothing in the summaries

tawdry tree
#

You could just make the variable static? That persists even if the instance is destroyed. Pretty sure people who have strong opinions about that kinda stuff would rip their hair out if they had to interact with your code anyway, but the point of styles is to help the developer develop, so if they become an obstacle, they are no longer useful.

golden heron
#

Yeah, i do like being able to reconsider the styles if needed, where appropriate. What i am trying to do does seem like something which should be supported tho,

#

I just simply want to put all the entities into a queue, those that define my universe's background activity, and let them update their thousands of entities at a rate of like 50 per frame by using the fifo behaviour.

amber flicker
#

(would recommend against static only because you may have issues in-editor - I did at one point)

golden heron
#

If i remember correctly, i tried statics, and the errors came saying they arent supported at all, even when accessing an external class static. I think they are non-thread-safe by nature.

tawdry tree
#

Well, that is true, but I figured this was running on the main thread anyway.
AFAIK the 'pure ECS' way to do this would be to create an entity to hold the data

golden heron
#

That being said, all my processing systems are jobs, but this one is not, it runs on main thread with as minimal activity, runs first, and defines who gets processed.

#

Thats what i was trying to do, thats why i wanted to put the container in a component data

tawdry tree
#

Yeah, that's why I figured it'd run main thread and be able to use static. I do think there are ways to avoid ECS killing your system, too, though I don't know the mechanics good enough to say how.

golden heron
#

An entity is never disposed of unless intentionally directed to be destroyed tho, right? So using an entity which has no other components does seem sensible, Ill try adding the tag instead, then changing the component in on create in the system, see if that works when i get home.

#

It seems, from how the errors acted, that the struct is capable of holding the nativecontainer, it just cant include the allocation part, so it exists if created by a conversion for one frame as an unallocated variable so the system gets upset. I figure i can overcome that with the tag... ill message here to let you know if you like?

tawdry tree
#

I'm not sure what you mean, and I don't particularly need to know your results. Though, if you want to share, here is probably the better place, so more people can see them.

dusk relic
#

Hey, someone have the old MeshInstanceRenderer code?

#

It's not in the package anymore, or I just couldn't find it

golden heron
#

they changed some names of stuff

#

its probably in there under a different name

#

Here is an interesting question...

#

If you have a one - use system, ie, its gonna change one entity once, then never act again - whats the best way to deal with this? if i make the system and then i have it simply stop working when the tag it uses no longer exists, it is still gonna be making an entity query every frame, which is really not necesary... Can i kill the system tho?

#

Like have it properly stop running?

#

Alternately, i could condense the logic into another system's on create?

#

does giving the entity query some OR requirements affect the speed of the query when you exceed 500,000 entities?

dull copper
#

@dusk relic you need to install Hybrid Renderer now and it's renamed to RenderMesh => it still exists

#

the upgrade guides are pretty informative and you usually find what has changed

dusk relic
#

But rendermesh is a component

#

and the system is different now

dull copper
#

they literally renamed MeshInstanceRenderer to RenderMesh

#

systems and implementations evolve a lot on DOTS

#

it's been like that from the beginning

dusk relic
#

Yes, which is why Iโ€™m asking for the old code.

#

The new one is too complicated for my neess

#

needs

dull copper
#

they've actually made it simpler to use now

#

but I guess it depends if "simpler" means you can use your own code still

#

old setup had more boilerplate

#

injects and stuff

dusk relic
#

How is it simpler?

#

However, Iโ€™m just trying to figure out how to get the mesh data to a system, since entities canโ€™t hold mesh component

#

Or shoul i make a shared component which has a mesh field

dull copper
#

data should be in components, not in systems

dusk relic
#

systems operate on data

dull copper
#

I have updated that to latest entities locally, just havent pushed a fork for it

dusk relic
#

You are tertle?

dull copper
#

no

#

I wish I had his ECS knowledge tho ๐Ÿ˜„

dusk relic
#

Me too ๐Ÿ˜ฆ

#

I keep seeing him on the forums

dull copper
#

I just meant that I've updated that mesh demo project myself to run on latest entities, upgraded the few things that needed to change

dusk relic
#

Ah alright.

#

I was also wondering if it would be wise to use an external renderer, since unityโ€™s renderer canโ€™t accept unmanaged data

#

i mean Mesh class

dull copper
#

what I tried to communicate earlier was that components in ECS hold your data and systems hold your code/functions

#

therefore mesh data belongs to components

dusk relic
#

Yeah, each entity has a mesh and I want to render it

#

However I donโ€™t think RenderMesh would be good, tertle had a benchmark which showed that traditional MeshRenderers were faster than MeshInstanceRenderer if the mesh was different on each entity

dull copper
#

that makes sense

#

I dunno if that's even all that different if you draw instanced meshes for each unique mesh even without custom renderer

#

you get the benefits from the instancing and it probably always has some initial overhead

#

but if you don't need duplicates, you don't get those gains

#

I dunno what's their grand plan on ECS rendering, they renamed the MeshInstanceRenderer to RenderMesh despite it's still working the same way, so it suggests they either don't want to separate the instanced vs noninstanced meshes or that they just handle that on the same component in the future etc

flat talon
#

@dusk relic That was only with a low number of meshes. When you have a lot, and especially when you can instance them the hybrid renderer is WAY faster

#

I've done tests with a few hundred thousands meshes just fine

dull copper
#

@flat talon that was the whole point, if you got unique meshes, you don't get instancing gains

#

like, if you got level that mainly got few instances per mesh, you just pay for the initial overhead

#

I can't immediately think any such level tho ๐Ÿ˜„

flat talon
#

I do know that the hybrid renderer is a temporary solution until they have a "pure ecs" renderer, but that is probably a year away or so

dull copper
#

yeah, it's a stepping stone

flat talon
#

(Im just guessing at the time)

dull copper
#

I'd guess the full renderer would be last thing they'd do

#

something we'll see around 2022

flat talon
#

I'm hoping we'll get some nice tools once Tiny C# gets released ๐Ÿ˜ƒ lots of stuff in there

dull copper
#

we can use hybrid already and there are way more important things missing on other systems right now

#

like.. that DOTS editor ๐Ÿ˜„

flat talon
#

yep! I hope we'll see the first version of that once they release Tiny C# ๐Ÿ˜ƒ

dull copper
#

I really really want that editor myself, more than anything

#

I hope we will be pleasantly surprised with the tiny editor actually working with all ECS world components

flat talon
#

I was hoping they'd push out Tiny with the 2019.2 beta, perhaps they are waiting for RTM on that

dull copper
#

I'd be disappointed if they still keep it separate as they said a long time they want to put these closer together

dusk relic
#

But I'm creating procedural meshes, each entity will have a different mesh

flat talon
#

well the workflow for it looks great ๐Ÿ˜ƒ component types as assets, the component groups and all that

dull copper
#

yeah, I really really want that especially, I don't like the conversion oddities at all

flat talon
#

I believe the current workflow for meshes has a lot of memory copies, so it wont be super fast

dull copper
#

it's like making DOTS feel like proper Unity again

#

current setup feels like a big hack

flat talon
#

they'll probably do a new mesh API as well, slowly over the next 2-3 years they're pretty much DOTS-ify the whole engine

#

yeah totally

#

Will be nice to see ECS entities in the scene hierarchy ๐Ÿ˜ƒ

dusk relic
#

Eh.. I'm probably just going to try and write my own engine then

golden heron
#

Anyone fancy offering any suggestions id appreciate it!

#

(My entire setup hinges on me solving this problem, please help!)

#

Oh, and the poll is clearly very important to vote on hehe

flat talon
#

@golden heron Place your queue as a field on your system?

golden heron
#

heya, i replied on teh forum ๐Ÿ˜ƒ

#

(might as well reply there as then itll be possible for people to see any useful answers ๐Ÿ˜ƒ )

ember moth
#

Has AngryBots2 ECS from the GDC 2019 presentation been somewhere released? Could only find Mikes SpaceShooter

worn hedge
#

Lol I just noticed that this isn't the ECS version, forget that link. And it was released before the GDC 2019 presentation as well

safe lintel
#

neat didnt know that was released

safe lintel
#

Nyscersul nested prefab conversion should be in the next entities release(whenever that is)

golden heron
#

Nice thanks

golden heron
#

If i have a reference to an entity in a queue, is it gonna be storing a copy of the entity's data?

#

This is a standard queue, not a NativeQueue

#

Im getting this...

#

ArgumentException: All entities created using EntityCommandBuffer.CreateEntity must be realized via playback(). One of the entities is still deferred (Index: -94).

#

when i store my entity references direct from the spawning system...

solar ridge
#

Mmm Im unsure if you can use the ECB entity indices post playback

#

As it is just storing an int in relation to your queue of commands

#

And storing an entity doesnt store antly component data fyi

#

Storing an entity stores an entity struct that has 2 fields, an index and a version number

#

Also, for your queue question; you can just store a NativeQueue allocated as persistent on system start and dispose on system end. You can then, in jobs or on update use this queue. Just make sure to complete any jobs scheduled PRIOR to disposing. Ie hold a local varaible of the job handle you are using the queue in and complete before disposing

#

@golden heron ^

golden heron
#

Thankyou for the detailed answer...

solar ridge
#

This is how I use persistent queues now

golden heron
#

I tried to use a nativequeue and it seemed to result in the constant deallocation error, in spite of disposing on destroy, it seemed to really dislike its persistence extending beyond a few frames

solar ridge
#

I havent had any problem with it? ๐Ÿค”

golden heron
#

i wasnt doing the complete tho

solar ridge
#

Ah yeah

#

So that'd be why

#

The thread is still doing work

#

Whilst closing

golden heron
#

i dont suppose you have some code i could see how youve laid it out? Maybe copy one of your systems, delete everything except the struct/ethod definition headers and the lines pertaining to allocations of and deallocation of the nativeQueue?

solar ridge
#

Im on my phone atm

golden heron
#

I've been trying to get this working for a week hehe

#

ok, in that case, can i ask your opinion on an alternate idea...

solar ridge
#

Basically: OnCreate() set local nativequeue

#

Update use local queue

#

Destroy job.complete(); dispose queue

#

Easy ๐Ÿ˜Š

golden heron
#

I was thinking of basically iterating over the system's entity array directly, its in a main thread component system. This should be fine?

#

(Thanks ๐Ÿ˜ƒ )

solar ridge
#

System's entity array?

#

For what purpose?

golden heron
#

ill explain in just a sec, brb (sorry)

solar ridge
#

If you are wanting all the things you just spawned, use a tag and then iterate using a foreach job

#

Like, spawn them in with a tag, then after looping, remove those tags

golden heron
#

ok, that sounds cool

#

i was gonna say basically, i havent tried yet, but i was reading that its possible to explore the arrays of data that the ecs system uses to store stuff directly, and that you can then directly access the array of all the entities.

solar ridge
#

Well keep in mind. You get an entity. Now what?

#

You dont have the data. You still need to get that

#

Using a foreachjob would at least have that data

#

And not mem thrashing

golden heron
#

You can use the entity manager to request component data of a certain type from an entity.

solar ridge
#

You can. But it wouldnt scale well

golden heron
#

You only need the entity reference to get everything, if you are in a component system anyways

#

you mean scale well as in it would be slow

#

?

solar ridge
#

Meaning that you are putting a lot of work on main thread

#

As well as not gaining the performance of the memory layout still

golden heron
#

Ah, no, hang on a sec... i havent explained exactly why im trying to do this

solar ridge
#

That would be nice

golden heron
#

sorry hehe

#

its basically a simulation of a universe, where 95% of the systems contain no players, and, as such, can be updated at a much less frequent rate, whilst entities inside player occupied systems would update every frame. The entities in the systems without players are unrendered, and never seen, so, even 5 seconds between updates is acceptable, assuming that the move is both interpolated, and steps are taken not to overshoot the destination.

#

So, this component system needs to pick and add a tag to a small number of the thousands of ai ships which would be moving around, trading, mining, to produce the games economy.

#

So, the component systems job is to tag its chosen ships for processing, in as quick and simple a way as possible.

solar ridge
#

JobForeach is still your ideal companion here me thinks

golden heron
#

everything else, movement, turning, ai choices, thats all done in jobs in the chunk system

#

a small job where each job is a single entity getting its tag added? or a single job which iterates them all and does it all at once?

solar ridge
#

I usually for somethinglike this: have a foreachjob select what I want and add them to a queue, the pass that queue after the selection job is done and handle them as needed

#

Selection job usually is a ForEachJob for data filtering and the manipulation job is just a normal IJob

#

The reason

#

I can select what datatypes I am filtering for then also use that data to filter it further

#

Ie: TaskData{ =idle} add to my queue

#

I want them all to do something

golden heron
#

listens carewfully

solar ridge
#

The point that you are isolating down to a local scooe usually something has gone wrong in a system design

#

By that I mean , I want to handle these objects constantly

#

Or in this case GIVE ME ALL ENTITIES

#

That is not a good plan if you are opting to not use the reason ECS is good

#

The more you can do in jobs the better

#

No matter how silly it may seem

#

Filtering, selecting entites you can do a number of ways

#

EntityQueries, Looping over entities matching tags in a job, etc

golden heron
#

Well, i was thinking partly that the nature of my systems might be more stable if i am able to force the system to do this part (the choosing what to process) on the main thread, whilst it has other jobs which do not affect the same entities are running, like some of the systems ill end up with relating to player's system's maybe.

#

Like, i could run the jobs for the particle systems im planning, then the component system without having set the dependencies ?

solar ridge
#

If you halt main thread you halt the game.

The job scheduling will handle the overlaps fine

#

Ie I have a system for moving my ships forward 10

golden heron
#

would that mean the main thread pushes on, or will it wait for each system to do ALL the systems work before the next system starts?

solar ridge
#

Then another system moving my ships right 2

#

Schedule these both it will know about the data overlap

#

If marked readonly it will pair them up best it can

#

If I am only reading data then all jobs read only of the data could in theory be ran in the same time interval and it will do it for you

#

But it would do all of this on separate threads

#

So the system starting is like .1 ms?

#

Or lower

#

As the tine it takes is how ever long the scheduler takes

golden heron
#

so, it doesnt wait for each system's jobs to finish before starting the next system, but, it does check each job's data dependencies will allow the apropriate access at the time the job starts, before it allows it to complete?

solar ridge
#

Should be

#

I havent run into data overlap issues yet

#

Nor timing issues

#

And I had a simulation of 200k cubes rotating and orbiting a central point

#

Only possible with jobs

golden heron
#

so if i wrote five systems, each system working on different entities and different data, then ran it, and was able to see the order the jobs completed, you'd find some jobs from system 1 ran after system 2, despite being sent to the stack before, but, if the data and entities are all the same, and dependencies are such that say system 1 is read-write, system 2 is readonly and system 3 is readwrite, i imagine they wouldnt overlap, theyd all run system 1, then 2 then 3?

#

oops, edits...

solar spire
#

you can see the order the jobs complete in the profiler under Timeline can't you?

solar ridge
#

If. They are sequential in nature and you need them to work in an order. Put them in the same system

golden heron
#

i didnt know that... ill explore that suggestion, thanks, vertx

solar ridge
#

Otherwise the order will be determined runtime iirc

solar spire
#

I've not done much ECS, but you can definitely see jobs executing in the Timeline view normally, so I assume it's the same ๐Ÿคท

solar ridge
#

All systems written ALMOST should be independent of other systems

#

Ie I turn one off others woukdnt die

golden heron
#

Also, i havent seen this mentioned, but its kind of suggested - we can assume that the system orders all jobs to complete before the end of a frame?

solar ridge
#

No

golden heron
#

so jobs can last beyond the end of a frame?

solar ridge
#

To some extent. They SHOULDNT atm last too long. But Id recommend if you have a long job, call complete if using a persistent native container before scheduling a new job

#

Ive had a job run for 3 frames as it needed to

golden heron
#

Ok, so generally its unlikely, but just in case be wary of large blocks of processing in the same job, i guess

solar ridge
#

So in the csse of jobs thst are handling data it is ok to schedule another job

golden heron
#

so did that job need to be using something like yield? or was it just locking up a secondary processor on a worker thread?

solar ridge
#

The point I am making here is the natve queue idea would break if you were to be say unloading from your prev job

#

And your nee job started loading to it

golden heron
#

exactly what happens is this...

#

it dequeues,

#

it adds to another seperate container...

#

it immediately requeues, in the same scope, function, method, even the same if conditional hehe

solar ridge
#

...why requeue it?

golden heron
#

this queue represents the list of ships being processed.

#

take it out of the bottom, process, (mnove/turn/think) then pop it back in the top and do the rest.

#

its intended to make the system robustly able to scale its delays depending on the number of ships

solar ridge
#

I could be wrong but that isnt really Data driven ? As you have a list of these ships already? The entities component data themselves . Requeuing them sounds opposite of scaleable. But what ever works

golden heron
#

(By the way, thanks for your patience, and help @solar ridge )

#

i need to keep some kind of way of knowing which one of the ships is next to be processed data driven would have me accessing the entire array of entitys per frame

solar ridge
#

Which is actually fine to do

golden heron
#

i'd need to check values of timers

solar ridge
#

Totally fine

golden heron
#

thats what i was doing first, then i was told that was bad...

solar ridge
#

Again you are in thread n land

golden heron
#

hmmm... gimme a sec

solar ridge
#

Because in your queue system. A new ship is added. They get added to a weird part in the queue

#

Not necessarily the last ship

golden heron
#

doesnt that break the fifo rules?

solar ridge
#

What I am saying is: ship 1 goes not is at the end of the queue

#

I add ship 5 I now have 2 3 4 1 5

#

Which may be important based on what is going on

golden heron
#

well, if it means ship 5 gets processed more often....

#

Hmm...

solar ridge
#

But your scaling means that you jow have this massive queue of all ships

#

For what purpose?

#

As you should not really use any time in main theead to grab data

golden heron
#

im trying to find a copy of my original system a sec

solar ridge
#

Main thread should be for passing info to jobs and little work as possible

#

Unavoidable with somethings

golden heron
#

this is an older version of the system

#

actually... you know ill just rewrite it, and past that...

#

that system is broke hehe

#

(have a look if you like tho)

solar ridge
#

Err. TimerData each frame add using IForEachJob

#

Another job readonly to check for time desired

golden heron
#

ie, dont use chunks

#

?

solar ridge
#

I dont see why chunks would be necessary here

golden heron
#

its just the format i wrote everything else in

solar ridge
#

As the foreach is a less boiler plste variant

#

And gives ref variables

golden heron
#

ref?

solar ridge
#

Execute(ref TimerData data)

#

Then you can set the data

golden heron
#

so it gives a shortcut rather than a cope

#

*copy

solar ridge
#

dats.Value += deltaTime

#

Then another job for checking if your times are usable

#

Keep in mind the ForEachEntity variant

#

If you need the entity

#

Inneed sleep now. I wish you luck

golden heron
#

ok, thanks for help! Sleep well!

golden heron
#
World.Active.GetExistingSystem<AISchedulerSystem>().totalShips = 1;
#

is this safe to use inside a job?

#

(ignore the value, its an example line)

safe lintel
#

is that in your job execute or when you initialise the job?

golden heron
#

in the execute

#

its referencing a dependent system's data

#

system a finished before system b, system a is setting up the data for b

#

@safe lintel

safe lintel
#

i dont think you are supposed to be accessing other systems directly inside jobs

golden heron
#

There must be some sensible way to have the systems pass data independently of the entities?

#

Im trying to have a system count the entities and then work out some timer stuff...

#

maybe do more if it works. Just seems impossible any time i want system a to be able to pass data to system b, it becomes a ballsache.

#

I think im gonna return to the timer checking and just use tags instead of value changing. At least i know i can make that work and not spend the best part of a week without progress - thanks to everyone who has tried to help tho, sorry if i have been dumb! hehe

safe lintel
#

you can pass data around from another system but at time of the job scheduling rather than right inside the job

hollow sorrel
#

is it possible to send events from ecs to monobehaviours without polling? e.g. when an entity changed so monobehaviour UI needs to update, without having to check hascomponent every frame

low tangle
#

polling is faster than you think, but if you want a simple event listener, do the polling in a component system and pop off the event from that

#

sub using the entity as a id in a public dictionary or something

golden heron
#

Thanks @safe lintel

#

@low tangle was that to me? Im trying to use the tags setup to limit the number of entities processed per frame, basically.

low tangle
#

that was @hollow sorrel sorry

#

if your having trouble making a system, you probably just need to rework how you think about the problem

#

oh for your question you really want to use the components/entites as the data between systems

#

its kinda like having all the data out in the open for you to look at later

hollow sorrel
#

ooo i hadnt considered using a dictionary with entity id

#

thanks

low tangle
#

but if you really need to keep data inside a system but get it from another, really just use public fields and in the other systems grab that system using GetOrCreateSystem<>()

#

then keep track of it

#

its kinda like a manual version of the older [inject] api

#

@hollow sorrel entitys implement gethashcode so I've used that int as a key in a hybrid gameobject system

golden heron
#

So you have been accessing the entities directly, june?

hollow sorrel
#

does it matter wether you use the Entity as key vs an int and doing gethashcode

#

dictionary uses gethashcode underneath too right

golden heron
#

Also, with regards to your comment, my requirement is the other way around, to be able to put data into another system before it runs.

low tangle
#

what kind of data

golden heron
#

As an example, say the second system was receiving a count of the entities from the first system. Its more complex what i actually need, but say i wanted to have each job increment a counter in the second system.

#

i say, each job, i mean each entity processed by the previous system.

low tangle
#

@hollow sorrel yeah its the same thing, I just store that int into a component, so instead of keeping a ref, I keep a key (I just needed a unique number to start with)

#

so system 1 needs x
system 2 produces it?

golden heron
#

System 1 takes in all entities, counts them, does some checks of some values, then sends the data to system 2, which uses that data as constraints to define what entities it processes, and how.

low tangle
#

and you cant store all that entity data into a component for the second system to pickup and use as its constraints?

golden heron
#

Part of the data involves a "queue". I have explored both using timers to result in a clunky chunked setup which had each chunk only process 1 entity, that with the longest timer, and also explored trying an actual queue, and a nativequeue, im about to return to the original timer idea and try running some basic stats through to minimise cycles of processing, things like how many entities, whats the longest timer, and so on. The ultime aim is to have a background system of entitys, representing the objects in locations [edit]without players to be able to update less frequently, only say 30-50 per frame most of the time.

#

Ive got all fhe interpolation and stuff going fine.

#

Its just trying to find an effective method of queueing the entities in a persistent way.

#

oops - edits

low tangle
#

in my systems I have to run a peak of around 1m entities all being processed and queued

#

to pull that off I worked with chunk itteration and a Buffer<Entity> for the actual queue

#

ended up simple enough in the end, basically just had to make sure the dumb way it would run would stop instead of overflowing

golden heron
#

ok, can you directly access the array structure that the entities are held in by the system?

low tangle
#

yep

golden heron
#

How so? Where would i start? Some derivation of World.Active?

low tangle
#

inside of a jobchunk

golden heron
#

I probably used the wrong word

low tangle
#

let me pastebin it

golden heron
#

i dont mean the system as in an ecs system, i mean the entire system

low tangle
#

does it need to leave ecs and be accessed from mb?

#

personally I'd still just use a entity with a buffer of entitys on it acting as a easy to get to queue

golden heron
#

no, its all work done within the constraints of ecs systems, just want to know if i can access every entity in an array that exists naturally in the system, ie. without copying out

low tangle
#

well yes you can go randomly get something from any entity there is

#

either entitymanager on the main thread or explicit component data type in a job

golden heron
#

Ok, cool, so in a job which is scheduled via entity queries, onupdate is called once per matching entity/chunk? So its not a reliable place in those style jobs for stuff you want to run once per frame across everything?

low tangle
#

they most certainty will one once per everything

#

thats what the jobs running on a query do

golden heron
#

Hehe i think ima stop asking questions and start some code - thanks :)

low tangle
#

alright have fun

#

let me know if you have more questions

golden heron
#

Thanks :)

#

(I probably will ;) )

#

If a system receives, say, 200 entities matching its query in a system providing one job per entity, and so, 200 jobs, would the onupdate part be reliable in incrementing a counter - assuming the only change in activity affected by the counter was in the same update?

Also...

The onupdate needs to return a job handle, but, is there anything stopping me from setting up two different job structs by different names in the same system which then have different effects?

#

Ie, if counter < max, send first job, else, send second job

#

first job does activity, second job does wait timers and such

low tangle
#

nope you can chain and should chain jobs

#

whatever makes it easier to make your logic work

#
var jobaHandle = new joba{
data fields
}.schedule(this, inputdeps)

var jobbhandle = new jobb{
}.schedule(this, jobaHandle)

return jobbhandle
golden heron
#

cool thanks

#

is there any way to see the data going into the job at the point of creating it? ie, identifying which entity is the subject of the job?

#
        if(shipsActed > 50)
        {
            var jobA = new AISchedulerJob()
            {
                DeltaTime = Time.deltaTime
            };
            return jobA.Schedule(this, inputDependencies);
        }
        else
        {
            bool wait = false;
            var job = new AISchedulerJob()
            {
                DeltaTime = Time.deltaTime
            };
            return job.Schedule(this, inputDependencies);
        }

I have this, but i want to check the component data to see what its timer is to know which job it needs to go into

low tangle
#

for the shipsActed value?

golden heron
#

no, its independent timer

low tangle
#

if you have a stored reference to the entity just grab the data though the entity manager

#

also you dont need the () if your field initalizing a object with {}

golden heron
#

but i dont have that reference? how can i get it here? the ai scheduler that drives the selection of the entity in the first place, the component, contains its own entity reference, so if i could just see the data that goes into the job

low tangle
#

they are two different ways of constructing a object

golden heron
#

I get you ill remove the ()

low tangle
#

oh I see, so your trying to look at a component then branch based on a value in it, to run another job?

golden heron
#

yes

low tangle
#

why cant you have both bits of logic in the same job

golden heron
#

intention is to be if timer = top 10% then process, otherwise if remaining ships to process is equal to the remaining ships, itll just process all the remainder

#

i was trying to minimise the jobs... if i can branch it, my "wait" job becomes...

low tangle
#

you shouldn't need to minimise jobs

golden heron
#
    struct AISchedulerWaitJob : IJobForEach<AISchedulerData>
    {
        public float DeltaTime;
        public void Execute(ref AISchedulerData AI)
        {
            AI.timer += DeltaTime;
        }
    }```
low tangle
#

you just need to look at overall job time if you are meeting your frametime budget or not

#

okay so you have tons of float based timers that increase

golden heron
#

so, forget about the branch if i need to see the data? put the branch in one job

low tangle
#

then you need to run afterwards and look at the timers

#

to decide what you should do

#

likely you will be able to 'do it all' while looking at all of the timers

golden heron
#

Yeah, the timers serve a dual purpose - later systems also use them to correctly interpolate the movement for an arbitrary delay

#

ok, so its basically back to my first design... :/

#

Thanks for the help tho ๐Ÿ˜ƒ

low tangle
#

well its really hard for me to understand what you are trying to acheve

golden heron
#

Apologies, if it helps...

low tangle
#

systems are byproducts of what you want to achieve using the data you have (or will create)

#

I tend to write out the logic and events in a document, figure out the simplest flow for what I want to happen. then start deriving component types from how things need to look for me to run simple querys on it

golden heron
#

Its a space game, a universe, where only the systems containing players are rendered, and in view, everything else moves around in the background, and so can be updated infrequently to save processing, even as slow as once every five seconds per entity, as long as steps are taken not to overshoot the destination.

low tangle
#

why are you trying to save processing? did you actually run into performance problems?

golden heron
#

Because my final aim is to run multiple concurrent physics simulations depicting the multiple systems containing players, its for a server of an mmo game

low tangle
#

how do you plan on running the physics sim, custom or the new ecs physics?

golden heron
#

custom. Its gonna be handcoded minimal newtonian physics

low tangle
#

good choice

golden heron
#

๐Ÿ˜ƒ

#

The scale tho...

low tangle
#

well I'd say your going to need to very very cleanly make the component data state be as opaque as possible

#

because you either have to go full ecs, or have it mirror the actual physics sim world

golden heron
#

i want over a thousand solar systems, each requiring "maintenance" on planetary orbits, ships to be moved, and attacks to be worked out. eventually, there could be 20,000 or more background objects to move, easily, if i achieve what i want

#

hence why this is important

low tangle
#

well thats actually not even really a problem for ecs scale at all

#

like I said before, I process over 1m entities for a single system @1000 player target for my game

golden heron
#

itis when you are also running the communications requirements for alll the connected players of an mmo ๐Ÿ˜‰

low tangle
#

at roughly 8ms on the server

golden heron
#

Well, not a problem, but a concen

#

*concern

low tangle
#

I already push much more data I promise you

golden heron
#

I also dont have the fastest pc to get the project started with

low tangle
#

one of the best things about ecs is jobs on servers, that automatic balancing and multithreading does wonders for server cpus which have tons of cores, but not as fast per each

#

my dev machine only has 4c, but our servers we typically use have 8+ meaning it runs x2 faster by default

#

or x2 the cpu time to use as well

#

that extra budget is insane as well when it comes to raw pushing more and more systems and entities

#

1,001,109 entities, this is one of the benchmarks I run

safe lintel
#

what does your system queue look like? kinda curious how many systems manage that many entities

low tangle
#

well I can't exactly show most of this stuff because of competitors (were a few weeks from releasing right now)

safe lintel
#

ok np

low tangle
#

it does really good, but a lot of time at the scale ecs is letting me run at

#

most stuff just doesnt scale up to this number of things

#

like I'll pull a pdf of a technique and it works well at a couple of thousand, but scale up 10 - 1000x and it just dies

#

seems to take a few days to work out the single ecs way that pulls off the right performance

#

the system in question here I've tried to redo about 3 times now, and even with newer ideas its still isn't any faster

#

even with a full new way of logic / thinking of it

#

also main thread foreach's are dirt slow past 1000 entities in a query

quick stream
#

I have a bunch of masks being used
and for some reason, they are interfering with masks outside the hierarchy
like
parent
child with mask
child with mask
child
parent
child with mask (doesn't work because of above masks)
child
shouldn't they only be affecting children?
and I do have a valid reason for using masks within masks, so that isn't changing

golden heron
#

Thanks june.... interesting...

#

@low tangle do you have a ready simulation you could benchmark a small change with? I refer to your screen snippet, 159.34ms?

#

Try seeing if it makes any difference using a normal for loop. To the huge number sof entities i mean.

#

My system is taking shape slowly, atm, not able to test yet tho as need to rebuild dependent systems too

low tangle
#

whats funny is that 160ms in one main thread system is only processing 1k entities

#

vrs the jobs running on the 1m

#

that system was just a skeleton I was getting started on testing some logic, its getting removed later. but I'm a bit busy on some vr fullbody logic right now

golden heron
#

Ah ok, no worries :)

#

I'd be interested if you fancied sharing a quick description of your project?

low tangle
#

VR sandbox with gmod and vrchat influence. but all at a larger scale per server (100 players official target but were aiming for 1k on beefy servers)

golden heron
#

Nice, so a rpg/building kinda game?

low tangle
#

trying to build a full collection of all the vr gameplay stuff you expect (guns, weapons, ai ragdoll physics) and cram it into a large sdk kit people can build with

golden heron
#

Oh, isee, thats cool

low tangle
#

that way people can make gamemodes that are full games and players can share super easily

#

while not having to make the entire vr kit for their game

golden heron
#

Would you have any offhand suggestions for good reusable methods i could add to my mathematics package? it currently has a few options, like fromto returning a quaternion from two vectors, for example.

low tangle
#

for the most part, I've found all the method's I've needed in there

golden heron
#

I built it to emulate some of the missing functions from unity.mathematics, it uses the ecs types

low tangle
#

sometimes in the weirdest spots though

#

like I'd expect it to be a extension but its just a static method now

#

I did a ray tracer in it the day before in a few hours and it was 100% mathmatics

#

didn't find other than a single method that wasn't in there

golden heron
#

yeah, it seems easier to offer functionality that way, when you want to offer it without bogging down the objects you are acting on, i think.

low tangle
#

yeah its cleaner and closer to gpu programing

golden heron
#

mine is all statics

low tangle
#

which is super nice

golden heron
#

thats what theybsaid, based on hsls (or whatever the order should be hehe)

#

Hlsl? i dunno hehe

#

So, do you know, offhand, what i would put in if i wanted my component system to directly access the entity arrays? I tried to find it but got stuck. Its a componentsystem, main thread. I wanna try a few things accessing the heirarchy direct, if possible.

#

Specifically not cppying out the data tho, i wanna see if i can avoid the memory allocations there

safe lintel
#

@quick stream are masks IComponentData?

quick stream
#

UI masks

safe lintel
quick stream
#

I tried there but nobody responded after a long time

#

figured this might be a better fit, idk

golden heron
#

Its WORKING!!!

latent walrus
#

Is there anyway to store an entity with components as an asset for later use?

#

Like a scriptable object

solar hill
#

hey so i have come up against an issue. i cant figure out how to have an array inside a component that is then passed into a job. i don't understand why this isn't possible.

#

@latent walrus what do you need to store this entity for?

tawdry tree
#

To add to the above: Do you need to store values as well, or just the list of components?

#

Faldor, are you trying to use SomeType[] arrays or NativeArray<SomeType>?

#

Because the first shouldn't be possible for technical reasons, while the second is very much something you should be able to do.

solar hill
#

well you can't use a native array in a component because it ends up being uninitialized. (Unless it is possible to initialise the native array in the proxy definition). You can't use a normal array unless you make a fixed array which is considered unsafe.

candid willow
#

@tawdry tree What would the solution for be for using <T>[] then? Converting in an array loop?

tawdry tree
#

You'd need to initialize it from a system, probably as you add the component. I haven't done it myself so I don't know exactly how it's done, but it should very much be possible.

solar hill
#

okay, its just a pain, i was just going to set an array of actions for a bunch of entities to perform from the inspector.

#

it seems like it should not be that hard to simply set an array in the inspector, and then use it in a system.

tawdry tree
#

With array of actions, do you mean Action[] or array of some custom type?

dry nymph
#

@solar hill not sure I understand your problem

  • DynamicBuffer ?
  • Scriptable Object that is read by a system (if you want to edit something in the editor?)
solar hill
#

In this case it is just an array of vectors and an array of times for how long to move in that direction

tawdry tree
#

+1 for scriptable objects, as long as you don't particularly need them to change (that much) at runtime

#

So you're doing something like an animation, kinda?

dry nymph
#

but if you want to read it in a job, you have to pass it to a dynamic buffer (or blob, might work with references - i never used this)

solar hill
#

That could work. this is really just a little test project to test the use of arrays in components.

#

i mean it just seems so convoluted. I find it hard to believe that just having an array on a component was not considered a common desire.

tawdry tree
#

Quick google search tells me sharedcomponents should be able to hold normal arrays

dry nymph
#

but that is what a dynamic buffer is

tawdry tree
#

Remember that arrays are kinda complicated in terms of memory, hence why you aren't allowed to the the built-in language type (as they want to make it really hard to F that up but still have the perf of managing it yourself)

solar hill
#

they cant, that's what I'm allready using. i cant seems to get them to work.

dry nymph
#

sharedcomponents are mainly used for filtering or if you truly have something that's shared and never / seldom changes - like the render system

#

they can but you cannot access the values in a job

solar hill
#

well it is shared, that's actually what i was using it for, many entities performing the same actions

tawdry tree
#

Have your tried these dynamic buffers? I haven't touched them so can't really say anything about them, but from what sngdan says it should be an option?

solar hill
#

they are not settable form the inspector which is very annoying

solar ridge
#

Wouldnt using the entity as a prefab work?

solar hill
#

how would that help?

solar ridge
#

Ie the way HelloECS spawns in the sample

dry nymph
#

I have to run now, but I think you might want to specify your case and put it in the forum (and explain exactly what you want to do i.e. edit values of array in editor, access in job, per entity or shared across many entities, etc.)

solar ridge
#

Storing them for later like a scriptable object...

#

I think sngdan is right, explaining the desired effect would help a lot

#

As we all use things differently

dry nymph
#

it does not sound difficult to solve but your use case needs to be as specific as possible to get a good answer

solar hill
#

okay cool, thanks for you help, i will make a foum post

#

i think the ecs example 08 spawn and remove has exacly what i am lookng for in their rotation speed proxy. i think i can have my data as an array and i can convert from that array into a native array in the proxy script. thus allowing me to give the array an initializer.

solar ridge
#

When in doubt, look at the samples. Albeit some of them are... not the best

#

Particularly one of them with a queue

solar hill
#

ive noticed some unusual stuff... i kind of had a moment of "huh... is that how your supposed to do it, sure isn't how i would have"

solar ridge
#

Some of them are proving a concept not proving performance

solar hill
#

still it can easily give people the wrong idea

solar ridge
#

The major thing it is demonstrating is that there is not one way to solve the problem

#

It is highly dependent on your needs

#

So they show multiple ways

#

Some more performant continuously where as others may be better in specific scenarios

golden heron
#

(Thanks for reactions guys :) )

potent cape
#

if you are still searching...

ember moth
#

@potent cape Thank you. ๐Ÿ˜ƒ

potent cape
#

i just was looking for the same one and remembered you looked for it too

golden heron
#

Anyone able to help me with a localtoworld matrix? Mostly just making sure i understand what its values are

#

It represents a position and three vectors, defining the facing direction, is that right?

tawdry tree
#

Shouldn't a local to world matrix be a transformation matrix that transforms from local coordinates to world coordinates? ie localtoWorld*localPosition = worldPosition

lilac ermine
#

curious if anyone here might have other insights on this (maybe some unity folks?)

safe lintel
#

hmm, might try asking that in the thread joachim started for scene conversion, i havent ever seen non monobehaviour classes referenced as part of the hybrid workflow so i have no idea if this is something that is slated for later or not planned at all

golden heron
#

So does that mean i need to change the vectors held in the localToWorld to affect orientation, and the translation to change position? Or is the position you mean the property of the localToWorld? i think it had that as a property

#

I assumed that part of the matrix was actually part of the numbers in the matrix? My question mainly tho, is what do the numbers in the matrix mean? I am trying to use one, but need some definitions of what it is

#

I thought i understood but guess not

#

My bad, it seems the unity.transforms package manual covers this :D

frosty holly
#

What are peoples thoughts on using ECS for production?
(I know that it is in preview and that means officially it is not supported for production)

safe lintel
#

imo its pretty solid for pure number crunching, it still lacks a lot for features though

low tangle
#

fantastic already

#

using it in prod myself

#

reactive systems are still pretty not ergonomic, but the trade off for system separation from data makes it worth it. At the moment I can keep the entire logic of my game inside of my head because of how simple each system is

#

its super nice for reasoning about things

crystal zephyr
#

Does somebody had also problems running the hybrid renderer with LWRP and SRP leads to rainbow flickering visuals?

mystic mountain
#

@crystal zephyr If you're using the Convert to Entity it might be that it creates one renderer there as well. Try disabling the one you have on your GameObject in that case.

crystal zephyr
#

@mystic mountain I using Convert To Entity. But in this case I have a prefab referenced in a spawner. This prefab gets converted to the entity and I use EntityManager. Instantiate. And the ConvertToEntity is set in this case to Destroy GameObject. So I have nothing to deactivate ๐Ÿ˜ฆ

safe lintel
#

to the bugreportmobile

lilac ermine
#

i'd second @low tangle take. using it in production already, though some things are certainly still pretty awkward

#

i'm tending to keep a lot of things in regular ComponentSystems and hybrid until the tooling improves

#

and not a lot of the subscene / convert to entity stuff. @frosty holly i maybe be wrong but i think they feel too early along and it will just be pain being that bleeding edge. but the hybrid stuff works for now and you can get things prepped and as the tooling improves it should be pretty straightforward upgrading

tawdry tree
#

That seems to be the overwhelming consensus - you can very much start using jobs and systems for most projects, but we're still a good bit away from most projects being possible to do in pure ECS. It seems to me like there is a few project types that can utilize pure ECS for at least part of their logic, though.

golden heron
#

Yay! correctly delayed ai movements, with basic momentum simulated movements on the non-skipping ships too :D (fps isnt great as pc is slow)

urban rivet
dull copper
#

well, that was unexpected ๐Ÿ˜ƒ

#

heh ```Undo/Redo, unstable - will likely crash

Copy/Paste between graphs, unstable - will likely crash```

#

I could do without undo for a while but copy/paste is pretty bad

#

but yeah, it's early

safe lintel
#

kinda wierd if the editor build is a custom build? why not roll it into the beta

dull copper
#

what do you mean?

urban rivet
#

the beta is only 1 version later than a14 anyway.

dull copper
#

@safe lintel ah, you mean the link on the thread

safe lintel
#

yeah

dull copper
#

it's stock a14

#

it's not altered at all

#

I checked the hash

safe lintel
#

ah

dull copper
#

would expect b1 to work with that

#

unless there's some dependency with ugui that's not handled yet with that package

knotty radish
#

"We share this build to be as transparent as possible with our process and get your early feedback. This is an opportunity for you to see how DOTS and Visual Scripting are evolving and participate in the discussion."
I want this for everything Unity does

dull copper
#

while I want that too, the issue with this is that so many vocal and ignorant users don't understand what alpha is

#

they call out the whole engine being trash that breaks in every direction

#

and many are straight up mad at Unity for daring to do even previews

#

wanting only final things (yet they could just as well wait for those final things)

#

in modern age, you just can't make everyone happy

tawdry tree
#

I doubt that's new

dull copper
#

they could do some "register for alpha/beta"

tawdry tree
#

I suspect it's been like that forever

dull copper
#

if you have to file a form, even if it's automated process, it would leave some entitled individuals out

tawdry tree
#

Just, we have better channels for loud ignorance now

dull copper
#

as many of such can't be bothered on filling forms ๐Ÿ˜ƒ

#

getting alpha level access for all users hasn't been norm in past

#

usually it's been only available for select people

tawdry tree
#

It also makes them literally legally agree to the fact that
THIS PRODUCT IS IN ALPHA/BETA/EARLY ACCES/WHATEVER AND WILL LIKELY CHANGE/BREAK/HAVE BUGS/WHATEVER AS ITS BEING WORKED ON

#

Won't silence all the voices, but gives a very easy to to shut them up if they get too obnoxious

knotty radish
#

The form would be a great idea

safe lintel
#

probably doesnt help that many companies use alpha/beta testing as just a marketing ploy for their products

tawdry tree
#

Same issue as with early access games - They definitely have their place, and a lot of games would not have existed in their current form without including a large amount of users as early as they did, but there have also been some bad apples.

coarse turtle
dull copper
#

@coarse turtle we were just discussing it ๐Ÿ˜ƒ

coarse turtle
#

Haha, maybe I missed out on the discussion here

safe lintel
#

is there a EntityManager version of ComponentDataFromEntity?

#

ok nevermind GetComponentData, was confused cos rider was not highlighting it the same as other stuff

untold night
#

I feel like the very type of people who complain loudly about Alpha/Beta features not being done are the same people who would complain loudly back when Unity really didn't open up and features just appeared out of nowhere, and were rife with issues due to not being vetted by a larger pool of users than a handful of select companies

knotty radish
#

The main thing needed from Unity is a clear and somehow accurate estimation on features release dates. With that info, you know you if you have time to do it yourself or wait a bit for Unity to do it and in that process, prevent a lot of frustration of doing something they already did

#

(I'm not saying estimation is easy because it's not)

low tangle
#

yeah estimation is a pain in the ass

#

have you seen the vague dots timeline

safe gate
#

Hey all! What is the best type of system to use when it handles only one entity, like PlayerInputSystem?

#

Is it worth it to use as a job, or do I simply run a ForEach?

regal pond
#

There is a SetSingleton API

#

ah,

#

what kind of job to use when going over the Singleton Entity?

safe gate
#

It is not explicity a singleton, but as it represents the player I guess it is ever only going to be one

regal pond
#

I think IJobForEach<PlayerInputComponent> in a JobSystem would work fine

safe gate
#

Ok. I just remember someone saying that using jobs create a tiny overhead, so it was not recommended to use with small systems. I just wanna be sure

regal pond
#

Mmm. they are probably right. The input shouldn't need to be in a job explicitly. You're probably okay with just a regular ComponentSystem instead.

#

Yeah, putting it in a job is probably overkill for what it is doing. Sorry for any confusion

safe gate
#

What is this SetSingleton?

low tangle
#

the scheduling for a job is a super tiny overhead

#

if its fully ecs then a jobforeach should be a no brainer

#

but if its not, a regular entitys foreach for speed of implmentation is what I go for

safe gate
#

Im trying to learn pure ecs

low tangle
#

I find the singleton api super obtuse still

#

try it though

safe gate
#

So should I go for JobForEach?

low tangle
#

it throws a exception in the editor if you spawn more than one (helpful for debugging broken logic)

#

jobforeach's are super nice and should be your default if you can make it work for the logic you want

regal pond
#

SetSingleton is just some api sugar for only allowing a single type of an Entity to exist. It allows for a an easy EntityQuery via entityQuery.GetSingletonEntity()

low tangle
#

yep

#

theres no buffer accessor for it

#

but there is a componentdata accessor

#

and you can always entity->buffer like any

safe gate
#

So if I want the player to be unique, setting it to a singleton is more efficient?

#

And another thing, I tried to use a empty component as player tag, and got this:
ArgumentException: ArchetypeChunk.GetNativeArray<PlayerTag> cannot be called on zero-sized IComponentData

#

I need to use [RequireComponentTag(typeof(Hungry))]?

regal pond
#

I'm not sure how the last part ties into the other part of your statement

safe gate
#

I created an empty component as a tag for the player, but when I tried to schedule a job that required it, I received the error. So I searched and discovered that I need that attribute on the job

#

But now Im facing another problem, when I hit play my object vanishes

#

It has the ConveertToEntity monobehaviour and if I go to the entity debbuger, it appears there

regal pond
#

ah i see.

safe gate
#

But not on the Scene or Game windows

regal pond
#

What setting do you have on the ConvertToEntity? is it convert and destroy?

safe gate
#

Yes

#

And Unity samples has that as well

#

But their cube appears

regal pond
#

also if you're planning on doing an ECS conversion, you should not expect the GameObject to stay inside of the hierarchy when running

#

do you have the hybrid-renderer package installed?

safe gate
#

I forgot the hybrid package ๐Ÿคฆ

#

I CAN MOVE THE PLAYER

#

Im so happy right now

#

Thank you guys for your tips

#

That would be all for today, but you will see more of me ๐Ÿ˜ƒ

analog tangle
#

Congrats

lilac ermine
#

is it not possible to inspect NativeString? just jumping onto 2019 and latest ecs for something quick and could've sworn i did this before ๐Ÿค”

low tangle
#

empty components should not be in the ref component name part of a foreach and for a jobforeach they should not be in the generic type slots, instead as a requiretagcomponent attribute before the job @safe gate

golden heron
#

has anyone worked on applying rotational inertia in ecs?

#

specifically, id like to be able to apply the lerping quaternion as an acceleration and then have the ship continue turning if the controller stops turning.

#

Doing so independently in three dimensions wouldnt be a problem, if i had a function to break the quat into eulers

#

Please @me if you respond :)

low tangle
#

you should have a second component that is a component that decays to zero

#

then modfiy and create the main rotation and copy it over when applying input

#

and always have the main actually applied rotation decay constantly in a different system (can even throw a bool in there and update it for turning the decay off without removing the component) or use a tag [Decay] and remove / add it to do the conditional decay

#

@golden heron

golden heron
#

Thanks @low tangle what method would you use to apply the decay? I was using a drag multiplication with a cutoff at tiny speeds for the movement, i was trying the same but wasnt able to work out the right approach

low tangle
#

spherical lerp * delta time * angular rate you want to decay at

#

make sure its lerp thats clamped so you dont go past

golden heron
#

Oh, i see...

#

Never thought of... thats kinda like backwards lerping hehe

low tangle
#

lerp to zero basically

#

at a rate you want to decay at :)

#

bonus points if the 'mass' of the ship is related

golden heron
#

I do want it to be

low tangle
#

small fighters smooth out because their nimble

#

big ships sway slowly

golden heron
#

Well... Its gonna be quite a complex scenario...

#

The result will make it quite realistically possible to calculate both the variance in turn rate on each of the three local axes, and the centre of gravity.

#

In a nutshell, i've mentioned its an mmo, but the final design will be using ship components put together into a customised design made by the player. If you place objects that extend outwards greatly in one dimension, the rate that dimension turns around its axis will be reduced, unless of course the object which is extending is very light, like a sensor array. I want to model the appropriate differences between the ships like that, and should be able to do so easily, with ecs, mostly because my gameplay wont involve gravity as a force. So its basic newtonian motions across the board.

#

That being said, would it just be easier to use the rotationEulerXYZ component ?

low tangle
#

sure you can do it that way

#

also a module could have basically rca thrusters and help with movement on that axis

golden heron
#

rca ? sorry im not good with abbreviations hehe

low tangle
#

also look into solving the turning forces on a per ship basis so you can save the effort of calculating the ships stats all the time

#

sorry rcs* I put down a audio jack type
https://en.wikipedia.org/wiki/Reaction_control_system

A reaction control system (RCS) is a spacecraft system that uses thrusters to provide attitude control, and sometimes translation. Use of diverted engine thrust to provide stable attitude control of a short-or-vertical takeoff and landing aircraft below conventional winged fl...

golden heron
#

Oh, the entire ship is gonna be "fixed" at load time, amalgamating all the dat into one set of centralised data.

low tangle
#

thats good

#

also do the same for model rendering if you can

golden heron
#

Yep

low tangle
#

also I'd highly suggest not calling it a mmo, but totally aim for that level of size

#

think very carefully about how you will do your network scaling

golden heron
#

I wanna make the final result go through first the stat amalgamation, then merging the meshes.

low tangle
#

servers are expensive as well so keep in mind both bandwidth and cpu time on server as those are the two most expensive peices

golden heron
#

So the designs are in fact one piece in the games view, for ease.

low tangle
#

yes thats exactly the right way to plan it

golden heron
#

Yeah, im planning for initially to run it from home... but im sure once its going it wont be hard to have it fund its own requirements.

low tangle
#

always start with the simplest implementation first before laying on merging and what not. ecs is very very good for keeping it separate and easily tying in new logic and data without touching the other systems. Its a big strength and in action super satisfying

golden heron
#

I also have already had some networking set up - a simple 3 ships in an empty system test, using my own networking layer :D

#

(That was easy compared to ecs :P )

low tangle
#

its easy at first :)

golden heron
#

Yeah, it has been very satisfying

#

Looksie...

low tangle
#

hard part is scaling it up and keeping it from spaghettifiying

golden heron
#

Yeah, im gonnaa have a lot of work avoiding that hehe

low tangle
#

highly recommend ShareX for recording stuff

#

looks good

golden heron
#

(The vid is my red ships driven by intervals - these represent background ships - and green is the insystem ships, hence updated every frame and more in detail)

#

It naturally scales too... It knows how many frames to skip, for example, from the second frame onwards, in spite of that sometimes being quite a few - at 5000 ships it skips approximately 100 frames per move.

#

But, uses lerps and no overshooting :)

#

Have you tried the rotationeuler component? Does it completely replace the normal rotation, or just offer an extra layer over quats?

low tangle
#

dont think I've used that one, all my rotations and positions are inside of my own custom component data due to needing full control and not wasting time computing a transform localtoworld

golden heron
#

So you dont have the normal rotation either?

low tangle
#

just a custom one yeah

#

I sometimes use the transform system for some smaller systems

#

but my main ones all drive custom ones so my pipeline is clear

golden heron
#

How does the custom one work?

low tangle
#

componentdata struct with a quaterion and a float3 in it

#

8 diffrent other types modify it and utilize data from it

#

about 12 systems touch it

golden heron
#

And you have turned off the transform system that manages localtoworld completely?

low tangle
#

transform system only runs when you use those components, I'm not so they dont

golden heron
#

ok, cool... So your custom one, how does it replace the standard rotation completely? Surely it needs one of the original components to apply the rotations and stuff too? Or, is that sent direct to the mesh renderer?