#archived-dots
1 messages ยท Page 95 of 1
at least the boilerplate amount got smaller now
but it's still extra if you need things that have one instance etc
but most of that code also does structural changes, and those can't happen in the new JobComponentSystem.ForEach
which thread its on does matter tho because scheduling has overhead
i was thinking more about if you can hijack whatever system they're using to execute the job directly without using the jobs system or scheduling.
hmm i wonder if the jobified foreach that runs on main thread lets you add/remove components
because it does run synchronized, but on the other hand it uses burst and i dunno if it supports that
I'd really love to be able to just use burst on dedicated threads :p
@hollow sorrel nope, structural changes not allowed within new ForEach
yeah, and its interesting that the messaging earlier was job scheduling is the performance by default and now they're bypassing it all entirely.
have you tried with the alwayssynchronize and using .run() like in above post?
also, you can run it with no burst: Entities.WithoutBurst().ForEach(...)
I'm bad at discord and can't paste 5 lines of code :D
but no, .Run() doesn't help, you can create an ECB and .Playback() it right after you Run() the job
i saw in the notes that ComponentDataStore uses burst compiled delegates for add/remove
im gonna hvae to have a play i guess ๐ too interesting
i imagine they'd allow it in the future since it seems to make more sense to merge ComponentSystem and JobComponentSystem now that they can do (almost) the same thing
also maybe we can check their codegen of the ForEach to see what it does to bypass the job system and still run burstified so that maybe it can be used without jobs
oh they do not bypass the job system
ohhh that was you posting in that thread scorr, didnt notice!
they do generate a job
yes, but its not scheduled like normal but called directly as i understand it
you can .Run() normal jobs
oh so the requirement for burst is still always a job
ohhhh, okay, i was thinking it was doing something new - i was confused ๐ฆ
btw, the bottom half of Unity.Entities/CodeGeneratedJobForEach/UniversalDelegates.gen.cs is art ๐
oh so the requirement for burst is still always a job
i have a link to an example that supposedly has working burst delegate function calls, but i haven't had a chance to test it https://github.com/sebas77/Svelto.MiniExamples/blob/master/Example1-DoofusesMustEat/Iteration2-Burst/Assets/Code/Engines/LookingForFoodDoofusesEngine.cs
@dull copper doesnt the new foreach use jobs automatically?
well, it reduces the boilerplate to half
but you still need to write some
this is the sample Joachim gave on running the job on main thread with AlwaysSynchronizeSystem: ```cs
[AlwaysSynchronizeSystem]
public class RotationSpeedSystem_ForEach : JobComponentSystem
{
// OnUpdate runs on the main thread.
protected override JobHandle OnUpdate(JobHandle inputDependencies)
{
float deltaTime = Time.DeltaTime;
// Schedule job to rotate around up vector
Entities.ForEach((ref Rotation rotation, in RotationSpeed_ForEach rotationSpeed) =>
{
rotation.Value = math.mul(
math.normalize(rotation.Value),
quaternion.AxisAngle(math.up(), rotationSpeed.RadiansPerSecond * deltaTime));
})
.Run();
// Return job handle as the dependency for this system
return default;
}
}```
I was mainly talking about the amount of code you need to write for one off kinda things.. even having burst there isn't needed for perf but it's the only way to guarantee that the floating point math you do is deterministic
of course the burst float determinism isn't 100% done yet either
apparently it's supposed to be deterministic within the same platform but I don't really know if that means anything
considering that most code you build for specific platform using same compiler tend to run exactly the same on that platform anyway
but I am really waiting for full crossplatform determinism
but also, considering how many times Unity has postponed it, it might not even be a thing even next year
Have you done any tests on how good is Burst at determinism right now (vs what Mono/il2cpp are doing)?
I had to do a fully deterministic project recently, but I've chickened out and went integer only for logic ๐
not yet and it doesn't really matter as long as the crossplatform support isn't in either if you do crossplatform multiplayer
and in the case of physics and multiplayer, you can't have 100% determinism anyway because lag, there will always be moments during dynamic collisions where you have to predict things and things don't match in the end
like, if you have two player controlled dynamic objects simulated through physics, any input players do the moment before impact will be simulated differently on each client as the up-to-date input isn't known for any but the each players own clients dynamic object at time of impact
so these things need to be resynced after collision anyway
and well, same goes with all predicted movement really
yeah, luckily my project was fast enough to do the rewind&resimulate trick after each input received
also fixed point math is still the most safe bet if you need to have that thing done now
so it's not really a bad choice by any standards
we all know that works today
If you're pretty close to determinism you can reduce the amount of synchronization needed, though
Less network traffic, potentially less complexity, etc..
when you have full determinism, you can trust some things to be exact tho
just catching up on discussion here ๐ @mint iron Burst supports function pointers now: https://docs.unity3d.com/Packages/com.unity.burst@1.2/manual/index.html#function-pointers.
A few important additional notes:
* Function pointers are compiled asynchronously by default as for jobs. You can still force a synchronous compilation of function pointers by specifying this via the [BurstCompile(SynchronousCompilation = true)].
* Function pointers have limited support for exceptions. As is the case for jobs, exceptions only work in the editor (2019.3+ only) and they will result in a crash if they are used within a standalone player. It is recommended not to rely on any logic related to exception handling when working with function pointers.
* Using Burst-compiled function pointers from C# could be slower than their pure C# version counterparts if the function is too small compared to the cost of P/Invoke interop.
* A function pointer compiled with Burst cannot be called directly from another function pointer. This limitation will be lifted in a future release. You can workaround this limitation by creating a wrapper function with the [BurstCompile] attribute and to use the shared function from there.
* Function pointers don't support generic delegates.```
None of those are surprising really.. its a bit of an inconvenience not being able to call FPs from other FPs, but can be easily worked around I guess.
this is great
I mean, I'd love to have some codegen for this too
but at least it's supported officially now
and it's not terrible amount of extra code to wire the delegates
yep
also thanks for the heads up ๐
Note that you can also use these function pointers from regular C# as well, but it is highly recommended (for performance reasons) to cache the FunctionPointer<T>.Invoke property (which is the delegate instance) to a static field.
well, people who do this may not always care about the perf, like if you need that burst determinism for example
also what was the regular quote block again? ๐
I never remember it
is this not a block quote?
this for code samples
wait, so what does triple ' do? I tried to paste some code earlier with 3x single quotes and it just disappeared
need to be ` not ยด or '
you need to start with 3x ` and end too. That wrapt it in a block, useful for code
text wrapped in single ` will just do the thing inline
three does the separate box like seen above
block quote is less intrusive, hence trying to use it
oohh
test
public field;
makes me happy that the blittable structural changes code is in now, its a huge step forward cause they had to rewrite a lot of the core for it. com.unity.entities@0.2.0-preview.18\Unity.Entities\EntityManagerChangeArchetype.cs
ah nice you can do 3xand language name like csharp
I just use shorter cs, it works as well
and md for markdown (I mainly use this if I paste any changelogs here)
also sorry for offtopic
"The syntax to use Block Quotes is > or >>> followed by a space. "
This works?
And yes, lets get back on track ๐
Going to be exploring the new subscene flows today. It's quite nice the V2 asset DB now handles the saving and no need to have those cached assets anymore
anyone know the costs involved in a P/Invoke and is there a way to get around it - i guess the burst method ptr would have to be called from the C++ side?
you mean interop between c++ and burts compiled code? Havent tried that actually
I think the overhead is mentioned because they have to do individual pinvoke for each function pointer individually
you don't do much work on single invoke call
so you mainly pay for the overhead
just curious, what is it you are planning to do on the c++ side you think you cannot in HPC#? use some existing libs?
if you've read about il2cpp, it doesn't remove this overhead fully either
there was some unity blog post about this at some point
oh, so this function pointer stuff lets you burst compile random stuff?
it lets you use burst separate from job system yes
ok, 10-30 instuctions + marshalling
PInvoke has an overhead of between 10 and 30 x86 instructions per call. In addition to this fixed cost, marshaling creates additional overhead. There is no marshaling cost between blittable types that have the same representation in managed and unmanaged code. For example, there is no cost to translate between int and Int32. http://msdn.microsoft.com/en-us/library/ms235282.aspx
like, lets say i have a voxel creator. Can i make that function be burst-compiled and then just execute it normally?
without jobs
I'm now wondering if I can invoke these burst-compiled delegates from regular c# thread
because that's really the thing I'd want to do
I think you can yeah. All of this in the context of il2cpp is interesting though.. like is it going to be cheaper accessing native collections from il2cpp compiled code?
I'd expect it to work
@flat talon i don't have a need right now; i'm just interested to know how to do it in case i need to at some point.
Keep in mind, some of the perf benefits of Jobs+Burst is being able to skip some expensive checks because of assumptions you can make about security of the memory. Outside of Jobs you probably still need to pay those costs?
yeah its interesting
So a burst-compiled FP accessed from managed code that iterates over a native array is prob going to be slower than when done from a job?
I don't really now much about practical cases where il2cpp is better other that you can actually link your own c++ code in the same native dll and have tad faster interop action
oh wait
burst compiles into separate dll's?
oh right they have to due to own compiler
honestly I havent read much up on il2cpp + Burst/Jobs. Just heard they should work fine together
I wouldn't wonder if IL2CPP would give tad better perf with DOTS than on regular c# code, at least all figures Unity has given seem to support this assumption
on regular c# code, people get quite mixed results on IL2CPP, usually it's slightly faster but not always
yeah I was always a bit confused what the future of IL2CPP would be in the brave new world of HPC# ๐
ie in a pure DOTS project, is there a need?
IL2CPP is very much needed by many platforms in general as Unity doesn't even support mono backend on all
yeah.. but! the zero player doesnt need Mono does it?
its a new type of Unity player for pure dots projects, used I think only by Tiny atm
is that a thing already?
I mean, it was supposed to launch for 2019.3
but I haven't followed the progress since the ditched tiny editor
probably just "under the covers" ๐ but it exists. Im not so sure anymore though, because of the U turn that Tiny is taking now. New conversion flow vs the "pure dots" approach
yeah, it was weird
I just hope they will drop mono at some point and use .NET Core
no more dots mode, no more tiny 2D ๐
2D will be back ๐ but yeah, must be annoying for people who started making stuff there
since 0.2 is out now, I expect we'll see the new Tiny soon
teh thing is that the C# jit will optimize stuff with knowledge gained from running the program
for example, stuff like devirtualization
meanwhile il2cpp cant do such things, as its ahead of time
aye and it can do processor-specific optimizations when doing the jit
in heavily OOP code, its possible to see C# and java outperform C++
but it needs to be an absolute nightmare of "enterprise Java(tm)" level OOP
and its mostly due to the devirtualization stuff
btw @vagrant surge do I remember your name from a UE4 group/discord? or am I misremembering? ๐
(Im getting old after all haha)
yes
oh cool ๐ /wave
I havent done much in UE4 since shipping my last project and leaving CCP. Honestly Im more excited about the DOTS future of Unity, as much as I like some of the tools and editor in UE4.
im working on my own ecs implementations for C++
maybe i actually try to release a marketplace plugin of something like a highly flexible projectile system that works with that ecs (ue4)
nice! I would love to see that pattern for UE4. I had sooo many issues with the brittle actors and actor components, trying to parent things together was a nightmare when doing networking.
That ChildActorComponent thingie still gives me nightmares
it was .. so not deterministic ๐
yeah child actor is a nightmare
im working at PUBG now, and we run into bottlenecks due to the oop-ness of the ue4 architecture
oh wow, nice! ๐
funny enough, we are moving code precisely into "bad practises" because its a lot faster
having a huge monolyth on the player is a lot more performant than spreading those replicated variables over multiple components
yeah there hasn't really been much movement on the programming architecture in UE4 since the initial UE 4.0 release. Sure compile times have gotten faster, but no big changes coming up that Im aware of.
btw didnt they buy some company somewhere to do a new higher level scripting language thingie?
i got contacted by a epic engine dev about the experiments i was doing with ECS on unreal
oh nice, thats good
Video Inspired by the new Unity ECS system, i decided to try those same techniques with UE4 and C++ instead of Unity and C# . For my experiment, i used the library EnTT to drive the ECS.
They need to look into this or be left in the dust! I was very surprised how UE4 code doesnt even use SSE instructions
(I know you can turn that on)
very cool! cant wait to see where you take this.
@flat talon I'm pretty sure the use SIMD for math lib in ue4
at least I had to strip some of that out for my double precision variant as I didn't want to bother with vectorization
it's only used in few select places tho
also for ue4 future scripting, there was interesting comment from Tim Sweeney about it
they clearly want to explore more efficient ways to script things but I dunno if it'll ever affect the actual engine side of things
they seemed to be doubtful about Unity's ECS because it's quite compicated for the things users need it
I wonder if I can find the exact quote still
@dull copper IL2CPP performs quite a lot better than mono, for code that deals with a lot of pointers, structs, etc.
Unity is exploring an interesting direction with their ECS (Entity-Component System), which aims to escape the overhead of C# by moving data away from high-level objects linked by pointers to much tighter data layout, as is commonly seen in graphics programming and particle systems, and is less explored in gameplay programming. What's unknown is the productivity cost of recasting gameplay programming problems within the more constrained data model, and whether it would scale to e.g. a triple-A multiplayer game developed by a large team. from https://www.reddit.com/r/unrealengine/comments/aezhdv/it_seems_people_at_epic_are_considering_adding/edxha25/ see two top comments from Tim
i do know from some engine devs i keep contact with, that epic games is absolutely going into more data-oriented stuff
most of the new renderer internals follow those sort of practises
What's unknown is the productivity cost of recasting gameplay programming problems within the more constrained data model, and whether it would scale to e.g. a triple-A multiplayer game developed by a large team.
This is so true.
even more on the physics
@vagrant surge I had to do my own transform component so if ftransform had it, that's very likely place where I saw that stuff
no, i mean actual fmatrix ands tuff
there are 2 implementations separated by a define
one of them is TransformVectorized, and the other one too
oh I thought they only used ISPC on chaos
I haven't really followed up what they do there lately tho
yes
the ispc stuff is for chaos things, they vectorize some inner loops
like calculating AABBs on a fkton of objects at onces
ok so we still talk about same things then ๐
all I meant that you referred to chaos with ispc, not for the vectorization in general
i still think they are cooking something. Lets see
you dont buy a team who makes a scripting language
and not make a scripting language
@dull copper yeah I remember the same article from Tim.
didn't they make python scripting for the editor tho?
I remember they bought some company, and it was some language I didnt know
yes, but you dont need a team who makes his own lang for that
the python thing even kinda already existed
what they have done is to expose BP function reflection to python
except python is editor only
yeah it makes sense to support python for tooling, so many other programs do that
the funniest part is tha the python support is python 2
because all other CG programs still use 2
also, this day is super off topic now here :p
tho they made the implementation in a way that they would flip a switch and now its 3
its semi related ๐ talking patterns and where the industry is heading with dod
i managed to add unity style for-each to my c++ ecs
cool
world.for_each([&](EntityID id, I1& c, I2&c2) {
count += c.val;
});
im taking some inspiration from what unity does, but i havent even looked at the code of unity ecs
i prefer to solve the problems on my own. Much more fun
all depends on what you want to spend you time on ๐ if you enjoy it and have fun, by all means!
but yeah, writing my own implementation lets me know first hand how something like the unity one works
and what could be good/bad to use
for example, editing a random component (or reading it) from a random enemy outside of a loop is quite slow
as it needs to find exactly what offset to use within the chunk for that component type
they probably have some cached lookup tables for that? I havent dug into their code though
its not so easy
each archetype has different offsets
so you need to first get the archetype and chunk of the entity ID, which is easy
but then you have to search the archetype component list to check the offsets for that component type
and then access the chunk memory
btw does anyone know what this is?
They are created by adding the EntityStaticOptimization component to the root of a hierarchy.
https://forum.unity.com/threads/what-exactly-are-static-entities-in-dots.782525/
I cant find that component or behavior
as far as i know i think thats about flattining the hierarchy
it's being discussed in the context of rendering optimizations
if you know the entity will be fully static, there is a lot of fun stuff you can do
@flat talon it's called StaticOptimizeEntity
like store JUST the render matrix, and nothing else
so the entity ends up being super small
just render matrix + render mesh
and i guess AABB comp for culling
thanks @worldly pulsar ! Im thinking about using this for static parts of a subscene, like walls in a level
use it. If unity ecs can know your stuff is static, it can collapse plenty of stuff
which is quite great
Im doing an RPG game and rendering a dungeon from a bunch of pieces
then thats perfect
are they actually static, or do you spawn them, position, and from then on they are static?
the startup speed (hit play) when using subscene and the new quick start is quite impressive
i actually had some ideas for my own engine (which im also making) to use the features of chunk components and such to preprocess static scenes
and make sure the stuff is extremelly hyperoptimized in a few ways
@worldly pulsar Im using the subscene flow, so they are already converted into entities on disk and never moved.. so completely static
@vagrant surge kinda like the subscene conversion flow?
maybe but a bit more overkill than that
i want to actually do some fairly advanced stuff
like use shared components to split objects by coordinate in a way that they are clumped togther, for culling
but not only for culling, but for mesh too
i want to do batching by merging the meshes of entities inside a chunk
well, you can hook into the conversion flow in Unity ECS ๐ for example write a conversion system that write everything into a blob asset
and then use drawindirect
blobs are very cool
ah mesh merging, yeah. We used that quite a lot on EVE Valkyrie, it was key to getting good perf on AMD cards
64 wide waveforms suck when your meshes are small
(AMD cards back then did not play nicely with UE4 rendering, because of all the extra gbuffers)
anyways.. ๐
i was bottlenecked as fuck on mem bandwidth for my PSVR game
managed to reach 120 fps, but the resolution had to be on the smaller side
and no matter if i simplified the scene, it wouldnt improve much
yeah we only did 90 fps on the psvr iirc
on base ps4?
damn thats impressive as fuck
i tried to do 90 on the base ps4 but ran into a similar issue
had to be low res
yeah we undersampled a bit on Sparc ๐ Key for perf on Valkyrie was we implemented a dynamic res algorithm like the one described by Valve's Alex Vlachos. Basically monitored the fps and tuned some gfx settings up/down on the go
ah, that does make sense
main issue i had is also the PSVR tracking overhead
90 fps is 11 ms
but you need to budget at 8
couse the psvr tracker comes and says "fuck yo frame"
ugh dont get me started on that tracking... ๐ but getting WAY off topic ๐ haha
I left VR for now, but doing some personal project exploration still. Mainly programming AI these days, and atm writing an influence map system in DOTS ๐
Planning to make a pure DOTS based utility AI at some point too
influence map looks a perfect match
after all its basically a parallel for calculating a score
it really is ๐ Im just using Burst and jobs for now (lots of native arrays)
once Entities 1.0 ships I will most likely explore converting some of our simulation systems to Entities too
Does anyone know what the "Hierarchy color" on the subscene does? I cant see it used anywhere
how to enable entity preview in inspector? or its isn't in 0.2?
I havent seen it at least, maybe it only shows up when using live link? /shrug
https://i.imgur.com/eXzLnvf.png maybe this is it but it does nothing for me
anyone implemented a DOTS octree of any kind yet?
@languid stirrup octrees generally go against the thinking of the whole data-oriented thing
for accel structures, the unity physics does some things there
@vagrant surge yea i figured. ok these accel structures using unity physics, any exmaples or implementation?
implementation
there is also the boids sample that does a hash-grid
if you want to create one, a rule of thumb is "all nodes go into an array, and you connect them through indices"
if you feel like tryharding, look at how octrees are implemented for GPUs
as GPUs basically only undesrtand arrays
Are there any cons of using the lambda generating jobs?
@vagrant surge yea that i get, I always have flattened arrays anyways. Easier to play with them in interesting ways XD
thnx, i will look into it
so, anyone know when to use the [DeallocateOnJobCompletionAttribute]
error DCICE001: Entities.ForEach Lambda expression uses something from its outer class. This is not supported. Seeing this error indicates a bug in the dots compiler. We'd appreciate a bug report (About->Report a Problem). Thnx! <3
And now I'm confused because it gives me a clear error message about something I totally expected to not be supported, and then asks to report it as a compiler bug ๐ค
@languid stirrup you mean with the new ForEach or in general?
@worldly pulsar Are you captureing variables from outside the lambda? I was trying that last night but it wasnt working correctly
worse, I'm capturing system class fields ๐
in general. i just found out about that attribute tag, so wondering where i can use it @worldly pulsar
Native arrays I guess? yeah not sure about that, have only used the new syntax a little bit
DeallocateOnJobCompletionAttribute was used on native arrays on jobs, so they would auto call Dispose when job is done. Afaik ๐
@languid stirrup use it on native containers that are fields in a job struct, the container will be deallocated after the job completes
saves you a "jobVar.MyArray.Dispose()" call later ๐
ah, thnx, fields in the Job Struct. But will these be atleast be available a bit after the Completed() is called, or at Completed() poof, they are gone?
assume they are gone at Complete()
also, TempJob allocations are also automatically disposed after the job is done right?
Pretty sure TempJob have to be disposed manually (not 100% sure)
yes it does have to be disposed
Temp allocs don't care about Dispose
sure about that? I thought the alloc type was really just in what memory blob they ended up in and how much the system would monitor their lifetime
Well, I'm dropping Temp allocs on the floor and it never complained ๐
afaik Temp is just a linear allocator that gets reset at the end of frame
ok, more specifically, it's deallocated when returning from managed to native:
Scripting: Allocator.Temp memory in NativeContainer types is now automatically disposed of when returning from managed code back to native. Also enforced the restriction of passing Allocator.Temp memory to jobs, which enables the use of Allocator.Temp NativeContainer types in Burst compiled jobs
thanks! ๐ thats useful to know (for sure)
So, did you build from build settings?...
Assets->Create->Build->BuildSettings Classic
And build using the inspector on that asset
I'll look at that thank you
That create is greyed out
Not sure if I need to select something beforehand
click on any folder in the project window
Ah yes
btw, there is a nice example of what you can do with BuildSettings in the ECS Samples repo
Do I have to put just scenes or subscenes in there also?
I should probably check that out yeah
subscenes belong to a scene, so just the scene
Alrighty!
Unity now has a built-in way to specify the build directory without writing code, the future is here ๐
Not quite sure what you mean by that ^^'
Joachim recently commented on the forums that this new build pipeline will slowly take over the old ways, they are just developing it first with DOTS in mind
You can now add Build Output Directory in the BuildSettings, instead of selecting it every time you press build, or writing a custom build script
Ah alright yeah I see
yeah I didnt notice the giant + sign on the bottom of the inspector at first, to add new build modules
entities can have names now, show up in the entity inspector. Maybe that?
this is for job systems though?
interesting
its used to give the job a name it seems
ie the job created from the lambda
But I can't find that name anywhere
profiler?
* **`WithName(string)`** โ assigns the specified string as the name of the generated job class. Assigning a name is optional, but can help identify the function when debugging and profiling.
there ya go
np
Where is that docs from btw?
One unfortunate thing of the codegen magic is that you can't figure out what a piece of code does from looking at the source ๐ฆ
So I managed to setup the new build settings, but my scene is still not playing correctly.
My environment subscene displays only 1 GA out of 4, and seems out of place.
Could it be there is more to setup for a build?
Works fine in-editor
its from the Entities documentation, not sure its been published fully yet
i see
look in your packages folder
Library\PackageCache\com.unity.entities@0.2.0-preview.18\Documentation~
what I pasted is from entities_job_foreach.md
its not as handy as just reading it from the webpage though, but Im sure they'll push those out very soon
package was published very late on Friday, I guess the docs people had gone home for the weekend ๐
I'm not fan of the il patching magic tbh
They've done this in the past, il weaver for unet for example, it always ends up with a bunch of weirdness and code that cant be source code stepped (when debugging)
If they wanted to reduce the amount of boilerplate I don't see a better way to do it
Magic implicit shit always ends coming back and biting you in the ass
Every time
This is a lambda that's not a delegate but gets turned into a magic structure with an interface on it..
I'm sure that's never gonna confuse anyone lol
you can still write IJobChunk though. I think its nice to reduce boilerplate for simple and common cases
I'm mostly ok with ForEach() being essentially a compiler intrinsic... There are way more confusing things in dots already (like all the magic attributes, [ExcludeComponent], [DeallocateOnJobCompletion], [DisableAutoCreation] etc).
But are there performance cons for using the lambda generated jobs? Or are they equal to writing them explicitly?
They should be as fast as hand-written IJobChunks
except when compiling(at least for me)
@worn stag I totally expected the new live inspector to be there but haven't seen it anywhere yet
I hope it's not far away because we need it badly / using entity debugger is far from convenient
what is live inspector?
well, that's not what they call it but I mean this:
they showed this at Unite Copenhagen keynote
I was under impression that it would ship with the new dots packages
ye that would be nice
this probably needs changes to the unity editor itself that haven't landed yet
we'll know this for sure once the dots shooter project lands
I just tried simple subscene from ECS samples on both 2019.3b12 and 2020.1a14 and don't see anything obvious to enable that entity conversion option for the subscenes
except when compiling(at least for me)
@safe lintel you mean compiling takes noticably longer using ForEach?
Joachim said all what they showed will land on 2019.3 soon
Exciting updates including Data-Oriented Tech Stack (DOTS), Unity Simulation, Scriptable Render Pipelines, multiplayer services, our new 2D tools, and much m...
so I guess, soon(tm)
this is not it but did anyone actually try this? https://bintray.com/unity/unity/com.unity.dots.editor/
it's from september
# About com.unity.dots.editor
##DOTS Editor
This package provides data analysis and visualization tools that are built on top of the ECS architecture.```
it depends on the Entities 0.1
I wonder about the live link tho
they only covered changing materials or manipulating existing objects
which leads me to believe that you still can't import new meshes or textures live
Didn't someone say it basically re-compiled and sent a dll? That would imply potentially greater changes
they basically save the data serialized along with subscene I think
I dunno how they included materials in that tho
I'm instantiating approx. 20,000 entities from a prefab which is just a cube with a material, no physics shape / body authoring - and converted to an entity. But my FPS drops under 60FPS, the system with the biggest load seems to be RenderMeshSystemV2 , can anyone see what I might be missing or how I can better optimise this? Cheers
No I know
you have 23.000 drawcalls
i dont know
Do you have gpu instancing enabled in the prefabs material?
@twin raven Yeah :/
Can you post a screenshot of the inspector window of the material
what shader that was?
It's just this material causing issues..
This one is one I purchased from Unity Asset store
Yeah
๐ค Json...
Having troubles reading a string value into a NativeString struct
For the structure example: https://forum.unity.com/threads/json-to-struct-with-nativestring-preview18-0-2-0.782123/
I was assuming the added implicit would help the JsonUtility, but that seems not the case
@hollow sorrel yeah, feels slower compiling with the new ForEach
So does that mean ForEach is optimized like an an IJobChunk now?
Anyone having issues with the contents of a subscene disappearing as soon as you save+close the subscene? Then once I hit edit they show up again
How can I set the Collision Filter "Belongs To" and "Collides With" data at runtime when I instantiate an entity?
@civic bay I noticed not all shaders are able to use GPU instancing properly
For example if I use standard shader, GPU instancing works
But if I use mobile diffuse, the batches will skyrocket again. Even though GPU instancing is enabled and the only thing that changed was the shader
Yeah it did ๐
nice
Does the new update have any animation support?
no
Anyone using ECS with the new Input system?
yes but im still trying to wrap my head around it, current implementation is super simplistic
mine that is
Anyone using Component data outside of a system? Wondering how to update a Text field from a value in a component
Ideally Iโd like to convert a GO to an entity and then get back a reference to that entity in a monobehavior
Any examples appreciated
use entitymanager to query that data?
use IConvertGameObjectToEntity on your monobehaviour, and in Convert store the entity on your script. Then in update or wherever use get the entitymanager via World.DefaultGameObjectInjectionWorld.EntityManager and then use entitymanager from there
@rare umbra ```cs
public class GameManager : MonoBehaviour, IConvertGameObjectToEntity {
private Entity m_Entity;
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) {
m_Entity = entity;
}
public void Update() {
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
if (entityManager.HasComponent<MyData>(m_Entity)) {
var data = entityManager.GetComponentData<MyData>(m_Entity);
}
}
}
@safe lintel looks like the unity physics sample includes an ECS implementation of the new input system
It seems very complicated.
Great thanks @safe lintel
I really feel like the Unity samples are a mess.
are enums in compdatas supposed to show the enum name instead of the variable name in the debugger? for example: "AllPossibleStates" vs "CurrentState"
Many files which include authoring, components, systems, etc. all in 1 file
its not a big deal, just kinda odd
I dont think i ever noticed that @rare skiff , thanks for pointing that out
np
sup guys, anyone formed any meshes in dots?
Like, used the ecs systems to actually create them?
that was my plan this weekend lol
but boy I am spending a lot more time just wrapping my head around this
than I thought I would need
Hehe nice, good person to talk to then - im mostly interested in the thought about it rather than implementation
Its a completely new way of thinking.
You've heard of thinking outside the box?
Monobehaviour is the box. Ecs shreds the box and pees on it.
yep
But, with love. Very quickly calculated love hehehehe
Have you got any issues atm?
"Burst Compiler -> Premature Calculations for the cpu" :P
I have a lot of experience with Entitas but still just trying to figure out the API
Ah, i see, api is a pain, but ive gotten through most things now hehe
My own trouble is figuring out a way to create a sphere which can dissolve and subdivide at will, and unevenly.
three main resources; blood, sweat, and tears.
Well, not so much the blood hehehe
But yeah, its just odd bits here and there
I found it best to look at premade systems, starting with the simplest, and replicate them yourself from scratch.
I've actually gone as far as designing my own physics for it... Then they released unity.physics the damned helpful gits hehehe
In particular, the boids example shows how problems can be solved in ways you never expected, and it teaches you to think about the entities differently.
Have you created any systems yet?
I find generally picking something from the api and googling the method/property name works, and go from there. If needed, try it out and get your feedback recorded somewhere, test the output with debug.logs or something, to avoid that mysterious background numbers feel.
@me if you reply :)
Yeah @golden heron
I'm just starting with simple random cube spawner
Then adding more components
and more complexity
I'd go through all the examples, and just start by trying to get your head around whats going on first.
That includes the boids one.
The thing about ecs is you arent just rearranging memory and programming layout, you are also exposing your entities to types of data analysis and statistical composition that the usual monobehaviours just plain cant do.
The boids example is a beginning idea of this, and it uses a very basic implementation of swarm mechanics to keep the fish both together, and apart, and also avoiding the shark.
i still dont understand the boids example ๐
hehehe
well it uses the hashmap and the combined directions of the entities. It basically looks at the entities as a group simultaneously, using multiple jobs one after the other to achieve this, as of course each job pertains to only one entity at a time. So, they run through gather data, then they do their swarm calculations and then they return the data to the entities. All this is done by modifying data only component data, updating direction intention and so on, then the rest is simple movement systems.
Dont try to understand the math, just follow where the data goes and what it does.
the boids math is cool, but its irrelevant unless you have a swarm. What matters is how they manipulate data of entities as a group. That part is invaluable for any cohesive behaviour of a game world.
hmm boids system code example looks different from how I remember it
i think it used to be chunk iteration previously? not sure if this is more readable or not
oh joy, looks like probuilder meshes are messed up with dots again
What platforms does DOTS support?
i think its supposed to support all of them? burst is another question though. also they are targetting hdrp first, urp is on the backburner so that probably limits the platforms right off the bat
sidenote getting strange behaviour if static is enabled on a gameobject that is converted to an entity
Basically, all of them, but its still young hehe
its like the baby yoda, technically older than it looks and sometimes acts
So having experimented a bit with the new serialization package, anyone happen to know if I am using this wrong? I am getting a VAST difference of performance when serializing a json string with JsonUtility vs Serialization.DeserializeFromString
https://forum.unity.com/threads/json-to-struct-with-nativestring-preview18-0-2-0.782123/
Is there a performance impact when reading static variables inside * a system while having the IComponentData as an empty tag ?
( assuming in some cases the static vars will be changing during runtime )
plz tag me, if anyone knows, cheers
@hollow jolt can you provide an example of what you're trying to do?
runtime editable variables in the inspector
i was thinking to make a mono that will edit any changes values on update -- to the static class *
while the system will act on the component tag without the data
also the system job will read directly form the static class
dunno about static but what you can also do is use OnValidate() on the mono which runs when you change inspector data, and then setcomponentdata in there
then you wont have to run it every update either
yeah, definately check out the proxy classes in the entities hybrid source, they use that strategy.
\Unity.Entities.Hybrid\Components\ComponentDataProxyBase.cs
wouldn't that be too much changing 1000's component data at the same time ?
i guess ill try both methods ( static and onValidate )
would there be something like shared component data ?
dunno, if its just something you change in editor every once in a while to test i wouldnt worry tbh
true that
OnValidate looks like the proper ecs approach method ( when calling set component data, instead of unnecessary system modifications in the test code )
@mint iron so something like that ?
public class EditorComponentDataMono : ComponentDataProxy<ComponentData>
{
public float var1 = 0f;
public float var2 = 1f;
public float var3 = 2f;
}
where var1,var2 & var3 are also present in the ComponentData ?
hmmm, i havent used it directly tbqh, i just took the technique and implemented the OnValidate/Serialization hooks but for a scriptable object. The default proxies use it like this
public class TranslationProxy : ComponentDataProxy<Translation>
{
}
public class RotationProxy : ComponentDataProxy<Rotation>
{
protected override void ValidateSerializedData(ref Rotation serializedData)
{
serializedData.Value = math.normalizesafe(serializedData.Value);
}
}```
why is the 1st class don't override ?
( is that because it will auto serialize the base class data as well ... ? )
i suspect its because the base class parameter (Translation/Rotation) is stored as a private field marked with the property WrappedComponentData, then a custom drawer will display it Unity.Entities.Editor\PropertyDrawers\WrappedComponentDataDrawer.cs
would the TranslationProxy be needed to be added on top of the gameObject who is getting converted to entity ?
Where * did you implemented it if i may ask ...
https://gist.github.com/jeffvella/aee47c7199f061c01d9fca68a42b25f9#file-scriptableobjectproxy-cs-L52
bare in mind this is just me messing around with different ideas
woah that's a lot of material, thanks !
anyone else having trouble installing burst 1.2.0 ?
maybe it's not specific to burst
but i can't get it to install the package
maybe package manager causing issues
what does your package manager look like
every dependency needs a checkmark next to it
and if it doesn't then you'll prob have to add it manually in the package json
had to do that for properties 10
or serialization i forget
Is there a way to ScheduleSingle with new ForEach syntax?
I have a IJobParrelelFor and itโs scheduled as (100*100, 1000) and in every thread I check for a condition. If the condition is met in ANY of the threads I want a true after the job is completed(). I tried creating a bool and an int and setting bool to true or setting that int to 1 but when I check the job.conditionFlag after the completed() it returns false or 0......
@hollow sorrel checkmark is basically there to give you a visual clue that the package version installed is as new or newer than marked for that package dependency
only case when you'd see X there is if you've manually installed older package for some of the dependencies
and I guess it's also technically possible some other packge installed older dependency too, considering how fragile PM has been in past :p
ye
but all in all, the less amount of packages you install manually and just rely on the dependencies, easier it will be for you
oh right, you were replying to fholm
my bad ๐
@trail burrow you've hit the expand arrow on the Burst package versions?
they now hide more experimental versions by default if there's verified package
ah
"have you tried to turn off and on your computer"
still works
there used to be this "by design" thing about PM
I wonder if it still works the same way... basically PM's cache didn't update if you had it open/docked to your layout and you opened Unity
it's super dumb as it's a thing you'd expect to have there open on some background tab
but after I found it was root cause of my issues (around 2018), I just systematically taught myself to always open it only on demand and close it immediately after
most of my PM oddities went away after that
hmm.. has anyone experimented with this? seems to be a way to Burst compile a block of code within a lambda? :)
Job.WithName("AMainThreadJob").WithCode(() =>
{
for (int i = 0; i != myCapturedFloats.Length; i++)
myCapturedFloats[i] *= 2;
}).Run();```
That looks cool. Been working with DOTS for a year-ish now and suddenly I feel a bit lost again ๐ - like I was using AddComponentObject for managed components and later chunk.GetComponentObjects<type> - but the latter now requires a struct. There's now these 'hybrid components' but completely unsure if that's what I need to be using.. sigh
hybrid components are slow, and only supposed to be a temporary patch until everything is in "dots land" ๐ ie for things you cannot convert into component data.
And yes its all changing a lot
^ sounds like every big Entities api update
I hope it will start to stabilize soon! 1.0 is not that far off (or so we think!)
How would you move something like a https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequest.html to dots though?
not sure you need to? I cant see many cases where perf sensitive code would need to send web requests? and you also wouldn't need to reference a web request class from an entity?
it is possible though ofc ๐ SpatialOS changed their main SDK to use entities for all network calls
For my server I send a web request for each client , i.e. entity. Holding the Request and Operation in a managed component.
Hmm, I guess one* solution would be to have an ID to the request that exists in some managed code.
sure, if you dont need to process the request in dots land you can just have a ref to a managed array
@flat talon I'm 100% convinced that the API will still keep evolving a lot after 1.0
sure, but at that point they need to maintain and support the shipped APIs too
Unity rarely locks API tightly once the first stable gets out
Lol to the answer to "how do i do a web request in dots is?" is "not sure you need to?" ๐ lol
I know they want to move away from the explicit jobs and rely on the lambdas
ofc not fholm, its just a question of practicality ๐ currently there is more effort required in doing dots code
- overhead of doing simple things, like iterating over 1-2 items is most likely going to be slower than managed code
@mystic mountain you can just pin the web request handle, hold on to its IntPtr, and check it occasionally on the main thread
that lets you keep a reference to a web req on a component
pin?
eh... i dont have unity with ecs/dots installed (in this project right now), there's a utilty method deep down somere
UnsafeUtilty.PinObjectAndGetAddr
or some shit
Oh!
Appreciate thoughts on the following. GameObject with Camera component on. First constraint is no requirement to convert this gameobject to ECS land and to be left as-is. I want to create an entity with a ref (somehow) back to this camera MB. Let's say this entity has a 'CameraZoom' ICD and a system runs over those components and I want the system to be able to write values to the original Camera MB. This is a specific example but my use-case is any gameobject/components being left as-is.
Currently when I create the entity I do AddComponentObject(origCameraMB) and in my system chunk.GetComponentObjects(CameraType) then set values directly. This seems no longer viable (although god knows what this ArchetypeChunkComponentTypeDynamic is now).
It seems like I may be able to use AddHybridComponent when I first create the entity but I can't find anything on how you'd access the component later from a job.
been pondering building a fully deterministic 2.5D physics engine for ecs/dots
what is 2.5D in physics?
@dull copper 2D physics with verticality/heigh
~~Do I need to unpin it? ~~ Can I check the ptr in job, or how did you propose I would connect the two?~
@dull copper well 2D colliders with extruded colliders in height/depth, and allowing height/depth offset
it's a normal 2D physics engine also ofc
a multi layered 2D physics engine
@hollow jolt well, yes 2D physics with depth and thickness basically
it's pretty useful for a lot of 2D games, or semi-2d/top-down games like diablo style stuff, etc.
yep, or use 3d ?
@hollow jolt well the 3d engine isn't deterministic, nor is it predict/rollback, and 3d is waaay slower than 2d physics
if you want to simulate lots and lots of stuff in 2D, it's much faster to just do it in 2D, than lock an axis/rotation in 3D
didn't know that, i figured determinism comes along the ride on each added dimension
huh? there's no determinism in dots physics atm at all
yea but you can save any given point in time
or rather solve backwards ( if that's even possible )
like reversing the time var
how does that help determinism?
math wise reversing the time should work
So what would the advantages be of using PinGC compared to having a managed Component? (since I still need to go main thread to check the managed object) Or just that the managed component will be deprecated in future?
@mystic mountain none maybe, right they added managed component now a days... use that then
maybe it slows it down? idk
iirc i remember somebody did a box2d time rollback effect few years ago
@hollow jolt well, i'm not sure what you're on about... lol
i want to do full determinism, not play time backwards
oh as if you want to predict the simulation before it starts ?
like avoid chaos theory and all
?
no, i just want a deterministic physics engine for multiplayer, so i can do predict/rollback and lockstep games in dots lol ๐
sounds like you are making the next CSGO if you need that amount of precision
what
would it be 265 tick server O.o
It means same input => same output every time wherever
i don't even... ยฏ_(ใ)_/ยฏ
jk, speaking of multiplayer physics, why the current ecs-physics won't work ?
you could save the sate of any given time step
lol
and roll back if needed ...
it's still not deterministic lol
hmm... so you would need to predict something like a attack hit before it happens ?
that has nothing to do with determinism, that's an orthogonal problem to determinism itself
what do you mean by determinism ?
that the simulation can be seen as a pure function
and that the simulation always produces the same result
for the same start state and input
i.e. s' = f(s, i)
assuming the player input does not introduce chaos into the equation ?
not sure that i get it
ok, ill go read some about that
still getting compile errors after updating to 0.2.0
com.unity.entities@0.2.0-preview.18\Unity.Entities.CodeGen\EntitiesILPostProcessor.cs(36,40): error CS1061: 'ICompiledAssembly' does not contain a definition for 'Defines' and no accessible extension method 'Defines' accepting a first argument of type 'ICompiledAssembly' could be found (are you missing a using directive or an assembly reference?)
anyone able to help?
@trail burrow are you looking to implement lock stepping ?
via mlapi ?
what are you going to use ?
my own stuff
because... i don't want to use MLAPI
Yes I am, I build networking stacks for games for a living
can you recommend some learning material for networking ?
nope
there's none
well gaffer on games
and gambetta
and then the tribes paper
and a few GDC talks
but that's about it
so basically trial and error ?
yes
god damn ...
Lol
Here we go again...:=)
@hollow jolt some of us here do game networking for a living.
It's a nice community.
iirc unity had a multiplayer talk recently were they discussed many different implemented algorithms for this, is that relevant ?
relevant to what?
networking with unity & physics
And sometimes that (networking) has a super close relationship with data models (dots, for example)
sounds complex
how should i answer that lol, never seen the talk ยฏ_(ใ)_/ยฏ
what about coherence.io ?
i know the guys behind it, nice guys
@trail burrow I recently spent a lot of time investigating determinism. I didn't really find anything suitable off the shelf. If you have the budget Quantum does it, I've ended up keeping my own deterministic gamelogic running in a native plugin.
@glad grail I'm the inventor/lead behind Quantum btw ๐
oh, hi ๐ Nice job!
@glad grail how's that going? Are you guys waiting for an answer from us?
Just checked here. We answered you.
Hi Erick, I've been in touch and all looks great, but for a few reasons we're not really in a position to commit to Quantum for this project. If our situation was any different I would be trialing Quantum without a doubt.
I'll send you a PM
@tiny ore so 1K$US is the fixed price ?
For SDK access yes... That or you pay a (very good) developer to write something similar over 3 years..
sdk access only ? so that doesn't include hosting ?
That comes with 500 CCU hosting during development/beta testing games, etc
For live ops, your game can grow a LOT, right? So that's a separate agreement.
1K doesn't pay for a lot of servers if your game gets successful. You pay based on the number of concurrent players.
But anyway...
500 active at any given point in time or 500 in total ?
Send us an email. I should not "polute" this channel.
CCU (concurrent at the same time). You need a lot of players to reach that.
ok thanks
marcmcg Today at 9:42 AM
still getting compile errors after updating to 0.2.0
com.unity.entities@0.2.0-preview.18\Unity.Entities.CodeGen\EntitiesILPostProcessor.cs(36,40): error CS1061: 'ICompiledAssembly' does not contain a definition for 'Defines' and no accessible extension method 'Defines' accepting a first argument of type 'ICompiledAssembly' could be found (are you missing a using directive or an assembly reference?)
anyone able to help?
Fixed it by updating 2020 to the latest alpha (14)
@flat talon and others should read this super informative thread (they explain the Burst compilation inside lambda): https://forum.unity.com/threads/performance-overhead-of-dots-systems.751823/
Does the new entities package allow commadbuffer commands to be burst compiled ?
yes
InvalidOperationException: Burst failed to compile the function pointer Void AddComponentEntitiesBatchExecute(Unity.Entities.EntityComponentStore*, Unity.Collections.LowLevel.Unsafe.UnsafeList*, Int32)
Unity.Burst.BurstCompiler.Compile[T] (T delegateObj, System.Boolean isFunctionPointer) (at Library/PackageCache/com.unity.burst@1.2.0-preview.9/Runtime/BurstCompiler.cs:160)
@trail burrow I get this error
ยฏ_(ใ)_/ยฏ
๐ฆ
I have not seen a working example yet.. everyone keeps saying its working..
If I want to use an EntityQuery with the new JobComponentSystem's Entities.ForEach(), (equivalent to the Entities.With(query).Foreach() in ComponentSystem), Do I use WithStoreEntityQueryInField?
@deft niche are you using same dependencies as on the entities 0.2 package?
or do you have different collections etc package
ok got it to work.. had to delete the library folder..
Well.. everyone else was right.. commandbuffers do work in burst compiled jobs now ๐
Hmm updated to a14 today (along with all packages) and it looks like "Convert and Inject GameObject" has changed; a GameObject is no longer being created (so it's basically just Convert and Destroy)
{
for (int i = 0; i < randomNumbers.Length; i++)
{
randomNumbers[i] = randomGen.NextFloat();
}
}).Schedule(inputDeps);
Job.WithCode is new, right?
wasn't there before...any documentation anywhere on what it does exactly ?
generates a job apparently
@worldly pulsar thanks for that ๐
Silly workaround but it'll do for now
it's a silly bug
is Job.WithCode burstable?
yeah, I hope they hotfix it soon, it's annoying
considering this is really basic usage now
makes one wonder how it could even slip through
@gusty comet according to Lucas Meijer on the forums, Job.WithCode uses burst, yes
https://forum.unity.com/threads/performance-overhead-of-dots-systems.751823/#post-5209994
Both Entities.ForEach() and Job.WithCode() will by default use burst
(my first reaction being what the hell is Job.WithCode())
also wtf just happened on this thread ๐ https://forum.unity.com/threads/dots-netcode-copenhagen-updates.760112/page-2
people really are losing their cool
I totally expected superpig to step in ๐
but I guess he doesn't do dots subforums
Has anyone gotten similar issue to this? My default HDRP Lit shader is glowing bright pink!
No. It randomly happens. It'll render normally one day, then does this another day.
After updating to 0.20
search for "Empty scene with no light.. default cube, new project in: dots " on discord
(I don't know if there is a way to link to a post on discord? )
oh, pretty specific ok lol
I'd link you the post but don't know how ๐
right click the message and you should see message link option as last option
ok things are improving
"copy message link"
ArgumentException: Unknown Type:MasteryEffectComponent All ComponentType must be known at compile time. For generic components, each concrete type must be registered with [RegisterGenericComponentType].
Anyone got this error ?
Its not even a generic component ๐
The same code was working with previous versions..
So... apparently to see the "copy message link" option you need to have developer mode active
ah, that's possible
I sometimes feel like I'm getting too old for the intuitive, modern software (and I'm not even 30)
Is there a way to convince the new ForEach job generator to mark a captured NativeArray [ReadOnly]?
Cant you specify that component to be readonly in entity query itself ?
not component, NativeArray
Entities.ForEach((ref Thing thing) =>
{
thing.Value = readOnly[thing.Idx];
}).Run(); ```
interesting..never really needed to do that. But yeah.. don't think there is a way to do that..
Alright turns out its dx12 if someone else runs into that default bloom issue
oh, ok, there is Entites.WithReadOnly(readOnly).ForEach(...)
So I have a MonoBehavior running on a GameObject that is in a subscene - the component has it's own conversion definition. I'm finding that he monobehavior only runs when I actively have the subscene in the "Edit" state in the editor
monobehaviours dont exist when it gets converted to entity representation
which is what happens when you close it
@safe lintel hrm in that case I'm confused - I'm using the code you gave me yesterday. I guess I shouldn't be using it on a game object in that case?
using System.Collections.Generic;
using Unity.Entities;
using UnityEngine;
public class GameManager : MonoBehaviour, IConvertGameObjectToEntity {
private Entity m_Entity;
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) {
m_Entity = entity;
}
public void Update() {
Debug.Log("moooose" +m_Entity.ToString());
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Debug.Log(entityManager.Exists(m_Entity));
if (entityManager.HasComponent<WalletComponent>(m_Entity)) {
var data = entityManager.GetComponentData<WalletComponent>(m_Entity);
Debug.Log("moooose1");
}
}
}```
ignore my crazy log messages
Don't put it in a sub scene..
As far as I know.. things in sub scene will get converted to pure entities and monobehaviors won't exist
still stripping out the monobehavior - even if I use Convert and Inject
well anything in a subscene is treated as convertanddestroy
anything you want as inject dont put in a subscene
subscenes are just entities, no gameobjects
(you use a gameobject to author their conversion though)
@safe lintel did I hear something about Convert and Inject issues in 0.2.0? Because My GO is being destroyed now that itโs in the main scene and marked as convert and inject. Hrmm maybe thereโs a new compiler directive for this
this works great, thanks!
and the code that you gave me @safe lintel works a treat too
@rare umbra I added a line to the ConvertToEntity class
where it says toBeDestroyed.Add(convert.gameObject);
I added if(convert.ConversionMode == ConvertToEntity.Mode.ConvertAndDestroy) above it
it solves the issue for me withoiut needing to parent anything, but im not 100% sure if this is correct which is why i didnt post anything to the forums about it
I am just using GameObjectConversionUtility method at the Start() on the authoring scripts as an alternative till unity fixes converttoentity
@safe lintel nice fix! I did the parenting one from the forums and I named it something really obvious so I wonโt forget to check if this is fixed in a new version ๐
anyone know how to use the inputs for the Linear Blend Skinning node in ShaderGraph? i know that some things like UV can contain a bunch of Vector2s, kind of like a texture containing colors, but im not sure what contains a bunch of Vector3s to use with this node. im 82% sure it's a DOTS-specific thing which is why im asking here. i also can't find any documentation on it
Does anyone know what is the minimum version of unity that the new ecs package requires ?
Does 2019.3.0b8 work ?
i think 19.3b10
well maybe im misremembering things
it's b11 actually
but the new entities does need the new build stuff to work properly with subscenes
can confirm, 2019.3b11 is the min for new entities package
really wish unity would add some more buttons to the ui, getting ridiculous with all the buried menu items
don't get me started on the dropdowns
it's almost always the lazy programmer decision
so true ๐
At this point it could use a search bar
There is one though..
For the dropdown menus? Or do you mean the asset browser? I assumed we were talking about the long lists of different components you can create like this
If there has been one for this menu this entire time that will explain my blue name
Aw nuts, the animation package documentation is mostly a placeholder
@magic frigate https://docs.unity3d.com/Packages/com.unity.quicksearch@1.0/manual/index.html#search-providers lists Menu items also
you still need to install that quicksearch package manually for it to work
Sweet! Thanks for the info.
If the burst compiler strenghtens performance so much, what are the reasons to nรณt use it?
Not everything works, string manipulation (because strings are managed references) they break horrendously on burst sadly
Im hoping for some burstable equivalents on NativeStrings but the fact you can compare them now in Burst is great
@upper ingot Burst is only faster if it can vectorize the loops properly
If it can't, you're either sacrificing performance (it ends up slower than IL2CPP) or features (you can only use the limited HPC# subset of C#)
In some scenarios though you do get performance increases in code that you didnt necessarily change: ie looping over a queue to filter values out
I got a 10x speedup from just that alone
Which was fantastic
Yeah there's cases where you cant get perf improvements anyway due to how aware burst is of how the unity native collections, etc. work internally, etc.
But I've had many pieces of code which end up slower in burst than il2cpp
(yes tested in builds, not editor)
Do you have an example? (Not doubting, more curious) :)
specifically burst doesn't seem to do so well on integer math atm, the tests I've done on our fixed point library (all integer math), burst ends up about 5-10% slower than IL2CPP if it can't vectorize the operations
Mmm were you doing operators or math library?
I remember (VERY FAINTLY) that math was better off using the library in place of operators
Hand inlined integer math
But then there are cases where the intrisic talk was useful for this case scenario
@solar ridge I can dig up the code later, but it was part of our 2d physics engine i tried to burst compile to see how it handles what we do internally
It was not a very scientific test
Just burst compiling some of the narrow checks between different shapes
And see how they perform in burst vs il2cpp
Results were basically ~same speed or ~slightly slower
but again, no scientific method or anything used, just threw some code in and see how it ran
Ah no worries :)
It's all integer math, and loads of it
I've been scrambling around trying figure out what exactly is slowing down their new deserializer like crazy
No avail yet :/
So havent got to move over to bursting too much this update
Though Command buffers being burstable is nice now
yeah that's nice
Could two entities share a component? Or does that go against the design?
Trying to think of how you would go about implementing an input lock without adding any code to the input system
Thinking of using a data field on my input data component and accessing it via another entity/system altogether
Mmmm not ... exactly.. they could store a pointer , but I think at that point you need to reconsider the problem. What do you mean by "Input lock"?
Trying to think of it as mixins, sort of
So I would add an entity that uses the same input component as that used by my player
And a system that manages all those lock mechanics. As in prevents input
Oh! You could handle that a better way realistically. You'd have an input entity
And then everything you want being that youd just use the value of that entity
I'm just at the figuring things out stage, probably doing things very wrong ^^'
Locking would be as simple as not updating that entity
And to not updated it, would it use some "lock" bool on the related input component?
Enitity value*
I mean... you could do that, or some other conditional to not set the data
Purely up to you
Yeah, for sure
Though Command buffers being burstable is nice now
anyone know if it can it playback from a burst job yet?
Unsure
It seemed fast but....
I didnt check
I will later
Json deserializing was more important to get performant for me
By the way, speaking of input. Does this whole system make input delayed by one frame? If input is read and stored as data, there is no way to know if it will happen before or after the other systems which read this data
Well you could potentially be very specific with it. But 1 frame of delay is not a thing to really worry about
16ms is less than a human perception notice change
So it is not a matter of me missing something then, the current way of reading input through a dedicated system induces this 0 to 1 frame lag
Is there anything like an execution order for systems maybe? Edit (2018 link mentions it at least): https://forum.unity.com/threads/execution-order-of-systems.522666/
hmmm, I haven't actually tried to use burst on this rig before
Burst requires Visual Studio (installable via Add Component in the Unity Installer) & the C++ build tools for Visual Studio, along with the Windows 10 SDK in order to build a standalone player for Windows with X64_SSE4
joke is that I have VS2019, c++ toolchain and bunch of Win10 SDKs installed here
if I had to guess, it's seeking for some windows SDK that I don't have here tho
Same error trying to build an empty project that didn't use Burst a couple of weeks ago
burst docs aren't helping me either, because requirements are: Visual Studio (can be installed via Add Component in Unity Install), or C++ Build Tools for Visual Studio. Windows 10 SDK
Didn't find anything googling
burst clearly works in the editor
does it work for others here on latest entities and burst?
@slow epoch was that with latest burst still?
oh wait, you said it didn't even use it
I mean it was installed but never used
And yeah it was the latest version
Don't know if there are any updates tho
I'm only trying to package boids demo with IL2CPP backend here
I'll try with stock mono setup
Aaah so for builds I had to add it to the editor itself in the hub when I got that error. May not be your case but it was for me ๐
you mean install VS with unity installation?
Yeah :\
it could help as it's preconfigured for Unity's use
but it's silly that I'd have to redo the installation just because they can't list the requirements more specifically
that sounds like more trouble ๐
ok so, can't do mono build with burst either
I guess I'll go with the addcomponent thing then
thanks for the headsup
I tend to avoid letting 3rd party tools mess up with Visual Studio, hence installed it manually (I also use it outside Unity ecosystem)
I can't even count how many times my Visual Studio installation has gone sideways because of some random thing somewhere
especially if you uninstall older and then install newer, cmake etc scripts often still seek for the old installation
(even aften running microsofts own VS cleanup tool after uninstall)
well... adding the vs module didn't change a thing ๐
Riiip
wonder if their silent installer backed off once it figured it was installed already
there's probably some log file somewhere if one is able to find it
I might have read somewhere that you have to use the new build pipeline to successfully build burst stuff now? Haven't had a chance to look myself though.
hmmmm, I don't have the latest c++ toolchain installed tho... so it could be complaining about that, it's still toolchain meant for VS2019 but older version
mainly because ue4 engine builds break on the newest
Anyone have any clue what warnings such as Assembly for Assembly Definition File 'Packages/com.unity.rendering.hybrid/Unity.Rendering.Hybrid.Tests/Unity.Rendering.Hybrid.Tests.asmdef' will not be compiled, because it has no scripts associated with it. are about? I renamed some files, have no compilation errors but crash when enter play mode. If I delete my lib folder I get the above warning (amongst some others)
it really sounds like the hybrid.tests is just a shell folder with asmdef in it
technically you don't even need the hybrid tests at all yourself
it's hard to see what's going on exactly (long editor log to go through) but another line I notice is Symbol file LoadedFromMemory doesn't match image ..\Library\PackageCache\com.unity.ext.nunit@1.0.0\net35\unity-custom\nunit.framework.dll Native extension for WindowsStandalone target not found :/
well
on the bright side
2019.3 release is super close now, so they might really give the shooter sample with it
Not reproducible with: 2017.4.35f1, 2018.4.13f1, 2019.2.0b9, 2019.3.0a1, 2019.3.0f1, 2020.1.0a14
2019.3.0f1
it could be RC but still, not many weeks anymore
Speaking of releases.. anyone tried the animation package yet? Saw it was up on bintray at least.
oh right, it is there
probably way easier to get into it with the sample tho
to comment the previous thing a bit, I can't even do IL2CPP build with this now :/ I disabled burst compilation and IL2CPP just fails without giving proper error
all the past nightmares of trying to make VS play ball with tool x are coming back at me now ๐
solved it but wasn't all straight forward: had to uninstall VS, then uninstall Unity to be able to reinstall it with visual studio module (it wouldn't let me install it again otherwise), but this would first just flash the VS installer screen and not do anything... so what I had to do is I had to navigate to program files (x86) and manually wipe the remaining bits VS installed didn't manage to remove on it's own... and then when I let unity installer install VS it still failed to install the Win 10 SDK it relied with
fortunately this time around the console error message actually said which sdk was missing so went and installed it and then Unity built both burst + il2cpp
@violet garden late reply but you can use [UpdateAfter(systemtype)] and updatebefore on your system to make sure input has already been processed before your system runs
there shouldnt be a frame delay
@hollow sorrel Depends on how you do it, if you Add a component with input, it is present after the commandBuffer played back, so Adding input component to BeginSimulation/initialization/EndSimulation would make a frame delay.
@amber flicker cant get this one to compile ๐ฆ the previous version at least didnt give me compilation errors though I couldnt enter play mode without some errors
yea... guess it's not ready..
I'm using this to get an entity manager in the awake method of a monobehaviour "World.DefaultGameObjectInjectionWorld.EntityManager" and I'm getting a null reference exception after the update. Anyone have any ideas?
DefaultGameObjectInjectionWorld is returning null not just the EntityManager
might not exist during awake? im not too familiar with the order of systems creation and monobehaviours events but could you get the entity manager during convert instead of awake or start?
It doesn't have a convert it's a UI menu that needs to interact with the ECS. It worked fine in awake until the update.
I don't think it's a game object lifecycle problem, doesn't work in Start or Update either.
Seems like the automatic world creation/automatic system bootstrap isn't working for some reason.
Now I'm getting this error "Cannot find the field TypeInfos required for supporting TypeManager intrinsics in burst
at Unity.Entities.TypeManager.GetTypeInfo(int typeIndex"
@hollow sorrel Thanks!
Hi there, I'm decently new to creating games (and Unity), but I do have very good ground knowledge in programming as it is.
Is there anyone who has some slight experience with Tilemap, Tilemap Renderer and the API (Scripting) that comes with it?
I want to be able to get the following data for each tile in the grid:
Position, size etc (So I can use it for interaction, collision and placement in the world)
Sprite / Material (So I can render it)
Do keep in mind that I want this data so I can create Entity equivalents to use with (ECS / DOTS), so I want / need to do everything in code (I don't want to use Tileset Colliders etc)
Thanks in advance
With the new support for IComponentData classes, is there a way to store arrays in them? It seems the work only if the component is the last one added to an Entity, as I have described here: https://forum.unity.com/threads/arrays-are-not-supported-in-icomponentdata-class.783803/
SetEntityComponentData()
Doesn't exist in current context? Help anyone?
maybe you mean to use the EntityManager?
I'm trying to create an entity and set the component data
is there any method except to use EntityManager.SetComponentData ?
The tutorial I'm following is using SetEntityComponentData()
Let's see how we can Find the Closest Target in a Pure Unity ECS game. โ Get the Project files and Utilities at https://unitycodemonkey.com/video.php?v=t11uB...
also, what at what time?
2:55
oh SetEntityComponentData() is a method he made earlier
do you need to create a new command buffer for each job? or can you create one and use it for multiple jobs
1 per job. but if that job runs on multiple cores the ToConcurrent() struct interface will handle it fine.
thanks!
What are some common causes for editor crashes when using ECS? Trying to narrow down what I should do since the crash log I get basically means "we have no idea" according to Google
I'm thinking stack overflow but I got an error message when that happened before, not a total crash
I'd turn up the Jobs/ memory leak logging levels
that usually gets you closer
I have an event when an object collides with each other, But I am having a problem when I try to set the PhysicsVelocity Linear to reflect from the collision normal. It seems that it happens multiple times for each event. Does that mean the the object is still inside each other? Is there a way to fix this?
Alright thanks recursive
anyone gotten the livelink to work? ive tried building using the new build tools but i get an error if I modify anything in the subscene when the built player is working. just assuming its not ready for prime time unless someone else has gotten it to work?
every time I've tried to check out ECS Samples there are dozens of compile-time errors to wade through, is there a known working editor version + package version configuration anywhere?
to be specific Physics Samples is more important to me than ECS Samples right now but getting both working would be nice
@chrome pawn I have the UnityPhysicsSamples working on 2019.1.14f1
could you tell me the versions of your Entities, Physics, and Input packages?
all the latest available on that editor version?
latest entities requires 2019.3.0b11 or newer
I have Unity Physics Samples running on 2019.3b12 here but I've manually updated it's manifest to use latest:
-hybrid renderer (which also updates to latest entities)
-urp (older lwrp/urp don't work with latest hybrid + entities)
Each system has a property for the EntityManager ? Or do we need to manually access it using World.Active.EntityManager.
I'm able to do so without it, but just checking whether I'm doing it right
Each system has it
ok thanks
whoa...how do I get that ?
"com.unity.dots.editor": "0.1.0-preview.2",```