#archived-dots
1 messages ยท Page 194 of 1
I wouldn't say that really...they just removed the need to use them to make a tiny project work
So you can use them if you want to and gain all the benefits, but it's not necessary just to get your project running
How do we work in the editor .. sorry for all the questions I feel like Iโm missing something here
Ah ok
Well I can only speak for myself - I just use IConvertGameObjectToEntity scripts on everything in my scene - except the camera
And they just automagically get converted to entities when the project is built
How do I setup the build w sub scenes
I can't really help you there, I avoid subscenes like the plague personally, every time I tried to use them I just end up confused and frustrated
Ok no problem, your help is really appreciated
Ok seem like all you need to do is include your sub scene in the scene list for the build and you are good to go
Some kind of hierarchical solution like you described would be best imo. One way would be to chunk out your map then calculate the paths between chunks so you could first run astar on the chunk level, then eliminate all other chunks when you drill down to the per-tile level. I think there's still a chance you could get suboptimal paths that way but it should be a massive performance improvement
alright
I'm just struggling a little with the in-between now
but I think I got a solution
nvm I don't
does anyone has hybrid renderer V2 with dots in unity 2020.2 working on android?
it's not rendering anything for me
@hollow scroll Have you added the scripting define in the android settings as well?
Also you need to be running vulkan, GLES is unsupported
I did the define... not vulkan, will check that! thanks!
@honest plinth thanks you sir! that fixed the problem! ๐
how... do i mix animation events with dots?
no wait.... there is a way, go hybrid
or is there a "DOTS" way to do it other than hybrid?
they arent implemented yet ๐ฅฒ
march is kinda soon in my mind lol
really hope not but given how slow its been im expecting it to be delayed
off topic question but is there a way to get back the pause button in the Editor UI on the latest version I don't understand why the removed it I used it quite a lot ๐
must be a bug but you can use the hotkeys for it
afaik it still shows in the edit menu so assuming its a bug
If I am putting my jobs in an array and executing CompleteAll, how do I get my output values?
how are you writing the data?
typically you would write back to a NativeContainer
and access the NativeContainer
ofc it also depends on the lifetime of your NativeContainer (so you may need to look into a persistent native container if you need to access the data on the next frame or so)
related to that, if I wanted to create a persistent nativecontainer that would stay around for the lifetime of the app, how would I go about making it so that the console doesn't fill up with undisposed messages when exiting play mode? In the past I did it by registering the containers in a monobehaviour with OnDestroy disposing them, but that seems a little inelegant
I guess it depends on structure - if it's a MonoBehaviour, you can use OnDestroy/OnDisable, if it's a SystemBase, OnDestroy can work too. If you have like a static one, you'll likely need to find a way to explicitly manage the native container yourself
@coarse turtle https://hatebin.com/bwsrzjiqhj
I am running 400 jobs and I have 2 output parameters (path and finalGCost) per job. I want to use them, then dispose of them to prevent memory leaks.
the way you structure your jobs is just making it difficult, and 400 jobs is a lot
That is why I am running them multi-threaded
well you're still scheduling 400 jobs, I'm curious as to why a job can't handle n tasks
Oh, I could make a special job just for getting all paths, hmmm
So I have a pathfinding job, which finds a path from one location to another
but back to your point of concern, if you need to access path and finalGcost, you will need to refer back to those native containers
Oh I just refer back to the jobHanldeArray before disposing of it
Ah I think I understand, or what your saying is I could have a custom path finding job for when I need to get all paths and do it all inside of one job
so if you want to access the 5th path NativeList, you will need to somehow grab that path variable and access it
yes something like the latter, it may be better to have a job handle multiple things instead of trying to schedule 400 jobs
so if a Job handles "n elements" you wouldn't have to schedule 400 jobs
Well most often when finding a path I am only running 1 job, from start to end position
However when displaying a grid of all possible places you can move, I must run a path to all 400 positions, so that the grid can be updated
Using DOTS I can do this so quickly I can almost do it between frames without a hitch, trying to get away from ASYNC calls, which have to wait over multiple frames and then update the view
can i get advice on good ways to do this... Like.. you know text-games with a console and you input commands? How should i use ecs to carry out the commands. Like lets say each command has its own system and regex pattern. Could i just like... put a fixedstring buffer for commands on all players, and then each command system does an entities.foreach on all players with a change filter for that string buffer? does that sound ok
can i do async await stuff in OnUpdate in systembase?
@coarse turtle I create a job to check paths all in one job, I am concerned that it is not using other threads doing it this way though
Well it really depends on the implementation
Usually if I use IJobParallelFor, multiple cores are utilized (ofc this depends on the parameters that are set when scheduling the job)
I think by having multiple jobs, each checking a single path, it can make the best use of your CPU
well if scheduling 400 jobs work, consistently across the target platforms you intend to release to without major issues, then that methodology would work @dull siren
Yea I just could never get to my outputs, because they all run in one CompleteAll function, I have no chance to grab the arrays I put into them and dispose of them or get the data
I guess the problem is that you can't just put a single parameter into a job, like int. It must be an Array of size 1 int. But for 400 jobs, I need an array where I can put the index into each job, however I can't have an array of arrays
Well maybe I could have a List of NativeArrays of size 1
Yes the first remarks is my big problem, I have been running one job at a time, so to access for example the "path" variable I just access it after running the job. So when switching to putting all jobs in an array and executing CompleteAll I was passing the same varaible to all jobs and it was being overritten
Also I forgot to put the count++ line and take out the original Schedule
I think what I need, outside of the for loops, it a List<NativeList<int2>> paths
possibly, but I'm not so sure
i think the issue you may run into if you store the path into a list would be
that NativeLists are structs, and by default, structs are copied over. So you can imagine when you add the struct to a list, you would copy that list over. The problem here lies in the Length property of a NativeList
because a copy of the length property would be passed to the job (not its reference)
A simpler example would be gcost, since it is just an int. Essentially I want to run 400 jobs simultaneously and get 400 int variables back
so the job would do the work on a copy of the NativeList, manipulate the Length property, and if you possibly tried to access in a later frame, the Length property would be 0, as you're looking at a copy before the work was done (the pointer would still be pointing to the correct data though)
I'd try storing the NativeList<T> into a list to see if it would work, if you end up with a length of 0 per native list, then you would know it wouldn't work (since this depends on scope) ๐ค
or you may need a different data structure to solve your problem
Oh I could just increase the length of the existing native list, hmm
god damnit, I wish we could just get a vague high level plan of whats going on with dots
has it shifted to a 5y roadmap? 10y?
something to plan for future titles
I will play around with it some more
400 is just to test the limitations right now, in reality the calls will be much smaller on average, but I am trying to see how fast I can get it
yeah makes sense, I have limited knowledge based on your problem domain - so I'm just commenting lol
thanks! I have 2 things I can try now, a List of NativeList or just having all jobs work with increasing the native list
Set your agent to run AStar only within maybe 100 meters. Then, take the point you want to get to and project a line between your agent and that point. Compute the intersection of that line with the far edge of your AStar "radius" and choose that point as the navigation location. Periodically re-run the line intersection to pick a new "navigate to" point at the edge of your AStar radius. Repeat this until the destination location enters your AStar "radius".
Trying to run AStar across your entire multi-km map would be essentially the same as making all agents omniscient as far as path navigation goes.
The method I just described as an alternative is much more performant and also more closely resembles what real organisms do for navigation.
Right now I'm using a pre-baked astar map in chunks that all enemies can use.
hello, how can I have a child entity follow the transform of its parent? Like in non-dots you just set the child object and it just works. I can't seem to get the same thing in dots
Pre-baked maps across multi-km tiles doesn't really scale well. I would greatly reduce the size of the maps and compute a new one periodically for each agent as it moves.
@dull siren Instead of using 200 jobs for your 20x20 grid, why not a single IJobParallelFor
@stiff skiff Will have to research it. The tutorial on pathfinding in DOTS recommended doing multiple jobs to make the best use of the CPU and proved it by showing how quickly it runs
IJobParallelFor does this as well
This issue with IJob is that is basically 1 task == 1 job. And those jobs are spread across your X cpu cores. With some scheduling overload per job
But on your end, you technically have the same task, 400 times
So an IJobParallelFor lets you define that task, and schedule it with 400 different inputs
then tell the scheduler to have 1 job per, lets say 20 of them
This means every job will now do 20 iterations, leaving you with 20 instances of your job, spread over your cpu cores
This is significantly more efficient
And a better way of thinking about your data
Ok, as long as I can get the outputs for each job
400 times is how many paths you need to check if your character can move 20 spaces, a bit excessive but a good test. If the character can only move 3 spaces then it would simply by 9 path jobs
For A*?
Yes, it is using A*, but instead of waiting for the player to click and see if a path can be found, it is showing all possibilities, like XCOM
I mean, pretty sure XCOM only shows 1 path, the one i'll take IF you were to click
so it just takes the grid cell your mouse is over, and calculate the path to that 1 cell
well I have not played XCOM but maybe a better example would be Wasteland 3 then, where it literally shows every possible spot you could move to, every possible spot you could move and shoot from, continuously
Do you have an image?
Because I feel doing an A* job to every grid cell, is very much the wrong way to go around this
since I can unload/load in the maps for every chunk, it's way less resource intensive than you'd think compared to having a map for every enemy
Example of grid showing where you can move
I highly doubt this does the A* like you are trying
For example, this doesnt need the path as the output
You just want to know if which cells are within range
If you look at a visualization of A* you can see this "flood fill" style of calculating adjacent cells movement cost (total)
And this is very similar
you don't want to know the cheapest path from X to Y. You want to know what cells gcost <= distance from X
Thats something that you can do in a single job. Using your current XY and a MaxGCost as input, and a NativeList<int2> as output for the cells you can reach
You'll only need A* once the player hover over one of the "in range" cells to figure out the path
and you can even re-use the NativeList<int2> you calculated earlier as your list of open cells, since you know these are all what will be in range, ever
I hope I'm making some sense ๐
Yes your right, in fact I dispose of the path and only keep the gcost when doing this. But i still need to path find a path to check for things like 2 corners on diags, etc. Then just return the finalnode gcost for each tile
So right now I am just collecting 400 gCost ints in 1 job. I need to split it back out to separate jobs but run them simultaneously
Oh I re-read what your saying with doing it in 1 job, while pathfinding I am getting the gCost for every cell, but not sure how to pathfind in all directions.
hey, is there a way to speedup the hybrid renderer v1? When I look into profiling, my game logic in total takes like 3ms, and the hybrid renderer takes 60ms ๐จ
Another person said before that it was not very well optimized and I believe it's no longer in development
I know about v2, but my issue is that I use a lot of visual assets on the asset store and the majority of them want nothing to do with SRP. and v2 only works with SRP
else I'm gonna have to write my own DOTS renderer system which I would rather avoid spending time on
Thats sadly the reality of using DOTS rendering
I believe the hybrid renderer is used when converting unity objects to dots right? if I remove the conversion and use pure DOTS rendering components, will that remove the hybrid renderer out of my way?
i know nothing of your situation but it seems like it would be easier to rewrite things over to hybrid v2 than writing your own dots renderer
no conversion is a separate step that has nothing to do with rendering in that way
Is there a good way to to have a ForEach(c1, c2, c4, c5) with a condition on the parent? Say Entities.Where(Parent.HasComponent<C>).ForEach() ?
Or is it negligible to loop over all these entities and check manually parent.HasComponent<C>?
That's why nested loops would be fun...
honestly, I just use ComponentDataFromEntity.Has - I haven't tested on thousands, since my case is generally hundreds and falls within the target metrics ๐ค
Question is, is it faster to do the check and branch in the job. or 3 jobs. 1 to split the entities between have and have not, and 2 for the separate branches ๐
caching will be better on the latter, but job scheduling is pretty bad currently, so might not be worth it
I'll stick to HasComponent since it's a very low amount of entities
Actually just splitting in it two systems with events works... idk why I was looking for another way
The issue is the dozen or so assets I use from the asset store which don't support SRP.
some of those assets are quite massive (like a volumetric cloud renderer, I can't rewrite that easily in SRP)
how do i know if i a container is able to be scheduled parallel? and whats the proper way to do stuff like making temp containers to transfer field data and using with burst, and then disposing of them?
If a container can be written to in parallel it will have an AsParallelWriter function. Except nativearray which just works I guess
Any container can be used as ReadOnly in parallel
For passing a container between jobs you just need to make sure you pass the job handle along with the container and dispose it at the end, passing in the dependency to Dispose
what about entities foreach scheduleparallel? i dont need to do any job handle stuff with that?
and uh.. are dynamic buffers able to be in parallel?
You would still need to manually manage the job handle only if the container you're passing between jobs leaves your system. If it's only contained to one system you shouldn't need to worry about it in most cases
A buffer can be used as an argument in your query for a schedule parallel job, but the work won't be parallel on any single buffer
im confused about like... i know schedule parallel uses multiple threads... but is there any guarantee when it finishes? like if i do an entities.foreach.scheduleparallel and then right after i do entities.foreach.withoutburst.run in the same OnUpdate, what really happens
The work is parallel across chunks
In that case your first job gets scheduled then your second run job runs immediately afterwards - meaning the one you scheduled hasn't happened yet
oh.. how do i know when its finished or uh
idk how to make sure the stuff happens in order
It's finished the next time OnUpdate runs at the latest. Otherwise any time you call complete, a structural change happens, or some other job that depends on it needs to complete
My advice would be to only worry about ordering between systems via UpdateBefore/UpdatAfter
Let unity handle the rest if you can
so... uh... when do i use scheduleparallel or schedule
if i dont have a lot of data... like maybe just one chunk.... scheduleparallel doesn't bring any benefit?
also can i put entities.foreach inside entities.foreach... like nesting them?
I don't know what you mean by nesting. If you don't have enough entities to have multiple chunks for an archetype then scheduleparallel won't do anything afaik
It will just work like schedule but probably be more expensive
it doesnt give any compile errors when i do that but idk wtf it does when i do stuff like entities.foreach.withoutburst(() => { Entities.foreach.scheduleparallel(() => {};);}).Run()
I don't think that works
so uh.. if im making a mud... and i need to parse commands with regex... I'm reading input on the main thread with networkstream... What's a good way to bridge like... my input string stuff from each client and have the server parse the commands?
Sorry you lost me, hahah
this is what i have. how do i make it better. oh wait the first scheduleparallel shouldnt be there
// Remove unused commands.
Entities.ForEach((ref DynamicBuffer<CommandData> commandBuffer, ref DynamicBuffer<LogData> logBuffer, in Player player) => {
foreach (var command in commandBuffer) {
logBuffer.Add(new LogData() { Value = FixedString.Format("Couldn't understand: '{0}'", command.Value) });
}
commandBuffer.Clear();
}).ScheduleParallel();
// Set new commands if any.
if (commandMap.Any()) {
Entities.WithoutBurst().ForEach((ref DynamicBuffer<CommandData> commandBuffer, in Player player) => {
if (commandMap.TryGetValue(player.Name, out FixedList32<FixedString512> commands)) {
foreach (var command in commands) {
commandBuffer.Add(new CommandData() { Value = command });
}
commandMap.Remove(player.Name);
}
}).Run();
commandMap.Clear();
}
// Send logs to respective players.
Entities.WithChangeFilter<LogData>().WithoutBurst().ForEach((ref DynamicBuffer<LogData> logBuffer, in Player player) => {
SendLogsToPlayer(player.Name, ref logBuffer);
}).Run();
}
uhh idk... trying to like... get the data into and out of the ecs stuff seems weird or maybe im thinking about it wrong... should i just stick to using withoutburst unless i have a lot of data to do stuff on
I think you should try something simpler until you're more familiar with unitys ecs
@odd ridge are you sure the hybrid renderer is your bottleneck here? you profiling using the timeline view or hierarchy?
I was looking at the hierarchy, that's where I got the 60ms for hybrid renderer and ~3ms for everything else
the timeline should give a better idea of whats taking up performance. if the hybrid renderer is waiting for other jobs its possible the 60ms is partially waiting
I assume there's no way yet to have floating text in DOTS?
Since 2D isn't supported
Oh maybe 3D text...
i dont think hybrid v1 should even be a bottleneck if you are using assets incompatible with it, they shouldnt even affect how the hybrid renderer operates, so im thinking the 60ms you might be seeing is hv1 waiting on other jobs to complete, but its hard to speculate without further info
@safe lintel right, I will turn everything off to make sure
should be easy enough to just run it and drill into the timeline view to see what is eating up your cpu
no need to disable anyrthing
here
RenderMeshSystemV2 is the hybrid renderer v1
I'm not sure why but according to this profiler, it's horribly slow and single threaded
I mean, I know it's supposed to be slow
how come when i do this it says i dont have any capacity (list capacity is 0? i thought it would allocate. how do i do that?)
list.Add(cmd);```
but that's really bad
that's with 1 million entities, everything is an entity, each piece of grass, each tree, each object
curious what your tri count is for scene statistics
I know that's not the problem because my GPU is at 8% usage
v1 was only ever any good at rendering statics - v slow when it came to dynamic and one of the things v2 is working on addressing
84.7k tris, that's nothing
fair
yes most my stuff is dynamic, not static
still wouldn't expect 1mil dynamic meshes to render super fast on v2 mind you..
only way to get decent perf for that kind of count is manually through drawmeshinstancedirect I believe - but that's pretty manual
who knows, maybe easier and better than I expect in the future
that's my next best bet, trying to write a DOTS rendering system with indirect
instance I mean
on my laptop (8 cores) I can render about 200k dynamic cubes on v2 in about 10ms in case that helps give any kind of ballpark reference (urp unlit)
hmm, I see
yeah, not really sure for your options here. v1 is basically deprecated, and they are fairly communicative for feedback for v2. i still think it would be easier to try to update stuff for v2/srp batcher rather than writing my own rendering system but thats just me. you might be able to communicate with some of the asset devs to update for srp batcher
srp batcher stuff is basically the future so id imagine any decent dev would want to help out and improve the perf of their stuff
I might just try to isolate my code stripped of the assets I use and try v2 on it
to state the obvious... it's rare you'd ever want to throw all your cpu power at blades of grass so.. just make sure it's worth the time investment ๐
well, the thing is my CPU is sleeping. my DOTS game logic takes 3 ms on 1 million entities.
yeah a million entities for only 80k tris, wonder if any of that can be improved. there are some good techically minded people on the forums if you want to pose the problem there
opportunity for some background mining ๐ฌ
lolll
you could try raytracing on the cpu.. that's expensive ๐คฃ
it's just because of the hybrid renderer though, it's locking my main thread at 10fps, so I can't schedule more jobs than 10 times a second. at 60fps, that would be 3ms*6 = 18ms, which is a pretty decent load on the CPU
you could do 100k instead of 1mil? ๐
hybrid can't even handle 100k lol, GPU usage at 1 million is 8%. at 100k I'm at 20% GPU usage.. hmmm
it's not unplayable, far from it. but yeah, 20% GPU usage
and huge CPU single thread bottleneck
I mean, I would expect better from "performance by default", why am I using DOTS otherwise ๐
well apparently v2 and srp batcher is worth it if you want perf, 2.2ms for 1mil entity cubes
gpu usage is 88%
with all safety checks on(1070 and 8700k)
and in editor, not a build
@zenith wyvern it's a valid question : ) I do have Enable Burst Compilation turned on
I've been hearing nothing but horrible things about hybrid renderer with this version, seems like a rough patch for sure
those are nice numbers
yeah, it's pretty horrible. if only v2 was backported to built-in renderer..
how should i do singletons or global variables in ecs? like if i want an in-game time variable or something
do i just use uh.. addsingleton
many ways to do it. for time variables, I just pass a time value to my job struct
is there any advantage to like.. using a singleton component? and uh... does calling get or set singleton cause a sync point?
oh wait
does this look ok
WorldTime worldTime = GetSingleton<WorldTime>();
worldTime.Time += worldTime.WorldTimeToRealTimeFactor * Time.DeltaTime;
SetSingleton(worldTime);
}```
Is there any simple way to render a plane from ecs? I am trying to render I grid and I would like to avoid creating a plane entity via conversion
about functions in Entities.Foreach under SystemBase
is it possible to turn this bit into a function withBurst and ScheduleParallel
All entities are created using conversion. Unless you're using project tiny maybe?
tldr, can i have functions for use in jobs especially with entitycommandbuffer
Yes you can create burst compile static functions
Just mark it with first compile or whatever the attribute is I forget
yes with ECB?
And make sure it's static
@slim nebula I am using a custom map data structure for the levels so the entities are not "classically" using conversion workflow
Yeah entity command buffer is burst compatible
much thanks
I haven't tried that specifically myself but I think it should work
but I have a grid component which basically contains every info necessary to render the grid. so I would like to have a system just render it without having to create another entity with render components etc
Do you mean you're creating the entities programmatically?
Ohhhh
kind of. most of it is converted from prefabs though
was thinking about using Graphics.DrawMesh or similar. But its tough to get a mesh into the job
Off the top of my head you need to convert the data into a format that's usable by the ECS renderer at some point. So I would think that it would be about the same amount of work to create those entities as it would be to write the renderer. But I don't know for sure
Maybe someone else can help?
yeah I see what you mean. thing is I would have to keep the entity in sync with the grid component then. So if any value changes I have to update the entity with the render components
I think any entity or component change causes a sink point yes. The get shouldn't but the set should I think
would be great to just do sth like: for each grid render a quad with this shader and these shader parameters
sounds like a perfect fit for system to do ๐ค
I mean it's no different than like the physics system right. it does a build physics world every frame which just converts the data to a format that's more efficient to process. It's doing that data conversion every frame.
But I don't know maybe the custom renders stuff is super easy I'm not sure
Thats what I was hoping. But couldnt find anything
Hello, is it possible to use Hybrid Renderer V1 with unity 2020.2?? Nothing is being rendered if I don't set ENABLE_HYBRID_RENDERER_V2 (which I don't want)
I wonder what the issue is
no error?
nop... and I created a new project just to test that in isolation... unity 2020.2, "com.unity.rendering.hybrid": "0.5.2-preview.4", a cube with convert to entiy... and it just not rendering that
classic unity
try update hybridrenderer to v10
I just did... same problem
oh
yappp
Important: Hybrid Renderer V2 is considered experimental in Unity 2020.1. We have validated it on Windows DX11, DX12, Vulkan and Mac Metal backends in both Editor and Standalone builds. Mobile device and console platform support will be validated in 2020.2.
what does validate even mean?
does it work with a subscene insntead of convertToEntity ?
Haha unclear. I guess theyjust make sure the versions together dont break Unity ?
ye
Unityโs release management only grants a package the verified status after it passes several testing stages and validation procedures, which also include checks for appropriate documentation, changelog, and license files. Packages in this state may appear in the Unity Editor with the 2019.4 verified label and never use preview as part of their version.
From https://docs.unity3d.com/Manual/upm-concepts.html#States
But I'm more confused what they mean
seperate unrelated question of my own:
is it possible to have an array of RenderMesh and another for PhysicsCollider that can be used in Entities.Foreach?
1) it can be converted from a C# array if neccessary
2) i dont need to write to it, I just need to access copies of it
hmm
verified == no error log ๐
SO it's not "verified", but it's "validated" for DX11, 12 and Vulkan ๐ค
@karmic basin I didn't try with a subscene... it's just an empty scene with a camera and a cube with the convert to entity component
have you try pure ecs scene
There's nativearray and nativelist, but there's also the getcomponentdatafromentity thing on systembase
the problem is the mesh is generated at launch on the main thread
Yeah and if you put them in components, you already get copies of them
@vagrant lotus sorry... what do you mean?
its a terrain generation thing
should i make holder entities as a way to store them and use entityquery to use it in Jobs?
oh i glanced over the answer
Yeah I mean all your data should be on an entity
brainfart of my own
You might use static members as a shortcut sometimes but I think in most cases it should be on an entity
but V1 works by default in 2020.1 it seems
they may only validated it with pure ecs entity
it was a pure ecs entity
convert and destroy creates a pure ecs entity
or am i missing something?
does this qualify for a bug report
same packages in completely new project same scene... works fine in 2020.1, but not in 2020.2
try making a new project with V1 and 2020.2
I did
if the same bug occurs
that's the project I was testing
๐ thx
they often ask if you can replicate your bug
Yeah my s*** crashes all the time. They asked so many questions I can't really report it
But if you can reproduce it then you can report it
if it always crash, you report maybe able to get through
but there are just so many threads closed because dev cant replicate it
๐ฅฒ
@vagrant lotus yep... I just created a new project and same issue
why dynamic buffer has 0 elements after this
var buffer = entityManager.AddBuffer<LinkedEntityGroup>(blockEntity);
buffer.Add(entity);
Var buffer is not a ref, I don't think. You I have to set the buffer back on the component.
@half jay
Or maybe I'm wrong actually I'm not sure
its strange when using EntityManager and method AddBuffer return buffer then
It shouldn't, what leads you to that conclusion?
You shouldn't need to assign it back
Oops my bad
i tested it
Can you show the test?
Does someone have up-to-date documentation on the netcode package ? Latest versions have deprecated ConvertToClientServerEntity and ask to use the subscene workflow, but I can't get my head around it, I think I'm missing important step(s)
@hollow scroll try toggling srp batcher if you havent already
@safe lintel I'll try that
@safe lintel ahh by unchecking that it seems to work! thanks!
just note that v1 is deprecated and wont get any support going forward
yep... I know... I'm hoping for them to add support for OpenGL ES to V2... or I'll need to start thinking about other optoins :S
V1 also works with 2020.1.17 and a lower version of URP [8 instad of 10] (mentioning just in case)
@karmic basin the way I did it was to set the subscenes to not autoload, then only load certain subscenes programatically depending if server prediction system or client prediction system exists in the current world. (client and thinclient load the same subscenes for me)
I'm not sure if there's a better way
ultimately I'm tagging the subscenes and processing them with a system. identical to the deprecated component, so I'm not sure why they did that
i mean thinclient has a singleton component in their worlds
the normal client doesn't. they have different input processing or w/e but I just load the same subscenes cause it's only in dev and I have 64gb of ram
Alright I'm gonna read more about subscenes, ultimately if I spend too much time making it work I might revert to older versions. This is a side experiment, I wanna quickly test things
Thanks for your input
if it's just testing, then use the depricated component. it still works
yeah, true
i use it when I'm lazy and just jamming debug junk in the root of my scene
Yeah ok deprecated way works, so I dunno why I was obsessed with novelty
Thanks again for putting me back on the right track ๐

So I've got a system that runs on scene load that's supposed to create a GameObject and link it to an Entity. However it seems to run once and then the scene load wipes the GameObject. Is there any way to delay a System's first execution until after scene load is finished?
sceneSystem.IsSceneLoaded(entity)
if false then just return and try again next frame
@raven grail
sceneSystem would be World.GetExistingSystem<SceneSystem>();?
hmm, I'm wondering if people had success with conversionSystem.AddHybridComponent(Camera) in mobile builds? I seem to be getting this error on Android via the CompanionLink:InstantiateCompanionObject(entity, gameobject):
The referenced script on this Behaviour (Game Object 'Camera') is missing!
Still getting nothing
For reference, this is what my Job code looks https://pastebin.com/h6RrxjX5
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Though now I'm getting an assertion failure AssertionException: Assertion failure. Value was False Expected: True The scene catalog has not been loaded yet
so your RenderObjectLinkComp is on your entity from the query, not on the subscene. is that intended?
There is no subscene
var sceneEntity = sceneSystem.LoadSceneAsync(guid);
if(!sceneSystem.IsSceneLoaded(sceneEntity))
return;```
I'm loading the game into a main menu scene and then loading a game scene
this will 100% always return false
it's loading it asyncronously. you'd need to wait a few frames
and not load in a new scene every frame heh
err... the subsiquent loadsceneasyncs will prolly fail? I dunno
And yes, the idea is to run the system on every entity with RenderObjectComp, create a GameObject, then store an ID linking to that GameObject in RenderObjectLinkComp
also ur GUID is like hard-codedish var guid = sceneSystem.GetSceneGUID("Scenes/GameScene");
you can only load a subscene once. you can't load multiple instances of it
subscenes are for disk to memory, prefabs are for instancing (in-memory copy).
The GUID is just for testing now
kk
just sayin if you have multiple maybe that's why ur seeing wierd things but if ur testing is just 1 then it's fine
kk hmm
yea I mean
var sceneEntity = sceneSystem.LoadSceneAsync(guid);
this will like... return a value right
then
if(!sceneSystem.IsSceneLoaded(sceneEntity))
return;```
this will make it return
will always return
Basically the issue right now is I'm doing SceneManager.LoadScene, which triggers map gen, which puts an entity with RenderObjectComp in the World
then you've lost "sceneEntity" cause it's fallen out of scope
then next frame you do it again. I assume var sceneEntity = sceneSystem.LoadSceneAsync(guid); on the next frame will throw some error or return null
i don't think it's getting to that new gameobject line is it?
if(!sceneSystem.IsSceneLoaded(sceneEntity))
return;```
this will always return right?
the "new gameobject" is after it
Nope, it just goes assertion fail
ohh wow I'm sorry I totally didn't understand
so this line
var sceneEntity = sceneSystem.LoadSceneAsync(guid);```
is throwing that error right?
or maybe this line var guid = sceneSystem.GetSceneGUID("Scenes/GameScene");
sorry I'm not sure. if the guid is correct it should just go... I"m not sure
It's var guid = sceneSystem.GetSceneGUID("Scenes/GameScene");
I've never used that method. as a work-around you could try using the GUID directly. from unity docs:
Yeah but where do I find the GUID
put it on a component or monobehavior and assign it in unity editor
drag the scene onto your property in the editor
should just be "Scene" type, then there's a property on it for the guid
iirc
with serializeutility.. if you want to serialize objects to files, then you have to save their assemblyqualifiedname and data and recreate them when you load?
or will that break things
also im confused as to what's a sync point. So... any structural change, (creating/destroying, adding / removing stuff) or any setting to component data (causing component sync point?)? So getting component data... also getting singleton data... are fine and wont cause sync points?
Doesn't seem to work for me, can't assign a scene to a scene field. Is there no other way to just delay a system for the first frame?
pretty sure that's right.
ok
public class SceneLinkAuthoring : MonoBehaviour, IConvertGameObjectToEntity
{
public SubScene Scene;
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
dstManager.AddComponentData(entity, new SceneLink { SceneGUID = Scene.SceneGUID });
}
}
i know that's subscene but
I assume you have to do the same thing with scene
the generated authoring stuff doesn't work for scene/subscene
I assume you're using a component
so you can either use a monobehavior to have the "Scene" property directly, or write ur own authoring like I did above
Scene and SubScene are not blittable. only the GUID property is. so it can't go directly on a component.
Did you try playing with RequireSingletonForUpdate and using a system to add a component tag.
Or better, use [UpdateBefore/UpdateAfter] to control flow
I've tried UpdateAfter but it didn't seem to fix the problem
do you have 2 subscenes and 1 one of them is loading really slow causing an error in the entities.foreach? just got on the convo
ah
The weird thing is I've got this older job code that does something similar, instantiating GameObjects on scene load and linking them to an entity and it works just fine
So really the question is, how do I set up the system to either run at the end of the frame, after the scene has fully loaded, or to run only on the second frame
Why not just pre query the entities you need.
If the query is empty (i cant remember the actual syntax) skip the entities.Foreach?
The problem is that the query isn't empty
The Job code does everything it's supposed to, it just fires too soon so the GameObject it instantiates gets wiped
Or at least that's what I'm assuming here, cause when I set the Job to run every frame it works
I've tried UpdateAfter(typeof(EndPresentationEntityCommandBufferSystem) which looking at the documentation should be the last system updated but that still didn't work
So either it needs to be even later than that somehow or there's something else going on that I'm not seeing
is it safe to reference entities in buffers? like... if the entity is destroyed, does the buffer update or uh.. i gotta manually check before i use it or idk?
like containers holding items... rooms holding stuff
DynamicBuffer<Entity>
you gotta check it manually, or have a system that removes it from dynamicbuffers on entity destroy
also not sure if you can do dynamicbuffer<entity> as it's not an ibufferelement
can make a bufferelement that holds an entity tho
what naming convention do you guys use for ecs? Like for components... do you just name them the thing... or maybe thingData?
I prefer to name them as a thing. Don't see any reason to add suffix it will just clutter naming
Ah figured out why I had this issue, had realised that one of my asm definitions wasn't targeting Android.
Same as @manic reef, I just name them what they are eg Health
Anyone heard anything about when the next updates will drop (0.17)?
Sweet, been away from dots for awhile and exicted to get back into it
well fingers crossed
Have they released component enabling/disabling?
yea i just read those and didnt see anything about it
someone from Unity confirmed me hybrid renderer v2 won't come to built-in. I'm considering getting rid of the assets that don't support SRP so I can upgrade to URP asap. v1 is just horrible
@odd ridge I thought that was said ages ago?
Does animation finally work? I see it has its own forum now
yeah, still tricky to figure out
tricky is better then impossible ๐ I couldnt get it to do anything before
it sorta always worked but they never updated the samples alongside the package updates. just hoping they keep it up to date this time around but you know how it goes ๐ฅฒ
how should i structure this? Like... if entities can have a whole bunch of stats. I usually need to process through all the stats since each stat can have temporary decaying/growing statmodifiers. But i also usually need to retrieve stats by name. Do i use a DynamicBuffer<Stat> and then manually find each stat by name when i use them?
does this look ok ```
public struct Stat : IBufferElementData {
public FixedString32 Name;
public float BaseValue;
public float FinalValue;
public FixedList32<StatModifier> AdditiveStatModifiers;
public FixedList32<StatModifier> PercentStatModifiers;
public FixedList32<StatModifier> MultiplicativeStatModifiers;
}
public struct StatModifier {
public float Gradation;
public float Initial;
public float Final;
public float Duration;
public float Time;
}
am i doing anything weird
and then if i just want to get like... an attack stat.. i manually go through the dynamic buffer and find it by name? or is there a better way?
How do you add a subsystem descriptor for a custom SubSystem? I created a UnitySubsystemsManifest.json file but can't see my descriptor when I call GetSubsystemDescriptors
My UnitySubsystemsManifest.json is very simple,
{
"name": "VoxelSubSystem",
"version": "0.0.1"
}
Do I need to add more to this or specify my descriptor class?
@warped coral I would make each stat and stat modifyer a real type
eg Health (which contains value, min/max) and then healthModifyer
unfortuantully that means you need to make a ton of types :/
heallth would be a normal component and modifyer would be a buffer
and then a health system to process the modifiers to update the correct max health value?
yup
I did the same thing. Actually I have gone one step further and have a healthBase so I can reset it
once you got the basic pattern down you could probably code gen it all somehow
that... sounds like a lot of systems and components... if i have a lot of stats... although it does seem better for having each stat have unique values or different ways they work i guess
yea you need alot of code ๐ฆ i was using a ton of code gen for my stuff
do generics work with systems? like... will unity automatically create the generic system stuff.. like if i made a ResourceSystem<T> or something. would unity autocreate it like normal
so with Health i would put a attribute on it, thats the only component i would actually write, and the code gen will make the modifiers / systems
honestly i had sooo many issues with generics
i gave up on them
but that was many versions ago
@ocean tundra is Unitys internal codegen accessible through scripting?
i dont think so
i made my own
using t4 templates (which were aweful) ๐
im planning a remake of my code gen stuff and looking into this for it (https://github.com/scriban/scriban)
and ive seen some other teams (ai planner) use that, not sure what entities use
interesting thx
good luck ๐
I guess I will try without it for now and see how long I can handle all the boilerplate code
but I will def keep it in mind ๐
yea i think thats the best way
what i found is i was spending tons of time updating the code gen and templates cause i missed a use case or found a bug
best to get a nice useable system with a few of your core stats
then code gen
yeah I can absolutely see that. I am not even sure about the core patterns to use yet
but its good to hear that I am not the only one handling single stats like health with multiple components
for me it was for networking
i wouldnt sync the value, instead capturing the value change into a 'timeline' and syncing that
every value i wanted to sync needed like 3 other components and soooo many systems ๐
well that sounds way more complex. which network solution are you using?
I see ๐
how does uhh.. schedule parallel work? like... what's it really do?
it will 'magicly' schedule the work to be done on 1 or many threads
how it decides i cant remember
maybe was something todo with the number of entities
but i think it was the recommended way to schedule things
array len / chunk size > min, spawn job for each slice of chunk size
im still confused on how to properly use schedule parallel... Like.. so.. it uses one thread per chunk? and then when does it complete... and how to tell when it completes.. err
yea that took me a bit
and since it does stuff based on chunks.. i should try to make sure most entities have the same architecture so they can be processed in parallel right
basicly schedule (and schedule parallel) dont actually do the work then, it 'schedules' it to be done 'soon'. so all your systems are running, declearing what they read and write too and then all that work gets safely ordered and runs in different threads
i didnt really worry about making entities have the same architecture
ok.. so.. there's no uh.. guarantee on when it finishes? can we tell when they finish.. or do we design systems so they just continue when finish conditions are met or something
so you can order your systems somehow (cant remeber the attirbute name) and if your using the same components they will be scheduled to run after the previous
oh so... if i tried to multithread every single thing... it'd actually be much slower than just multithreading the big tasks
i think its actually faster
like if i have tasks that can finish on the current frame, it'd be slower if i schedule them instead and wait for them right
i think everything has to finish in the current frame
i remember trying to get jobs to run across frames and it was super hard
oh
dont think of them as threads, sorry for using that word ๐ they are TINY little jobs scheduled and run VERY quickly across all your cpu cores
oh
each 'job' should be realitivly simple and you have many and many of them
uhh... then... wait idk im confused. whats the difference between Run() and Schedule() and ScheduleParallel(), considering they all finish by the next frame?
Run runs on the main thread
but i cant remember if it runs it right then or still schedules it to be run later
Run -> does the work immediately on the main thread
Schedule -> tells the scheduler to do the work later on a single thread
ScheduleParallel -> tells the scheduler, do this work later on multiple threads (depending on collection size / amount of work done on slice)
ohhh
for me i was trying to make sure everything would scale large, so was trying to use scheduleparallel everywhere (and failing)
should i always use scheduleparallel if i can... and i dont need the work immediately? also.. uh... how later is "later"
the next frame... within the same frame.... a few frames ahead?
within the same frame i belive
with the order attribute unity can work out what jobs you want to have done first and can schedule your work to run after
so you can have job1 that updates translation then job2 that reads it and then job3 that updates it again all execute and complete within the one frame
ahh UpdateBefore and UpdateAfter are their names
oh... wait.. can i make groups within groups? so... it's perfectly fine to have a bunch of subsystems each do one parallel job?
do you mean making ComponentSystemGroups?
yeah... But is there any way to have one system do... uh... a bunch of parallel jobs in a certain order? where the jobs have different entityqueries so they cant be scheduled together, but they have to be in a certain order?
I think if you just have 1 large system with all your entities.foreachs within they 'might' be automaticly dependant on eachother
but if they use different components/querys then why do that?
oh.. then... that means the system should be split into smaller pieces?
yea, normally i have 1 foreach per system
i have a player system that does three things in order, each thing having a different query
i guess maybe it's too big
if theres no dependancies between those 3 i would make those 3 systems
even if there is dependancies i would still make that 3 different ones
not sure what the use case is for large systems
the first task i can scheduleparallel, but i need the next two to be done after it... so currently i just use Run() for all three
to confirm your using Entities.Foreach right?
so it would be better to split the stuff into three systems and use [Update] attributes to order them and have the first task able to uh.. schedule parallel?
yeah
yea then unity can automaticly schedule them in order
oh
if your only reading a component then make sure to mark that as 'in' instead of 'ref'
yeah i did that
if i want to use a dictionary.. i need to uh... have it be a native hashmap and copy it to some local variable first before the ForEach in order for it to be able to be scheduled parallel?
oh in that case you dont get automatic ordering
using a hashmap?
as your storing the data outside of the entities and unity cant track that
yea
whats the hash map do?
so... what would happen if i still split into three systems and used the Update attributes? the second task is the one that i wanna pass the dictionary into. Currently it's just using the dictionary directly without burst
it stores the commands for each player. Like for a MUD game. currently i take all the received commands from all the clients and put them in a dictionary
dunno if there's a better way to do it
Dictionary<string, List<string>> commandMap = new Dictionary<string, List<string>>();```
yeah.. player name to a list of their uh... commands. Yeah im using without burst. If i want to make it able to be scheduled parallel... should i make it with FixedStrings and then pass that to a local variable in ForEach?
can you get away from strings completly? i think even fixedstrings would be hard
still dunno which containers scheduleparallel works with. does like.. schedule parallel try and interpret what to do or idk
i dont think so...
i need to take their commands and then add them into ecs. I put the commands in a buffer for each command system to use regex and parse/consume the command
and also by using regex i can't use burst ... idk how ๐ฆ
idk if i did stuff alright... but i cant use like... a lot of classes with ecs. like Regex, TcpClient
yea you cant use like 90% of c#
yeah... idk if i'm bridging between them right
is it a mp game?
yeah
๐
offline, online, or server
i just have an abstract session class with write/read/parse methods on it, then i have offline, client, and server subclasses from that
each player has a stuct containing a TON of native lists, each native list was for 1 command (eg select unit, move unit)
and it would contain job handels (as unity cant track dependancies for native lists)
when the player does something it will be written into that list and job handle set
then another system will schedule a job to be dependant on that handle and read from that list, depending if its networked or not it will then send it to the server
server then reads incomming packets, figures out what type they are and then adds them into a server verson of that same stuct (except having a native list per player) again setting up job handels and other jobs scheduled against that
was super painfull to work out
and had SOOOO many job/world scheduling issues
eg server world updates at 10 fps, and if its running a client locally thats runnibg at 60 fps, but they both need to write data into eachothers lists (no network connection)
i would recommend staying away from the crazyness that is custom mp ๐
even tho i wont take that advice
take a look at DOTSNET
ok
im planning on rewriting my mp stack and releasing that open source
maybe that could work for you
Sorry probably sounded a bit negitive ๐ just custom mp = crazyness
How do native streams work if your writing all sorts of different types into it?
When you read or peak you need to supply the type? so you have to know the type in advance?
also does it work with any struct?
I believe it works like, when you tell it to Write, it allocates an amount of data equal to the size of what you're writing, then sets the bytes there to that value. So yeah you'd need to know the type in advance, to make sure you get the right number of bytes and interpret it properly. Could be wrong.
yea that makes sense
based on my reading of the docs it looks easist to just have 1 stream per type
Unrelated question, anyone know if there's a way of doing random-ish writes safely, that doesn't have to rely on an Entity Command Buffer?
At the moment I have a system that writes its value to another entity any time it's changed, and I love the speed bonus from only doing it on change, the problem is that using an ECB takes a whopping 40x longer than a straight random write from ComponentDataFromEntity with NativeDisableParallelForRestriction
and to top it off said performance hit happens on the main thread
Maybe a 'event entity'?
no you still have to use ecb...
so for one of my issues i reversed the issue
entity b would read from a
but that loses out on the change detection
yeah
you could try a hashmap?
write entityA value into that
then schedule a job to read from that hashmap/list thing
doesn't that still lose out on change filtering?
or even a normal entities foreach and do hashmap.containskey or something
where do you want the change filtering?
when entityA changes or B?
data on A changes, propagates that change to B
I think componentDataFromEntity is correct then..
The issue is it's so unsafe. If there was a way for me to tell it "hey, only this job is allowed to write to that component, ever", or even better in this case "only this specific entity will ever write to that one, throw an error if any other tries", that'd make me feel much better
don't want undetected race shenanigans
I'm using an ijobchunk, I originally tried with .Schedule instead of ScheduleParallel but it seemed to suffer from the same issue
ijobchunks just seem to do parallel regardless of if you say parallel
but I also would want to avoid the case of another system writing to the written value
ComponentDataFromEntity(false) (non read only) is the only way to do direct writes
no way to guarantee EntityA and EntityB is a 1 to 1 link?
you're gonna have to tell it that its allowed to write to it though
ofc. I have it working with CDFE, it's just the unsafety of it is exceptionally unsettling
'guarantee' a link, or do you want a valid up to date entity ref? @ocean tundra
its not unsafe, if you validate that your logic doesn't allow for it to read+write during a job when you might pivot on said value
most of the time when you just write out to a value, it never even matters that its 'safe' to write anyways. but you might just want to switch to transient data durning the job, though native arrays, and then the final job writes out any data for the next frame to start with
to confirm i understand the issue?
EntityTypeA-1 updates EntityTypeB-1
EntityTypeA-2 updates EntityTypeB-2
BUT your worried when
EntityTypeA-3 updates EntityTypeB-1
sync points and/or setting up job chains is how you validate what the current state of the component will be when your system runs @ocean tundra
I'm worried that I'll forget about the fact that only one thing is supposed to be writing, later on in the project. Or that someone else is using my code, and doesn't know
well in that case you might want to rework the logic to omit the random write
if you describe the logic I might be able to help with that. there are a lot of ways to pull off desired logic with ecs
yeah, I have an already-working safe read-based system, but I wanted that speed boost from only updating on data changes instead of reading every frame, when the data in question will probably only change at most once every 2-3 seconds
ah so the event system problem
so your read safe way is EnityB reads values from EntityA?
yes
how many entities is this that are effected by the write
that will mimic WithChangeFilter
is it 1 signals a large volume of change, or is it one to one, with a total count of 1K+
one to one for the most part, 1k+
would it really be more efficient that just eating the random read?
profile all the things
if its one to one, can you do a direct update within the ForEach, if you moved the signal value into one of the components?
they're in separate entities, idt foreach allows for that
and a follow up to that, is the value change and the entities updated grouped with some sort of high level logical chunk?
default chunk grouping, chunks of type A do not correspond to chunk of B
it's a Buff and Resource system. Buffs can be applied that increase stats on the main entity
the Resources can have changes every frame, so I'm using Reads for that over the writes, but since buffs being applied on consecutive frames is unlikely, I'd rather avoid that
ah, that helps a ton
so your resource, needs to know what buffs to apply to it, this frame, but only once, until a few seconds later you might need it again?
Buff A is activated, that increases Speed of Entity B. When Buff A runs out, the SPeed on Entity B drops back to its previous value. idt the resource part of the system is relevant, unsure why I brought it up
for the purpose of this let's assume it's 1 to 1. It can actually do multiple, but that's handled by a different part of the system
so for this i would structure it all on the target entity
okay so your trying to map a single buff to 1-n targets, using a entity ref, and are doing a random write, from the buff or target?
from buff to target
eg entity has SpeedStat component, and SpeedModifiersBuffer
I think flattening all buffs on a per target (npc, w/e) is what I'd attempt to do
flatten and apply current state of all buffs onto target every frame
only have to deal with variable n of number of live buffs, and no random crossing writes
the issue is if the values on the buff change. Such as a speed buff that decreases in strength as time goes on, or such. Having a buff that holds a "flattened" representation of the buffs loses any references that could be used for such a thing
the flattened stack of buffs would be current each frame, so the buffs being updated by other systems would be ran first, giving a live value before the flatten
how does that get around the random write?
I think that's how I'm doing it now essentially
run for all buff0 - store into hash map containing a all buff stats struct
run for all buffN - store into each hash entry, updating
run for all targets - lookup read each value
just have to use a stable ID for your targets (entity is stable)
all linear loops. followed by a single linear random lookup and write.
I will note that people argue about buff systems a lot in here and dots fourms, wait a few hours and someone will give you another way to do it
because of the whole target-event-ref setup theres about a million ways to pull off buff systems
tbh that's why I'm so excited about DOTS and performance stuff in general. OoP got to feeling very linear for me for many years. DOTS feels like an art form
since I imagine your buff-able values are a small set of values, it makes sense to just have a struct that contains all values within it, to act as your flattened value. you can concat values too, so have +50% move, added to +100% move
then your apply final run is just, evaluated current movement speed = 2346% move buff * base input move value
if you get stuck on this let me know and I'll write a system that does this (contrived ofc)
I think I'm good with all the help I've received so far. I didn't really consider hash maps. I think I'll get that implemented and then compare it to the random read and writes, see what ends up being best
sounds good, in my personal experience a hashmap setup usually wins
my issue with hash maps is its outside the automagic dependancy tracker
more data is always nice
so you may need to watch job handles
shouldn't have to at all
just chain your system that flattens and write out at the end of the chain
yeah I got a (literal) crash course in job handles earlier, even if I have to do shenanigans with them should be good
other system come before or after it will already complete or be scheduled before
sorry just clicked, you dont read the buffs out of the hashmap, just using it during caculation?
try to work with the system, get the hang of the golden path before getting zany with the scheduling
yeah, either you try to do safe read/write to it for the multiple buff type passes, or you swap chain the buffer and alternate two hashmaps for read write
if you got the swap chain route, you can get a easy win by warming up both hashmaps in the first job (write to both)
then you wont have any new buckets getting alloc'ed later on
Theres no concept of single producer multiple consumer anywhere in dots is there?
like i want to watch when Translation gets updated, then trigger a bunch of stuff
๐คฆโโ๏ธ With Change Filter would do that...
per chunk level is economical, but you have to scan though the chunk and find the ones that actually changed (hopefully more than one)
yea thats what im thinking
but after that it would be nice to have just a single 'thing' that can then trigger all the next stuff, eg a native stream but with many readers
will probably just make many native streams (1 per reader type)
events and caching are somewhat complex to do performant, I just keep my stuff light and run it all the time
event entities for the small N, and it really hasn't failed me
normally i would agree, but this is for network syncing stuff and I dont want to be sending the same info over and over
I'm probably going to have to keep a cached copy of the last value and then combo checking that value and WithChangeFilter
oh for networking at I keep that signal updated every frame and checked every frame
even at 2m network entities it was still fine
just have to make that really really light, and let hashmap generate the much much smaller set of whats actually read to be processed
custom, only within burst and entites
and what trasport?
unity transport before, but its migrated a few times now
I'm currently using litenetlib due to some external prototyping
working on a cloud setup with some raw servers in c# for the moment, and eventually will move them again later
yea that makes sense
the unity side is now the small side, being a single client
so it doesn't matter what I pick. its only the server that has to handle the big work
how did you find using unity Transport?
well a year ago it was fine. its just a thin wrapper over c sockets at that time
tested to work within jobs/burst which was more restrictive then
whats your project?
VR social sandbox on a few different platforms
the core of it has be fully dots since 2018 when it came out
the rendering isn't obviously
i considered messing with VR + dots ages ago, but had enough issues using all the core gameobject stuff from the sdks
I check in every few months, its getting close but still not there
whats the new unity XR stuff called?
my index just sits around gathering dust atm, would be nice to develop something for it
good luck, I've been at this for so long now
I'd like a clean break from VR, but that isn't happening
๐ ill probably just stick to building a mp stack that will be enough work
yea im good at that
for now just a mp stack and some samples is what i want to make
my last attempt got everything working but was annoying to work with
as it was game + networking
and was too easy to break the codegen which then breaks your project code
What do you mean by persistent reference?
oh my mistake, let me change the question
question changed (more open ended)
Any method to get a reference(works thoughout runtime)(be it index or other wise) to a shared component?
note: I will not modify the data and the related component after grabbing the index
I mean if your component is implemented as a class then I guess you're getting a reference - but I'm still not sure what you mean by "works throughout runtime"
Works how?
its just unique rendermeshes and physicscolliders these two
but they are pre-generated pieces as part of a terrain generation
and putted into entities that do nothing but hold them
do just use getSharedComponentIndex?
I'm not sure how the shared component indices are implemented to be honest, my guess would be that they are recycled since shared components are ref counted
I need to swap them in place with actual terrain pieces in the world
hmmm, fair
wait, I may have found it, but i need someone to varify
at paragraph named: SCD data removes itself when no one is holding that SCD index anymore
https://gametorrahod.com/everything-about-isharedcomponentdata/
quote
Removing things from List<object> is done by just null the element. So all ever happen to this List<object> is .Add. Never .Remove. This way we have no need to go and update all the existing indexes on all the chunks, making sure they are always usable.
does this means the int index does not change throughout runtime?
today's activity
Isn't that just when you last refreshed ๐ ?
Or are you showing that you've been pressing that button since this morning? ๐
Why are you so eager to break your project ? ^^
That doesn't require you to update, only to install entities in the first place ๐
I like DOTS but I'm not into the number of versions of Unity I now have installed and the intricate web of dependencies which could change at any moment of working with preview packages ๐
Yeah we are all crazy people here
need moar speed ๐ฌ
How long has it been since the last release 4 months?
feels like 4 years but yea, end of October.
tbf if it's the first time that Unity are testing all the DOTS packages together, it's a wonder it's not more like a year
Which is actually a really good thing since we will finally have a release of dots packages that just works.
But I still miss my package updates
...
Wait there's a release that just works? I don't believe it I'm going to have to try it
C#'s built in crypto classes don't work with Burst, right?
I need client to send SHA1 digest of files before they upload to the server so server can do duplication check, files can be up to 30MB and the game is targeting mobile of all ranges.
I'm worried that it might be too much for low end mobiles to do cryptographic hashing on files of that size, thinking maybe I could move it to Burst to speed it up.
Hi guys strangely enough I am not getting any feedback on the animator package in the slack unity dots channel, so I wonder if any of you used it yet
ping me in case, I have a simple question
I've only looked at the examples. I think @safe lintel ... here they are ๐
seems like no 0.17 release today?
ive used it, not sure if i can help because its a beast
also .17 is out on my package manager
Looking that way
thanks @amber flicker I am wondering if the Gameobject conversion already works for it or I have to rig from scratch
im afraid to update ๐ฅฒ
must be a really nasty bug in there. 0.17 was released on 11-13
I think some exists? Depending on what you want to do there's like RigComponent and other stuff... sorry don't know much
conversion works, have you tried the animation samples @scarlet inlet ? it will need to be in a subscene if you want it to work in a build
I tried to convert a rigged GO to a subscene and nothing happened
holy moly.. there it is ๐ฅณ
did you check out the examples?
so I am using the scoprion example, but I am not sure how it would help
what else do I have to check?
lol, 0.17 just released? have to check
Click show all versions
what are you expecting to happen @scarlet inlet ? animators themselves are discarded, theres no conversion yet for animation controllers > dots (dataflowgraph) animation nodes
cool! i can see 0.17 too with 2021.1.0b2
forgive me I am actually not really used to hierarchies with bones in Unity, but I can see that the SkinnedMeshRenderer is not converted either
I can see it in the package manager ๐
I swear I did it and it wasnt there a few minutes ago, now it's OK ๐ ๐
if there is something I have to study/check please let me know @safe lintel
does the model show when its converted?
I see, I am realising now that it's a robot that dxoesn't need blending so I didn't realise it before
the basic vertex skinning shader is what im using as a starting point
interesting I will try and explore more, but surely I am still a bit confused
you're not the only one.. it's impressive how confusing it is
well it's still preview and I am not surely using it for produciton
I just wanted to make a demo
note that I do use entities havok ecs in production ๐
one more thing, assuming you have show dependency packages enabled, you should import the DataFlowGraph "Guided tour in code" samples for reading
is that the tutorial package? Because I removed it
i consider it essential to understanding how animation is setup(until they release a visual component to all of this)
I will check it
yeah its a set of like 15 scenes that explain DFG, and everything in animation is built on top of it
@safe lintel how come you know it so well?
i spent ages learning it because I really want animation in my project, and to ditch gameobjects for good
ok now tell me, why have you been more useful than the official unity team ๐
self-oooof
the code reads like only 2 people at Unity understand it...
i dont know, im just happy they made a self help forum after all this time ๐
you mean this server?
new animation package too. lets see how much stuff breaks..
Dang, still can't use struct shared componets in a foreach
0.17!?
nice time to update
wow batching ecb looks cool
yo Entities.WithFilter(NativeArray filteredEntities)
more micro optimization
๐ฅณ
ugh this definitely isn't going as smoothly as I'd hoped
yea I'm also curious - assume it's to do with editor selection?
Hybrid still just silently fails to render if SRP batcher is enabled
Deprecated Frozen component as it is no longer in use
we had a frozen component!?
yea but it was obsolete I think? some static optimize component or something now? unsure
@safe lintel with the right shader I don't have errors but still didn't work. I will study all the new info you gave to me before to ask other questions
I have no idea what this means...
damn these errors are unhelpful - just pointing me to blank lines
so now that we have 0.17... should we now hammer the dots team for 0.18?
wait.. can we not use SetSharedComponentFilter within an ISystemBase.. gah
are there any docs or samples for isysbase?
not 100% - too many errors to know exactly what's going on but I think it counts as managed
stuff like this (0,0): Burst error BC1042: The managed class type `System.IntPtr` is not supported. Loading from a non-readonly static field `Unity.Jobs.IJobExtensions.JobStruct`1<Unity.Collections.LowLevel.Unsafe.UnsafeDisposeJob>.jobReflectionData` is not supported ยฏ_(ใ)_/ยฏ
pointing to a closing bracket of a job struct.. so.. I guess something in the job
that's a relief... could you just add a ResetFilter for a quick check while you're there? no idea why it'd be different
But that system is not burst compiled is it?
oh
Wouldn't you have to add a BurstCompile attribute on top of the struct and OnUpdate method
oh nice, ISystemBase just works like regular SystemBase
yea I believe so
Yeah you're right
That broke it
Rip again
Hmm - if you set the shared filter outside the bursted function it actually does work
That still kinda breaks it for me though
any updates to the hybrid rendereR?
Like if I set it in OnCreate it works
I set it in a loop in update so no go for me but good to know
@scarlet inlet If you havent already, would definitely start out testing the samples repo(where that shader is located first) before embarking on custom models. i also noticed issues with humanoid rig models, though one of the samples uses a humanoid rig I wasnt able to get them to work(switched all to generic)
Yeah it's been updated, changelog on the web is not updated yet
cool
## [0.11.0] - 2020-11-13
### Added
* Frame queuing limiting solution to avoid hazards in the GPU uploader
* Hybrid V2 should now render objects with errors (e.g. missing or broken material) as bright magenta when the used SRP contains compatible error shaders, and display warnings.
* Support for lightmaps in hybrid renderer. You will need to bake with subscenes open, upon closing the lightmaps will be converted into the subscene. (Note: Requires release 10.1.0 of graphics packages).
* Support for lightprobes in hybrid renderer. Entities can dynamically look up the the current ambient probe or probe grid. (Note: Requires release 10.1.0 of graphics packages).
* Added error message when total used GPU memory is bigger than some backends can handle (1 GiB)
* HybridBatchPartition shared component that can force entities into separate batches.
* It is now possible to override DOTS instanced material properties using `ISharedComponentData`.
* RenderMeshDescription and RenderMeshUtility.AddComponent APIs to efficiently create Hybrid Rendered entities.
### Changed
* Log warning instead of error message when shader on SMR does not support DOTS Skinning
* Update minimum editor version to 2020.1.2f1
### Fixed
* Fixed float2 and float3 material properties like HDRP emissive color to work correctly.
* GPU buffer now grows by doubling, so initial startup lag is reduced.
* GPU resources are now cleaned up better in case of internal exceptions, leading to less errors in subsequent frames.
* Hybrid Renderer forces entities using URP and HDRP transparent materials into separate batches, so they are rendered in the correct order and produce correct rendering results.
* Fixed a bug with motion vector parameters not getting set correctly.
* HLOD conversion code now properly handles uninitialized components
* Removed internal frame queuing and replace it with frame fencing. Hybrid renderer will now longer wait for GPU buffers to be available, making it easier to see if you are GPU or CPU bound and avoiding some potential deadlocks.
* Disable deformation systems when no graphics device is present instead of throwing error.
* Fixed a bug with converting ambient light probe settings from GameObjects.
@safe lintel btw do not update animation package if you still want to use the examples ๐
wait... am I crazy or can you no longer set a public int in a job? That's what this error points to but it must be something else right?
was thinking of starting a project using the ECS paradigm and was wondering if anyone here would recommend it, I worry a bit since it's still in a "preview" stage. I mostly want to use it to keep things organized and scalable but I'm wondering if it's more effort than it's worth lol
If you put in the work it will keep things organized and scalable for sure
It's not easy though
I didn't get an error from it
yea... it's a lie
maybe this wasn't the right system to start with ๐ฌ
huh
wow
ah they actually put compile time errors to blobs now if you add in a managed reference/pointer by mistake lol
I wonder how you found that out ๐คฃ
ok... looks like my strange System.IntPtr error was due to calling ScheduleParallel on IJobEntityBatch with an entity query - talk about cryptic error
thanks
Oh, wow. Time to introduce new and unexpected bleeding edge bugs on top of heaping pile of existing issues. ๐ฅณ
did transport and netcode update too?
arrays are considered non blittable so you can't use arrays in struct ICD.
if you want to use an array in an icd. you can use class/manage ICD's
no wait... arrays are blittable according to msdn. oops
@scarlet inlet figured it out, there were little additions or subtractions of in for node interfaces, ie in MessageContext ctx is now MessageContext ctx also for kernelnode update interface uses in KernelData data instead of just KernelData data
but they also made some animation components internal, damn it had a working switch to ragdoll and stuff and this update breaks that ๐ข
If you have a need for a small list of ints in a componentdata then FixedListInt32 FixedListInt64 FixedListInt128 etc are good candidates
we need to wait they update the examples
i will go pout on the forums ๐
so.. if want a length less than 32.. it's not possible? i gotta at least use 32?
my lambdas that don't match any entities seem to be taking about 1000x longer to execute over nothing than before.... wut
yes
what happens if i make a struct more than 32 bytes and try to allocate a fixedlist of 32 bytes for it?
it'll just move to the next chunk
well if it exceeds the fixed container size then I assume it will throw an error
what's EntitySelectionProxy in 0.17? edit: Oh, it isn't new, something editor related
trying to think of how to implement rooms, obstacles, and containers in ecs for a MUD. like... So... should i do like... a node-based structure? So FixedList<Entity> for children and each child has an Entity Parent field?
and then i guess if i want obstacles and containers to have different functionality... i have to make them all entities
thinking of everything in terms of data is messing my mind
i cant have multiple components of the same type on the same entity right? i have to use a dynamic buffer then?
could also make more entities and reference them on your main entity, but yes, only one component type per entity
im pretty confused on how to structure rooms, exits, and doors
in oldschool muds i think they just have each room having an array for exits where each index is a direction...
but that's too limiting i think
so if i wanna be able to add/remove functionality i guess i need to make stuff entities so i can add/remove components from them.. so i guess i'll have to use a bunch of entity references... dunno how hard that is to manage or if that's slow
How is system execution order determined
i think this explains it
https://docs.unity3d.com/Packages/com.unity.entities@0.16/manual/system_update_order.html
can i make generic systems and will they be autocreated?
so... interfaces in ecs aren't really the same as monobehaviour? instead we just use abstract systems?
so like.. instead of interfaces on monobehaviours... all the functionality stuff is just... system stuff?
anyone figured out how to use ISystemBase yet? ive made a simple system yet it doesnt get added to the loop(automatically), I assume there was nothing more needed to make it work?
The methods for referencing unmanaged systems are internal and netcode has no support for unmanaged systems
That's a big yikes from me
oh wait.. generics can't use structs as the type param... so generic systems aren't really useful i guess?
ah false alarm, was using class instead of struct for ISB
Did anyone test HybridRenderer 0.11 yet? Did they fix the bug with LODs crashing HR after LODed entity is destroyed?