#archived-dots

1 messages ยท Page 280 of 1

devout prairie
#

Not sure

#

Was just reading your discussion about modding on il2cpp, also interesting

solemn hollow
#

for me when i first tested autovectorization ExpectVectorized() always threw an error... even when it did work

devout prairie
#

I think this will become an increasingly important point as more games abandon mono and look for ways to leave the door open to the modding community

rotund token
#

yeah if you dont clear it could have any values in it

devout prairie
#

'stop holding my hand .net I want to be a real coder now'

solemn hollow
#

i remember joachim saying in a thread that its ill advised to allocate memory inside jobs. its supposed to be very slow. is that not true anymore? i do in some cases where i have no choice and i never found it to be too slow

rotund token
#

it is slow

#

i only allocate it per thread

solemn hollow
#

ah and there is a diffrence? i do allocate a hashmap per entity

rotund token
#

thats very slow

#

(memory is one of the reason i mostly use IJobEntityBatch)

solemn hollow
#

that codedeletion bot slowly starts catching u outsmarting him? ๐Ÿ™‚

rotund token
#

i use this pattern a lot

rotund token
#

easier to screenshot

solemn hollow
#

yeah but screenshots are against the rules too right. who abused posting so much code they had to get that bot

#

so you create that array just for the first batch on every thread is what that says right?

rotund token
#

every chunk that re-uses this thread will use the same list

solemn hollow
#

oh god you dont wanna know what i am doing currently lol

#

the simple version : i allocate a hashmap with size depending on the count of a Buffer on each entity. depending on some settings struct this can get alot more involved. which sounds like so much work that is unnecassary. i could totally get away with allocating a single hashmap of size 1000

#

So hashmap.clear then is way more performant than allocating right?

devout prairie
#

i wonder is it better to actually create a big global or per-thread array than using DynamicBuffer on entities then?

#

i'd have thought maybe internally the system would do that anyway or something

#

i think dynamicbuffer are pretty much always fixed length right

solemn hollow
#

i cant use one big datastructe because of parallelism of those calculations

#

i mean im sure i could if id handled safety completly myself but thats not in my league

devout prairie
#

yeah i was thinking, they allocate a fixed size of memory, but you maybe only use say 3 slots out of 10 or whatever

rotund token
#

allocating one of the slowest things you can actually do

devout prairie
#

i wonder if it could be more efficient to say have a big array for each thread, each entity has access to say a fixed 30 slots, and if you only use 23 slots it ignores the rest

#

and if you need to dynamically use a larger array then, decide beforehand you need more slots

solemn hollow
rotund token
#

imo just go profile it and see!

#

make a simple simple job, allocate a small native array per entity

#

then do it per chunk

solemn hollow
#

i mean there is no question about about whats more performant ^^

rotund token
#

but unless you see difference

#

you wont know!

#

and when its important to care

devout prairie
#

@rotund token any idea does vectorized simd parallelism on the cpu bring it up to par with the speed of gpu level stuff, compute shaders etc?

rotund token
#

not even close

devout prairie
#

ah

rotund token
#

think of a gpu as having 1024+ threads

#

but it doesn't mean you can't get good performance

#

there is a cost of uploading to gpu

solemn hollow
rotund token
#

and you are stopping the gpu doing something else

#

while most of the time you have free cpu cores

devout prairie
#

right yeah

#

i thought maybe cpu architecture had evolved to leverage the whole simd thing more in line with gpu's

#

i think many of the new chips have onboard graphics right

solemn hollow
#

that reminds me of a question i didnt ask. there are registers in some hardware that could handle 8 floats SIMD right? would using float4 still be using all 8 float slots in the register?

#

or would you have to write a completely diffrent Loop to optimize for that?

#

In the case of tertles array wouldnt it mean you had to hint at multiple of 8 size. which would break it for hardware that has no such register

rotund token
#

i /think/ most of these large avx registers

#

do work on doubles not floats

#

so like 4x double

rustic rain
#

what am I doing wrong?

#

I am trying to simulate parent transform

#

but result is...

#

meanwhile, if I attach in actual transform child

#

with same local offsets

#

it works just fine

#

Cannon has scale, but I tried without it and i get same result

#

wait a second

#

hmm

#

without scale it works

#

xD

#

How can I do scale adjustment?

rotund token
#

remove scale

#

and never use it again

#

half of lifes problems solved

devout prairie
#

hehe

#

mult the local position by the parent scale, or something

#

but yeah, problems ๐Ÿ˜›

#

visually looks nice btw, be interested to see what you're building ๐Ÿ™‚

rustic rain
#

but I decided to rewrite it in ECS xD

rustic rain
#

where player is just too far from position he needs to be

solemn hollow
#

yah that game looks definitly like a conditate for ecs upgrade ๐Ÿ˜„

#

5 entities total? ๐Ÿ˜›

rustic rain
#

๐Ÿ™ƒ

solemn hollow
#

ull probably have worse performance than with GO

rustic rain
#

no doubt, tbh

#

xD

#

but I just hate OOP

#

I haven't touched this project just for 3 months

#

and I totally forgot how it works

#

With ECS I have no such problem

#

easily jumped back into probject I haven't touched half a year

devout prairie
#

Fun game!

#

Do your objects spawn randomly or is the level premade?

rustic rain
#

I will make it so levels can be regenerated

#

through seeds

#

luckily unity's math random allows it easily

#

I think the hardest one would be recreating DoTween xD

devout prairie
#

what's DoTween again?

#

ah like an animation engine

rustic rain
#

when rotation is identity it's good

#

but with any other offsets it breaks

devout prairie
#

ecs can be odd tbh because you have rotation, translation, local to world, and local to parent if it's a child.. then scale and composite scale.. currently dealing with that myself at the moment, need to read back over how the relationships work and what gets written first etc

#

kinda painful to deal with

#

something tells me it would all be easier to just, unparent everything and write a system that manually sets parent-relative positions/rotations.. and also not use scale as tertle suggested, it just causes problems

rotund token
#

the same thing exists on monobehaviour transforms, it's just all handled for you under the hood

#

i'm hoping aspects solve this for dots in 1.0

devout prairie
#

my previous ecs adventure i had a manual parenting system, which basically avoided the ecs parenting system and did it, because i think something was broken when updating certain things in the chain with default parenting

rotund token
#

from what i read, it basically seems like the primary use case

devout prairie
rustic rain
#

I still need to solve scale xD

#

I can't do it without it

rotund token
#

sure you can buddy! i believe in you

rustic rain
#

๐Ÿ•ฏ๏ธ

devout prairie
rustic rain
#

there are no children with physics

#

Can't make it child

devout prairie
#

ah it's a physics body

#

is it uniform scale yeh

rustic rain
#

that's why I need it in the first place xD

#

it doesn't matter

devout prairie
#

like 0.4/0.4/0.4

rustic rain
#

I grab scale from LTW

#

0.3/0.3/1

devout prairie
#

hmm

rustic rain
#

I can't even imagine how would you scale rotation

#

accordingly

#

maybe I should look at Unity transform

#

system

devout prairie
#

my old code i used to use LTW just as a helper to extract Rotation from a matrix 4x4

#

not sure if it would be useful to manually create an ltw and let it do the work or something

#

you can only Get rotation from ltw tho, not set

#

all this cos too lazy to learn matrix math

#

which is almost like an oxymoron

#

because i'm pretty sure learning matrix math would require some considerable effort

solemn hollow
#

i looked into the transform system and copied from there

devout prairie
solemn hollow
#

all ecs systems are easily accessable. thats one main point of the new tech stack. engine code in c# thats accessable for everyone

devout prairie
#

ahh sorry i thought you meant UnityEngine.Transform

solemn hollow
#

ah i see. yeah its confusing

devout prairie
#

yeah they definitely need i think to start providing primers and information for this stuff, if they hope to transition people over

rotund token
#

again im pretty sure thats the whole point of aspects in 1.0

solemn hollow
#

well thats for after 1.0 . atm they actually want people who know what they are doing. (which im not)

solemn hollow
#

yeah aspects actually sound too good to be true

misty wedge
#

Why did they rename NativeMultiHashMap to NativeParallelMultiHashMap?

devout prairie
#

tbh i'd prefer just give me the info/methods rather than farming out operations to yet another system or whatever, if that's what it is

rotund token
#

the point is they can't really give you methods etc

#

because you need to pass like 2341234 components

#

and its gross

#

youd need to pass every single transform component conditionally for most transform operations

#

thats like 15? components

devout prairie
#

as in when objects are parented etc you mean?

#

so you need trans/rot/scale of the whole hierarchy

#

just to get say world position of a child

#

not sure if that's what you're referring to tho

#

i think from my pov i'd prefer - tell me what the math is, and i'll do the rest

#

i know what i want to do, i just don't know the math behind it

rustic rain
#

yep

#

I solved it

#

was so simple ngl

#

I feel dumb

#

now I experience other problem

#

Graphical interpolation of physics...

#

smoothing*

#

which can also extrapolation

#

Gotta figure out how to toggle it on and off

misty wedge
#

Is it intentional that the source generators are ignoring all modifiers on variables?

solemn hollow
misty wedge
#

for example, it will assume constant values to be a variable and attempt to set it

#

(resulting in a compile error)

#

Seems odd

#

Same with private variables

#

It also ignores properties entirely

solemn hollow
#

hm i guess they just havent gotten around to implementing all possible ways. not sure if they ever could

misty wedge
#

How does the source generator pull the variables? I'm assuming with reflection?

solemn hollow
#

idk about the source generator they are using. but i think usually you get it from the roslyn analyzer output.

misty wedge
#

I've not read up on it either, but I'm pretty sure you can get stuff like access modifiers since that's kind of an important part of programming ๐Ÿ˜…

solemn hollow
#

yes you can but youd still need to handle those diffrent cases and permutations for each modifier

#

50x the work probably

misty wedge
#

Yeah but not attempting to create an instance of a private variable in an authoring component kind of seems like a given

#

I'd be less surprised if it was some odd combination of modifiers that was breaking the source generator

solemn hollow
#

ah i thought you were talking about job codegen

#

[GenerateAuthoringComponent] should be way easier to do yeah...

misty wedge
#

I'm converting to 0.51 atm, and so far that has been the first oddity I've encountered

solemn hollow
#

from 0.17?

misty wedge
#

Yeah

solemn hollow
#

im not using [GenAuthoringComp] so i cant speak to that

misty wedge
#

I've not used private fields in components a huge amount, but something like this doesn't seem too far out there imo

solemn hollow
#

yes but considering this is experimental and GenAuthoringComp is as far as i see it not the prefered workflow i can totally understand they didnt take the time to implement that

misty wedge
#

What is the preferred workflow?

solemn hollow
#

the main point of authoring is that you can design userfriendly components on the Authoring side and then convert them into (multiple) optimized ones for runtime

misty wedge
#

Well, yeah.

solemn hollow
#

i seldom have a mapping of 1:1 authoring to runtime components

#

so i always need to use the IconvertgameobjectToEntity interface

#

or ConversionSystems

misty wedge
#

My main issue is I'm trying to figure out if I should report this as a bug or not. The documentation states this:
ECS only reflects public fields and they have the same name as that specified in the component.

#

It is in fact reflecting private fields as well.

solemn hollow
#

At the beginning of my ECS journey i made the mistake of having too many authoring components mapped to basically the same amout of runtime components. that system is a huge mess because of it now. very hard to setup right

misty wedge
solemn hollow
#

ah i see.

misty wedge
#

I can definitely see the issue if it was a more traditional set up with many defined prefabs

solemn hollow
#

and honestly using the ConvertToEntity interface isnt really that much boilerplate. there you can do the stuff u want to do easily

misty wedge
#

Yeah I didn't know it exists for a long time, I always used GameObjectConversionSystem which is a lot more boilerplate

misty wedge
#
  • the number of components
#

๐Ÿคท maybe it's just me

solemn hollow
#

well but u can handle combinations of monobehaviour components which is a really nice thing

misty wedge
#

Definitely, but it's more boilerplate if you don't need it

#

All 3 options seem to have their defined use cases, which is nice

solemn hollow
#

lets say you wanna make sure your artists never forgets to add a component to an entity that has a animator and spriterenderer (like i have an animationoptimizer component). conversionsystem makes it so nice to handle

#

even though you dont have access to those unity components yourself

misty wedge
#

I'll try and convert all the components on my procedural entity to a single conversion system, maybe I'll like it more ๐Ÿคท

solemn hollow
#

lazy af ^^

misty wedge
#

I just don't really have any heavy duty authoring requirements ๐Ÿ˜…

#

Especially since this is a one person, non-professional project

solemn hollow
#

yes go for it. its easy to split up later anyways if it somehow got complicated

#

if youd packed all gamelogic in one monolithic system to avoid boilerplate id say something different though ๐Ÿ˜„

misty wedge
#

Nah I recently forced myself to divide everything into assembly definition files, so I feel it's split up pretty well atm

#

It's just hard to get a feel for the "intended" way sometimes since I've never used unity in a professional context and only worked on solo stuff

solemn hollow
#

well unity isnt sure about it yet either ๐Ÿ™‚ im curious on what 1.0 really brings

misty wedge
#

Same, some of the stuff on the roadmap sounds kind of funky

#

Also are there any plans for making world serialization in a production context easier? I didn't see anything on the roadmap

solemn hollow
#

not that im aware of but it might well be in there anyways. has a lot to do with sebscene workflow so id expect atleast some improvement on that part. i think i read somewhere that there were some performance improvements planned. but it might also have been this 0.50 release

misty wedge
#

I meant more of in a savegame context

solemn hollow
#

yah i dont think it ever was intended for that. do you really need to serialize the whole world to save some gamestate? sure for small games thats possible and maybe even efficient but as soon as you got alot of entites this becomes a bad idea i think

#

but id like to see some deltacompressed way of storing savegames vs the unchanged subscenes

misty wedge
#

Why? All types are already blittable and well laid out in memory. It's a perfect scenario for serializing a lot of data. And I'm not talking about serializing the whole world, only a subset of entities with a subset of components

solemn hollow
#

yes subset is fine. and i bet even deltacompressed would be really good already

#

without you having to specify which components you really need to save

misty wedge
#

That could be tricky with things like SystemStateComponent though, at least in my game I would need to explicitly specify what gets saved

#

Also some components aren't inherently blittable if you disable safety restrictions (e.g. pointers in components)

solemn hollow
#

true

misty wedge
#

But my point is, it's a very important thing in games, and there's no really support for it yet, which is fine if their approach is "write your own system for it". But I don't recall them really saying anything about it

#

I saw some approaches with EntityManager.GetDynamicComponentTypeHandle to automatically serialize components with specific attributes that seemed promising

misty wedge
#

Any idea what is going on here? com.unity.entities@0.51.0-preview.32\Unity.Entities.CodeGen\Cloner\Cloner.cs(31,25): error System.InvalidOperationException: Method Cloner ILPP: Cannot find method

#

I can't find anything wrong with the method...

remote crater
#

Uh, I still can't get this UnityBug Work around to work, it bugs out in new ways. iBufferElementData n stuff ain't working for me

misty wedge
#

In the editor or in the build?

remote crater
#

Editor for now

#

It used to give me the data items like public and such

#

but now it self references

#

Look lower right corner: ItemDropBufferAuthoring is a list of ItemDropBufferAuthoring instead of the fields inside

misty wedge
#

What does your authoring component look like?

remote crater
#

shnike

misty wedge
#

I don't see the authoring component here? Only the actual component

remote crater
#

I think I gave you the wrong one

#

maybe its because I tried default assigning nums?

misty wedge
#

The issue is ItemDropBufferAuthoringData is inheriting from monobehaviour

#

It shouldn't inherit from anything

dapper arch
#

do i need URP or HDRP or anything like that for ECS? i can't see entities

remote crater
#

It appears there is a visual rendering bug now:

misty wedge
#

Otherwise try resetting the component

remote crater
#

I got this before when I did automaticauthoring, I'll try

#

Ever since the last 2-3 versions of Unity my generateauthoringcomponent has done this

misty wedge
#

What unity editor version / ECS version are you on?

remote crater
#

2020.3.36f1 unity

#

It works on .33f1 to render, but not in play.

#

in .36f1 it does not work in render or play

#

When I restart unity, I'll tell you all my packages if you'd like

#

This Unity bug actually caused me about 50 hours of work and headache to get a compile, and about 20 since

misty wedge
#

Ideally you upgrade to 2021.3.4f1 and ECS 0.51

remote crater
#

Wait, ECS works on 2021 now?

misty wedge
#

Yes

#

It's worked on 2021 for a long time now, just not officially

remote crater
#

Thank you. That is great news.

#

Version 0.51.0-preview.32 - June 15, 2022

#

I'll try the new editor version, this seems promising to fix one of my bugs at least

misty wedge
#

I'd upgrade regardless just for the various improvements

remote crater
#

Right

#

2021.3.5f1 is out now

misty wedge
#

the docs list 2021.3.4+ with entities 0.51 so that should be fine

lofty oak
#

hi there curious for anyone else using the Hybrid Renderer. The official site says it won't work with Gamma color mode (only linear), but it seems just fine on my mac, anyone else run into this?

dapper arch
#

does anybody happen to know if there's any sample unity packages / scenes showing ecs/dots on 2021 0.51?

solemn hollow
karmic basin
#

Yeah until now they've done a really good job keeping them updated ๐Ÿ™‚

remote crater
#

Ok the bug it is saying now is: 'ItemDropBufferElement' is missing the class attribute 'ExtensionOfNativeClass'!

#

Not sure what is proccing it

#

I might have to set up editor prefs with new editor

rustic rain
#

hmm

#

is it possible to do a write group filter outside of job?

solemn hollow
#

@rustic rain the filter is on a query not on a job

misty wedge
#

Is there a way for exceptions to point to the original lambda code, not the the source generated one? It's like a million times harder to read and for some reason the lines aren't correct

solemn hollow
misty wedge
#

very annoying

#

Clicking the line doesn't even do anything...

solemn hollow
#

i rarely use codegen atm though.

misty wedge
#

How can you turn it off?

solemn hollow
#

you cant. i mean i more often than not write the IJobEntityBatch myself

misty wedge
#

Ah. Yeah I've done that with a lot of newer jobs I've written but I still have a lot of old ones that I haven't converted

solemn hollow
#

well for me all my old stuff did not break

misty wedge
#

It didn't break for me either, this is just a bug ๐Ÿ˜…

#

Also, line 581 in the above exception is this line:

#

???

#

thanks

solemn hollow
#

lol

#

hmm i wanted to try caching handles. is there any reason why entitytypehandle has no .Update() ?

#

as i understood it i should get the handle in OnCreate and then call .Update() each frame before scheduling a job with it. should entitytypehandle be handled diffrently?

misty wedge
#

I'm guessing you don't need to call update, since Entity isn't a component type

#

But if you mess something up I'm pretty sure unity will yell at you, I've had typehandles not be valid before and it throws an exception

solemn hollow
#

ah since the handle to the entites array never changes. entites never move into other chunks just their componentdata

misty wedge
#

Yep

solemn hollow
#

but then again wouldnt that mean you could get the handle in OnCreate and not while scheduling the job?

rustic rain
#

all right, I'll try to do it xD

#

I also consider doing normal Scale and NonUniformScale just in case xD

misty wedge
#

Anyone know what is up with this?

error SGICE002: Seeing this error indicates a bug in the dots compiler. We'd appreciate a bug report (About->Report a Bug...). Thnx! <3 System.IO.IOException: Cannot create '...\Temp\GeneratedCode\Schnozzle-ChunkObjects' because a file or directory with the same name already exists.
devout prairie
rustic rain
#

kind of

#

making my own tweening thing

devout prairie
#

Nice, best of luck with it ๐Ÿ™‚

misty wedge
#

Is there something new you need to do in 0.51 if you want to create a custom collider? I think I'm missing a component, and the only thing I can see is PhysicsWorldIndex

devout prairie
misty wedge
#

Yes, I'm creating the blobs on initialization

devout prairie
#

Physics ragdoll sample does:

misty wedge
#

My entity doesn't start out with an authored PhysicsBody

#

I think I'm missing some new component they added

gentle harness
#

How do I schedule a job when a button is pressed?
I'm imagining something like

protected override void OnUpdate()
{
  if(leftMouseDown)
    Entities.ForEach(_ => { DO STUFF });
}
devout prairie
misty wedge
#

I don't actually use the simulation, all my entities are static

#

So I probably don't need a lot of those

#

I think it's PhysicsWorldIndex, so I'll check that

devout prairie
#

i think PhysicsWorldIndex is normally 0 and is a shared component

#

shared i think with all physics entities

misty wedge
#

Is it possible to add shared components to an EntityCommandBuffer inside a burst compiled job now? I know that wasn't possible in 0.17

devout prairie
#

so for example when button is clicked, it gets World EntityManager and creates a singleton

#

then u could put RequiresSingleton on that system, so it only runs when that singleton exists

misty wedge
#

I'm pretty sure you can also just schedule the job if you press the button, no?

devout prairie
#

or another alternative - set a bool value on a system, and the OnUpdate just returns early if the bool is false

devout prairie
gentle harness
#

Is that not equivalent with my snippet?

misty wedge
#

The amount / order of jobs schedule each frame definitely doesn't need to be the same each time

#

As long as you don't pass in a handle to Schedule / ScheduleParallel it will handle the dependency in the order you create the jobs automatically for you

gentle harness
#

Yep, it works

#

I'm still confused how the system just knows when to activate automatically

misty wedge
#

The system knows which entity queries you assigned to it

gentle harness
#

Is that generated at compile-time?

misty wedge
#

no

#

e.g. calling Entities.ForEach((in MyComponent) => ... will tell ECS that this system requires MyComponent with READ permission

#

The system will collect all queries, and if it finds a single query that the system wants, it will run

gentle harness
#

But in my system Entities.ForEach() isn't called until a condition passes

misty wedge
#

In your case specifically, it can be an issue

#

Since, like you said, the system doesn't know of the query until your code runs

gentle harness
#

But the system still knows to run when an entity matches the query

misty wedge
#

There are multiple ways to work around that

#

Either you declare your query in OnCreate

#

or you add [AlwaysUpdateSystem] to the top of the system

solemn hollow
#

the system still knows about the query even if it is hidden behind a branch

gentle harness
#
Debug.Log("f");
if (Manager.controls.Player.Split.WasPerformedThisFrame())
   {
       Entities.WithStructuralChanges().ForEach((Entity e, in Selected s, in Translation t, in Radius r) =>
       {}
   });
misty wedge
solemn hollow
#

if you use a lambda job it works. if you dont you need to create the query before the condition check

misty wedge
#

It was a lambda job, odd

solemn hollow
#

but the query should be created in oncreate anyways

misty wedge
#

This was also the only query in the system though

solemn hollow
misty wedge
#

I originally assumed that the system isn't even started if no query matched it

gentle harness
misty wedge
# solemn hollow yes

Well then if I have a single query in a lambda in OnUpdate it would never run, right?

solemn hollow
#

so if you had a system that checked if you pressed a button with a query that is only ever active after you pressed the button it should never run

gentle harness
solemn hollow
#

no also if you use foreach. because the query would never find an entity to run on. so the system never runs. so it will never be checked if the button is pressed. so it can never produce an entity that matches the query. and so on

#

but lets say you always find an entity in the query. then it all works fine

#

its just that one confusing case where you create a logic loop without ever entering it

gentle harness
#

It's getting deleted

#

Huh

#

I guess I've posted too many snippets

solemn hollow
#

no its just stupid. u need to remove all indents

gentle harness
#
protected override void OnUpdate()
{
  float2 cursorPosition = Manager.CursorPosition;

  if (Manager.controls.Player.Split.WasPerformedThisFrame())
  Entities.WithStructuralChanges().ForEach((Entity e, in Selected s, in Translation t, in Radius r) =>
    {
      ...Stuff...
    }).Run();
}
#

This snippet will run without Split being performed

solemn hollow
#

when the query finds an entity to execute on the system will run but the job wont be executed until you Perform Split

gentle harness
#

But when is the query created?

misty wedge
#

It's created when you call ForEach

#

That's why can call WithStoreEntityQueryInField withForEach to store the query in a variable

solemn hollow
misty wedge
#

Yes, I guess I wasn't really clear. It's created when you define the parameters to the ForEach function

solemn hollow
#

and specifically it is created for you in the CodeGenerated OnCreate()

misty wedge
#

Is there an easy way in rider to jump to the source generated code?

solemn hollow
#

thats how the entityquery codegen for a small lamba job looks like

solemn hollow
rustic rain
#

All right my scary tweening system starts to make sense xD

#

Allthough I used polymorph components

#

which is quite questionable in terms of ECS design overall

rotund token
#

really wish i had a buffer chunk component ๐Ÿ˜

#

instead I'm going to have to attach an unsafe container to the chunk ๐Ÿ˜ข

viral sonnet
#

yaaas, come to ze dark zide

#

we have poisoned croissants

rotund token
#

so i have a component that has an entity reference

#

so for every entity referenced in this chunk, i'm caching the chunk it belongs to in a chunkcomponent

#

i may have fallen too far

viral sonnet
#

what's your saying? sounds gross. ๐Ÿ˜… what are you hoping to accelerate here?

rotund token
#

you know how i wrote that way to directly write to entities

#

well, i always need to trigger change version

#

this way i can just iterate each archetype chunk and bump it's version

#

i'm basically just bypassing having to use GetComponentFromEntity

#

and allowing 2 entity archetypes to directly write to each other

viral sonnet
#

i want to see some benchmarks for this later

rotund token
#

weirdly enough, i'm doing this more for usability than performance

#

i could write this super performant in a way that makes it much less flexible for designers

#

but what i want is a really generic flexible system so i'm writing it in a specific way

#

that just isn't that naturally performant

viral sonnet
#

yeah generic and performant rarely go in one sentence

#

if you don't kill iteration time with random access it's pretty cool though

rotund token
#

well it's either use componentfromentity random access or write to a pointer randomaccess

#

hmm there's no natural way to get a chunkarchetype of an entity in a job is there

#

oh well, incoming ChunkArchetypeFromEntity

devout prairie
#

where's the best place to browse the dots source code?

rotund token
#

side by side with your code

devout prairie
#

vs just gives me the metadata stubs i think from the compiled dll's

rotund token
#

yeah it's annoying

#

i haven't used VS for a while now, but i think there is a way for it to show actual code

viral sonnet
devout prairie
#

i know the code is in the downloaded packages, just wondering if there's a repo online or something

viral sonnet
viral sonnet
#

if you're sick of VS, switch to Rider ๐Ÿ™‚ Did the same thing some time ago

misty wedge
#

I don't think that's financially an option for everyone

rotund token
#

you just saved me 10min'

viral sonnet
#

well I get my copy of VS from my company. other than that VS is really expensive

devout prairie
#

i just use community tbh

#

never tried rider or really felt the need if i'm honest

rotund token
#

managed to convert 90% of devs at work to rider from VS

#

need them to start a referral program

rustic rain
#

I am converted xD

viral sonnet
#

you'd be swimming in referral money by now ๐Ÿ˜„

devout prairie
#

so what's the big attraction

#

i've always been really vanilla in my usage of apps

rustic rain
#

it was made to just make your life easier

#

the moment I launched Rider and tried to do auto format I realised - this is it

rotund token
#

it's faster, it let's you inspect code, has better formatting

rustic rain
#

and then I opened options tab

#

oh man...

rotund token
#

and once you get used to it, better default colour schemes right enzi ๐Ÿ˜„

devout prairie
#

fair enoug

viral sonnet
#

it's clean, fast, has tons of useful code suggestions, can decompile sources, hold lots of projects and files, fast startup. no bugs or hanging and is customizable like crazy to your needs

devout prairie
#

i always find autocomplete in vs to kinda trip me up and be irritating to use

#

so it's almost as if it's designed to help, but doesn't

rustic rain
#

I personally switched only after VS faced me with some unsolvable bug

devout prairie
viral sonnet
#

vs2022 auto complete is cool. really the only thing that VS team has done since 2005 that's actually worth a damn

devout prairie
#

i'm using vs community 2019

#

can get laggy after a while occasionally

#

does throw an error occasionally

misty wedge
#

MS kind of shot themselves in the foot with VS Code

viral sonnet
#

yeah, and it just goes on and on with benefits. i have tried rider a bunch of times and always went back because i was so used to VS. tbh rider has made big leaps in the last few years

#

now it's really the go-to IDE i feel like. VS code is also pretty tight for python

misty wedge
#

Rider is just a lot more expensive than VS or VS Code, which is the main drawback I guess

devout prairie
#

so is it lightweight, enzi mentioned it start up quickly

misty wedge
#

Yes, it's the main reason I switched. VS was incredibly slow on my system

#

For some reason VS literally imploded when I had too many assemblies loaded

#

Became unusable

devout prairie
#

you know how some apps are just well built, like for example Blender compared to 3ds Max or Maya.. does all the same stuff, in a fraction of the footprint, and takes the blink of an eye to startup

viral sonnet
#

depends on the country and income I guess. for me it's not that much. best thing, rider becomes cheaper after the years

misty wedge
#

It's still slower than VS Code, but that's understandable, and it's faster than VS Code with Omnisharp installed

viral sonnet
#

i certainly have paid much more in useless assets I never use ๐Ÿ˜„ something like an IDE is what I use every day. I don't want to deal with a bunch of friction

misty wedge
#

Definitely, but I think it depends. Rider is on the cusp of being expensive enough that the features may not be worth it for some people

#

And I guess it depends on whether or not you use it for work, or are a hobbyist

viral sonnet
#

even a hobbyist needs good tools ๐Ÿ™‚

misty wedge
#

Sure, but VS and VS Code aren't bad tools

#

And they're both free, which is a big draw to a lot of people

devout prairie
#

would be nice tbf if VS referred to the source code rather than the compiled dll's with unity

#

i wonder if there's a way to set that up

#

for example this is the source for a Physics extension method:

#

but when using the method in my code i don't get the summary or the hints

viral sonnet
#

yep, I had the same problem.

devout prairie
#

and to view definition i just get the dll meta stubs:

viral sonnet
#

VS is too dumb to understand that the source is already there

devout prairie
#

i wonder how rider knows though

#

considering unity itself i guess is referring to the dll versions

viral sonnet
#

I wanted to show you how it looks in my VS but it's bugging again. 2019 works a lot more stable when it comes to decompiled source

#

you can get VS to understand when including the external packages as project

rotund token
devout prairie
#

i think i may have figured it out

rotund token
#

it can decompile dlls though (such as UnityEngine)

#

but yeah im pretty sure VS can do something similar it's just off by default for some reason

devout prairie
#

just waiting on it building the project files

#

yeah it worked:

rotund token
#

oh yeah there was that way of doing it

#

via project generation from unity

devout prairie
rotund token
#

yeah that's super annoying imo though

devout prairie
#

i guess if it's going to slow down VS it may be better to be able to switch it off

misty wedge
#

That's what made my computer explode

#

It got unbearable slow

#

Typing was lagging, and intellisense took like 1-3 seconds to do something

rotund token
#

yeah it makes analysis run on all the packages

devout prairie
#

yeah damn

#

so rider doesn't have such lagness?

misty wedge
#

I think you can disable the analyzers

#

Rider works much better on the same system for me

#

In general it's better imo, with the main downside being the cost

rotund token
viral sonnet
#

i got really mad when VS loaded Unity.Collections

devout prairie
#

so rider is 130gbp inc tax for the first year, that's just the ide

#

is it one of these things where you end up needing to pay for all the extra stuff for it to be fully functional?

misty wedge
#

No, jetbrains just sell a lot of different IDEs

devout prairie
#

it's 238gbp for the full package

viral sonnet
#

no, you actually don't need anything else. resharper is included in rider. it's just for VS

devout prairie
#

seems reasonable i would say

misty wedge
#

I wish they made a community edition like they did for IntelliJ

devout prairie
#

i'm about 50gbp p/m for adobe sooo..

misty wedge
#

I'm also really interested in their pricing strategy for Fleet, since if it costs too much it will never be able to compete with VSCode

#

Although I really like the idea

devout prairie
#

anybody use any of that azure stuff from MS

misty wedge
#

You mean their cloud infrastructure? ๐Ÿ˜…

devout prairie
#

yeahhh

misty wedge
#

We used it at work, but we switched to AWS

devout prairie
#

i guess more of an enterprise thing, i'm just a freelancer soooo ๐Ÿ˜›

misty wedge
#

I guess it depends a lot on where you work

rotund token
#

we use it at work just because of playfab which our publisher likes

viral sonnet
#

we used azure at work because investors said cloud is da sheeet. iops were so bottlenecked, we moved to dedicated server in our locak region

#

aws is much nicer

#

and azure is really expensive

#

you even pay like crazy for a simple sql server

#

it's really only for very big companies who don't care about server money

devout prairie
#

there doesn't seem to be a way to change physics timescale

#

this seems to work:

viral sonnet
#

uh boy, I'm onto something. I use a lot of CDFEs in another stage and I just realized that I can cache the chunk and the index for that. as the writing is in the order of the chunks too I can pretty much skip all CDFEs

#

glorious day if that would boost the job

frosty siren
viral sonnet
#

well the gist is that I save the pointer of the ArchetypeChunk in a struct via UnsafeUtility.AddressOf(ref chunk) and the index so I can later recover all arrays without doing any lookups via CDFE.

#

getting comps is then only a matter of chunk.GetNativeArray, getting the pointer via GetUnsafePtr and adding indexInChunk to the pointer to get the actual position

#

and I'm thinking about adding this logic for targets too because that's quite a lot of CDFEs which I could reduce to basically one lookup

viral sonnet
#

so many useful API calls are behind internal stuff -.-

viral sonnet
#

I can't believe I'm considering making another hashmap -.-

#

tertle, what do you think? save the EntityInChunk or EntityStorageInfo in a comp? I'm leaning more into EntityInChunk because the size is smaller. But I also don't want saving the same data over and over again when the same targets are referenced but that would mean a hashmap and at least 1 lookup which could defeat the purpose. well, it would still be better than CDFE though

rotund token
#

hashmap lookup not that much faster than cdfe

#

at least depending on the hash generation and comparison

viral sonnet
#

true dat, GetHashCode for an entity is just returning the index so pretty fast.I'll go with saving EntityInChunk for now.

#

damn, I don't even know if this will be faster. CDFE caches the internal lookups to get the comp array and I'd need to get those very time because I just have the chunk

#

the dream is slowly crumbling

viral sonnet
#

interesting, chunk.GetNativeArray doesn't use a cache but GetComponentDataPtrRX does. that's why you need a ref ComponentTypeHandle for the ptr. not really sure how that affects other Execute calls though. the handles are unique for every thread, right?

#

the behaviour of DataPtr still makes it quite useful when only having the chunk

rotund token
#

this cache generation better than i could have hoped

#

if i turn off the change filtering to ensure it runs every frame for testing, i can have 100,000 attributes targeting 10,000 random entities and calculate those target chunks in 0.11ms/frame

viral sonnet
#

what exactly are you caching now?

rotund token
#

public struct AttributeTarget : IComponentData
{
public Entity Value;
}

#

every ArchetypeChunk that all entities in this chunk access

#

stored on a chunk component that looks like this
internal struct AttributeTargetChunkCache : IComponentData
{
internal UnsafeListPtr<ArchetypeChunk> Targets;
}

viral sonnet
#

huh, what do you access then with the chunk? just metadata or component arrays?

rotund token
#

i'm just using this to trigger change filtering

#

since i'm not accessing the AttributeTarget.Value via any conventional method

viral sonnet
#

ah i see

rotund token
#

so if say my StatEffect triggers change filter, it then iterates this list and triggers change filter on all these

#

i'll optimise chunks with shared components are some point to try ensure more of the same targets are in the same chunk to reduce changes

viral sonnet
#

interesting you started using unsafelist in an icomp even when it's chunkdata. you are getting around the world destroy problem?

rotund token
#

oh that's easy

#

i just store this list in a native queue when i create it

#

and just dispose them all on destroy

#

oh that was a slow bot

#
{
    while (this.chunkLists.TryDequeue(out var list))
    {
        list.Dispose();
    }

    this.chunkLists.Dispose();
}```
#

whoops just realized after a small refactor i had deleted that

#
if (!attributeTargetChunk.Targets.IsCreated)
{
    attributeTargetChunk.Targets = new UnsafeListPtr<ArchetypeChunk>(Allocator.Persistent);
    batchInChunk.SetChunkComponentData(this.AttributeTargetChunkType, attributeTargetChunk);
    this.ChunkLists.Enqueue(attributeTargetChunk.Targets);
}```
viral sonnet
#

interesting approach to get around the change filter triggering. thanks for the info

solemn hollow
#

oh i thought tertle does it for the opposite reason. doesnt he want to bump the version without ever calling getnativearray? since he directly writes to his attribute memory which the targets only have pointers to he doesnt know which targets total stats should be recalculated. Now with caching the chunks of all targets on effects(attributes) he can trigger the changeversionfilter on all Targets only if an attribute changes.

#

sry that TLDR was more for my own understanding what happend tonight xD

#

@rotund token looks very promising! now i think the only thing i would still miss for a very complete EffectsSystem is having attributes that depend on each other somehow resolve in order. and having the possibility to overwrite how those attributes effect each other. (like speed = (2* totalAgility + TotalAdditiveSpeed) * TotalSpeedMultipliers)

rotund token
#

my stats are broken into 5 parts

#

Added, increased, reduced, more, less

#

var stat = added * (1 + increased - reduced) * more * less

#

specifically i use this formula

#

(from poe)

solemn hollow
#

haha for effects i also looked at poe formula ^^

#

but honestly i felt the more and less are so overpowering it feels like it just enables bad gamedesign xD

rotund token
#

oh yeah got to be careful of scaling

solemn hollow
#

poe is always about maxing the more multiplier. gets really annoying to play after a while. all builds end up at the same more nodes

#

but my point was more that totalAgility in the formula

rotund token
#

but that's kind of out of scope of what I'm doing tbh

#

how stats affect you is separate

#

health might be a combination of strength, vitality, health, etc

#

i might look at it in future but my gut is it's a bit hard to make it generic and not game specific

#

but it might be doable

#

hmm i guess thinking about it

#

it could be doable but i might make them like, a separate, combination stat to avoid some weirdness

solemn hollow
#

but its all about that weirdness thats fun ๐Ÿ™‚

#

lets take poe again : you scale str. str feeds into hp. hp feeds into engeryshield (through some item converting hp to es) and es feeds into mana (sry i forgot the name of the node that does this)

#

so youd need to calculate all the stats in order

rotund token
#

thatd actualyl be easy to implement

#

you'd just add a system after my statupdatesystem

#

poe is very particular, things can only convert 1 way

#

for example damage

#

Physical โ†’ Lightning โ†’ Cold โ†’ Fire โ†’ Chaos

#

there is no way to convert cold to lightning

#

there is direct physical -> fire

#

but yeah nothing in reverse

solemn hollow
#

yep but one attribute affecting another would still mean that order matters. so i cannot just loop over all effects on an entity and sum them up one after another by the poe formula. id need to respect the order in which the gamedesign wants the chain to resolve.

#

because any stat could feed into any %increased stat of another stat and so on

#

the order you described above is exactly what i think poe does to be able to feed stats into stats

#

but i get your point. for 99% of games that is not an issue. Hp is calculated in a second pass after all attributes are done and not seen as an attribute itself

#

thinking about POE they propably also are not that complex. they might have like 3 passes. StatAttributes -> Secondary Attributes (MovementSpeed,Attackspeed,AttackdamageIncrease,...) -> HP/Mana/Es

#

nvm. idk... you can scale damage by increasing ES... its just weird to think about it

solemn hollow
#

@rotund token I just stumbled over the forumpost where you show this:

#

is there a reason you split up increased and reduced for example?

#

with that logic to be consistent youd also need a subtracted

#

cant you just sum up all increased and reduced values in one array?

#

same with more and less

#

reduced is just a negative increased afterall

rotund token
rotund token
solemn hollow
#

huh. i thought the increased and reduced modifiers are additive and just cancel each other out

#

so i thought -increased = reduced

#

which it is in the formula right?

#

also less and more is addtive too in the same sense

#

20 less and 20 more cancel each other out at the end

rotund token
#

i mean sure

#

i could probably combine them intermittently

#

but then i'd have no way to display the data to the user

#

like, you have 78% increased spell power from this item

#

hmm but does that matter being able to display separate

#

not sure

#

i like flexibility

#

would save 2 arrays though

solemn hollow
#

hm i dont see why you cant display that seperatly stil

#

youd just have to check when you display wether its negative or positive number

rotund token
#

because if it's summed together then i can't show them separate?

#

like your gear is +120%
current penalty is -40%

#

for a total of 80%

#

(increased/reduced)

solemn hollow
#

but you still have the array with 120 and 40% somewhere wouldnt you? my main point was just that you wouldnt need 2 seperate arrays for increased and reduced

rotund token
#

all i have is 100,000 single values

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

the only combination is the array above

#

that array above is every stat on a player

#

each index is 1 stat

#

index0 = health
index1 = str
index1234 = flee speed

#

etc

#

predefined

#

that above code is not what is summing the reduced/more/increased/etc, that's already been done earlier. that's just writing calculation final result

solemn hollow
rotund token
#

i am curious though what performance benefit merging the arrays would be though

solemn hollow
#

but still at some point you make a distincition between increased and reduced which is unnecassary right?

#

no idea if that gives u any benefit

rotund token
#

it depends if i want the individual sums

#

i did some quick maths and i think you are right i could probably do it on the fly

solemn hollow
#

its what i do in my statsystem so i wondered why u split it up

rotund token
#

for more/less

#

but i dont think so for increased/reduced

#

though let me check that

solemn hollow
#

it should be both

rotund token
#

yeah my bad read equation wrong

#

thought it was multiplication not addition

#

be pretty easy for me to test if it makes a performance difference

#

i expect it will

solemn hollow
#

yeah the formula doesnt look intuitive but when you think about it its really easy

rotund token
#

interestingly

#

it does not run any faster

solemn hollow
#

just less code then ๐Ÿ˜„

rotund token
#

0.3-0.45ms for both cases

solemn hollow
#

i mean the processor still has exactly the same amount of values to go through in the end

rotund token
#

well that's not exactly true

#

because where it's being done is different

#

adding the stats is the exact same calculations

#

but the actual loop now is less operations

solemn hollow
#

ah then id expect more performance. hmm

rotund token
#

same

#

after/before

#

(dont mind line numbers)

#

probably just need to crank counts

#

and set it up in a fair performance test

#

and it'd probably be consistently a tiny bit faster

solemn hollow
#

well at that point i guess its more howd you prefer the code to look like

rotund token
#

i should point out though in this equation

#

20% more and 20% less are not the same thing and don't counter each other

#

1.2 * 0.8 = 0.96

#

and if you have 100% less it will always equal 0 regardless of any other value in equation

solemn hollow
#

oh man you are right. no wonder my builds sucked

rotund token
#

This is a very useful attribute though

#

100%less guarantees immunity

#

Just need to be careful when designing

solemn hollow
#

yes it makes sense for some mechanics. poe just throws it around too much IMO

rotund token
#

Well they don't use much less for this reason

#

Use a lot of more though

solemn hollow
#

dont monsters use less modifiers for damage taken all the time?

rotund token
#

Oh that's true

#

Delerium in particular

#

But there's not that many cases outside that

solemn hollow
#

honestly though i still dont like that formula. if more and less was additive with each other too it would work out just the same i think

rotund token
#

It wouldn't

#

Say you give yourself poison immune by 100% less effect of poison

#

If a monster had increased effect of poison

#

You are no longer poison immune

solemn hollow
#

i think it would only be fair that if you had a 50% more dmg taken and a 100% less damage taken that youd still take 50% damage

rotund token
#

You're 1 life ci build is now dead

#

Because poison bypasses es

solemn hollow
#

nono increased effect wouldnt matter. just more effect would

rotund token
#

Sorry more effect of poison

#

This was a huge issue not long ago

#

Where you could stack 100% reduced effect of ailments

#

But certain maps had increased effect

#

Removing your immunity

solemn hollow
#

oh i didnt see that as an issue though. it forces you to not hyperspecialize your character

#

i mean the whole concept of complete immunities is just broken... cause at some point every character needs complete immunity to everything to do high level content

#

just reduces build diversity

#

It feels like a checklist to go through when you build a char doesnt it? Ailmentimmunity, resistances capped, all more multipliers i could possibly get, max fortify, ... and all of that has to do with more and less scaling

rotund token
#

(pretty much half of that is impossible to do these days)

solemn hollow
#

hmm havent played for over a year. i just sometimes check back in when there might be a cool league

rotund token
#

missed out, this league was the best

#

golden rule of poe : shitter a league sounds the better it is

solemn hollow
#

yeah this one sounded so bad ^^

rotund token
#

up there top 3 leagues ever

solemn hollow
#

well then its getting added to the leaguemechanics pool anyways

rotund token
#

oh it's not the league mechanic which is good so much

#

as the combiners for making insane gear

#

and i suspect, just like harvest, that won't make a full implementation

#

league mechanic was nice though

#

just worked, no complaints

#

gave lots of loot, non invasive

#

so wont be upset if that goes core

solemn hollow
#

ill probably check it out again in another year or so (or whenever poe2 comes out...)

rotund token
#

i'm just a masochist, no other game really offers me that hardcore experience

solemn hollow
#

dota? ๐Ÿ™‚

rotund token
#

oh i played dota for years

#

i actually played as a stand in on pro teams back in dota 1

#

(though probably hard to call australian teams pro back then, we had like 1 good player in the country)

#

dota 2 my second most played game after poe

#

but i haven't played in a few years, i can't commit enough time to remain really good so i just don't enjoy it as much

#

still try to follow/watch it

solemn hollow
#

yap same. but i only watch internationals

#

and the other game i can also sink in insane amounts of time is OxygenNotIncluded

rotund token
#

that i have never played

#

though probably should since game at work is i guess similar genre

solemn hollow
#

to check out gamedesign alone you should play it

rotund token
#

i just don't play single player games at all

solemn hollow
#

the emerging mechanics from those systems are just sick. whole own physics

solemn hollow
rotund token
#

i cant really think of many (any?) single player games i've played since n64 days

#

i have enjoyed a few more coop building games in recent years

#

but historically, more competitive the better

rotund token
#

which makes sense

#

1 less memclear and memcpyreplicate

#

~0.25 to 0.18ms

solemn hollow
#

glad i could be of minimal help once in a while too ๐Ÿ˜„

rotund token
#

one of the reasons i actually like posting code

#

maybe someone spots something

rustic rain
#

bruh, why the forbid posting code

rotund token
#

discord bots?

#

yeah so painful

rustic rain
#

Programming server blocking code

#

absurd

solemn hollow
#

do they have to pay for discord traffic somehow?

rotund token
#

it only increases traffic!

#

not like the message doesn't go through for a split second

#

then we try again and again to repost it

solemn hollow
#

oh god true.

rotund token
#

and then we resort to large image files

#

maybe it's the opposite, mods holding discord shares (/s)

solemn hollow
#

๐Ÿ˜„ but im not aware of a payment model where discord is payed by traffic though

#

dont know how it works for gigantic servers

#

what was the current way to declare a dependency on the physicssystem again?

rotund token
#

in on start running

#

this.RegisterPhysicsRuntimeSystemReadOnly()

solemn hollow
#

ah thx! i looked at all the wrong spots

#

hmm and how do i do it the other way around? tell the physics system it needs to wait for one of my systems to be finished?

#

I have a job that is raycasting against the physicsworld of the previous frame. now i get the error that the physicssystem tries to write to a hashmap which is still beeing read by my raycastingjob. so the physics update somehow has to wait for all raycasts to be done

rotund token
#

it should wait by default

#

if you need to write

#

RegisterPhysicsRuntimeSystemReadWrite

solemn hollow
#

InvalidOperationException: The previously scheduled job BaseFilterSystem`3:FilterJob reads from the Unity.Collections.NativeParallelHashMap`2[Unity.Entities.Entity,System.Int32] FilterJob.processor.physicsWorld.CollisionWorld.EntityBodyIndexMap. You must call JobHandle.Complete() on the job BaseFilterSystem`3:FilterJob, before you can write to the Unity.Collections.NativeParallelHashMap`2[Unity.Entities.Entity,System.Int32] safely.

#

wont get rid of this error

dapper arch
#

im going through some of the example projects on unity but it doesn't seem like this .WithName filter is working as I would expect it to, no matter what is wrote in there, the outcome is the same, would anybody happen to know why? i would expect the first example .WithName("aaaaaaaa") to not work because it cannot find an entity that has that name and/or system/component?

solemn hollow
#

@dapper arch WithName is not a filter. its a way to set the Name of the CodeGenerated job so you can easier identify it in the profiler

dapper arch
#

ooh okay thanks

solemn hollow
#

@rotund token my problem was not cloning the CollisionWorld it seems. i did not have to do that before in my other systems though

rotund token
#

you shouldn't have to...

solemn hollow
#

hmm but it also doesnt work with RegisterPhysicsRuntimeSystemReadWrite.

#

do i fist have to schedule the job and then declare the dependency? because im not only depending on the system running before but also on job completion ?

rotund token
#

is your job running several frames?

solemn hollow
#

no but it is running more or less often than physics depending on framerate

#

cant do the job in fixedupdate

rotund token
#

id try to make a simple repo

#

what you're doing i think is fine

solemn hollow
#

will do. first ill get this to run with clone. need to make some progress ๐Ÿ™‚

devout prairie
#

just thinking out loud.. so if burst doesn't automatically vectorize floats to float4[] for simd, does it do it for stuff that is already float4 like quaternion rotations, and assuming it doesn't do it for translation values stored as float3

#

just curious if for example you created a simple system that took the Rotation component and lerped the float4, would it be simd-fied

rotund token
#

float3 arrays dont really simd well

#

how do you populate that 4th required field

devout prairie
#

yeah i was wondering if just putting a zero would cause problems

#

putting a one i imagine would not be useful

#

i take it for simd to work, it has to be performing the exact same operation across all four floats, so maybe something like rotating two vectors or something might not work

#

my understanding is limited ๐Ÿ˜›

rotund token
#

i actually have a bunch of algorithms i store position in float4

#

and i actually create float4 vertex meshes

devout prairie
#

ahh, and it simd's well?

rotund token
#

yes purely for that purpose

rustic rain
devout prairie
#

pos rot and scale all at once

#

just curious because, i think once you get to that point, you must be effectively hitting the architectural limit of the platform

solemn hollow
rotund token
#

apart from the fact anything more than a basic example will struggle to even properly auto vectorize, its significantly less instructions

#

float3

#

float4

#

half the instructions for float4, can work directly with the nativearray

#

for float3 it has to copy it to a new float4 variable and fill the empty slot

#

its basically doing this (but in simd registries)
var a =new float4(Array1[index], 0);
var b =new float4(Array2[index], 0);
Result[i] = a + b;

solemn hollow
#

ah ok. but i meant more like having Arrays of float instead of an array of float3

rustic rain
#

I just realised

#

that you can have float4 for positions/scale in 2D

#

xD

rotund token
#

you could... but can also be sneaky and pack 2x operations in a single instruction

#

float4(pos1x, pos1y, pos2x, pos2y)

#

and double your throughput!

rustic rain
#

I guess

devout prairie
# rotund token

what sort of time differences does this give? or is it not an apples and apples comparison without context/data to test it on

#

i imagine it's maybe, same time, but 2x more data, or something along those lines

rustic rain
#

I kind of want to make my own components for 2D position/scale and rotation

#

and I wonder

#

whether I should write directly to LTW or to translation/rotation/scale components

#

isntead

devout prairie
#

good question and good idea

#

when dots becomes a fetish club for over optimizers

solemn hollow
#

why do you need your own components. youd have to do everything from scratch and probably cant optimize yourself as much as unity did already for 3D.

solemn hollow
rustic rain
devout prairie
#

well i guess, if he took a truly abstract data oriented approach, for the main loop of his systems, he could discard the z axis and pack all of his object positions into float4 arrays of two objects each..

rustic rain
#

when you have all in 2D

devout prairie
#

rotation also becomes one single float value, rather than the Rotation component of float4

#

so you get four rotations for the price of one

solemn hollow
#

i understood it more along the lines of he doesnt want to use the transform package at all. thus he would have to roll his own renderpipeline etc since he has no translations anymore. sure you can do your own 2DTransformComponent. in the end you still need to write to unitys Transform components to have any compatability at all

devout prairie
#

yeah that's the part i was wondering about, you'd still have to write to unity transforms at the end

rustic rain
#

good thing about it

#

it's 1 less dimension

#

so transform system will be overall even faster

#

also less memory in chunks

solemn hollow
#

but you dont even fill a single chunk right now anyways.

rotund token
#

Boids sample overrides the transform system and writes direct to ltw

devout prairie
#

i imagine unity could write a 2d transform system that could potentially be blazingly fast, just doing the above

#

no idea what the 2d rendering workflow/pipeline is though

devout prairie
#

i'm back to needing to extract euler from a quaternion ๐Ÿ˜

#

i could only avoid this perilous mathematics for so long

solemn hollow
#

hmm i dont understand Collectors yet. anyone got a resource where i can check them out? only thing i wanna do is write a collector for a raycast that ignores the first hit if it is at rayfraction 0. because that should be the collider of the object shooting my ray

rustic rain
#

either create quat from ground 0 or make it through multiplication

devout prairie
rustic rain
#

why you need euler?

devout prairie
#

min/max radian rotation constraints for joints

viral sonnet
#

can you solve min/max rotations with a dot product?

devout prairie
viral sonnet
#

have you tried turning it on and off again?

devout prairie
dense prawn
#

Is it possible to assign entity references during conversion? Like, having 2 converting GameObjects referencing each others converted entities?

solemn hollow
#

yes. GetPrimaryEntity(gameobject) is what you need

rustic rain
#

lemme remember which is it...

viral sonnet
#

IDeclareReferencedPrefabs is the interface

rustic rain
#

yeah

dense prawn
#

Yep, GetPrimaryEntity worked like a charm, thanks guys!

rustic rain
#

hmm. Do you guys know any way to reduce code size or reuse any of that code somehow? xD

#

I have 7 big blocks of code like this

#

and I can't think of a way to use it

#

modifying it is somewhat scary, even though I usually do it through "swap all"

devout prairie
#

yeh just dump it in a static method with [MethodImpl(MethodImplOptions.AggressiveInlining)]

rustic rain
#

but how

#

Key thing which differs is end of those loops

#

I loop through all entities in chunk and then through all tweens in buffer

#

and depending on what components chunk has

#

I have to call different interface method

devout prairie
rustic rain
#

through polymorph components

#

that getrecasted to different versions of it

#

and thus call different interface implementations

#

all this to avoid doing more code in components themselves

#

this is how it looks now xD

devout prairie
#

sorry need to grab some food ๐Ÿ˜

solemn hollow
solemn hollow
#

i thought if id filter out hits occuring at hit.fraction == 0 id filter out the collider of my unit. seems not to work consistently

#

if the doc would be correct it would be impossible to hit the collider of the entity casting the ray with this collector. hmm

karmic basin
#

can't you just cast further ahead ? ๐Ÿ˜›

solemn hollow
#

i need the closest hit that is not the entity itself. if id cast further ahead id have to be sure that i dont skip hits which could easily happen because my units actually have no collision with each other

#

i mean i know which entity casts the ray so i can filter based on that (i think i have to do that regardless ) but still its unexpected behaviour

karmic basin
#

Oh I see

karmic basin
# solemn hollow

hmmm looking at tests, looks like Fraction is supposed to be a float. Does it fail the casting from int to float maybe ?

viral sonnet
#

if it's inside you can Physics.ComputePenetration but I don't know the equivalent in the new physics package

rustic rain
#

Maybe you guys could know any idea what could possible be flawed here?

#

it's supposed to give me delta in edge frames, where delay is over, but not fully

#

and same with elapsed time

#

give me leftover delta on last frame

#

In the end it's called like this

#

so supposedely total newDelta passed through DoTween() will be 1.0

#

but I get invalid result

#

just a sec, I'll show

#

end translation must be 8.2 and 11 since original is 3.2 and 6, while total movement should be 5 and 5 in 5 seconds

#

but something is wrong and total amount of change results in higher result

#

which makes tween not precise

rustic rain
#

bruuuh, can it be float precision?

viral sonnet
rustic rain
#

how can I transform it into ticks?

#

I also consider using double ngl

viral sonnet
#

before you use ticks test with a double, yeah

rustic rain
#

but I worry about size of each tween

#

also

#

hmm

viral sonnet
#

see if the problem goes away or is not as prevelant

rustic rain
#

delta time is only available as float

#

so I'd need to cast it

#

which is probably fine

#

but what if it's already has float loss?

#

๐Ÿค”

#

there's double version of elapsedTime

#

which I obviously can iterate myself

#

to get double delta

viral sonnet
#

the loss doesn't matter as much when you calculate in relative terms

rustic rain
#

it's about getting precise numbers in the end

#

it's quite sensitive to loss

viral sonnet
#

then don't use floats ๐Ÿ™‚

rustic rain
#

as it seems

#

I guess xD

viral sonnet
#

i moved away from floats for exactly that reason. when something converges to zero and needs to be precise at the end

#

floats have their place but incrementing them over several frames and expecting a precise result is not one of them

#

1.001 -> actual value 1.00100004673004150390625

rustic rain
#

I assume

#

DynamicBuffer

#

doesn't affect entities total size in chunk

#

right?

viral sonnet
#

depends on the InternalBufferCapacity

rustic rain
#

element's size I mean

viral sonnet
#

if it's 0 the buffer is outside the chunk and only ptr, length, capacity is in the chunk

rustic rain
#

since I might add a lot of tweens (for chaining purpose)

#

yeah

#

that's what I thought

#

all right

#

let's see it in double

#

welp ๐Ÿ™ƒ

#

it;s certainly more precise

#

but still bad xD

#

oh wait

#

I forgot initial delta

#

nnnope

#

same loss

rustic rain
#

welp, so far going in nice xD

#

I already managed to work Move Scale and Rotate tweens

#

Now the part where I need to figure out how to author it

hot basin
#

hello, I need to process same data in different way, and it's simple as it's just different equation
I can have multiple jobs that just do what is needed to be done but I realised I can generalize it with an interface

#

should I bother as I would probably have only like 6-8 of different kindd of equation?

rustic rain
#

That's OOP though

#

if you still want to go down that path

#

there's PolymorphStructs

#

lib

#

I currently use it to develop ECS tweening

hot basin
#

data struct is the same, I can generalize only the job

rustic rain
#

if data struct is same, you can just do cast I guess

solemn hollow
#

dont generalize if you have a low finite number of cases

hot basin
#

public struct EvaluateAxisLinear<T> : IJobParallelFor where T is IFunctionProvider it this way

solemn hollow
#

oh no another utility ai?^^

hot basin
#

nah, I just copy existing struct def

#

and yes I have utility AI

solemn hollow
#

thats like implementation nr. 6 or sth ^^everybody is rolling their own

hot basin
#

it's too easy to not make your own

#

i have my own gpu instanced animation renderer also

#

and I saw Dreaming posted update to his framework with somethin similar

#

so I'll assume it will be much common to see same tools popping now and then

#

and I realized now I could generalize UtilityAi also in that way ๐Ÿ˜„

solemn hollow
#

yah i did that... made it quite complex though