#archived-dots

1 messages ยท Page 279 of 1

rotund token
#

the size will be the number of stats in my game, estimated between 100-500 for release

viral sonnet
#

500 stats? teh fuck ๐Ÿ˜„

rotund token
#

stats are more than you think

#

str, int, dex etc

#

increased damage

#

but its more than that

#

this is a completely project wide generic system

#

stat could be ability to talk to actor

#

you'll love this

viral sonnet
#

ah cool, so pretty much every variable to track something

rotund token
#
{
    public float Value;
}

public struct StatEffect : IComponentData
{
    /// <summary> The stat type this affects. It matches the index in the stat schemas. </summary>
    public ushort Type;
    public ShortHalfUnion Value;
    public StatModifyType ModifyType;
}

public unsafe struct StatValueBuffer : IBufferElementData
{
    [NativeDisableUnsafePtrRestriction]
    internal StatEffect* Effect;
}

public unsafe struct StatValue : IComponentData
{
    [NativeDisableUnsafePtrRestriction]
    internal StatEffect* Effect;
}```
#

stats are part of my effect system

#

all my effects are tiny standalone entities

#
{
    public ushort Type;
}

public struct ConditionActive : IComponentData
{
    public BitArray8 Active;
}

public struct EffectActive : IComponentData
{
    public bool Active;
}```
#

so StatValue exists on the effect entity

#

but the owning actor has the same ptr in a buffer (all stat effects of an entity have a pointer into this buffer)

#

so stats can write their state directly to their owning entity without needing to do BufferFromEntity(Entity)

#

basically 5 types of effects atm that control everything

  • modify stats (above)
  • capabilities (put things on cooldown etc)
  • add tags (stunned, invisible, etc)
  • remove modifiers (poison etc)
  • create new effects
misty wedge
#

Are your dependencies handled with the normal job dependency system?

viral sonnet
#

ah that's pretty good, I utilize pointer caching too. do you set the ptr all the time or how do you handle chunk changes when the ptr would change too?

rotund token
#

everything is ISystem atm

#

i use some query tricks to ensure safety

rotund token
#

the entity change it doesn't matter

#

it's pointing to a large chunk of 'stat' memory

#

basically i sat down and was like, how would i do this if i was using c++

misty wedge
#

Something I was wondering, if I have an IComponentData with an UnsafeCollection inside, it should be safe to write to that unsafe collection inside a scheduled job as long as I'm declaring that dependency properly, right? (e.g. ref inside an Entities.ForEach). I assume it just won't detect me modifying it if I don't pass the correct dependency

viral sonnet
#

ah cool, how do you manage the big block of memory?

#

btw. the picture you've just scribbled down is why I think ecs is not *that * great

rotund token
#

traditionally i'd do this all on the actor entity

#

but by separating it, it's a lot more dynamic and easier to develop

#

i can conditions a lot easier

#

and also checking condition changes on effects is just much faster in tiny archetypes

#

i can actually smash 10,000,000 effect entity checks

#

in a fraction of a ms

#

i think it was 0.24ms if the chunks had nothing else

#

going up to 0.74ms if i add 32 bytes of random data in the archetype

viral sonnet
#

so the block in the middle is still an ecs chunk?

rotund token
#

nope

#

the middle block is my own managed memory (managed bad term, i mean i'm managing it)

#

cant use ecs chunks, it'd move

viral sonnet
#

yeah, thought so ๐Ÿ™‚

#

a lot of design ended up in such blocks or I'm planning to. shame that unity hasn't thought of it. maybe because they are not actually developing games ๐Ÿ˜„

misty wedge
#

I doubt very many games need the performance required by such a system, and if they do, I think you are at the point where you either decide to work around the kinks or write your own engine

viral sonnet
#

can you detail the middle block somewhat? I'm mostly using a data type similar to NativeList. linear memory, able to grow

rotund token
#

UnsafeUtility.Malloc

#

except i have custom native memory allocators

#

i havent decided which i'll use it

#

i have a bunch of slaballoctors etc

#

need to determine what works best in actual realistic conditions

misty wedge
#

Is there a list of stuff that they plan to add in with 1.0 besides the "journey to 1.0" or whatever the post was?

viral sonnet
#

just malloc? is this a frame buffer then? how do handle resizes?

#

yeah there's a whole roadmap

#

you have surely seen t

viral sonnet
misty wedge
#

Ah I haven't actually seen that one

#

Haven't had a lot of time to check up on DOTS stuff since I've had to learn inferior languages like python and JS :[

rotund token
#

and it's persistent while the effect entity exists

viral sonnet
#

ah ok, I thought it's a global buffer for all stat values. so the block is per actor?

rotund token
#

it is a global buffer of all stats

#

each player has a buffer of the stats that are on them

viral sonnet
#

python is great, had to use it for tensorflow. python > c# for ML

misty wedge
#

Only had a short course in university on it and while it was interesting it's not really my thing

#

too much math @_@

devout prairie
#

Any idea if there is any guarantee of the order of an EntityQuery

#

ie say you have a bunch of components called MyTag, that are created in a specific order, one after the other

#

and they are never destroyed

#

would an EntityQuery for those always return an array in the order they were created

misty wedge
#

I wouldn't rely on it

#

If you need their order why not just index them

devout prairie
#

yeah i'm wondering, maybe layout/order could change maybe if archetypes/chunks change

viral sonnet
#

pretty much every system i'm optimizing and happy with then is a process of moving lots of data into specialized containers. putting all data into a chunk is such a trap. I still have not really found a good feel of which data should end up there and which shouldn't. that's really hard and often unintuitive to find out.

devout prairie
misty wedge
#

What do you need their order for?

viral sonnet
misty wedge
#

Just do this: UnsafeUtility.Malloc(SystemInfo.systemMemorySize * 1000000, UnsafeUtility.AlignOf<float>(), Allocator.Persistent);

#

Computers hate this one simple trick

devout prairie
misty wedge
#

Relying on the order of the entities just seems like it could produce some nasty bugs down the line

viral sonnet
#

if the chunks doesn't change and only grow the order stays the same

#

i just wonder how you'd never delete something but if you don't, you're good. also, entity indexing is quite fast which wouldn't rely on being completely deterministic

#

is blob data actually put on the stack? or how can we force to put the whole blob there? i think ref reading values one by one slows down a lot. maybe I'm wrong though

misty wedge
#

I think only the reference is put on the stack

#

But since the entire blob is layed out linearly in memory it should be in the cache after you access it and be very fast

viral sonnet
#

my blob would exceed a cacheline

misty wedge
#

That doesn't change if you were to somehow copy it

#

You'll still need to actually read it

rotund token
#

effects aren't super frequently created

#

on piece of gear [un]equipped

#

on point put in talent tree etc

#

etc

misty wedge
#

on bite taken out of croissant? if it's a poison croissant?

rotund token
#

the more frequent ones would be via combat, poisoning etc

#

probably handled by ecb.AppendToBuffer but undecided

#

depends how i implement that side of it

misty wedge
#

Are "old" effects deleted? Otherwise I feel you would have a lot very quickly

#

For example if someone eats a lot of poisoned croissants in a short timeframe

rotund token
#

yeah that'd be a bunch of effects

#

i'm testing with 10,000,000

#

and processing state changes in under 1ms

#

so atm i can handle a lot of effects on a basic level

#

obviously that number will never be that high and there's a lot of other parts that won't be nearly as fast

misty wedge
#

That's a lot of croissants

rotund token
#

Croissant eating game

#

Get a pack of croissants as a bonus for early access

misty wedge
#

Marketing โœ…

devout prairie
#

anybody know if there is a method to get a euler from a math.quaternion

viral sonnet
rotund token
#

yeah bit of a pain

viral sonnet
#

i wouldn't recommend it though. do you really need the euler angles?

rotund token
#

i think the physics package has some

#

generally i feel like the main good case of euler angles is (first person) character controllers

devout prairie
#

thanks yeah i'm deconstructing and reconstructing some bone rotations with per-axis adjustments

viral sonnet
#

be aware of inaccuracies, angles could start to drift

devout prairie
#

yeah, thankfully i realized i actually only need to do it one way for now, so i can use quaternion.Euler(float3) to construct a rotation from a euler

#

i might need to actually get the euler value from a quaternion at some point though

viral sonnet
#

is this an actual downside of profilemarkers? i measure every part of the code yet there are these huge gaps in between

rotund token
#

my job without profile markers, 0.6ms, my job with profile markers, 2.4ms

#

profile markers don't profile themselves!

viral sonnet
#

hm, i'd at least expect the gaps to be the same size, yet the last one is much wider

#

and yeah, profiler markers should profile themself and show it. as they are now they are pretty trash

#

at least, i'm not figuring anything out other than, a quite involved method that does a lot takes double the time as acquiring GetBufferAccessor that's only called once. that can't be right ...

#

if i comment out the method the job is so much faster that the method takes at least 80% of the time. I don't get why that's not showing up with the markers

#

burst must remove a lot when i comment it out. otherwise i can't explain it

devout prairie
#

Okay so i have an interesting quaternion math problem:

#

Normally to get the world/global position from a local position you would do:

Vector3 childGlobalPosition = (Quaternion)parentGlobalRotation * (Vector3)childLocalPos + (Vector3)parentGlobalPosition
#

However in Unity.Mathematics it's not possible to do the equivalent quaternion * float3 like this:

#
float3 childGlobalPosition = (quaternion)parentGlobalRotation * (float3)childLocalPos + (float3)parentGlobalPosition
#

I have no idea of the math to make this work

#

using math.mul((quaternion)parentGlobalRotation, (float3)childLocalPos) doesnt work either

rustic rain
devout prairie
#

nah it just doesn't allow quat*float3

rustic rain
#

ahem, weird it won't mul quat and f3

devout prairie
#

i think in standard unity it's setup to allow Quaternion * Vector3

#

but not with the Mathematics library

#

this type of math really isn't my strong point ๐Ÿ˜

rustic rain
#

well, it surely must allow you to mul(quat, f3)

#

can you double check?

devout prairie
#

yeah no it doesn't

#

ah wait

#

i'm an idiot

#

it does

#

jeez, was forgetting to replace the * with a , in math.mul

#

not enough sleep, is my officialยฎ excuse

rustic rain
#

classic

#

well, TIL that to get world position of child you just multiply rotation by local position

rustic rain
#

I didn't know how to do that one

#

but now I know

#

kek

#

You came for help, but you actually gave me one xD

devout prairie
#

Ahh hehe.. yeah I really need to learn the math behind this stuff properly, I basically just pick up what I need to get the thing done

#

Having stuff like transform.InverseTransformPoint etc is mega convenient but you can get away with years of not knowing the math behind it

#

In the same token, you dont need to know the circuit diagram of a CPU to be able to operate a PC

rustic rain
#

Knowing math helps as you will be able to create complex algorithms

devout prairie
rustic rain
#

I personally enjoy creating world space animations through async code a lot

devout prairie
#

That's actually part of what i'm doing

#

I've created a code driven procedural walk animation

#

Then i've used it to drive a custom IK system

#

Which then drives the joints of an active ragdoll setup

#

So it's, kinda complex, but i built and prototyped each part in gameobject world with standard unity mono's and joints etc, then unified the code into one single mono/update, and now i'm transferring the whole thing to pure dots

rustic rain
#

why not do it through dots in the first place?

#

Seems like same effort while testing

devout prairie
#

mm well prototyping i think is definitely 10x faster with standard unity

#

not thinking about data layouts and ordering etc etc

rustic rain
#

uugh, I rarely think about data layouts in dots at all xD

devout prairie
#

just throw some code together, build some gameobject prefabs, tweak joints and values easily in the editor etc

#

fair enough yeah, i do find it easier to prototype in the editor though

#

i think, for pure logic situations, ie not dealing with joints and hierarchies so much, dots is arguably just as quick and maybe actually simpler/easier

#

really looking forward to seeing how it performs once i've finished the dots version

#

life would be a bit easier if they hadn't removed the Animation package ๐Ÿ˜

#

that's basically why i decided to prototype a procedural anim system

#

i tested unity's Animation Rigging for IK, it's really nice and runs on Jobs, but it relies on having an Animator component so can't be used for a pure dots solution, would need to be hybrid setup

rotund token
#

imo it's ill-advised to use vs code for dots at this stage

#

i would definitely stick with vs studio or rider

#

but to answer your question, not really sure sorry

#

so v-rising is interesting - first game i've seen make use of subscenes, 1744 of them to be precise!

solemn hollow
#

first time seeing it. looks great

rotund token
#

oh the game? super popular

#

35k reviews on steam in 1 month

#

they have some really giant jobs

solemn hollow
#

is there a talk about it?

rotund token
#

no

#

i'm just decompiling the code ^_^'

solemn hollow
#

๐Ÿ™‚

rotund token
#

well i probably won't go that deep because il2cpp and i cbf

#

just looking at signatures atm

#

can tell you a lot

#

HandleGameplayEventsSystem for example has 25 BufferFromEntity

solemn hollow
#

maybe just 25 diffrent eventqueues?

rotund token
#

they aren't all events*

#

oh well, time to actually play it ๐Ÿ˜„

#

public BufferFromEntity<AggroDamageHistoryBufferElement> getAggroDamageHistoryBuffer; // 0x16B0

#

stuff like this

solemn hollow
#

you know how big their team was?

rotund token
#

moderate

#

i had a look before

#

35 on this list

solemn hollow
#

ah the bloodline champion guys

devout prairie
#

any idea if it uses dots Animation?

solemn hollow
# rotund token

i had a follow up question to your effects implementation.
How do you handle update order of affected stats and when and how do you update the stats on a unit?

#

Do you recalculate all stats whenever a new effect is added to a unit?

#

How do you deal with stuff like agility attribute changes speed. (all agility must be calculated before speed then)

#

after you can calculate the speed from items + attributes etc

rotund token
#

How do you handle update order of affected stats and when and how do you update the stats on a unit?
first pass i literally update them every frame

#

that was what i was testing this morning when i had weird performance

solemn hollow
#

ah ok

rotund token
#

can update 10k units with 512 stats in 0.70ms

#

but yeah my next objective is to filter this down a lot since its really not needed

solemn hollow
#

well with such a performance you dont really care if you recalculate all stats on one unit if 1 effect changes

#

my system is supposed to be reactive. but i still have to check every effect every frame for what i believe you called conditions

rustic rain
#

every time you change component data in subscene

#

it'll regenerate that entity

#

thus you can tweak everything in editor

devout prairie
#

yeah, subscenes for me are buggy and fickle tho, not worth the hassle

#

i'll move things in to a subscene at a later point if it makes sense to, but at this point, it causes more problems than anything

rustic rain
#

But you can create subscene just for this testing purpose

#

literally drop 1 entity here

#

do not close it upon clicking Run

#

and here you go

#

fully debuggable entity, ability to edit authoring component

#

it's actually that easy

devout prairie
#

yeahhh that easy if you're doing something simple maybe.. i eventually decided to just stop fighting it and not use them

#

problems with conversion scripts running or not, problems with scripts updating after changes, etc etc etc

rustic rain
#

hmm

#

Can I use Unsafe Container in component?

#

or do I just use buffer?

#

hmm

#

all right, generate attribute

#

still doesn't support it

rotund token
#

nothing stopping unsafe containers

#

its just a pain to manage the memory

rustic rain
#

how so?

#

I thought unsafe containers are just normal native ones with pointer instead of actual memory

solemn hollow
#

how much performance improvement did you guys see when switching to ISystem for a System that is basically just scheduling one job and doing nothing else on mainthread? is it worth the hassle right now?

safe lintel
#

personally my relatively complex systems tend not to be that complex and also use things that cant be used with ISystem yet so its hard to tell

rustic rain
#

what's up with ISystem?

#

Never heard of it or it's use

#

also not a single word in manual

safe lintel
#

unmanaged burstable systems

rustic rain
#

wait what, where is burst compile settings are now?

safe lintel
#

same as they were before?

rustic rain
#

No option to disable compilation

#

๐Ÿค”

solemn hollow
#

It always was in Jobs menu

rustic rain
#

oh

#

me blind

solemn hollow
#

does anyone else randomly have spikes in systems execution on mainthread? i have some frames where certain systems just need 100x more time than usual. and all the system does on mainthread is scheduling... so how does it take nearly 1ms to schedule 2 jobs???

#

usually its around 0.01-0.02 ms

#

it has something to do with DisposeSentinel.Create

rustic rain
#

yep, I do

#

no idea what is that

solemn hollow
karmic basin
#

Then it won't be a problem at runtime :)

rustic rain
#

allthough, it might be jobs debugging

solemn hollow
karmic basin
#

Yep, in a build

solemn hollow
#

and why do i have those red bars there telling me i allocate garbage when the profiler says i generate 0 garbage?

karmic basin
#

I don't remember if it's one of the safeties you can disable or Always on

solemn hollow
karmic basin
solemn hollow
#

hmm safety is off though

#

leak detection is still on.

karmic basin
#

Yeah should be this safety. To warn you when you forget to dispose

#

Hence the name

#

(dispose sentinel)

solemn hollow
#

still i find it weird that it just spikes sometimes.

#

but i can confirm it is the leak detection. no more spikes without it

gilded glacier
#

does anyone use or know of some ecs frameworks ?

#

I had started making my own sort of "framework", because ecs is kinda barebone, and I don't like some features, like the default bootstrap, which is simple, yet not very practical solution

solemn hollow
#

well DreamingImLatios has a framework with some nice tooling inside. havent tried it though

gilded glacier
#

the problem is that writing my own framework takes time (so I don't really contribute to my projects) and is incremental, you could say, because I add features and solutions only when I encounter the problem

gilded glacier
#

are there any more options ?

solemn hollow
#

there are some nice packages that help with events and polymorphism in components but not so much frameworks

gilded glacier
#

not that I know everything it does, it's that I have a solution for addressables that I've incorporated into my code

solemn hollow
#

Latios even said he shouldnt have named it framework.

gilded glacier
#

what would he call it ?

solemn hollow
#

i think he said its actually a collection of tools atm. but im not sure. its somewhere buried to an answer to me on the forums i think

#

but thats the most complete "framework" you will find

gilded glacier
#

it has some nice features, like physics, audio and stuff

#

I just try to analyze what it can do, whether it's worth porting my projects to it, but his demo kinda discouraged me with his rap god style description of certain use cases, instead of describing general stuff, workflows, and how things relate to each other

#

I've had a similar problem with svelto ecs, as all the necessary information was encrypted and turned into lengthy articles, and I ended up making a whole diagram to visualize individual stuff and how they relate to each other (not to mention different naming)

solemn hollow
#

well ecs just isnt easy to make userfriendly yet. so there is much to explain i guess

rustic rain
gilded glacier
rustic rain
#

ah

#

as in some kind of template

gilded glacier
#

yeah, sort of

rustic rain
#

I wouldn't really rely on that ngl

#

considering state of ECS atm

gilded glacier
#

also, hybrid solutions are necessities even today, and I'm afraid vanilla unity ecs is not handling it well

rustic rain
#

on new update you might just end up with not updated framework

#

because ECS might change a lot

gilded glacier
#

that's why they say it's not production ready ...

rustic rain
#

there are certainly no ready solutions for a lot of problems

#

but nothing stops you from recreating them yourself

gilded glacier
#

yes, there are things that do

#

like time

#

I tend to regret not putting my time and energy into the final product

#

and I assure you, I've wasted a lot of time on such things

#

already made tools and solution, even if it would mean sticking to the same ecs version for the entire life of a project, might just be the best, I just need to know which are made the most suitable way for my case, as I use addressables, the new input and ui packages, and I do things procedurally, so there's like no gameobject to entity conversion (most of the stuff isn't even supported by ecs, such as animations, audio, lighting, etc.)

rustic rain
#

yep, but just not in this alpha state of ECS

solemn hollow
#

why is building subscenes SO much slower... pre converting my project to subscenes i had buildtimes of around 20-30 min. now it takes close to 60

rustic rain
#

wha

#

20-30 mins

#

is already a lot

solemn hollow
#

yap...

#

idk what im doing wrong

solemn hollow
#

and then the build doesnt even start... without giving me an error i comprehend T_T

rustic rain
#

hmm

#

is there a way to profile building process?

solemn hollow
#

also i dont understand why it wouldnt use the incremental build pipeline in my case...

#

i build into the same folder without any changes. it still takes 50 min

solemn hollow
#
Asset Pipeline Refresh: Total: 0.306 seconds - Initiated by RefreshV2(AllowForceSynchronousImport)
    Summary:
        Imports: total=0 (actual=0, local cache=0, cache server=0)
        Asset DB Process Time: managed=0 ms, native=304 ms
        Asset DB Callback time: managed=0 ms, native=1 ms
        Scripting: domain reloads=0, domain reload time=0 ms, compile time=0 ms, other=0 ms
        Project Asset Count: scripts=11699, non-scripts=5231
        Asset File Changes: new=0, changed=0, moved=0, deleted=0
        Scan Filter Count: 1
    InvokeBeforeRefreshCallbacks: 1.591ms
    ApplyChangesToAssetFolders: 0.273ms
    Scan: 272.346ms
    GatherAllCurrentPrimaryArtifactRevisions: 1.366ms
    UnloadStreamsBegin: 3.169ms
    UnloadStreamsEnd: 0.048ms
    Untracked: 27.532ms
#

this is from the editor log. its scanning the files and sees 0 changes (takes 272.346ms. -> ca. 5 min)

#

then it does this multiple times over...

#

the next scan takes 800k ms

#

why is this so slow and why is it done multiple times

rustic rain
#

hmm, is it possible to edit gravity factor in physics body?

solemn hollow
#

IIRC yes

rustic rain
#

I need to be able to toggle body from being kinematic and dynamic

#

Can't find on which component

#

it is written

solemn hollow
#

sry cant look... building

#

should be in body

rustic rain
#

no idea what is it

#

Tried changing inverse mass

#

it resulted in weird result

solemn hollow
#

ah i meant its in PhysicsBodyAuthoring

#

no idea in which IComponentData it is written in conversion

#

@rustic rain if (body.GravityFactor != 1) { DstEntityManager.AddOrSetComponent(entity, new PhysicsGravityFactor { Value = body.GravityFactor }); }

#

from the conversionsystem (PhysicsBodyConversionSystem)

rustic rain
#

yeah, but it's required in runtime

solemn hollow
#

?

rustic rain
#

switching body from kinematic

#

to dynamic

#

I think

#

it's inverse mass after all

#

but it's so weird

solemn hollow
#

why you think its inverse mass? the snippet i posted shows u that it should be in a PhysicsGravityFactor component

#

at runtime

rustic rain
#

wha

#

I don't even have that component

#

xD

#

maybe it's added

#

upon

#

modifying gravity factor from default

solemn hollow
#

look into the conversionsystem i got it from

rustic rain
#

well yeah

#

seems like it's added if not -1

#

according to that code

solemn hollow
#

yes. and -1 seems to mean that the body is kinematic

rustic rain
#

isn't it supposed to be 0?

#

-1 seems like will just reverse gravity

solemn hollow
#

where did you get -1?

#

i see it is added if it is not 1

#

since a factor of 1 would do nothing

rustic rain
#

oh

#

just typo

#

I meant 1

solemn hollow
#
{
get => m_MotionType == BodyMotionType.Dynamic ? m_GravityFactor : 0f;
set => m_GravityFactor = value;
}
#

thats from PhysicsBodyAuthoring

robust scaffold
#

I have no clue how to use a subscene

#

And the fact that the DOTS hierarchy doesnt highlight the currently selected entity is so fucking dumb

#

How did that manage to make it past QA?

#

[Worker2] 1 entities in the scene 'TestSubscene' had no SceneSection and as a result were not serialized at all.
Anyone know what this is?

solemn hollow
#

im sure subscenes will be amazing at some point. RN using them has alot of hidden implications im not totally aware of yet. i am still converting stuff to be compatible with subscenes... took me quite a while already. I expected performance speedups but really it feels slower working with them in my current workflow

solemn hollow
robust scaffold
#

Ehhhh, i'm gonna stick with the tried and true just manually convert it using OnStart

solemn hollow
#

do you mean the converttoentity component?

robust scaffold
#

No. Make my own monobehavior that has a section of code in OnStart() or OnAwake() that gets World.DefaultGameObjectInjectionWorld And just creates the entity with relevant components.

#

Never go anywhere near the conversion workflow

solemn hollow
#

ah so no conversion but basically spawning in first frame

robust scaffold
#

pretty much yea

#

and destroying the GO after first frame

#

unless it needs to be rendered of course

#

i havent gotten to the point of creating my own rendering system for sprite so I use the built in one

solemn hollow
#

well conversion will be the standard and optimized workflow at some point. if you have a project that will go on for a while i think its better to use subscenes sooner rather than later

robust scaffold
#

well, it seems intended for the HybridRenderer ecosystem but I dont have HR so it breaks sprite rendering

solemn hollow
#

ah wait was it you who just used 1 or 2 systems and the rest was still gameobject code?

robust scaffold
#

Yea

solemn hollow
#

yeah makes sense then.

robust scaffold
#

Do we still need the convert to entity component if its being converted by subscene?

solemn hollow
#

how i handle sprite renderer (with pure ecs gamelogic) is instantiating a gameobject for each entity that needs a spriterenderer and sync the gameobjects transform

robust scaffold
solemn hollow
#

if they are converted by a subscene they should have it

#

maybe if you instantiate extra entities aside from the ones created by conversion you need to add it?

#

but it should work with CreateAdditionalEntitiy()

robust scaffold
#

How do you use this section of the inspector?

solemn hollow
#

umm not sure but you probably need to use the right LiveConversion setting

robust scaffold
#

It's active

solemn hollow
#

where do you have this Entity Conversion preview? havent seen it yet

robust scaffold
#

Right below

solemn hollow
#

works for me

robust scaffold
#

huh, recreated the GO again and it works

solemn hollow
#

sometimes the scenecache is somehow broken.

#

you can use this to clear it and force it to rebuild:

robust scaffold
#

hrm, if I add my PointLight conversion script, it breaks again

#

when I remove it, it works

solemn hollow
#

your script got deleted. but i didnt see anything wrong at first glance

robust scaffold
#

hrm

#

Adding a generateAuthoringComponent makes it work but not my own IConvertGameObject

#

I wish I could set default values but this is fine

devout prairie
#

bbeemmsa

robust scaffold
solemn hollow
#

i use hybrid renderer for sprites that dont have animation

#

so i just let the spriterenderer be converted

robust scaffold
#

Thats annoying, im gonna have to do it myself

solemn hollow
#

for everything with animation i spawn a gameobject after conversion which is only the representation and sync it with the entity pos

#

that way i can still use all the old systems which have no ECS implementation yet but can do all the costly stuff like AI in ecs

robust scaffold
#

Because I can not convert physics 2d colliders and movement must be through the physics system

solemn hollow
#

through the old physics?

robust scaffold
#

yea

#

not DOTS physics, just regular 2D physics

#

i had issues with instability and vibration when moving against DOTS physics surfaces even with the Z level of objects clamped

#

Anyone know how to remove that message?

#

what the fuck is wrong with the entity debugger anyways? It has HIGHLIGHTED ENTITIES

#

Guess which entity i clicked

#

Guess which entity I clicked

#

BLUE HIGHLIGHTS. REVOLUTIONARY

solemn hollow
#

well in theory it is replaced by those debuggers :

#

oh wait you dont know about the dots hierarchy?

robust scaffold
#

nope

#

The first image is the debugger, second is the hierarchy

#

what do i need to toggle on to allow selected entities be highlighted

#

because in its current state, it's unusable

solemn hollow
#

ah i see now what you mean. i guess the highligthing broke in 2021 or sth. it worked before.

#

if you have the SubScene in edit mode you see which one you selected atleast

#

(the one with the cube symbol)

robust scaffold
#

Yea, barely

#

so dumb

#

I want to remove that message, it takes up nearly a fourth of the window

solemn hollow
#

well that will be fixed. for now its totally fine to use the entitydebugger. it has features the other debuggers dont really have yet

robust scaffold
#

the debugger works so well. Old reliable. Unity should stop trying to reinvent the wheel with so many useless windows and empty space

solemn hollow
#

there are some nice new concepts too. i like the relationships stuff.

robust scaffold
#

The inspector I admit is the one place they actually improved

#

Hierarchy, system, and archetypes need to be scrapped

solemn hollow
#

idk. i like it actually. i just miss the possibility to filter for a set of components in the hierarchy

rotund token
#

Yeah hierarchy just needs proper filtering

#

I barely find myself using entity debugger anymore now

robust scaffold
#

Maybe because I'm doing my own hybrid things, I still need the GO list up and inspector. I dont have the room for 3 more windows

rotund token
#

I just have dots hierarchy and normal hierarchy in same group

#

And just switch between the tabs

#

I agree I can't have them all on the screen at once

#

But entities debugger is so big can't have it on the screen at all!

robust scaffold
#

Yea, conversion is a neat concept but I need GOs mirrored in ECS world, not the other way around. Physics2D doesnt work well with entity conversion.

#

Hrm, i might just create my own conversion system with that priority in mind

solemn hollow
#

@rotund token you got any idea why incremental builds could be broken? i need 50+ min per build even without changes

rotund token
#

That seems very long

#

Only takes me 15min for a full build at work...

#

Unless I'm doing like super optimised ps4 which needs like 128gh memory and 4 hours...

solemn hollow
#

Total: 687.795292 ms (FindLiveObjects: 67.524917 ms CreateObjectMapping: 22.962209 ms MarkObjects: 595.840083 ms DeleteObjects: 1.467167 ms)

#

Memory consumption went from 4.56 GB to 4.55 GB.

rotund token
#

Well that's 1.2 seconds

#

My personal project build time halved in 2021 over 2020

#

Only 3 min on il2cpp

solemn hollow
#

ups wait i thought that was a summary

#

oh lol sry that was not the build. that was an asset pipeline refresh in editor

rotund token
#

But yeah work still 2020 so have no major project to compare

solemn hollow
#

well i wouldnt call my project major.. thats the thing

rotund token
#

What level is your c++ compiler on

solemn hollow
#

where do i see that? :S

rotund token
#

Project settings

#

Debug, release or master from memory

#

Release should be default, master on some platforms could take a long time

solemn hollow
#

u mean this ?

rotund token
#

No

solemn hollow
#

hmm you know which sub menu it is located at? cant seem to find it

#

in build settings i did build with mono. cause IL2CPP wouldnt build at all

#

i also read somewhere that mono is supposed to be building faster

#

im trying another il2cpp build now

#
UnityEditor.Build.Pipeline.ContentPipeline:BuildAssetBundles (UnityEditor.Build.Pipeline.Interfaces.IBundleBuildParameters,UnityEditor.Build.Pipeline.Interfaces.IBundleBuildContent,UnityEditor.Build.Pipeline.Interfaces.IBundleBuildResults&,System.Collections.Generic.IList`1<UnityEditor.Build.Pipeline.Interfaces.IBuildTask>,UnityEditor.Build.Pipeline.Interfaces.IContextObject[])
Unity.Scenes.Editor.EntitySceneBuildUtility:PrepareAdditionalFiles (Unity.Entities.Hash128[],UnityEditor.Experimental.ArtifactKey[],UnityEditor.BuildTarget,System.Action`2<string, string>,string) (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Scenes.Editor/EntitySceneBuildUtility.cs:219)```
#

no idea what causes this ๐Ÿ˜ฆ

#

omfg :

IL2CPP requires the use of generic sharing to work when using Unity 2021 LTS. This can be enabled via Project Settings > Player > Configuration Section > IL2CPP Code Generation > Faster (smaller) builds. Depending on how generic types are used by your game, there will be an additional runtime cost in IL2CPP builds with generic sharing enabled. We are actively looking into this issue; please share any feedback you have to help guide our efforts towards addressing this.```
#

and this Faster (smaller) builds Option is only available in alpha builds...?

coarse turtle
#

No it's available in 2021 too

solemn hollow
#

oh man. in the post i posted above it was supposed to be in Project Settings > Player > Configuration Section > IL2CPP Code Generation > Faster (smaller) builds.

#

mind you this is the actual current post explaining knows issues for Entities 0.51...

coarse turtle
#

Huh - so this is all I did to get my build working in 2021 and entities 0.51 ๐Ÿค”

rustic rain
#

Managed to make it work by adjusting colliders

#

And applying 0 velocity to certain constraints every tick

#

So far seems to fullfill my needs

#

Which is collisions, triggers and a bit of gravity

solemn hollow
robust scaffold
rustic rain
#

I don't use those

#

What exactly are you trying to achieve?

robust scaffold
#

just 2d gameplay with a tilemap

solemn hollow
#

top down or side?

robust scaffold
#

top down

rustic rain
#

So what's up with tilemap?

solemn hollow
#

so do you actually need a collider or is everything on y = 0 anyways?

#

i do top down 2,5D and i just use a navmesh on my tilemap

rustic rain
#

I haven't used classic unity much so I don't really have much idea xD

robust scaffold
#

converting a composite collider2d into a 3d physics collider mesh is painful and even then, moving along its surface causes vibrations

#

i got a lot of projectiles as well that bounce off the collider as well

solemn hollow
#

but has your tilemap height?

robust scaffold
#

no, just flat 2d

solemn hollow
#

then why not have a huge plane as a collider. and some kind of navmesh where your agents actually move that is baked from the tilemap

rustic rain
#

What's even the point of tilemap collider

#

Why not just have many box colliders?

#

Or plane

robust scaffold
#

i got a lot of colliders, moving a bunch of box colliders will massacre performance

rustic rain
#

Hmm

#

If you move through translation

solemn hollow
#

honestly im not sure it would. if you make them static it might work anyways

rustic rain
#

It won't have any effect of perfomance

#

Physics world is rebuilt every tick

solemn hollow
rustic rain
#

From current state of components on entities

rotund token
#

what manarz said

#

physics is broken into 2 groups, static/dynamics. statics only rebuild if something has changed.

rustic rain
#

If you instantiate static object during runtime

#

Does it count?

robust scaffold
#

hrm, i'll see if anything changed with physics since the last time I checked

solemn hollow
robust scaffold
#

which was about back during 0.15 days

rustic rain
#

Considering dynamic world suffers worse fate most of the time

rotund token
#

on a tangent, i would not have made a 2d game in entities - you guys love pain ๐Ÿ˜ฌ

rustic rain
#

It's fine

solemn hollow
#

well i couldnt do it without dots performance

rustic rain
#

It took just 2 systems

#

To turn 2d into 3d

rotund token
rustic rain
#

1 to edit authoring

#

2 to fix physics velocity for my orientation

solemn hollow
rustic rain
#

Everything else is same as 3d

solemn hollow
#

and i fucking love ecs architecture

rustic rain
#

Triggers collisions and etc

rustic rain
#

I cringe every time I have to work in classic unity world xD

#

Hopefully dots will make it to 1.0 and someone might hire me xD

solemn hollow
#

but tertle is right. 2D was a lot of PITA. just today i finally managed to get rid of all the unnecassary 2D Tools overhead unity has... Like sprite Resolver at runtime. IK manager at runtime, Sprite Sorting Groups

#

i went from 40fps to 80 fps in editor...

rustic rain
#

Wha

#

So you just edited manifest file?

rotund token
# solemn hollow well obviously it leads to 1 recalculation of the static world

not sure about that

    batchInChunk.DidChange(LocalToWorldType, m_LastSystemVersion) ||
    batchInChunk.DidChange(PositionType, m_LastSystemVersion) ||
    batchInChunk.DidChange(RotationType, m_LastSystemVersion) ||
    batchInChunk.DidChange(PhysicsColliderType, m_LastSystemVersion) ||
    batchInChunk.DidOrderChange(m_LastSystemVersion);
if (didBatchChange)
{

    Result[0] = 1;
}```

```if (world.NumStaticBodies != previousStaticBodyCount)
{
    haveStaticBodiesChanged[0] = 1;```

```if (buildStaticTree)
{
    m_StaticTree.Reset(staticBodies.Length);
    BuildStaticTree(staticBodies, aabbMargin);
}```
#

any change to any static causes the entire static tree to rebuild

rustic rain
#

And removed unnecessary packages?

solemn hollow
rotund token
#

oh i get you, 1 recalculation

#

i thought you meant, only 1 entity is recalculated

#

not 1 physics world is recalculated

solemn hollow
#

well incremental rebuilding would be nice to have

#

but honestly the static scene should be static

rotund token
#

well unity physics is specifically designed around being stateless

solemn hollow
#

ah true. that would also be considered state

rustic rain
#

What about those 2d tools you mentioned?

solemn hollow
#

whenever i think i understand how to get sth deterministic and stateless i always am surprised at the actual implications

rustic rain
#

I want fos improvement too xD

solemn hollow
#

but to be able to do that we had to change a lot about how we built our prefabs

rustic rain
#

Ah, it's your own code you disabled?

#

Or unity's?

solemn hollow
#

no i just disabled the IKManager2D for example. so unitys

#

but that again meant i had to write a tool that converted Animations with Ik to Animations without IK

rustic rain
#

Smth I don't use at all, it seems

solemn hollow
#

its the 2DAnimation package

rustic rain
#

I am stuck with animator

#

As hybrid

solemn hollow
#

yes me too

#

not hybrid though? on a gameobject

rustic rain
#

On go yes

#

Works fine

devout prairie
rustic rain
#

If I execute animator manually

devout prairie
#

Was reading up on Havok earlier, just wondered if it related to the problem you were having

rustic rain
#

Tbh not sure if I should try and write my own 2d renderer and animator xD

solemn hollow
#

but didnt u make that spacesim game?^^

rustic rain
#

Smth tells me focusing on game would be better

solemn hollow
#

i didnt think it would turn out 2D

rustic rain
#

It's different project

#

It was almost finished on classic unity

#

So I decided to finish it

#

But on ECS

#

xD

solemn hollow
#

"finished" ^^

rustic rain
#

Basically rewrite from scratch

#

It was literally almost finished

#

I only needed to finish UI, fix minor bugs and build it for android

#

And that would be released project kek

robust scaffold
solemn hollow
#

but wait u wanted normal physX unity physics right? wouldnt u have the same problems?

devout prairie
solemn hollow
#

well sleeping isnt stateless i guess?

devout prairie
devout prairie
solemn hollow
#

yes but physx is not stateless either. so also a problem for multiplayer as far as i understood

robust scaffold
solemn hollow
#

but i never implemented a physics multiplayer so dont quote me here

solemn hollow
robust scaffold
#

yea... i guess no unrolling. What I want is no vibrations when moving along a surface

devout prairie
#

Anybody know how i'd recreate Quaternion.FromToRotation with Unity.Mathematics

solemn hollow
rustic rain
solemn hollow
#

IIRC it did feel smooth

robust scaffold
solemn hollow
#

i mean its one of the most basic usecases of every physics package right? move along terrain

rustic rain
rustic rain
robust scaffold
#

moving the circle against a fixed position box, pushing against it diagonally, resulted in the circle continuously repulsed.

rustic rain
#

Through force?

robust scaffold
solemn hollow
#

did you use continuous collision setting?

robust scaffold
#

Holding down the movement key against the box (moving the circle), resulted in the sphere "vibrating" against the surface of the box.

robust scaffold
rustic rain
#

I meant how you move it

#

As in

robust scaffold
#

WASD sets the velocity parameter of the circle rigidbody

rustic rain
#

What changes to what components

robust scaffold
#

Just that, very simple. I have a copy here but for physics 2D. Use it everywhere

rustic rain
#

Oh, it's classic 2d

robust scaffold
#

Except the velocity was a float3 because 3D, but the Z was 0.

#

yea, nothing fancy at all, very simple

#

My project is top down 2D, so there will be a lot of pushing against wall tiles when moving. If the collider vibrates against just a single box, it's not usable.

devout prairie
#

I have no idea the math behind it tho ๐Ÿ˜

rustic rain
#

I don't know that function

#

Just asking what it does

devout prairie
#

yeahh

rustic rain
#

Cause I might know logic behind

#

If it takes 2 positions and returns wuat

#

Quat

devout prairie
#

takes two vectors ( 'directions' )

rustic rain
devout prairie
#

yeah this is what i'm not sure, is it that simple ๐Ÿ˜

#

i guess i could test and compare the results

rustic rain
#

To minus from is direction vector

#

And then Euler to convert into quat

devout prairie
#

yeah i mean if you minus one position from another, it'll give the direction

#

but in the case of working out the rotation between two direction vectors, not sure

#

if the math is as simple

#

this type of math is the black hole at the center of the galaxy for me ๐Ÿ˜›

rustic rain
#

It's not directions but positions

devout prairie
rustic rain
#

Oh

#

That's different

devout prairie
#

yeahh

rustic rain
#

Hmm

devout prairie
#

They should open up the code behind the old unity maths methods for the benefit of people transitioning to dots

rustic rain
#

I guess logic behind is creating quats for both

#

And doing matrix division

#

Not sure though

devout prairie
#

Yeh see that's the edge of the black hole for me

robust scaffold
#

You can just use the quad

#

does it have to be lowercase instead of upper?

rustic rain
#

Quat multiplication is rotation

#

X*y

#

X original rotation

#

Y is how you rotate it

devout prairie
rustic rain
#

So you know Z - result rotation

#

And you might get it by division, but I'm not sure if that's a thing tbh

devout prairie
#

actually i was getting this error with upper case, which i wasn't getting in my managed version

solemn hollow
devout prairie
#

so i figured screw it i need to bite the bullet and figure out how to do this without the helper method

solemn hollow
#

btw. my artist tried to build and it took 1,82 hrs... there is definitely sth broken or i use some very wrong pattern...

#

im done for today

late mural
#

hey trying to learn how to build with dots, and im following the manual's guide, but im having a hard time installing the windows build package, it just gives me errors, are there any dependencies?

rotund token
#

you do not use windows build package anymore

late mural
#

oh ok, guessing the manual is slightly outdated then?

rotund token
#

all the packages except the default build package are no longer used

#

and that is included in the dependencies for entities

#

what part of the manual tells you to get windows build package?

late mural
#

brb with a link to it

rotund token
#

i don't see anything on here

late mural
rotund token
#

you're looking at 0.17

#

manual

#

when you did need it

late mural
#

yup.... only realised now...

#

thank you so much, sorry that im a bit of an idiot

#

is there anywhere in the manual that says how to set up the build configuration thing? As i cant seem to find anything about it and i have a bad feeling im missing something obvious....

late mural
#

hmm from more research i see that in 2021 the component menu is a pick a path situation, and you just guess and until you have what you want, but still what is needed for it i cannot find, im really missing something lol

#

ok found some samples on the github, gonna mess arround with them and see if i can get them working

#

ok i think i got it working, although new challenge, i need to work out how to add scenes to the build thingy, or somehow find the option that lets me build whatever scene i have open

#

ok it appears there is no information online about this, so ill have to trial and error until i find some weird way of making it work, although personally i am mildly annoyed that the manual had no info on how to build a dots project

rotund token
#

you add a scene list

late mural
late mural
rotund token
#

add component

#

its just htat in 2021 the menu is broken

#

and you can't browse it

#

that's probably the problem you're having

late mural
#

yup, but the buttons still work atleast

rotund token
#

imo just load up a 2020 project and set it up

#

or simply import the one from the samples project

#

once components are added works fine

late mural
#

oh i did import from one of the sample projects, tried many, none of them are working, cause none of them have any scenes in them

rotund token
#

pretty sure it should have the scenelist on the build config though?

#

you just add your own scene

late mural
#

let me go check again brb

rotund token
#

like the manual image

rustic rain
#

Oh god, broken build asset

late mural
#

oh mine has no scene list, which tab is the scene list under so i can add it?

rustic rain
#

Still not fixed?

late mural
#

guess and check

#

but there is a simpler way

#

just use the search feature

#

which is basically not broken

#

say you want to add a scene list in the broken thing, as i figured out, you search "scene" and then click the top result, usually you get what you want

#

so the component thing, while it may look broken, it still works fine basically

rustic rain
#

Huh, that's a nice catch

late mural
#

lol

rustic rain
#

I used to brute force

#

And add all

#

Until run out of options xD

late mural
#

welp atleast you know now that you could have used search

#

tbh i used to do the same though lol

rotund token
#

this is what i use

late mural
#

lol

#

anyway, now that ive built it, where on earth in my file system would it have gone, as for some reason i couldnt find the location settings, so i just hope the default was good

rotund token
#

if you don't specify a path

#

i believe it's in project/Builds

#

at least that's where mine end up

late mural
#

that is what i thought, but that is an empty folder on my end

rotund token
#

not sure =S

late mural
#

yup that is how mine looks

rotund token
#

maybe last place previously built

rotund token
late mural
#

lol

late mural
rotund token
#

there is a component you can use to specify build output folder

#

just builds where i want it it to by default though

late mural
#

lucky lol

#

the weird thing is i found it, but it built an empty folder...

rotund token
#

sure it built successfully?

late mural
#

not sure, let me go check brb

#

i dont know, it didnt give me any errors like it used to, so i suppose it did good?

rotund token
#

it should error if it fails

#

did it at least say successfully built

late mural
#

it didnt say anything

#

ill try rebuilding

#

same result

rotund token
#

whats in your log

late mural
#

what log?

rotund token
#

you know

#

the unity console

#

where everything gets logged ๐Ÿ˜„

late mural
#

lol

#

nothing currently, other than unity complaining about some random fir tree not having the correct shader apparrently (i dont even have it in the scene)

rotund token
#

if it hasn't logged success or errored it hasn't built

#

what components are you using

late mural
#

these ones

rotund token
#

yeah thats not enough

late mural
#

oh, what do i need?

#

i just kinda copied the samples....

rotund token
#

pretty sure you need general settings

late mural
rotund token
#

and classic build profile, scene list - which you have

late mural
#

ok ive got it now, and ill rebuild and report back

#

ok it is giving me an error finally!!

#

appears to be something to do with dots compiler messing something up, gonna restart the editor and rebuild, and then ill report back!

rotund token
#

Turns out leaving it float, int even with the nice data struct burst can not vectorize it. Requires the float4/int4

#

From my experience this is very common

#

If you want to vectorize it, got to give it the right data

late mural
rotund token
#

what's with everyones build taking so long =S

late mural
rotund token
#

ah ok

#

manarz was having 50min+ builds =S

late mural
#

yikes, i hope mine doesnt take that long

#

i wonder why building dots takes so much longer than non-dots?

rotund token
#

i don't know

#

Build Win-ClientServer succeeded after 1.30m.

#

my dots project only takes 1min 30

late mural
#

woah lucky

rotund token
#

il2cpp

#

let me clear the incremental build

late mural
#

as someone who isnt famillier with that stuff, what is the difference between the llpc2 or whatever it is called and the other build options?

rotund token
#

as the name suggests il2cpp is basically converting il 2 cpp ๐Ÿ˜„

late mural
#

aha, that means nothing to me, other than cpp which is c++ id assume?

summer pilot
#

note, il2cpp: Intermediate Language to C++

late mural
rotund token
#

are you familiar with how c# traditionally works under mono or .net ?

late mural
late mural
#

woah from reading that, that sounds cool!

rotund token
#

.net includes the CLR (common language runtime) which is the execution engine.

programs written for .net (e.g. using c#) don't compile into machine code, instead they compile into CIL (common intermediate language code) and execute JIT (just in time) converting CIL to machine code depending on architecture.

late mural
#

thanks all for teaching me such intriguing stuffs!

#

that sentence did not have good grammar, but i couldn't figure out a better way to structure it lol

rotund token
#

think of mono as an alternative

#

and it's what powers the editor

#

and why you can recompile quickly in editor and just jump into game

late mural
#

oh ok cool!

rotund token
#

il2cpp on the other hand converts the intermediate language to c++ then compiles it natively

#

just reading that should make you understand why it takes longer

#

but il2cpp can produce much faster code than the old mono found in unity

#

the other important reason it exists is certain platforms don't support JIT only AOT (ahead of time) compiling

#

e.g. IOS

#

anyway i'm no expert on this but it should give you a basic idea of it

late mural
#

wow, that is fascinating, thank you so much for teaching me this stuff lol

rustic rain
#

Il2cpp is nearly impossible to mod sadly

rotund token
#

not really true

#

there's good injectors on it now

#

people modded our game within a week

#

even unlocked our dev console (whoops, forgot to disable that)

late mural
#

lol

rustic rain
#

Decompiled code is absolute worst to read

#

With il2cpp

rotund token
#

it's hard to read source, sure, but you can get all contracts easy enough

#

this is my dump of v-rising contracts which uses il2cpp

#

for example

rustic rain
#

Uugh

#

I just wish Unity will update to 6.0 net

rotund token
#

that said

#

it comes a lot down the developer - it's obviously going to be a lot easier if you provide info

#
{
    // Fields
    private Dictionary<ComponentSystemBase, PerformanceRecorderSystem.RecordingKey> _Recording; // 0x18
    private Stopwatch _Stopwatch; // 0x20
    private bool _IsThisSystemRecording; // 0x28
    public static bool StaticRecordingEnabled; // 0x0
    private static int _JobWorkerCount; // 0x4```
#

like you can see all fields in systems

#

decompiling il2cpp has got pretty good

solar spire
#

They're making the necessary steps to update internally, it'll just be a while

rustic rain
#

I'm not sure what would be a good pattern for making game that is meant to be modded. Make it il2cpp but leak source?

#

What would be downside for leaking source though?

rotund token
#

a good moddable entities game shouldn't even need source

#

you just need to know the contracts

#

now will we see this case anytime soon? probably not

late mural
#

build in a file perhaps that just interprets each line as a line for a dev console which can spawn and do whatever

#

could make it easy to mod then for people

rustic rain
rotund token
#

if you design it so systems are only controlled by data with no coupling

#

then you can really do anything just by manipulating data

#

now doing that is very very hard

#

but it's a dream!

rustic rain
#

Yeah, that's what I am aming for at this point

#

Previously I would use some inter system methods

#

But I soon realized how bad it is

#

State entities really help with that

#

RequireSingleton makes things so much easier and fluent

solemn hollow
rotund token
#

it just complicates it

solemn hollow
#

ah harder for the modder to understand the contract?

rotund token
#

if you're only looking at contracts (say, system names and data structs)

#

how can i know what weird setup i need to do to override your system

#

i can't just go in and turn off your calculate stat system etc

#

and replace it with my own

solemn hollow
#

i see. so youd say chains of systems running on data would already be coupling systems?

#

say your stat system is actually a ssystemgroup

rotund token
#

it depends - like it makes sense to pass data between systems

#

maybe you only want to override 1 part of a pipeline of systems

#

that is a great way of modding

#

but if i can't do this without calling some impossible to find method on a second system

#

or worse - the second system depends on a native container from the first system

#

how can i easily modify this behaviour

solemn hollow
#

hmm i didndt do this for moddability but for my own quick refactoring needs but i dont pass any containers between systems ever atm. all is passed through the ECS structure

#

thats why i wondered what you mean by coupling. cause i thought not coupling things was the easy not so performant way

rotund token
#

modability doesn't necessarily go hand in hand with performance

solemn hollow
#

skyrim T_T

#

i mean when you and enzi talk performance its probably like 100x faster than how i do things but dots is still sick in even my case.

rotund token
#

i'm very heavy about the data driven and moddability atm

solemn hollow
#

yeah out of intuition id say the effectssystem you showed would be easy to mod and is fully datadriven. even though you have this EffectsDataMemoryBlock

chilly crow
#

effectssystem ๐Ÿ‘€

rotund token
solemn hollow
rotund token
#

ok i swear to god its random

solemn hollow
#

why was this bot added...

rotund token
#

write groups setup

#

very specific behaviour per system

#

but honestly, these systems would probably not need to be modded

#

better off just modding in custom effects/conditions

#

which imo is the best way to mod!

#

just data

solemn hollow
#

i never fully understood writegroups TBH

#

never really bothered too

rustic rain
#

they are cool

#

let you kind of create some sort of abstraction in components

rotund token
#

unity has a good color example these days imo

#

the tldr is someone can create a component that my system doesn't know about that my system will now use in the WithNone part of the query

#

so if they add that component to an entity, my system will no longer run

#

and instead they can have a system to implement alternate behaviour

solemn hollow
#

and how do they declare that their component is part of another write group?

rotund token
#

[WriteGroup(ComponentType)]

#

on their component

chilly crow
#

woah that's pretty cool

solemn hollow
#

[WriteGroup(NotMyControlledComponent)]
MyComponent

rotund token
#

a simple example, your game has no stealth mechanic but someone wants to come in and mod your game and add one

lets say you have a footstep system that shows footsteps on the ground, plays audio etc. well if it was a writegroup, they could make a stealth component and make it target say FootStepComponent and stop your footstep system running while the entity is stealthed

#

they've added a stealth override with 1 attribute to your systems even though you never built it into the game

#

i think write groups are the ultimate modding tool

solemn hollow
#

i see. so i should declare writegroups for the components my system writes to

rotund token
#

they only work on things in a query with readwrite

#

so thats automatic you just need to mark your query as that

#

the entire unity transform system has write groups enable

solemn hollow
#

but to make that more understandable id probably only want to have 1 systemoutputcomponent?

rotund token
#

so you can override how transforms are built

rotund token
#

im only using small systems atm because they're ISystem

#

and i'm experimenting on this effect/attribute system with ISystem and seeing how pure i can make my ecs code

solemn hollow
#

So all i need to do is add the Filter and unity figures out which components are written to and thus the writegroup applies to?

rotund token
#

pretty much

solemn hollow
#

did you ever find a usecase for yourself to use writegroups to like split entity processing to two diffrent systems?

#

i mean is it an architecture tool outside of modding purposes? sounds like it might reduce some needs for WithNone and WithAll

rotund token
#

i've used them a couple of times

#

1 specific collection of systems at work

#

for determining how entities spawn in world

#

1 default spawn rules, then separate overring behaviour with write groups

solemn hollow
#

yeah i could see that used as some kind of factory pattern maybe

#

and does it have any performance implications to add the filter to just any query?

rotund token
#

ive never measured it

#

but as far as i'm aware the cost is in typemanager initialization

#

as well as when the query is created

#

which is 99.9999% done in OnCreate

#

i don't believe there should be any per frame cost

#

though again, never measured it

solemn hollow
#

makes sense though

rotund token
#

basically once query is setup it should be no different

solemn hollow
#

i wonder why unity skipped adding the filter for alot of their systems

#

companiontransfomupdate comes to mind...

rotund token
#

forgotten feature

#

i'm the only one who remembers it ๐Ÿ˜„

#

~brb 20 cooking dinner

devout prairie
rotund token
#

actually i just managed to make it generate the same code

#

but it requires some attributes

solemn hollow
#

hmm just yesterday i watched the low level development with burst talk. there should be autovectorization for it

#

with timestamp for autovec

rotund token
#

it's interesting though, even though it generated exact same burst code for the loop it still runs a little slowly

solemn hollow
#

thats 2019 though

rotund token
#

0.21 vs 0.24ms

solemn hollow
#

huh

rotund token
#

i think there's a bit more overhead setting up the loop

#

but yeah i could get both cases to generate this

#

exact same burst code

#

(looks beautiful doesn't it!)

#

but yeah again it's very fickle

#

so i'll stick with float/int 4 version

#

it's just as readable

solemn hollow
#

so did i understand correctly that you can just take a nativearray of float and reinterpret it as an array of float4?

rotund token
#

yes

#

so 1 catch of vectorization, you can only do it in a single loop

#

if your arrays are a multiple of 4

#

for obvious reasons if you think about it

#

otherwise it takes a second loop of 0-3 elements

solemn hollow
#

well in autovectorizers it handles the rest too right

solemn hollow
rotund token
#

i basically got this working by simply telling burst that the length was always a multiple of 4

solemn hollow
#

hence the attributes u mentioned?

rotund token
#

i just used Hint.Assume for that

#

but i needed some [NoAlias] attributes

#

and a few other things (cant remember)

devout prairie
#

Yeah I was thinking maybe just force the array to be x4 and then discard the unused data

rotund token
#

yeah that's what i'm doing

devout prairie
#

So I guess it still works out faster

rotund token
#

the one thing that is bothering me is
Unity.Burst.CompilerServices.Loop.ExpectVectorized();
i just can't get this to work

#

my loop is clearly vectorized

#

i think this is not working because it's already vectorized - llvm doesn't actually have to do anything

#

at least that's my best guess

#

but i can pretty much never get this to work except in the most basic of loops

devout prairie
#

I was reading UninitializedMemory yesterday i take it that's also quicker when creating arrays inside a job as opposed to during oncreate

rotund token
#

i really wish i had a reliable check to make sure something/someone doesn't break my nice loops

rotund token
#

i'm going to populate the entire thing after allocating it, why bother doing a clear

devout prairie
#

Seems kinda pointless in any case

#

I guess unless you are copying from another array or something

#

Or could the allocated memory potentially have data in it already and cause corruption