#archived-dots
1 messages Β· Page 68 of 1
but only if you have a reference to the entity in question is the hole
so if I run this
GetComponentDataFromEntity<OverlordData>( true );```
will it find the entity I need? it's not throwing errors let me test
well im assuming in your case you need to know the entity to use GetComponentDataFromEntity
it has the dictionary square brackets for access[entitygoeshere]
it also has an Exists(Entity e) function to check if it's there
well, there's only one, but it gave me this
so the dictionary is [index, version], so we set or get those, and what would the sytax for getting the reference through the dictiorary be?
I thought it retruned smth lol
Ah that function will return a ComponentDataFromEntity<T> structure. The bool flag is only needed for readonly.
the ComponentDataFromEntity<T> structure works like a dictionary, where the entity is the key and the T component is the value.
Exists(Entity e) just checks if the version for the entity is still valid
oh its (Job)ComponentSystem.GetComponentDataFromEntity
so in my case
ComponentDataFromEntity<Projectile> ProjectileData = this.GetComponentDataFromEntity<Projectile>();
OH YEAH. Sorry, I'm at work and all my ECS projects are at home
i shouldve searched the github samples first π¬
otherwise i'd just drop a sample in there
yeah thanks @untold night & @light sage , was wondering why you were getting the manager as I thought it was something to be gotten from a componentgroup
@safe lintel ah, ok, just checked back in after messing with GetType(), thanks for the syntax
Yep, so I see some light. I need to make my bootstrapper a JobComponentSystem and not a the Monobehavior, and that opens up a lot more options
public EntityManager manager;
public int x;
public ComponentGroupArray<ShipData> entities;
//insert job and onupdatehere
var positionJob = new Simulate_Position()
{
x = GetEntities<ShipData>( )[0].hasMonopropellant
};```
this makes me happy
hmmm, just found something pretty interesting, you can use foreach in a burst job if you use a ref struct enumerator
I'm used to just grabbing the length of the array or such in question and using a for because I can just use the local for value for indexing purposes. But I did realize upon reading, I'm reallu lacking in for loops, and kindof just making small systems and using them as my loops instead. It would be better to have larger systems as to not have to go through the components as often I assume, unless, those components are needed elsewhere also, but breaking components down into just a few fields instead of my 6+ field components would make large systems more feasable. Is that accurate, larger systems being favourable?
that's a really good question, personally i'm not convinced splitting data up into such small pieces pays off if you have to spend a lot of time moving and massaging them, id love to read some benchmarks/comparisons anyone has done.
true, but I have some components that have a certain property that needs significantly more access than others, so for cases like that I think it's good because it frees any other properties that may have otherwise been clumped in that component to be used worry free by other systems, whole think is literally backwards though, sifting for you need instead of building it, ECS is wierd haha. It's like the two different kind of 3D printers, ECS is the wierd one the starts at the top
and I guess system size/component size is extremely dependant on exactly how my individual system-network is structured
very variable on a case by case basis
If the systems and components are too large it becomes exponentially more difficult to expand and grow your brainchild also. Smaller systems and components allow for scalibility without ripping apart big pieces of your earlier work. Something I'm coming to realize....scalibility is the only reason I wanted efficiency to begin with, but ECS seems hard to scale unless you have a good idea of what you're going for and good pseudocode from the outset
My last thought (sry if spam). Use smallest components possible to reduce the need to restructure all the time, and combine them towards the end of the project when the whole thing takes a solid form and dependencies, etc. are obvious and static
posted about FPS Sample update here https://forum.unity.com/threads/fps-sample-0-3-0-now-available.636883/ they got plenty of ECS updates as well
that's awesome news! I knew something new had to happen soon.
the whole EntityManager Add/Remove/Swap Component = key to seperating and merginging systems as needed epiphany I had^
Conceptually I'm there now, but in practice I might as well be working with the large hadron collider and window screens (the criss-crossed wire, kinda window screen, that was ambiguous)
wut it mean
all I want is to vaguely blame unity and suddenly somehow my game is really fast, AAA and automatically networked. Anything else is unacceptable x 1000
they still haven't made the mmo button yet, have they?
I think blame is an evolution over having a magic button, you know?
thinking ahead here
although I suppose today it'd be a Battle Royale button
basically mapping left trigger to blame and right trigger to whine, one can get unity into a state where at least something will coincidentially happen in the trek toward our own battle royales
Apex Complaining
I'd love it if Unity announced it made all decisions looking at arowx threads
it's april next month, make it count
+few days
I'd buy unity premium if it came with "UNITY ECS for Dummies"
that book I recommended yesterday? It basically IS Unity ECS for Dummies (except in C++ and it speaks about the problems in general)
at least, it's as close as were going to get without more project samples
maybe there's a pdf
that are mature and not going to break 2 months later
a better understanding of c# in general would help me a lot too in all honesty
been a long time since java. (Something won't work and I think it should, I admit to sometimes just sticking => and where/set/from/etcetera for about a minute with very little logical basis. My favorites are "this" and "base", lol
In js and python with their implicit conversion I was literally in the habit of writing chains of nested code like 20 layers deep....
I'm generating tile positions inside a burst job, how can I sync those added positions to a sync system?
Remove burst and spawn dummy tile entities through a barrier? Injection is gonna be deprecated so I'm meh about that. If I do that, what to do with processed tiles? I need to process only freshly added tiles so do I destroy processed ones? Or add a processed tag component?
Or am I supposed to add new positions to a temp queue and send that queue to a syncing job with that barrier method?
Or maybe there's something else?
I would switch to quads instead of sprites with ecs, but I know that's not the answer you're looking for
@light sage Uniity tilemap is already working great for me. Only 5 batches for a giant level.
I just need to set the tiles from the generated positions continuosly cause the generation never stops.
that's how my game works it was tilemap at first
but I could do a million quads with ECS
Yes, just let me write a whole ECS physics system and tile rendering just for this small usecase.
I mean yea, I was just starting, if you're already far into dev, then hybrid si the only option
but everything is going to be bottlenecked by the monobehavior, since your tiles are 1 unit I'm assuming, make a separate x and y component
and create and entity for each tile with both components
so you have two systems in parallel, one for each axis
a database an option? if not it will be tough getting that data back to the mono
I don't really need the tile entities besides getting them to spawn as real tiles into the tilemap.
Well, I also need to draw positonal gizmos for debug information.
yea, I need to do toggle features for debugging too
A database? That's an odd suggestion.
a tilemap is a grid, sql based DBs are grids, it just makes sense, but I'm looking into bitmapping
maybe four bits per unit, with base 4 that's a lot of options
Nah, have no need for that.
but we have very different needs for tile systems
Well, I guess using System.Task is an attractive option for me since my generation algo can't be parallel ford anyway.
this was with tiles before ecs
I couldn't get it to work with ECS in a satisfactory way, ended up with this, lol
but you sound like your doing standard sprite sheet, tile system kinda deal? like old school or more like "don't starve" or smth?
Well I just have an infinitely generated upwards world of interconnected platforms with some bonuses. That is, infinite when I make the generation async. I just have 1 base tile for platforms and that's it.
I gotcha, yea, I was ecstatic when I hit "infinity". I can fully understanding wanting tiles, trying to think
store references to their transforms and just use an extra invisible layer?
Tiles don't have transforms. They aren't even gameobjects.
that's right, I forget how strange tilemap was
The approach of spawning enitities with a position for the sync comoonent system to process will work. It's just that I read about people suggesting sharing a container between systems on a forum but no code.
as long as the container has a unique component type
and entity manager can add/remove/swap components
I didn't mean DynamicBuffer attached to an entity, I meant a NativeQueue etc allocated from a system.
this is where I deadended with that line of thought mysefl https://forum.unity.com/threads/nativearray-icomponentdata-and-blittables.534146/
with injection out, and no native arrays in components and no instanced data in jobs
gotta temp alloc them I guess, I never figured out best way to get them from one job to anther and back to a native array, am still working on that, no documentation sigh
If you put the same array to both jobs it'll all be the same array no?
just use one job, ijobprocesscomponentdata runs in parallel, so just split it's functionality maybe
you can process componentdata with entity maybe, and have it in isharedcomponentdata
I was referring to your previous message. I don't want to crash by calling Unity Api from a job π
yea, it's annoying but you can't grab objects instantiated outside unless you bring them in through the filters, maybe pointers, but I'm not familiar with intptr use in c#
would it be too much overhead to just delete the old tiles?
ik it's bad practice, but tiles are cheap, right?
look at the hashmap stuff maybe, I haven't learned it fully yet, but it's a good option I think
reading from arrays is linear, ECS shines with Icomponent use, even en masse from my experience thus far
I know batching can read arrays dynamically, but
@light sage read my original message, deleting processed tile entities is exactly what I suggested π
ah ok then, I assumed you wanted to save and reuse them, I'm a hoarder sry
if your doing 1 tile = 1 unit, you can use int[] honestly, it's not much difference performance wise
unless it's like ridiculous amounts and speed
No, I don't care about them at all besides creating a real tile there. I already store them in a Hashmap for collision querying in generation.
you can get all entities from an entity manager
I know how to do what I suggested, I just wanted a betyer option.
but thae job is world differed though huh
keep us updated?
I need the info just as badly
lol
Heh. I'll keep trying tomorrow.
cool, I think IComponents for the axes, but nice bouncing thoughts banter :p
Hey guys! Question -- is there currently a solution for collisions / hitboxes that works nicely with ECS?
@queen belfry well the fps sample just got updated with some basic stuff that could be a good solution
Perfect! Thanks. I'll take a look.
"HitCollision no longer uses Unity collision system for queries against moving colliders. For lag compensation server needs to do queries using different historical data and moving Unity physics colliders multiple times per frame is very inefficient. Now queries are handled using custom collision primitives and burst jobs. The structure of the collider and history data is still WIP." https://forum.unity.com/threads/fps-sample-0-3-0-now-available.636883/
and moving Unity physics colliders multiple times per frame is very inefficient.
I do wonder if the eventual ECS-supported physics will not require the equivalent of "SyncTransforms" before every physics run. It's kind of nightmarish to reverse history like that while using Unity collision. Explicitly, you can't evaluate multiple histories in parallel...
I'm stupid...
zi thought the types for the jobs were exclusive,
whereas they're actually inclusive....
sigh knew something wasn't right
well....now at least I can develop 1000x as fast, feel stupid, but Iit's just a bunch of functions
must have gotten confused at the start when the first video I watched was talking about subtractive components
oh dear. yeah I can see how that might be confusing if you hadn't been looking at the concepts before
Finally they are doing the cleanup! π its been a confusing mess lately with lots of out-of-date samples and new people learning from them and using Inject
(I think the reason I assumed the parameters were exclusive ratehr than inclusive was because of the position component. When I use "ShipPosition" and "Position" as parameters, only the ship's position is altered, so I saw it as the "ShipPosition" ComponentData field excluding any enity without that Component) ok, duh, they are exclusive, but to the entity, and not the job....
So being that they deprecated all the APIs I didn't use, and the fact that this is basically python now mean's all my frustration is finally lifted
Tilemap collider regeneration takes a long time even if I sync only 2 blocks per frame π© Guess I can't use it for continuous generation during gameplay huh.
What was that about ECS tilemap again? π
And I'll have to write a jobified physics system as well..
yea, that's a lot of ms
And then there'll be AI, heck.
I'm brand new to this, isn't rendering time of 16ms/frame the goal
Yes. Tilemap collider regen drops the frames more and more as more tiles are added.
ah
I just added scroll wheel functionality and added an occlusion type job that changes the grid size based on width/height, now I have to sync it up to different aspect ratios
Why can't you just change the orthographic size of the camera to zoom out?
that's what I do, but I don't want to be rendering quads that are outside of the viewport
I have a mirror, I'm either going to finish this and use it, or just alter the ships z-axis for zooming and leave the asteroid things alone
and I'm using perspective camera (for when I finally add the mouse drag and skybox rotating stuff, I'm going to need perspective lines when I add polyhedrons for the stars or w/e)
@light sage so do you just DrawMeshInstancedIndirect your tiles?
they're quads, not tiles, I swapped a while back
Cirles, pegs, you have things on a grid, yes?
It's an imaginary grid, not tilemap grid
I'm not talking about the tilemap package anymore.
I just create an entity for each one and give it RenderMesh as a Component
RenderMesh takes a property for Material and Mesh
So that'd work for a crapton of tiles?
yea, when I had it 2d, I created 1,000,000 quads, each 1x1 unit
Does it do culling?
Cool.
@gusty comet only things I don't like ECS for is something like
cam.fieldOfView += Input.mouseScrollDelta.y;```
and OnGUI(), everything else, ECS all the way
Should be simple to do in a ForEach from ComponentSystem π€
.. OnUpdate()
{
ForEach((Entity entity, Camera camera) => { // We did it! });
}```
yea, that's a good idea, I like the new unity.Position a lot though, since it can be in IComponentData
I like how hands off non job component system is.
@light sage have you compared perfomance with IL2CPP vs Mono? Or it doesn't matter when most of code is Burst compiled?
It's hard to tell, I dropped an fps meter on but since I have so little overhead thusfar I was at stable 60fps with both. My stresstests have mostly been limited to editor, but I would say il2CPP would perform better for most games if I had to guess. You need a link.xml file to compile it though, at least I did, otherwise it can strip textures
you just drop this in Assets
Huh. I'll keep this in mind if I try il2cpp.
mono build is fine though, il2cpp is a headache, like you can't make a mac build unless you're using a mac, I guess because of the different c++ headers and source
@gusty comet Even on my crap[py PC in the Editor with OBS and 40 chrome tabs Open it can handle tons and tons of them without a hitch, but the collision testing that you're doing, I can see where that could be a huge problem. Any way to limit the scope of where you're testing for collisions?
@light sage I'm not testing a lot of collisions. It's just that when Unity tilemap is updated, its composite collider is fully regenerated from a bunch of disjointed blocks into whole polygon shapes.
Which takes more and more time the more tiles you have.
you are using Unity.Mathematics.mathnoise right?
math.noise*
if you're trying to do random stuff and not using the new math packet noise methods (there are like 50 noise methods) you're going to have waaaaaay mroe overhead and waay less entropy
a1 = noise.snoise( a2 );
a2 = noise.snoise( a1 );```
that generates sooo much noise it's ridic
just use a float 3 to set it up, then you can grab or x,y from either of those floats
random is not deterministic so with ECS you're better off performance wise going with one of the mathematics noise
are they grabbing fluctuations off the hardware hippocoder?
where do they get their entropy
gotcha
their just so lightweight that it's like I don't even have them in the code
zero ms difference with or w/o ~
@urban rivet random is usually pretty deterministic if you provide the seed tho
and even more so once burst compilation gets determinism implemented
which btw, brings up another question, is Unity planning to give us Burst support outside jobs soon?
because I can't imagine people would run all their math code only in jobs
and right now you need jobs for Burst and Burst is needed for the determinism thing
would expect Unity to at least implement Burst support for ForEach as it would seem likely candidate for SIMD / vectorization
I don't see a reason not to use jobs when for anything other than GUI, camera, maybe some input, is there a good reason to not use them when you're able too?
@light sage not every bit of code need to run in jobs
Have only health for player? Why jobify it
yea, I'm trying to work out how to integrate my gameclock, network stuff, gui stuff, etc. with the mono without bad asynch
There are lots of small things you'd do basic math for that dont need jobs
I like the compartmentalizaton of the Components, and the jobs can talk with each other, and most of them share moving parts so it's best to keep most of my stuff in ijobs right now
also I'm using the new math library and burst with most of my current work
can do millions of these, just have to work on the bad asynch
but I'll have "scenes" for the menu, and launcher and stations etc
and just drop dump those scenes and grab them when needed scenes since the garbage collector sucks
I need a good way to get back to universal (0,0,0) also
wanted to just simulate movement using the background to begin with, read it was bad, but now all I can think is rotate like 1 degree every for steps to circle 0,0,0 but that's a a big wrench in my plan if I have to do that
need ideas badly!
One posibility I'm thinking is using an additional cameral and buffering everything at a certain point, this is going to be a tough one
on the GC front, 2019.1 is introducing a new collector option that runs it over multiple frame.
Doesn't get rid of allocations but it does smooth the spikes
if you're using LWRP, they got rid of camera stacking and are replacing it with some kind of callback / interface replacement. I think they're still nailing that down and they will have examples sometime after GDC
nice, I want to look into that for sure. For a first project I'm giving myself 6 months for an alpha and calling it at that point, hopefully there's enough info for me to come to a decision on that
adn I have LWRP, I haven't applied it to the build yet though. Need to make a few mirrors for that and asset addresser testing
Unity.Transforms.PositionProxy() is something I probably need to go ahead and integrate
since ECS iterates through entities seperately I think the triggering an job that grabs everything with a Position attribute, and using an appropriate deltaTime, (probably a library to grab system diagnostics somewhere else to work with it) and just do a slow rotate based on velocity, and if not a slow rotate (because it's 3d, and I don't neep players tetering on the "borderline" at slow speeds rotating over and over iwhich could happen) , then a buffer and transform system to activate as worst case scenario.
I think it's better to just have the right system, so you have all these entities with component data, but the filters will process some with deltatime some without, sepending on what systems you are using... ECS tends to go bad when you fight it
ideally the best pattern is when ECS doesn't require external memory fetches during
or get that data prepared beforehand
Hi guys, the documentation say that we should split the game between, for example, a rendering world and a simulation world. One of the reason is probably to optimize chunk size, but what do you do when the simulation trigger a change in the rendering? Entity reference isn't a good option because serialize/deserialize or even moving entities is gonna patch them without the other word noticing (especially if you just serialized them). Should I try to filter my entities in the rendering world in a system just for that with a filter that allow the simulation world to refer to it easily?
What is the nature of the rendering change, first?
filter is your first port of call, as it's the simplest native option, followed by exotics... it's a good idea to share your problem on the ECS forum as staff and even the CTO of unity may respond to you there. Here, not so likely.
Discord is for the easier quickfire things
Unity wants examples that cause you problems in ECS so they can fix it for you
Copy that, I guess I'll see with them directly then π
For this use case, well it's a procedurally generated game (each mesh is unique) so the player can come and modify meshes. Or some events could come to modify them.
But I think that an EntityMultiWorldSystem with a simple ID and some array to make the links is a good option here ^^
It's not like every entity will be multiworld obviously
id actually like to know more about that, too. i assume the premise is to run a relatively low simulation tickrate, and at the end of each simulation tick, move any entity that needs interpolated into the rendering world and update its position to the interpolated one each rendered frame until you need to do another one. copy the entities back to the simulation and set their position to the last simulated position.
it is pretty quick to move entities between worlds in my experience
@manic aurora That would depend of your use case but moving entities still mean memmove with some overhead and patching entities. My design split worlds into set of archetype that aren't too big. Because it's more cache friendly, because the streaming logic is going to be different (especially true if we speak about the rendering and anything else), and anyway grouping systems into separated world is a bit more organized than having archetypes with 20 components or whatever ^^ Obviously communication between world must remain event driven, otherwise worlds shouldn't have been separated in the first place.
yeah fwiw in practice i DON'T move my entities between worlds, my simulation is pretty lightweight
And I'll still need "pool" worlds to load and unload entities ^^
Huh ... Is a Nullable<T> never blittable ?
Its just a struct with a bool and my value, why not ?
right now, bools don't count as blittable
They're working on fixing it, but there are fixes out there, search for 'blittable bool' on the forums of 'unity ecs blittable bool' in general and you should probably find something.
As for why, some technical reasons. You could always just make a wrapper for a byte, though.
you can also use old bool1 from older ECS version on newer ECS versions (but those blittable bools on the forum are probably better pick atm)
Unity.Mathemathics.bool2 seems to internally use actual bools with [MarshalAs(UnmanagedType.U1)] annotated in the latest version of Unity.Entities
I wonder if that'd work too .. ?
(Nope, it doesn't)
generics are managed types, so they are not blittable
(which is really quite annoying)
Was considereing when I used to play EVE and remembered that it doesn't really allow free flight (you can bookmark between warps), but it forces orbits. KSP on the other hand locks the ship at origin and moves the world. That's the dichotomy between the multiplayer and single player approaches. I think orbital mechanics can solve my floating point issue. Any chance that ECS will allow double point precision for it's Position component? (yea iirc, EVE is just linear trajectories, and orbital maneuvars, with no gravity, and ony the most insignificant amount of collision testing)
It struck me a couple days ago, but if you have a sim/render split, you could sim with doubles and render with a floating origin.
I mean, you could even without the split, but with the split would be more ideal?
@tawdry tree this is what star citizen does
@tawdry tree I made a floating origin system with ECS which resets the player position every 500m. Now I can fly thousends of kilometers without camera jitter.
Nice. Considered putting that system on a Git or something? Sounds like it might be useful to the community, both as an example of ECS and of floating origin.
yes, when it is ready I can post it somewhere.
rebasing the world isn't super complex itself, having everything else on the game engine to play nice with it is the real trouble
if game can use pure ECS, it's a whole lot easier though
Here is the script I used as a starting point.
http://wiki.unity3d.com/index.php?title=Floating_Origin
writing code in ECS is much more intuitive than OOP
Sorta? It's a mindset kinda thing. If you're used to OOP and haven't done ECS, then you're gonna need to learn. From knowing neither...
I think OOP is easier to learn and get to the point where you 'understand' it (this is an object; a thing. it does stuff, has stuff, and is stuff).
On the other hand, after the initial learning bump, I think intuition about ECS should be closer to good/best practice without specifically learning about it.
does scheduling an IJobProcessComponentDataWithEntity using ScheduleGroup while having .SetFilterChanged set on the group actually work? i can't get it to, but the equivalent code using chunk iteration and chunk.DidChange() works fine...
hrm. ok. if i modify ComponentGroup.cs to expose SetFilterChangedRequiredVersion and call it manually with the LastSystemVersion it works fine, but that's a pretty undesirable solution! seems like SFCRV doesn't get called on its own.
I'm just too use to OOP, I'd love learning ECS but with some things I don't seem a good design with ECS
For example my Messaging system, I can do in OOP a message with its data and when receiving it through network apply its behaviour
But in ECS I don't see a clear way through that
In my understanding, you 1: Shouldn't need a messaging system if design well enough and 2: you can just spawn a message entity which the other system uses. If you need it to be consumed by multiple systems, then, uh, make a separate system that runs after everything else and then destroys it?
I'm using Unet so I use the MessageSystem
Instead of Command and RPCs
But hummm yes, a message entity, I'm still learning the base of ECS
I've started programming with Assembly 8 years ago, OOP 6 years with Java so changing to ECS is breaking a lot xD
And one last question, is Unity ECS production ready? Because it's still in preview packages and unity always say that never use preview packages in production
WTF, starting coding in assembly? What kinda spartan fucking training did you go through?
The answer to that question is officially no, but https://forum.unity.com/threads/unity-ecs-and-job-system-in-production.561229/
not that unusual. my first programming was in z80 assembly when i was 13
awful
Which was how long ago?
early 80s ;p
Back in the 1920s π
assembly is still a valid language
Yes, but why in the world would you subject yourself (or others) to that?
By now it's extremely niche
granted there's so many high level languages now, i don't really use it anymore except to tweak things i don't have source for ;p
^
but you have to start somewhere
In Telecommunications Engineering here we start from bottom then go top
Also use it in some hex dumps
and in other sides for profiling code
Assembly -> C -> Java / C++
C and C++ is already what I would consider low-level, if you go below that you're basically (in my view) working with machine code, or might as well.
I went Java->C and C#-> C++ in school (1st year, 2nd year 1st semester, 2nd year 2nd semester) and have later picked up Python and JS (and TS)
I've started with C# on summer of my first course around 2011 with unity and I can say it's my favorite language xD
Two roads diverged in a wood and I - I took the one less traveled by, and that has made all the difference. - Robert Frost
Isn't that the poem which is supposedly ironic? There's some contention, at least.
yes ^.^
i was curious if someone would know that
The poem isnβt a salute to can-do individualism; itβs a commentary on the self-deception we practice when constructing the story of our own lives.
but i think art like poems can be interpreted by the reader how they want. that's part of what makes art, art.
C++ is my favourite
I dislike C++. Not enough to top out over Javascript(f*** Javascript), but header files and the amount of (forced) management, ugh. I suspect it would either fade or get worse (Javascript(f*** Javascript) hate contender?) if I worked with it more than the half a year I've barely touched it so far.
C++ is cool for how much performance you can get
But some things are horrible
All the things you need to take care of (copy constructor, cycle composition etc..)
It's a pain in the ass
Thing is, you can get that performance in other languages too (as they make a point of in the ECS talks - in one benchmark they even get better results with C#). I much prefer being able to avoid that hassle and the option of squeezing out more performance at the cost of bringing hassle back.
I really should learn ECS for our RTS game
Hmmm.... anyone had any idea why an Entity created on a Mono wouldn't be drawing with batch renderer, but if the same code (literally copy paste) is located on a ComponentSystem it will be rendered correctly?
@gusty comet I was asking about this last night, I'm glad you're working on tackling that issue, since I didn't want to refactor my whole 10,000 plus lines into an origin-centric model. I'm very satisfied with ECS, and just threw some sloppy code to make efficient later inside today so that it felt more like a game, and I'm just Using the basic "OnGUI()" stuff in my one mono. Two questions fro today. What lines of thought should I consider on making the GUI more efficient (right now I just have one system called GuiRelaySystem that does a pass over relevaant components and dumps the data to the mono to deal with. I saw EntityGuid or similar, but haven't picked it apart yet. After a lot of thought I've decided to go with a sigle player model since ECS is modular to the point of a future fork being quite simple, but my main question is whar is the best option for a DB, both for persistent data such as item profiles, locale layouts, save state, etc etc. I can't move on with any production at this point until I come to a decision on that. I had problems with SQLite before, but they may have been user end issues. so JSON or SQLite or is there a better solution? Sorry for the flood, thanks in advance!
@soft nova all of my entities (100,000) are created in my mono, and they are all processed in at most 13-14 batches of hundred each, is GPU instancing checked?
Yes it's checked, it is even calling the batching rendering on the RenderBatch function, but they are not batched.
IJobProcessComponentData?
??
was just wondering what type of job you are using are a struct template. 99% of my entities are as as basic as it gets, so idk, I'm sure you looks at this criteria already, but may be helpful https://docs.unity3d.com/Manual/DrawCallBatching.html? But I don't think it's the mono, as mine are born there, and I don't create additional worlds, only the default and automatically created differed
I never said anything about a job. The RenderMeshSystem batches them if I create them on a ComponentSystem, but if I create them on a Mono the system does use the batching method for drawing, but they are not batched.
this is a one time or only periodic load? Yea, the mono should batch on load regardless idk as with most specific questions, it's difficult to deduce without source to pile over, I've had to create toggle features and use process of elimation while scouring forums a lot with ecs
Database solution though, that's something I have to decide (need insight) mch thx, don't want to go with the wrong choice there, and I'll look at my stack Rotary, see if I can gleen anything
Alright, for now I'll have to create the entity on the mono, but let the ComponentSystem attach the renderer since that's the only way to make them be batched. I'll check on other version and project, perhaps something is broken on mine
@soft nova All I can really pull from the stacktrace is that a lot of JIT compilation is happening at the draw. I'm adding the position, rendermesh and one other component first, then I'm setting the data for each of those with the rendermesh data being the only static data. And this is all simply within a function called by awake() in nested for loops
@soft nova Also, I don't know your version, but this is labled RenderMeshV2 in the debugger, it's the latest repo I thinks
RenderMeshV2 is 2019.1+ only. It has a preprocessor directive for that
v2?
ooo, new ECS stuff on staging
com.unity.entities@0.0.12-preview.26
com.unity.rendering.hybrid@0.0.1-preview6
here's the whole new latest set:
{
"registry": "https://staging-packages.unity.com",
"dependencies": {
"com.unity.burst": "0.2.4-preview.50",
"com.unity.collections": "0.0.9-preview.13",
"com.unity.entities": "0.0.12-preview.26",
"com.unity.jobs": "0.0.7-preview.7",
"com.unity.mathematics": "1.0.0-preview.1",
"com.unity.rendering.hybrid": "0.0.1-preview.6",
"com.unity.test-framework.performance": "1.0.4-preview",```
the last is new, no??
on 2019.2.0a6 I still get this: Library\PackageCache\com.unity.entities@0.0.12-preview.26\Unity.Scenes.Editor\SubSceneTransformHierarchyHook.cs(31,16): error CS0246: The type or namespace name 'SceneHierarchyHooks' could not be found (are you missing a using directive or an assembly reference?) so it's likely still missing some API change from Unity side
and what could they possibly add to the mathematics library xD
test framework was requirement for previous entities packages, I dunno if they still need it
and for math lib, that's kinda silly statement considering that math lib is still in preview and they keep constantly adjusting it for Burst + users needs
it's way simplified lib in comparison to the old unity math lib
does you error point to an assembly directive?
I'm still on 2019.1.* I was hesitant to switch before hearing reports
I'm more algebreically inclined, I wrote thi for velocity, but though the math lib should have something better
math.sqrt(math.mul( rVel.rel_velocityX , rVel.rel_velocityX ) + math.mul( rVel.rel_velocityY , rVel.rel_velocityY ));```
I lost my focus somewhere amidst the quaterion section
Couldn't use ^ in a job, nor found a squaring function in the lib
you mean math.pow()?
oof, thx (I get sidetracked in there parsing the shuffl and select stuff, the matrice stuff, and end up just overlooking I guess, I think also I was focused on finding a pythagoreom function specifically)
There's also math.length(), so you can pretty much save all of that
hmm, I'll look at it's params, thx Life
hmmm, made local diffs for the new entities packages, Entities 0.0.12-preview.25 is where it's at, .26 only got one line fix for one test
this new entities package got some weird stuff, like mathematics lib extension for Hybrid Renderer
why on earth did they put this on Entities package instead of hybrid renderer
I'm guessing it's here because they did math extensions for regular Entities package too here
but still odd
bacthing determination exclusive to entities?
the dot() function is what I needed to understand, this helps a lot with getting the math lib
Apparently there's a new parent system on Unity.Transforms now
I really wish we got patch notes
and yeah, they put Unity.Transforms.Hybrid here too
so I guess it's this is why that math lib extension is there
as they haven't split Unity.Transforms into two
we need a persisten data store inherit functionality
ugh, since I can't make progress on any other major hurdle I guess it's high time to implement the zed axis (gonna need a mirror or two or this is will be a mess)
hmmmm, this is really weird
they just bumped up Rendering.Hybrid package number but did ZERO changes
(that's from my local git diff with this package)
@solar spire yeah, it does suck that the changelog thing goes to separate samples repo
still need to wait for Unity to approve these before they update that :/
ok so, they moved the AABB classes from Hybrid Renderer and put those back now to Entities package π
So you couldn't roatet skyboxes before ECS, but I'm thinking just add a rotation component to my skybox should work fine?
these things now live in that Unity.Transforms.Hybrid
I'm guessing Unity will eventually split the transforms thing into separate package too
there's now FrozenStaticRendererSystem and FreezeStaticLODObjects system on Hybrid
they also made Hybrid min requirement to be 2019.1 which isn't surprising
I would enjoy reading blogs about changes they make and why - it's been good hearing about the reasoning behind depreciation and I wish we got that sort of thing more regularly
I would lap up descriptive patch notes π
Or a comprehensive API
they'd have less to talk about on upcoming events if they did that :p
we are ahead of the game at least
API is always rapidly evolving on big new things like this
they already kinda have documentation for current setup on the samples github repo
but wouldn't expect tutorial like things before the first stable version is out
I've developed a system of random places and can generally find what I need now
I just never got to view the examples on the github, only the boids was there when I started dev (and the cubes)
you'd want to check at least the changelog
as it gives instructions on project upgrades when moving from package version to another
I mean "upgrade guide" on this doc: https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/master/ReleaseNotes.md
Yea, componentdataproxy threw me for a second
thx
but when I open the page, it says this on top:
I'm guessing that's the first commit it appeared in?
I never paid attention to this before
weird, yea, looks like the cache isn't updating
no idea, so I'll just blame the dom in general
Looks like 17 minutes ago, they push more samples.
nice
New Features
- Added ComponentGroup versions of AddChunkComponentData, RemoveChunkComponentData and AddSharedComponentData. Also optimized the ComponentGroup versions of AddComponent and RemoveComponent. These can now be used to add and remove components to all the chunks/entities in an ComponentGroup. For components that don't change the layout of chunks (Tag, Shared and Chunk components) these functions will take an optimized path that migrates the chunks to new archetypes without copying the component data.
- Added new transform-related components as part of redesign (in progress)
- CompositeRotation
- PreRotation
- PreRotationEulerXYZβ¦ZYX
- RotationEulerXYZβ¦ZYX
- RotationPivot
- RotationPivotTranslation
- CompositeScale
- Scale (now for uniform scale)
- ScalePivot
- ScalePivotTranslation```
Changes
- 2018.3 support has been dropped. Please ensure you are on 2019.1+ if you want to keep getting new updates
- BarrierSystem renamed to EntityCommandBufferSystem
- Subtractive renamed to Exclude
[RequireSubtractiveComponent] renamed to [ExcludeComponent]
- ComponentType.Create renamed to ComponentType.ReadWrite
- Transform-related component names changes
Position->Translation
Scale->NonUniformScale
- Attach, Attached components removed. (No transform hierarchy)
- ComponentDataArray, BufferArray, SharedComponentDataArray, and EntityArray have been deprecated. Please use ForEach, IJobProcessComponentData, IJobChunk, and ComponentGroup APIs to access component data.
- [Inject] has been deprecated. See the Injection documentation for more information.
- Component system update ordering is now hierarchical. A forthcoming document will cover this feature in detail. Key changes:
Added ComponentSystemGroup class, representing a group of systems (and system groups) to update in a fixed order.
The following ComponentSystemGroups are added to the Unity player loop by default:
InitializationSystemGroup (in the Initialization phase)
SimulationSystemGroup (in the FixedUpdate phase)
PresentationSystemGroup (in the Update phase)
Each of the default system groups contains a pair of BarrierSystems which run at the beginning and end of that group (e.g. EndSimulationBarrier).
EndFrameBarrier has been removed; use the End barrier in the appropriate system group instead.
Use [UpdateInGroup] to specify which ComponentSystemGroup a system should be added to during default world initialization.
If omitted, systems are added to the SimulationSystemGroup by default (and will thus update during the FixedUpdate phase).
Built-in ECS systems have been pre-assigned to the appropriate groups.
Use [UpdateBefore] and [UpdateAfter] to specify relative ordering of systems within their common ComponentSystemGroup.
Ordering relative to systems in different system groups is implicit from the group hierarchy; explicitly specifying this ordering triggers a warning and will be ignored.
Added ICustomBootstrap interface to allow applications to partially/fully override the default world initialization process, support multiple Worlds, etc.
- MoveEntitiesFrom no longer remaps Entity references.```
[RequireSubtractiveComponent] renamed to [ExcludeComponent]
makes so much more sense
I just looked through Rendering.Hybrid changes and they actually removed [Inject] from it on preview.5 π
Fixes
- Fixed bug causing incorrect read dependency error on Unity.Entities.Entity
- ComponentSystem.GetComponentGroup(...) will no longer treat two queries with the same component types and access modes, but in a different order as different groups.```
What was the real use for attach? Seems like they removed that too
hmmmm, those ECS samples run on project that's marked to be 2019.1.0b4
but newer 2019.2.0a6 doesn't have the required API yet, I would have suspected 2019.1 to require at least upcoming b5 at least as well
renames BarrierSystem and then uses BarrierSystem throughout the rest of the change log
hmmm, I don't get the errors on 2019.1.0b4
I guess current 2019.2 alpha's API is more outdated then, despite the 2019.2.0a6 being newer release than 2019.1.0b4
oh
this is new
that's monobehavior script you can attach to your gameobject
you do good and fast work
this basically lets you setup the thing in GO but immediately convert to entity, meaning you can still use the old editor but not have to rely on GameObjectEntity that exists on both sides (traditional unity scene and ECS world)
what's nice about this is that it also converts the child gameobjects and automatically sets the parent relations on entities
this is great as I've been wondering how I should do exactly this myself
(how to convert gameobject hierarchy to entities so I don't have to do manual setup for it)
this is actually now covered on first HelloECS example scene, they have two cubes as gameobjects, other is child of another and they only attach rotation component to the parent + that conversion script
when this runs, it converts both cubes and their mesh renderers to entities counterparts, destroys the now obsolete gameobjects and the new entities still hold the same transform hierarchy (child still rotates automatically despite there's no rotation script on it directly, it just follows the parents rotation)
anyway, new HelloECS samples looked good and simple, I like that they redid these
the old samples were really hard to figure out (especially what belongs to what when you start out)
oh, nice, Joachim made a big forum post about the new things:
https://forum.unity.com/threads/new-subscene-converttoentity-workflows.638785/
ConvertToEntity is great for getting started in a simple scene and see the conversion workflow doing it's thing, but it doesn't help with improving load times. SubScenes do. Essentially when saving the scene, we also write out a cached entity binary representation. SubScenes is what allowed the megacity to scale, since we only ever load the game object representation for editing a specific part of the world:
oh, you need to hit "Rebuild Entity Cache" button to get the subscenes running on 2019.1.0b4
it does work after that
Of course I finally get my input buffering working last night and now new changes to upgrade to!
What kind of things your input buffering is relying on ? This update is mainly deprecating Injection, adding a few things for subscenes and hybrid conversion and minor changes to transform system
Found my issue, in case that anyone is wondering. I was assigning the RenderMesh data as following: EntityManager.SetSharedComponentData(entity, new RenderMesh{ ... }); which worked fine before since I wasn't using multiple objects with the same RenderMesh. Now I'm just using a cached RenderMesh for all the entities that share the same properties and batching is fully working.
Im sad that "- Attach, Attached components removed. (No transform hierarchy)" happened
Im hoping we get a replacement for it at least around GDC time
what you mean?
you need something other than the transform parent system they have there now?
Did they introduce a new system recently?
well, HelloECS samples demonstrate how parent rotates the child entity
Ah ok then that is new
As long as it applies the transforms down the chain then it serves my purpose
IE: rotate the root, it rotates all children
yes, that's what it does
check these and their readme's out in the editor: https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/Samples/Assets/HelloECS
should be obvious how it works after that
Ah they added a few more
They only had 3 when they initially changed to the HelloCube
yeah
This is good to see
I guess these samples don't talk about the parent thing but the ConvertToEntity sets these automatically when converting from gameobject hierarchy to entities
Their samples have improved DRAMATICALLY for how they present them
This makes me happy π
yeah, I really dig the direction
the first ECS samples were a huge mess, I didn't even know where to start deciphering what belonged to what
I always use their Tests way more than their samples
Like for example the "new" transform system can be understood very easily by looking at Unity.Transform.Tests
For updating your current project you just have to replace Attach with Parent (we already had that component but it was redundant)
The only problem with that is that the tests are rather vast π
Too large of scope
Useful if you are exploring but not necessarily for all cases
Well written tests are great documentation, though if they have high coverage there will be a lot to go through...
So with this Parent component you don't need to create a new entity, jsut set that to the child entity then?
Sounds like it works exactly like parenting a traditional GO
Am I understanding this correctly? the new entity update doesnt update the Translation Component(previously Position) if you are using the copyFromGameObject and only the LocalToWorld by design?
im supposed to use the 4x4matrix in LocalToWorld for my positional queries?
You could also use Translation but IMO LocalToWorld could be used for any use-case
Notes for the folks at home:
- If you used the old Scale Component, it's now a uniform scale. If you need all 3 components separately, use NonUniformScale instead.
- If you want to add a System to the new groups for custom bootstrapping, it's pretty simple. You'll still need to AddOrCreate them or use AddManager(YOUR CONSTRUCTOR HERE) before you add them to the group, the group add function won't do this for you.
Also yes, the parent component "just works", you don't need the song and dance of Attach or Attached anymore
@safe lintel but yes technically Translation isn't updated. If you know which components will change your position you know that only Translation will affect your position. If you don't want to handle the hassle of doing that, just use LocalToWorld or LocalToParent
But be careful, you may get a value that's not what you expect because of this:
// LocalToWorld = Translation * Rotation * NonUniformScale // (or) LocalToWorld = Translation * CompositeRotation * NonUniformScale // (or) LocalToWorld = Translation * Rotation * Scale // (or) LocalToWorld = Translation * CompositeRotation * Scale // (or) LocalToWorld = Translation * Rotation * CompositeScale // (or) LocalToWorld = Translation * CompositeRotation * CompositeScale
another note:
If you update the package(s) for ECS and Hybrid Renderer and clean up everything, but stuff still isn't rendering, try cleaning out your package cache / Library folder and regenerating it.
I had a bit where everything was running, but I had nothing actually rendering
thanks @knotty radish
LOL I saw this on the forums, this was a very misleading title π (Edit of my old message to remove the user)
ugh had a system that was working just fine before this update and now its like only half working
hah i just finished upgrading a project from 2018.3 / preview 23 to 2019.1 / preview 26, total nightmare. i use a 3rd party dll that has the same name and namespace as one that unity.collections relies on, and that caused hella problems. i still have to delete the one from my package cache every time i open unity, because the one i'm importing is newer (by necessity)
@manic aurora yeah its a nightmare. fixed the showstopping issues but now its like why isnt the behaviour the same? id rather have unplayable errors π¦
yeah i agree you have it worse, hope you get it figured out
in other news i just commented out my entire project via picket fence debugging trying to find where a traceless leaked allocation was, but they were just being spammed in an empty project. restart of unity fixed it, but yikes...
bool in componentdata when? π€
hey umm, do you need to maintain unity's naming of key variables when building your own native containers. I'm wondering if the compiler only doing optimizations etc when it finds these specific field names
internal unsafe void* m_Buffer;
internal int m_Length;
internal int m_MinIndex;
internal int m_MaxIndex;
How do I conceptually connect components on different entities? Let's say I have a PositionPublisher with and id and a PositionReceiver that has a publisher's id and a position field for receiving the position. How do I iterate these related entities and update positions on receivers with positions of their publishers?
iterate through all entities to find the matching one?
thats how ive been doing it anyway
i assume you have 1 publisher -> many receivers? you can just maintain a map of publisherId -> publisherEntity and use that to look up the publisher from the receiver.
if a position receiver always references the same publisher, you could create a SharedComponent<SharedPublisher> containing the publisher id, then attach that component to the appropriate publisher and its receivers. you can then iterate all receivers per publisher more quickly, because you can filter receiver chunks by the shared component data index of the publisher.
Old hdd died, so on laptop waiting for my on downloads on my new SSD, but I grabbed the new 2019 Beta to try on this laptop. Does Translation correlate directty to the old Position, and also does ComponentType.ReadWrite() work the same as C*.Create() did? I can't get the version of VS on this laptop to connect to the editor executable atm
Based on the changelog yes, ComponentType.Create was renamed to ComponentType.ReadWrite, which makes more sense than Create
It does, but I can't get my entities to render with the newest previews. I'm trying to do it the way I did before
//in declarations
public Entity MyEntity;
public Material m_material;
public Mesh m_mesh
//in Awake()
MyEntity = EntityManager.CreateEntity(
ComponentType.ReadWrite<RenderMesh>(),
ComponentType.ReadWrite<Translation>() );
EntityManager.SetComponentData(MyEntity, new Translation {
Value = new float3( 1 ,2 ,3 ) ) } ;
EntityManager.SetSharedComponentData(MyEntity, new RenderMesh {
mesh = m_mesh, material = m_material) };```
You need to add local to world since now it's not added automatically: https://forum.unity.com/threads/0-0-23-code-diff.639391/#post-4283725
ah, will try that thanks
@soft nova Thanks btw, you were spot on, glad it was a quick fix and I can understand the thinking behind the syntactical and requisite changes, they do give us more control over our systems at a fundamental level
Np, yeah I agree with you there. I wasn't affected by the error since I am already manually adding local to world.
Any update on ECS audio btw?
I'm specifically interested in graph stuff for a physics based sound system so if any staff want a test dummy, please poke hippo on unity dots external or here
@soft nova I've been meaning to add it if for a while, but have just been coding around the issue. It's good that they're pushing me in the right direction
man got a weird bug in the latest entities package where using entity.Equals(otherEntity) doesnt appear to work in a job, dont suppose anyone else experiencing this? reporting it regardless
wish the bug reporter uploaded faster
Are you sure the id and the version are matching ?
@light sage yeah, I even noticed that with the Parent you need to add LocalToParent too otherwise it throws an error. I prefer to add all the needed components on creation honestly so I agree that is good they are pushing us into doing it
Yea, I actually dropped down to just a camera instead of camera + other Game Object, but I did add another camera, to deal with the rotating skybox, but it will also come in handy for a reset to origin later. By doing that I'm trying to get as much stuff set up as efficiently as possible on initial load. I haven't even had time to look into the new parenting, too busy finally making use of the former "RequireSubtractiveComponent", since my brain doesn't run away from it's confusing name anymore
but by adding/removing components from large entity groups, it can work with the systems I already have to sharply reduce the number on entities they're processing. That and I have to find a good way to do the system groupings
I'm still unsure of the best way approach simulation world/graphical world dichotomy. In my mind the graphical world would always need to be a monobehavior, and the simulation worlds would need to be separate based on timescale dependencies.
@urban rivet nothing about ecs audio but i saw ecs animation on staging https://bintray.com/unity/unity-staging/com.unity.animation
The Animation package brings a new animation system to Unity, entirely in C# and with performance in mind. It aligns with our DOTS coding style.
# Installing Animation
To install this package, follow the instructions in the [Package Manager documentation](https://docs.unity3d.com/Packages/com.unity.package-manager-ui@latest/index.html).
# Using Animation
`TODO`
# Technical details
## Requirements
This version of Animation is compatible with the following versions of the Unity Editor:
* 2019.1 and later (recommended)
dots animation huh? interesting
yeah, didn't try it tho
seems like its based on the same UNode stuff which audio will be
UNode sounds a lot like a visual scripting tool's name
surprised to see this: https://bintray.com/unity/unity-staging/com.unity.tiny/0.14.2-preview
it's still typescript, yet pretty sure Unity mentioned next release will be c#
must be some compatibility thing
also get this with the new package π error CS1029: #error: '"Unity 2019.2 or later is not supported by Tiny Mode yet"
it's not often when you see that newer version isn't supported yet in the error message
https://i.imgur.com/fdRVNNe.png i guess this UNode api isn't there yet...
@knotty radish well its more that it doesnt match at all yet the comparison should mean it does
https://i.imgur.com/2nfVEeb.png what does this guids mean? missed assemblyes? scripts is using UNode namespace but there is no UNode assembly reference
entity comparison?
Hum wtf
You could try to step into the Equals function while debugging
Just to see if it's going somewhere else
I wonder if UNode's just going to wind up being the overarching VS solution, and the aniation package is basically Playables 2, ECS boogaloo
ALSO GIVE IT TO ME NOW
@worn stag it means the file is storing GUIDs to refer to the Assembly Definitions, they can also do it via name I think
It looks like it's doing the Skinning inside jobs which is actually nice
well, we've cracked the code for the GDC presentation.
An unbelievably large volume of Ethans, Unity-Chans, and Robot Kyle's rave dancing on the rooftops of megacity. Probably
and all of that raytraced
with VR spatial audio
haha
Just waiting for "RTX ON" for mobile 
great
that animation package is targeting older Entities package
so if you pick newest unode, it'll force you to newest entities
and then you have to update animation packages ECS usage to preview.26 conventions
(those failing tests on unode itself can just be removed)
so what version of unode we need? 0.1.0?
no idea
i will try it i guess
ok
and entities preview.24
I'm trying to get this running on latest here but it does require file changes
still stuck on these
I have no idea where these are coming from
Next release will also have blob assets which is made for sharable immutable resource data. In that case, you could convert a ScriptableObject into a BlobAsset and then share it from multiple instances in the same scene.
BlobAssets are made for zero cost deserialization for large amounts of data. AnimationClip, CollisionMesh, CurveData is a good example of what we think belongs into a BlobAsset. ```
source: <https://forum.unity.com/threads/new-subscene-converttoentity-workflows.638785/#post-4292482>
that blob asset plan sounds nice
hate the name but like the plan π
Is there any source that explains how they made the loading part of the megacity demo?
yes
but at this point, I'd rather wait for GDC and see if they release the demo like they've hinted they try to do
a lot has changed since Unite LA
@gloomy wasp https://youtu.be/9MuC3Kp6OBU
This in-depth talk covers entity serialization to and from disk, how we built seamless play mode streaming and efficient editor workflow, and what a separate...
look around 5 minute time mark if you don't care of the generic stuff in the beginning
the actual explanation starts there
I'm super interested on that, I understand that ECS will be supper helpfull for the parts of the level that you instantiate later (like enemies, or watever), like in the voids example. Instead of having a lot of starts and awakes in different scripts that really sucked.
But what I want to know is how to apply the same principle to the actual level layout (meshes, terrain etc).
Thanks I will take a look at that!
since we now got subscene loading for ECS, we could work around the loading issue with it as well, not quite sure how Unity is going to present the megacity now with current systems in place
11 days till GDC keynote, and few days more for ECS talks probably so it's not a long wait
hmmm, looking at that Joachim's forum post
BlobAssets are made for zero cost deserialization for large amounts of data. AnimationClip, CollisionMesh, CurveData is a good example of what we think belongs into a BlobAsset.
CollisionMesh?
wonder if that's a slip from upcoming ECS physics thing as there's no such thing in Unity atm
we have MeshCollider and it's Mesh ref but that's different naming altogether
They have publicly mentioned before they are working on an ECS-based physics solver
Also CurveData isn't explicitly a thing so it could just be a kind of shorthand to describe the content
I wonder if you can use the blob for strings?
well, DOTS compatible physics solver at least
they've talked about HPC# Physics but it doesn't mean it's ECS based
true
would be surprised if it weren't though as it would sound like a thing that could really benefit from it
HasComponent doesn't seem to work in IConvertGameObjectToEntity's Convert method... that makes sense but is a bit of a pain in my use case. I'd like to avoid adding an intermediate spawn component & system (or similar) as I have data on the monobehaviour I'd like to reference when the game object is converted. Any thoughts? I can only think of adding a spawn component which references the game object which isn't ideal as I don't want to get in the way of destroying the game object.
@dull copper what is UNode?
it's an insult
so whats the correct usage, like "hippocoder is a unode" or "hippocoder unodes himself to sleep every night"
or "hippocoder, more like unodecoder!"
anybody know why a new shader I added shows as "miscellaneous files"?
wait a minute... are shaders actually C# files?
no they are their own language, where did you put it?
under scripts/shaders in my project assets
actually it turns out it IS part of my project, it just says that because it is not C# I think. Which leads me to a conundrum. I want to have 2 textures on this shader and dynamically change one at runtime
but if it isn't C# I am pretty sure I can't put this logic in the shader itself
well I would think you would want to change the material properties of the shader which you can do via c# as long as your shader supports it
the #archived-shaders subchannelroomthingamabob is right below this one, someone more versed in shader magic could most likely help you better π
wow why didn't I see that
Gotta love playing whack-a-mole after upgrades. Wanted to check out the new entities and now I have to clean Library and reimport every package repeatedly until compiler errors go away.
Okay kids, don't install Shader Graph manually, bad for your HDRP health.
The more I think about it, the more I feel like I need to wait after GDC and at least after the next release to update my ECS project which at the same time is a good thing they actively work on it but also very hard to test the new features to give feedbacks :(
https://forum.unity.com/threads/why-is-simulation-the-default-system-group.639058/#post-4289911
@safe lintel UNode package description would say it is: General purpose graph processing framework.
That description could mean anything, it could be a Toaster or GPS algorithm
My guess is that it will be something we may actually not use because manually handling your usecases / codebase will be more efficient
they used to have package named "com.unity.unode.visualscripting" before but I don't think it is on bintray anymore
that had description of Unity's visual scripting tool adapted as a framework for use by the Compositor
There is also UCore and UCoding
I wonder if that works for both rider and VS
i don't want balls of lint all over my code. messy π
my favourite repo is called "camelcase"
I wonder if they enjoyed or hated typing it in lower case
Or whether it's just a conversion that happens server side
how's everyone handling physics in their ecs projects? using regular unity physics not a good fit for me due to the SyncTransforms requirement. i'm loosely planning to write some simple AABB-only physics, but I wonder if anyone's successfully integrated a third party 3D physics library that they like? or just sticking with something trivial and waiting for official ecs physics impl?
@manic aurora you saw the bullet ECS thing on the forums?
I'm chilling on physics until at least a basic collision system is there
it wasn't full integration, just a way to wrap bullet manually to ECS
I'm personally hoping Unity does give some DOTS physics thing soon, even if it's only for collisions (I know FPS Sample has simplified collision thing for dynamic objects now)
@manic aurora can you link the thread?
oh there's an ecs specific one?
oh you mean https://forum.unity.com/threads/with-project-sample-ecs-js-bullet-physics-is-it-feasible.544231/#post-3591540 maybe?
yes
I'm rizu on the thread btw
(my old nickname + Unity forums don't allow usernames that start with number)
that sample is hardly ideal, you could optimize it a lot if you want
but still cool to get some samples
yeah i was paging through the example like "hmmmmmm" lol
you probably also know PhilSA's ECSPhysics one?
that would require a major rewrite and it's more like a shell atm
yeah it doesn't support box colliders yet which is like my only requirement in the short term lol
plus he's been off it for a while iirc
yeah, wouldn't really count on that evolving anytime soon π
im also doing same as recursive, just waiting for something official/using hybrid and biding my time
yeah, I'm on hold for ECS physics too, just using hybrid right now for that
if GDC doesn't show anything that's going to help on that in short term, need to go on plan B
which would be a lot like that Bullet ECS thing in principle
yeah digging in a little it does seem relatively practical to integrate bullet, but it (at a glance, i have no actual idea) seems like you can only access bullet on the main thread, so when i have to do a lot of time-rewinding i can't update all the physics positions simultaneously...where as i assume with unity-integrated ecs physics i totally could
like if i just wrote some simple aabb physics, i could parallelize distinct time-rewinds per player
the transform updates will not be the major cost here before Bullet itself chokes
I'd also do some perf tests on typical gameplay scenario before thinking that as showstopper
usually gameplay physics aren't all that demanding but that would of course depend on the gameplay itself
well id need a bullet world per-player or have to do each distinct rewind state one at a time, right? if i'm trying to parallelize a unique simulation update per player
also, you really really need to rewind the physics?
I know people try to do it for server authorization but it's kinda thing most indies try and struggle to do when AAA games just use client side checks for most online game physics
also usually the indie games MP is dead on arrival or not super popular so all the effort in doing it so that nobody can cheat in any case is usually wasted effort
there are just so many issues to solve on MP physics in general, and if you need all clients to play nice on collisions that are verified on server... that's a huge undertaking
well i am not building a game, really, i am just building a netcode for sport, so i'm trying to make it fancy
just a little experimental hobby project y'know
ah, well, if it's just for kicks and learning, I guess everything goes π
I doubt one could make a generic code for this either
like, netcode that works for all types of sports games
oh no, for sure, i am specifically making fps-style netcode
then gonna try mmo, see what i can do re: horizontal scalability
oh, right
not that kinds of sports π
you've seen the FPS Samples collision detection code?
they added custom collisions for dynamic objects on last update
HitCollision no longer uses Unity collision system for queries against moving colliders. For lag compensation server needs to do queries using different historical data and moving Unity physics colliders multiple times per frame is very inefficient. Now queries are handled using custom collision primitives and burst jobs. The structure of the collider and history data is still WIP.
yeah i knew about that but haven't dug in yet, i AM hoping i can borrow some of that work, i was already intending to use the ecs unity.mathematics extensions
but i already know my interpolation for networked objects is better than theirs, so maybe i should just roll something together \s π
good lord, this guy is a machine
Photo by Oliur
[https://unsplash.com/@ultralinx?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit]
/ Unsplash
[https://unsplash.com/?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit]
You can just give your GameObject to GameObjectConversionUtility s...
i really wouldn't be able to use half of this stuff without sifting through his (and some other key community member's ;)) blog posts and code
Hmmm testing 2019 now and my job (which works fine on p24) is now throwing the error Iterator must be marked [ReadOnly] on p26 anyone knows what that means?? It points to job.Schedule(this, inputDeps);
The job is a IJobProcessComponentData if that matters
Even a simple system throws the error
[ExecuteAlways]
public class TestSystem : JobComponentSystem
{
public struct Job : IJobProcessComponentData<TestComponent1, TestComponent2>
{
public void Execute(ref TestComponent1 test1, ref TestComponent2 test2)
{
}
}
protected override JobHandle OnUpdate(JobHandle inputDeps)
{
Job job = new Job
{
};
var handle = job.Schedule(this, inputDeps);
return handle;
}
}
this is probably not it, but i had a generic job doing that that worked when i declared it outside the system lol
I can't see anything wrong about your sample, it looks almost 1:1 to https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/master/Samples/Assets/HelloECS/HelloCube_02_IJobProcessComponentData/RotationSpeedSystem.cs which runs on p26
Job job = new Job()
instead of Job job = new Job
?
@soft nova
literally a standard C# thing you can remove if you're using an object initialiser
Just letting you know π
Yeah, perhaps the installation of the beta is wrong or something. I tried in a new project with the same results
try the samples?
also, what's the full error message?
you have manually set jobs package?
I don't have the full output right now, but it was the same thing that is posted here https://forum.unity.com/threads/strange-error-iterator-must-be-marked-readonly-since-0-23p.640951/
No I used package manager
Yeah, I used PM to install it
in that case make sure you got jobs 0.0.7-preview.7 and collections 0.0.9-preview.13 there
Still the same issue unfortunately
At least now i have the full error
Hmmmm to big to post here
@soft nova did you try the new samples?
hello ecs 02 has almost same setup as your snippet and it works
Yes that one works, but it doesn't matter what new system I make it will keep throwing the same error. The only way to make it work is to use any of the already available ComponentData. Changing it to this doesn't throw any error and executes normally, why?
public struct Job : IJobProcessComponentData<Rotation, RotationSpeed>
{
public void Execute(ref Rotation test1, ref RotationSpeed test2)
{
}
}
also new Entities and Hybrid packages π
now Entities is at 0.0.12-preview.27 and Hybrid is at 0.0.1-preview.7
also new collections, jobs....
(not updated yet on that image)
I wouldn't even list these all separately on PM normally, you can just get Hybrid (or Hybrid and Entities if you want to see the dependency lists) and dependencies take care of the rest
gotta love these comments on the new entities package diff cs // Invoked by Unity magically for FrameSelect command.
they also got some place holder for Tiny "TODO" ? π cs [TinyFixme] // Should this work for Tiny? public class BlobTests : ECSTestsFixture
in general, they've updated a lot of the conversion setup here, main new thing is the blob support
also ComponentQueryBuilder
this is also new file Unity.Entities/Injection/DefaultTinyWorldInitialization.cs
as for the hybrid package, it got now some HLOD change and small tweaks
new release notes are up https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/master/ReleaseNotes.md
- To use, try the Entities property of ComponentSystem, which returns a ComponentQueryBuilder that has a set of With methods on it to construct a query.
- ForEach now lives on this and the parameters of the lambda will be combined with the builder to form the final cached ComponentQueryGroup.
- You can also call ToComponentGroup from the builder if you just want to use this new way of constructing one.
- The default cache size of 10 for ComponentQueryBuilder-created queries can be tuned with InitComponentQueryCache.```
well, that happens π
the same issue is still in this file π I would make a PR to correct it, if they were taking contributions :)
https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/master/Samples/Assets/HelloECS/HelloCube_05_SpawnFromMonoBehaviour/HelloSpawnMonoBehaviour.cs
heh
weird that they didn't mention blob thing on the release notes
I'm guessing it's still incomplete or something
you'd think they would have put move info about it otherwise
Can someone explain to me the difference and benefit to ECS? I've seen several videos about it and I'm still confused as to what exactly it does
not sure if there's really any up-to-date comparison thing, you can find some partly outdated ones if you look around
is there a replacement for GetBufferArray<T>()?
besides doing chunk iteration for it
Well 5argon found the issue and explained it here: https://forum.unity.com/threads/solved-strange-error-iterator-must-be-marked-readonly-since-0-23p.640951/#post-4296163 Now the only other problem I'm getting is that my custom render renders on scene view, but not on game view if I use the Parent component
I actually thought that too but then thought you didn't really have empty component on your end in reality
Yeah, on my actual system I don't plan to have one, but since I'm not done with that component it didn't have anything yet. I found that while the game window don't render my custom render (which is just a copy of RenderMeshV1) it works fine on the scene and on a build.... I have no idea why the game window just won't show it. Even more odd, when I made a build the game window showed the rendered objects and then disappear when I pressed play
Well someone found a fix for the game window drawing issue: https://forum.unity.com/threads/bug-ecs-disables-drawmeshinstanced.641320/#post-4299532 this will at least let you keep implementing while they either fix it or tell us what to do
Is it possible to bring the cameras position property out of the monobehavior at all? I'm at a point where I'm considering forking my project to a system where the camera is always at the origin, or having to rethink/recode a lot of the infrastructure of what I have now, But if I could find a dencent way to deal with camera position inside the various systems, I would be able to save a lot what would have of wasted time. If not, I can't see a way around -a) moving the camera to 0,0,0 full time or -b) depending on an extra delta time function or two, and having extra components/systems, to deal with it and to also for a buffer preventing the camera from holding up any other systems that might have mutual dependencies somewhere along the line
It's really just resulted in a strange hybrid system for me that's hard to work with. Camera position is dependent on player entity, everything is dependent on player entities position also, I x/y axis is actual position while z-axis is always zero with a value representing where it would be similar to the 0,0,0 based system
anyone know how to manually initialize and update RenderMeshSystemV2 + transform system? with v1 i just tossed all the named systems in a file, updated them in the order they seemed to expect, and it worked. with v2, this isn't getting me anywhere. there are also several systems internal to the rendering namespace that it looks like i might need...
bonus points if i can get rid of everything that has to do with hybrid/proxies/GOs
ah i sorta got it... initializing worlds with DefaultWorldInitilization.Initialize gets you all the built in stuff set up correctly, then you can remove what you don't want and scope certain systems to certain worlds by using an ICustomBootstrap. seems like ScriptBehaviourUpdateManager doesn't support multiple worlds anymore, which is confusing to me, modifying it to support them works fine...
okay, awkward triple post, but i got it working right and hate when people don't post answers to stuff. this post helped: https://forum.unity.com/threads/why-is-simulation-the-default-system-group.639058/#post-4294693
if you have multiple worlds, you straight up are (currently) expected to manage their updates in a monobehaviour. you use the default world init with a custom bootstrap like i describe above, get the world references in your game loop monobehaviour. THEN you can get a reference to the presentation and simulation groups with World.GetOrCreateManager<SimulationSystemGroup> - updating those manually will execute render and transform systems in the correct order per world.
id interject to make it less awkward but i have zero experience with initialising worlds
1.0.0-preview.1 for the Burst
- Fix regression when resolving the type of generic used in a field
- Fix linker for XboxOne, UWP
- Fix performance codegen when using large structs
- Fix codegen when a recursive function is involved with platform dependent ABI transformations
Any tips as to how to have a system associated with a non-default World? Thanks!
got more context for us? you can make a totally empty (i.e. no ecs default systems) world with new World, add your system to it manually with world.GetOrCreateManager<T>, then update the system as you see fit with system.Update.
Hmm thanks @manic aurora itβs that last step Iβm unsure about - especially how that works in conjunction with ComponentSystemGroups
you can update groups directly as if they were systems https://forum.unity.com/threads/why-is-simulation-the-default-system-group.639058/#post-4294693
rest of that thread might be a good read, too. seems like if you have multiple worlds right now, you are expected to either manually inject them into the player loop (insane, imo) or bootstrap them with a monobehaviour* that calls Update on systems during its own update/fixedupdate as needed.
hopefully they will give us the ability to add multiple worlds to scriptbehaviourupdate order back soon, that made this easier. they are doing a lot of player loop tinkering in the upcoming releases afaik
awesome, super helpful - will digest this (and maybe just live with everything existing in default world for now) - many thanks @manic aurora
@amber flicker i had actually been working on a little writeup on getting default systems operational in multiple custom worlds and manipulating the player loop, might be useful to look at the draft? https://piefayth.github.io/blog/#/posts/ecs_render_multiworld
@manic aurora really nice article
the first article i've seen that describes a use case for icustombootsrap
oh good! i'm super glad you guys got some mileage out of it
Was interesting snippet of custom player loop, Iβd be more involved but doing a and b will turn into i and j by the time I get something good made aha
Did EntityManager.GetComponentOrderVersion changed somehow? It seems to be working fine on 2018.3, but not on 2019.1.
Hmmmm nvm my issue is not there
god dammit all these conflicting dependencies on package manager are driving me insane
Anyone know if there's an ETA on a non-hybrid physics system? Trying to figure out whether it's worth rolling my own simple one or just waiting a bit.
If a simple one is sufficient, it's probably worth it to make your own. I wouldn't hold my breath for an official pure ECS physics package just yet. That said, try Googling a bit, it's not new ground, so there might be something available out there.
isnt there an open source one?
Probably is, never checked. Might be a bit outdated with how often the ECS system changes, but should be less effort to fix than(and make a pull request) than to make one from scratch?
I don't think this is the ECS visual scripting though
wonder if they are still going to put this out there, regardless the DOTS version coming up later
yeah they also have "com.unity.unode.visualscripting"
saw it in compositor dependencies
I can't build the scripts with this, but still fancy to get a peek
mostly curious if they plan to release the nonECS thing after all
I was expecting this to go back to drawing board tbh
neat
I need this before my hands fail due to excessive master commits
that audio system is on staging atm
(I linked dev version before, but it's on staging too)
is it weird that they are putting the megacity audio in as a package but its not intended to be the official audio solution?
there are a lot of random unreleased packages
hell there's packages called "a", "b", "c"
it might be weird if they released them, but they're just on staging, which is meaningless
ah, thought it was destined for release
that megacity audio package doesn't work at all on 2019.2 alphas atm btw
latest 2019.1 beta doesn't throw errors with it
seems like they 2019.2 got the changes later in this case
(required using Unity.Experimental.Audio doesn't exist on 2019.2)
Hey, anyone know if there is any way to manually tell when OnUpdate should be called for all systems?
Nice update of entities
Which can now handle bool and char
So we could handle ECS strings \o/
yeah I was actually wondering about strings π
would you do that as NativeArray<char> ? π
yeah I came across that type recently, but haven't looked into using it
It wasn't working before
struct EcsStringData : IComponentData { public NativeString64 value; }
oohhh
Taken from WordsTests.cs
there are multiple versions, presumably just different sizes
ugh must resist using staging packages!
Exact
data seems to be efficient, but naming is confusing π NativeString64 is 30 characters long and using an unsigned buffer:
private unsafe fixed uint buffer[15];
Yeah ok the naming convention is how much memory the type takes up. 15 uints *4 bytes, plus one int (4 bytes) that is storing the length = 64
o man i saw that before you edited it and i was just doing the math in my head like, "hm, am i an idiot?"
nah took me a minute or two to get it π I checked the other types (512 and 4096) and it adds up
512 = 254 char
4096 = 2046 chars
This reminds me a lot of the early days of MS SQL Server before we got the varchar variable type π
welcome to Unicode
They will change the names though
How does entity id recycling work? I need to know so I can implement it in some non ecs related code.
They have an Index and a Version, but how do they connect them? Just storing an array of version for all ids would be 16 megabytes π€
The index will eventually be reused, but never with the same version. The version will increase whenever the entity changes. I do not, however, know exactly what it means for the entity to change. Adding/removing components should be one way
@tawdry tree I meant how do they find the next free id when the next id would be max int + 1. Do they just foreach over all ids to find a dead one then?
One strategy is to keep an array of "free ids"
So it's fine if I keep 2,147,483,648 x 2 sized list?
That's gigs of memory...
you would only keep those that are free "inbetween" and a max one
but yeah not ideal π
Oh right, I forgot 1 division by 1024.
btw strings work just fine in component data π I just did a quick test
https://forum.unity.com/threads/strings-are-usable-in-component-data-now.644647/
I assume they have an optimized way to find free ids.
In fact, I would assume that they would ALWAYS look for the lowest free id when creating a new entity, though with some optimistic optimizations
oh nice, new things π
New Features
Added BlobAssetReference and support for building and serializing blob assets.
- Blob assets are built using BlobAllocator and BlobAssetReference fields in components are automatically serialized and deserialized.
- BlobPtr and BlobArray are used to represent pointers and arrays inside blobs and are allocated using BlobAllocator.Allocate.
- BlobAssetReference are currently not supported inside DynamicBuffer components.
- bool and char can now be used in ComponentData and in native collections.
- GetBufferFromEntity and GetComponentDataFromEntity only available on JobComponentSystem
Upgrade guide
- Unity 2019.1b5 or later is now required.```
Changes
- If a system in a ComponentSystemGroup throws an exception, the group will now log the exception as an error and continue updating the next system in the group. Previously, the entire group update would abort.
- Moved most documentation to the Entities, Collections extensions, and Job extensions packages.
Fixes
- Fix underconstrained systems in the TransformSystemGroup, which could cause child transforms to lag behind their parents for one frame.```
excellent
kinda bummer that they didn't put any example on the samples about blobs
no further docs either, only those mentions on the release notes
they did however come up with this π https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/master/Documentation~/getting_started.md
nice
holy crap that's great
how long has this been a thing?
wondering mainly if it's because of the ECS subscene loading or if it's been there for longer period already
I don't often use that specific menu
(for other than creating empty gameobjects
The notion of Subscenes is only existing in the Entities package so maybe about 2-3 versions
Thats been a thing for a few releases already
yeah, I'm aware of that
just wondering if it came along that update but I guess then it did
my comment is first there after Joachim π
should probably put same avatar there as the nicks are different :p
yeah I actually cant remember where I saw this context menu demoed, thought the info was in that thread hence why I linked it
Hey @dull copper, isn't BlobificationTests.cs enough informations about blobs ?
ah, I didn't check the package contents yet
Tests kinda reveal things often on these, so I guess that's a good starting point
I haven't made a diff for the changes yet either (have a local entities and hybrid git repos for that)
There is the basic usage for Blobs, not yet any conversions for Texture2D or any fancy things you may want to have but it will come soon enough
OK guys, gimmie a TLDR of what I've missed with ECS!
and strings π
new hybrid package mainly does changes like this ```cs
-
ForEach((LODGroup lodGroup) =>
-
Entities.ForEach((LODGroup lodGroup) =>```
- Working NativeStrings and our dear
bool
yupyup
It is (not actually, thought you were talking about bool and char)
char and bool, not nativestrings
you mean on the package release notes?
and not the samples one?
ah, thought if I missed it somehow
Package doesn't have a CHANGELOG.md
also they mentioned the documentation was moved, but the links dont work
wonder if this means they'll finally throw this in github
would be so much nicer to track changes if they did
I don't think they will
oh some of the docs are now live (wasnt earlier today)
https://docs.unity3d.com/Packages/com.unity.jobs@0.0/manual/index.html
https://docs.unity3d.com/Packages/com.unity.entities@0.0/manual/index.html
the collections one still isnt there (https://docs.unity3d.com/Packages/com.unity.collections@0.0/manual/index.html)
Just like any other package which is not on github so either the package start on github or it will never be there
I dunno about that
also wonder what's their motive for not putting it on git
as anyone here could do it anyway
the license isn't stopping for doing that
Support
it's under unity companion license, you only need to ship the license with it
(with the source distribution that is)
If it's available people start playing with it and then if there is something not working, they will immediately complain about that issue while the Unity team may already know
That and the suspense, GDC is near and we are all waiting for sweet updates
considering how much Unity hypes ECS, github presence has very little to do with how many people adopt it π
actually if it were only on github, it would limit the people who tried it
but since it's on package manager, everyone can just drop it in
perhaps they just want to stabilize it before releasing it fully?
I agree that a small button to remove the lock in the manifest file from the Editor would be cool
heh, they couldn't put the graph in image?
now their ASCII art doesn't fit into the window and it breaks the presentation π
needs ScrollASCIILayoutSystem to see the entire ascii art graph
I use Quads and Line Renderers for most of my architecture diagrams
@untold night https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/awesome-ascii-effect-123603
doesn't support TMP -> unusable π
it doesn't use any GUI at all hehe. it fakes the whole thing
but can it run doom?
if you can make Doom run in unity, yes π
Watch in 1080p60 for best quality. Created in Unity3D, Just showing off how it looks so far playing through the first 3 levels. The monster and item placemen...
someone is working on that lol
the pink demon in original doom, was such a surprise to me once, that I actually gibbered and dribbled while backpedalling desparately
to anyone these days it would never be a big deal
looked at BlobificationTests, not much wiser on the actual usage
https://bintray.com/unity/unity/com.unity.audio.megacityprototype on regular registry now
ah nice, didnt realise that new entities package was also out of staging
hmmmm, the "Convert To Entity" thing doesn't set the old gameobject name in for the converted entities automatically like the gameobject scene conversion tool did
wonder why, it was pretty handy to not have just numbers for entities + it's still editor only thing
Anyone know if there is a way to run the ComponentSystems "manually", basically so I can do it X times in the Update loop. Like ~ World.RunSystems(); or something.
I've seen that, have not yet come to the conclusion if it can solve the problem. But I guess the idea is to make a new UpdateMethod which adds the ECS stuff, and control the amount of times it is run by loopConditionFunction. But my current problem to understand it is that I have no idea how and when that condition is checked, can I cause two of these functions to trigger after eachother - or will some fixedUpdate come in between?
I think there's an attribute to force your system to be called before/after other system
But right now i can't find it
Yeah, but I'm not talking about one system, but the whole simulation tick.
And in the player loop you can modify it to be called in the order you want
You can even force fixedupdate to be called as a normal update
Hmm, doesn't seem to work the way I want. From what I can see, and that someone else had a problem with, the "loopConditionFunction" needs to be copied from one of the existing PlayerLoopSystems. There is very little to go on with this one.
FixedUpdate would be cool to use if it wasn't for the fact that it isn't prioritized by be matched by the framerate :/
I seem to remember you having to override the default bootstrap if you want to control your own loop? haven't tried it myself
From what I remember finding is that the bootstrap uses ScriptBehaviourUpdateOrder.UpdatePlayerLoop(World) to activate the updates into the Loop. But might've overlooked something that might help.
you can look into DefaultWorldInitialization how ICustomBootstrap is being called
Yeah.. but It comes down to the UpdatePlayerLoop as I previously said https://forum.unity.com/threads/i-created-this-video-guide-to-help-explain-unity-ecs.524711/ :/
You can always update them manually as often as you like, eg World.GetExistingManager<SimulationSystemGroup>().Update(), or you can implement a custom SystemGroup which updates all contained systems multiple times
Hey,
so I have some understanding problems for ECS, I wanna do the following:
World
-> Chunk[,,]
-> Voxel[,,]
But I wanna generate chunks inside the world, and voxels inside the chunk. In what function do i possibly do the generation of chunks / voxels? Onupdate wouldnt be the right way right?
I would probably go for a system which keeps track of player position and which chunks are spawned and need to spawn or despawn, then mark them somehow, probably via fields (needUpdate, shouldDestroy). Might despawn directly, actually.
Then a second system would look for chunks which needs update (or destroy) and does the generation in a job which is not bound to the frame, ie not awaited.
You need to keep track of the state but shouldn't be hard. An enum would do it? Since they boil down to an int anyway it should be blittable
and of course, actually doing the generation is it's own whole topic, but not really ECS related. I don't think voxels should be their own entity, though, unless really big (so few are used), or on movable grids or something, as a 10x10x10 chunk already has 1k voxels.
those only appear once it moves to regular registry π
I was talking about the release notes of the sample repo
yeah, I know
I meant they don't update that until the new entities package is on regular registry
checking the change now
seems mostly cleanup pass
hybrid renderer moved Update LodRequirementsJob into IJobCunk from IJobParallelFor
that's about it
Nothing much here either
I'm guessing it mean this now https://docs.unity3d.com/Packages/com.unity.entities@0.0/manual/index.html
as there were zero changes on the docs on the samples and the packages
kinda sucks that there's no way to diff the official docs
or I guess one could crawl the site after each pass but π
I'm guessing if something is new, it's here: https://docs.unity3d.com/Packages/com.unity.entities@0.0/manual/chunk_iteration.html
but I didn't really spend much time reading the previous version
Yeah I guess, amyway GDC is this monday so we will have enough new things soon
need to shine a 5argon sign in the sky for a good diff writeup π
if i have some shared component (with an index available via either chunk.GetSharedComponentIndex or entityManager.GetAllUniqueSharedComponentData(..., out indices)) and destroy all entities that use it, is that index eventually recycled?
edit: yeah they're reused
Have you guys played around with the new sub scene? I started doing some tests on my end and I'm super impressed about how wonderful it makes the workflow and how extremely fast loads heavy data
are you using hybrid for project?
Hey, was not sure if I missed something to turn collisions on and was wondering if someone could please tell me
It is colliding with this (well should be, but they pass through each other
@urban rivet Me?
@fathom carbon turn off Is Trigger
on what one?
Box collider
thank you!! will try that out
Both of them should not be triggers I imagine
It worked!! But there is a problem with the gravity now. They all float up
It could be your player controller or it could be that they immediately collide with the floor and then get pushed into the air
as you have unticked Use Gravity
yeah, I may just put a floor in to stop that.
Do you happen to know how I can adapt this code to use for the player to follow the curser
None of these are #archived-dots questions either, #π»βunity-talk and now #π»βcode-beginner is the appropriate place for discussion
okay thank you!
FYI - Burst doesnt correctly recompile edits in editor since preview50. This has been driving me nuts all day and question my sanity and programmer skills.
Hey, how can I access a System from the outside?
I have a GameObject "TerrainGenerator" that creates multiple Chunks (which create multiple voxels inside of them), now if the players removes one voxel how can I notify the chunk system / world system that it needs to update the chunk? (voxels are combined to a single mesh, so the chunk needs to re-generate that chunk)
Have a NeedsUpdate component with a boolean value, set it to true to mark as needing update. Chunk update system will iterate over all Chunk/NeedsUpdate entities and essentially start with if (NeedsUpdate.Value = false) continue;
yeah i know of that one, but how can I access that bool from the outside? Like Im in the player Update function and somehow need to get the access to the chunk
'How do I find a specific entity, by some ID I have set' is a question I am still looking for the answer to, if that's what you're asking (in a slightly different way; get chunk for position [...])
@flat talon so workaround is to disable burst while working on codebase in editor?
Or is the old version still compatible with current entities?
workaround is to use preview 50, and yeah Im able to use preview 50 with the latest version of the rest of the DOTS stack
Is there an equivalent of Vector3.SqrMagnitude in Unity.Mathematics for float3?
(Ah, it's lengthsq, right?)
yep
haha finding things in unity.mathematics will be the death of me, i manually implemented quaternion -> float3x3 before i found it
Yeah, I had tried to find it with autocomplete with, sq, mag, etc. I had to open the fine and search for sq, to find that they now call it lengthsq... I'm really looking forward to the time where this is all consistent and documented π
Another question; With Burst, do I have to mark all methods as [BurstCompile], or is it enough to mark the "first" one, that calls all the other methods?
I mean if you just type in "math" intellisense should show you all methods, definitely faster to scroll through those than doing it yourself π
I just type math. and then press tab. But it's a small window that pops up, and scrolling through all methods in math will take a while. It's easier to narrow it down by typing what I thing it's called.
sure, still better than doing it yourself
New Burst 1.0-preview 5 just released that fixes the compilation issue I mentioned above π
https://puu.sh/D18yF.mp4 finally got that damn chunk system running, now to convert it from hybrid ecs to pure ecs / jobsystem, its running to slow on generating new chunks π
With Burst 1.0-preview 5 I still get different behavior in the editor than I do in a build, so I just leave burst off in the editor for now
preview 5 was to fix a showstopper bug I think. Can you explain the difference in behaviour please?
Just weird problems like collisions being inaccurate so things falling through the floor and sometimes different animations playing
burst's preview.6 is out now
kinda lost my motivation do any ECS code today, so now holding off doing extra work in case of keynote reveals something that could change my future workflows anyway π
that being said "three year plan" thing sounded VERY much like their future DOTS-plan
so, not really expecting anything but MegaCity to get released around GDC now
this is kinda interesting: https://forum.unity.com/threads/nvidia-physx-plugin-preview.645004
will see where nvidia goes with that
I hope they'll ship with the sources too
as it would mean we could use physx outside of the gameobject scene fairly easily then (meaning one could use it with unity's ecs directly then)
