#archived-dots

1 messages ยท Page 30 of 1

rotund token
#

haven't tested at all though

#

but rendermesh no longer used at runtime

#

and it's just an array now

#

i'm assuming with all submeshes in it

#

(again havent tested it, don't quote me)

pliant pike
#

the meshe's I have are completely separate just the same level childs to a main empty game object

rotund token
#

oh they are separate

#

that should be fine =\

pliant pike
#

cool

untold mirage
#

Did anyone manage to make a build work which uses net code as a client? I tried windows and android and both get exception on connecting.

devout prairie
#

this system isn't running, i think because these queries are empty - is that normal?

#

normally it runs fine but i've just changed the ordering of some stuff and it's not running this system

molten flame
#

Maybe its [AlwaysUpdate], I dunno

devout prairie
molten flame
#

Does anyone here use PlasticSCM?

#

I've just converted all my authoring scrips to use bakers and now Unity is crashing with stack overflow which appears to be caused by PlasticSCM

pliant pike
#

I do

#

I think I've had similar errors

rotund token
#

system will always run by default

pliant pike
#

I'd stick with github in future to be honest

rotund token
#

PlasticSCM seems good for artists/designers

molten flame
#

If GitHub had a decent way to backup large files then I would do that

rotund token
#

i still want to explore it's git intergration

#

use gitlab

molten flame
#

But LFS is dogshit

rotund token
#

you get 10GB LFS instead of 1GB on github

remote crater
#

My game is in a very trippy place in a good way: https://www.youtube.com/watch?v=0iNV3jJkRp8&t=1m36s

Stuff's about to get VERY VERY VERY FUN!

www.starfightergeneral.com

We run a guild. Opportunity: I can teach you how to make games for free better they teach at expensive universities. If you help us, you get revshare.

#1 Senna NA mastery I saw no hate ever in arcades. Choose love. Also #1 world in Starcraft/Broodwar/Warcraft3/Diablo2/C&C3/...

โ–ถ Play video
#

How do I mitigate the collision from being sticky? How can I make it bounce you off?

#

1m 36s

devout prairie
devout prairie
remote crater
#

My ship when it hits the wall should bounce off

#

From 1 m 36 seconds to about 1 minute 42 seconds it gets "STUCK" to the wall

#

I saw it happen before, but I forget how to fix it

devout prairie
#

ahhh i see now

#

it's almost as if it's clipping through and then getting stuck, which is quite common

#

if you can reproduce the problem easily, maybe try increasing iterations just to diagnose if that fixes it

remote crater
#

I think it has to do with convex hull or something

#

Anyway, no big. I think its a new one since the space station I added is "static" and immovable.

#

Its a pretty cool show off video too

devout prairie
#

is the space station using a convex hull or mesh collider

devout prairie
remote crater
#

Static mesh

#

When I add in experience/random loot/random events/ inventory, it's gonna get SICK

#

surprisingly space games and trading games like Sid Mier Pirates and Elite Dangerous do not have random events like Oregon Trail or Final Fantasy.

#

Space gets boring and random events non stop will spice this game up hardcore.

#

Random events combos with proceedurally generated galaxy

#

I can't wait til next friday's patch, gonna be sick

#

THANKS COW!

#

ty tertle,enzi, korn, etc, we about to start making bak

#

bank

devout prairie
#

yeah it looks like it could have a lot of scope for nice space travel gameplay

remote crater
#

I gotta add 64 bit shifter tech

#

and some proceedurally generated stuff

devout prairie
#

k i need some sleep, laters folks!

remote crater
#

I have multiplayer and everyone who helped, if you see me making money, just ask for some if you ever need it

#

Good Night MidnightCow, gonna go see family myself. I pray everyone has productive devving.

untold mirage
# molten flame Does anyone here use PlasticSCM?

I used plastic for a few years and now we are switching back to git.

Plastic has some amazing features but it still lacks real cross platform support (Mac client lacks many features) and we also had some strange issues recently.

rotund token
#

well cross platform isn't a concern for me really

#

but what other strange issues did you have?

#

i've been loosely investigating it for pre-production

#

because git just is not good for artists

#

we run a second svn server for them which i would like to get rid of

untold mirage
# rotund token because git just is not good for artists

Indeed you will have a lot less issues and problems with plastic thatโ€™s absolutely true.

But we had some issues with projects locally corrupted (devs needed to check out a fresh repository and we couldnโ€™t really repair it or understand why it happened)

#

Overall itโ€™s rare, and most likely you will be more productive with plastic

rotund token
#

that'd be kind of unacceptable

#

did you use git integration with it?

#

or just full plastic

untold mirage
rotund token
#

well it supports gitserver right?

untold mirage
molten flame
#

I think its come a long way, at least the Unity integration has come a long way

rotund token
#

because i will have a rebellion if devs can't use their existing tooling

untold mirage
#

If you donโ€™t use lfs it might work, but if you use lfs when we tried it didnโ€™t work at all.

rotund token
#

i really want devs to have existing git workflow, while having artists on gluon

untold mirage
untold mirage
untold mirage
rotund token
#

not in like 2 years

#

it's just in my, todo list of pre-production work

#

but we're not officially in pre-production yet and i'd rather work in entities in my spare time ๐Ÿ˜„

#

i just randomly do some reading here and there

#

so until i can allocate myself some time at work to investigate it, it's going to sit there

untold mirage
rotund token
#

hmm somehow missed CreateAfter CreateBefore

spice vale
#

Now that we have system entities, has anyone found an easy way of authoring these from the editor?

rustic rain
#

these are created during world creation

#

which is runtime

spice vale
#

A pretty common case for me is that I have some system specific settings that I want to author in the editor. It was always hard to communicate config data to systems from the editor since systems don't have an inspector, but maybe now with system entities it is easier somehow?

rustic rain
#

I'd love that feature too

rustic rain
#

if it's not possible

#

store them on singleton game object

#

which will be retrieven from system

spice vale
#

That's what I did previously, just convert monobehaviours to singleton entities that has the settings. But I'd like them to end up on the new system entities now instead.

rustic rain
#

at least

#

no need for that

spice vale
#

why?

rustic rain
#

not sure whether chunk GC is implemented

#

but by creating new arhcetype

#

you make your world a little bit slower

#

so might as well just store each on their own

#

instead of combining into another achetype

#

and end up with 3 archetypes total

#

that will be a thing until there will be archetype GC

spice vale
#

my settings are completely unmanaged, so no need to gc

rustic rain
#

I talk about chunk GC

#

it's not a thing yet afaik

#

so every new archetype you create

#

will there

#

slowing iterations down

spice vale
#

You mean that each new archetype will have it's own chunk?

rustic rain
#

it will have at least 1 chunk, yes

spice vale
#

well that still applies to system entities I guess. But they are the recommended way to store system state.

rustic rain
#

yeah, it is generally a good idea

#

but since they exist

#

they don't waste chunk space for nothing

#

meanwhile moving entities from 1 to another

#

will

spice vale
#

My hope is that in the future unity will handle system entities a bit different to avoid the chunk fragmentation issue.

#

maybe not store them in chunks, but just some kind of large unmanaged array or something.

rustic rain
#

the best thing - entity

#

this way you'll have live conversion

#

so you can change settings during runtime

spice vale
#

That would require the settings to end up on singleton entities tho right?

rustic rain
#

yeah

spice vale
#

so we are on the same page. I just wish they could end up on the system entity instead of a separate entity. That would clarify to which system they belong.

rustic rain
#

for example if you have singleton component Gravity which is by default only used by GravitySystem
That doesn't mean smth else wouldn't want to use it too

spice vale
#

In 1.0.0-exp8 they added system entities. It is a entity created automatically for each system, where you are supposed to store system state instead of inside the system class/struct. So those entities indeed belong to a system.

brave field
#

Not sure whether system entities are like regular entity that will create new archetype per new system entity

rustic rain
#

there it is

spice vale
#

well yes, it is the same archetype as long as you don't add any components to them, they will all have the same default components.

misty wedge
#

I mean that's because nothing was added to it

#

Can you use Query in a static function that is called locally in an ISystem? or will that break code gen

spice vale
#

I think It will break it, but I have not tested.

#

/// <remarks> Not working in Entities.ForEach, IJobEntity, Utility methods, and Aspects</remarks>

misty wedge
#

Using query for structural changes is really annoying atm imo

rustic rain
#

how so?

viral sonnet
misty wedge
#

I meant the SystemAPI.Query API

rustic rain
#

chunks get invalid with structural changes during iteration

misty wedge
#

I mean Entities.ForEach could do it so I'm sure it's possible

rustic rain
#

๐Ÿค”

#

in a very slow fashion I guess

rustic rain
#

I thought they were tied to specific world

#

meanwhile now it seems they aren't

misty wedge
#

Ideally the codegen would create an ECB automatically, give you a reference to it in the foreach parameter, and then call playback at the end

#

e.g. with SystemAPI.Query.WithECB

#

or something like that

viral sonnet
rustic rain
#

yeah, but I'm fairly certain you could do

#

query.CalculateEntityCount()

#

without any EM or World as argument

viral sonnet
#

hm, true

rustic rain
#

public int CalculateEntityCount() => _GetImpl()->CalculateEntityCount();

#

still is

#

๐Ÿค”

viral sonnet
#

so queries must live in the world/entitymanager.

#
        {
            SyncFilterTypes();
            var ecs = _Access->EntityComponentStore;
            var mask = _Access->EntityQueryManager->GetEntityQueryMask(_QueryData, ecs);
            return ChunkIterationUtility.CalculateEntityCountInEntityArray((Entity*)entityArray.GetUnsafeReadOnlyPtr(), entityArray.Length, _QueryData, ecs, ref mask, ref _Filter);
        }```
#

yeah makes sense that GetEntityQuery goes through the local EntityManager

rustic rain
#

then I don't get it

#

how can it can be created

#

without any World reference

#

or EM reference

#

yet contain it

misty wedge
#

Since when can you do new EntityQuery?

#

It's always tied to something

rustic rain
#

EntityQueryBuilder is new

misty wedge
#

It uses the SystemState to build the query

#

Which knows the world

rustic rain
#

and doesn't use any World/EM reference

viral sonnet
#
        {
            desc.FinalizeQueryInternal();
            ref var handles = ref EntityQueries;

            // TODO: https://jira.unity3d.com/browse/DOTS-6524 CompareQuery sorts each component array in the builder
            // every time it's called. That sort could be moved outside this loop, or into
            // EntityQueryBuilder.FinalizeQuery(), to avoid doing it every time.
            for (var i = 0; i != handles.Length; i++)
            {
                var query = handles[i];

                if (query.CompareQuery(desc))
                {
                    return query;
                }
            }

            var newQuery = EntityManager.CreateEntityQuery(desc);

            AddReaderWriters(newQuery);
            AfterQueryCreated(newQuery);

            return newQuery;
        }```
misty wedge
#

You pass it to Build

viral sonnet
#

always tied to EntityManager

rustic rain
#

oh

#

Build

#

right

#

๐Ÿ˜…

misty wedge
#

Using [RequireMatchingQueriesForUpdate] on a system that only contains SystemAPI.Query calls should be fine right? Since the code gen turns that into type handles

rustic rain
#

one of devs mentioned

#

that they want to get rid of cached queries

#

that are stored internally through GetEntityQuery

misty wedge
#

I mean the query still needs to exist somewhere on the system, even if you use RequireAny

rustic rain
#

for your own usage you can store it in a field

#

for iteration it uses SystemState

misty wedge
#

That's a massive pain with the Query API, since you can't get it from that

rustic rain
#

that's why I recommend manual dependency building

misty wedge
#

How does that solve writing the query twice

#

(once in the EntityQuery, once in the foreach Query request)

rustic rain
#

I'd guess it uses same query

#

and they will be equal

#

considering there's the same Pipeline rn

#

for creating them

misty wedge
#

I still need to define the types twice, that's my issue

#

Ideally this isn't something the end user needs to worry about, and code gen will use RequireAny for a system that defines [RequireMatchingQueriesForUpdate]

viral sonnet
#

not sure what's the downside of cached queries ๐Ÿค”

rustic rain
#

you don't get to know why your system runs

#

unless you researched through code

#

that GetEntityQuery actually creates a requirment to run

rotund token
#

It doesn't anymore by default

rustic rain
viral sonnet
#

yeah, well, they wanted to make it kind of automagic and that's pretty much always the downside of that, something not being really obvious

stiff mesa
#

Hey everyone. I'm thinking to make a sort of a dictionary to search for entities by a specific value. Like

var ents = EntityDictionary.GetWhere( e=>e.Comp.Value == 2);

  1. Is there any solutions out of the box for that?
  2. If not, how would you approach this?
rustic rain
#
  1. no
#

as for how to

  1. create temporary entity query of chosen component or use existing one
  2. get chunks list from it
  3. get type handle of your comp
  4. iterate over all just like IJobChunk
  5. add entities to list that you will return later
stiff mesa
#

So, just through iteration, huh? I thought more in the direction of a HashMaps with component value as a key and entity list as a value. Each time the value is changed the entity is moved to other "cell". Is this viable in dots? Or iteration would work better?

rustic rain
#

but they have a downside

#

you need to track your component's value somehow

#

and update your hashmap

stiff mesa
#

Yeah, I didn't thought about that. That would be a chore.

rustic rain
#

if your values are not spread widely

#

you might just SharedComponent

#

this way all entities of same value will be stored in their own separate chunks

#

from another value

stiff mesa
#

Hm... I'll look into it. Thanks.
One more question. Can component store a NativeHashMap? And if not, where better to store it to have access from the systems? Separate system?

rustic rain
#

not sure anymore

#

ever since they made native collections unmanaged

#

I think you can store anything on comps

#

anyway

#

just try

#

it'll error on play

#

if component is invalid

#

or even during compilation

stiff mesa
#

Ok, I'll try. It's just became even more convoluted since 1.0 where they said they recommend to remove any public fields from systems and instead use singletons.

robust scaffold
robust scaffold
# rustic rain no way ๐Ÿ˜…

Ya know that hybrid discussion? The guy was saying singletons in Entities are ultimately a roundabout way to use a static class.

rustic rain
#

yeah, I saw that

#

I'm just

#

disagreeing with it

stiff mesa
robust scaffold
#

Static classes are baked into C# and the best performant way to access and set singleton data sets. With no restrictions compared to using a single entity.

rustic rain
#

I prefer entity data

#

or at very least

#

data attached to World

#

in any way

robust scaffold
#

I do too but they do have a point. Its a lot more performant and easier on the code side.

rustic rain
#

with later access through pointer

#

uugh

stiff mesa
rustic rain
#

anyone remembers how to get System signleton?

robust scaffold
rustic rain
#

yeah

#

it's built in feature

wraith hinge
#

I didnโ€™t say singletons were a roundabout way to use a static class. I said that I thought for the situation in question, I thought static variables made more sense

robust scaffold
rustic rain
#

aaand I can't find how it works

robust scaffold
viral sonnet
rustic rain
robust scaffold
robust scaffold
rustic rain
#

for specific system

#

I am really struggling here ๐Ÿ˜…

robust scaffold
#

World.GetSystemHandle() -> EM.GetComponentData?

viral sonnet
rustic rain
rotund token
#

getexistingsystem, getcomponentdata(systemhandle)

rustic rain
#

I am trying to implement similiar thingy for UI screens

viral sonnet
#
World.Unmanaged.GetExistingSystemState<T>().SystemHandle``` what am i doing ๐Ÿ˜„
rustic rain
#

so, world reference, ok

rotund token
rustic rain
#

๐Ÿค”

rotund token
#

works on ISystems

rustic rain
#

I want to try and implement system that allows to open UI screens based of event entities

viral sonnet
#

oh nice, right that's shorter

rustic rain
#

that store unmanaged reference to UI Screen

#

Trying to figure out though how to reference smth managed as unmanaged

#

first that comes to mind - index in List

rotund token
#

thats how my UI works

#

the system just creates the UI itself (ui elements)

rustic rain
#

nah, I use addressables assets

#

it's switching between screens which bothers me

#

because rn it caused quite too many reworks

#

and now system is so chunky I don't even want to develop it anymore

#

So I want to switch to some entity approach

#

but I also want it to be Burst Compatible

gusty comet
#

I'm getting a lot of compilation erros with a blank project. Is something wrong with my manifest:

#
{
  "dependencies": {
    "com.bovinelabs.event": "https://gitlab.com/tertle/com.bovinelabs.event.git#f827895246b9a01fa4dc146632a9260bbc19c64a",
    "com.domybest.mybox": "https://github.com/Deadcows/MyBox.git",
    "com.unity.2d.sprite": "1.0.0",
    "com.unity.2d.tilemap": "1.0.0",
    "com.unity.ads": "4.3.0",
    "com.unity.ai.navigation": "1.1.0-pre.1",
    "com.unity.analytics": "3.8.1",
    "com.unity.burst": "1.7.3",
    "com.unity.collab-proxy": "1.17.2",
    "com.unity.entities": "1.0.0-exp.8",
    "com.unity.entities.graphics": "1.0.0-exp.8",
    "com.unity.ide.rider": "3.0.15",
    "com.unity.ide.visualstudio": "2.0.16",
    "com.unity.ide.vscode": "1.2.5",
    "com.unity.inputsystem": "1.4.3",
    "com.unity.physics": "1.0.0-exp.8",
    "com.unity.purchasing": "4.4.1",
    "com.unity.render-pipelines.universal": "14.0.3",
    "com.unity.serialization": "2.0.0-exp.11",
    "com.unity.test-framework": "1.1.33",
    "com.unity.textmeshpro": "3.0.6",
    "com.unity.timeline": "1.7.1",
    "com.unity.ugui": "1.0.0",
#
    "com.unity.xr.legacyinputhelpers": "2.1.10",
    "com.unity.modules.ai": "1.0.0",
    "com.unity.modules.androidjni": "1.0.0",
    "com.unity.modules.animation": "1.0.0",
    "com.unity.modules.assetbundle": "1.0.0",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.cloth": "1.0.0",
    "com.unity.modules.director": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.imgui": "1.0.0",
    "com.unity.modules.jsonserialize": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.screencapture": "1.0.0",
    "com.unity.modules.terrain": "1.0.0",
    "com.unity.modules.terrainphysics": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0",
    "com.unity.modules.ui": "1.0.0",
    "com.unity.modules.uielements": "1.0.0",
    "com.unity.modules.umbra": "1.0.0",
    "com.unity.modules.unityanalytics": "1.0.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.modules.vehicles": "1.0.0",
    "com.unity.modules.video": "1.0.0",
    "com.unity.modules.vr": "1.0.0",
    "com.unity.modules.wind": "1.0.0",
    "com.unity.modules.xr": "1.0.0"
  },
#

All of them have to do with Collections

#

Library/PackageCache/com.unity.collections@2.1.0-exp.4/Unity.Collections/UnsafeParallelHashSetExtensions.gen.cs(71,79): error CS0246: The type or namespace name 'UnsafeHashSet<>' could not be found (are you missing a using directive or an assembly reference?)

#

I've tried matching the versions of various entities-related packages, but the Collections errors persist

sage kestrel
#

so would anyone know how to disconnect a entity's gameobject?,my hierachy is full of gameobjects that i can't change anything about,i would prefer to destroy them

gentle gyro
gusty comet
#

It's been a while since I touched Unity and DOTS. Should I create a new Assembly Definition asset for every DOTS project?

#

Thanks, that's good enough of a starting point!

gentle gyro
#

Sure...

gentle gyro
gusty comet
#

I moved every single asset from an existing Entities 0.50 project into another folder, and then upgraded to Entities 1.0

#

Now I'm progressively incorporating the old code into the upgraded project

#

But after upgrading the packages aren't playing nice

robust scaffold
#

Huh, Burst 1.8.0 removed the mention of valuetuple support from its documentation. Did they drop support for it? Nothing in the changelog mentions no longer supporting tuples.

gusty comet
#

Library/PackageCache/com.unity.collections@2.1.0-exp.4/Unity.Collections/UnsafeParallelHashSetExtensions.gen.cs(1894,86): error CS0246: The type or namespace name 'UnsafeHashSet<>' could not be found (are you missing a using directive or an assembly reference?)

rustic rain
#

so yeah

#

you gotta fix it

gusty comet
#

Do I either manually edit them, or change the version of some of the dependencies?

rustic rain
#

type was quite literally renamed, not sure about the one you sent

#

but

#

for example

#

NativeParallelHashMap was renamed

#

in fact

#

separated into 2 differents types

#

for different purposes

#

so I had to manually go over each

gusty comet
#

That's kinda messed up that we are expected to manually edit released software

#

But thanks, I'll start doing that

robust scaffold
#

Shouldnt need to do that....

robust scaffold
rustic rain
#

I was talking about your own code

#

not actual package

gusty comet
#

Oh no, this is from the Collections package

gusty comet
#

Unity version 2022.2.0b10

rustic rain
#

๐Ÿค”

robust scaffold
# gusty comet "1.0.0-exp.8"

What's your package manifest? Here's mine:

{
  "dependencies": {
    "com.unity.2d.pixel-perfect": "5.0.2",
    "com.unity.2d.sprite": "1.0.0",
    "com.unity.2d.spriteshape": "9.0.0-pre.1",
    "com.unity.2d.tilemap": "1.0.0",
    "com.unity.2d.tilemap.extras": "3.0.2",
    "com.unity.burst": "1.8.0",
    "com.unity.entities": "1.0.0-exp.8",
    "com.unity.ide.rider": "3.0.15",
    "com.unity.render-pipelines.universal": "14.0.3",
    "com.unity.test-framework": "1.1.33",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0"
  }
}```
gusty comet
#

"dependencies": {
"com.bovinelabs.event": "https://gitlab.com/tertle/com.bovinelabs.event.git#f827895246b9a01fa4dc146632a9260bbc19c64a",
"com.domybest.mybox": "https://github.com/Deadcows/MyBox.git",
"com.unity.2d.sprite": "1.0.0",
"com.unity.2d.tilemap": "1.0.0",
"com.unity.ads": "4.3.0",
"com.unity.ai.navigation": "1.1.0-pre.1",
"com.unity.analytics": "3.8.1",
"com.unity.burst": "1.7.4",
"com.unity.collab-proxy": "1.17.2",
"com.unity.entities": "1.0.0-exp.8",
"com.unity.entities.graphics": "1.0.0-exp.8",
"com.unity.ide.rider": "3.0.15",
"com.unity.ide.visualstudio": "2.0.16",
"com.unity.ide.vscode": "1.2.5",
"com.unity.inputsystem": "1.4.3",
"com.unity.physics": "1.0.0-exp.8",
"com.unity.purchasing": "4.4.1",
"com.unity.render-pipelines.universal": "14.0.3",
"com.unity.serialization": "2.0.0-exp.11",
"com.unity.test-framework": "1.1.33",
"com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.7.1",
"com.unity.ugui": "1.0.0",
"com.unity.visualscripting": "1.7.8",
"com.unity.xr.legacyinputhelpers": "2.1.10",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.cloth": "1.0.0",
"com.unity.modules.director": "1.0.0",
"com.unity.modules.imageconversion": "1.0.0",
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0",
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.physics2d": "1.0.0",
"com.unity.modules.screencapture": "1.0.0",
"com.unity.modules.terrain": "1.0.0",

#

"com.unity.modules.terrainphysics": "1.0.0",
"com.unity.modules.tilemap": "1.0.0",
"com.unity.modules.ui": "1.0.0",
"com.unity.modules.uielements": "1.0.0",
"com.unity.modules.umbra": "1.0.0",
"com.unity.modules.unityanalytics": "1.0.0",
"com.unity.modules.unitywebrequest": "1.0.0",
"com.unity.modules.unitywebrequestassetbundle": "1.0.0",
"com.unity.modules.unitywebrequestaudio": "1.0.0",
"com.unity.modules.unitywebrequesttexture": "1.0.0",
"com.unity.modules.unitywebrequestwww": "1.0.0",
"com.unity.modules.vehicles": "1.0.0",
"com.unity.modules.video": "1.0.0",
"com.unity.modules.vr": "1.0.0",
"com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0"
},

#

dang, my burst is off. That's one

rustic rain
#

wait, old UGUI can be removed in 2022?

robust scaffold
rustic rain
robust scaffold
robust scaffold
gusty comet
#

I'm doing that right now

#

Welp, that solved it

#

@robust scaffold Thanks a ton for your support though!

#

@rustic rain you too

#

I completely forgot to do the first programming troubleshooting step, which is "turn if off and back on"

rustic rain
#

ah, get used to it

#

beta editor is buggy

robust scaffold
#

I really want to use IJE but losing out on pointers is just ugh

rustic rain
#

IJE?

#

what's that?

robust scaffold
#

IJobEntity. The codegen job struct

#

The alternative is IJC (IJobChunk) and doing the enabled mask manually.

rustic rain
#

oh yeah, it sucks

robust scaffold
#

Hrm, apparently IJE does support optional components.

#

Here's my automatic inspector for a ICD on an entity. Actually pretty easy to set up without having to go through manually creating a custom inspector script.

#

Produces this:

rustic rain
#

๐Ÿค”

#

so you create inspector now through atttributes?

robust scaffold
#

Always able to. I just stumbled upon it in my source code dives

rustic rain
#

I don't like it, cause I don't really want editor code in build

#

any idea

#

what they swapped Inspector<T> with?

robust scaffold
#

These are all just properties, not actual fields. Without the editor in build, these are all stripped out.

#

And you can wrap these manually with a #if UNITY_EDITOR define anyways.

robust scaffold
rustic rain
robust scaffold
viral sonnet
sage kestrel
robust scaffold
sage kestrel
rustic rain
robust scaffold
#

I highly doubt they'll be removing it entirely but C2E runtime is being deprecated and a replacement is... somewhere. Hopefully. Maybe.

sage kestrel
# robust scaffold Oh, runtime conversion is currently up in the air right now. If you want to use ...
private void Start()
    { 
        grid = new DotsHexGrid<Entity>(10, 6, 1f, float3.zero);
        for (int x = 0; x < grid.GetWidth(); x++)
        {
            for (int y = 0; y < grid.GetHeight(); y++)
            {
                using (BlobAssetStore blobAssetStore = new BlobAssetStore())
                {
                    var go = Instantiate(testhex, grid.GetWorldPosition(x, y), Quaternion.identity);
                    var entity = GameObjectConversionUtility.ConvertGameObjectHierarchy(go, GameObjectConversionSettings.FromWorld(World.DefaultGameObjectInjectionWorld,blobAssetStore));
                    grid.SetGridObject(x, y, entity);
                    Destroy(go);
                }
            }
        }
    }

any idea how to make that use subscenes?

rustic rain
#

you put game objects in subscene
and that's about it

robust scaffold
rustic rain
#

to create additional behaviour you use Baker<T> and BakingSystem

viral sonnet
robust scaffold
rustic rain
#

no runtime anymore

#

poof

robust scaffold
viral sonnet
#

unity explicitly said they won't support runtime conversion in 1.0 and going forward as it's causing too much problems

robust scaffold
viral sonnet
#

i think there will be hacks to do it regardless but that's the official stance

robust scaffold
#

No doubt. And rolling my own wouldnt be hard. just annoying.

rustic rain
viral sonnet
#

source, hm, it was discussed here on discord. no idea when that was

robust scaffold
#

Which is why Im doing all this bullshit with companion GOs and assembly hacks to get a hybrid working. Runtime conversion solved a lot of issues.

sage kestrel
#

anyways gtg,thx anyways

robust scaffold
#

Anyone have an example using optional components in an IJE?

#

Alright, IJE optional components not possible. The [WithAny()] attribute only modifies the query search parameter and not any of the property field within it.

#

How does 2 enabled components in a single IJC work?

#

huh, I dont think it can

viral sonnet
#

good question, you'd need to check both i think. the chunkIterator is just there to skip when both are disabled

#

surely can be checked with the mask

robust scaffold
viral sonnet
#

ok if there's really no proper way i don't know what to say, i considered it a bad feature before that ๐Ÿ˜„

#

the optional comp check is also so simple. chunk.Has() done. it's maybe doable with one of the RefRO/RW structs and checking for null. i dunno, the docs on it are non-existent

robust scaffold
viral sonnet
#

maybe unity should just stop codegening jobs. ๐Ÿคท there's always something and then you wonder, for whom is it?

#

to get the complexity what can be done in IJobChunk under 1 codegen is nearly impossible

robust scaffold
#

Dont get me wrong, the codegen is sweet.

viral sonnet
#

yeah it is, for very simple jobs

robust scaffold
#

All of this into just this

#

To be fair, the first image is the header required for merging light and fov components into 1 job. And since I think I'm gonna make both L and F components into IEC, I have to split them for the enabled mask to work properly

#

Getting rid of the CTH<> boilerplate is the best part of the codegen.

viral sonnet
#

lots of dev work for something that small is not worth it imo

#

and i dunno, i write such lines once. then i copy paste

#

even parameter names are just copy paste. LightData_ReadHandle, FovData_ReadHandle, etc...

robust scaffold
#

hrm, and I cant do this since stackalloc will be inside a for loop...

viral sonnet
#

yep, that won't work ๐Ÿ˜„

#

i think it would make sense to have an additional method, in case we want control over the outer loop

#

Execute turns into ExecuteSingle or smth

robust scaffold
#

Yea. I wonder, how does aspects work with IEC as fields?

#

The more im thinking about this, the more I think IEC were a mistake...

viral sonnet
#

last IJE I saw on the forum checked entities for HasComponent every time. it just hurts reading such code. use a chunk.Has ๐Ÿ˜„

viral sonnet
#

it's a micro solution to a macro problem

robust scaffold
#

IEC minimizes memcpy by toggling the component itself instead of relying on query chunk filtering but unless the component is being toggled off and on every other frame, is it really that much of a cost to just memcopy it?

#

I guess if you want to minimize refreshing Entity fields in other components, which would make the memcpy difficult to match.

viral sonnet
#

well in terms of scalability 1.0 runs worse than 0.51 with the 128 cap, so they lowered the bar anyway. there's no fair comparison anymore. unity says, and i think the stance is pretty dogmatic, 128 entities in a chunk are enough and archetype size is mostly bigger than 128 bytes anyway. leaving out anything that runs on less. the worst thing of all, this hinders design. now you are basically a bad designer when you create an archetype with less than 128 bytes

robust scaffold
viral sonnet
#

i am fair, not every entity has a LTW

robust scaffold
#

yea, mine doesnt since I roll custom rendering, but generally 128 is a good upper cap while also allowing for v128 enabled bit mask operation.

viral sonnet
#

sure, drop some physics on it, a LinkedEntityGroup maybe another buffer. Parent and Child. soon the 16k chunk size comes into question ๐Ÿ˜„

robust scaffold
#

there is v256 though which would've been better but not supported on mobile and old pcs.

robust scaffold
viral sonnet
#

probably, i've been complaining about it a lot ๐Ÿ˜„

robust scaffold
#

I think unity is pushing for a flattened hierarchy which is why they've largely ignored the problems with it.

viral sonnet
#

everyone needs a hierarchy. at least, much sooner than IEC. yet IEC gets the core treatment

misty wedge
#

I still have trouble with that in simple gameplay stuff. For example, if I have an actor that has a lot of stuff like inventory, stats, equipment, etc, when do I start moving that stuff to other entities to improve chunk utilization or do I just not care

robust scaffold
misty wedge
#

I mean I can just use a dynamic buffer with size 0, which amounts to the same thing

viral sonnet
#

it's really based on access patterns. things like equipment and inventory can be moved out with references. stats on the other hand should stay on the main entity.

misty wedge
#

I just meant in general when "piling on" a lot of components on a single entity

robust scaffold
#

Buffers are only NativeLists, if ya want NativeHashMaps or other exotic containers it's now open season.

misty wedge
#

You still get to a point where a chunk only holds a "few" entities pretty quickly

#

especially with the stuff you mentioned, LEG, parent, child, etc

#

Since I use netcode that's like another 50 components per entity

#

~_~

robust scaffold
viral sonnet
#

i use a separate stat entity but the final stats buffer is on the main entity/avatar. there's always downsides when getting those references but as long as unity stays true on their 16k chunk size, any archetype that has a capacity of <16/32 has to be optimized

misty wedge
viral sonnet
#

netcode is pretty good. i wouldn't roll your own ๐Ÿ™‚

robust scaffold
#

And how in the world does enabled components work with aspects?

misty wedge
#

Netcode is really good, it just adds quite a few components per entity

robust scaffold
#

You can store within the aspect either the enabled condition of the component *or* the component itself, not both.

misty wedge
#

I still have no idea how I should be using aspects

#

for transforms it makes sense, but I have trouble thinking of other use cases in my project

robust scaffold
#

I think it's a neat way to conglomerate the various frequently used together components.

#

My current use case is for two components, light and fov properties. Since Lighting and FoV go through the same rendering system (just rendered on top of each other twice), they are always used together. However, an entity could have disabled light but functioning FoV and vice versa. Or both on and both off. I'm trying to make a IJE that will marshal the data within the entities with enabled components into NativeLists for dispatch to the GPU. But doing so in a single job with IJE is surprisingly difficult.

#

Since I dont know how aspects will work with two enableable components. From what I can see of IJC, the enabled bit field if both components are in the same job is smashed together using an & operation which is definitely not what I want. I want an | operation.

misty wedge
#

I guess I just usually write a system that does one thing, and then I have some kind of component to signal that a thing should happen, so I the aspect wouldn't really make a lot of sense outside of the system. But that could just be that I haven't written a lot of gameplay code yet

rustic rain
#

No need to bother until it's actually below 128

robust scaffold
#

I dont think aspects can sidestep the issue of IJC merging the enabled condition of two or more enableable components. Since the for loop is based off a IJC's enabled mask and not anything inside an aspect.

misty wedge
#

(granted they have some buffers that don't have internal capacity set to 0 that use up like 500 bytes or something)

viral sonnet
rustic rain
#

The easiest optimization I use

#

Is moving graphics to child

#

But since I use pure mesh rendering, it might not be applicable for animated stuff

robust scaffold
#

from there, it's using ChunkEntityEnumerator using this mask and not the Execute version for iteration.

rustic rain
#

I don't quite get how that works

#

So for every chunks there's 128bits, right?

viral sonnet
#

no i think for every enabled comp in every chunk

rustic rain
#

๐Ÿค”

misty wedge
robust scaffold
#

Every chunk has an array of v128. One v128 for every enableable component.

rustic rain
#

Oh

robust scaffold
#

Each bit inside the v128 corresponds to the enabled / disabled state of each component of the corresponding IEC.

rustic rain
#

So components with enable feature actually implement more

#

Memory

#

Bruh

robust scaffold
#

Yes. That's the downside, the upside is "structural changes" without actually structrually changing the entity.

rustic rain
#

I mean

#

I don't see why 128 cap

#

Technically you should be able to implement any amount

misty wedge
#

hardware limitation

robust scaffold
#

Yeaaaaaa. I dont know why either. There's v256 as well and in the hardware world there's also v512 but those are for supercomputing cluster CPUs.

balmy thistle
#

There's some associated SIMD optimizations that take advantage of the count limit

rustic rain
#

๐Ÿค”

misty wedge
#

computers can only count up to 128 before they get confused

robust scaffold
#

But enableable components break SIMD across components anyways.

#

Unless you're doing vpmaskset (whatever it's called) and those are for 64bit wide masks at most.

misty wedge
#

I have trouble deciding if I should use an IEC or just a tag that I add / remove for systems

misty wedge
robust scaffold
#

I dont get it, enabled components break SIMD / vectorization anyways. Except for the most basic of single 32bit values. All others requiring more complex structures cant be recognized by burst to vectorized across component boundaries anyways. Without manual reinterpretation to v256 and doing it by hand.

#

The only SIMD available will be during the checking operation and that screws over chunk size for everyone.

rustic rain
#

Someone said it doesn't break it

#

Somehow...

#

Smth about shader like compilation

viral sonnet
#

yeah, with hand written simd code ๐Ÿ˜„

#

j/k but i believe it when i see it

misty wedge
#

Is there a reason why there are a lot of operator implementations missing for half?

robust scaffold
misty wedge
#

That's what I want the operator to do

robust scaffold
#

? (float) halfValue doesnt work?

misty wedge
#

Sure it does

#

but half2 * half doesn't

#

I think it even has an implicit operator for half -> float

robust scaffold
#

Yea, that's math. You must do (half2)((float2)half2 * (float)half)

misty wedge
#

that looks disgusting

robust scaffold
#

It's a storage value. not a math value.

misty wedge
#

Yes, I get that. I wish the operator converted it to a float, did the math, and gave me back the half value again

robust scaffold
#

Well you can do it with your own wrapper struct but the reason why it's not provided by default is because the conversion cost is non-negligible and those unfamiliar with using half sized floats dont realize that.

#

// masks for "All" types are AND'd together + // masks for "Any" types are OR'd with each other, then AND'd with the final result + // masks for "None" types are negated and AND'd together

#

hrm

#

Alright, smashed together slightly better but still has the issue where it's one v128 and not multiple.

misty wedge
#

Do IBufferElement have some kind of massive overhead?

#

It's telling me in the archetype that an entity with a buffer of 2 half2 is using 144 bytes?

viral sonnet
#

what's your internalbuffercap?

misty wedge
#

I haven't set one

viral sonnet
#

then it's 8

misty wedge
#

And it uses an array internally with that size set?

#

I thought it resized

viral sonnet
#

only when it's larger than the internal cap

misty wedge
#

Or does it just use a static backing array and then move everything off chunk if it exceeds that

viral sonnet
#

then it will be moved outside the chunk memory

robust scaffold
#
public static class ArchetypeExt
{
    // ! Modified from ArchetypeChunk.GetEnabledMask<T>()
    public static unsafe v128 GetEnableableBits<T>(this ArchetypeChunk chunk, ref ComponentTypeHandle<T> handle)
        where T : unmanaged, IComponentData, IEnableableComponent
    {
#if ENABLE_UNITY_COLLECTIONS_CHECKS
        AtomicSafetyHandle.CheckReadAndThrow(handle.m_Safety);
#endif
        int typeIndexInArchetype;
        if (Hint.Unlikely(handle.m_LookupCache.Archetype != chunk.m_Chunk->Archetype))
        {
            typeIndexInArchetype = ChunkDataUtility.GetIndexInTypeArray(chunk.m_Chunk->Archetype, handle.m_TypeIndex);
            if (Hint.Unlikely(typeIndexInArchetype == -1))
                return new();
            handle.m_LookupCache.Update(chunk.m_Chunk->Archetype, new(){ Value = typeIndexInArchetype });
        }
        else
            typeIndexInArchetype = handle.m_LookupCache.IndexInArchetype;

        return *chunk.m_Chunk->Archetype->Chunks.GetComponentEnabledMaskArrayForTypeInChunk(typeIndexInArchetype,
            chunk.m_Chunk->ListIndex);
    }
}``` Here's the GetEnableableBits using a CTH<> instead of a DCTH. Dont know why unity didnt provide this version.
misty wedge
#

I see

viral sonnet
#

that's why a LinkedEntityGroup with default size of 8 is horrible. often you have only 2-3 elements and the rest is unused chunk space

#

and entity is 2 ints, so pretty big

misty wedge
#

But shouldn't it be 8 bytes if I have a buffer of 2 half2?

viral sonnet
#

no, the length if the buffer is 2 but the capacity is 8

misty wedge
#

No, I mean if I set a capacity of 2

viral sonnet
#

oh no there's a bit of overhead

misty wedge
#

Ah ok, that's what I was wondering

viral sonnet
#

ptr, length, capacity and something else

misty wedge
#

I guess it really only makes sense for very small buffers then

#

to not set it to 0

viral sonnet
#

yep

#

or static ones

misty wedge
#

Why static ones?

robust scaffold
misty wedge
#

At least the reported 16 bytes make sense then

viral sonnet
#
    public struct Avatar_StatBuffer_Base : IBufferElementData
    {
        public byte Value;
    }``` for example. the size never changes and DBs are actually quite nice for that
misty wedge
#

I mean it would still consume the same amount of chunk memory

robust scaffold
misty wedge
#

My buffers usually stay constant, the values just change

viral sonnet
robust scaffold
viral sonnet
#

hm, that would work then ๐Ÿ˜„

robust scaffold
#

so a fixed byte Value[2] is the same as byte ValueOne; byte ValueTwo;

misty wedge
#

I changed some rider formatting settings, this has to win the prize for prettiest line of code

robust scaffold
#

nice

misty wedge
#

thanks, I try

viral sonnet
#

damn, wasn't aware of that ๐Ÿ˜„ yeah in that case i could change it to an icomp and save some useless variables

robust scaffold
viral sonnet
#

thanks man ๐Ÿ˜„ yeah i need to rewrite this

misty wedge
#

Is it faster to iterate using a pointer than indexing the array?

robust scaffold
misty wedge
#

I was wondering why you are using the pointer in the count function

robust scaffold
misty wedge
#

Ah, I missed that, my bad

viral sonnet
#

did anyone ever test this, when a DB is exceeded it will be moved outside the chunk. but when it gets smaller again, does it ever move back? afaik it doesn't

robust scaffold
#

I forgot the method but it does.

viral sonnet
#

ok cool thanks

robust scaffold
#

also, make sure to use chunk.GetRequiredComponentDataPtrRO() for non-optional components in IJC.

#

Alright, i think this is how you use IJC with enableable components without needing to split into different jobs:

#

Well, it doesnt explode.

misty wedge
#

What if something has more than 2 hands... thonk

robust scaffold
misty wedge
#

I know, I was only joking since things usually have 2 hands ๐Ÿ˜…

viral sonnet
#

i think it's funny that IJE doesn't use chunk.GetNativeArray in the generated code but gets the ptr ๐Ÿ˜„

misty wedge
#

ptr = fast

robust scaffold
#

ptr stronk

misty wedge
#

array = slow

#

it's not hard

viral sonnet
#

yet unity doesn't want us to use them ๐Ÿ˜„

#

then

ref var speedData__ref = ref InternalCompilerInterface.UnsafeGetRefToNativeArrayPtrElement<Speed>(speedData, i);```
robust scaffold
viral sonnet
#

upside, no unsafe context needed

viral sonnet
#

btw the fastest way to get a comp ptr from a chunk is now with GetRequiredComponentDataPtrRO/W

robust scaffold
#

Yep

#

what, you cant set enabled / disabled property on bake? Tsk tsk, unity. Shame.

#

Time to hunt for the internal property to make it possible.

#

All lights disabled through the entity inspector because I was lazy to code an actual way at bake.

viral sonnet
#

wait, you managed to disable IEC on bake?

robust scaffold
#

nah

#

I did that by hand through the editor

viral sonnet
#

ah, i'm looking for solutions for that

robust scaffold
#

but the GetEnableableBits<T> using CTH<T> instead of DCTH works.

viral sonnet
#

are you remaking DROD? ๐Ÿ˜„

robust scaffold
viral sonnet
#

haha, nvm then ๐Ÿ˜„ very nice grid based puzzle game that also had shadows like that in dark rooms

robust scaffold
#

ah, no. At least I dont think so.

misty wedge
#

How do you set a shared component filter on an IJobEntity?

robust scaffold
misty wedge
#

eugh, that's kind of annoying

#

Is there some function to get the shared component data for an archetype chunk?

#

Or do I just get it normally with a type handle?

misty wedge
#

yea

#

Since they'd all have the same value

robust scaffold
#

There's SharedComponentTypeHandle<> -> chunk.GetSharedComponent(). Readonly in a job though.

misty wedge
#

Alright, so just the type handle

robust scaffold
#

Yea, everything is just type handles in the end.

misty wedge
#

I thought there might be something like ArchetypeChunk.GetSharedComponent<T> or something

#

I should be fine with only reading it once and then caching it at the beginning of the IJC though right? Since it is always the same

robust scaffold
#

Yea. Each chunk has only 1 SCD.

misty wedge
#

Thanks, just making sure ๐Ÿ‘

#

Anyone else think CleanupComponent is a weird name?

#

I think I preferred SystemStateComponent

#

I guess it more clearly differentiates them away from the new SystemState for ISystem ๐Ÿคท

robust scaffold
#

Yea. But at the same time, cleanup is basically all that it does.

misty wedge
#

Yeah but it feels kind of weird to store data there. I usually put my NativeCollections inside ICleanupComponent so they don't leak if the entity gets destroyed

robust scaffold
#

That's what they're intended for.

misty wedge
#

Yeah I know, like I mentioned I guess it just feels weird putting state data in something called cleanup ๐Ÿคท

robust scaffold
misty wedge
#

I guess if it were struct SomeComponent : IComponentData, IRequiresCleanup I would feel better about it, but at the end of the day it doesn't really matter

robust scaffold
#

Yea, like how IEC is an additional interface and not IECD.

misty wedge
#

Yep

#

Also not a huge fan of all the different types of cleanup components

#

e.g. shared, normal, buffer

robust scaffold
#

ugh, yea. Disgusting.

misty wedge
#

Something I'm struggling with while porting some code at the moment:

I have some state that is in a system, and it holds some native collections. It does some calculations, and another system relies on the length of the computed data to schedule an IJobParallelFor. Is there a better way to do this besides calling Complete on the system?

#

My first step is to move the collections out of the system and onto a component, but that doesn't solve the dependency issue

#

I also can't get the component and use IJobParallelForDefer since that also requires the job to be completed

robust scaffold
#

hrm

misty wedge
#

But the list is in the component? How would I get it on the main thread

robust scaffold
#

does the component need to have the list?

misty wedge
#

Not really, like I said, currently it's just stored in the system

#

But that doesn't seem to be the way going forward

robust scaffold
#

hrm, it is an option to make a NativeArray<int>(1) in the system with the [0] index containing the final length of the nativelist and pass a pointer to that NA into IJPFD for scheduling.

misty wedge
#

Yeah there are some ways around it, but it seems kind of cumbersome

#

Couldn't I also store a pointer to the length of the unsafe list backing the native list and pass that to IJPFD?

robust scaffold
#

You could, if you can guarantee that the list will not be disposed.

misty wedge
#

I wish you could schedule an IJPFD on a dynamic buffer

#

(but then you'd also need to get it so that probably wouldn't help either)

#

:[

robust scaffold
misty wedge
#

Yeah I think it's doable, but I'd need to get the dynamic buffer on the main thread (same as a component), and it's scheduled, so I'd need to complete as well

#

Might still be useful for other stuff though

robust scaffold
#

public static unsafe JobHandle ScheduleByRef<T, U>(this ref T jobData, NativeList<U> list, int innerloopBatchCount, JobHandle dependsOn = new JobHandle()) Just look at the source below that method signature for IJPFD and you can probably do it.

misty wedge
#

Yep, I'd still need to call complete though

robust scaffold
#

complete before? Shouldnt need to.

misty wedge
#

I can't get the dynamic buffer otherwise

robust scaffold
#

Ah, the DB yea.

#

Well, you might be able to pull and cache the DB's pointer. Assuming it's stored outside the chunk.

misty wedge
#

Is there some other way to divide logic across many threads that relies on the data on a single entity?

robust scaffold
#

Not really... IJPFD is I think the only way.

misty wedge
#

Hmm, alright. Guess I'll just do it by calling Complete ๐Ÿคท

robust scaffold
#

Singlethread is better than multithread for surprisingly the majority of options

#

unless your DB is 1000+ size.

misty wedge
#

It's just a very compute heavy operation

#

If it was just some iteration with light logic I wouldn't bother

robust scaffold
#

Can you vectorize it? Otherwise, you might be able to hack together a IJPFD using a NA containing a pointer to the DB backing array and another NA containing the list size for thread dispatch.

misty wedge
#

Basically the entity represents a world, and contains a list of chunks that need to be created. The chunks are 16x16 tiles and need to do a lot of noise generation, so I think it would be better to split it up on threads

robust scaffold
misty wedge
#

I could, but that would probably be a lot of entities per frame

#

It would certainly make the dependency handling easier

robust scaffold
#

How many times do you need to regenerate the noise?

misty wedge
#

Whenever an entity moves across a chunk boundary

#

It gets rid of the chunks that it left, and queues the ones it entered into to generate

robust scaffold
#

I dont know how you're using this noise but what I would do is get 3 already pre-generated noise textures and overlay them with NoiseTexOne and NoiseTexTwo rotating.

#

No complex noise calculation, just rotating textures and then sample a block for the final noise value.

misty wedge
#

I might do that in the future if I need to optimize, but for now each tile belongs to a biome and has multiple layers which are just set up on a scriptable object, so that would be a lot of textures

robust scaffold
#

Just 3 global 500x500 ones and then randomly sample a 16x16 block.

misty wedge
#

They use different types of noise and different frequencies and octaves

robust scaffold
#

Ugh, that's up to you then.

misty wedge
#

Haha, I know it's all cacheable. If it becomes a bottleneck I'll build some archetypes and use textures, it's definitely the much more performant approach ๐Ÿ‘

gusty comet
#

Is there a way to add a component as initially disabled during the Baking process?

misty wedge
#

Nope

misty wedge
# robust scaffold Why cant you make each chunk it's own entity?

I still have trouble gauging the performance impact of creating a lot of entities each frame. Each entity that can activate chunks can do so in a 3x3 area, so with 500 actors that's 4500"active chunk" entities, and at least 3 created and 3 destroyed per entity that moved across a chunk boundary in that update

robust scaffold
misty wedge
#

Really? Even if I add and delete potentially hundreds per frame?

robust scaffold
#

The creation / destruction is an issue though. How many times per frame?

misty wedge
#

Ah

#

Well I'd do it in an ECB, but like I said, potentially hundreds

robust scaffold
#

Do you need to structurally change them? Can you not just modify the components?

gusty comet
# robust scaffold Pain but no.

That sucks. Fortunately turns out I don't need it ATM after doing some thinking, but this seems like a pretty critical feature for most developers

robust scaffold
misty wedge
robust scaffold
#

I mean, you can create a baking system to do it, if you really really need it.

viral sonnet
robust scaffold
viral sonnet
#

disable it in runtime

gusty comet
#

Awesome! In the meantime, is there still an advantage to adding/removing components? In my current use case, the component rarely gets added and removed.

viral sonnet
#

even a baking system can't disable an IEC

robust scaffold
#

Well, "a lot faster" is relative. I doubt it's by much.

gusty comet
#

Sweet, so there's a tradeoff. Thanks!

robust scaffold
misty wedge
#

Can you pass an EntityCommandBuffer to an IJobEntity that you run on the main thread? Or do you also need to use an ECB for structural changes

robust scaffold
misty wedge
#

I also wish queries could somehow do structural changes, creating an ECB before and playing it back is really annoying

robust scaffold
misty wedge
#

You can't destroy or create entities

robust scaffold
#

Well, creation of entities is just using an archetype and specifying a number of Entities to generate. Destruction, uhhh. Let me see. I'm fairly certain you can.

misty wedge
#

I tried it earlier and everything exploded

robust scaffold
#

You can.

misty wedge
#

?

#

I'm talking about SystemAPI.Query

robust scaffold
#

Oh. that's just a glorified for each

#

I think it code gens to EntityQuery.GetEntityArray()

misty wedge
#

Yeah, but I have some stuff that does structural changes on the main thread very rarely, and there is no replacement

robust scaffold
#

Doing it using EntityQuery.GetEntityArray() -> EntityManager still works.

misty wedge
#

Yeah definitely, but I feel it would be nice if the query could do that too

robust scaffold
#

Ugh, tomorrow, i need to figure out runtime prefab spawning. Until then, sleep for me

misty wedge
#

Don't you just instantiate the entity?

#

(after baking it from the gameobject)

robust scaffold
#

I'm trying to do hybrid without companion GO

misty wedge
#

I'm not sure what you mean? The baking process converts it to an entity. There is no game object during runtime

robust scaffold
#

I've got a prefab GO inside a managed component

#

Prefab as in actual prefab. Not entity prefab

misty wedge
#

You can reference the game object inside an authoring component and baking converts it to a prefab entity

#

(that you can store as an Entity in a component and then instantiate)

robust scaffold
#

But I don't want it to convert

misty wedge
#

Why not?

robust scaffold
#

It's my hybrid GO, containing physics2d components and sprite renderer

misty wedge
#

Ah, then I misunderstood

#

I just use normal game objects and the entity stores a reference to it, I never messed with the hybrid stuff

molten flame
#

How do y'all bake your input actions? I'm finding it doesn't work in 1.0 for some reason...

misty wedge
#

You mean from the input system?

molten flame
#

yeah

misty wedge
#

Is the asset broken for you?

molten flame
#

Nah I can put the asset on a managed ICD no worries

#

but the actions maps dont want to work

#

likely a skill issue

misty wedge
#

Ok then I have no idea what you are doing, I just get my input on the main thread ๐Ÿ˜…

robust scaffold
#

Trusty built in input

molten flame
#

Do you cache your input maps in a system or something tho?

#

cos you gotta load them up at startup

misty wedge
#

I just create an instance of the input system class manually

#

And have a static class that manages it, then I just read the input or subscribe to callbacks on that instance

molten flame
#

can you screenshot it?

#

This is what I do, its on a singleton ICD

misty wedge
#

Reading would look like this

#

Everything is fetched on the main thread in a system update

#

I don't have any input stuff on entities

#

Gameplay is the action map, Target is the input action

molten flame
#

whats System?

misty wedge
#

an instance of the input system class defined by my input action asset

molten flame
#

ok this is where I'm not understanding... do you generate the C# ?

misty wedge
#

Yes

molten flame
#

ah ok

misty wedge
#

Otherwise I couldn't have an instance of the class ๐Ÿ™‚

molten flame
#

now im on board

#

yes well I've never gone that route before lol

#

I only know enough to know that I don't know, you know?

misty wedge
#

It makes it vastly easier imo, since you get compile errors if you rename, add, or remove anything

#

And you don't require any initialization (besides creating the class and enabling an action map)

molten flame
#

thanks Schnoz, I might try that

misty wedge
#

Can you not disable the multi threading safety on a component lookup?

viral sonnet
#

do you need [NativeDisableParallelForRestriction]

viral sonnet
#

ref readonly weirds me out

#

and i also find it annoying, it makes it unclear what the value is

#

eh nvm me ๐Ÿ˜„ i just had no clue about the correct syntax. it's ref readonly var val = ref someRefRO.ValueRO;

#

please put this in the comments of RefRO.ValueRO. took me quite a few tries to find this

rotund token
#

isn't this c# syntax

#

seems weird to me to comment on c# syntax in a library

drowsy pagoda
#

Hey guys, took a break from ECS, left off at 0.50. I see that 1.0 is out. Looked over the docs, I see new concepts (i.e. Aspects, Baking, etc). What's a good single go to resource that can give me good direction on ECS 1.0?

drowsy pagoda
#

awesome, thx

viral sonnet
#

c# on unmanaged memory isn't normal c# anymore. it gets pretty unclear what's happening. you don't have to use the ref. now what is val? and UnsafeUtility.AddressOf with a ref readonly doesn't work :/

#

the comment from ValueRO is already pretty lengthy. noone gets hurt if you throw in that additional info

rotund token
#

and UnsafeUtility.AddressOf with a ref readonly doesn't work :/
well that makes sense ๐Ÿ˜„

#

they can only be passed to 'in' variables

viral sonnet
#

i just want to get a damn ptr

rotund token
#

that's what the non-readonly version is for!

#

you're kind of fighting a compiler here

viral sonnet
#

i've changed my stats buffer to a fixed byte array public unsafe struct Avatar_StatBuffer_Base : IComponentData { public fixed byte Value[Avatar_StatsConfig.CONST_STATSBUFFER_BYTES]; } i can only access Value with a variable otherwise i get fixed usage in unfixed space errors.

#

now i'm not really interested in the access anyway because the ptr to it would be enough

#

if this doesn't work with ComponentLookup i'm just gonna use my UnsafeCDFE and be done with it. i want to give it a try though

rotund token
#

i can only access Value with a variable otherwise i get fixed usage in unfixed space errors.
curious what error this is specifically

viral sonnet
rotund token
#

oh literally just that

#

it's an error for a reason, just use fixed?

viral sonnet
#

this works without fixed

rotund token
#

isn't this just because you've made a copy?

viral sonnet
#

copy of the ptr or the whole struct?

rotund token
#

is VakyeRO = Avatar_StatBuffer_Base ?

viral sonnet
#

yeah, i have Base and Final

rotund token
#

so the whole thing is moved onto the stack

viral sonnet
#
        /// Returns a read-only reference to the component value itself.
        /// </summary>
        /// <remarks>
        /// This value is a reference to the actual component data.  It is safe to use this field directly, e.g.
        /// "Data.Value.SomeField".  It is also safe to make a copy of this value, e.g. "var myComponent = Data.Value".
        /// Keeping a ref ("ref var myref = Data.Value" is inherently unsafe as any structural change may invalidate this
        /// reference, and there is no way to detect this. It is safe to use this reference locally if you can guarantee
        /// that no structural changes will occur in between acquiring it and using it. Do not hold on to such a reference
        /// for any extended amount of time.
        /// </remarks>
        public unsafe ref readonly T ValueRO
        {
            get
            {
#if ENABLE_UNITY_COLLECTIONS_CHECKS
                AtomicSafetyHandle.CheckReadAndThrow(_Safety);
#endif
                return ref UnsafeUtility.AsRef<T>(_Data);
            }
        }``` why i'm even talking about this
rotund token
#

and the GC no longer cares that it could potentially move the container

viral sonnet
#
        /// "Data.Value.SomeField".```
#

hm, is there no other method to allocate an array inside an IComp other than fixed?

rotund token
#

you can use fixed containers

#

FixedList etc (wouldn't be hard to make a FixedArray version)

#

but not really sure it's what you want

viral sonnet
#

i'd need to be able to define the bytes amount

#

i've a distaste for fixed in unmanaged memory and burst, that much i know ๐Ÿ˜„

rotund token
#

for example I have this

        where T : unmanaged, IFixedSize```
#

let's me assign any size bit mask

#
        private struct Bytes4 : IFixedSize
        {
        }```
#

for example

#
        private struct StatBuffer : IFixedSize
        {
        }```
#

you could do it like this for example

#

public FixedArray<StatBuffer> Stats;

viral sonnet
#

ah, structlayout. yeah, why not. thanks.

rotund token
#

this was very, c++ inspired ๐Ÿ˜„

viral sonnet
#

and how would i get the ptr to it?

rotund token
#

it's just a struct

#

implement an access [int index]

#
        where T : unmanaged, IFixedSize
    {
        private const int Idx = 3;
        private const int Shift = (1 << Idx) - 1;

        private T data;

        /// <summary> Sets the value of a bit in the bitmask. </summary>
        /// <param name="pos"> The bit to set. </param>
        /// <param name="value"> The value to set it to. </param>
        public void Set(int pos, bool value)
        {
            this.CheckArgs(pos, 1);

            fixed (T* t = &this.data)
            {
                var ptr = (byte*)t;

                var idx = pos >> Idx;
                var shift = pos & Shift;
                var mask = (byte)(1 << shift);

                var bits = (byte)((ptr[idx] & ~mask) | (-value.AsByte() & mask));
                ptr[idx] = bits;
            }
        }```
#

for example this is how my set works for my bit array

#

it's just a struct that holds a block of data you assign from the generic

#
        {
            get
            {
                fixed (byte* t = &this.data)
                {
                    return t[index];
                }
            }
            set
            {
                fixed (byte* t = &this.data)
                {
                    t[index] = value;
                }
            }
        }```
#

would just look something like that

#

for an index if you were doing a fixed array

#

you can make a ref return version

#

or whatever you want

viral sonnet
#

thanks, i'll try that tomorrow. tbh, i don't want to use fixed mainly because of this ```byte* stats = null;

            if (spellData.Effect_Main.Value.snapShotStats)
                stats = statsAccessor[i].Value;
            else
            {
                ref readonly var tmp = ref StatBuffer_Final_Lookup.GetRefRO(spellOwner.source).ValueRO;
               
                stats = UnsafeUtility.AddressOf(ref tmp);
            }```
#

doesn't play nice with something like this

rotund token
#
        {
            get
            {
                var d = UnsafeUtility.AddressOf(ref this.data);
                return ref UnsafeUtility.ArrayElementAsRef<byte>(d, index);
            }
        }```
#

i think would work

viral sonnet
#

and i wrote a small method to return a ptr which has that warning

#

unity dev lied to me ๐Ÿ˜ฆ said i can get the address from a RefRO

rotund token
#

seems to work fine?

#
            void* b = (void*)a;```
viral sonnet
#

did i just miss the most obvious solution?

#

that's not working for me

rotund token
#

try void

viral sonnet
#

same error

rotund token
#

interesting

#

no idea

viral sonnet
#

what type is your this?

drowsy pagoda
#

Can someone give me a quick example of the power of using Aspects?

rotund token
viral sonnet
#

ah, seems the struct is the problem

rotund token
#

still unsure why you don't want to use fixed?

drowsy pagoda
#

But I don't see a DOTS file menu, not any option to enable Live Conversion. Even in the Edit>Preferences>Entities section.

gentle gyro
rotund token
#

Type internal

#

check edit -> preferences -> entities again

#

they accidently? left an attribute on the option to hide it from the menu

drowsy pagoda
#

lol, now that's just odd. thx for the tip

#

i also like how that is disabled by default. Go Unity! haha

rotund token
#

i'm not sure if it is or just your state you had before you upgraded is just stored

deft pilot
#

instead they just foreach

#

SystemAPI.Query<RefRW<LocalToWorldTransform>, RefRO<RotationSpeed>>()

#

any reason to do that?

#

or is this a burst compiler thing

late mural
#

i see unity physics has a 1.0.0 experimental version, does it support the new transform system yet? Or is it still using the old one?

rotund token
late mural
rustic rain
#

hmmm

#

Unity removed [BurstCompatible] attribute

#

I like it though

#

was a nice way to mark whether certain method is burst compatible

rotund token
#

they renamed it

rustic rain
#

I saw [GenerateBurstCompatiblityTests]

#

but I feel like

#

that's smth different

rotund token
#

they renamed it to what it actually does

rustic rain
#

huh?

rotund token
#

that's what the attribute always did

rustic rain
#

I used it only for personal work in IDE ๐Ÿ˜…

rotund token
#

it generated unit tests

#

that could be run in a build

#

to test if a method actually worked in burst

rustic rain
#

so

rotund token
rustic rain
#

if it's marked with attribute

#

then during run it'll error?

#

if not burst compatible

rotund token
#

if you run the obscure command to do it

#

and make a test build

#

and run the tests

#

then yes

rustic rain
#

ah

rotund token
#

(unless you are very determined, i very much doubt you were actually getting anything out of those attributes; they only do anything if you proceed to run the codegeneration that knows about them AND then make a player build afterwards)

rustic rain
#

yeah, I only used them to know whether method can be used in Burst

rotund token
#

grumble grumble
var commandBufferSystem = SystemAPI.GetSingleton<BeginEffectEntityCommandBufferSystem.Singleton>();

Packages\com.bovinelabs.effects\BovineLabs.Effects\Effects\Systems\EffectDestroySystem.cs(66,39): error SGSA0001: SystemAPI usage with generic parameter not supported

#

this doesn't look generic to me ๐Ÿ˜ข

#

was kind of hoping I could just have a base ECBS

#

so i didn't have to keep manually implement the Singleton

#

but i guess is why unity didn't do that...

#

it's fully resolved though so I really feel like it should be handlable

rustic rain
#

So sadge, we still don't have a way to register generic components through reflection

rotund token
#

Still didn't understand your use case of this that wouldn't break il2cpp

#

Was it just convenience

rustic rain
#

and yeah, this is pretty much for convinience and some edge cases

rotund token
#

It's just that il2cpp has even stricter requirements on generics than entities and burst

#

I've broken il2cpp multiple times from generics that work fine in mono / entities

rustic rain
#

does il2cpp allow for loading new assemblies in runtime?

rotund token
#

Not mono ones

#

It can load native libraries and you can inject into it

rustic rain
#

so il2cpp are fine?

rotund token
#

That said you seem focused on Modding so probably only looking at Windows mono? in which case this all all mute

proud jackal
rustic rain
#

I am certainly focused on Modding, but tbh registering ComponentTypes in runtime is not related to it really

rotund token
#

while I have you for a minute @proud jackal, can I ask what the possibility of something like this would be?
#archived-dots message

proud jackal
#

For 1.0 likely not - but I'll happily show how one might add it to the generator themselves, with the obvoius caveats of changing entities yourself :3

rotund token
#

obviously i don't expect some major feature request for 1.0, i'm sure you have a whole task list of stuff to do

#

was just more curious about a) if it's feasible (which you seem to imply it is) and b) if it's something that would even be considered

#

as for doing it myself, i have had a quick look at the Unity.Entities.SourceGen.JobEntity.csproj

#

which I assume is where it'd be done?

#

but I try not to make changes to packages as it's just a pain to maintain and I don't need the feature enough to warrant breaking this rule at the time

#

just been thinking a lot about how entities 1.0 is shaping up with systemapi and how clean code is starting to look

proud jackal
#

JobEntityDescriptionSourceFactory.cs
with changes like this would pretty much do it:

rotund token
#

ok so tempting

narrow scaffold
#

Does anyone know if there is a problem with having many systems that run very infrequently?
I would like to create an individual system for each ability a player or npc can perform to allow for maximum flexibility in terms of execution logic. Or can you think of a better way to encapsulate the logic of an ability?

rotund token
#

historically yes it's been terrible

#

in 1.0 with ISystem it's a lot less problematic

#

we basically merged all our systems into 1 giant system

#

in 0.17

#
merging to single system, lots of little jobs - 2.5ms
1 single system, merging into 1 large job (reusing Gets) - 0.75ms
1 single system, 1 large job, burst compiling Gets - 0.35ms```
#

this is what i mean by being terrible in 0.17

#

benchmark xbox one back in February

narrow scaffold
#

Okay very interesting

rotund token
#

now this has improved a lot in 2022 + 1.0

#

job scheduling is much cheaper

#

using ISystem significantly reduces system overhead

narrow scaffold
#

So if I have to make a design choice right now, do you think I can go with the many systems approach or would you still opt for fewer bigger systems to be safe?

rotund token
#

cached GetX and Update is much faster

rotund token
#

i should say we have like 500 systems or something ridiculous in 0.50

narrow scaffold
#

We are probably talking around 100-150 different ability systems max

rotund token
#

unfortunately i don't have the numbers of large enough project to say either way if this would be fine now

#

we are unlikely to upgrade work project to 1.0

#

and well it'll take 2 years before next project is large enough to start finding scale issues

narrow scaffold
#

Okay I will do some testing on my own and keep the architecture flexible for now I guess. Thanks a lot tertle!

rotund token
#

i will say very roughly that systembase is like 0.1ms and isystem is 0.01ms with like single query / job

#

overhead at least on my machine

#

so do the maths

#

or just create 150 dumby systems ๐Ÿ˜„

#

thinking about it, personally 150 systems for a single feature might be a bit much, but for no particular reason though

rustic rain
#

Last time I checked, I have 89 systems including built in

#

no netcode, no physics though

proud jackal
#

150 systems = 150 entities so there is that, but not like the biggest cost in that :3 But from a design perspective, 150 framgentations of one feature does feel weird to me

rustic rain
#

runs totally smooth

#

that's what I meant

deft pilot
#

I've read up one way how to reference prefabs in a tutorial, but tried to use IBufferElement over IDataComponent to reference multiple prefabs but the authoring component doesn't have an editor drag drop

#
    [GenerateAuthoringComponent]
    public struct EnemyPrefabElement : IBufferElementData
    {
        public Entity Value;
    }
#

how would you fill this?

uncut rover
#

why have a partial struct ?

deft pilot
#

shrugs probably typo when testing

#

but anyway how would i create a collection of prefabs

#

to refer to

rotund token
uncut rover
#

are you using 0.51 ?

deft pilot
#

still in 0.51

#

is 1.0 out?

uncut rover
#

in experimental yes

rotund token
#

yes, couple of weeks now

uncut rover
#

with 2022.2

deft pilot
#

welp...

#

guess i'll go download that

rustic rain
#

Get ready

#

it's full of bugs ๐Ÿ˜…

uncut rover
#

In this video we will present the main packages of Unity's Data oriented Technology Stack.
We will also setup our workspace and introduce the core concepts of ECS that we will explore in the next videos.

SOURCE CODE & FOLLOW ALONG CONTENT

https://github.com/WAYN-Games/DOTS-Training/tree/DOTS-101
com.unity.rendering.hybrid

CHAPTERS

00:00 ...

โ–ถ Play video
rotund token
#

is it?

uncut rover
#

it will take you to 1.0 in the 4th episode

rotund token
#

@deft pilot if you use a lot of [GenerateAuthoringComponent] i would highly recommend duplicating your project so you can see previous data

deft pilot
#

i don't

rotund token
#

well if you don't, it's not that painful of an upgrade

deft pilot
#

okay good

#

the only thing i used it for was literally this thing

#

weird installed 2022 dont' see 1.0.0

#

do i have to manually download it?

rotund token
#

2022.2.0b8+

#

i thought if you had it already installed it'd show up

#

as an upgrade button

#

you are using 2022.1 not 2022.2

deft pilot
#

damnit

#

missed the .2