#archived-dots

1 messages ยท Page 121 of 1

amber flicker
#

worlds can't share data - you'd at least have to copy the results back (not that I'd expect it to be that slow) - I'm actually not sure why they put conversion in a separate world... is it so you can run main-thread type code in isolation? or more easily control the thread priority or something? I have no idea ๐Ÿ˜„

vagrant surge
#

@amber flicker nope, no need to copy

#

it just needs to remap entity IDs and a couple other things

#

merging worlds is much faster than you would think

amber flicker
#

nice

vagrant surge
#

it just inserts the chunks on the other world archetypes

opaque ledge
#

@zenith wyvern Sorry, you mentioned getting singleton data through entity query, i couldnt find the post but can you tell me about it again ? For my buffers i have to do it like this:

            var allyThreatEntity = GetSingletonEntity<ThreatAllyMasterTable>();
            var allyThreatBuffer = GetBufferFromEntity<ThreatAllyMasterTable>();

And inside job i do

var buffer = allyThreatBuffer[allyThreatEntity];
amber flicker
#

@vagrant surge what's the reason for using a separate world for conversion do you know?

vagrant surge
#

because worlds dont need to sync multithreading beetween each other

#

so you can have a background job filling one background world, while stuff on the main world continues to render and calculate

amber flicker
#

ah I see, like the way adding an archetype would cause a structural change.. yea I think I understand ๐Ÿ‘

vagrant surge
#

its a great way to do background streaming

#

you have code adding entities from disk files into this staging world

#

and when ready, it swaps into main one

#

tho im not sure how exactly the entity remapping works

#

thats why i dont have that feature yet on my cpp ecs

amber flicker
#

makes sense - any thoughts on @bright sentinel 's question or knowledge of any api for timing how long a job takes across threads at runtime?

bright sentinel
#

Ohh, so creating a new world would be another way of just running things in the background?

#

That would at least solve the same problem, just in a different way

zenith wyvern
#

@zenith wyvern Sorry, you mentioned getting singleton data through entity query, i couldnt find the post but can you tell me about it again ? For my buffers i have to do it like this:

            var allyThreatEntity = GetSingletonEntity<ThreatAllyMasterTable>();
            var allyThreatBuffer = GetBufferFromEntity<ThreatAllyMasterTable>();

And inside job i do

var buffer = allyThreatBuffer[allyThreatEntity];

@opaque ledge

You just do exactly what you're doing but call GetSingleton through the query. Cache your query in OnCreate, then in OnUpdate you can do

var entity = query.GetSingletonEntity();
var buffer = EntityManager.GetBuffer(entity);
bright sentinel
#

I'm not looking for how to implement a solution that splits a job into multiple frames, but a way to not block other vital parts of gameplay, which seems like worlds could solve

vagrant surge
#

@bright sentinel yes

zenith wyvern
#

Then you can pass your buffer into your job

vagrant surge
#

one problem with ECS is that changing entities has to be done at a sync point, singlethreaded

#

but...

opaque ledge
#

ah okay cool, so i can get the buffer in OnUpdate and not inside Job right ?

zenith wyvern
#

As long as you declare the buffer as read-only in your query then your system will only access it as read only

vagrant surge
#

if you have multiple worlds, they dont have to sync point beetween each other

#

so you can be adding entities on a background world without locking the main one

#

and then just lock once when merging

zenith wyvern
#

ah okay cool, so i can get the buffer in OnUpdate and not inside Job right ?
@opaque ledge

Yeah, you get it in OnUpdate and pass it into the job

bright sentinel
#

Ahaa, that might be the key I'm missing here. Is there then any way to control how many resources each world gets?

opaque ledge
#

ah damn, i am writing to my buffer, would that be a problem

#

ooh thats great, not getting the dynamic buffer inside job per entity will give me good performance boost already

zenith wyvern
#

No, you just have to run your job in a single thread, or disable parallel safety on your buffer

opaque ledge
#

thank you ๐Ÿ‘

zenith wyvern
#

ooh thats great, not getting the dynamic buffer inside job per entity will give me good performance boost already
@opaque ledge

Make sure you do buffer.AsArray().Reinterpret as well unless you actually need to resize it. Makes a huge difference to use it as a NativeArray

opaque ledge
#

does Reinterpreting gives peformance boost ? i have 2 fields in my buffer so i cant use reinterpert, but i can make it to a single struct if it gives perf boost

zenith wyvern
#

Well no probably not, the important part is to use AsArray as long as you're not resizing

opaque ledge
#

๐Ÿ‘

#

Can i make it an array inside OnUpdate ? ๐Ÿ‘€

zenith wyvern
#

I'm not sure actually

coarse turtle
#

a native array?

#

sure

zenith wyvern
#

If you're passing it directly into a job from the main thread though. As long as you're accessing it through the query first I think it would be fine

opaque ledge
#

Yay its working ๐Ÿ˜„

#

This made me confused however, i guess using Entity manager to retrieve(read) values in OnUpdate doesnt introduce any problems

#

AsNativeArray do work in OnUpdate ๐Ÿ˜„

bright sentinel
#

Why do you think it wouldn't? ๐Ÿค”

odd cipher
#

still trying to figure out a more optimal way to use NativeMultiHashMaps.. they seem really slow, or well you cant do it too often, as it did almost crash my computer

opaque ledge
#

Because i am accessing some components inside main thread, i mean what happens if a job that manipulates the data that i am getting with Entity Manager ? i could be working on proper values or wrong values depending on if that job has completed or not which would break determinism

bright sentinel
#

That's actually a really good question

warped trail
#

i bet calling EntityManager.GetComponentData<T>() is finishing all jobs with write access to T ๐Ÿค”

zenith wyvern
#

Hmm, if you declare the buffer as read/write in the query, you might be right about that

#

Maybe always actually, I need to dig into the source code

#

You're right, damn. From EntityDataAccess.GetBuffer

        if (m_IsMainThread)
            DependencyManager->CompleteReadAndWriteDependency(typeIndex);
#

So even if you only access it as readonly it forces a sync point for that component

opaque ledge
#

damn

zenith wyvern
#

That's unfortunate, I was using that pattern all over the place

opaque ledge
#

aww

zenith wyvern
#

I guess the way you were doing it is right then Curly, pass in a BufferFromEntity to the job

#

If you want to avoid the forced sync point on the main thread at least

opaque ledge
#

yeah but it doesnt force sync point for everything right ? it just forces a sync point that has that component, isnt that basically same with chaining jobs that read/write to that specific component ?

warped trail
#

mainthread blocking?

zenith wyvern
#

I don't think just scheduling a job for a component forces a sync point on the spot though, I'm assuming unity chooses some time to do them all at once where it makes sense

opaque ledge
#

i think someone has to test this tho, maybe having bunch of Sark's pattern can break performance, but not so much if its only a few

bright sentinel
#

As said, this isn't a sync point

#

Hm, maybe it is actually

#

I'll go back to observing ๐Ÿ˜‚

opaque ledge
#

i mean doing the thing i was doing actually lowers the performance by a lot, i had a job that was running without burst and run that was handling UI rotation to look at camera, i was creating normal Quaternion to be able to use a Quaternion function inside UnityEngine, so i was simply creating Quaternion from quaternion inside the job, i took that to outside of the job and it went to 0.4 ms from 0.6 ms, so if that alone can make this much difference imagine accessing the same buffer for every entity on a job

zenith wyvern
#

Were you accessing it through the BFE every time though, or caching the buffer at the start of the job?

opaque ledge
#

nah, i was talking about simple calculation, no BFE or CFE, i simply took the calculation of Quaternion from quaternion to outside of the job and thats it

zenith wyvern
#

Oh I see

warped trail
#

what about .ToComponentDataArrayAsync?๐Ÿค”

opaque ledge
#

I did the same thing for getting camera and player position/rotations, instead of doing CFE<Translation> and getting Tag Singleton and accessing it inside job, i made CameraPosition, PlayerPosition etc and get them once inside OnUpdate, which also made good performance boost.

#

that doesnt work with buffers unfortunately

warped trail
#

fixedlist inside component instead of Buffer?๐Ÿ˜

opaque ledge
#

i have too many entities to put into 4k bytes ๐Ÿ˜„

warped trail
#

your buffer is so big๐Ÿ˜ฎ

zenith wyvern
#

All I know is sync points are bad - multiple sync points one after the other is definitely bad. Curlys way of passing in the BFE with the BufferEntity is the right approach I think. Hopefully we will get a "GetBuffer" equivalent to the "GetComponent" they added in 0.7 to make it less ugly

opaque ledge
#

yeah, it does feel like right approach

#

but i will stick with Sark's pattern unless i have peformance issues one day ๐Ÿ˜„

#

how about making a job that retrieves these singleton buffer and put it into native array with AsNativeArray, and use that native array on 2nd job ๐Ÿค”

zenith wyvern
#

You would have to copy it to a NativeArray that you pass into the first job - which would need to be sized properly ahead of time...or use a list I guess. BufferFromEntity seems like a better alternative

opaque ledge
#

well i mean, you can just do Schedule since its singleton anyway so you can use lists, and afaik AsNativeArray doesnt do any copying right ?

zenith wyvern
#

No but you can't get the buffer out of the first job when the first job queries for it

opaque ledge
#

oh you cant ? why not

zenith wyvern
#

The only way to get data out of a job is to pass in an array you copy the data to.

opaque ledge
#

Well anyway, i just saw poor performance from BFE so i am open to alternatives ๐Ÿ˜„

mystic mountain
#

Alright so I have spaceships with a bunch of stuff on them. Both dynamic and static. I simulate a exterior collision box, which collides with other spaceships and the world. Then I simulate the interior collision of walls boxes, player characters etc inside the ship. Currently the structure is like this (indents are children of, and "old exterior" means that collider has been moved from this entity to another):

Spaceship with exterior collider
Spaceship empty (old exterior)
Spaceship Interior Collider
Spaceship Interior Visuals

  Static object with interior collider
        Static object empty (old interior)
        Static object visuals

  Dynamic object with interior collider
        Dynamic object empty (old interor)
        Dynamic object visuals

This setup previously had all child colliders (spaceship interior, static dynamic objects) operate in local space around (0,0,0) while the rendering followed the spaceship. This is not the case anymore. Since many static and dynamic objects are ghost entities I have basically two options.

  1. Change to have the interior in world position; rework of some systems; most importantly; requires me to update all LocalToWorld of ghost entities that are children before running PhysicsUpdate, as their Translation might have changed from NetworkReceive.

  2. Instead of parenting and moving colliders to main Static, Dynamic entity, only add them to the LinkedEntityGroup. After PhysicsUpdate we now manually have to update the localPosition of Dynamic entities to follow the dynamic collider(which is not parented but operate around 0,0,0 )

Anyone have suggestion of what approach I should go or see any flaw/suggestion of other solution I could go with?

odd cipher
#

tried remving the [NativeDisableParallelForRestriction] line but somehow this happens Index 1702528 is out of restricted IJobParallelFor range [3333...3333] in ReadWriteBuffer.

#

the array length isnt that big

slim nebula
#

@low tangle

#

do you mean the memory profiler? or is there some other feature that I"m missing?

amber flicker
#

Jobs->Leak Detection->Full stack traces

slim nebula
#

ok I've tried all 3 options (on/off/full). it doesn't appear to change the output at all

#

shows a stacktrace like this regardless of my selection, even if I select off

#

but I'm guessing this is where it detected the issue, not where the allocation happened. is that right?

#

i have no clue how to debug this

#

I've tried commenting out most of my code, it still happens

#

there's got to be some way to find the issue without reconstructing my project piece by piece

odd cipher
#

so,, does anyone know a alternative to NMHM?

fallow mason
#

@odd cipher what exactly is the problem you're trying to solve? Why does a TerrainSprite map to a color?

odd cipher
#

well, because its supposed to?

#

I dont know what to tell you there

fallow mason
#

I'm not a developer of your game. I don't really know what a TerrainSprite is or why it maps to a color. Can you explain what it is and why it needs to do that? Are you doing a procedural terrain?

odd cipher
#

Yeah so, each TerrainSprite has a TerrainID which is what TerrainType it is refering to. such as (0 = Dirt, 1 = Water) for example. and a VariantID which is for the TerrainType's other sprites. and a bitMask from 0-256 for different combinations ```cs
public struct TerrainSprite : IEquatable<TerrainSprite> {
public int terrainID;
public int variantID;
public int bitMask;

public TerrainSprite(int _terrainID, int _variantID = 0, int _bitMask = 0) {
    terrainID = _terrainID;
    variantID = _variantID;
    bitMask = _bitMask;
}

public bool Equals(TerrainSprite other) {
    if (other.terrainID == terrainID && other.variantID == variantID && other.bitMask == bitMask) return true;
    return false;
}

public override int GetHashCode() {
    return 0;
}

}

#

an example would be colorTerrainTiles[new TerrainSprite(kvp.Key, 0, 2)] = loadedSprites[name + "_N"].texture.GetPixels32();

#

though this does become repetitive because essentially that line has to be done 256 times for each combination

fallow mason
#

I'm just asking what it is in the context of your game. What problem is TerrainSprite solving? Procedural terrain generation?

odd cipher
#

yeah, it picks the correct entry in the "colorTerrainTiles" NMHM, the problem is that getting the values from that NMHM is slow

#

which is why I was asking if there was any good ways to avoid using a NMHM in my case

north bay
#

Well your NMHM is readonly isn't it?

odd cipher
#

Yeah it is but that doesnt seem to help in any way

north bay
#

It does, your problem seems to be really easy solvable by nested arrays

#

For lookups

#

Or am i missing something?

odd cipher
#

nested ararys is what I pretty much want but it doesnt work with burst

#

I think thats what I need anyway

north bay
#

That's what i use

#

It doesn't provide any safety tho

odd cipher
#

alright, how do I get this install in my project? never done it like this before

#

and not sure how it works either

#

@north bay ?

north bay
#

You mind if i dm you?

odd cipher
#

yeah sure

gusty comet
#

@odd cipher If I understand the above correctly, you are using your terrainID, variantID and bitmask (?) as your hashcode, couldn't you just use them as indexes in a multidimensional array?
There's this old C++ trick where you'd have a single dimensional array and index it multidimensionally by indexing it like this: someArray[i*rowLength + j].
I think you should be able to do indexing like that in something like a dynamic buffer on an entity.

junior fjord
#

in the examples (for example the boids example), the components are often way bigger than I do them myself

#

I have very small components, like even sometimes I have one component float2 for location on map and another one for height

#

does this have any drawbacks? why do the examples use such big components?

safe lintel
#

for larger projects theres just no getting around using more complex components, it would actually be detrimental to try to split things up into very granular components if many tend to get used by the same systems

bright sentinel
#

You should organize components into data where the system will almost always need all of the data in that component. For boids, it makes sense since you need quite a lot of data to describe a boid, while more isolated components (such as position) is usually needed in lots of different contexts

#

That's of course the ideal way, but as @safe lintel states, it's not always the most practical way

safe lintel
#

ah only 56 more ijobforeach's to switchover! ๐Ÿ˜ฉ

junior fjord
#

ok so the only reason is that it is tiresome to write out all the components needed if you need a lot in more complex systems?

safe lintel
#

both a convenience thing and also running into the component limit when for example using the ForEach lambda

#

can get around with chunk iteration but you're already writing a fair bit of extra code

#

like in this entity(which has other components too) it can definitely be split up and I plan to do so but it would be too much to split into granular sub components and its mostly one or two systems that deal with all of it so I keep it all together

formal scaffold
#

Hey, how do I have to understand the ```cs
RayFrom

and ```cs
RayTo

in the physics ShereCast example from the Unity docs? Does it cast the collider along that line and when it collides with something it stops immediately even if it doesnt reach the "Rayto" position?

junior fjord
#

haha yeah ok my entities don't look like that yet

#

and thanks for the answer

bright sentinel
#

@formal scaffold You can look at the Physics samples (the one called Queries) to see how they do it. As far as I know, inferred from the sample, RayFrom is the start position, and RayTo is the end position.
There are two overloaded methods for raycasting, one is that it will stop at the first collider hit and output that, and the other is that it will output all the coliders hit, without stopping.

dull copper
bright sentinel
#

That is so useful!!

dull copper
#

I'm not sure what to make out of this feat yet

zenith wyvern
#

Oh hey, if b1 is out that means we can finally actually use Hybrid v2 right?

dull copper
#

nah

#

need b3

zenith wyvern
#

rip

dull copper
#

also apparently DX12 works on hybrid v2 already, it's just HDRP DX12 is super slow (which they will address on 2020.2)

#

the reason why it didn't render for me must have just been the missing implementation on engine side as I tested it on b1

#

even DX11 just rendered like half the meshes

#

same with their testprojects

#

but it all makes sense, since Unity staff said that b1 wouldn't yet render these right

zenith wyvern
#

And a webinar on April 20th, I wonder if that's meant to replace the stuff they were going to show at GDC

#

It felt like they were leading up to showing off all their dots progress

formal scaffold
#

Is is possible to make SphereCast visible?

#

Something like Debug.DrawRay but as Sphere

sour ravine
#

mathematically it's a capsule

warped trail
#

you can look at how they do debug drawing in physics package๐Ÿค”

warped trail
#

can you do this from job?๐Ÿค”

fallow mason
#

the trick is using from DOTS, I know

#

you'd probably have to store position and radius in a debug component and read the component data from a MB

#

can you use Graphics API from Jobs?

warped trail
#

i dont think so๐Ÿ˜…

fallow mason
#

these jobs sound worse the more I hear about them!

bright sentinel
#

All work and 0 pay

formal scaffold
#

My Player is on Layer 11, why is this CollisionFilter colliding with my Player?

        var filter = new CollisionFilter() {
            BelongsTo = 10u, // Belongs to Layer 1
            CollidesWith = 100u, // Collides with Layer 2
            GroupIndex = 0
        };
worldly pulsar
#

@warped trail I think Topher mentioned Debug.DrawLine was going to be supported in jobs in 2020.1?

mystic mountain
#

@formal scaffold Might be wrong here, but you're specifying it to belong to layer with bitmask of 10 in UINT => 1010 binary, and collide with 100 in UINT => 01100100 binary ?

formal scaffold
#

Oh wait I havent thought about it being UINT ill test

mystic mountain
#

I usually bitshift it 1U << layerindex

zenith wyvern
#

I think you want 0b10, 0b100, etc

chilly halo
#

May I ask a question about the new mathematics package here?

formal scaffold
#

I found my problem, it was the Physics Shape, Collision Filter. It was set to "Belongs to: everything"

#

Then all of those work to set the filter:
100u, 1u << 2, 0b100
Those are all equivalent to Index 2

chilly halo
#

here is the thing...
the first block of code I'm using the old Mathf.Quaternion.LookRotation with (0,1,0) as forward and (0,1,0) as upwards. According to the documentation it should return Identity
"Returns identity if forward and upwards are colinear" <- from the docs
Then I'm multiplying that quaternion by the world axis to get a "local axis"

In the second block of code I'm using the new quaternion.LookRotatioSafe from the new Mathematics Package, with (0,1,0) as forward and (0,1,0) as upwards. Again according to the docs Identity should be returned.
"If the magnitude of either of the vectors is so extreme that the calculation cannot be carried out reliably or the vectors are collinear, the identity will be returned instead" <- from the docs.

Mathf.Quaternion.Identity is equals to math.quaternion.identity indeed , so... why Quaternion.LookRotation and quaternion.LookRotationSafe are returning different values?

worldly pulsar
#

@formal scaffold 100u is 0b1100100

formal scaffold
#

@worldly pulsar 100u seems to point to index 2 aswell as 0b100

#

A collider set to index 1 wont trigger a collision

#

Oh I think I get it

worldly pulsar
#

it has bit 1 << 2 set, so it belongs to index 2, but it also belongs to 1 << 5 and 1 << 6

formal scaffold
#

Yeah

worldly pulsar
#

(not sure if Unity.Physics allows objects to belong to more than 1 layer btw)

formal scaffold
#

My wall can belong to 31 Indexes, not sure if it's the same as layers tho

worldly pulsar
#

I don't use Unity.Physics so not sure on terminology, just pointing out that 100u is decimal and not a bitmask ๐Ÿ™‚

#

@chilly halo you are 100% sure faceOffsetDirection is (0,1,0) in your second example? that quaternion is 90deg rotation

chilly halo
#

Is the same variable for both cases , but I will debug to be sure.

formal scaffold
#

Yeah just getting really started with it myself ๐Ÿ˜› It's quite overwhelming but cool

chilly halo
#

@worldly pulsar yes , it is

worldly pulsar
#

oh, the code is one screenshot, I thought you stitched it together from several :)
either way, the Unity.Mathematics code is correct (returns identity for (up, up)), and the old one return a rotation that moves Vec3.forward to Vec3.up.
Never ran into it myself, but my guess is that there is a special case in the UnityEngine.Quaternion version to pretend the second argument is not there when it's (0,1,0), since that's the default value of that parameter and Quaternion.LookRotation(Vector3.up) should return a 90 deg rotation around the X axis. There is a bunch of little traps like these in the old math library.

#

for comparison, Quaternion.LookRotation(Vector3.forward, Vector3.forward) correctly returns identity

chilly halo
#

So... the bug is with Vector3.up with Vector3.up?

worldly pulsar
#

uh, scratch that, Quaternion.LookRotation(new Vector3(1,1,1), new Vector3(1,1,1)); returns nonsense too

chilly halo
#

Huh...

worldly pulsar
#

so yeah, the "Returns identity if forward and upwards are colinear" part seems to be a lie ๐Ÿ™‚

chilly halo
#

If it were just a theorical question/problem I wouldnt mind.
but the issue here is that the rest of the code behaves totally different with one result or the other (as its expected).

So... how is half of the games out there even working? Why no one else are having issues with that "false" identity returned?

worldly pulsar
#

the "returns identity" case is essentially an invalid argument error, you are asking it to build a rotation that puts "forward" and "up" in the same direction

#

(more specifically: you are asking it to build a rotation that puts "forward" the way you say, and "up" on the plane formed by the 2 vectors given. If both vectors point the same way there are infinitely many such planes, and the problem is underspecified)

chilly halo
#

Yup , exactly.

And... the old Unity mathF namespace returns that place rotated 90` degrees because reasons.

#

Well , I will continue to update our codebase to the new math package.
At least Im not crazy ๐Ÿ™‚

#

Thanks Rett

fallow mason
#

oh my. I've been living like a fool for so long. I had no idea systems still ran on entities in expanded subscene. I am so happy and angry at myself. ๐Ÿคฆโ€โ™‚๏ธ

zenith wyvern
#

Has anyone been able to set up dynamically created entities to work with the hybrid renderer?

#

Got it working, I forgot to set the material on my RenderMesh

gusty comet
#

What, if any, solutions to per-instance properties using the legacy pipeline with hybrid rendering do you guys use?

opaque ledge
#

there is per instance support in hybrid renderer v2

#

but they are not officially released, it requires 2020 beta 3 and URP HDRP 9

#

otherwise there was a forum topic about it, someone made a custom solution, but i am not sure if its relevenant anymore

gusty comet
#

Cool, I'll see if I can find it.

opaque ledge
#

you can also download master branch from SRP to activate hybrid renderer v2

gusty comet
#

Why does V2 require 2020 though?

opaque ledge
#

no idea, its just the way it is i guess

dull copper
#

2019 cycle features are locked already, last tech release has released

#

there will only be bugfixes and sdk updates from now on for the 2019.3 engine itself

#

2019 compatible packages can still evolve but not for things that require engine side changes

#

@gusty comet @opaque ledge do note that hybrid renderer v2 is purely for SRPs, it will not work on the built-in renderer

#

(like hybrid renderer v1 does)

opaque ledge
#

is built-in renderer still being used ?

#

for new projects at least

dull copper
#

many still use it

#

you can "blame" endless asset store offerings on that

#

only few asset store publishers support URP and HDRP

#

and ones that do are really pissed off about SRPs ๐Ÿ˜„

stoic osprey
#

yo, i'm having a bad case of analysis paralysis, so give me some input here. coming from an "advanced beginner" level in regular unity, i started looking into dots and I wanna learn it cause i feel it'll be the way forward. however a lot of things still haven't clicked; anyway, i'm finding it hard to get started. What i want to work on is a vr shooter kind of situation, without lofty goals but just to prove a concept; it would be coop enabled so I'm also looking at the new networking stuff. I really want to use Ecs as much as possible even though i realize it'll be a struggle, cause I want to wrap my head around it, so i'd avoid hybrid solutions as much as possible. that said, i don't know where to start, lol. It's like every time i think of something i can thing of some prerequisite and i just keep going in circles

#

so i guess the question is "what do first"

#

and how to best compartmentalize my systems in a way that when i inevitably have to scrap a chunk of it, it won't have a huge impact on everything else (which i understand should be a core advantage of ecs in the first place)

zenith wyvern
#

Don't try to make a full game to start out with, and definitely not a networked game. Go through the examples in the pinned messages, particularly the github samples

stoic osprey
#

oh no never a full game lol. whiteboxed and all that.

#

minimal gameplay

#

for networking, i feel like if i don't start out with that in mind it will be exponentially harder to shove it in later

fallow mason
#

The shooting aspect of the shooter would be a great place to start of you're trying to get familiar to ECS workflow. And no hybrid should be required for that part. That's where I would start.

#

Networking is still in its infancy in DOTS and very complicated. A good way to get discouraged.

#

imo

zenith wyvern
stoic osprey
#

ok thanks for the help ๐Ÿ™‚

fallow mason
#

Any word on when Unity might do the online GDC talks that Riccitiello mentioned in his blog post?

dull copper
#

lols

#

if I have joints in a dots subscene, they don't work unless I actually add convert to entity with convert and destroy option to the joints parent physics body

#

since it's in the dots scene as well and I have dots editor package, it claims that convert to entity script doesn't do anything

#

but if I remove it, it definitely breaks

#

having the extra script there keeps it functional

#

since the convert and destroy wiped the gameobject on dots subscene, it means I can't use the entity conversion preview while playing

#

as there's nothing to examine

warped trail
#

subscenes are very mystical creatures ๐Ÿ˜…

vagrant surge
#

so, no GDC talks from unity?

#

i was hyped to death from the "how to make an ECS" by mike acton

opaque ledge
#

yeah same

dull copper
#

it doesn't look good for epic's or unity's talks now

#

it's looking like Unity will do some of these along the spring now

#

super bummed tbh

#

was expecting them to prepare at least some package for GDC week

zenith wyvern
#

Yup I was really looking forward to the dots stuff from GDC. Rip in spaghetti

pliant pike
#

stupid basic question but how do you increment a variable in a job?

#

I have this in the Onupdate outside the job

#
 var timeaccumalator = Time.DeltaTime / 20f;
        var timedeelta = timeaccumalator;```
#

and this inside the job

#
placeonSpline.floatVal += timedeelta;```
#

but I'm just getting haywire random results

warped trail
#

placeonSpline is component?

pliant pike
#

yeah its a component on entities

safe lintel
#

was there official word that the talks would be delayed or just speculation?

warped trail
#

i think there is something that you are not showing us ๐Ÿ˜…

pliant pike
#

probably leahYTHO

#

but in general that is a correct way to increment a float var on each entity?

warped trail
#
var deltaTime = Time.DeltaTime
Entities.ForEach((ref PlaceonSpline placeonSpline)=>
{
  placeonSpline.floatVal += deltaTime ;
})```
#

this should work

pliant pike
#

I do need the division part because that slow it done but that's basically what I've done ๐Ÿค”

warped trail
#

you can multiply it instead of dividing ๐Ÿ˜…

#

Time.DeltaTime * speed

pliant pike
#

the value needs to stay between 0 and 1 multiply would make it go over

warped trail
#

in your case speed = 0.2f

fallow mason
#

.05 == 1/20

warped trail
#

oh๐Ÿ˜…

#

but your floatVal will be more than 1 anyway

#

after some time

pliant pike
#

thats why I use math.saturate

warped trail
#

after 20 seconds

fallow mason
#

hmm never used. weird it's called saturate instead of clamp. must be a shader thing

pliant pike
#

yeah that threw me off, never would have found it if not for someone here, thanks again, whoever that was

#

anyway I still get the same chaotic random output using multiplication ๐Ÿคท

warped trail
#

what value is chaotic?

pliant pike
#

placeonspline

warped trail
#

floatVal should increase by 0.05 per second๐Ÿง

pliant pike
#
  Entities.WithAll<TestMoveojbectTag>().ForEach((ref Translation moventy, ref tPlaceonSpline placeonSpline) =>
        {
            ref var booked = ref baked.BezzyGraphcomp.Value;
            var Curvecount = (booked.Bezzypoint.Length - 1) / 3;
            float3 Bezpoint1 = new float3();
            float3 Bezpoint2 = new float3();
            float3 Bezpoint3 = new float3();
            float3 Bezpoint4 = new float3();
            placeonSpline.floatVal += timedeelta;
            Debug.Log("placeonspline" + placeonSpline.floatVal);
            int i;
            if (placeonSpline.floatVal >= 1f)
            {
                placeonSpline.floatVal = 1f;
                i = booked.Bezzypoint.Length - 4;
            }
            else
            {
                placeonSpline.floatVal = math.saturate(placeonSpline.floatVal) * Curvecount;
                i = (int)placeonSpline.floatVal;
                placeonSpline.floatVal -= i;
                i *= 3;
            }
            Bezpoint1 = booked.Bezzypoint[i];
            Bezpoint2 = booked.Bezzypoint[i + 1];
            Bezpoint3 = booked.Bezzypoint[i + 2];
            Bezpoint4 = booked.Bezzypoint[i + 3];
            placeonSpline.floatVal = math.saturate(placeonSpline.floatVal);
            float oneminust = 1f - placeonSpline.floatVal;
            float u = 1.0f - placeonSpline.floatVal;
            var tt = placeonSpline.floatVal * placeonSpline.floatVal;
            var uu = u * u;
            var uuu = uu * u;
            var ttt = tt * placeonSpline.floatVal;
            float3 p = uuu * Bezpoint1; 
            p += 3 * uu * placeonSpline.floatVal * Bezpoint2; 
            p += 3 * u * tt * Bezpoint3; 
            p += ttt * Bezpoint4;     
            moventy.Value = p;
        }).WithoutBurst().Run();```
#

the full job if anyone is curious and has a clue

fallow mason
#

my guess is placeonSpline.floatVal -= i;

#

hmm wouldnt the first branch of the if statement always run after the value reaches 1?

pliant pike
#

yeah thats when its finished, it basically moves an entity along a spline

fallow mason
#

should you reset the value to 0 in that branch?

pliant pike
#

not unless I want it to loop and go back to the start

warped trail
#

so, floatVal starts from 0 and increases to 1 linearly?

pliant pike
#

yeah between 0 and 1 are all the values along the spline

fallow mason
#

yeah I was confused. thought you were resetting an offset every time you reach a point on the spline. got it now I think

warped trail
#

then why don't you just lerp it?๐Ÿค”

pliant pike
#

it uses that to calculate the exact position using the other equations, dont ask me exactly how, I have no clue leahYTHO

fallow mason
#

yeah, I agree. I think this is a lot of code to lerp a value from 0 to 1.

warped trail
#

oh it is a curve, you can't just lerp it to move linearly๐Ÿ˜…

fallow mason
#

plus you're manually clamping (the max) once and using saturate in two other places. probably unnecessary

pliant pike
#

if you can figure out how to do it fewer code be my guest, but yeah its several bezier curve paths

fallow mason
pliant pike
#

yeah I've seen that thanks

#

that's the one I've mainly used though

fallow mason
#
    {
        float u = 1 - t;
        float tt = t * t;
        float uu = u * u;
        float uuu = uu * u;
        float ttt = tt * t;
        
        Vector3 p = uuu * p0; 
        p += 3 * uu * t * p1; 
        p += 3 * u * tt * p2; 
        p += ttt * p3; 
        
        return p;
    }```
pliant pike
#

it does work just not on multiple entities

fallow mason
#

you've tried just feeding a function like that with a linearly interpolated value and it doesn't work when doing multiple entities?

#

that's weird :\

pliant pike
#

I know, I don't know if its some bug I'm or I'm just not understanding how to increment component variables in jobs

fallow mason
#

Is PlaceOnSpline a ISharedComponentData?

pliant pike
#

nope public struct tPlaceonSpline : IComponentData { public float floatVal; } thats all it is

warped trail
#

so, you have blobassetreference with array of splines?

#

each spline is 4 points

pliant pike
#

yeah

#

yep

warped trail
#

you are incrementing your floatVal and when it is 1 you want to move to next spline in array

pliant pike
#

no it basically divides it by all the sum of the splines or something so that 0 and 1 is across any number of arbitrary curves

opaque ledge
#

b2 is out ๐Ÿ‘€ Soon hybrid renderer v2 shall be mine ๐Ÿ˜ˆ

warped trail
#

@pliant pike you are modifying floatVal, not just incrementing it and i think it is the source of your problem๐Ÿค”

zenith wyvern
#

@opaque ledge Btw regarding our discussion about passing in a dynamic buffer from another entity to a job for processing, I think it might be better to just use blob assets. At least in my case, since my buffer wouldn't be changing a lot

#

BlobArrays can also be nested

mint iron
#

upgraded my project from 0.6 to 0.8 and now all my tests are going like twice as slow :S grrr. </whine>

coarse turtle
#

Hmm anyone had issues with building out to android with the default gameobject injection world not initialized cause of a marshalling error? ๐Ÿค”

mint iron
#

using a subscene?

opaque ledge
#

@zenith wyvern yeah, that is not really good for me ๐Ÿ˜„ i am holding threat(aggro) table in that dynamic array so it will change all the time, as a side question, can you reconstruct a blob asset when you want to change it ? or does it function like a runtime static or something like that

zenith wyvern
#

Yeah you can recreate it whenever you want

#

But you have to manually update the references from the original to the new version

opaque ledge
#

ah i see

#

i never did anything with blob assets, they seem.. unnecessary

zenith wyvern
#

It's nice to just have static data you can store in components. Plus - nested arrays like I said, you can't do that with NativeArrays

opaque ledge
#

FixedList ? ๐Ÿ˜„

#

i mean what is the difference between static data (blob asset) and changable data but you wont be changing it

zenith wyvern
#

There's no other way to store a reference to static data inside a component

south falcon
#

Hello, I am wondering if I new a world, how can this world update with the default world?

zenith wyvern
#

Plus trying to store shared data in a dynamic buffer runs into sync point issues as we found out. With a blob asset there's no indirection or performance concerns, it's just a straight reference to your data

mint iron
#

unless you have multiple threads hitting it with a write, then you'll get false sharing no?

opaque ledge
#

Yeah but Sark, imo they should have buffer version of GetSingleton anyway, so you have 1 buffer accessed from the job, instead of accessing it on every single entity query

zenith wyvern
#

The safety system won't let you write to a buffer from multiple threads - unless you disable it. But there's no way to actually "share" the buffer directly with other jobs without forcing a sync point first. You would have to copy the buffer data out to a NativeContainer then pass that into the read jobs

opaque ledge
#

Maybe your use case is good for static data, but what about mine ๐Ÿ˜„

#

I just want to read the buffer

mint iron
#

seems like buffers get invalided if someone sneezes in the next room.

opaque ledge
#

yeah tbh, thats the way to go, sure its unncessary copy operation but whatever, definitely will boost perf

#

so i guess i will be converting from Sark's pattern to that probably

zenith wyvern
#

Yeah I suppose there's a good reason they force you to do it that way, buffers get invalidated from any structural changes

opaque ledge
#

not anytime soon tho, i have other things to do ๐Ÿ˜„

mint iron
#

you could pass the ptr to the buffer and hope it wasn't touched ๐Ÿ™‚

zenith wyvern
#

Faith based coding

coarse turtle
#

oops sorry just saw the msg @mint iron - no I'm not using subscenes atm

#

I'll see if I can grab the actual error message - I was combing through the forums last night to see if anyone else had a similar issue ๐Ÿค”

mint iron
#

ahh yep, i just ask because, topher's answer is that runtime conversion is not supported anymore

coarse turtle
#

oo - well then

#

guess I'll jump onto subscenes now haha

mint iron
#

yeah, im going to have to check it out too, ive avoided it becuase it seemed completely unnessesary and slow.

zenith wyvern
#

You can't create subscenes at runtime right?

coarse turtle
#

Dont think so - since the goal is that they're serialized to a mem mapped file right?

#

ahead of time

zenith wyvern
#

It would be nice to have some mechanism to do that manually at runtime for loading/unloading procedural parts of the game

opaque ledge
#

wait, so no more GameObjectConversationUtility ?

mint iron
#

it seems still to be part of the plan, but you'll have to move things that need to be converted into a subscene.

opaque ledge
#

wait, how am i suppose to convert my prefabs into entities then

#

or are we talking about when there will be a good/full DOTS editor support ?

zenith wyvern
#

You would use the normal prefab entity workflow like from the samples, then you Instantiate the prefab entity

#

So rather than creating a gameobject and converting it at runtime, you convert the gameobject prefab to an entity prefab during conversion and instantiate the entity prefab at runtime

opaque ledge
#

ah okay, with IDeclaredPrefabReference and IConvertGameObjectToEntity interface then ?

zenith wyvern
#

Yeah

opaque ledge
#

ah okay cool

zenith wyvern
#

The idea I guess being to literally have zero gameobjects at runtime

coarse turtle
#

hmm I imagine conversion systems would remain the system functionality wise?

zenith wyvern
#

My assumption is they will work the same but we'll lose the ability to use them (or any kind of gameobject conversion) at runtime

#

Seems like that won't be happening any time soon though

dull copper
#

oh, a new DOTS editor package

warped trail
#

new Entity debuger? ๐Ÿ˜…

opaque ledge
#

bring in the notes Olento ๐Ÿ‘€

dull copper
#

on it ๐Ÿ˜„

coarse turtle
#

lol

opaque ledge
#

๐Ÿ˜„

#

thanks^^

dull copper
#

well... ouch

stable fog
#

We all know what 0lento is good at

#

uh oh, thats not a good sign

dull copper
#
## [DOTS Editor 0.4.0] - 2020-03-17
[Changed]
* Updated package dependencies```
coarse turtle
#

lol

stable fog
#

lol, as Cassia would say, "You're making me nervious!"

dull copper
#

they must have changed more tho

bright sentinel
#

From the editor package?

dull copper
#

ok, discord is acting up again

#

anyway, they fixed some of the warnings that came with newer entities using different world setup

bright sentinel
#

Maybe changing the dependencies fixed those warning? ๐Ÿค”

dull copper
#

pretty sure the issue was in the actual code using the deprecated world getter

zenith wyvern
#

If I create an entity at runtime using a commandbuffer, how do I handle attaching it to another entity for parenting/linkeentitygroup/etc? The entity returned from the command buffer is meaningless. Adding a "spawned" component or something similar seems annoying

opaque ledge
#

yeah, in unity's own videos she said "you have to create a workaround" ๐Ÿ˜„

#

i probably would make a system state that indicates that specific entity has been created, and i put a entity field and put the parent in it when i create that entity, later on a system links it and removes the system state.

zenith wyvern
#

I guess I could spawn it with a "Disabled" component, then query for the disabled component in the linking system, so it gets ignored until I hook it up properly.

#

Still annoying

opaque ledge
#

yep

coarse turtle
#

hmm wondering if this works on a job ๐Ÿค”

var dummy = CmdBuffer.CreateEntity();
CmdBuffer.SetComponentData(entity, new SomeLinkedEntity { Value = dummy });
bright sentinel
#

Why wouldn't it work?

#

Oh

zenith wyvern
#

The entity returned from buffer.CreateEntity is meaningless outside that context

opaque ledge
#

yeah exactly, dummy is 'undefined'

coarse turtle
#

Yeah I figure lol

opaque ledge
#

you have to put parent entity to child's component somehow and do the link 1 frame later

coarse turtle
#

Its like one of those thoughts that came across recently: "I never tried it cause all my spawned entities that need to be linked use either the disabled component or some tag"

zenith wyvern
#

Yeah disabled seems like the right way to go, avoids having to add a tag specifically for this purpose too

dull copper
#

hmmmm, bunch of things just broke on my dots project

#

I wonder if it's really about beta 2

#

because I reverted the dots editor back and it's still broken af

#

(just updated to 2020.1.0b2)

zenith wyvern
#

Are you using packages aside from Entities?

dull copper
#

I also added netcode package just a moment ago, I'll try without

bright sentinel
#

Isn't most of DOTS only battle proof with 2019.3?

zenith wyvern
#

Other packages aren't even close to staying up to date so they'll often include older packages as dependencies which causes everything to explode because apparently UPM wasn't designed with that in mind

dull copper
#

2020.1 got some advantages

#

and new hybrid will only work on 2020

bright sentinel
#

Yes I know ๐Ÿ˜„

#

But that doesn't matter if it doesn't work ๐Ÿ˜‚

dull copper
#

it worked about the same on earlier ๐Ÿ˜„

#

but this could be on me too

#

I tried earlier to get the netcode's client interpolation to work

bright sentinel
#

Client interpolation? What exactly do you mean by that?

zenith wyvern
#

Like we can't even use physics with 0.8 because physics is incompatible with the latest collections package which 0.8 relies on

dull copper
#

basically trying to figure out FixedClientTickRate thing and the additional thing to interpolate it for rendering

bright sentinel
#

Is that really true? Fairly certain I tested that earlier today

#

@dull copper Is the ghost interpolation not working for you?

dull copper
#

when you run simulationgroup at fixed timesteps, it will be async to rendering

bright sentinel
#

Oh I see

#

Makes sense

dull copper
#

well, atm nothing works like I'd want to, even hybrid rendering broke ๐Ÿ˜„

#

I'll revert this soon to earlier state if I can't figure out what broke it

zenith wyvern
#

Is that really true? Fairly certain I tested that earlier today
@bright sentinel

Thygrr brought it up in this thread https://forum.unity.com/threads/dots-dependency-hell-was-entities-0-8-0-missing-class-propertyattribute.847255/#post-5602222

It may be a combination of latest hybrid renderer package, latest entities and physics

dull copper
#

I can tell few things wrong there immediately

#

the person is using newer perf testing package which isn't compatible

#

most dependency hells are user generated by them overriding the dependencies

zenith wyvern
#

In his repro case he started on a fresh project

bright sentinel
#

Yes, and it is also a known issue it seems

zenith wyvern
#

Or so he said

bright sentinel
#

Which was actually with IL2CPP

#

And for the package resolving, that's also on the radar

dull copper
#

oh, wonder if that's still broken on 2019.3

#

pretty sure I reported that being broken before

#

but it got fixed on some later version

bright sentinel
#

Don't think it's completely fixed yet

zenith wyvern
#

At the very least UPM should let you know there's a package incompatability, that should have been the case way sooner

dull copper
#

oh wait, I didn't report tht one, but I definitely had that before

coarse turtle
#
Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Scenes.Hybrid\LiveLink\LiveLinkPlayerSystemGroup.cs(32,59): error CS0117: 'SceneSystem' does not contain a definition for 'GetBootStrapPath'

Library\PackageCache\com.unity.entities@0.8.0-preview.8\Unity.Scenes.Hybrid\LiveLink\LiveLinkPlayerSystemGroup.cs(53,48): error CS0103: The name 'bootstrapFilePath' does not exist in the current context

On a side note anyone ran into this seems like an issue on Android :/

dull copper
#

I've been on mono builds for other reasons now, mainly to reduce the burst spam :p

#

hmmmm, getting rid of netcode package and clearing library fixed my dots project

#

can't tell which one it was

bright sentinel
#

Probably the latter ๐Ÿ˜…

dull copper
#

but all the sudden hybrid rendering works again and physics don't go through ground plane ๐Ÿ˜„

#

I wouldn't be surprised on either alternative, considering the experiences I've had on this

stable fog
#

Synchronizing data between running jobs

#

Go

bright sentinel
#

Also @zenith wyvern there's not much reason to import collections, jobs, burst if you're working with entities. Likewise there's also not a lot of reason to import entities if you're working with hybrid renderer, physics, netcode etc

#

@stable fog NativeArray's without safety checks I guess

#

But then you run into race conditions

zenith wyvern
#

I can see the case for not being worried about the specific version of things like collections or jobs, but if there's an incompatability between the latest physics, entities and renderer that seems like a bigger issue that's going to be hit by a lot of people new to ECS

dull copper
#

I think current entities, physics and hybrid renderer do work together

bright sentinel
#

Well as I said, it was working fine for me earlier today

dull copper
#

but there are two newer packages that don't

worldly pulsar
#

@stable fog for 2-way sync the only thing I can think of is: split the job into before/after you need output from another job, then insert the dependency inbetween
for 1-way producer/consumer you can use e.g. NativeStream

dull copper
#

you shouldn't update perf testing package or the serialization one to newer than mentioned on entities dependencies or it'll either break or throw bunch of warnings

stable fog
#

I'm less thinking about whether or not it can be done, more about whether or not it should be done, or avoided

dull copper
#

also, platforms package can't be newer than 0.2.1 ๐Ÿ˜„

#

so yeah, it's gettting tricky

#

platforms 0.2.2 will throw bunch of errors

bright sentinel
#

You really should just go with the highest level packages that you need. Physics, Hybrid Renderer, NetCode, Editor basically for now

#

They should of course work together

#

But there's not much need to import deeper packages

#

As they'll get resolved automatically

#

(In most cases)

dull copper
#

and if you do, it'll break

#

and based on todays experience, I'm not even sure if latest netcode is compatible ๐Ÿ˜„

zenith wyvern
#

Yup, just tried it. If you install entities, renderer, then physics, it breaks.

warped trail
#

just update collections๐Ÿค”

zenith wyvern
#

It's understandable that there would be incompatabilities with all the different versions but UPM should warn you if you're trying to import a package that's going ot break an existing dependency.

#

You can't. Physics is incompatible with the latest collections.

bright sentinel
#

But that's more a problem with the package manager than it is with the packages themselves ๐Ÿ˜…

dull copper
#

these work for me: json "com.havok.physics": "0.2.0-preview", "com.unity.burst": "1.3.0-preview.7", "com.unity.collections": "0.7.0-preview.2", "com.unity.dots.editor": "0.4.0-preview", "com.unity.entities": "0.8.0-preview.8", "com.unity.physics": "0.3.0-preview.1", "com.unity.platforms": "0.2.1-preview.8", "com.unity.rendering.hybrid": "0.4.0-preview.8",

warped trail
#

it works fine on my project๐Ÿค”

zenith wyvern
#

Yeah, that's my point. UPM is failing hard.

dull copper
#

or just Unity

#

they should release all DOTS packages that have dependencies at once if they plan this to be nice for users

#

I bet they put more effort to that once these are out of preview though

bright sentinel
#

Yeah, it's good to remember that this is essentially alpha/beta stuff

zenith wyvern
#

What the heck, @warped trail you're right. Why wouldn't UPM know to just keep the up to date collections package then instead of forcibly downgrading it and causing errors

warped trail
#

i noticed that if you install entities, renderer, then physics it loads collections 0.5.x

#

just update collections to latest and everything works fine

dull copper
#

btw, remember when I wrote earlier that I still need to add extra convert to entity script to DOTS subscene or physics joints will not attach... turned out that while that hack did work in the editor, it completely breaks in the build

#

moving things out of DOTS subscene makes everything fine and dandy again, even in build

#

it's just, DOTS editor doesn't do anything without subscenes

bright sentinel
#

That reminds me, how do you handle NetCode stuff with subscenes? Currently they ask you to use a ConvertToClientServerEntity component outside a SubScene, but no references to subscenes in the docs

dull copper
#

so, can't win in any case here

#

I'm not annoyed about the dependencies at all, but I'm super annoyed by the state of editor tooling and this conversion stuff

warped trail
#

sometimes i have situations that subscene is loading previously saved data ๐Ÿ˜…

zenith wyvern
#

I think you need to use the explicit versioning thing if you're using subscenes don't you?

#

To force it to update the cache

warped trail
#

im not talking about scripts

stable fog
#

so if it works in the editor, it doesn't mean it will work in the build?

dull copper
#

it definitely just worked for me in the editor but not in the build ๐Ÿ˜„

warped trail
#

you put one set of objects to subscene, save it(State A). Open it, remove/add some objects, save it(State B) and than you close subscene it loads StateA, open it and it loads State B

south falcon
#

I have a question. If a system add in both GroupA and GroupB. What would happened with this system if I create both GroupA and GroupB in current world? Would it log error? If this system already be created in current world, what would happened with this system once I disable GroupA or GroupB? Would this system also be disabled?

opaque ledge
#

I think you gotta test that on your own ๐Ÿ˜„

#

But a world cannot have same system more than one so i am pretty sure it would log error about it

south falcon
#

Thx๐Ÿ‘

low tangle
#

damn I'm still out of date

    "com.unity.entities": "0.5.1-preview.11",```
#

feel like I just updated entities the other day

#

tried moving to 6 and my project blew up

mint iron
#

and it will blow up again going to 0.8 ๐Ÿ˜„

bright sentinel
#

Currently it seems like there are bi-weekly updates

formal scaffold
#

Hey, has anyone used CapsuleGeometry from the Unity.Physics package? What are the Fields

public float3 Vertex0
public float3 Vertex1 

doing?

low tangle
#

one thing I'm really not liking about the new codegen lambdas is with il2cpp, if you do something not supported, theres no warnings, no info, and il2cpp will just complain about the next random cpp error from the actual malformed input

zenith wyvern
formal scaffold
#

Thanks, so as I thought the height

formal scaffold
#

Sorry for asking again but any way to make CapsuleGeometry or SphereGeomery visible? I am casting a Sphere- or CapsuleCollider but it's hard to see where it is actually being casted.

I get some wierd collisions that shouldn't happen and I can't pinpoint where my problem is

opaque ledge
#

So i have a question, i have a weapon firing system from a spaceship, this system does 2 things:

  1. Checks if weapon is available to fire, Checks if there is a line of sight
  2. If above is true, it creates bullet entity, it calculates projectory, so basically weapon fires

So i wanted to ask how can i seperate these 2 systems, because generally speaking %95 of the time weapon wont be available to fire (be it weapon is on cooldown or target is not in sight) so that means my system will be wasted %95 of the time, i havent encountered any performance issues, not that i tested it extensively but i was wondering what kind of approach people would take, this is my system:

https://pastebin.com/S7FScsCf

#

@formal scaffold there is a script called Physics Debug Display, put into somewhere and make sure its being converted to entity

#

i only used to see collideres, but i think it also draws collisions

worldly pulsar
#

means my system will be wasted %95 of the time
can you expand on what you mean by that?

opaque ledge
#

I mean, my ship wont be firing %95 of the time, so 2nd part of the system is wasted

#

I want to seperate 1st and 2nd part so there wont be any waste

formal scaffold
opaque ledge
#

probably

#

oh, i mean you already have the script ๐Ÿ˜„

#

you dont have to download it

zenith wyvern
#

If it doesn't fire the bullet after the check what is being wasted?

worldly pulsar
#

Are you worried about pulling too many components at once? Because I'm not sure I see any big waste here

opaque ledge
#

@zenith wyvern 2nd part of the system where bullet is created and given components.

bright sentinel
#

@opaque ledge if you really want to separate the check, and only have the 2nd system run when it should actually fire, then you probably have to do some structural changes by adding a tag or something for the 2nd system to query. Another approach is to use a SharedComponent where you have a true and a false state, and you could filter based on that.

opaque ledge
#

Yeah exactly Rett

#

i feel like this is not exactly a good design

zenith wyvern
#

You mean you create a bullet even if the check fails?

opaque ledge
#

no i dont, if check fails it wont create the bullet

zenith wyvern
#

Right, so if the code isn't running...what's being wasted?

bright sentinel
#

Yeah, which is why I think your system is fine for now. Besides, it's not really a heavy system and something that can save you performance.

#

@zenith wyvern Job scheduling I guess

worldly pulsar
#

If you split it you have to schedule even more jobs

opaque ledge
#

So what i am saying is, i am pulling 1-2 components to check, but 4-5 components to fire, so i am retrieving many components even tho those componenets wont be used %95 of the time

#

But maybe i am just nickpicking

worldly pulsar
#

The components shouldn't be loaded into the cache unless you actually read/write to them if that's what you worry about, the job just has to keep a few more pointers around

zenith wyvern
#

Yeah I'm not sure how much overhead you would save by not including a few components in your query

bright sentinel
#

And as the wise words of someone on Discord, don't prematurely optimize ๐Ÿ˜„

zenith wyvern
#

If you wanted to separate them for the sake of readability that's one thing, but you shouldn't worry about the performance cost of that in particular

opaque ledge
#

alright thanks^^ i was just worried about the random access

coarse turtle
#

also remember your target device you want to aim for

opaque ledge
#

i am converting some prefab colliders to shape right now, i can test after that and see how much that system takes

#

yeah its mobile

bright sentinel
#

Besides, your system is already fetching other entities than the ones being queried, which is probably where you will see the biggest performance hit in terms of memory fetching at least.

coarse turtle
#

well mobile has different processors amongst generations - so definitely you should define your scope -
typically, I test on Samsung S6, Pixel 1, IPhone 6S as my benchmark for lower bound phones

formal scaffold
#

Hmm sadly the Physics Debug Display doesn't draw Colliders made with

Unity.Physics.SphereCollider.Create(...);
#

Maybe they are simply bugged

low tangle
#

profile your damn systems at scale before you even think about making a complex job chained monster when you probably dont need it @opaque ledge

#

target is for 1000 of x, spawn that many with a benchmark and profile if it would be fast enough on your target machine, with target threads

#

if your operation only happens every once in awhile, pretty much anyway you do it will be fast enough

bright sentinel
#

Generally I've heard some things about ECS not handling large amounts of systems well, so take that into consideration as well

opaque ledge
#

๐Ÿ‘

south falcon
#

Do you guys know how to update the system which is manually created?

worldly pulsar
#

system.Update() ?

south falcon
#

can it auto udpate??

#

Because I find out that there is no display on Entity Debugger of that system which is manually updating.

worldly pulsar
#

look at what the default world initialization code does, I don't remember the exact calls you have to make to insert it into the update loop

south falcon
#

ok, Thx.

#

can i filter the tag of entities in entity debugger?

coarse turtle
#

there's a filter button on the top of the entity debugger

south falcon
#

Oh, I have found the filter button the entity

#

Thx

stable fog
#

Where is that talk about SIMD operations and JOBS?

coarse turtle
#

this one?

opaque ledge
#

Ok, that system is running 0.07 ms on 1k entities lol

pliant pike
#

debugging seems to have changed with the latest beta, I have to go into debug mode and I get a ton of errors, when I just want to mark a break point ๐Ÿค”

stable fog
#

looks like thats the one @coarse turtle thank you

pliant pike
#

can you even view componentdata on entities in VS studio code view?

low tangle
#

@opaque ledge good job testing

#

Just spent 6 hours debugging only to find out it was the minor unity update from 2019.3.3f1 to .5f1 that caused il2cpp to start throwing the gibberish

opaque ledge
#

Beta was giving me a weird error, when i opened debug mode that error would be gone and that system was working properly, but when i was off debug mode it came again, so i decided to downgrade to 2019.3 for now

#

also there is a burst debugging video if you havent watch already

#

tbh June, i thougth it would be like 1 ms D:

#

no idea why its 0.07

low tangle
#

Job time can only be viewed in profiler

#

Timeline view

#

Click on the job after expanding job threads

#

It will tell the total time as well as the slice time you clicked on

opaque ledge
#

oh, it was 0.07 on entity debugger, i will check profiler tomorrow

low tangle
#

Ping me if you need some pictures on where to go and click

#

I'm heading to sleep now that the madness is over

fallow mason
#

is quaternion implemented differently than Quaternion?

#

I've been trying to implement a static extension method 'Angle' for quaternion to match the way Quaternion.Angle is implemented in UnityEngine, but I'm getting nonsense results

#
Debug.Log(string.Format("Mathmatics: {0}",QuaternionX.Angle(quaternion.Euler(float3.zero), quaternion.Euler(0f, 90f, 0f)))); //returns 116.6202
Debug.Log(string.Format("UnityEngine: {0}",Quaternion.Angle(Quaternion.Euler(Vector3.zero), Quaternion.Euler(0f, 90f, 0f)))); //returns 90
#

here's my extension:

#
using Unity.Mathematics;

public struct QuaternionX
{

    public static float Angle(quaternion a, quaternion b)
    {
        float num = QuaternionX.Dot(a, b);
        return QuaternionX.IsEqualUsingDot(num) ? 0.0f : (float)((double)math.acos(math.min(math.abs(num), 1f)) * 2.0 * 57.2957801818848);
    }

    public static float Dot(quaternion a, quaternion b)
    {
        return (float)((double)a.value.x * (double)b.value.x + (double)a.value.y * (double)b.value.y + (double)a.value.z * (double)b.value.z + (double)a.value.w * (double)b.value.w);
    }

    private static bool IsEqualUsingDot(float dot)
    {
        return (double)dot > 0.999998986721039;
    }

}```
low tangle
#

Why not use the methods in math.

fallow mason
#

math has an angle function?!๐Ÿ˜ซ

low tangle
#

Everything is built around static functions you pass onto, instead of treating the struct like a object

fallow mason
#

Yeah that makes sense. Just makes it a little less intuitive to find

#

Thanks

low tangle
#

It's meant to mimic gpu shaders math

fallow mason
#

math does not have an angle function...

#

and wow is that documentation page horrible. so long it freezes every 2 seconds

fallow mason
#
Debug.Log(string.Format("Mathmatics: {0}",quaternion.EulerZXY(0f,0f,90f))); //Mathmatics: quaternion(0f, 0f, 0.8509035f, 0.525322f)
Debug.Log(string.Format("UnityEngine: {0}",Quaternion.Euler(0f,0f,90f))); //UnityEngine: (0.0, 0.0, 0.7, 0.7)
#

so that's neat

indigo delta
#

Why did you use ZXY instead of XYZ, like Quaternion.Euler takes?

fallow mason
#

Documentation states that Quaternion.Euler rotates in ZXY order

#

Quaternion.Euler takes the parameters in that order, but does not apply them that way

#

likewise, quaternion.EulerZXY just applies them in that order. not the order of parameters. both euler angles are 90 degrees rotations on the z axis.

indigo delta
#

Oh, it takes angles in radians.

#

There's your problem

fallow mason
#

โ˜ ๏ธ

worldly pulsar
#

math.acos(math.min(math.abs(num), 1f)) * 2.0 * 57.2957801818848
are you sure about this math?

fallow mason
#
Debug.Log(string.Format("Mathmatics: {0}",quaternion.EulerZXY(0f,0f,math.radians(90f)))); //Mathmatics: quaternion(0f, 0f, 0.7071068f, 0.7071068f)
Debug.Log(string.Format("UnityEngine: {0}",Quaternion.Euler(0f,0f,90f))); //UnityEngine: (0.0, 0.0, 0.7, 0.7)
#

I'll take it. Thanks @indigo delta

indigo delta
#

Nice. Closer to the real value, on the first one

#

It should be sqrt(2)/2, or 1.414/2, or 0.707

fallow mason
#

@worldly pulsar Am I sure? No. But Unity seems to be ๐Ÿ˜‰

solar spire
#
Debug.Log($"UnityEngine: {Quaternion.Euler(0f, 0f, 90f).ToString("F7")}"); //UnityEngine: (0.0000000, 0.0000000, 0.7071068, 0.7071068)```
fallow mason
#

well look at that ๐Ÿ™‚

indigo delta
#

Ah, fun. Good to know there's not a significant digit loss that large in the stock math ;P

fallow mason
#

can't even complain about the documentation on that one. plainly says its in radians ๐Ÿคฆโ€โ™‚๏ธ

coarse turtle
#

Hmm I dont suppose there is a way to add materials to an entity within a subscene is there? ๐Ÿค”

#

aside from render mesh?

odd cipher
#

why isnt use burst jobs an option under jobs?

remote coyote
#

You set the BurstCompile attribute on the job struct instead

odd cipher
#

ah alright, thought burst somehow wasnt enabled this whole time

hollow sorrel
#

just had a look at what unity does with FixedRateUtils, which is used for making a systemgroup use fixed time step
they use World.PushTime and PopTime to set the deltatime used in the group
but they don't PopTime until the second time the group runs, so isn't this bugged? every group that updates after that will use the same elapsed+deltatime as that fixed time group
and there is no guarantee it even pops the correct time if a different system after that pushes theirs thonking
unless i am missing something

#

i guess there is bug in FixedRateUtils or i'm using it in the wrong way ๐Ÿ˜•
@warped trail
is this the same bug you encountered? (just searched fixedrateutils in this channel)

#

ahhh wait nvm

#

it just calls it twice in a row and pops the second time

#

damn i thought not being able to do time management was the only downside of using a systemgroup's updatecallback but seems that isn't the case

zenith wyvern
#

LinkedEntityGroup is supposed to make it so if you destroy the root, it destroys all the linked Entities. Is that right?

opaque ledge
#

yes

warped trail
#

@hollow sorrel I was setting this function callback in custom world bootstrap and it just stuck in infinite loop๐Ÿ˜•

#
var elapsedTime = group.World.Time.ElapsedTime; // elapsedTime = 0
if (m_LastFixedUpdateTime == 0.0) //true
  m_LastFixedUpdateTime = elapsedTime - m_FixedTimeStep; // 0 - 0.02 = -0.02

if (elapsedTime - m_LastFixedUpdateTime >= m_FixedTimeStep)//0--0.02 >= 0.02
{
  m_LastFixedUpdateTime += m_FixedTimeStep;// -0.02 + 0.02 = 0
  m_FixedUpdateCount++;
}
else
{
  m_DidPushTime = false;
  return false;
}
return true;
opaque ledge
#

how can this stuck in infinite loop, there is no loop in there

warped trail
#

this part decides if you will update group one more time or not

#

and this is how systemgroup updates systemscs while (UpdateCallback(this)) { UpdateAllSystems(); }

opaque ledge
#

hmm ok, you could debug.log to see where it goes infinite

#

is UpdateCallback that check function ?

warped trail
#

yes

#

i just created my own function๐Ÿ˜…

opaque ledge
#

but you are getting elapsed time on every check, i think you should minus m_FixedTimeStep from it if returns true, so lets say if elapsed time is 0.03, fixed time is 0.02, it will always return true because both will stay the same, right ?

#

ah actually nvm, you are updating last fixed update time

#

well, gl ๐Ÿ˜„

#

i am kinda glad i dont need to deal with any physics stuff, BARGOS is in a very wild ride because of it ๐Ÿ˜„

warped trail
#

and elapsed time is not changing during your world update๐Ÿ˜…

dull copper
#

Has anyone tried FixedRateUtils?
@warped trail yeah I was fiddling with it yesterday, it's where things started to break in all directions after I added netcode package (as only it has the interpolation code for client)

#

that last snippet worked for fixed timestepping

#

that being said, those netcode docs state you could just add that component to singleton entity and it should work(?)

bright sentinel
#

@dull copper Actually now that I remember, NetCode has their own fixrate stuff

dull copper
#

oh right

#

so it's not even same thing?

#

that snippet on the forums didn't even require netcode package

#

well, this explains why it broke when I mixed these two concepts ๐Ÿ˜„

#

I somehow assumed they both used same fixed timestepping code under the hood ๐Ÿ˜„

#

so, that's a good point@bright sentinel

bright sentinel
#

Yeah, it would be nice to have some universal solution, but generally it feels like they are struggling with fixed timestep

#

I mean, Physics doesn't even have it yet ๐Ÿ˜…

warped trail
#

i don't think that fixed time step functionality is Physics' problem๐Ÿค”

bright sentinel
#

Well physics is the one in most need of it

dull copper
#

netcode benefits from it as well, in fact it's mandatory there if they want deterministic netcode

#

you can't have determnism on any simulation if each client simulates things at different timesteps

#

(regardless if the simulation is physics based or not)

warped trail
#

im just saying that the job of the physics is to simulate(float timestep)๐Ÿ˜…

untold night
#

Considering how new the fixed rate stuff is I'll bet it takes a bit to ripple out to physics / netcode

dull copper
warped trail
#

can't wait to test this ๐Ÿ˜…

vagrant surge
#

niiiiice

opaque ledge
#

Olento the Bringer of Good News ๐Ÿ‘€

#

except yesterday lmao

low tangle
#

the new renderer has me excited

#

is 2020 b3 out yet lol

opaque ledge
#

soon ๐Ÿ˜„ b2 was released yesterday i think

vagrant surge
#

this is the sort of thing that has a good chance of having insane perfs

#

by caching render commands on a perchunk-archetype basis, you can do tons of fun things

low tangle
#

yeah delta memory upload is a super smart choice

vagrant surge
#

unreal does it, but its individual per-object

hollow sorrel
#

daaamn

#

that is sexy

vagrant surge
#

this sort of thing is faster

#

you upload more memory

#

but the uploads are simpler

low tangle
#

thats awesome to hear

#

I like the sound of it all going from job threads directly to render thread to upload

vagrant surge
#

thats actually similar to some of the things i do in my ecs experiments

#

in my ecs simulation, i dont have delta tracking, but not like it matters, as my entities are all moving

low tangle
#

yeah makes sense

vagrant surge
#

but when rendering, i grab a chunk, and memcopy it straight into gpu, and then render-instanced

low tangle
#

how was the performance?

vagrant surge
#

well, memcpy the matrices

low tangle
#

yeah yeah, same thing

vagrant surge
#

400.000 cubes flying around, all moving

#

at 60 fps

low tangle
#

๐Ÿ˜ฉ

vagrant surge
#

render system not being the bottleneck

#

i actually havent tried to stress the rendering only

#

but my rendering is very simple. i only have instanced colored cubes

low tangle
#

is it just the 4x4

#

400k * 4x4 (4*16)

vagrant surge
#

4x4 + color

low tangle
#

1 byte per component on the color or 4

vagrant surge
#

4

low tangle
#

alpha?

vagrant surge
#

uhm, would need to check

#

yes, even if dont use it. gotta pad to 4 after all

#

on the cpu side, this is faaaaaast, takes like 2 miliseconds to do the rendering on those 400k

low tangle
#

80 bytes for 4x4+color

vagrant surge
#

could be an stimate, yes

#

i pack them 500 at a time, to avoid having too many directx calls

low tangle
#

31.25mb / frame

#

1.9gb/s

#

not bad for going from cpu->pcie->gpu

opaque ledge
#

Btw June i checked the profile, same with Entity Debugger, i checked with 2k entities, its 0.09 ms

vagrant surge
#

im basically memcopying straight to buffers on uploads of 500 renderables at a time

low tangle
#

yeah thats great

vagrant surge
#

the 500 is because its what i calculated as the maximum size of uniform array

low tangle
#

I think pcie4 can do 60gb/s ?

#

or was it more

vagrant surge
#

i dunno

#

in this lunatic benchmark, im actually bottlenecked by RAM to cpu speeds

low tangle
#

that makes sense

#

I just like to get an idea of how close to theoretical max we can get

#

v. 6.x (64 GT/s):
7.88 GB/s (x1)
128 GB/s (x16)

vagrant surge
#

gonna make a build witthout profiler and send it, so you can run the thingy

#

specially now i did some experiments to tryhard even further

low tangle
#

sure ThumbsupA

#

make sure you put the stats up somewhere, at least DT

#

gonna attempt to update to entities 7 or 8 today

#

did people have problems with 8?

#

better scroll up

#

if you click on the jobs down in the timeline, it tells you the total, which is sliced up by multiple instance (I have a quad core so 4)

#

roughly speaking, its not exactly always that

opaque ledge
#

๐Ÿ‘

#

will check now

hollow sorrel
#

someone said 8 has problems with physics 0.3

low tangle
#

thats what it was, thank you

vagrant surge
#

have fun

#

let me know how it runs on your machine. When the max number of boids is reached, mine (ryzen) is at 20 ms

warped trail
#

no problem with physics

hollow sorrel
#

ooo

#

is this your own engine?

vagrant surge
#

this is a tech demo ive been using to develop my c++ ecs

low tangle
vagrant surge
#

its similar to the way unity ecs works

#

so i use it as a experiment to see what kind of things work on it, or not

#

@low tangle bit slower than mine

low tangle
#

cpu limited

vagrant surge
#

seems about right

#

i made it so it reaches very high cpu utilization on ryzen

low tangle
#

I could bump the oc back up to 5 but I dont usually run that for heat

vagrant surge
#

which is 16 threads

hollow sorrel
vagrant surge
#

you have similar numbers to me @hollow sorrel

hollow sorrel
#

am on i7 8700k

low tangle
#

6/12

vagrant surge
#

i use this (and others) to mostly see what works or doesnt with the ecs model unity has. Also how would stuff like job system work with it. im using a cpp task library + parallel stl

#

one thing i found, is that using "manual" chunk jobs to "merge" multiple systems into one can give good speed boosts

#

but mostly only when you start having to deal with huge counts of units

amber flicker
low tangle
#

yeah that makes sense

#

god thats great

hollow sorrel
#

daymn

opaque ledge
#

finally i found it ๐Ÿ˜„ it says 0.116ms, 8 instances

#

i probably should start to name my jobs, its all DisplayClass in here ๐Ÿ˜„

low tangle
#

very reasonable for 1k

#

yeah

amber flicker
#

is that with a build attached to editor @opaque ledge ?

low tangle
#

.WithName or something like that

opaque ledge
#

0.116 ms for 2k ๐Ÿ˜„

vagrant surge
#

thats quite nice

low tangle
#

if its burst compiled with safety off it should be fine performance wise vrs built

vagrant surge
#

there is one thing that worries me on unity ecs. Whats the overhead of having lots and lots of systems?

opaque ledge
#

i am not sure what that means Timboc, i am testing on editor, not build if thats what you are asking

low tangle
#

not much

vagrant surge
#

on this sort of ecs, there is allways a small cost to scheduling jobs and preparing the list of archetypes to run

amber flicker
#

about ~5% difference I find depending on what you're doing (build vs editor all safety off)

low tangle
#

I think with the 260 I have its like a baseline of .3ms / frame

vagrant surge
#

oh thats great

#

260 is on the higher end

low tangle
#

which is pretty much nothing

vagrant surge
#

maximum ive seen is one crazy guy on the Entitas github

#

he talked about having 3000 systems

low tangle
#

god damn

vagrant surge
#

for a mobile game

low tangle
#

I bet he has hellish archetypes

vagrant surge
#

but, those systems were almost all reactive systems, so they do nothing until stuff starts changing

#

he also commented 1500 components

low tangle
#

yeah that sounds spot on

#

let me see how many compnents I have

vagrant surge
#

overwatch has something like 30 systems, from their ECS talk

#

and 20 components

low tangle
#

they have fat components though

amber flicker
#

@opaque ledge if you do a build, you can enable Autoconnect Profiler - allows for profiling the build directly (there are some safety checks you can't disable in editor) - not a huge difference but generally good practice of profiling imo

low tangle
#

so like the whole physics world is one etc

vagrant surge
#

i know a spanish team who built a overwatch-style ecs for their engine and multiplayer mobiel game (call of duty type thing), and they had 50 systems and 30 components

low tangle
#

looks like 350 components counting unity ones

opaque ledge
#

ah i see, i probably will start doing that when project is at the end

vagrant surge
#

this simulation i shared is 10 systems

low tangle
#

not bad

#

my little ecs test with flecs and raylib was at like 8

#

but I was just trying to explore ergonomics more than performance

#

writing the code fast and easier trumps performance most of the time

hollow sorrel
#

i thought ecs would have you write more systems than you would monobehaviours but those numbers sound pretty low

low tangle
#

well only because I keep ignoring how I would write it before

#

try to write it with the most minimal amount of logic and data to get the same result as before

hollow sorrel
#

how many components do your systems touch on average?

vagrant surge
#

@hollow sorrel its a good idea to now have that many systems. In general you want systems to be small, but not too small

#

plz dont be like the github guy on 3000 systems

hollow sorrel
#

hahah

low tangle
#

offhand I'm not sure

#

I'd estimate around 3 primary components, and 0-3 tags

#

most of those tags are just to get around how shit world management is

hollow sorrel
#

sounds about right

low tangle
#

ServerOnly and ClientOnly

fallow mason
low tangle
#

intel stuck with quad cores for way too damn long

fallow mason
#

I know. def going ryzen if I upgrade soon.

dull copper
#

I'm still bit bummed I didn't get the 16 core one

#

was going to but they kept postponing it and even 3900x stock was hard to find so just got one when local store had it on stock

fallow mason
#

we got the 32 (I think?) core threadripper for a render machine at work. It's insane.

dull copper
#

3970x is probably the most useful TR out there

hollow sorrel
#

at least now cpu progress seems to be picking up again so if you wait shit will only get better
i feel like before ryzen the ~7 years before that haven't been worth upgrading

vagrant surge
#

i had a friend run this thingy on a 32 core threadripper

hollow sorrel
#

i used a 2700k for like 7 years

vagrant surge
#

it was memory bottlenecked like crazy

#

in fact he had lower frames than me lmao

dull copper
#

@vagrant surge did you upgrade yours already?

low tangle
#

memory on cpu when

opaque ledge
#

is there a way to force a job to take more than 1 frame ? i am about to make a sphere collidercast on 1-2k entities and i am sure it will take some ms, so i was thinking if i could make it to work in 2 or more frames ?

vagrant surge
#

not possible if its on the main world

#

due to having to sync some stuff

dull copper
#

you could split the task so it would alternate the frames

low tangle
#

if you really need to, the system needs to hold onto a job handle and check complete

vagrant surge
#

you would need to ship it into a "outside of main ecs" job

#

yeah, alternating is where its at

low tangle
#

but you run into issues with sync points

vagrant surge
#

at the moment on my experiment im simulating everything, but i did experfiments with only updating half the boids every frame

opaque ledge
#

oh hmm, sounds like unncessary work

vagrant surge
#

good ol index % 2

low tangle
#

first try the naive case

dull copper
#

well, if it can take more than one frame, it has to do the splitting internally anyway

#

(if such was supported out of the box)

low tangle
#

yeah you could do a job chunk and alternate your updates

dull copper
#

I'd love to have it supported out of the box too

vagrant surge
#

@opaque ledge as your case is more like many entities doing the check, just split it, do half the entities every frame, or similar

#

use modulus operator for it

opaque ledge
#

yeah well i was depening on Unity to do the splitting ๐Ÿ˜„

vagrant surge
#

and manual chunk iteration

low tangle
#

or skip chunks

vagrant surge
#

i found that full chunks being split is not so good

opaque ledge
#

yeah i was thinking about that vb, just do a modulo on entityInQueryIndex ?

vagrant surge
#

unless you have a clear delimitation, like for example if i used it on red vs blue boids in my thing

#

yup

#

on the next frame, you do +1 to the index, so the modulo rolls

#

the branch predictor predicts the 50/50 split no issue

#

i did it on my simulation and it was basically a x2 speedup

low tangle
#

and i am sure it will take some ms,
@opaque ledge you do need to measure first

amber flicker
#

you could also queue e.g. 200 entities to operate on per frame or something instead? Unless I'm missing something

dull copper
#

pretty sure you can't do this for physics queries but if you have your own processing that doesn't need to finish on same frame, I think you could just offload it now to separate thread and run it with burst using function pointer thing

#

or does that require to be run from main? (I don't see reason for it to)

low tangle
#

games can lag under heavy (for your game type) load of units, or props or players etc

opaque ledge
#

Yeah sure June ๐Ÿ˜„ you are right

vagrant surge
#

btw, there is a issue with the whole modulos on index thing

low tangle
#

not everything has to be perfect performance

opaque ledge
#

will test soon

vagrant surge
#

when you move entities from place to place, its possible that a few entities dont update

dull copper
#

I also feel that the brute force splitting is only way you can guarantee determinism if you need it

vagrant surge
#

so you should only use the index modulo thing if your entities are static in their chunks

dull copper
#

like, have to be able to do it the same way regardless the machine capability

#

altho one could force the determinism on that by various actions

amber flicker
#

how about using an ISCD to separate e.g. 2k entities into 4 chunks and work on one chunk per frame?

opaque ledge
#

those entities has tag components to drive AI so they wont stay in the same chunk all the time

amber flicker
#

conceptually I mean - obviously those chunks could further fragment as they would usually - but your job filters on e.g. ISCD value = 1, then next frame ISCD value = 2

opaque ledge
#

ah ofc^^

amber flicker
#

unless @vagrant surge or @dull copper think it's a bad idea for some reason? They're smarter than me ๐Ÿ˜„

vagrant surge
#

@amber flicker fragmentation

#

that works if you can do something like my simulation, where you have very clearly defined "faction" boundaries anyway

#

but adding a new ISCD will fragment your chunks, and fragmentation is the #1 thing to worry on a archetype ecs

amber flicker
#

sure.. but as a trade-off... if we're talking an additional fragmentation e.g. every 500 or 1000 entities we're reaching how many would probably fit in a chunk anyway?

vagrant surge
#

i still advise to avoid ISCD on nearly all cases unless you are really, really sure you want it

#

@amber flicker fragmentation accumulates real easy

amber flicker
#

other alternative is to track manually? NativeQueue or similar?

vagrant surge
#

if you are completely sure that those entities are in the same archetype (they might not be!!) then its ok to use ISCD

#

@amber flicker add a component to add a unique index

#

or hell

#

use entity ID

#

and modulus operator

#

entity Id is a integer after all

#

mine was done with internal chunk index because i wanted a more predictable branch prediction, but you can use entity index too

dull copper
#

@amber flicker I have literally no idea ๐Ÿ˜„

opaque ledge
#

is there a difference between "ref DynamicBuffer<>" and "DynamicBuffer<>" in ForEach lambda ?

warped trail
#

without ref or in you are passing components by value(from documentation)

opaque ledge
#

yeah but i still can add to DynamicBuffer if i dont do ref

warped trail
#
for (int i = 0; i < count; i++) // with ref
{
  DynamicBuffer<TestBuffer> buffer = runtimes.runtime_buffer.For(i);
  OriginalLambdaBody(ref buffer);
}

for (int i = 0; i < count; i++) // no ref
{
  OriginalLambdaBody(runtimes.runtime_buffer.For(i));
}``` this is the difference
#

there is DOTS Compiler, you can look what code was generated by your lamda foreach

hollow sorrel
#

oh man

#

those color choices in the dots compiler window

#

i guess it was only made for dark theme

warped trail
#

at least it is black text in 20.0b2, it was white and yellow at first๐Ÿ˜•

hollow sorrel
#

ah yea i'm still on 2019.3

stable fog
#

is the intrinsics stuff available yet?

dull copper
#

yes

#

on Burst 1.3

dull copper
#

hmmmm, hybrid rendering v2 seems to work better on beta 2 already

#

at least it doesn't miss meshes anymore like it did on beta 1

stable fog
#

miss meshes? ๐Ÿ˜ฎ

dull copper
#

if you tried new hybrid renderer on b1, it like rendered only 50% of the meshes/materials

#

but it was stated already by people building it that it will not render correctly before b3

#

DX12 didn't render anything on hybrid v2

#

now it works as well on beta 2

#

so some changed definitely made it to beta 2 already

#

it's possible this still misses some but it feels functional now already. I also briefly tested DXR but that's not working with this (but that was also expected to be missing as it didn't work on hybrid rendering v1 either)

gusty comet
#

So, now that we can't use IJobForEach I was wondering how am I supposed to pass ComponentDataFromEntity to the Update function?
Used to do it like this:

struct Job: IJobForEach<Type>
{
[ReadOnly] public ComponentDataFromEntity<Type> typeReference;
    void Execute()... 
}
protected override JobHandle OnUpdate(JobHandle inputDependencies)
{
        var job = new Job()
        {
            typeReference= GetComponentDataFromEntity<Type>(true),
        };
        return job.Schedule(this, inputDependencies);
}

But now that we do the Entities.ForEach inside update I'm having trouble passing ComponentDataFromEntity

opaque ledge
#

if you inherit from SystemBase you can use GetComponent/HasComponent/SetComponent functions directly inside your ForEach

#

if you still want to continue using GetComponenetDataFromEntity or Buffer version you can still do it, you simply do it in OnUpdate method and you will be able to catch them inside your lambda. However there are things to note, if you are only reading it you have to do .WithReadOnly(local_variable_name)

coarse turtle
gusty comet
#

Thank you, @opaque ledge . I'll try that

low tangle
#

@dull copper do you happen to have a vr headset to test if it renders in that?

#

v1 does so I assume it will in v2

dull copper
#

I can test but there is no official openvr plugin for new xr managent yet and they nuked the old plugin from 2020.1

mint iron
#

so i tried to move a converted game object into a subscene, and my expectation was that it would be pre-converted and stored somewhere in that state. And so when i hit play that data would show up in my Default game world. But what im seeing looks like its created another World for the subscene and it remains isolated from my Defualt world. My default world systems are not able to find the entities that are in the SubScene. what am i missing here?

dull copper
#

There is wip branch for 2020.1 compatible openvr tho

low tangle
#

oh yeah totally forgot the plugin update

#

is there not one directly from the steamvr package now?

dull copper
#

I have no idea if the steamvr has even worked on hdrp

#

I mean that asset store package now

#

I'm not really a vr dev but I do check these official systems occasionally

low tangle
#

yeah no worries

#

I'll check into it soon as I need to see how close we are getting to being able to update my game to it

#

full ecs rendering is badly what I need to get going

warped trail
#

@mint iron maybe prefab component is a culprit?๐Ÿค”

dull copper
#

also pretty sure this won't work with new virtual texturing ๐Ÿ˜„

#

but I haven't really checked it yet

#

VT didn't play nicely with raytracing either

#

this is kinda big downside for all experimental stuff getting developed separately

#

there's no integration between these until they get fully released first

stable fog
#

it kinda defeats the whole point

coarse turtle
#

@mint iron I had a similar issue last night too ๐Ÿ˜ฆ

dull copper
#

I totally understand that experimental stuff gets developed in isolation

#

but it gets more painful when things stay in preview for years

#

@low tangle just tested VR mode, seems to work at first glance

#

I don't have full VR setup on this project, but it does render the both eyes on my dots project

low tangle
#

awesome, thank you

#

a cube or any model being rendered doesn't look offset in the eyes right

vagrant surge
#

there are ways of doing VT on rays, but its quite complicated

#

essentially you need to count how many rays are accessing a texture

#

tho

#

sampler feedback should make it a bit simpler

low tangle
#

thats actually something I was working on in my path tracer

#

I was working on it one day when I watched a rage documentary

mint iron
#

ok figured it out, turns out in a SubScene you can't just use the dstManager to create entities, they do show up in the SubScene world, but they're not tracked properly so they don't get injected into the DefaultWorld when the SubScene is loaded.....

vagrant surge
#

did yall see the updates with xbox series x and ps5?

#

having an SSD that is so stupidly fast is going to be amazing with the ecs model unity uses

#

you will be able to load and unload chunks/subscenes crazy fast

dull copper
#

@low tangle not sure what you mean by that but it's definitely rendering in stereo (different image per eye)

silver dragon
#

Uhm, it seems CopyTransformFromGameObject sets LocalToWorld only -> Translation is not updated and therefore the physics collider stays at the old place. It seems i need to replace CopyTransformFromGameObject with my own code, or is there something i missed?

coarse turtle
#

oh cool - didn't know GameObjectConversionSystem had a method CreateAdditionalEntity ๐Ÿ‘ thanks @digital scarab

mint iron
#

that did the trick, thanks!

opaque ledge
#

@low tangle its taking 220 ms on 400 entities ๐Ÿ˜ฆ

junior fjord
#

I have a tilemap and each tile is an entity. I often need to check neighboring tiles

#

Will I have a possibility so arrange the Archetype chunks lateron s.t. tiles that are nearby in the gameworld are also in the same chunk?

#

is it good practice to maybe lateron sort the entities which some kind of sharedcomponent that gives them their approximate location, s.t. tiles in the same area of the map will also be in the same chunk?

mint iron
#

I don't think you can modify or rely on the order of Entities. But there's a method EntityManager.LockChunkOrder()

junior fjord
#

but how are you supposed to do stuff like I described above then?

safe lintel
#

@silver dragon Def gonna need to make your own equivalent, I do it for translation and rotation for physics objects

junior fjord
#

I do stuff like water flow simulation for example (where I check the neighbors to see where water comes from)

mint iron
#

One approach is to have an array loaded as a DynamicBuffer, then you can grab it, access it via normal 2D/3D indexing.

#

or you could keep it as an Entity per element, and maybe use a map for coords => Entity.

junior fjord
#

I have a array with 2d indexing for coords => entity

#

the only thing I am thinking about is memory locality

#

if entities that are nearby on map are also nearby in memory, then it won't be a problem, but if they are scattered everywhere, I will have a problem

#

because the lookup of the neighbors will always jump around in memory

zenith wyvern
#

If you want that then you shouldn't do one entity per tile since you can't control the order of entities in a chunk.

#

I'm doing a voxel thing right now, I use dynamic buffers of different types to represent sets of block data

junior fjord
#

@zenith wyvern so you have an entity for a chunk in the voxelworld?

zenith wyvern
#

Yup

junior fjord
#

with multiple dynamic buffers for the different data

zenith wyvern
#

An entity for the region, the region has a buffer of chunk entities. The chunk entities themselves have the buffers of block data

junior fjord
#

ok but then you always have exceptions on the border of the chunk where you need to check the neighboring chunk right?

zenith wyvern
#

So I have different levels of abstraction for whatever operation I need

#

ok but then you always have exceptions on the border of the chunk where you need to check the neighboring chunk right?
@junior fjord
Yes. You need mechanism to cross borders

junior fjord
#

if you need to check a neighboring voxel, to you always have something like if(voxelX == chunkWidth){ somehow find out where the neighbor is }?

zenith wyvern
#

But you get a nice ordered array of data within a single buffer

warped trail
#

@junior fjord you can use nativemultyhashmap๐Ÿ˜…

junior fjord
#

yes that makes sense. I somehow thought I will just use sharedcomponent with AreaID later to order the entities s.t. nearby entities are in the same chunkarchetype

#

I won't have them in the exact perfect order but very nearby

zenith wyvern
#

Yeah, SharedComponents is probably what I will do. I'm avoiding trying to stick everything into a NativeContainer since that's a maintenance nightmare

#

SCD is really awkward but flexible at least