#archived-dots
1 messages Β· Page 100 of 1
again, not that many lines of code but it adds up when you do this for every file again
I was kinda bummed they didn't use Unity Physics on the Tiny Racing yet
i kinda like the tiny racing demo, its pretty well written
very good example of the simplicity of ecs
well, same thing would have been way simpler on monobehaviours still
but it's nice to have "minigame" examples
as it gives more ideas on how one can structure these things when getting into DOTS
that being said, I haven't checked that source code that closely, usually Unity examples tend to do silly things π
yeah but the monobehavior ones cant be copypastad liberally beetween projects XD
stuff like the 2 simple smoke systems can be copypasta-d as is
over the time ive been dealing with ecs, ive found its "copypasta" potential to be huge
there are systems ive been copypastaing from projct to project to project
btw, that tinyracing demo didn't work properly for me in the editor
havent ran it on editor yet, just browsed its code
like, it kinda did run but it didn't load all textures and it didn't clear instanced stuff like smoke puffs etc
i think with what it does you can create a tower defense fairly well
it has some nice spline follow logic that would work
@dull copper just fyi in case you were thinking this is the kind of thing they'd add
ah yes, so it exists already
IMO they should move that entry closer to creating new c# script on that menu
wow, it feels like it is almost 30 years ago
I could just replace ecs with oo and most of the conversations would still be the same π
@gusty comet the current ECS craze reminds me about the MVC craze of 2004-2006 in the web world
its just.... eh
@trail burrow yeah seriously, i worked on web application UX a little after that, MVC4 i think it was. But from Unity's point of view it makes perfect sense; if you want to re-write your engine its a great promise to get everybody excited about (and pay for/be happy about dealing with your code-debt)
@mint iron It just feels a little bit like the kool-aid drinking club at times
π
as for the Tiny Racing getting bee.exe flagged as malicious, here's a staff reply about that:
Also, we have updated the sampels projects, so just pull the latest changes and try to build again. ```
Just to make sure I am not being dumb, because Hybrid Renderer uses game objects, you still get the performance pitfall of creating/destroying gameobjects frequently, right? Or does have some type of pooling sytem
it only uses Camera/Lights etc in the form of gameobjects
the actual rendered objects are entities
creating/destroying them is really cheap
Ah okay
The term "hybrid renderer" is used because the renderer uses GameObjects, such as the camera and lights, to render ECS entities.
That line just confused me then
Thanks for the clarification
lol the sheer broken of the tiny racer demo
when running from editor
the smoke entities never get deleted
It's early access!
@vagrant surge yeah, that's what I meant earlier by smoke puffs not clearing at all and things not loading
anyone know what hybrid renderer uses to actually render? i hear it doesn't use graphics.drawmeshinstanced (but v1 used to), but not sure what other api it uses then
not getting any wiser from skimming through the package
ty π
is there a way to get ahold of the entitymanager from mono? I got a input struct with x and z float values that I want to set to get the player to move, although seems like the values are never set
World.DefaultGameObjectInjectionWorld.EntityManager? I believe that's what it might be called since World.Active is deprecated
Awesome thank you
Is it possible to have two ICustomBootstraps (without inheritance), and choose one to be the one that should run?
So I want to store a fixed array in my buffer elements rather than this: tier0level, tier1level, tier2level... Surely this is possible with unsafe arrays right? I was sure I had seen a snippet for this somewhere, but fail to find it now. Any pointers?
Keep the tier0Level, etc, and get the pointer of tier0Level to do indexing?
Or is it fine to have the element have a pointer to another buffer?
@vagrant surge wheres the tiny project now? do i need a specific version of unity? i'm on.. 2020.1 i think..
i didn't see it in the project manager
Could anyone explain what I'm doing wrong here? I'm trying to run two parallelfor jobs that modify the dynamic buffers from two separate entities, but for some reason the job system is saying I need to call Complete() on the first job when the second one tries to run:
protected override void OnCreate()
{
for (int i = 0; i < 2; ++i)
{
var e = EntityManager.CreateEntity(typeof(BufferTag));
EntityManager.SetName(e, $"Buffer {i}");
}
fillBufferJobs = new NativeList<JobHandle>(Allocator.Persistent);
uninitializedBufferQuery = GetEntityQuery(new EntityQueryDesc
{
All = new ComponentType[] { typeof(BufferTag) },
None = new ComponentType[] { typeof(IntBuffer) }
});
}
protected override JobHandle OnUpdate(JobHandle inputDeps)
{
var bufferEntities = uninitializedBufferQuery.ToEntityArray(Allocator.TempJob);
for (int i = 0; i < bufferEntities.Length; ++i)
{
var buffer = EntityManager.AddBuffer<IntBuffer>(bufferEntities[i]);
buffer.ResizeUninitialized(bufferSize);
}
fillBufferJobs.Clear();
for (int i = 0; i < bufferEntities.Length; ++i)
{
// InvalidOperationException: The previously scheduled job ArraysTest:FillArraysJob writes to the NativeArray FillArraysJob.buffer. You must call JobHandle.Complete() on the job ArraysTest:FillArraysJob, before you can write to the NativeArray safely.
var fillJob = new FillArraysJob
{
buffer = EntityManager.GetBuffer<IntBuffer>(bufferEntities[i]).Reinterpret<int>().AsNativeArray()
}.Schedule(bufferSize, 5, inputDeps);
fillBufferJobs.Add(fillJob);
}
inputDeps = JobHandle.CombineDependencies(fillBufferJobs);
bufferEntities.Dispose(inputDeps);
return inputDeps;
}
@stiff skiff thanks but after some thinking I think I'll just break it up so that I have category tier and level per element, and just 3x the elements. Will be so few per entity anyway
so this has existed for a few weeks, animation samples! https://github.com/Unity-Technologies/Unity.Animation.Samples
@remote coyote the syntax is fixed int stuff[3] in an unsafe struct
Ah URP is coming next for GPU based animations π
I wonder what additional apis would exist to get it working on a custom render pipeline
so happy to see them go for gpu skinning
Heya! I am fairly new to DOTS in general, can anyone help me on how to dispose of NativeHashMap after passing it to a Job in JobComponentSystem? [DeallocateOnJobCompletion] doesn't work with it and passing a NativeArray is either too slow or doesn't work with burstcompile because of iteration limitations. Thanks
Are you sure it doesn't work with [DeallocateOnJobCompletion]? As in, did you try, and what errors, if any, do you get?
Specifically I was getting errors about leaking arrays, which didn't happen with NativeArray, a quick google search confirmed that it indeed didn't work with NativeHashMap or NativeList
This is the thread that confirmed it
Although I will still need to pass hashmaps to jobs in the future, currently I am trying to solve passing of LocalToWorld from parent to child, so I can use world coordinates in the child entity, if anyone has an efficient way of handling this I would be glad to know
assuming you didnt allocate it with tempjob?
var deps = jobWithTheHashMap.Schedule(inputDeps);
hashmap.Dispose(deps); // This schedules a job whose only purpose is to deallocate the memory
handy
Bingo! Will test it now, thanks a lot!
just a note building a player with the new anim samples seems a bit broken, getting strange results with anything animated in the player
What is that used for ? @dull copper
visual scripting with dots?
I dunno if you still need something else to run that
haven't tried the new package
only some earlier prototypes
It seems to have errors on 2019.3.0f1..
I thought the visual scripting tool drop was given on the forums. https://forum.unity.com/threads/dots-visual-scripting-5th-experimental-drop.772520/
Getting super confused between that and this package .. π€
the drops on the forums are what Unity officially gives us for testing, should work on engine versions we got now, alho it's still in experimental stage
they are eventually moving to package distribution and while we get some packages now for these, it doesn't mean they are fully featured or that we even can run them π
but that's half the fun on experimenting with these early on
I do agree with that! π
I'm impressed with how readable the codegen is but it seems kinda rough for someone who doesn't understand DOTS to use as of now
It has great potential though
"Tracing by frame and by steps" wow that's gonna be like super useful
0.4.0 just dropped, anyone knows where to find the release notes?
## [0.4.0] - 2019-12-16
**This version requires Unity 2019.3.0f1+**
### New Features
* Two new methods added to the public API:
* `void EntityCommandBuffer.AddComponent<T>(EntityQuery entityQuery)`
* `void EntityCommandBuffer.RemoveComponent<T>(EntityQuery entityQuery)`
* BlobArray, BlobString & BlobPtr are not allowed to be copied by value since they carry offset pointers that aree relative to the location of the memory. This could easily result in programming mistakes. The compiler now prevents incorrect usage by enforcing any type attributed with [MayOnlyLiveInBlobStorage] to never be copied by value.
### Changes
* Deprecates `TypeManager.CreateTypeIndexForComponent` and it's other component type variants. Types can be dynamically added (in Editor builds) by instead passing the new unregistered types to `TypeManager.AddNewComponentTypes` instead.
* `RequireForUpdate(EntityQuery)` and `RequireSingletonForUpdate` on a system with `[AlwaysUpdate]` will now throw an exception instead of being ignored.
* ChangeVersionUtility.IncrementGlobalSystemVersion & ChangeVersionUtility.InitialGlobalSystemVersion is now internal. They were accidentally public previously.
* Entity inspector now shows entity names and allows to rename the selected entity
* Improved entity debugger UI
* Create WorldRenderBounds for prefabs and disabled entities with renderers during conversion, this make instantiation of those entities significantly faster.
* Reduced stack depth of System.Update / OnUpdate method (So it looks better in debugger)
* Assert when using EntityQuery from another world
* Using an EntityQuery created in one world on another world was resulting in memory corruption. We now detect it in the EntityManager API and throw an argument exception
* Structural changes now go through a bursted codepath and are significantly faster
* DynamicBuffer.Capacity is now settable
### Fixes
* Remove unnecessary & incorrect warning in DeclareReferencedPrefab when the referenced game object is a scene object
* GameObjects with ConvertAndInject won't get detached from a non-converted parent (fixes regression)
* Fixed a crash that could occur when destroying an entity with an empty LinkedEntityGroup.
* Updated performance package dependency to 1.3.2 which fixes an obsoletion warning
* The `EntityCommandBuffer` can be replayed repeatedly.
* Fixed exception in entity binary scene serialization when referencing a null UnityEngine.Object from a shared component
* Moving scripts between assemblies now triggers asset bundle rebuilds where necessary for live link
* Fixed LiveLink on Android
channel is quiet today so i figure the changelog spam is fine
Wow..finally the convertandinject is fixed..
Does that mean we can finally inject uGUI elements as entities? Or is there still another blocker?
* Structural changes now go through a bursted codepath and are significantly faster``` weeeeee
ah, the slightly stricter blob ref usage is nice
@worldly pulsar you can
Did it last night to start converting UGUI into its entities format version π
Ohhh looks like the DOTS multiplayer sample was just released?
https://github.com/Unity-Technologies/DOTSSample
wait a second! i see ComponentDataProxy useage! in Movable.cs lol
wait they're using rigidbodies for movement?
Is it possible for burst to access static data in ANY way?
yes, with SharedStatic or readonly managed arrays
is there any perf penalty related to it?
i think its fine if you set it up properly, it can just hit the pointer directly, ill dig up an example just a sec
unity sure has a good way of naming repos
"just look at the samples" now refers to like 5 things
so it was that package
as another thing: anyone got that dots sample running?
testlevel loads eventually for me but it's not rendering right
Forum post of the DOTS sample: https://forum.unity.com/threads/dots-sample.796308/
ah, the whitebox levels do run in the editor
(and render properly
the level they showcased at Unite runs ~45fps in the editor with lots of 20fps dips
(on Ryzen 3900x + RTX 2070s)
Did you try the editor settings from the readme?
turning leak detection off in the editor removes the framedrops and it then runs solid 50-52fps in the ediotr
there were settings there? π
I'm horrible at reading instructions
Also, it is worth turning off Leak detection
yeah, this was a big one
The most impactful is to disable editor attaching (the ability to attach a debugger to the editor). You can do that in Editor > Preferences > External Tools.
this carries over to other projects, right?
or are the editor preferences still per project?
No clue
disabling editor attaching wasn't most impactful for me tho
it goes from 52 fps to 56fps
That... still sounds pretty heavy? What's going on in the sample project?
yeah I dunno
it suddenly ran at 45 only again
restarted the editor, didn't change anything and it runs 90fps now
Anyone here that knows about this issue? Just downloaded the new entities package and keep getting these errors:
Library\PackageCache\com.unity.entities@0.4.0-preview.10\Unity.Scenes.Editor\LiveLink\LiveLinkBuildPipeline.cs(257,61): error CS0117: 'ContentBuildInterface' does not contain a definition for 'GetPlayerObjectIdentifiersInSerializedFile'
Library\PackageCache\com.unity.entities@0.4.0-preview.10\Unity.Scenes.Editor\LiveLink\LiveLinkBuildPipeline.cs(323,37): error CS1579: foreach statement cannot operate on variables of type '?' because '?' does not contain a public instance definition for 'GetEnumerator'
@gentle osprey if you have any other packages such as Collections in the package manager, don't forget to update them too
packages that were manually added in package manager don't automatically get updated even if they are a dependency
I see, thanks @hollow sorrel I'll give that a try :)
currently loading
lets see how broken it is
couse racer was really broken
atrocious performance
50 ms/frame
ooof
The question here is: Will Unity support this sample and improve/maintain it or are we just kind of getting it as is like other samples?
I remember them mentioning the added fps netcode pieces are going to become parts of the netcode package later?
I'm still not entirely aware as to why we need to have burst compile every time we hit play
Surely this can get saved for later... somehow?
I'm so hyped right now
Getting 55 fps on my i7 7700k... Time to check the graph
Performance isn't great in editor (even with all the safety checks turned off for burst/jobs), but still great to finally get access to the code.
Someone set up a server so we can test it out
performance improved after removing some of the checks and stuff
still 5 ms on client-only
on the game code btw, not renderer
thats.... very sad
ServerFixedUpdate goes at almost 3 ms
which is a massive rolflmao given there is literally only 1 character
Does it handle many characters at once well?
woof
the thin bots are headless full clients tho
but still
local client takes 12 ms
server tick takes 8 ms
code is also significantly harder to follow than the Tiny demo
i understand its beta and stuff, but being slower than UE4 ShooterGame is actually some true award
its really not easy to be slower than that
lets see how it improves over time
I'll never forget Ark: Survival Evolved for literally just building directly off of Shootergame.exe. That was funny when I noticed the process name
If it works, it works I guess
main difference is that those devs actually give a shit
ark devs dont
which is why they didnt even bother changing project name
I'm assuming those mentioned at least changed the project name lol* ah
those projects rename shootergame
so they rename all ShooterX, to WhateverX. like ShooterCharacter to WhateverCharacter
and then heavily modify it
honestly, stuff like pubg being on top of shootergame makes sense
it is a shooter
conan or ark really doesnt
but some teams have even "abstracted" and modularized shootergame
so they start a new project with only part of shootergame
they dont grab the weapon or chatacter stuff, but they do grab the online and menus and loading screen stuff
shootergame is designed to have savegames, achievements, friend lists, in all platforms. It also passes release QA on ALL consoles
I was honestly hoping I could shamelessly build off of this DOTS sample for my own stuff but now I'm not so sure
Their character movement controller does not handle edges that well so far
@magic frigate as for burst recompile, they said some months ago that they will cache that stuff but I don't think it's in yet
also as to what comes to DOTS sample perf, it's not great and Unity clearly knows this as they mentioned that on the readme even
A bit weird they'd release their biggest DOTS project, performance by default, and it doesn't have performance by default. But oh well π
Lots of stuff missing burst compilation I guess
Going to try out built game perf
Has anyone got a built game working? Looks like level_00 doesn't exist for creating a game and "connect" doesn't do anything on the main menu
getting same results as 0lento, ~17ms (no safety checks) with editor attaching, ~12ms without editor attaching
still not great but damn
never realized editor attaching could be so heavy
this sample seems extra unorganized, like prefabs and scripts everywhere, hard to get my bearings with whats what
maybe they did it on purpose to simulate average indie dev's project structure π
only thing missing is a bunch of asset store assets in the root folder
oh wait nope they checked that off too
Getting stuck on Calculate Custom Dependency Data here
You don't need the windows Il2cpp module for this, do you?
@vagrant surge doesnt that show the chunk utilization as a max of 4 per chunk?
ok thats heavy
if the max really is 4
that means the thing is like 16 / 4 kb ?
so somewhere around 3 kbs, giving some space to metadata
thats heavy for an entity
but im 100% sure that unreal engine Character is MUCH heavier
AActor alone is 1.5 kb
Yeah, even being really flippant with components it's pretty hard to be worse than crazy OOP god classes
yeah id assume a aaa game might have way more which is why i brought it up, what happenes when you exceed the chunk(i know you could split up your entities but still)?
you cant
errors out
btw, its not 16 kb, its a bit less, as those 16kb contain a bit of metadata
not much tho
versioning stuff?
yup
versioning stuff, plus things like pointer to its archetype, and the amount of entities its holding
Ah, my mistake with the build was going through the default ctrl+b
The buildsettings folder has the new build stuff
let me know if the character stuff looks correct in a build. i had issues trying to build the standalone animation samples https://forum.unity.com/threads/animation-samples-odd-build-behaviour.795129/
In non-livelink everything appears to be behaving correctly
currently have a server and a client exe joined
Getting 100 fps at 1440p with everything except Vsync on. Running a 2070 and an i7 7700k
Firing while leaving sprinting seems to have a "buildup" of a couple of shots that come out faster than intended
Non DOTS related but I'm impressed with their TAA. No ghosting that I can see
that sample levels are super easy on ghosting
UE4's TAA can handle that kind of geometry just fine as well
but throw in some more difficult things and that breaks super bad
like any TAA, put noisy textures and big contrast between materials
and it'll ghost super bad
Ideally a lot of this will be moved into a package (I hope)
the entity debugger doesn't even catch most relevant systems because they are manually updated.
i guess so too that they will be made into packages but it seems really disjointed right now
i didn't find any serversimulation groups which were used in the previous netcode sample
Is there a way to stop systems from running? I'm updating my entities packages and prior to this it seemed that most systems would run as needed, but now all the systems are running when I hit play.
If you don't do any RequireForUpdate() the system should update only when at least one of the EntityQuery it created matches anything. If you didn't create any queries in that system it should always run.
That is unless they've changed/broken something in 0.4
if you want to turn a system off, there is the Enabled property
I'm updating from an older version I think. I'm going through the "DOTS Training". Let's see, just creating any EntityQuery would fix this, you think?
I'm so glad you know what I'm talking about, since I'm stumbling over my words.
In general systems should only operate on entities, so if no queries match it means there is nothing to do
Ah, some of these jobs are using "RequireComponentTag" instead of queries, would that be it?
This one in particular is IJobForEachWithEntity
yup, the Schedule method takes a system to create a query
All the smart component iterating jobs create queries under the hood
Then...why are these running? Hmm.
Because there are entities matching the query?
I guess that has to be true, so the question becomes: why are there entities matching the query?
In the entities debugger the system is being run, but it says "no entity queries in system"
Wouldn't that mean that it shouldn't be running?
If you didn't create any queries in that system it should always run
I thought that scheduling the job implicitly creates the query.
I feel dumb, I'm sorry!
(No way to tell what's going wrong without the code, but I don't have time for debugging right now, sorry π )
Okay, I'll keep trying, thank you.
Huh. So just MAKING an EntityQuery, not even using it, fixes the problem, it seems.
That doesn't make much sense to me, but...okay.
Thanks for sharing @magic frigate, good to hear performance improves that much with export. I'll be using TPS Sample as a reference and not as a base though, just the organisation of the project alone is a bit meh. But lots of good code here to learn from.
Besides, so much is bound to change and improve on the DOTS Sample the next few months that it would probably be a pain to build on top of it regardless π
Btw @magic frigate, did you test with thin clients to see how it scales?
@left spindle you can also use Enable = false to stop a system from running, i just put it in create if i'm debugging or something
how to i setComponentData for a BlobAssetReference<T> field?
is it considered a shared component?
nevermind! its early.
Any idea how/if I can check if a NativeHashMap has been disposed? IsCreated returns true even after it has been disposed.
Anyone check out the dots sample?
In Unity DOTS Physics/Havok are you able to manually step/simulate the world like you can with PhysX using Physics.Simulate? I can't find any documentation online that explains how.
I didn't know you could do that, @winter veldt thanks!
@remote coyote no thin client tests yet. Can I use the built game client for that?
@ionic holly there's an example in the UnityPhysicsSamples project that uses manual stepping for projecting into the future
it's in Demos/6. Use Cases/ImmediateMode
steps a clone instead of the original physicsworld but maybe gives a starting point
I think so Megafunk, probably a console option to spawn them?
Interesting what Ante wrote on the forum. I had noticed they used Run over Schedule a lot... turns out they intentionally want the server to run on a single core for multi-instance per server machine / server cost.
interesting, but how does that factor into all the scheduling and stuff?
Are there any advantages or disadvantages to using controllers vs managers in the DOTS framework?
in other words, does the manager style lend itself to dots code structure?
What are "controllers" and "managers" in this context?
I mean a very basic distinction: controllers are monobehaviors that attatch to individual objects in order to run functions directly on their own object, whereas a manager approach would collect all objects of a certain kind and run the logic on them from the manager script
possibly i have a very primitive conception of the difference, but i have an even mroe primitive understanding of dots so far
although i plan to implement it soon, so im wondering about how i should style my code going forward
I guess the ECS systems are what you call managers
DOTS doesn't really use MonoBehaviours
that's kind of what i intuitively thought about it too... i don't use managers much or at all (not yet anyway) so it's all a bit confusing
im used to using mono's everywhere
there is no direct equivalent to MonoBehaviour in ecs
so how would collision triggers be handled? (for instance)
have a look at the physics samples in https://github.com/Unity-Technologies/EntityComponentSystemSamples
(I don't use physics in my ecs projects and don't remember how they do collision events)
ill take another look at the examples, thanks!
Still no debug.log in burst, right?
just added entities and havok to a 2020 project and im getting those 2 errors :
Library\PackageCache\com.unity.entities@0.4.0-preview.10\Unity.Scenes.Editor\LiveLink\LiveLinkBuildPipeline.cs(257,61): error CS0117: 'ContentBuildInterface' does not contain a definition for 'GetPlayerObjectIdentifiersInSerializedFile'
Library\PackageCache\com.unity.entities@0.4.0-preview.10\Unity.Scenes.Editor\LiveLink\LiveLinkBuildPipeline.cs(323,37): error CS1579: foreach statement cannot operate on variables of type '?' because '?' does not contain a public instance definition for 'GetEnumerator'
Looks like you have some versions mixed up. Not sure havok is updated to 0.4.0 entities yet.
Seems like the guys at Havok get entities packages the same time we do lol
havok has been quite broken all the time tho
even if you get it running, it might not work at all in the actual build
last time I checked, HDRP rendered one pixel color full screen when havok package was only installed (not even used)
@dull copper :(
thanks, will be waiting for next version
does burst support fixed layout now?
Have yall been playing with the FPS sample?
@stable fog you mean FPS Sample or DOTS Sample?
both tps and fps i think
I'm curious how good it is
Okey I have only dont data processing in ECS/DOTS, since like... forever
I know the way you render changed at some point
- what packages do i need
- what components do i need
to render something
right its the hybrid renderer
rendermeshcomponent or w/e it was called is gone right?
figured it out
lol topher, I was speaking in terms of design, readability, modability, etc.
@stable fog honestly... it's like 2/10 =/
the code is a mess, it's hardly readable or easy to understand
π¦
@trail burrow its still a total disaster
@vagrant surge the dots sample? yes
both dots sample (tps) and tiny sample are kinda broken in editor
disregard if it doesnt work/etc
tiny being extremelly broken, dots sample being somehow spectacularly slow
have you checked the code?
yes
it's... eh
noped out of there real fast
Tiny racer code is the opposite
its a folder of systems, one system per file, everything super simple
this is their 'prime' sample on how to use dots? like the pinacle of dots made by the people that made dots?
this is what they put out?
...
it's like..
looks like they reused a lot of the code of the FPS sample
what it looks to me
is prototype code
if you guys cant do better, how the fuck do you expect the users to do better
it looks similar to when im working on prototype stuff
and just doing stuff semi-randomly
without much regard
@digital scarab You can't argue that the code in the dots sample is good dude
nothing wrong with prototype-y code, but if its a sample people are supposed to use as base....
It's a mish-mash of copy pasted stuff from the fps sample
Full of comments about broken stuff, hacks, workarounds, etc.
Then it shouldn't be put out as a 'dots sample'
This is more like 'dots testbed we use internally'
which... fine, sure
Well, naming something 'dots sample' implies that it's a sample ... to see how things should be done (in dots) ?
is the aim here to demonstrate that Unity has a functional solution thats kinda still shit to work with but hunting for feedback?
Not trying to shame, honestly getting perspective
Look, don't get me wrong
the whole DOTS stack is cool
Idk, i suppose people (me included) just expected more, than a code dump of some internal test repo
its been exceedingly difficult to get into DOTS workflow
Because it was explained as a 'DOTS Sample' ? Nobody said 'DOTS Code dump of our internal test repo'
the best documentation is outside of Unity Technologies
No Project survives its first collision with a user
I'm not blaming you personally...
Yes the name is wrong, because it conveys something different than what this is.
Sure, that's great. I think people (me included) are fed up with the state of the engine over the past two years, there's too many bugs, too hard of a push on the marketing side in relation to DOTS while it's not ready for use, etc.
Just read this thread https://forum.unity.com/threads/2019-3-entered-the-final-stages-of-beta-testing.792882/
People in there sum up what i mean in longer posts than discord is suitable for
@digital scarab So over the previous 2 years, it hasn't been a supported part of the product? (i.e. classic system)
I get it's not your decision, you're a programmer. But literally anyone that have been in the tech industry for more than a year could tell that replacing: core engine loop, physics, rendering, input, networking, etc. all at once... isnt a good idea lol
Right now it's a mish-mash of preview packages where you have to balance the specific versions of each package on a razors edge to get something usable and somewhat crash free
if you want to use the new stuff
or you can use 'classic', and be left with bugs unfixed for 2+ years
Also how the last two unites were basically DOTS DOTS DOTS, and then people try to use it, and its not ready, just leaves a sour taste.
Yes we all know... preview/not done/etc.
But that's not what's being sold on stage at Unites
Again, not your fault.
It's just getting a bit... sigh... unity fucking up and releasing unstable shit again (that's the general 'feeling' i get, talking to a lot of our customers)
Because of old bugs unfixed and new stuff unstable, everything is buggy and unstable...
Yeah, hopefully π
A lot of people still prefer that way of building, because they don't need the perf that ECS gives. And can use Jobs/Burst for small subsections that need the perf.
I do love where ECS/DOTS is going, and it looks particularly great
but I've been waiting for it to be "done" for quite some time
I personally don't mind waiting, but this is a hobby for me
hiss
HEy Topher, maybe you can answer a question for me
no one else has been able to so far
@digital scarab Yeah maybe.. idk, I am just not convinced that this DOD-focused ECS that unity has is actually proven to work for large complex games with a lot of intricate game logic, etc.
I'm working with people on jobifying the navigation baking system for Risk of Rain 2, (Disclaimer: Ghor/Hopoo know what we are doing and are even trying to get some code to us in a way that doesn't put them in a legally difficult situation)
The Jobified system is faster, but I want to try to burst compile it
While we can hook in most code through Harmony and load plenty of custom code for mods, It isn't clear to me if it would be possible with Burst
it seems like Burst requires I build a player and include extra libraries
Correct you can not load burst code from outside atm
:*(
I guess I'll just have to convince them to add the custom code to the game from their side :p
I'm building a deterministic 2d physics engine for ecs over christmas , little side project
you used to be on afternet didn't you
@digital scarab I basically only do deterministic stuff now a days, just no other way to sync as much stuff as we push into our own ECS either over the network
Want to try to build an RTS inside of ECS basically, figured i'd start with the physics engine and flow field navigation over holidays
ive done more prototypes using my own self-built unity style ECS than unity own ECS XD
ill now check it out as Tiny lets me do some basic pure stuff
@digital scarab not if you split the entities accordingly
for an RTS i would have the "visual" unit as a separated entitity
@digital scarab one of the drawbacks of archetype ECSes, i'm partial to sparse set ECS myself... but maybe that's cos its what we use π
@trail burrow entt style?
@vagrant surge yes
@digital scarab also i'd probably not do all the state chnages as components, but probably flags on components, etc.
not put each state in one component
how? as a enum-component type thing?
for my own C++ ecs i was thinking a compressed enum like that, with option to allocate maybe 3 bits per entity
i mean again, i literally built our own ecs (sparse set style) and our own job system, so i'm as knee deep as unity is on this dod/threading thing
and then its holding a bitfield
so don't get me wrong
I am hopeful for the future... just the current state of Unity is... EXHAUSTING
so there was something I found a little confusing about ecs
for something like character AI, the idea is to add a component for a behavior and then a system initiates that behavor, so you'd add a "Seek target" component, then the system runs and when it finds a target it removes the component and adds an "attack target" component?
and so really you're adding/remove components constantly?
Okay cool, I thought that was the intent and It really rubbed me the wrong way
there is nothing wrong with having a structure for your AI graph in another format
in unity model, adding/removing components is relatively expensive + fragmentation. But on the other side then matching on those is crazy efficient
and then have a component which links your entity with a specific AI graph
oh yeah that for sure
i see on forums
and its unsolvable
blame Code Monkey for that
people seem to think everything has to be made into an entity<>component
yeah thats a big mistake
One of the examples he uses is to break up the world space by applying a position component which puts the Entities into a grid set
i think thats something that the data-oriented book explains very well
so you can query Grid(1,1) to get all entities in it and check for them
not everything goes into tables, and not all tables are the same. You select the one best for your approach
@vagrant surge god i have such mixed feelings about that book lol
which saves on queries
@trail burrow how so? i really like it
but then people take it to the nth
even if its a bit too extreme, but thats the fun part
i have read it... and the guy is just so heavy handed in his OOP bashing, etc.
yes if OOP = gameobject/monob type architecture
then yes OOP = bad-ish generally
but that's... well
@stable fog thats not a good idea
causes too much fragmentation
you might want to do that for stuff like zones
or BIG tiles
in those case, sure
hey, talk to the Code Monkey guy, not me :p
but the "query by vector" is better done in good ol multi-hashmap
All I want to do is use Jobs for a parametric modeling system I've made
the fact that I wont be able to use burst for my first actual implementation makes me a bit sad
are they the pointery kind, or the flat kind
@vagrant surge ehm idk if there's a 'pattern'
it's their own multi threaded concurrent hashmap
its good because it's concurrent, it's slow as shit if you want to use it single threaded
or well i havent checked that in a few months to maybe it changed
yeah, but that multithreaded one, how is it implemented?
@digital scarab is there any goal to make that situation I'm dealing with possible?
@stable fog they were talking about some DOTS based mesh api for 2020
that got just released
you looked into that?
sorry not talking about my parametric stuff
talking about adding in some burst compilable code into an already built game
Its probably exceedingly unlikely
and really, its kinda irrelevant
@digital scarab Hey... is there a way to have a concurrent list ? I know there didnt used to be (had to do it by hand with an oversize array + interlocks)
Has anything been added recently that can fulfil that job? basically concurrent list
@trail burrow im not him, but i implemented my own for my ecs experiments by abusing the way chunks are executed
yeah i know the trick you can do with IJobChunk
and the start indices, etc.
but it doesnt help me in this case
i have a N:M relationship here
my problem was to copy data from ECS into a flat array, 1 unit per entity. I then allocated an array with the sizes from the chunks, and atomically added +N where n is entities inside chunk when copying...
N entities need to output M things each, into separate collections
uhm... siht
what about doing multiple jobs
and each has its own array
so you create 4 jobs (for 4 cores), and each one has one array
N entities, they each create 1-M things, which all go into 1-M collections
yes, thats an option but the work i need to do to create these 1-M things is reasonably heavy
so redoing it on each job
isn't a good solution
i'll just use interlocked
4 data structures
burst supports that right?
i dunno
just need Interlocked.Increment atomic
yeah but thats slow
in fact, some guy with a 32 core threadripper ran my big ecs simulation
i have a 32 core TR π
and the system that did the copy-into-array that interlocked once per chunk
so adding +200 or so at a time to the array
and it bottlenecked hard
interlocking becomes expensive when you have 32 cores competing for the same location yes lol
32 cores and was slower than running on 8
i've ran into the same issue in several places in our own stuff
memory sharing is a bitch
now luckily, most of the gamers still use 4 core CPUs, so can still get away with interlock :p
and dont have to get too clever
i was thinking of doing that whole multi-array thing on my simulation
its for boids. I create a list with morton-ids of each entity, and then use binary search there for acceleration
i tested that for another thing, on my 4 core / 8 thread 6700k the interlock wins, on my thread ripper the multi-array-copy-join-together wins
atomics in the threadripper probably are crzy slow
given the separated dies
btw, is your threadripper the old one, or new one
yes
this guy tested on one of the new ones
ah
even in those the interlocked was slow
tho im not so sure how much was the interlocking, vs the cores all copying memory to the same locations
Β―_(γ)_/Β―
i kind of just left it where it was because interlocks is fast enough for all target devices
wait isn't native stream supposed to do this
oh right... i dont have access to the whole buffer at once then
sigh
hmm how do i get the current worker thread count
from the job system
i know you can now a days
@digital scarab but you can change the thread count
somehow
means you should be able to read it?
i mean i'll just use int ThreadCount { get { return System.Environment.ProcessorCount; } } for now
oh
π ah, sorry!
my mind already moved on π
@digital scarab perfect, thanks
@digital scarab If you are around...
Why am i getting really high values
for the thread index ?
[NativeSetThreadIndex]
int ThreadIndex;
i'll get like 66, 64, 65, etc.
which is higher than my thread count (32)
so this how it always worked apparently
well this fucks me
Currently Unity Physics doesn't support motors on hinge joints like PhysX. Anyone know if this might be supported in the future, or how I might be able to achieve the same result?
what do you mean motors on hinge joints?
Are you familiar how motors worked in PhysX?
nope
On a hinge joint you could enable a motor, give it a force and a target velocity, and the physics engine would perform the calculations needed to keep the joint at that velocity with the given force
So setting the targetVelocity to 0 would lock it in position with resistance
ah interesting
Right now i have a hinge joint connecting a parent object to a child, but when the parent object has motion, the child object moves because it starts to be pulled behind it
I basically need my child object to stay in the same orientation regardless of how the parent object is moving
A fixed joint will do that, but i need the child object to be moveable via code when I want it to
This all has to be done with proper physics so that collisions behave as expected
i would say pester them on the dots physics forum, get your voice heard π
I will try, but I'd also like to know if the behavior I'm after is achievable in a different way
this appeared on Unity's youtube channel: https://www.youtube.com/watch?v=a9AUXNFBWt4
In this workshop style video we walk through an example project created by Unity Evangelist Mike Geig on how to script a Pong style game using Unity's Data Oriented Tech Stack (DOTS) including the Entity Component System (ECS). This video covers the latest syntax in Unity 201...
But is it as efficient as the original Pong game? π
Just kidding, I hope they show it running collision/movement on 40000 pong balls
the original pong game was hard wired wasn't it
good lord i have the weirdest error. in build mode the collider of one of my enemy disappears but not on every build. it's a coin flip if it works. shit's crazy -.-
that's with default physics collider. anyone else had that kind of instability?
turns out my rigidbody is pushing some enemies through the floor in a build. this is so weird it's not happening in the editor
Does compiling burst to Linux require you to be on linux? Swear it was fine just before, switch to 2019.2.15f and suddenly it's saying clang is missing from /usr/home/clang
Can compile to windows just not linux
@dire frigate not currently, no
upcoming Burst 1.3 will have cross-platform compilation for some platforms (including Linux)
Worked just fine before, ticked all the right boxes with 2019 Visual Studio and were able to compile to linux π€·ββοΈ Doing so now resolves to an error saying:
BuildFailedException: Burst compiler (1.1.2) failed running
stdout:
Burst requires gcc/clang toolchains to be correctly installed in order to build a standalone player for Linux with X64_SSE4
Unable to find /usr/bin/clang or /usr/bin/gcc, is the gcc/clang toolchain installed?
stderr:
Was able to compile my headless server and just upload it to linux via ftp
yes, but did you actually have burst compilation enabled then?
you can do crossplatform builds for mono
On assets yes, I don't use it myself currently in the project
but not for burst or il2cpp
Question about generics. If I want to have e.g. CDFE<T> bob where T : IComponentData, let's say I make a concrete class where T is Unity.Transforms.Translation. I can't access bob[entity].Value as IComponentData doesn't specify Value. Am I right in thinking this is just a no-go? Obviously wouldn't want to have to add an additional custom component that wraps each one and wouldn't want to use reflection at runtime.
there's a way to register closed generic types... let me look it up real quick
systems with closed generics have to be manually setup, they won't be auto-registered. You can circumvent this by subclassing them with a concrete type:
public class MySystem : MyGenericSystem<Translation> { ... }
@amber flicker In the concrete class you should be able to access bob[entity].Value if T is known to be Translation
in the generic class you obviously can't because you don't know what T is
Thanks both. I guess Iβll continue to rely heavily on code generation π
I unsafe stream usable for many readers/writers at once?
Or one reader/writer ?
A deterministic data streaming supporting parallel reading and parallel writing. Allows you to write different types or arrays into a single stream.
This doesnt specify if its a single producer/consumer, or multi producers/consumers
What to do about this stuff with the jobs schedulr?
This is in BUILD, With all safety off.
And it just will not utilize all workers
And the scheduling seems way off
crickets
@magic frigate no
ugh. Really struggling to pick up dots. Not even sure if what I'm trying to do is possible.
I'm streaming topography and map data into my scene. I make some GET requests to get the data, parse it, then manually build meshes based on some rules for the buildings and roads. For the topography, I'm creating terrains in code, calculating and setting their heighmaps on the fly. All of this is happening in chunks. IE player goes to a new area, the requests/parsing/building are made only for the chunks that are missing.
Now currently, since everything is on the main thread, every time data needs to be downloaded or parsed, the game freezes. I'd like to offload as much of the chunk logic to other threads as possible. No ECS is being used at the moment for any of this.
Anyone have any insights into what if anything I would gain by trying to use DOTS for some of this? And in general, how would you structure things? Maybe I should just use native c# jobs?
I've been reading docs and looking at various resources/examples/etc but shits just too confusing still.
For example, I don't think I need to convert my player to use ECS in any way. But I do need to get the information on the players position, so I know what chunks to load. Not entirely sure how to do that. If I make a component that contains the players position data, how would I update the data as the player moves around?
For loading in the terrain, I have a regular c# class to make a HTTP request for the data (would love for it to be threaded), then a service class to convert it to a heightmap (again would love if this was threaded), then finally a monobehaviour that instantiates an empty game object, adds a terrain component, sets the heighmap. How would that workflow look like with ECS? What are the individual components/systems that I would split it into? Really struggling to wrap my head around it.
Have you measured which parts are actually taking the time? I'm willing to bet that figuring out which chunks to show and sending the http request are a non issue and can easly stay on the main thread.
Conversion to heightmap definately (and probably pretty easly) can be jobified, depending on the source data format. That is assuming you can't just send heightmap data ready-to-use from the server.
Can't really give much more advice without knowing the actual data/timings you are working with
@serene thistle Have you tried downloading in a coroutine and yielding?
The http request takes a few seconds to complete. Downloads can be anywhere between 5 and 20mb, and so will take longer on slower connections.
Server is not mine, so I have to do all conversions on my end. Besides the download, this is what takes the most time. There are a lot more conversions for buildings/roads, but I want to start with the terrain heightmap, for simplicity.
Each terrain chunk takes about 0.2 of a second. Building/Road information takes about 0.5 of a second. I tend to have to load in 2 chunks at a time with my current draw distance, but I'd like to increase that and load in something like 10 at a time. So the 1 or 2 second stutter is noticeable right now, it will be worse if I try to do what I really want.
Coroutines still happen on the main thread. Yielding might make it less noticeable for the user, but it slows down all my calculations, as its just interrupting things, instead of doing them concurrently.
Wait, you are blocking the main thread while waiting for the http request to complete?
You definately want the downloads to be async, jobs are not really a good answer here
Would jobs not have it executing on a separate thread?
Thing is, I cache the data. And the download is often larger than any particular chunk. So for most chunks, they grab it from the cache. Only when they can't find it, is when a download triggers.
downloading stuff has very little cpu overhead, it's mostly waiting for the network that makes it slow
So how would that work? Try to get data, trigger an async download and then check every once in a while if the data is there? I'd have to track what's already in the process of being downloaded :/
You can do multthreaded downloads without the job systhem but i do not see areasone against (am not profissiond egnoth in jobs)
and with the restrictions on jobified code, making a job that runs an http request is really hard
I see. OK so work on async downloading. Gotcha.
But that was always a secondary concern. The data crunching from the raw download to the format I need is what I really wanted to jobify anyway
if your download is something like xml DOTS won't help you much right now
I've assumed you control the data you send
but parsing json/xml is also really annoying right now
Terrain is a binary file, buildings/roads are xml.
is there a way to jobify xml parsing without writing your own parser now?
i did basically same thing as you a couple years ago minus heightmaps and used a seperate thread (regular C#) for parsing, jobs didn't exist back then tho
and mesh creation used a lot of unity api's so i used coroutines for that, but i think they made a lot of that thread safe now too
Is xml parsing annoying because string isn't a bittable type?
Oh yea, offloading the whole thing to another C# thread and only doing the heightmap assign totally makes sense
for the http part there's multiple ways but using UnityWebRequest + coroutines is imo easiest
@serene thistle that's one reason, another is that any off the shelf xml parser you'll find is not compatible with the job system
what's why I said DOTS won't help you much
ah yea true
Im just using the c# library to read it. I wrote the actual parsing myself.
umm where do you draw the line between "read it" and parsing? π
because to jobify it you'd have to operate on raw strings (as NativeArray<byte>)
and that's not fun
Ah shit. Yeah
So in your case I'd use WebRequest to start async download, when that's done grab a thread from the ThreadPool to parse it, prepare the heightmap etc, and when that's done on the main thread assign the heightmap to the terrain. I don't see much benefit in pushing dots in there
i agree with the above
btw is there any reason why RenderMesh could be not chunking properly? it's creating a seperate chunk for each entity even though .GetHashCode() is exactly identical
Thanks guys, I'll give it a go and let you know the results π
No clue, I just accepted that shared components don't do what I want them to and avoid like fire :P
I really hope at some point they'll provide a different component/mechanism for rendering
hmm it seems to happen when i add my built mesh
but the mesh is the same ref for every instance, i only make it once
and yea i agree
at least for low-count/unique entities that only show up once in your game
i think games tend to have a lot of those
but they still take up an entire 16kb chunk
when starting the game I have 271 entities in 98 chunks, and the vast majority of those are 1 entity per chunk
sounds about right
Lol, I have a chunk with 33 entities that only have transforms (husks of GameObjects I use as reference points and just read their position at conversion time), never queried
and then a bunch of texts in the same chunk because i store the text meshes somewhere else
I mean it's 1.5 MB of mostly wasted space, so it's in the who-cares range
and if you scale up to 10k entities you probably have a lot of duplicate meshes
yea true
Is there a way that I could schedule a generic job, basically IJobParallelFor myJob = new MyJob() {...};
and then do myJob.Schedule(...);
Schedule<T>() requires a non-nullable type T, so I would assume no?
Actually I think I figured it out, I used IJobParallelForExtensions.Schedule<MyJob>(myJob, ...)
@chilly bobcat it needs to know the static type of the job
To be able to copy the memory needed to native side
@chilly bobcat If you know the type of MyJob why are you boxing it into an IJobParallelFor?
because I want to be able to create a density grid in many ways
one would be a ProceduralTerrainDensityJob
other maybe HeightmapDensityJob
they create the same thing with different outcomes, but in different ways
idk if that makes sense
but you said IJobParallelForExtensions.Schedule<MyJob>(myJob, ...) works for you, and you specify MyJob there
yes that was just an example
this is a quick hack, but I'll just create a few if statements with different Job types
The job system must know the concrete and fully qualified type of the job when its being scheduled
Heyo! So I have this performance problem when I write to a NativeArray of a struct (in a loop so it writes all 8420 of the elements) , and this costs about 100ΞΌ seconds to do, and this is the most expensive part of the operation it seems like, is there a way to avoid this? I don't actually need the whole whole struct changed, just 1-2 values of it changed, should I not use structs and just use separate arrays for separate values? or is there a way to change just one variable of a struct while it being stored in an array? so is there like a way to get the memory index of it and write there?
Hey I'm trying to build the megacity demo for android but as soon as I switch platforms I get a bunch of errors and warnings essentially stating that nothing will render
@surreal grail depends on how big the struct is ofc, its just a memcpy essentially
@surreal grail and yes you an do that, you can get the pointer to the internal elements and work over that instead
@trail burrow okay, thank you! :)
Did unity specify anything about all their current physics components if they're gonna be using their own physics solution or are they gonna be relying on physx still?
Wondering of the non dots component are ever gonna become multithreaded
Or utilized in a multithreaded environment
@dire frigate physx already is multi-threaded
So I am manually constructing a bunch of meshes and instantiating game objects with those meshes. And unity doesn't like it when I do like 20k for 4-5 update loops in a row. Like it freezes for a few seconds. I'd like it to be smoother. Am I understanding correctly that DOTS can solve this problem for me?
More so want to interact with the character controller via dots π
Was hoping that they would just change the underlying system to theirs so that there's a dots character controller
Whereas creating your own kinematic one is quite some work to do
There is a dots character controller, they use it in the Dots Sample
Could you link it? Would love to dive into it
Thank you Sark π
Oh that's quite nice, not nearly as bloated as the other examples awesome
@serene thistle I believe yes, burst compiler in itself is huge for performance, I tested it a bit, the performance gain can be 2x up to the 100x-s or even thousands, depends on the situation. Btw if you don't want to use DOTS for everything, you can store GameObjects in Lists and enable them when they are needed (basically an ObjectPool)
@surreal grail that just isn't true, enabling/disabling burst is not going to increase performance 100x or 1000x fold
at best burst will give you linear scaling with how wide your SIMD registers are
@surreal grail my issue is that all the game objects are unique and created on the fly. Pooling won't really help
@serene thistle DOTS is very bad at dealing with high amounts of unique objects atm (in terms of meshes or components on them etc)
The best you could do is combine the meshes. If that's not possible your best bet is to spread the spawning over time I think
Combining is possible to an extent. Will try that. Thanks!
@serene thistle if you are doing unique meshes, DOTS will atm allocate 16kb per entity per unique mesh
You can work with nativearrays in jobs so you can do all your work in another thread. Try to do whatever you can off the main thread until you need to call Mesh.SetWhatever
so for ur case it'd be 16kb x 20k
when i say its not good for drawing a lot of unique meshes
i mean... REALLY not good
lol
All the other code is already off the main thread. It's literally the instantiations.
Then yeah I don't think dots is any help at all really. Like FHolm said the hybrid renderer is shit for any kind of instanced data atm
0 for 2 on "can DOTS solve this problem I have?" for me π Thanks guys
Mesh combining should make a huge difference though if you're stuck with gameobjects
gonna have to actually be smart
@zenith wyvern the rendering situation and shared component shit
really was not though thru properly
It sounds like they're working on it at least
@serene thistle what are you actually trying to do btw? why do you need so many unique meshes?
Loading in real world buildings from map data π Think shitty google earth in your unity scene
You'd think buildings are just boxes. Turns out, very few of them are actually boxes.
lol π
nice out of context quote π
sounds like something from the hitchhikers guide to the galaxy
π I try
A+ quote
@serene thistle hmm and what if you used some kind of LOD system where far away buildings are just part of a heightmap? or is that not an option in your situation?
Does not even come up. I'm loading the data in chunks, each chunk is 256m^2. That area usually contains anywhere between 0 and ~2000 buildings. Each wall for a building is constructed separately, a building will have a minimum of 4. As the player moves around, I may need to load in 4-8 chunks at a time. Hence several tens of thousands of instantiations.
As per your suggestion, the first easy thing I can try is combining the building to be a single mesh. That will cut down the number significantly
after that, we'll see π
@surreal grail if you're curious what it looks like: https://www.reddit.com/r/Unity3D/comments/eapwnw/been_working_on_and_off_for_a_year_on_this_side/
@serene thistle it might be cheaper to build a large mesh on a background thread which you update as things come in/out, that can be done using jobs/burst
i.e. focus on the mesh data, not the objectgs
But I want each building to be separate π¦ My grand plan has procedurally generated interiors!
Is it possible to check if an entity has a component while executing a job?
use componentdatafromentity
there's a function Exists() which should allow you to check if said entity has componentdata if its outside the bounds of your query
Ah, that's what I thought thanks @coarse turtle
@serene thistle you can still generate interiors separately procedurally if everything else is combined
How will I identify individual buildings if everything is a single thing?
can't you use Objects or Structs to store them?
or like how do you know if a thing is a building?
collission triggers probably... which don't give a shit about the mesh. Ok gotcha π
groan now I'll have to implement mesh chunking too, cause of the vertex limit. Damn you and your ideas
I was just about to say to be careful with the mesh vertex limit π
should be pretty simple to implement tho π
@serene thistle unity supports large vertex indices from 2019.1 i think
32bit indices that is
eh... vertex buffers sorry
i cant type, its late
that should be enough. If I don't increase the size of my chunks π Thanks @trail burrow !
yeah I'll google it
i forgot, but it should be there
@prisma anchor if it's in the hot path and you use an IJobChunk you can also do a check on the chunk level rather than per entity (using chunk.Has(someComponentType)) but what Psuong said is usually best & easiest
@amber flicker , thanks for the info
Has anyone upgraded to 0.4.0-preview 10? I'm trying to update the soon to be obsolete code, and having issues with the BlobAssetStore. If pass null to GameObjectConversionSettings.FromWorld it returns ArgumentException, if I pass new BlobAssetStore I receive A Native Collection has not been disposed, resulting in a memory leak
@trail burrow i honestly do not get the shared component for meshes
it just seems horrible
im writing my own engine, and that kind of thing just seems incredibly stupid to me
like... in a normal scene, a huge amount of the meshes wont be repeated 100 times
which is what it would take to fill a chunk
yeah i dont get it
now, if you had both? that would make more sense. If you have a mesh only a couple times, then instead of shared component, its a normal component
and keep the shared stuff for modular meshes or instanced meshes repeated a ton oftimes
its definitely extremelly biased towards Megacity
where there are a few meshes repeated a million times
With the hybrid renderer what is the least-painful way to change material properties at runtime without changing the serialized material?
I want to do the equivalent of renderMesh.material.SetFloat(propId, 12); but without it writing the change to disk. Like what .material vs .sharedMaterial did in MeshRenderer.
prob copy the material and set the copy
Yeah, I hoped to avoid writing the bookkeeping (tracking which material is a copy and which isn't), there doesn't seem to be an obvious way to check that
yea fair
you prob shouldn't write to the material itself tho
the other way is using materialpropertyblocks
Library\PackageCache\com.unity.entities@0.4.0-preview.10\Unity.Entities\Types\TypeManager.cs(431,13): error: Cannot find the field TypeInfos required for supporting TypeManager intrinsics in burst
Something changed?
oh, right, I forgot about that
@compact hound that usually pops up if you're missing other package updates
oh and i think entities 0.4 is missing a dependency on Collections
so might need to add that manually
do you have properties 0.10.3
i dont see such package
are you on at 2019.3.0f1 or higher?
2019.3.0f3
Updated all the packages, deleted Library, restarted Unity?
@hollow sorrel Another thing I forgot is that the MaterialPropertyAttribute is HDRP only -.-
Whatever, I'll just Graphics.DrawMesh this thing
whaaat is it really?
yeah, 3rd post on the forum
oh damn
I also feel like they're missing a case or two here -.-
namespace Unity.Rendering
{
public enum MaterialPropertyFormat
{
Float = 0,
Float4 = 1,
Float4x4 = 2
}
}```
that sucks
i feel like materialproperties are one of the things pretty much any game that uses custom shaders are gonna need
hell even without custom shaders you still wanna change color sometimes so even then
weird it's still not implemented yet
i went back to classic gameobject + meshrenderer after i couldn't get my RenderMesh to chunk yesterday (even tho GetHashCode() returned same value)
One of the main reason I use ecs is I'm tired of pooling gameobjects
yea same but the alternatives are writing own renderer or using someone elses (lots of examples ppl made right now) but with the risk that it won't be updated at some point
or hybrid renderer which will prob keep being updated but seems to lack a lot of features right now
I'm lucky on that part, the cases that cause me trouble are one-offs (that material will be on one object), so I can just Graphics.DrawMesh
@worldly pulsar delete library and restart didn't help
@compact hound do all things under 'dependencies' when you select Entities have a checkmark
Anything differs from what you see in PackageManager?
(ignore the packages prefixed JPL)
I'm on 2019.3.0f1
mhm i had to remove burst to see its update
hi, there is some problems on new entities package and burst compiler, i can not create entity and its not support by burst compiler.
@worldly pulsar i had to manualy set packages versions in manifest because package manager didnt see them
Yeah, Package Manager is not very good at package managering
what is this error: Cannot find the field TypeInfos required for supporting TypeManager intrinsics in burst
default world not works by burst
read the last ~20 messages
im on lastest 2020, your solve is burst 1.2?
@compact hound how you fixed typeinfos
@radiant sentinel make sure you have all packages up to date. Especialy burst. Probably you need to manualy set theirs version in /Packages/manifest.json file
@compact hound to 1.2? i can see 1.12 at my Pmanager. when i update to 1.2, new errors appear
can you send me this page?
and my new errors
its something in your code
@compact hound same errors when i turning off burst compiler
my create entity code
Mby burst is missing some dependencies?
maths? no, its ok and lastest version@compact hound
i have presentation. i should fix it or degrade to oldest π«
sorry cant help you :<
Anyone else seeing a ton of editor crashes with Domain Reloading disabled since 0.4?
Tried out the GettingStarted Cube sample from https://docs.unity3d.com/Packages/com.unity.netcode@0.0/manual/getting-started.html
Works pretty well, except the client side prediction.
Afaik the process is like this:
- Client sends inputs to the server with a prediction of the tick (called predictiontick) the server will have when receiving the inputs.
- The client will perform (simulates) the inputs right away.
- Inputs also receive at server -> Server performs (simulates) the inputs also
- server sends snapshot of results (i.e. translation) to the client
I am not sure what exactly happens at step 5.
I often hear the results are rolled back and eventually are corrected? What does that really mean?
Rolled back = take the snapshot from the server?
Corrected = client will apply all inputs again from rollback state?
When i set the recv/send delay to over 100ms then the cube has also a very jittery movement. I think the prediction here is not correct.
Anyone also has made these observerations?
Have a look at the Overwatch GDC talk, especially the second half where they talk about networking. The idea here is the same.
Already watched that great talk! But i still dont understand how the rollback + correction exactly works π¦
I don't have the code in front of me right now, sry π
No problem, did anyone have the same behaviour as mentioned above:
"When i set the recv/send delay to over 100ms then the cube has also a very jittery movement or jumps back and forth."
@gusty comet there are 2 simulations running, imagine one as server, far behind and the client. the server runs every input and simulation once onTick. the client on the other hand is further in the future than the server. when a new snapshot in step 5 is received, the client is already, let's us say 15 ticks (whatever ticks, dependent on ping) ahead so the client resets back to the old snapshot from the past and resimulates all further 15 inputs known to the client. this in tandem keeps the magic alive that you're playing a game that just moves forward in time when it's in truth going back and forth multiple times per frame.
that is for predicted entities, interpolated are really just that, interpolated with no real logic other than defined states from the server. usually, position, rotation, animation state,etc...
personally i'm not sure why anyone would use interpolated entities when you can predict them. maybe someone else can answer that
https://github.com/Unity-Technologies/multiplayer/blob/master/sampleproject/Assets/Samples/Asteroids/Mixed/Systems/SteeringSystem.cs this is one implementation that runs once on server and multiple times on the client
the asteroids sample is the best sample to study
Thanks for the nice explanation.
How does unity know which systems to run to resimulate the last (15) inputs?
Or does it just run all systems in the ghostpredictionsystemgroup?
exactly
is creates a server system and client system
the framework behind it is pretty cool i think. huge improvement over the last one where it was more complicated to write them. you had to make 2 different systems before which essentially do the same with some boilerplate code around it and now it's just one, that is called a mixed system in the asteroids sample
in the asteroids sample there are just 2 mixed systems. one for player movment and one for bullets. asteroids are interpolated i think
everything which is controlled by the server is handled with interpolation i think (because no info how to predict available on client)
right, i'm not sure if there are any bandwidth improvements when predicted instead of interpolated. in the case of the asteroids, they could be easily simulated on the client as it's just a velocity but maybe predicting should be kept to a minimum because it means a lot of computation.
and simulating 1k asteroids 15 times per tick makes no sense
guess i answered my own question what's the benefit of interpolation ^^
i am still struggling that my cube is moving back and forth when i apply higher send/recv delays > 200ms (should move slowly in one direction). Without prediction (only interpolation or no server interaction) the cube moves slowly in the correct direction.
When i log the PredictionTick of client (green) and server (purple) it seems that the server tick is way higher than the client tick.
The opposite should be the case, shouldn't it?
@viral sonnet did you also have these issues?
I also log the deltaTimes which both run at 16ms in the ghostpredictiongroup
hm, one problem is that logging to debug destroys timings. for accurate results you have to log to memory and write them to disk later.
the prediction system should run multiple times from latest snapshotTick to current prediction tick
why does it run mutiple times? (i also see this in the logs, so you are correct) But why is it the case?
Shouldn't it be sufficent to run it once for each tick from snapshottick to curren t prediction
So for example
Client: Tick 10
Client: Received Snapshot from Tick 5
--> Run prediction system from tick 5,6,7,8,9,10 again?
like that
k i will investigate when the predictionsystem is called/and how often
the call is in the netcode package GhostPredictionSystemGroup.cs line 107
for (uint i = oldestAppliedTick + 1; i != targetTick+1; ++i)
thanks was searching for this peace of code π
np, this is the only place where you know how many ticks it's predicting per frame. the prediction systems itself don't really know about it as even the time is manipulated before the prediction systems are updated
ok i understand. Do you know if there is a max count of iterations which can be simulated? because when i have a delay off 500ms, this means 32 ticks of 16ms
depends, i don't think there's a safety for it and it can break when prediction takes too long, at least i had it in the previous version. never tested it in the new one. there's a term for this behaviour in network games but i don't remember. some kind of death spiral ^^
@viral sonnet @gusty comet at some point it will death spiral, but since you usually just predict your character and a few more things, that's usually several seconds.
ok c# parallelFor is faster than job and slower than burstJob. is it true?
but why?
are you doing everything under one job? you should post your code.
there's not really a way to answer that without seeing what you're doing. The amount of thread overhead could be a huge contributing factor, Parallel.ForEach pools and will use as few threads as it assumes possible, which might be more efficient than the current job implementation.
have you checked the amount of threads its creating for all 3?
and you didn't show Len, so I don't know how many times these are planned to be ran.
Len is 1M
SampleCountsLimit is 1000
i should present job is faster but i have negative results. what can i do to show them faster?π«
@civic glen What about ECS? is it help jobs to run faster?
InvalidOperationException: Burst failed to compile the given delegate: Void InstantiateEntitiesExecute(Unity.Entities.EntityComponentStore*, Unity.Entities.Entity*, Unity.Entities.Entity*, Int32)
Hmm anyone have this issue where if you tried to convert entities - you would get a burst error about trying to compile the delegate? - this should be entities - 0.4.0 preview 10
Hmm - actually...it might be my own conversion system π€
Anyone got this with 2019.3 and entities 0.4.0:
Something went wrong while Post Processing the assembly (Assembly-CSharp-Editor-firstpass.dll) :
Failed to resolve System.Collections.Generic.Stack`1
Any idea how to solve this one?
Can anyone help me on this one on the day before xmas? π https://forum.unity.com/threads/pass-job-handle-dependencies-between-system-groups.799029/
You have to make the jobhandles public and use them in the dependent systems.
For such systems i usually add a property FinalJobHandle which contains all the jobhandles from the system. Other systems can use this one as dependency.
yeah I noticed the FinalJobHandle pattern
tbh I don't like it, it should be something that the group should be aware of, not the single JobComponentSystem inside
with this poor design, I am forced to promote one JobSystem to the FinalHandle holder and get it from inside other system to update it
easy to forget
You can put the handle on the whole group if you want
true, still I have to do a GetSystem from inside each system used in the group right?
I mean the systems in the group shouldn't be aware of the group where they belong to
umm, they have to be aware of it, putting the [UpdateInGroup] attribute on a system is the only way to get it in there
I don't even use it, as I don't use the default world and I create the system manually
oh
such a design will force me to tie the system to that group
which is fine, but it's dirty
I mean I am sure 100% of the time is fine, but still not conceptually right
Anyway I am getting this error:
InvalidOperationException: The previously scheduled job ExportPhysicsWorld:ExportDynamicBodiesJob writes to the NativeArray ExportDynamicBodiesJob.Data.PositionType. You are trying to schedule a new job CopyPhysicStatesFromUECSToSveltoSyncEngine:Test, which reads from the same NativeArray (via Test.Iterator). To guarantee safety, you must include ExportPhysicsWorld:ExportDynamicBodiesJob as a dependency of the newly scheduled job.
so I did this in my CopyPhysicStatesFromUECSToSveltoSyncEngine:Test:
{
_group = GetEntityQuery(typeof(Translation), typeof(Rotation), typeof(PhysicsVelocity), typeof(SveltoEGID),
typeof(SveltoGroupID));
_world = World.GetExistingSystem<ExportPhysicsWorld>();
}
_group.SetFilter(new SveltoGroupID(_groupID));
inputDeps = test.Run(_group, JobHandle.CombineDependencies(inputDeps, _world.FinalJobHandle));```
but the error doesn't go away
a better design would be that the the group gets the handle from the previous one, like it happens between jobcomponentsystems inside a single group
(or at least I guess this what happens as the inputdeps must come from somewhere)
the inputdeps are not from the previous system
(unless you define the new SIMPLE_DEPENDENCIES or whatever that symbol was called)
do you mind to explain how they are generated? m_JobDependencyForReadingSystems is hard to read
the dependency system figures out the dependencies based on the components you read/write
ah right, that's the automatic part I guess
so once jobs that do not use IJobForEach are introduced in the system, the automatism is gone
on the error you're getting I've got nothing, sorry :/
jobs that don't use IJobForEach can't read components
yes what I meant is that once they are used I am forced to start using solutions like FinalJobhandle
(although the error above is about components)
see what happens if you do _world.FinalJobHandle.Complete() before running your job
OK
(I know very little about Unity.Physics but I don't think you'll get many responses here over the next few days π )
haha this is my last day of work anyway π
but I am sure on the boxing day I will do something
yes with Complete the error is gone
well I don't know what to expect anymore
tbh I am more stressed out by the fact that the simple code this jobsystem is running doesn't work. However if I run exactly the same code inside a ComponentSystem it works
(I am using Run() to debug it in fact)
I hoped fixing the errors from the JobDebugger that I didn't notice would fix it
but it's still not working
it must be a timing issue
but I can't understand how since it's all on the mainthread
tbh this looks like a bug in the Run() method :P
I literally never used Run() with the second arg specified
I removed it and it's the same
if you have one minute: https://hastebin.com/bomagiyega.cpp
The ComponentSystem version works as it should, The JobComponentSystem version doesn't
with or without the second parameter (I now put the job complete too)
I mean there shouldn't be any difference, both should be exactly the same thing
and when I say exactly the same thing, I mean also executed at the same moment
with the same order
but one works the other doesn't
I'm setting the LocalToWorld of an entity to move it around. I want to use the new Unity Physics package. Adding a Physics Shape & Body is now preventing me from manipulating an entity by setting the LocalToWorld - how do I work around that?
@scarlet inlet can you show the version with FinalHandle used?
@gusty comet you can move things only changing velocity
otherwise you need to use kinematic bodies
even setting the body to kinematic doesn't let me change its position
{
if (entitiesDB.TryQueryNativeMappedEntities<RigidBodyEntityStruct>(_groupID, out var simulationMapper) &&
simulationMapper.Length > 0)
{
var test = new Test(simulationMapper, _groupID);
_group.SetFilter(new SveltoGroupID(_groupID));
_world.FinalJobHandle.Complete();
inputDeps.Complete();
inputDeps = test.Run(_group);
var dispose = new DisposeJob(simulationMapper);
dispose.Run();
}
return inputDeps;
}```
write to Translation/Rotation to move anything that has physics body
not to LocalToWorld
@scarlet inlet and that version doesn't work either?
nope
@worldly pulsar thanks