#archived-dots
1 messages ยท Page 280 of 1
for me when i first tested autovectorization ExpectVectorized() always threw an error... even when it did work
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
yeah if you dont clear it could have any values in it
The joy of unmanaged native memory allocation
'stop holding my hand .net I want to be a real coder now'
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
ah and there is a diffrence? i do allocate a hashmap per entity
that codedeletion bot slowly starts catching u outsmarting him? ๐
i use this pattern a lot
oh im playing games, cbf coping and making it work
easier to screenshot
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?
every chunk that re-uses this thread will use the same list
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?
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
no they only have a fixed max lenght in chunk. i set that to 1. cause i either have 1 entry or more than 20
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
yeah i was thinking, they allocate a fixed size of memory, but you maybe only use say 3 slots out of 10 or whatever
yes, allocating a hashmap calls clear as well
allocating one of the slowest things you can actually do
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
i thought thats only true for heap allocations. do nativearrays always live on the heap?
imo just go profile it and see!
make a simple simple job, allocate a small native array per entity
then do it per chunk
i mean there is no question about about whats more performant ^^
@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?
not even close
ah
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
my usecase is just diffrent. i need lists of Targets with Scores to multiply together in that hashmap. the result is then again a list of Target and Scores which is again passed to the next system doing exactly the same
and you are stopping the gpu doing something else
while most of the time you have free cpu cores
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
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
i /think/ most of these large avx registers
do work on doubles not floats
so like 4x double
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?
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 ๐
It was already finished actually in classic Unity (I hate it)
https://play.unity.com/mg/other/20-02-1600
but I decided to rewrite it in ECS xD
I tried, but it's experiencing same problem
where player is just too far from position he needs to be
yah that game looks definitly like a conditate for ecs upgrade ๐
5 entities total? ๐
ull probably have worse performance than with GO
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
random gen
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
sadge, but looks like rotation also needs some adjustment
when rotation is identity it's good
but with any other offsets it breaks
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
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
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
from what i read, it basically seems like the primary use case
yeah
aspects, never heard of
sure you can buddy! i believe in you
๐ฏ๏ธ
is the object a child?
like 0.4/0.4/0.4
hmm
I can't even imagine how would you scale rotation
accordingly
maybe I should look at Unity transform
system
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
im in the same boat. feel like there should be an easily accessable cheatsheet for transform matrix stuff
i looked into the transform system and copied from there
how were you able to see the code, i thought most of it was hidden no?
all ecs systems are easily accessable. thats one main point of the new tech stack. engine code in c# thats accessable for everyone
ahh sorry i thought you meant UnityEngine.Transform
ah i see. yeah its confusing
yeah they definitely need i think to start providing primers and information for this stuff, if they hope to transition people over
again im pretty sure thats the whole point of aspects in 1.0
well thats for after 1.0 . atm they actually want people who know what they are doing. (which im not)
yeah aspects actually sound too good to be true
Why did they rename NativeMultiHashMap to NativeParallelMultiHashMap?
huh, interesting
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
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
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
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
Is it intentional that the source generators are ignoring all modifiers on variables?
sry what do you mean by modifier?
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
hm i guess they just havent gotten around to implementing all possible ways. not sure if they ever could
How does the source generator pull the variables? I'm assuming with reflection?
idk about the source generator they are using. but i think usually you get it from the roslyn analyzer output.
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 ๐
yes you can but youd still need to handle those diffrent cases and permutations for each modifier
50x the work probably
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
ah i thought you were talking about job codegen
[GenerateAuthoringComponent] should be way easier to do yeah...
I'm converting to 0.51 atm, and so far that has been the first oddity I've encountered
from 0.17?
Yeah
im not using [GenAuthoringComp] so i cant speak to that
I've not used private fields in components a huge amount, but something like this doesn't seem too far out there imo
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
What is the preferred workflow?
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
Well, yeah.
i seldom have a mapping of 1:1 authoring to runtime components
so i always need to use the IconvertgameobjectToEntity interface
or ConversionSystems
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.
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
My game is 99% procedurally generated so I only have 1 "actor" entity that I need to have set up
ah i see.
I can definitely see the issue if it was a more traditional set up with many defined prefabs
id not report it. pretty sure they are aware how its working right now
and honestly using the ConvertToEntity interface isnt really that much boilerplate. there you can do the stuff u want to do easily
Yeah I didn't know it exists for a long time, I always used GameObjectConversionSystem which is a lot more boilerplate
even that is like 5 lines
well but u can handle combinations of monobehaviour components which is a really nice thing
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
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
I'll try and convert all the components on my procedural entity to a single conversion system, maybe I'll like it more ๐คท
lazy af ^^
I just don't really have any heavy duty authoring requirements ๐
Especially since this is a one person, non-professional project
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 ๐
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
well unity isnt sure about it yet either ๐ im curious on what 1.0 really brings
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
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
I meant more of in a savegame context
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
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
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
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)
true
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
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...
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
In the editor or in the build?
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
What does your authoring component look like?
I'm so happy you're on now
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
shnike
I don't see the authoring component here? Only the actual component
I think I gave you the wrong one
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
maybe its because I tried default assigning nums?
The issue is ItemDropBufferAuthoringData is inheriting from monobehaviour
It shouldn't inherit from anything
do i need URP or HDRP or anything like that for ECS? i can't see entities
It appears there is a visual rendering bug now:
I'd try restarting unity
Otherwise try resetting the component
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
What unity editor version / ECS version are you on?
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
Ideally you upgrade to 2021.3.4f1 and ECS 0.51
Wait, ECS works on 2021 now?
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
I'd upgrade regardless just for the various improvements
the docs list 2021.3.4+ with entities 0.51 so that should be fine
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?
does anybody happen to know if there's any sample unity packages / scenes showing ecs/dots on 2021 0.51?
seems like the samples are already updated: https://github.com/Unity-Technologies/EntityComponentSystemSamples
oh awesome thanks
Yeah until now they've done a really good job keeping them updated ๐
This worked to fix the Unity UI bug. If it does not outright fix the game mechanics bug I experienced, it sure as the sun rising will help me debug it. Thanks much Snike Cat
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 the filter is on a query not on a job
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
wait this is a thing? i always get the exeption for the lambda 0.o
very annoying
Clicking the line doesn't even do anything...
that i have too. but i cant remember to be redirected to codegen code yet.
i rarely use codegen atm though.
How can you turn it off?
you cant. i mean i more often than not write the IJobEntityBatch myself
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
well for me all my old stuff did not break
It didn't break for me either, this is just a bug ๐
Also, line 581 in the above exception is this line:
???
thanks
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?
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
ah since the handle to the entites array never changes. entites never move into other chunks just their componentdata
Yep
but then again wouldnt that mean you could get the handle in OnCreate and not while scheduling the job?
all right, I'll try to do it xD
I also consider doing normal Scale and NonUniformScale just in case xD
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.
You porting the DoTween thing?
Nice, best of luck with it ๐
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
Collider is stored as a blob asset i think are you doing all that
Yes, I'm creating the blobs on initialization
Physics ragdoll sample does:
My entity doesn't start out with an authored PhysicsBody
I think I'm missing some new component they added
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 });
}
This is one of my bodies:
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
i think PhysicsWorldIndex is normally 0 and is a shared component
shared i think with all physics entities
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
you could do it in a monobehaviour..
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
I'm pretty sure you can also just schedule the job if you press the button, no?
or another alternative - set a bool value on a system, and the OnUpdate just returns early if the bool is false
Haha maybe, i guess i'm fixed on ForEach just always being there in the OnUpdate
Is that not equivalent with my snippet?
This solution, that is
Try it, I think it should work just fine
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
Yep, it works
I'm still confused how the system just knows when to activate automatically
The system knows which entity queries you assigned to it
Is that generated at compile-time?
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
But in my system Entities.ForEach() isn't called until a condition passes
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
But the system still knows to run when an entity matches the query
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
the system still knows about the query even if it is hidden behind a branch
Debug.Log("f");
if (Manager.controls.Player.Split.WasPerformedThisFrame())
{
Entities.WithStructuralChanges().ForEach((Entity e, in Selected s, in Translation t, in Radius r) =>
{}
});
Are you sure? I had something not run earlier until I declared it in OnCreate
if you use a lambda job it works. if you dont you need to create the query before the condition check
It was a lambda job, odd
but the query should be created in oncreate anyways
This was also the only query in the system though
then the query should be auto codegened for u in oncreate anyways hmm
I originally assumed that the system isn't even started if no query matched it
yes
In this case the console logs "f" every frame, even before Split is performed
Well then if I have a single query in a lambda in OnUpdate it would never run, right?
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
If it doesn't use ForEach, that is?
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
no its just stupid. u need to remove all indents
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
when the query finds an entity to execute on the system will run but the job wont be executed until you Perform Split
But when is the query created?
It's created when you call ForEach
That's why can call WithStoreEntityQueryInField withForEach to store the query in a variable
i think thats not really true. its created by codegen isnt it?
Yes, I guess I wasn't really clear. It's created when you define the parameters to the ForEach function
Is there an easy way in rider to jump to the source generated code?
thats how the entityquery codegen for a small lamba job looks like
i do it via the global search most of the time
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
really wish i had a buffer chunk component ๐
instead I'm going to have to attach an unsafe container to the chunk ๐ข
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
what's your saying? sounds gross. ๐ what are you hoping to accelerate here?
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
i want to see some benchmarks for this later
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
yeah generic and performant rarely go in one sentence
if you don't kill iteration time with random access it's pretty cool though
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
where's the best place to browse the dots source code?
side by side with your code
vs just gives me the metadata stubs i think from the compiled dll's
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
take a look at StorageInfoFromEntity, you can get some nice info out of it. not sure if the archetype is in there though
i know the code is in the downloaded packages, just wondering if there's a repo online or something
VS bugs like crazy with inspecting source code. sometimes it works, sometimes it doesn't. just make sure you have decompiled sources ticked
This one is always up-to-date, it pulls directly from UPM: https://github.com/needle-mirror/com.unity.entities
if you're sick of VS, switch to Rider ๐ Did the same thing some time ago
oh it does have the chunk
I don't think that's financially an option for everyone
you just saved me 10min'
well I get my copy of VS from my company. other than that VS is really expensive
managed to convert 90% of devs at work to rider from VS
need them to start a referral program
I am converted xD
you'd be swimming in referral money by now ๐
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
it's faster, it let's you inspect code, has better formatting
and once you get used to it, better default colour schemes right enzi ๐
fair enoug
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
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
I personally switched only after VS faced me with some unsolvable bug
sounds like a fairly convincing array of benefits tbf
vs2022 auto complete is cool. really the only thing that VS team has done since 2005 that's actually worth a damn
i'm using vs community 2019
can get laggy after a while occasionally
does throw an error occasionally
MS kind of shot themselves in the foot with VS Code
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
Rider is just a lot more expensive than VS or VS Code, which is the main drawback I guess
so is it lightweight, enzi mentioned it start up quickly
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
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
depends on the country and income I guess. for me it's not that much. best thing, rider becomes cheaper after the years
It's still slower than VS Code, but that's understandable, and it's faster than VS Code with Omnisharp installed
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
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
even a hobbyist needs good tools ๐
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
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
yep, I had the same problem.
and to view definition i just get the dll meta stubs:
VS is too dumb to understand that the source is already there
i wonder how rider knows though
considering unity itself i guess is referring to the dll versions
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
rider actually loads the source from the packagescache folder
i think i may have figured it out
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
yeah that's super annoying imo though
i guess if it's going to slow down VS it may be better to be able to switch it off
That's what made my computer explode
It got unbearable slow
Typing was lagging, and intellisense took like 1-3 seconds to do something
yeah it makes analysis run on all the packages
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
rider doesn't need to add them to project generation
nope, my main reason for changing IDE ๐
i got really mad when VS loaded Unity.Collections
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?
No, jetbrains just sell a lot of different IDEs
it's 238gbp for the full package
no, you actually don't need anything else. resharper is included in rider. it's just for VS
seems reasonable i would say
I wish they made a community edition like they did for IntelliJ
i'm about 50gbp p/m for adobe sooo..
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
anybody use any of that azure stuff from MS
You mean their cloud infrastructure? ๐
yeahhh
We used it at work, but we switched to AWS
i guess more of an enterprise thing, i'm just a freelancer soooo ๐
I guess it depends a lot on where you work
we use it at work just because of playfab which our publisher likes
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
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
can you please elaborate on this, sounds like something i can use to improve my full of filtering calculations
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
so many useful API calls are behind internal stuff -.-
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
hashmap lookup not that much faster than cdfe
at least depending on the hash generation and comparison
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
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
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
what exactly are you caching now?
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;
}
huh, what do you access then with the chunk? just metadata or component arrays?
i'm just using this to trigger change filtering
since i'm not accessing the AttributeTarget.Value via any conventional method
ah i see
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
interesting you started using unsafelist in an icomp even when it's chunkdata. you are getting around the world destroy problem?
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);
}```
interesting approach to get around the change filter triggering. thanks for the info
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)
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)
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
oh yeah got to be careful of scaling
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
oh yeah i get you
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
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
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
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
@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
-add is subtraction
^
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
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
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
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)
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
but i don't? you're suggesting i remove that
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
ah i guess thats the misunderstanding
i am curious though what performance benefit merging the arrays would be though
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
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
its what i do in my statsystem so i wondered why u split it up
it should be both
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
yeah the formula doesnt look intuitive but when you think about it its really easy
just less code then ๐
0.3-0.45ms for both cases
i mean the processor still has exactly the same amount of values to go through in the end
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
ah then id expect more performance. hmm
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
well at that point i guess its more howd you prefer the code to look like
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
oh man you are right. no wonder my builds sucked
This is a very useful attribute though
100%less guarantees immunity
Just need to be careful when designing
yes it makes sense for some mechanics. poe just throws it around too much IMO
dont monsters use less modifiers for damage taken all the time?
Oh that's true
Delerium in particular
But there's not that many cases outside that
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
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
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
nono increased effect wouldnt matter. just more effect would
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
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
(pretty much half of that is impossible to do these days)
hmm havent played for over a year. i just sometimes check back in when there might be a cool league
missed out, this league was the best
golden rule of poe : shitter a league sounds the better it is
yeah this one sounded so bad ^^
up there top 3 leagues ever
well then its getting added to the leaguemechanics pool anyways
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
ill probably check it out again in another year or so (or whenever poe2 comes out...)
i'm just a masochist, no other game really offers me that hardcore experience
dota? ๐
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
yap same. but i only watch internationals
and the other game i can also sink in insane amounts of time is OxygenNotIncluded
that i have never played
though probably should since game at work is i guess similar genre
to check out gamedesign alone you should play it
i just don't play single player games at all
the emerging mechanics from those systems are just sick. whole own physics
i play more and more singleplayer. much more relaxing ^^
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
ok well i can definitely at least notice an improvement on the reset memory part
which makes sense
1 less memclear and memcpyreplicate
~0.25 to 0.18ms
glad i could be of minimal help once in a while too ๐
bruh, why the forbid posting code
do they have to pay for discord traffic somehow?
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
oh god true.
and then we resort to large image files
maybe it's the opposite, mods holding discord shares (/s)
๐ 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?
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
it should wait by default
if you need to write
RegisterPhysicsRuntimeSystemReadWrite
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
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?
@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
ooh okay thanks
@rotund token my problem was not cloning the CollisionWorld it seems. i did not have to do that before in my other systems though
you shouldn't have to...
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 ?
only found this : https://forum.unity.com/threads/how-do-i-raycast-in-an-old-state-of-the-world-inside-a-job-running-for-several-frames.933570/
is your job running several frames?
no but it is running more or less often than physics depending on framerate
cant do the job in fixedupdate
will do. first ill get this to run with clone. need to make some progress ๐
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
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 ๐
i actually have a bunch of algorithms i store position in float4
and i actually create float4 vertex meshes
ahh, and it simd's well?
yes purely for that purpose
I guess that's why it's better to simply use float4x4 matrices
good point yeah, i wonder if it simd's that
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
but wouldnt it also vectorize if you put X,Y,Z of a vector3 in their own arrays? storing it in a float4 (x,y,z,empty) seems useless for SIMD
the difference is huge
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;
ah ok. but i meant more like having Arrays of float instead of an array of float3
you could... but can also be sneaky and pack 2x operations in a single instruction
float4(pos1x, pos1y, pos2x, pos2y)
and double your throughput!
I guess
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
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
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.
this ๐
cause working with those components is painful
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..
when you have all in 2D
rotation also becomes one single float value, rather than the Rotation component of float4
so you get four rotations for the price of one
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
i missed this
yeah that's the part i was wondering about, you'd still have to write to unity transforms at the end
good thing about it
it's 1 less dimension
so transform system will be overall even faster
also less memory in chunks
but you dont even fill a single chunk right now anyways.
Boids sample overrides the transform system and writes direct to ltw
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
i'm back to needing to extract euler from a quaternion ๐
i could only avoid this perilous mathematics for so long
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
Don't ๐
either create quat from ground 0 or make it through multiplication
sorry i do not understand your labcoat speak
why you need euler?
min/max radian rotation constraints for joints
can you solve min/max rotations with a dot product?
i'm not sure, i tried realigning the sub-quantum arc derivative of the binomial probability drive but the semi reticulating toroid spleen wouldn't align properly with the gravitational constant of the planck residual
have you tried turning it on and off again?
good idea, i'll give that a whack
Is it possible to assign entity references during conversion? Like, having 2 converting GameObjects referencing each others converted entities?
yes. GetPrimaryEntity(gameobject) is what you need
there's also interface that lets you add prefab game objects that aren't in subscene into conversion list
lemme remember which is it...
IDeclareReferencedPrefabs is the interface
yeah
Yep, GetPrimaryEntity worked like a charm, thanks guys!
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"
yeh just dump it in a static method with [MethodImpl(MethodImplOptions.AggressiveInlining)]
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
couldn't you reduce it to two, so you call a DoRot() and DoPos() and pass in your tweenBuffer, translations, rotations as ref
no, because it's actually object oriented shit xD
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
sorry need to grab some food ๐
thanks but i meant more like someone explaining the concept a bit. i understood it now and the only thing that i did wrong was just not setting up the maxFraction when creating the collector... so the raycast never returned anything... in the sample the default value is 1. in the Standard ClosestHitCollector (which i copied and modified) it is 0....
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
can't you just cast further ahead ? ๐
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
Oh I see
hmmm looking at tests, looks like Fraction is supposed to be a float. Does it fail the casting from int to float maybe ?
inside raycast -> hit.point == Vector3.zero && hit.normal == -dir or hit.distance == 0 && hit.normal == -dir
if it's inside you can Physics.ComputePenetration but I don't know the equivalent in the new physics package
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
there
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
bruuuh, can it be float precision?
that could always be a problem ๐ that's why ticks are much better
but it's time based
how can I transform it into ticks?
I also consider using double ngl
before you use ticks test with a double, yeah
see if the problem goes away or is not as prevelant
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
the loss doesn't matter as much when you calculate in relative terms
then don't use floats ๐
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
depends on the InternalBufferCapacity
element's size I mean
if it's 0 the buffer is outside the chunk and only ptr, length, capacity is in the chunk
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
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
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?
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
data struct is the same, I can generalize only the job
if data struct is same, you can just do cast I guess
dont generalize if you have a low finite number of cases
public struct EvaluateAxisLinear<T> : IJobParallelFor where T is IFunctionProvider it this way
oh no another utility ai?^^
thats like implementation nr. 6 or sth ^^everybody is rolling their own
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 ๐
yah i did that... made it quite complex though