#archived-dots
1 messages ยท Page 99 of 1
same here, seems to be all main thread
btw i like how hierarchy view in profiler lets you select threads now
in .3
is there some stress test? I remember vaguely reading somewhere that they added one
@hollow sorrel the scrollbar on the right side doesnt work for me in f1 lol
I use middle mouse click to pan around in case that's useful @trail burrow
can confirm around 2ms total in build
It's been broken for a while now ๐
works for me
For 30 2d asteroids?
oh thought you meant middle mouse click haha
@tiny ore yes
@amber flicker but thanks for the middle mouse, didnt know that
finally i can see what the other 28 threads are doing
๐
well I assume there's a base cost to having all these systems running... would like to see how much it changes when you had thousands of asteroids
scrollbar is apparently gonna be fixed in f2
I see 0.95ms for the Server world and 0.7ms for Client
That's better Rett
let's see what changing asteroids from 200 to 20000 looks like ๐
Curious...
~half of that seems to not be netcode related (at least in server world). Physics, Transform, Spawners etc
Sรณ any game at 30hz will have excellent performance
building 20k right now ๐
Not exactly great... where are all the threads..
@amber flicker the same takes like 4x as long for me tho so
what do you get for single core mhz?
~4.5ghz
haha just thought I'd check.. my old i5 is 3.9
Ok.. slightly odd.. I have a tonnnne of other crap open on my machine but it looks like it is being somewhat distributed across cores? Would be interested if anyone else with a cleaner setup could check
this is on 20k asteroids, Dev Build
looks like most of the increase is in physics
wow that looks much more as expected
they dont use physics ?
maybe it is an f1 thing
actually.. no, I see something similar if I pick a better fraame
huh
nvm the physics comment I saw "0.01ms" for ExportPhysicsWorld and read as 1ms -.-
are you guys doing something different? am testing with just raising numAsteroids and i'm getting way different timings
~5ms for 20k
~9ms for 200k
idk what it's doing
still 30% CPU
@hollow sorrel think they are profiling builds... i cant
i'm going 2mil ๐ - @hollow sorrel yea I'm doing the same - but as builds, not in-editor
i'm still profiling in editor
oh actually i mistyped so it looks like I'm building 200k first.. probably sensible
200k before it crashed
how many clients do you guys have in Multiplayer > PlayMode Tools from top bar
1
About 6ms for 200k in a build for me I think
More important would be 1k with 100 clients
oof
Because for netcode we need to measure how the serialization and packing are performing
Build ran for like 3s with 2M entities, then crashed ๐
haha
Over several connectiins
It is something where dots can really work well
I'm hopeful....:)
But cautious, lol
getting this also
randomly when its running with 200k
where it literally just stalls t he whole computer
every core peaks at 100%
so how do you build server/client separately?
use the unityclient/unityserver defines
Ah, no use for quick profiling probably anyway because I'd have to write the "connect to localhost" code first
no it will do that auotmatically
check GameMain.cs
well i'm done with this for now
dinner time eh
yea - might be worth filing on forums that your cpu performs much worse.. or file a bug report or something
generally with burst stuff has it been good?
no it wasnt doing that before
oic
when connecting standalone clients
to server
th server is doing this
with just 200 asteroids
๐ฆ im giving up
lets just agree that the netcode isnt ready lol ๐
yup.. nice trip.. back to reality
something in editor is fucking you up
@hollow sorrel yes noticed that too, that was an editor spike
not the game itself
7 clients... 10% cpu each for receving a few asteroid over the network
Grr, is there a way to specify a define outside of PlayerSettings (and without writing a full build script)? Because if you define UNITY_SERVER for the whole project then some code in UNITY_EDITOR complains about missing symbols, and doesn't let you even start the build
I'm trying to build the server, and the defines are not setup properly
No way to add defines via the new BuildSetting thing either. Ok, that's my patience threshold crossed ๐
Does anyone know how to delay a custom bootstrap world creation until a specific scene is loaded?
Pretty sure you can't, and the idea is you shouldn't have to
I want to wait until my loading scene is finished before the world initializes
What's in your custom bootstrap that can't happen before the loading scene is done?
I mean, all my systems run in the main menu, they just do nothing because there are no entities that match their queries
It's trying to access assets that aren't loaded yet in the OnCreate methods of systems.
I was using #define UNITY_DISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP and not running DefaultWorldInitialization.Initialize("Default World", false); until the other scene is loaded. But that doesn't seem to work anymore.
I always looked at custom bootstrap as a way to get your systems/system group structure the way you want + exclude systems that are not supposed to run. I never touched assets in it.
I just don't want systems to start running until my assets are loaded.
I don't know your specific situation but the first thing that comes to mind is to have an AssetsReference component spawned when the assets are loaded, and have all the systems that need those assets query/RequireForUpdate that
(I just have an AssetsReference with some materials in it in a subscene, so they are available as soon as the subscene is loaded, but never really needed to have systems wait for specific assets to load)
anyone else getting poor performance with Hybrid Renderer 0.3 (versus 0.2)?
nothing on the GPU end. the CPU is the problem in my case
Do you have Burst enabled?
now i do ๐คฆโโ๏ธ thanks, that fixed it ๐
forgot to turn it back on after fixing some bugs
Can I use components to create a dictionary? E.g without ECS if I wanted to build a database of strings Iโd just use an array with a key. In ECS is it advisable, or bad practice to create an entity for each entry with a component that has a key and value? Feels a bit overkill tbh
My instinct is saying that thereโs a better way
Why would you want to build a Dictionary with components to begin with?
I would assume the data would be more nicely allocated in memory?
Define "more nicely"
Stored in a way that gives faster reads than a standard dictionary
@rare umbra afaik components can not hold strings right now
Unless I am misunderstanding your intention
Yeah strings was just an example
Do you plan to iterate over all your strings often? Because there is no way to store things in memory that gives faster reads in general
also dictonaries are costly to iterate through. Thats why the whole ECS stuff are arrays of arrays
iirc dictonaries are basically hashtables of some kind under the hood
Hrmm I think my use case doesnโt hold up too well. Let me think of a clearer way to describe what Iโm thinking about
@rare umbra never (with caveats) use entities for "data storage"
use entities when you want to have systems that execute stuff on top of the entities
in this context storage is like their values not changing very often?
if you want to store strings, use a dictionary, or some sort of array
To put it differently: the component storage is a data structure optimized for fast queries based on tuples of component types (aka archetypes), and for fast iteration over components matching those queries. If this is what you need, use components.
important the fact with the archetypes and components. If you just iterate some data, there are arrays for that
obligatory dodbook plug too
Data-Oriented Design
thanks
So I'm working on a mod for Risk of Rain 2 that is improving its navigation baking system so that we can bake the navigation during runtime (its a custom navigation system)
We are doing this with jobs and have it basically working, but its still not as fast as we want
I was looking at using burst, but after doing some reading, I'm not sure that its actually possible
It seems you'd have to run a standalone build to get a special DLL that needs to be loaded in order for burst to compile?
am I possibly misunderstanding this?
would it for some reason not be possible to add burst compilation to a game which doesn't already have burst, or possibly even more importantly, if the game ends up using burst, would that make it impossible?
@stable fog not totally sure what you mean exactly with that question. You would possibly need to do a client update with the burst compiler enabled to actually make use of it.
I cant rebuild the game, since its hopoos and. Ot mine, so if it requires the game to be rebuilt I guess I'm boned
aah I see what you mean.
yeah I don't think it will be possible with the current implementation at least.
Just to be clear they know what we are doing and have been kinda helpin
I'll ask the question on the forum in Hope's that a unity dev answers
wait a second, what is a Standalone player?
normal windows/linux/mac player
so any game typically published for those OS's are a standalone player
yup
New physics package 0.2.5-preview.1
is there a system you can run just once?
couldnt you just disable it after it does its mainthread logic?
yes. i just saw that ๐
@trail burrow i just built a largely empty player(no netcode, it is a scene with a box as a ground plane, and spawns other physics boxes when you click..) and it takes up 60% of my i7 on idle. in fact when you spawn tons of boxes, the entire sim will grind to a halt but not exceed 60% either. profiler says the entire cpu side is only taking 1ms too
yeah just saying that im really surprised too. i guess its probably not a netcode thing?
after removing the physics package, making it just an empty scene with a capsule entity, deleting all test scripts its now taking 50% cpu and 50% gpu in a build lol
@safe lintel well the problem i have is different tho, i have massive frame times also
like 100ms
but i gave up so
## [Unity Physics 0.2.5-preview.1] - 2019-12-05
### Fixes
* Fixed a bug that could cause compound colliders to not update with Live Link when moving around a mesh collider in the compound's hierarchy.
* Fixed a performance regression that occurred in certain situations when using Live Link```
so, basically small hotfix for those two things
Hey guys, is there an interface or something that I can assign NativeArray<T> AND T[] to?
SomeInterfaceOrClass<T> myCollection = new NativeArray<T>...
and
SomeInterfaceOrClass<T> myCollection = new T[length]
I looked at IList and ICollection, but they seem to be resizable with Add() and I don't want that
I want them to be fixed-size
I tried but it doesn't seem to be indexable
indeed, IEnumerable is not indexable
the question is whether native arrays guarantee order (not sure about that?)
if they do, you could implement your own LINQ-esque AtIndex method (which of course would be quite unperformant)
I'm already trying something else, so I don't think I need it anymore
Also there is ElementAt
Which would do the same thing
true
or you could create a method that does a type check whether it's a nativearray or a C# array and cast?
different question: What conditions are necessary for a ComponentSystem to run OnUpdate? I marked a ComponentSystem class with the AlwaysUpdateSystemAttribute and funnily enough ShouldRunSystem returns true for that system. Yet, OnUpdate is not running...
It wouldn't run if Enabled == false or the world doesn't exist
yup, makes sense, also checked that that's the case
uh, okay, turns out that a system cannot have the AlwaysUpdateSystemAttribute and DisableAutoCreationAttribute work together. The latter somehow disables the former.
This was submitted as an issue already but it's been marked as by design ๐คจ
DisableAutoCreation removes it from the player loop update (you take manual control of updating it)... alwaysupdate tells the player loop to update the system even if it doesn't have automatically discernible matching entities to operate on
ah, thanks for that insight!
I think that's an odd design choice then. I don't see why disabling auto creation would necessarily lead to having to manually update? What if I want some systems only in a specific world and not in the default world? Doesn't really seem sensible that I'd have to manually update the systems in such cases, or am I missing something here?
plus it's not reflected in the name of the attribute. That it's not mentioned at all in the documentation is not surprising but also doesn't really help. Not lashing out at you or anything, I'm just a bit confused about that design choice.
disable auto creation would mean you would create it yourself manually - so if its not in lets say the SimulationSystemGroup's update list - then you would update it yourself manually
I think by design its to allow ppl who want really fine tuned controls of their system for whatever gameplay needs
You can certainly add your manually created system to the system group that's being updated tho ๐
I agree it might not be all that intuitive (esp used to MonoBehaviour Update). Atm dealing with multiple worlds is still a bit tricky - not least because of lack of docs.
psa EditorApplication.QueuePlayerLoopUpdate(); is a thing for anyone who wants to do edit-time systems
Does anyone know if there any Entity serialization examples floating around anywhere? Just looking for how to implement saving and loading with the ECS.
Simple example here https://forum.unity.com/threads/serialization-questions.534187/
Heh, trying to plug into the IL rewriting pipeline, but something tells me they really don't want me to do that
("something" being [InternalsVisibleTo("OnlyOurStuff")] all over the place)
Thanks
hm... I asked the question a few days ago already, but it got buried in a discussion pretty quickly. As I still couldn't figure out how it works (and as @digital scarab above mentions it): How exactly do you transfer specific entities between worlds? I only seem to find ways to either move or copy all entities o a world to another, but I'm interested in using one world to store prefab entities and then instantiate them to a different world. Is something like this not possible? Or do I just not find the proper samples or docs?
An overload of EntityManager.MoveEntitiesFrom takes a Query
Re: serialization - are there yet any strategies for change-resistant serialization? because binary isn't exactly known to be great at that
@digital scarab hm okay... so if I want to simply transfer a single entity or a group of entities I already have an array of I still need to pass it through a query somehow? I am confused by this as it looks like I can only "generally" move entities, but not specific ones I have the references of.
hm yeah that makes sense if you do it constantly.
but I will most likely only instantiate entities on level load and not much more later.
if archetypes could handle different default values this wouldn't be a problem ๐
exactly. I am working on a very moddable game and I define my entities in a lua script. I have a handler that keeps them in a hashmap as prefabs in a specific world. so the entities are really only there as a description on how they should look at runtime.
okay clarification. I am defining my entity "prefabs" in lua scripts, not instantiating them in lua
I started out with archetypes until I found the need to declare different default values for components of different archetypes and that made everything a whole lot more complicated
I guess you can attach a tag to the entities you want copied to make them match a query
hm but that sounds like multiple times performance heavy work: once the instantiation, then adding the tag (new chunk), then moving them to the actual world, then removing the tag (new chunk again). or am I wrong in this? if adding and removing the tag doesn't update the chunks I think this might work.
They treat tags (empty components) in a special way - they don't affect which chunk an entity is in
They are extremely efficient for this kind of thing
aha! that's good news already ๐
hmm I don't think that's right @zenith wyvern ?
@zenith wyvern I'm pretty sure that's not true
I thought I saw a unity person say that at some point
There is a fast path when you add/remove a tag for an entire chunk
Is it not?
nah, you add a tag - it changes the archetype, therefore it moves chunk
Oh, bummer
Then again, @sharp nacelle don't worry about the overhead from moving entities between chunks, unless you are moving like 10k entities at once
You at least know it will be quick to remove the tag at the end since you can do it in batch by passing the tag query to RemoveComponent
correct.. understanding batch operations and just how low cost they are is important
once you have tagged your 'prefabs' that you want to move into the new world (I still don't really understand what's going on here), things should be very quick
yeah I'm currently thinking of how I could batch this in the best way. I guess I will make my life easier by already providing a method to instantiate a large number of entities of one or multiple prefabs at once so I can tag & copy them all at once.
so at best I only need to do this once or twice when a level loads
are you not recreating the Prefab component and Instantiate that takes a NativeArray?
wait... prefab component?
uhuh... add it to a created entity and it isn't processed by any systems
๐ฎ
and you can instantiate copies of them via entity manager
oh man. that makes my life so much easier ๐
haha ... sweet
I made one myself before and was annoyed by needing to exclude the component manually in each of my systems
Todays points for looking at the big picture go to Timboc ๐
that's why I got the idea of the separate world
I made one myself before and was annoyed by needing to exclude the component manually in each of my systems
I made one myself before and was annoyed by needing to exclude the component manually in each of my systems
that's why I got the idea of the separate world
thank you Timboc! I will definitely try it with the prefab component. this sounds a whole lot more simple than what I'm currently doing ๐
no worries - good luck! may also be worth avoiding the extra world unless there's a good reason for it
it just sounded so nice and clean
so entitymanager.instantiate will automatically remove the prefab component?
yup
very convenient. seems to work so far, but I need to restructure my code a lot before it works completely ๐ thanks again for the help!
Hmm, I have a nativearray but I need to write to it non-sequentially, is there a way to do this in parallel?
I'm writing to the "location" based on where the entities are, which means I don't know where they'll be writing to. I'm puzzled. For reference, I'm trying to port the "Ant Pheromones" project from the DOTS Training
I tried to use ScheduleSingle but I'm ALSO using IJobChunk which doesn't like that with an EntityQuery.
use [NativeDisableParallelForRestriction] myNativeArray to allow parallel writing
@safe lintel Awesome, thank you!
anyone knows a way to do something like: Mesh.SetVertices(NativeList<float3>); instead of using a List of Vector3
?
Would it be possible to do: NativeList.AsArray()?
If you have access to the new mesh api (2019.3), then you can pass native array's to Mesh.SetVertices, and lists can be converted to native arrays using AsArray().
It's a good book, but a bit heavy handed in terms of how much it like to "shit" on OOP, etc. Raw execution performance was never OOPs strong suit. The performance benefits of DOD can't be ignored and that DOD makes absolute sense for internals of a game engine is fairly 'obvious' imho.
@gentle osprey yeah, that seems to work, thanks, but I might need to look into it a bit more, I don't know if calling this creates garbage, and I need this to be called very often
It doesn't create garbage, a nativelist is a nativearray under the hood
oh, then that's fantastic, thanks! and one last thing: does ToArray() create garbage? since the indexes of my mesh are stored in a nativelist of int aswell, but it does not let me use AsArray
ToArray creates an actual copy so yes it will allocate. You should be able to pass a native array to mesh.SetIndices
https://forum.unity.com/posts/5241188/ See here for an example, pushing the data to the mesh doesn't cause allocations
Thank you so much! I was trying to use SetTriangles, that does not allow nativearrays or lists
There is no equivalent to Entities.WithAll<Thing>().ToEntityQuery() in the new codegened version, right?
@trail burrow I actually struggle to read that persons posts or blog posts
it usually takes forever to get to the point and all the info is mixed in book long paragaphs
the guy posting about it
I have nothing against the book ๐
I.. was going to post this reply on the forums
It's a good book, but a bit heavy handed in terms of how much it like to "shit" on OOP, etc. Raw execution performance was never OOPs strong suit. The performance benefits of DOD can't be ignored and that DOD makes absolute sense for internals of a game engine is fairly 'obvious' imho.
However specifically regarding the Unity ECS: Applying DOD on such a scale that it's intended to to be used for everything from core engine to fine grained game logic (in the end... dots is not ready... i know). I'm just not so sure, from an architectural perspective, how organisation of a lot of fine grained game logic with tiny variations in behaviour is going to pan out - for all its drawbacks, this is something OOP excels at.
but didnt wanna get into a shouting match
with the forum zealots
๐
yeah, I know what you mean
there's been many times I've written long responses and then... just never sent it
yup
I'm just not so sure, from an architectural perspective, how organisation of a lot of fine grained game logic with tiny variations in behaviour is going to pan out
This is why I don't like the fact all the Unite talks/demos etc. are all about performance. Do this to get performance, don't do that because performance. We know dod is fast. Show me how it is good to write gameplay code in it.
Also why the project I'm tinkering with to learn ecs is a card game. Minimal performance requirements, just try to arrive at a convenient pattern to express gameplay logic in.
That was one of Sweeney's main beefs with the idea of going to an ECS model as well. How does complicated gameplay code translate here to actual productivity gains? Ideally we can make gameplay logic in a more abstract oop way and DOTSify anything heavy. I think that was how Overwatch handled it.
They will probably show off more ease of use stuff once visual scripting is more mature
I really hope visual scripting doesn't become the go-to way to do gameplay code
So does my mouse-induced RSI
For me the best thing about visual scripting right now is seeing how they handle things in the (actually human readable) C# files they generate
Has a long way to go before it feels as nice as a certain other engine's node based stuff
I'm happy with their decision to make the visual scripting ECS only as there are already apparently good solutions for regular OOP node-based scripting
I really don't see them doing a visual scripting environment that beats Visual Studio at code editing. Like, I want to do "Find all references of this field", show me all the visual scripts that touch it.
Unreal Blueprints don't have anything like that either, right? (been a while since I looked at it)
Depends on what you mean by field? I believe there is something like that for variables in a BP
My Player has an int2 GridPosition field. Show me all the places it is read/written to
@trail burrow personally i like ecs architecture more than oop for game code but you should post it especially because of the forum zealots
imo i've prob learnt the most from the criticising posts on the forums because it shows weak points but also gets devs to justify their reasons and explain why they think their way is good
also i get what you mean sometimes the forums just read like a unity advertisement
@worldly pulsar Confirmed it does have a feature that searches for nodes that get/set the variable
That's across all blueprints in the project? Wow, maybe I need to look at certain other engine again sometime.
hey guys. more tests more fun
for the purposes of a 2d tilemap (so quads) what is the best approach for maps that would change tiles every so often?
i seem to get better performance creating largeer "chunks" of quads in one mesh, setting the uv's per tile... but that makes something like mesh sharing not work... if i create indivudal quad meshes, sharing would work, but it seems to have way less performance
If you are covering the whole screen with ~9 meshes I wouldn't worry about sharing them
How big is your tilemap? Can you just create it once and modify every time a tile changes, or do you need to build it on the fly as the player moves around?
And how often do the tiles change?
InvalidProgramException: Invalid IL code in JPL.TextRender.TextRenderingSystem:OnUpdate (Unity.Jobs.JobHandle): IL_007a: call 0x0600003c
Ok, that's a new one
if you have to do any kind of math, visual scripting will suck at it
things that take few seconds to type, take minutes to wire and are tedius to change and you also make mistakes easier that way
You could just have a node where you name your argument "ports", and just type in the math
The math expression node allows you to type in a math expression and builds the appropriate sub-graph to create that expression.
tilemap would be small chunks, not sure of size, but probably like you say, ~9 on screen. they wouldn't change frequently, but say a colony or builder game where walls are built, rocks or trees get dug/cut, etc.
still more tedious than just typing it in in code imho, but that's my take on visual scripting in general
is discord search not working?
It was broken for me earlier as well...
Discord had a major outage yesterday
discord's currently having an ouchie wowchie with it's magnifying glassy
alright thanks, to the unity forums
@winter veldt as long as you only maintain the meshes for the ones on screen I wouldn't expect any performance impact, even on mobile.
ok, so i thought shared resource stuff was like a "build once, stamp it all over" thing... but not so much huh.
@worldly pulsar yes, I've used that node... once
it doesn't really solve much and is still super tedious to use
I don't really hate ue4's blueprints, they are great for many things... I just hate any form of math equations on it
they are great for testing out new engine features and doing quick prototypes as you don't have to open docs to just assemble the thing you want (most things are obvious there)
btw, I knew someone would bring that math node up
it's great on paper
Visual scripting in general is great on paper imho
well it makes some things way faster to do on unreal
(and tbh I just google searched if UE had this kind of math node, never used it)
but on unreal, anything that lets you bypass their c++ api can speed things up... their c++ api is just poorly documented and you spend ages trying to figure out simple things because of that
their blueprints you just wire and it works
there are other reasons why I nowadays go almost full c++ on ue4 projects but it's not really relevant to this topic now
I'm actually genuinely curious if Unity manages to make their DOTS visual scripting logical to nonprogrammers
because the early versions we've seen didn't seem easy at all
my main interest on DOTS visual scripting is if it helps reducing the boilerplate code
but recent Entities changes did that to some extent already on code side
(but there's still work left on that front)
after programming for decades, I really don't hate anything more than writing boilerplate again and again
it's just work that shouldn't need to be done
there was an old slide preview image of what they intended for it to look like which did look pretty nice
any task you have to repeat like a robot is unnecessary
i consider myself a visual person but i dont even care to touch it until it gets that ux overhaul ๐
This is why I'm ok with them throwing codegen at the problem with the new ForEach. The amount of boilerplate we had with declaring the job structs was crazy, and IL postprocessing - while still evil - cuts that more than any generic magic could.
So given the choice between magical codegen rewriting my C# or visual scripting I still wouldn't choose visual scripting
i know its early, but i kinda prefer how the job structs more straightforward and feel more organized, the new foreach with all any structuring to me seems a little messy?
the post processing makes me nervous, at least heavy generics are strongly-typed and instructive to read; i can inspect it all and easily see what's going on. Magic that produces god knows what out the other end is worrying and I hope its kept to a minimum as the 'easy version'. One of the things i love about the jobs is the idea that its extremely explicit; everything going in to it is declared and obvious.
If they could get a good api with generics alone I'm sure they would.
is there a way to store a fixed sized array or some sort in a component? specifically say, an array of float3 for verts?
@winter veldt you can store a fixed array of int/byte/float (all the built-ins) like this:
unsafe struct T {
public fixed int arr[4];
}
no float3 tho
ah, thanks!
@winter veldt if you want to wrap that nicely for T, check out \Unity.Collections\ResizableArray.cs for inspiration
Well that's not it, you are ending up wasting memory for small data types @mint iron
@worldly pulsar You can easily store a float3 in that tho, since the size of float3 is known
How do I go about sharing a normal struct value between 2 jobs?
...
var handleA = jobA.Schedule();
var jobB = new JobB();
jobB.someFloat = jobA.aFloatResult;
...
jobB.Schedule(handleA);```
You put your value inside a nativearray and pass it between jobs
There isn't some neater container for just this?
Not right now, as far as I know
Alright
@wooden falcon can just allocate memory for it
// allocate
var value = (MyStruct*) UnsafeUtility.Malloc(sizeof(MyStruct), 8);
// clear it
*value = default;
put the value pointer on a job somewhere
So I would need to wrap it in a unsafe block right?
Also is Burst fine with pointers?
@wooden falcon burst is fine with pointers, I think you would need to wrap it in unsafe and mark your project as using unsafe too. Hence if needed I tend to also use a NativeArray
Yeah I'll use arrays instead
Given that the most annoying thing with them is making sure they are deallocated after the correct job, which I'm guessing any solution would end up needing
yup. I think Unity has said that in the future they'd like to make this nicer (esp between lambdas) - though probably a lot of people prefer the explicit nature of the current way anyway.
Yeah, explicit is nice.. I just need to work up my muscle to remember to dispose of them and so I don't have to look up the API every time I need to do it
True - the compile time errors and runtime warnings help a lot - some could be better but generally I don't think they get the credit they deserve for fairly immediately highlighting where you've gone wrong or forgotten something.
so, using GetComponentDataFromEntity in a IJobParallelFor job is not allowed (container does not support parallel writing)? So we can't use it to write to in a Entities.ForEach.Schedule?
I'm encountering this in a unit test, so not usre whether this is an actual restriction or if its me who haven't set up the stage yet for the test to run properly
I do get an Invalid Operation Exception though, so my guess is its not supported in parallel job, only IJob
hm, the Asteroid Netcode sample use it with a IJobForEachWithEntity and writes to it
You can use it for reading, but not parallel writing, at least not where safety is guaranteed by Unity. You can disable the restriction [DisableParallelForRestriction] in cases where you know for sure each different parallel run guarantees to not write to the same data.
Hm, I actually just read from it
var commandTargetsFromEntity = GetComponentDataFromEntity<CommandTargetComponent>(isReadOnly:true);
var unlockTalentRequestHandle = Entities.ForEach((Entity requestEntity, int entityInQueryIndex, ref TalentUnlockRequest request) =>
{
ecbUnlockTalentRequest.DestroyEntity(entityInQueryIndex, requestEntity);
if (commandTargetsFromEntity.Exists(request.Connection) == false ||
commandTargetsFromEntity[request.Connection].targetEntity == Entity.Null)
{
return;
}
var target = commandTargetsFromEntity[request.Connection].targetEntity;
ecbUnlockTalentRequest.AddComponent(entityInQueryIndex, target, new UnlockTalent
{
TalentId = request.TalentId
});
})
.WithName("TalentUnlock_Request")
.Schedule(inputDeps);
So, most likely, some of my setup in the test must be off
hmm weird.. if you get that error it likely means it doesn't think it is readonly so that (true) might not be all you need - does it help if you add [ReadOnly] before var commandTargetsFromEntity...?
its a local variable I extract in OnUpdate, so I can't add an attribute (I use the Entities.ForEach.Schedule approach)
I'll try changing it to a job and see whether that fixes the problem
After the .WithName() function, add .WithReadOnly(commandTargetsFromEntity)
nice, that'll be it
np ๐
man, learning ECS/DOTS with Unit testing helps so much
specially in Rider where you get the ECS unit tests right there in Rider
don't need to switch over to the Unity Editor at all while coding away
You can easily store a float3 in that tho, since the size of float3 is known
@trail burrow What I meant is you can't have afixed float3 arr[3]
@worldly pulsar no but you can have fixed byte arr[12 * 3] and cast to float3*
so I downloaded the new netcode packages and entities etc and followed along the "Getting Started" section on the Netcode manual
But when pressing the "Update Component List" Unity closes.
not even a crash, it just closes. anyone know anything bout that?
btw, Unity Physics 0.2.5 seem to break netcode samples, there's a possible fix (staff comment from the forums): https://forum.unity.com/threads/unity-physics-0-2-5-preview-now-out-and-about.788333/#post-5255366
Has anyone encountered this error when trying to Deserialize a world? We are reading a UnityEngine.Object however no ObjectTable was provided to the PropertiesBinaryReader.
Whats the current recommended method for "events" or other types of communication with entities?
If I have different meshes to be drawn with the same material there is nothing better than Graphics.DrawMesh() right?
interesting staff response on serialization https://forum.unity.com/threads/serialization-0-6-3-preview-package-performance-issues.782123/#post-5262788
@stiff skiff che3ck out tertle's event system https://forum.unity.com/threads/event-system.779711/#post-5242199 as its probably the most tested and well thought out solution available. In the recent version he's switched to NativeStream rather than the dictionary and NativeQueue approach previous. I think there's still a great deal of room for improvement but as far as out of the box solutions go he's done a lot of work for you.
not fully dots I suppose but it's jobs/burst supported
Numbers on 250x250 water mesh, with 10 wave source objects, on 2018 MacBookPro (Core i9 2.9GHz):
* Regular API: 66ms,
* Jobs+Burst: 3.9ms.
nice
codegen, the gift that keeps on giving
Member 'UnityEngine.TextCore.Glyph' is declared in another module and needs to be imported
(works fine in editor but refuses to build)
Hi, I've been trying to minimize the GCAllocation as much as possible in my project and I've come across the fact that the only thing that allocates GC memory is the Unity camera renderer and the rendering systems in general. Has anyone been able to somehow deal with this issue (besides obviously writing your own rendering system)
i made a persistent hashmap yet i still get the native container has not been disposed error when i exit playmode
anyway to get rid of it?
You should dispose the persistent native hash map before your application quits
so if it lives in a system you can likely put it in OnDestroy() call
if its outside, of a system - you should find a way to dispose it before you effectively quit
ah ok great! thank you :)
Hello,
I want to iterate through thousands of GOs at each update. Can I do that with Job but without ECS ? Should I have to populate a native array at each frame or can a Monobehaviour create and store a native array and then pass-it to a job at each update ?
@gusty comet you can access gameobjects only from main thread, so job system can't poll data out of them
there are things like gameobject transforms which you can jobify
and physx queries like raycasts etc
but those are special cases
IJobParallelForTransform for transforms, RaycastCommand for raycasts (and there are few others for other queries)
I want to try some procedural mesh generation and was wondering if there's anything in DOTS that would make it more performant. My previous experiments with the Mesh class showed that it wasn't particularly fast. I know that for many things I could just use vertex shaders, but still I'd love to do some operations on an array of mesh vertices without the need to dive deep in C# parallelism
Saw this yesterday too - for 2020 alpha version tho but could provide some insight https://github.com/Unity-Technologies/MeshApiExamples-2020.1
these improvements are good but you can generate meshes with over 100k vertices in a few ms
really, all you need to do is ignore the mesh class until you actually need to write to it
its the transfer of data that is the slow part
write to it once
and I don't mean to imply that you should aim to use DOTS
just make sure you're approaching the problem right
A lot of procgen can also be parallelized by way of "start a thread, ignore it until it's done, then listen to what it has to say".
This doesn't need to use threads directly either, it's fairly simple to do with the C# Task API.
The approach doesn't get full benefits of parallelism, but it walks a wide circle around many potential dangers while leaving the main thread doing main thread stuff.
Initial generation of various sorts can't really benefit from that, though.
The points above are good, too - you can work on pure math and arrays for a long time before you need to touch Mesh
So, let's say when you have a cube in a sub scene, it is automatically converted into the ecs representation which lives in the Editor World. Any idea how I could get hold of that entity? It seems like IConvertGameObjectToEntity's Convert isn't called for the Editor World? (Yet obviously, there's a conversion happening)
@digital scarab Thanks, that is exactly was I was looking for. though it seems like it's a work in progress. Do you know if there are any example projects with this improved mesh API?
So I realized my my deserialization error only happens when I have any entities with a RenderMesh. Does anyone know what I have to do when serializing/deserializing entities with those? Currently just doing SerializeUtility.DeserializeWorld(entityManager.BeginExclusiveEntityTransaction(), reader);
Which works until I add something using a RenderMesh.
Am I suppose to use SerializeUtilityHybrid?
Is RenderMesh not ISerializable?
If it were, I assume the relevant methods would be called, so if it is (easy to check with some intellisense and casting, or source), something in there is probably broken. Otherwise, I assume it just doesn't know how to serialize it, and that you need to make a custom thingy for that.
Yeah I think I figured it out, I have to pass an empty object array into the SerializeWorld method and serialize that separately. Then deserialize that myself and pass it into the DeserializeWorld method.
Haven't actually figured out how to serialize those objects yet, but it should work when that's done.
why are you serializing the rendered entities? seems like something you would want to rebuild when you deserialize?
Probably, but it depends on how its done. Presumably you'd want to save either just some reference (named or the like) to a model, or a seedfor procgen
At least not save multiple copies of the same mesh
Well when I try to deserialize them I have errors because they have references to managed objects which I don't have anymore.
yeah that's what i'd assume, i mean RenderMesh is literally holding the mesh and material and such, which is probably why it errors out when trying to serialize/deserialize.
SerializeUtility.SerializeWorld(EntityManager, writer, out ObjectRefs); When I do this the ObjectRefs is a list of meshes and materials.
Do I have to remove all render meshes from my entities and have a component with a string says which ones to load when they're reinstantiated?
i'd assume its not to just save the world to file or something, what are you serializing it for?
I'm just trying to have a save and load system
I want to save every entity as it is, and then reload them.
yeah, i don't think you're meant to be saving render data, that is the RenderMesh stuff. it should be built at load
or rebuilt as it were
Do I have to strip all of the to-be-serialized entities of their RenderMesh before serializing?
that's probably the best bet yeah. i keep anything that's being rendered in it's own entity, not tied to the actual data.
so like, a characters entity would be separate from a characters renderer entity.. just with a link to it if need be
but you can probably just remove a rendermesh and readd it
I'm converting a lot of game object prefabs into entities, I don't think I can store a reference to those prefabs in a component that will be serialized.
I mean maybe I can store an addressables string in a component.
Just seems like I have to redo everything I've done just to serialize.
sounds like a nightmare to try to handle tbh
How do I exclude a component from serialization? If it doesn't have a [Serializeable] attribute is it not serialized?
Maybe I'll try render entities and not put them into the world that will be serialized.
I just want to correct something I said above
"and I don't mean to imply that you shouldn't*** aim to use DOTS"
that would make more sense. to me, game data and render data is better left separate, for that exact reason. You don't want to save render data, only reason i can think of is extra space it would take... but i'd assume there are bigger reasons (not even sure you could say.. save a material object to file and recall it for one)
i haven't played with multiple worlds or serializing data in ECS really, so i can't help much beyond that
Having a data entity and a separate render entity seems weird. The RenderMesh is a separate component operated on by separate systems I feel like I shouldn't have to have a weird linking between two entities for that. Doesn't feel very ECS like.
definitely seems like it should warn you that shouldn't be serialized. you should be able to just turn it off
thats why i feel like you could just remove it and re-add it. but thats part of the issue, you are building the render data already, if you were to save it and load it back in, it'd be an entirely different location, but just a copy of the data... and render data is generally the largest data. essentially all the media (textures, sounds, etc) shouldn'
t be serialized to a save file
I think I'll have a component that has instructions for setting up a rendermesh. Either based on a prefab or data that's procedurally generated. And then remove the rendermesh before serializing. And use the setup component when deserializing to readd it.
i mean that's what a prefab is meant to be. the prefab of a section of wall is set, then you instantiate several wall section prefabs, changing each of their locations, and you create a wall. you're meant to be saving just their locations, not the wall section prefab.
I'm just glad they have blittable strings now so I can use adressables
haha yes. that was a fun realization
i haven't looked into ecs serialization yet but instead of serializing the entire world and excluding components, isn't there a way to only include components you want to serialize? in oop games i've worked on the save data is a really small portion of the game's total data
i'm guessing tagging the entities before you move them to the save world is a way but then you'd still end up with the entire entity
and splitting up simulation entity and render entity makes sense but to add a 3rd savedata entity is weird
Hi, is there a way in Physics to set the "timeScale" to zero?
I guess you could probably write a system to prune out componentdata's when you want to serialize the world after transferring it ๐ค @hollow sorrel
also @prisma anchor haven't messed with physics package, but possibly - you could turn off the systemgroups handling the logic to "pause" the physics ๐ค
yea i guess something like removing any component that doesn't match a filter
feel like that doesn't scale very well but perf doesn't matter as much if it's saving/loading since it's ok if it takes a few seconds
but still wish you could do like a [SaveMe] attribute or something and filter only those to copy to the save world
what i used to do with oop is let a component add itself to a list that gets iterated during save, and calls a serialize() method on each component to serialize itself
hmmm @coarse turtle sounds like an idea
is there a way to make a list that can hold all native collection types? i basically want one class to have a giant list of all persistent natives so i can dispose of all of them with a single onapplicationexit method
if its not possible are there any alternatives to do what i want to do?
i might be mistaken but if you close your built game the OS should reclaim all its memory regardless if you release it or not
dunno about editor tho
is there a difference to having a seperate render world vs one world with render entities? with systemgroups you can still put all your rendersystems on a seperate tickrate to render at refresh rate and fewer simulation ticks
on forums unity devs seem to recommend having a render world but i can't find why
@vagrant surge sorry for pinging but you tend to have insightful answers on these things feel free to ignore this if you're busy
could it be for ease of serializing a world for saving?
i haven't done any multi-world stuff yet, but someone was having an issue because they were trying to serialize rendered entities
Could it be to iterate less entities?
is dynamicbuffer broken in 0.3p4? trying some example code and the GetEnumerator() is throwing a "Not Implemented" exception
@slow epoch long as you keep your render entities seperate from simulation entities i don't think that would be an issue
Are chunks global or part of a World?
part of a world
btw, where did you see Unity devs recommending a separate render world?
@hollow sorrel it really really depends
the thing is that worlds have "forced" sync points
due to add/remove components
this means that there is a strict limit to how much parallelism you can have on 1 world
and then Amhdals law kicks in to ruin your day
with multiple worlds, their execution can be done parallel, so while 1 world is locked at a sync point, the threads arent idling
i actually implemented both approaches in my own experiments. The issue with multiple-world is that syncing data beetween that world and render-world is a forced bottleneck. It can be alright tho. Depends on how many dynamic objects you have around
their execution can be done parallel
In theory, yes, but with the restriction that all the systems run on the main thread you'd have to do some kind of interleaving of systems from different worlds to make that work
this is from a tech demo i have, of 100k "spaceship" boids, an even bigger version of this http://victor.madtriangles.com/code experiment/2018/06/11/post-ecs-battle-huge.html
After getting bottlenecked by UE4 on the last ECS battle simulation Link , I decided to create one on direct C++,using an engine written by me. The new simulation simulates 130.000 entities at 60 fps on my Ryzen machine. It is designed in a way that it almost scales linearly ...
the red and orange boxes are "worker threads doing work"
the blue is the main timeline
see all those sync points? Clear separations beetween those very parallel systems
there is literally nothing you can do for those if you use 1 world
if you use 2-3 worlds, and execute them at once, then the work of the different world systems will overlap and "fill" the gaps
but i dont know if that works in unity. Is it possible to run the update loop of multiple worlds in parallel?
As I just said, systems are restricted to the main thread
in that case, multiple worlds arent needed
you might want to separate "visual" and "logic" entities
so that entities that go through the render loop are "more optimal"
and even if you try to run them from your own thread, the JobSystem will yell at you, because its scheduler is not thread safe
oh
then separated worlds dont really have that many gains. Unless you want to do it anyway for architecture or special needs? like networking where you have client and server worlds
From what I understand creating worlds is lightweight enough for cases like move a bunch of entities to a world and then serialize that (which is just fwrite() of all the chunks)
yes, it is
changing the world of a "chunk" is barely a few pointer swaps around
you just remove it from the internal lists of world A, and add it to the internal lists of world B
oh huh
so basically in theory it'd make sense but since unity's systems run on main thread, it doesn't?
im not sure how exactly the internals of unity work, but if you were to do that on the unity-style ECS ive written on C++... it would be about 3 pointer swaps total
Unity runs with the assumption that systems do very little work, they just schedule jobs
also @worldly pulsar i can look up the posts if you want but it's basically just the threads of ppl asking "what are the use cases for worlds" and there's always a unity dev (e.g. joachim) mentioning presentation worlds
uhm if they run on main thread but just schedule, then its probably possible to overlap the jobs of multiple worlds
doing that whole overlap thing i commented about
I guess it would make sense for a kind of double-buffering scheme (copy your entities to a world after each sim step, then the presentation can grab 2 of those worlds and interpolate between for presentation)
maybe
@vagrant surge that's what I said about the systems having to be interleaved, you'd have to run world1 untill its first sync point, then world2 untill its sync point
pfff, that fucks with the interleaving quite a lot, unless you make sure you absolutely never block on each of the 2 world simulations
for my multithreading, i use Taskflow (c++). in that one you build a job graph ahead of time, and then execute the entire thing
How does ECS right now handle references between worlds?
ecs systems always finish their jobs before the next frame right? like running jobs are waited on at start of next update call? or at the start of updating the world?
so if you update your systems every 16ms, they'd have 16ms to finish their jobs
but if your renderer updates at say 7ms, does this mean everything in your world needs to finish in 7ms, or is that handled seperately if you update the systemgroups at different intervals?
if that's the case then that'd be a strong case for multiple worlds
i have literally zero clue about that
I think that was the idea with Unity ECS (systems build the job graph), but then you get restrictions on structural changes being main thread only and the idea breaks
@worldly pulsar or if you have to read/write from normal unity land
where hard syncs are needed
overlapping the systems like this is pretty hard
@hollow sorrel yes if nothing else Complete()d the handle you returned from JobComponentSystem.Update() then the same system will complete it on the next frame
if you didn't include the job handle in what you returned then you have to complete it manually (there are some additional smarts for IJobForEach and friends)
so system decides? e.g. if you update your system at 1 fps it'd have 1 second to complete its jobs?
the handle you returned will almost certainly be completed somewhere else if you scheduled any IJobForEach
I definately wouldn't depend on the "complete next frame" behaviour. If you want to complete the job manually (and don't introduce data races) then store the handle and call Complete() on it
ah so if you wanted it to take 1 second, instead of returning the jobhandle in onupdate you'd store it somewhere else (e.g. the system)
Yup, just make sure you don't touch any data used outside of that job. The safety system should tell you if there are problems.
makes sense
so from the discussion above i gather the answer to seperate render world is "it depends"
Outside of the double-buffering idea I mentioned (which I spent ~15 seconds thinking about so I'm sure it's rock solid), I don't see a good reason for a separate rendering world in Unity ECS
The context I've always seen it mentioned from unity people is when you're doing networking and want to easily be able to send your data over with wire without having to worry about rendering stuff
Yeah, that's a great use case, but not really "separate rendering". More like "separate client/server worlds"
Another would be if you need 2 physics worlds you don't want to interact with each other
Has anyone been playing around with the noise from Mathematics? I've noticed the simplex has this weird artifact when you approach a position with x = y = z
i thought the systems complete all outstanding jobs after every update loop; in other words by the time the system runs again it somewhere calls complete on any dependency it had returned from update. Although i cant remember offhand where it happens.
Anything that touches components is completed every time there is a structural change (see BeforeStructuralChange in EntityManager)
and the JobHandle you return from Update is stored and Completed the next time the system runs
but other than that I've never seen anything that would complete all the running jobs
Anything new on the dots frontlines?
I would say the last two weeks or so
Been a bit busy and had little to no chance to keep up to date with things
Request for pinned or otherwise "required reading" on dots. Other than the unity blog post and some pong tutorials I'm not finding a bunch about how to start working with it.
@vivid loom have you actually looked at the pinned message on this channel? ๐
that's basically it, official manual and samples
rest are hopelessy outdated
Oof, I'm on mobile so maybe I can't see the pinned message. I'll have a look on desktop when I get home. Thank you for the input!
Ok, I found it. On mobile pinned messages are in the top right ... Drop-down.
https://bintray.com/unity/unity/com.unity.dots.runtime/0.1.0-preview.4
https://bintray.com/unity/unity/com.unity.tiny/0.20.0-preview.3
https://bintray.com/unity/unity/com.unity.tiny.rendering/0.20.0-preview.3
https://bintray.com/unity/unity/com.unity.tiny.desktop/0.20.0-preview.2
https://bintray.com/unity/unity/com.unity.tiny.web/0.20.0-preview.2
lol, Windows Defender is blocking that dots.runtime package
how i do all my change logs
`## [0.1.0-preview.4] - 2019-12-11
- Updates`
Better than writing a changelog with the first line as "This may break." haha
Hey guys I'm trying to build the NetCube example into a server and a client executables but I have no idea what I'm doing. Has anyone done this ?
there's new netcode and transport packages now as well
I managed to to it. The server part from the example was in #If UNITY_EDITOR, so that's why the server build did not work. I now got a server build that runs on the local network for now. It also builds to android and connects, so that's nice
Seems they are working hard to get everything out before xmas, so we have busy holidays ๐
well, 2019.3 will not be out ๐
we aim to have polished everything out to enter the official full release status in January 2020. from latest blog post
Make sense, it seems like they're really been scrambling to get everything ready
that was unexpected but when you look at the issue list, it's no wonder they had to push it back to next year
Does anyone know if there exist any utilities for converting a Collider type component to a Physics Shape component?
Like a physx Collider component?
Colliders like "BoxCollider" and "MeshCollider" etc..
Ah - yea I dont think there's a way to automatically convert that
You could create some sort of mapping on the conversion system side which adds the appropriate Physics Shape component
Ah dang. But thanks!
The problem is that we want to define the colission filters, which we can only do on Physic Shapes components, as far as I'm aware.
Could ofc add a conversion system that did it, with a component to specify it, but would rather just convert it.
Why do you want the box collider if you're using physics shape?
I don't want the box colliders -_-
They do get converted just fine tho, but just can't set the colission filters
But we have a ton of objects that needs to be converted so probably going to write a converter
you could maybe try something like [UpdateInGroup(typeof(GameObjectAfterConversionGroup))] public class SetFilterSystem : GameObjectConversionSystem which runs after the initial conversion and sets the filters correctly?
@amber flicker Nice, good option. But don't always know what the filters should be, they need to be specified by the designer in some cases.
hmm then a custom component seems the way to go? Or possibly both solutions - add a component for when you want to specify
@amber flicker I'm too stubborn hehe. Converting all Colliders to Physics Shapes, it didn't take that much writing. If anyone searches and wants the script just ping me.
I think I didn't properly understand what you were trying to achieve but glad you sorted it ๐
Haha ๐ thanks for the suggestions tho!
I wanted BoxCollider compoenents to get removed, and add in a Physic Shape Authering component, with its settings set to match the box collider.
And vice verca for Sphere and MeshColliders etc..
Anyone know if DOTS 1.0 coming with 2019.3 in Jan or is that coming later ? Thx
One thing I am curious about is how the whole convert to entity thing works if you inect a gameobject. For example I was trying do something super basica aka a RTS style camera and wanted to do it in pure ECS but I have no clue how the heck I would identify the injected gameobject. According to the inspector it only has the default components of an entity so I dont know how to even start.
And in the entity debugger I cant see what systems act on a specific coponent or have acted on it previously
so I have no way to find out and I dont seem to find any documentaiton on the matter as well
i'm still waiting for that DOTS beginner project to come out this year
last I used DOTS, the HybridRenderer completely broke because I had 4096 gameobjects with Materials that were using Material Property Blocks
so hopefully that's fixed
It just to me feels too much is still obfuscated or at least badly communicated to make it practical to use
well it's not being done developed
there's been very little in the way of how to use it properly, and maybe because it's not done yet
Well the funny thins is they claimed a state less then what we have now was used to do megacity
so either they where crawling slow or that was an outright misinformation
I mean you can download megacity for yourself to see how they did it using what we have available now
You cant do something on that scale without having an established workflow as I see it
yep, you can do that, though it may not be easy to tell
Literally the entire project and all source is publicly available
Yeah I am not saying you can't do it, I am saying they do not communicate how anywhere
Sark the source does not tell you or let you deduce the workflow
I agree the documentation is horrible right now, but it's not fair to say that they misinformed us about what it's capable of
I also think that what docs are there are quite good.. just want to see more of it
@lament orbit
The idea is to test it for production viability no?
so no, it's not coming yet
Yes, everything available right now outside of base dots is in beta or alpha
Also I think you all might overestimate how much can be done till its production release date. The fundamentals wont change much till then. So best we can hope is better documentation.
I mean I would not still tinker with it if I would not care.
because I really want to use it as it progresses, but fear they are half baking this
And the fact that they fragmented the tutorial space with their approach does not help the matter
As I said last week I think the whole thing was made public a year too early
i'm personally v glad they made it available when they did
i think current docs are already pretty good at explaining the core principles, it doesn't make sense to document entire conversion workflow right now because they're still figuring that out
a couple weeks ago they made big changes to subscenes adding versioning and whatnot and not too long ago they added being able to add regular classes as components for example
I think only issue here is how they present things at Unite & GDC
it sets false expectations to people
yeah that was one major issue @dull copper
but having actual users using it as early as possible is great IMHO
Because right now pure ECS is simply not possible as I gather
this way they can correct the course in more agile ways
i don't think making things public too early is ever a bad thing unless you're talking about public perception
They even distinguished between the hybrid and pure approach in their early talks
The idea of pure is gone. Forget about it
then backpedalled to "hybrid is a 5 year thing"
and now they are finally maturing
They have been open that it was a mistake
sark if that is the case its dead on arrival for anything but major studios
i didn't realize pure was a mistake
I don't see why. They are trying to leverage all the work they've done with prefabs and gameobjects for edit time, then use entities at runtime for performance
It wasnt, it is just that production reality caught up to their overpromises
no pure is still recommended i think sark is talking about the conversion workflow which still uses gameobjects
It seems pretty reasonable to me. Right now the conversion workflow is horribly undocumented but it's coming slowly
but at runtime you'd still have a pure ecs game
because you loose the major benefits sark. If you have to reach in and out constantly the overhead eats up your gains
and then some
its not just the workflow that suffers there
authoring part completly aside if you have whole aspects that are non ECS that has to interact with the ECS part its non threadable or jobable for the most part
which eats any gains you might have had
If you're ignoring authoring then yeah I'm pretty sure their goal is to have everything at runtime be pure entities
the thing is you have a lot of current staff without any entity representation and that will not be done till it releases
they miss even some very fundamental parts on that let alone the more obscure things
yes the woes of basically making a new engine
Yeah, lots of stuff is still in the middle. Rendering in particular is really bad right now, the hybrid renderer is extremely limited
not just rendering. Stuff like lighting, input handling and much much more
lighting and input handling wouldn't be ecs anyway
heck even data transformation of anything that is not a base type
lighting is handled by srp and input handling is a seperate thing
which you can already use in ecs
and in data oriented design you basically throw away the concept of inheritance
forget it exists
scorr you can handle it but again you reach out doing so, loosing any ECS benefit. You have a reperesentation of it that does not gain the benefit
aka you morph what you have into an ECS pattern, but its not representing
yes, and it should not.
i don't even know how you'd make an ecs based input handler
ECS and monobehaviours are fundamental opposites and should at not point intersect
input handling isn't done with monobehaviours either afaik
the idea is you create a component with your input (e.g. motioninput that holds your axes) and populate it from your input handler which can be done from inside a system
I don't see what you would gain from trying to force input handling into ECS. You get your input in a reasonable way then inject it into your systems as needed
sark you would gain that you stay within one paradigm, and retain all benefits that ECS provides
and the srp's (for lighting) don't use monobehaviours either and can be used with ecs already
I am just baffled that something like a simple extension for monogame did a better job in a proper implementation of it.
Monogame extended has a full blown ECS implementation that works top to bottom
I did a prototype in it within a few hours compared to fighting against the mishmash
so use that?
nice just port that then if you still want to use unity
I think you miss the point. Yes I could just use that. My point is that I think that Unity could do far better then they did.
Perhaps it would help if you could give more explicit examples of what you're disappointed with Yuuki? I don't think anyone here feels like it's perfect but... Unity's approach to me seems fairly intuitive and they've explained why they've made certain decisions and most of the source is available to view too
yea sorry i didn't mean to sound dismissive
I won't be happy until something as basic (in my view) as the Rendering works as fully features as current Rendering does
the fact I had any difference in my materials meant the hybrid renderer couldn't group my entities into chunks properly, and I ended up having 1 entity per chunk
I am dissapointed primarily that they force an OOP system and an ECS system to interact which as I said reduces or outright negates the benefits. ECS is a wholly different pattern that does not mix and match well with OOP design principles.
they haven't been shy about trying to coax people away from OOP principles, but have been making a lot of concessions
So... you think they should.. replace everything at once? Or make monobehaviours incompatible with ECS or..?
@unborn totem while i do think there should be a seperate solution for "one-off" rendermeshes so they don't get allocated their own 16kb chunk, your instanced meshes shouldn't really be different at material level
if you want to change material properties you should be using materialpropertyblocks (which was only added support for a few weeks ago so i understand frustration there)
I would have prefered that they would have kept ECS segregated yes and develop it as they went along and at one point far down the lane they discontinue the old system yeah.
@hollow sorrel last time I checked, HybridRenderer did not support material property blocks
but if it was recently supported, awesome
i haven't touched ECS in months
just... don't look at it until 2022 is my recommendation... meanwhile some of us are getting good mileage out of it already and are happy to be involved in the early stages to help guide it
I would not be here and not tinkering with it if I dont believe in it. As much as I rant I like the system
damn, looks like it's only working in HDRP
shame, but I guess they are trying to make fancy looking demos first
I come from roguelikes where ECS pattern is nothing new so I might have had a bit too high expectations
@gusty comet the main focus is that you do not have to interact with OOP systems from ECS (unless you are talking about things like input handling which is different)
and the only reason you do right now is because not all systems are ready yet or you want to use old stuff
It would help immensly if they just improve the entity debugger, to show an entitys archetype and all its components especially for game objects that are converted and injected
do you have the dots editor package installed?
until you just mentioned it I was not even aware this existed I have to admit
that's definitely a problem at the moment - knowing things exist... but yea, check it out - it might help a little
it does help
i think that was how I realized every chunk contained 1 entity when I was trying out the HybridRenderer months ago
@unborn totem you may be referring to the entity debugger.. there's an additional package that shows previews of conversion of gameobjects just in case you weren't aware
It seems that only works if you use an authoring system to convert it?
ah so what it does require is being in a subscene I think
because it's then automatically being converted to that subscene's world
(and also the editor world)
you do need to use authoring for the dots inspector to work
That is indeed helpful since now I at least have an idea what I am actually looking at after conversion, much appreciated.
afaik you only need to use authoring in the sense that a monobehaviour will get removed unless it implements either IConvertGameObjectToEntity or the auto generate attribute - i.e. however you convert it, it should be displayed
Do we have any documentation on the built in components unity uses as to what they mean?
like the SceneTag and others? not afaik... I'd love some
I was just looking at the camera and saw some things where it seems to have some sort of odd referential data
i assume thats to differentiate entities to particular scenes for loading whole scenes in/out
yes... there's stuff to do with blobassets, scenes and sections within scenes
but, for example, it's hard to know what you should do if you want to create an additional entity beyond the one being converted
that is what I am trying to discern right now
As I have been on record saying, I love to poke at working stuff to see how it works
and I was hoping that I might could learn something by doing so
@amber flicker conversionSystem.CreateAdditionalEntity(gameObject);
that's one way yes
@dull copper thanks
about that entity preview thing
for me it broke again after I added netcode package
without it, it worked just fine
but I haven't tried with todays netcode update
btw it seems as though entities created with CreateAdditionalEntity don't actually save with the scene unless you manually add the SceneSection tag with the same values as on the main entity. That sounds wrong but it's what I observe. Have you seen anything similar @safe lintel ?
by save you mean once you close the scene and let it load in? either way, it gets auto added for me, and i create a number of them(but I do get a strange issue where attempting to add these entities to a linkedentitygroup doesnt appear to be working...)
yea, as in saving the scene and closing .. when I hit play the entity won't exist unless I add that component manually
I wonder if it's because I have to create it within the AfterConversion group
i havent got any special conversionsystems going for my current subscene entities so possibly
Unity Tiny was supposed to be the whole "ECS top to bottom" thing
starting with 2d
and then eventually integrate more features into it as more DOTS stuff is created
yet its basically been cancelled. They did 2d full ECS with javascript
then they scrapped the entire js stuff to do 2d with C#
removing like 80% of the features
and then they scrapped all the 2d stuff
and now it will be conversion workflow with simple 3d
the timeline of Tiny is extremelly dissapointing
Hey everyone, I was wondering how the update order works with multiple worlds.
Let's say we have World1 and World2 (created in that order in the bootstrap) with the same systems. Are all systems from W1 updated first then all the systems from W2 ? Or is it working with the SystemGroups ? I feel like it's something like flatening all systems existing in your project sorted with their groups (updateingroup, after, before) and then if a system exist in world1 and world2, it will be updated based on the world creation order.
Updating system groups I belive is currently a tree traversal, each group has a List<ComponentSystemBase> it calls Update() on
been a while since I looked at that part of code tho
and each world has its own instance of each system
Yeah they do have their own instance, but that doesn't explain in which order (or how) worlds are updated
I would assume, and treat, worlds as arbitrary order unless you specifically handle it
Internally systems use normal rules, as long as you've set them up corectly (no auto-setup in non-default worlds)
There is no way to custom update worlds at the moment
World has a public Update() method that just updates the 3 built-in groups, that doesn't fit your needs?
I know this is a bit of a dumb question but what exactly is the difference between Burst and IL2CPP?
Il2cpp is a compiler that turns any IL into C++ (that is then compiled by a cpp compiler)
@manic nebula IL2CPP is fully normal C#. Burst is a highly restricted C# subset that uses those restrictions to be much faster
Burst turns a rather strict subset of IL directly into a highly optimised machine code
whenever you can
and its only for jobs right?
There is a way to compile a delegate into a function pointer, but you'd have to search on how to exactly do that
the usual way is to burst-compile jobs, yes
ok got it
in the new JobComponentSystem you can do
Job.WithCode(()=>{/*code here will be turned into a job and burst-compiled*/}).Schedule(deps);
since i am comfortable with a very OOP system im sticking mostly with the traditional coding way but there were a few things that i think could get big performance gains from multithreading so i was just looking into using the c# job system at a fairly basic level
Yeah I was just looking at this method. I don't have a specific need, it's just curiosity.
It seems like this method is never called ? It's weird but this is used for updating the worlds then it answers my question about order
Yeah, the in-world order is just a tree traversal through all the groups. No clue how/in what order exactly the worlds are updated.
is there any word on Physx components becoming jobs compatible? ๐
(Rigidbody, Character Controller)
And actually that method would be quite useless if I trust the doc:
"There is currently no way to manually update every system in a given World; instead, you can control which systems are created in which World, and which of the existing system groups they should be added to. Thus, a custom WorldB could instantiate SystemX and SystemY, adding SystemX to the default Worldโs SimulationSystemGroup, and adding SystemY to the default Worldโs PresentationSystemGroup. These systems can order themselves relative to their group siblings as usual, and will be updated along with the corresponding group."
@dire frigate nah they're basically ditching physx for havok (and their own free implementation, but trying to sell you havok)
Oh... Well hopefully they bring out some more guides on howto interact and write your own character controller. Seen some of the examples on their git but it just looks overwhelming
yeah
typical way is doing collidercasts to check collisions which i think is also what their kinematic charactercontroller in samples does
but apparently kinematic bodies also generate collision events in new physics so i'm wondering if that can somehow be used for detecting collisions without having to do your own casts
only problem is i dunno how to get the collision data (e.g. how far penetration is) from the collision event
supposedly might be possible extracting it with IContactsJob but no clue how it all works
or if it's even worth doing
Guys, when I'm doing mesh.SetVertices with a NativeArray, and then later I'm calling Dispose(), am I disposing the part of the memory that was holding all of the vertices - meaning I'm disposing the vertices I've just set? Or is it actually creating a copy and then setting that copy?
no, SetVertices copies the data
Okay, I thought I was losing it lol, thanks
oh, yea, that was a facepalm moment when I've seen that
ehh, seems like the IL Postprocessing can crash your build even if you never use the Entities.ForEach :/
Let's say I have an Entity in an custom editor script, is there a way to display the entity inspector data like when I select an entity in the entity debugger? Either by displaying it as is, or by having a button I could click to select the entity in the entity debugger?
hey its easy as hell to follow
super simple code, mayority of it just ForEachs
most systems sub 100 lines
nice... as an aside.. I created a .buildpipeline... how do you actually.. use it? ๐
i.e. build using it
create the BuildSettings asset
its inspector has a button at the top
you can attach the pipeline in the ClassicBuildProfile section
oooooh thank you.. I created a BuildPipeline asset.. now that I've created a classic build settings asset instead/as well, I can see there's a build button
oo project tiny update
nice that it's now just regular unity with different packages instead of a seperate editor build
that tiny racing repo here: https://github.com/Unity-Technologies/ProjectTinySamples
And Windows Defender keeps insisting that bee.exe is malware... 95% chance it's false positive, 4.9% my machine is infected, 0.1% Joachim started phase 2 of his world dominance plan.
Ok, so that 4.9% is now gone.
what's bee.exe
the new build system
This program has potentially unwanted behavior.
sounds like normal unity
I posted about that on the forum thread
What is bee.exe? My antivirus is reporting it as suspicious.
Bee is our new build tool. It sometimes incorrectly gets flagged as suspicious. We will be signing it in a future release. The bee.exe shipped with 0.1.0-preview.4 of the DOTS runtime has a SHA-1 value of bac55f9250ffe1874e04a289f7ec21a004e6437a.
(cpp build system to be more specific, Tiny comes with full sources)
i wonder if using tiny you could embed a game within a regular unity game
Skyrim in all unity games.. lets do it!!
hhaaa
unity tiny game embedded in unity game sounds glorious
not sure if it's practical since at that point you could just make the tiny game in regular unity
but glorious nonetheless
playable ads has me recoiling so hard, but something like how they put wolfenstein in wolfenstein would be fantastic
is there a way to use unity.physics distance queries with non-uniform scale? distance queries only take rigid transforms as a parameter, which discard scale information
applying uniform scale to the new colliders isn't a problem, of course, but I'm failing to see how I could use non-uniform scales
hmmmm, that tiny racing didn't use Unity Physics at all, there's no physics queries for collisions etc, it's all manually checked
I hoped they had some simple text renderer so I could ditch my own...
While Unity.Physics should work, due to the lack of fixed-time updates, there are significant issues on platforms that cannot reach a high enough frame rate. Full robust support will be coming in a future release, at which point TinyRacing will be switched over to use Unity.Physics.
from docs
also lol @ material per number
sorry for hijacking the conversation about project tiny, that was a random question I interjected that wasn't related to the project tiny sample at all ๐
i would assume there isnt a way, seems like unity physics only uses a bare subset of what the transform system covers(to my own disappointment)
seems like a common use case tho
maybe a workaround could be making your own system that modifies collider size based on scale changes
dunno if that's feasible
I'm still amazed they haven't fixed the Unity Physics update loop
like if you use netcode package, they apparently have a workaround there
yea it's nuts, been what a year?
and interpolation too
but these things should rather be on the physics package IMO
Unity actually wanted Unity Physics to be released at this point
Q3 actually
but it wasn't realistic at all even when they set that target
yeah, I'd assume having scale work would be quite common... then again, non-uniform scaling seems to be a tricky issue to tackle, I've seen a couple of other bugs and known issues related to that in other projects.
I would be really surprised if Entities went 1.0 in 2020.1 too
writing a workaround that modifies size is currently what I'm aiming for, which would work well enough for boxes and meshes, but I don't see how it'd work for capsules and spheres
for 1.0, the core ecs, jobs and burst seems to work well and they can say conversion and the state of just about everything else isnt really part of the core
yup, if the versioning is anything to go by, 0.2.5-preview doesn't sound terribly close to release
(for physics)
With the addition of codegen there are so many bugs to be fixed now
tbh im a little more surprised that hdrp is coming out of preview than i would be if they said tomorrow ecs 1.0 is out
I had the codegen thing fail in at least 4 different ways since they released it, one of which I still don't have a workaround for
Then again depends on that they mean by "out of preview". Can just release with a huge list of known issues
Anybody has any explanations to as of why Megacity slows down my laptop so much that it's not workable? Apart from my lap specs being mediocre
19.1.14f version
profile it ๐
would assume its just too much for your laptops graphics card though
I'll try that, thanks!
Tho 4GB isn't enough to atleast run?
what are your laptops specs? 4gb is not much though, i wouldnt be comfortable developing on that
i5 7th Gen, ram 8gb and graphics 4gb and adrenalin.
Also, I don't exactly know what's profiling.. Is it like a button somewhere? 
oh i thought you meant 4gb ram not video ram, I misread that ๐คฆโโ๏ธ
window>analysis > profiler
That post about Tiny says 2D in January, I wonder if were getting a proper instanced renderer at last
@safe lintel one last thing, so after opening the profiler and trying to record, it just keeps loading forever. Am I doing something wrong or its just taking time
not really sure, it wouldnt take long to open
btw
if you look at that TinyRacing project, it's still using old DOTS Editor package which doesn't do entity previewing
it works once you update it manually with PM
ooookay, small update on the scale: scaling actually works. RigidTransform apparently implicitly takes scale into account if you feed it a Matrix4x4 with scale encoded. However, it seems that distance queries for box colliders don't work with any kind of scaling at all. Spheres and capsules work fine, (even with non-uniform scaling, apparently) but boxes are having difficulties even if only the other body has a scale other than ( 1, 1, 1)...
Hi all. Quick question. If I'm doing ECS with Jobs system, what's the replacement for EntityManager.exists() to check if something has been removed? That works at just using ComponentSystem, but of course doest work for jobs
You can use ComponentDataFromEntity.Exists inside jobs
@zenith wyvern will try, thanks
Now that they changed subscene, how would one go about loading a map into one of the worlds and not all?
well that was an interesting bug
had a system that was just creating a number of components, just setting ints on em... and if i changed my code somehow, saved, and hit play.. the first result would be expected (components with an int value set from 0 to 32). if i hit play again (and every time after) the components would be there, but the int would be 0 to -32.
putting a debug log in the job, after the first run, the job wasn't even running the job... it just magically created the components at negative ints
restarted unity, and it's fine now
@coarse turtle not only it is dots, its a great example of the simplicity dots brings now
now that generate-authoring-component and foreach exists
tho it has 1 flaw
look at the components folder
it has a fuck ton of files, one per component
and most components are a struct whose definition is less than 5 lines
unity needs to support generate-authoring-component on multiple per file ASAP
navigating 30 files is absurd
Would be nice to set a target file
The main reason I was waiting for [GenerateAuthoring] is I thought I could get rid of a folder full of XProxy.cs, all with a single line:
class XProxy : AuthoringFor<X>{}
The main problem not even being having a ton of files, or navigating them, but that adding a file means the .csproj is regenerated (2-3s wait in Unity), has to be reloaded in VS (another 2-3s), and on top of that usually breaks the "generate all .csproj" option so now you don't have all the package projects visible in VS
all that for something that should be just typing 3 lines in text editor
in all of my projects i have multiple components per file
allways
so in this case, you could have something like SmokeComponents, and it holds SmokeUpdate + SmokeSpawner comp
and then you have SplineComponents and it holds those.. etc
or hell, just 1 big TinyCarsComponents with all of them
Pretty much what I do (CardComponents.cs, MapComponents.cs, EffectComponents.cs and so on...). And I really hoped I wouldn't have to keep another Authoring file for each and every struct defined in them
Apparently an editor limitation, so wouldn't expect it to change until at least 2020.1, probably later
if they are already autogenerating the authoring component
why not put the generated code in another file
so you have your Stuffs.cs with 10 components, and it will create all the boilerplate in a temporal folder or something
@vagrant surge having multiple components in one file certainly sounds more data oriented. it keeps everything sequential in storage vs one file per component meaning possibly hundreds or thousands of tiny files bottlenecked by random IOPs and/or filesystem overhead.
lol that makes no sense. Thats only for compile time
Makes me wonder how many components a serious project could potentially have
in unity ecs, where its recomended you have tons of components....
easilly 100+
pushing 1000 on really complex projects
I dont think one can blanket state that. It depends on how generalizeable your game is
I have a NativeHashMap<int, int> with static data, generated in an editor script. I want to be able to associate entities (created through authoring) with that hashmap (i. e. at runtime, having an entity I want to get access to that hashmap)
The only way I can think of is:
- Serialize it to a ScriptableObject as a list of (key, value) pairs
- Attach that scriptable in the authoring
- Have a conversion system that takes those pairs and puts them in a blob asset, attach the BlobReference in a SourceDataComponent to the entity
- At runtime have a system that looks for SourceDataComponent, rebuilds the hashmap and attaches a HashmapIdx to the entity so I can do GetExistingSystem<HashmapCache>().GetHashmap(idx)
Please tell me there is a simpler way
wonder how Unity is going to mix their dots visual scripting with regular code dots
I mean we all know it'll generate c# code
but like, could you just author for example components with the visual scripting and code the systems in visual studio still?
if you can have some GUI for quickly doing and navigating the components, it doesn't matter if you have ton of them each in separate files
I'm having trouble imagining a GUI that would be better/quicker than a text file
(and iirc they did say they are working on lifting the one [GenerateAuthoring] per file restriction)
well, if you think about the component struct, it's just few variables there
it could be treated as simple asset where you setup/visualize these
since you do these a lot on DOTS, it would make sense to make it less tedious
even if it's just little extra work, it's still extra
What I mean is I can't really imagine a GUI that would be simpler than typing
[GenerateAuthoring]
struct GridPosition : IComponentData { public int2 Value; }
``` in an already existing file.
Visualisation (esp. at runtime) would be great, but I think it's a separate problem
for once, sure it's no biggie, but since you do this for everything, you still end up writing twice the amount you'd really need to make the thing vs what's absolutely needed if some tool understands this workflow
it's not a major issue
but I can see there being better ways to handle it
a button to scan the assembly and generate the missing authoring components? ๐ค
I could see some built-in tooling to treat ECS components as some separate data files which you could author with few button clicks
it's essentially what DOTS visual scripting needs to do anyway
but they'll probably embed the components somehow to the same file anyway
I actually havent used the GenerateAuthoring workflow yet
(and btw. referencing generated code from normal code is one of the major things I hated about Entitas. Rename a field in a component, run the codegen, 100 compiler errors)
wait, it wasn't fields, it was component names mostly. like if you had MyComponent, they generated all kinds of helpers like entity.hasMyComponent, entity.AddMyComponent() etc
When I think about it, the [GenerateAuthoring] has a similar problem, but with serialization instead of code references.
heh, I only now realized you can change values in your authoring component in playmode and it updates the entity in realtime
god, yeah i hated the code-gen in Entitas; i think it was the primary gripe looking around the internet.