#archived-dots
1 messages ยท Page 140 of 1
Yep
dynamic batches
I guess that part of RenderMeshSystem takes that (most part if not all)
Something like AddBatch
Guys, is dots really worth it?
RUN RUN WHILE YOU CAN!
Or it is just for specific cases?
Guys, is dots really worth it?
@wary kilnperformance by default.
or not
@loud matrix it indicates only that other system jobs takes long time
And camera follow only wait when that other system jobs completes
Yeah but i feel like it is a lot more complicated @naive parrot
@wary kiln depends on what you seek out of it. which part , or all of it.
Yeah but i feel like it is a lot more complicated @naive parrot
@wary kiln It's simple and easy
ECS for architectural gains or entire stack , mainly Jobs/Burst for speedups
Tiny is for you if you targeted to web
Tiny is for you if you targeted to web
@storm ravine What do you mean?
@loud matrix check timeline profiler here and you'll see what takes that 49ms
one of the biggest deciding factor is how much experimentation and research you willing to do thats not readily accessible out of the box as of today. @wary kiln
@storm ravine What do you mean?
@wary kiln Project Tiny.
@wary kiln it might be worth looking at their Tiny DOTS samples: https://github.com/Unity-Technologies/ProjectTinySamples
Their tiny racer game is a mobile web gl game
@storm ravine What do you mean?
@wary kiln its a runtime package for bite sized game based on DOTS
Well it's tiny enough ๐ not so different from network racing game ๐
tiny is impractical when it stripped down version for full blown DOTS at this point. and far more incomplete
and undergone so many re writes
not reliable or ready for production at all
its in limbo from what i see
But what is dots mainly applied? I have seen it used for a big numbers of entities
they keep changing its scope and definition
Every thing can be Tiny, but how tiny it will - up to devs ๐
So it is useful for a lot of entities
But does the performance increase is significantly in a first person shooter game?
there are fundamentally 2 gains you can get out of DOTS. 1 is architectural pattern using ECS. 2nd is performance using SIMD friendly code that runs nicely on multiple core using Jobs/Burst
Does dots improve graphics performance?
HRv2 yes
But does the performance increase is significantly in a first person shooter game?
@wary kiln its not that definitive if you are not capable of writing well optimized low level maths operations that go wide well on parallel cores
Im using the urp
HRV2 is stilly mainly HDRP focused but better support for URP is planned
it is. its an entirely different paradigm from OOP. DOD
Yep because HR team was targeted on HDRP first, because of Unite sample projects ๐
@storm ravine Really don't know to read timeline profiler, where should I be looking?
click at long LambdaJob
@loud matrix your ForEach generated code
Where are you seeing this?
read the method name
Well thats easier than scroll for zooming ๐
sure is
works across the editor to focus on stuff. including animation curves. quite handy
What if I say that you can even see jobs flow here ๐
One massive display of my incompetence at a time please @storm ravine
Does all those Dots packages make the webgl build bigger?
An empty classic unity project would be like 3 to 4 mb
Seems I have an older package soemwhere
2019.3?
Yup
Ah ๐
You on fancy pants 2020 beta?
We always on latest beta
and from time to time on alpha
That flow looks like this
Ahh, I tried setting it up at start but had some conflicts the day i was setting up.
White lines and arrow, which show your system jobs flow
For 2D, what's the difference between the Entities and 2D Entities packages?
Do I need both?
2D Entities is for Tiny
Ok
Ok. So for a regular 2D game I only need Entities?
When you install 2D entities you'll have entities also
Ok
2D Entities you need when you use Tiny
@storm ravine One more quick question. How much has ECS changed over the last year? Is a tutorial from a year ago still going to be relevant?
Which tutorial?
I'm taking a look at this
Learn how to Draw a Simple Sprite with Pure ECS in Unity 2019.
โ
Get the Project files and Utilities at https://unitycodemonkey.com/video.php?v=6eV9NR3Vb9U
Getting Started with ECS in Unity 2019
https://www.youtube.com/watch?v=ILfUuBLfzGI
If you have any questions post them ...
and Code Monkey's other stuff
Some of his stuff has been changed, usually to easier ways of doing things like setting up Jobs
Ok
And look at changelog of course
I guess I'll watch through the tutorial to get a rough idea then look at the docs
Make sure to ask any and all stupid questions here, hopefully It till make me look better. Or worse, more likely worse.
Ok, I'll probably have a lot of questions to ask here haha
Check forum first
It already have answers to all "beginner" questions a lot more than once ๐
@storm ravine Wait does ECS not support Linux yet?
I'm getting DllNotFoundException: libdl.so after doing nothing
I have my PC dual booted with Windows/Linux, so I might have to switch to Windows for ECS stuff
Install libc6-dev
Okay I'm installing it
And restart Unity after that if opened
It should solve your problem
I guess you see Burst in that error message ๐
I'm curious, are you on Linux as well?
Am i blind or is there no current docs for unity.mathmatics? The latest docs is just a single page and the old one is missing some bits.
https://gist.github.com/Suj33t/a850fd2571314c00aeb269a2163c6811
@loud matrix tried rewrite some of your logic in math lib for jobs/burst friendliness. it can be improved. tried to not plug drastic alternatives so it makes sense in previous context.
All "docs" for mathematics is inside source code
@storm ravine Yeay that fixed the error! I can't thank you enough
Got a nice clean error log now ๐
@loud matrix like this:
@storm ravine thought as much, annoingly my goto def doesn't work and I've been trawling the git repo to try and find stuff
@loud matrix should vectorize nicely on burst compilation. havent run since couple component were missing on my end. do check.
I'm in VSCode so guess not exposed there eigther
Guess I'll stick to using the git repo for my docs then
@naive parrot thanks Ill have a look ๐
Well i'm on Rider, thus source code already here ๐
Even without resharper decompiler
Unity show all source code for packages in pretty nice way
Stupid Jetbraisn and their new subscription model, I had their entire suite back in the day but it's all useless now
Why useless?
You no longer get a discount for "owning" the old versions
unless they flip flopped on it again
I switched to rider after 7-8 years of VS, first step was resharper, and now I don't even think about moving out from rider last 2-3 years (I count only IDE for Unity here, not every IDE\code editor which I using)
I just really dislike their new business model, expecially how they changed from ownership to subscriptions as it kinda screwed me over
I'd use Atom if it wern't such an arse to setup for c#
Well tere is subscription ages on backyard, everything is by subscription ๐ But it's personal choice of course ๐
- it also perfect IDE for mac ๐ IMO
Yeah we still pay for webstorm for macs, though I probably should cancel that. I started using Atom for easy switching from my PC to work MAC
Yep webstorm in my work IDE list too
Hello Again.
First Thanks for the help , I was able to figure out how to do what I wanted, I ended up using a custom Native Container and a Custom Job to iterate over it. It works like a charm.
Quick question I didnt find in the Docs. How can I link a Dispose from a NMHM to a Job? Dispose(Job) is not working.
Hi Guys
how can I get unique id of an entity cause the index and version seems to be changing all the time ?
@sleek ember AFAIK ... you cant and you shouldnt.
Wait.. I thought once you have a Entity as long as you dont destroy the enity (with things like EntityManager.DestroyEntity) it will always be valid and point to the same thing. As long as you use Entity, not saving things like Entity.Id
@chilly halo do you want to dispose your native container at end of your job? you can pass jobHandle to nativeContainer.Dispose( ) if thats what you need..
@sleek ember Entity is *an *unique ID itself. the version/index constitutes to that. dont think you should be generally using its intrinsics for any kind of lookups. https://docs.unity3d.com/Packages/com.unity.entities@0.10/manual/version_numbers.html
https://docs.unity3d.com/Packages/com.unity.entities@0.10/api/Unity.Entities.Entity.html
To represent the same entity, both the Index and the Version fields of the Entity object must match.
@naive parrot I think I know why is not working.
I have something like this.
OnUpdate(JobHandle inputDeps)
if(something)
---For(some loops)
--- --- JobHandle myDeps = default()
--- --- myDepsDeps = Job1.Schedule(myDeps)
--- --- myDepsDepsDeps = Job2.Schedule(myDepsDeps )
--- --- myDepsDepsDepsDeps = Job3.Schedule(myDepsDepsDeps )
--- --- NMHM.Dispose(myDepsDepsDepsDeps)
return inputDeps;
Those Jobs dont have any dependency with inputdeps, but the dispose complains that Job2 needs write acces to it and cant be disposed that way.
your first JobHandle , myDeps should be inputDeps i think instead of default , to ensure correct chaining
in case thats an oversight.
@chilly halo You have that For... (some loops) could you have many calls to the same NMHM.Dispose from different jobs?
@naive parrot
Its not... but I already tried that.
The thing is that those jobs are being scheduled inside a For loop where I loop through SharedDataComponents to run those Jobs only within that filtered query. Inside I create the NMHM with a TempJob Allocator. That NMHM is used inside those jobs to write and read some values. I want to be disposed when the Job3 finish for each loop.
arent you then supposed to 'carry forward' your latest job handle from each iteration to next in order to ensure the chain is sequential and valid?
yeah
So.. the execution order would be something like this...
new NMHM x
Job1 <- Default
Job2 <- Job1
Job3 <- Job2
x.Dispose(Job3)
new NMHM x'
Job1' <- Job2
Job2' <- Job1'
Job3' <- Job2'
x'.Dispose(Job3')
For some reason that doesnt work either... same error
InvalidOperationException: The previously scheduled job LiquidBehaviourSystem:<>c__DisplayClass_Liquid_Processing writes to the NativeArray <>c__DisplayClass_Liquid_Processing.JobData.simulatedEntitiesParallel. You must call JobHandle.Complete() on the job LiquidBehaviourSystem:<>c__DisplayClass_Liquid_Processing, before you can write to the NativeArray safel
Actually Im not really sure if that execution order is even valid...
is that top level for a regular for, or a entities for each?
ah alright, shouldn't be a issue
make sure you carry forward all the jobs into each other
then if its still giving the write errors like above, add in disable safety calls on the foreach
@low tangle
So.. the execution order would be something like this...
new NMHM x
Job1 <- Default
Job2 <- Job1
Job3 <- Job2
x.Dispose(Job3)
new NMHM x'
Job1' <- Job2
Job2' <- Job1'
Job3' <- Job2'
x'.Dispose(Job3')
Okay I will try disabling safety calls. But this should be doable , right?
Also... Job3 have a EntityCommandBuffer with a Job3 as Producer , that shouldnt be a problem... I think.
you can disable the checks as long as you are 100% sure they dont overwrite
(Y) ๐
everything you add increases size
of course if you go with dots runtime / project tiny then you'll get really small end result
No
Not project tiny
Just normal unity engine but with dots
Like how much could it increase?
try it
you are asking something someone else would need to try for you
could just as well as be you
my build went from 15mb to 45mb on android after i added entities/jobs/burst/math/physics/ packages. make of it what you will. rough figures. there were some other contibutors as well like new input system package. its pretty much blank project with basic touch balll that can be rotated.
and yes all the dots packages compile to build since am using all of it in code. if there is stripping doubts or such
it totally depends on which packages you install too
@naive parrot thank you very much
Ok, confused about something ... I'm using the following code to spawn a bunch of cubes using a command buffer:
{
for (int i = 0; randomNumbers.Length > i; i++)
{
Entity cubeEntity = endSystemCommandBuffer.CreateEntity(cubeArchetype);
endSystemCommandBuffer.SetComponent(cubeEntity, new Velocity() { Value = new float3(randomNumbers[i], 0) });
endSystemCommandBuffer.SetSharedComponent(cubeEntity, new RenderMesh() { mesh = mesh, material = material });
}
})
.WithoutBurst()
.Run();
This works ... if I use an entity manager to spawn 1 entity based on cubeArchetype first!
Why ..?
If I don't create a single cube before running this job, nothing happens.
@outer swift Maybe post whole system, do you know it's running? You sure you set up cubeArchetype correctly, and it is not created from your "first spawn"? Have you checked the Entity debugger?
I know it's running
I generate 12 random velocities for the new cubes, and apply them. Then I see 12 cubes move in random directions from the center of the screen
Anyway, I'll post my init as well
I'll reiterate Jaws: You'll need to show the system. Not just the method you find relevant ๐
Initialization:
{
public Material exposedMaterial;
void Start()
{
GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
MeshFilter filter = cube.GetComponent<MeshFilter>();
cube.SetActive(false);
mesh = filter.sharedMesh;
material = exposedMaterial;
DefaultWorldInitialization.Initialize("World", false);
world = World.DefaultGameObjectInjectionWorld;
EntityManager entityManager = world.EntityManager;
cubeArchetype = entityManager.CreateArchetype(typeof(Translation), typeof(LocalToWorld), typeof(Velocity), typeof(RenderMesh), typeof(RenderBounds));
entityManager.CreateEntity(cubeArchetype);
world.CreateSystem<CubeSpawnSystem>();
world.CreateSystem<CubeMoveSystem>();
}
public static Mesh mesh;
public static Material material;
public static EntityArchetype cubeArchetype;
private World world;
}
Spawning:
[BurstCompile]
[UpdateInGroup(typeof(InitializationSystemGroup))]
public class CubeSpawnSystem : SystemBase
{
protected override void OnCreate()
{
base.OnCreate();
query = GetEntityQuery(ComponentType.ReadOnly<Translation>());
initialization = World.GetOrCreateSystem<EndInitializationEntityCommandBufferSystem>();
}
protected override void OnUpdate()
{
int target = targetCount;
Random random = new Random(++seed);
int count = query.CalculateEntityCount();
NativeArray<float2> randomNumbers = new NativeArray<float2>(target - count, Allocator.TempJob);
Job.WithCode(() =>
{
for (int i = 0; i < randomNumbers.Length; i++)
randomNumbers[i] = random.NextFloat2Direction();
}).Schedule();
EntityCommandBuffer initializationCommandBuffer = initialization.CreateCommandBuffer();
EntityArchetype cubeArchetype = Entry.cubeArchetype;
Material material = Entry.material;
Mesh mesh = Entry.mesh;
Job.WithCode(() =>
{
for (int i = 0; randomNumbers.Length > i; i++)
{
Entity cubeEntity = initializationCommandBuffer.CreateEntity(cubeArchetype);
initializationCommandBuffer.SetComponent(cubeEntity, new Velocity() { Value = new float3(randomNumbers[i], 0) });
initializationCommandBuffer.SetSharedComponent(cubeEntity, new RenderMesh() { mesh = mesh, material = material });
}
})
.WithoutBurst()
.Run();
CompleteDependency();
randomNumbers.Dispose();
}
private uint seed = 0;
private EntityQuery query;
private int targetCount = 12;
private EndInitializationEntityCommandBufferSystem initialization;
}```
Ah
One thing is taht I believe you will need to force the system to update as it is now looking for something matchign that query before running
Ahhh, right
So [AlwaysUpdate] or something similar may help on the system (still looking)
That does make sense, I was a bit wat that the console reported the job as an Entity.Foreach since, well, it's a job
I'd recommend using commandBuffer.Instantiate to be honest
But if a job is just a different front-end for what amounts to an Entity.Freach, theeeeen ...
Instantiate and pass in a GameObject?
No, you can send it an entity that is precomposed
Ahhh, right
You can create an entity before hand from a GO
GameObjectConversion that nets you a entity 'prefab' with components initialized on it.
Dang, I thought that was ... what the archetypes were for -_-
Well yes and no
To do it in pure code
Buuuut
In this case you are not getting really any performance increase
I don't really want to use a GameObject, the point of the exercise is to learn how to deal with entities from ground up
I don't really care about performance, I'm just wrapping my head around the syntax for the time being.
Well the syntax is the reason for the performance ๐
1: you are completing the job system (not good creates a sync point)
Yeah, I was wondering about that.
I clearly need to read some more documentation -_-
2: if you are making a sync point, you should not really use the command buffer
is complete even valid since .Run( ) is used there its all main thread. no relevance of sync point.
I want to avoid sync points, that was the point of the command buffer.
Yeah, the filthy job wouldn't run without it because I'm passing in a Mesh and a Material
Schedule is the one you want ๐
Hence why I recommended instantiate
As you can set all that up and it will handle it
Yep, that makes good sense
Buuuuut how do I avoid my "template entity" being part of the game?
So. They have a component called prefab
2: if you are making a sync point, you should not really use the command buffer
@solar ridge very broad generalization i would say. ECB are more useful than just deferring structural changes. lets you design and order your systems in streamlined fashion.
Fair
If you pass in your object as an entity to store for later I believe it auto generates that prefab tag
as long as it is not in the scene hierachy
But how can I use the entity manager to create an entity without putting it in the world?
The entity manager is a feature of the world, no?
it is. entity exist and are tracked by world
This is where the editor and authoring components come into play.
Or will the Prefab component prevent it from acting like an entity?
"Pure" ecs is still a bit of a miss leading concept until they get Core 100%. Especially with them dancing around what hybrid is
Sad. I was hoping I could do this purely.
This is pure.
ALL you are doing is makign it so you are able to construct it in editor
But it is changed to an entity and GO destroyed on world load
(or kept if you desire)
Yeah, in my world "pure" would be via code and without strange data-from-editor workarounds
Then in that case, make an entity in code
Add the prefab component
And create this entity with all the data you want
Then instantiate using that entity
its possible. you would still want data from somewhere for any sort of initialization.
๐
Which then means EVERY change you want has to be done there in the code
Which takes a lot more dev time
In some cases it is useful. In many cases, you are reinventing the wheel
Yeah, I'm not worried about that since I'm just experimenting to wrap my head around how this all works.
hi, anyone had a problem with loading subscenes in player ?
I've been making games in Unity for 8 years now, so I've got a decent handle on architecture for game systems.
i get this error in playerlog and can't really solve it
Im interested in the science novel @storm ravine is writing as his game thus far looks neato!
NOTE: In order to load SubScenes in the player you have to use the new BuildSettings asset based workflow to build & run your player.
Anyway, @solar ridge and @naive parrot, thanks for the help!
1: you are completing the job system (not good creates a sync point)
@solar ridge no it's not a synch point. Job.WithCode and his Run doesn't have any synch point itself. Only structural changes throw synch point (mostly EM calls which I mentioned here yesterday)
Ah. Thought they made Run complete the jobs
Calling Run on job doesn't mean it's synch point. Moreover it even not used any jobs chain
I't just fully independent method with bursted code in his case\
Cool. The following "CompleteDependency()" is creating a sync ๐
Like you just call method and forget and all your other jobs work as if there is no that Job.WithCode
If He trying to use it with EntityManager and use methods which trow synch point, only then it will be synch point job
EntityManager is literally pretty much all structural change haven , aint it.
Not all
Every EM call which can change data layout (Add\Remove components, changing SetSharedComponentData value (because it changes entity chunk), Creating\Destroying entities, SwapComponents etc.)
https://discordapp.com/channels/489222168727519232/497874303463850004/706614513956421702
Thus Get values, or set values (except SCD) not throwing synch point
with footer on each method explaining same "Sync Point" theory
They all documented
And in source code every synch point related calls have comment about that ๐
Yes it's docfx
which generates that from comments ๐
We also using that
pretty sure every single method causes sync point here lol : https://docs.unity3d.com/Packages/com.unity.entities@0.9/api/Unity.Entities.EntityManager.html#methods
atleast as many i have used/aware of
Ah
How so?
XD
depends on how you using ForEach it can be EM which still same EM with synch point calls
Or ECB
They have a method that calls the EntityManger unless in a foreach
WithStructuralChanges here only matter how it will behave ๐
I THINK something along the lines of ComponentDataFromEntity
But I am still trying to find it in the doc
GetComponent\HasComponent
Yep yep
And they in any case wouldn't cause synch point
No they wouldn't that wasn't the point
because EM calls under hood of that not causing synch point
what happened to ECS Visual Scripting. RIP? they turned to GO/MONO route ?
was doing fine by 6th drop on forum
I mean. For a single release sure. We will see what 9 brings
@storm ravine I'm not really sure what you meant by using altitude to do something else than InverseLerp; I cant get anything to really look like what it did with InverseLerp
well, how then?
Is there something like layers for the DOTS Unity physics? I would want friendly and hostile units to collide but bullets should only collide with hostile units (e.g. no friendly fire).
I have just found out that colliders of type CollisionType.Convex have a CollisionFilter property which contains a BelongsTo and CollidesWith bit mask. Will try to mess with that
@storm ravine changed my code to yours but it only generates small dots
Any good places to read up on how you're supposed to instantiate new entities from entities with the prefab component?
I have a half-working spawn system (it spawns entities ... under certain conditions), but it simply stops working at all when I add a prefab component to the entity I want to instantiate
@storm ravine changed my code to yours but it only generates small dots
@odd cipher replace 2 and -1 to 0.5 for you
I need that values for my specific case, in your case they should be 0.5
EntityManager.Instantiate(entityPrefab)
Ayy! That did it! It now works just like before
Let me give some context
{
int target = targetCount;
Random random = new Random(++seed);
int count = query.CalculateEntityCount();
NativeArray<float2> randomNumbers = new NativeArray<float2>(target - count, Allocator.TempJob);
UnityEngine.Debug.Log(count);
Job.WithCode(() =>
{
for (int i = 0; i < randomNumbers.Length; i++)
randomNumbers[i] = random.NextFloat2Direction();
}).Schedule();
EntityCommandBuffer initializationCommandBuffer = initialization.CreateCommandBuffer();
Entity cubePrefab = Entry.cubePrefab;
Material material = Entry.material;
Mesh mesh = Entry.mesh;
Job.WithCode(() =>
{
for (int i = 0; randomNumbers.Length > i; i++)
{
Entity cubeEntity = initializationCommandBuffer.Instantiate(cubePrefab);
initializationCommandBuffer.SetComponent(cubeEntity, new Velocity() { Value = new float3(randomNumbers[i], 0) });
}
})
.WithoutBurst()
.Run();
CompleteDependency();
randomNumbers.Dispose();
}
Ignore the CompleteDependency and WithoutBurst stuff.
Also ignore the mesh and material
its faster aswell
Ayy! That did it! It now works just like before
@odd cipher and now you can run it in parallel
Because you don't need to know any thing from other samples
Which world size?
what happens if you dont add prefab component to your entity ?
are you creating a prefab entity from a code ?
200 by 200
@opaque ledge The code runs as expected and generates 12 new entities moving in random directions but I get an extra entity I don't want
@outer swift fyi there's an overload for Instantiate that takes a NativeArray and uses the capacity to instantiate that many - probably quicker than creating one by one though you will still need to set value one by one. In this case I'm also not totally sure if the command buffer can use the result from the command buffers instantiate so a by-product might be it working.
you sayin it should be faster? :p
{
public Material exposedMaterial;
void Start()
{
GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
MeshFilter filter = cube.GetComponent<MeshFilter>();
cube.SetActive(false);
mesh = filter.sharedMesh;
material = exposedMaterial;
DefaultWorldInitialization.Initialize("World", false);
world = World.DefaultGameObjectInjectionWorld;
EntityManager entityManager = world.EntityManager;
EntityArchetype cubeArchetype = entityManager.CreateArchetype(typeof(Prefab), typeof(Translation), typeof(LocalToWorld), typeof(Velocity), typeof(RenderMesh), typeof(RenderBounds));
cubePrefab = entityManager.CreateEntity(cubeArchetype);
entityManager.SetSharedComponentData(cubePrefab, new RenderMesh() { mesh = mesh, material = material });
world.CreateSystem<CubeSpawnSystem>();
world.CreateSystem<CubeMoveSystem>();
}
public static Mesh mesh;
public static Material material;
public static Entity cubePrefab;
private World world;
}```
@odd cipher 0.35ms is time from profiler timeline for that job instance?
Yeah
@amber flicker Interestingly, it works under certain conditions
it's (Burst) in timeline?
Still optimizing the perlin stuff? nice
Yes
Yes to my question or to zero? ๐
@amber flicker If I use Create instead of Instantiate and don't add the Prefab component, it works ... but I still need to make that first Entity I don't want
both
you can put Disabled component to it as a workaround
That's incredibly inelegant
the first entity you don't want should disappear from the entity debugger with a Prefab component on it I think... when you look it at in the inspector it has the Prefab ICD?
Yeah, but if I add a Prefab component the code doesn't work
actually that 0.35ms is from editor so it may be faster in build
but not sure how I could check that
You can replace sample and noise height rows to math.mad
i never tried to create a prefab entity from code so i dont know if there is any difference between what Unity does to prefab entites and trying to create a prefab entity from code
0.35ms from a 200x200 perlin grid is absurdly slow
as in couple orders of magnitude
so i guess you are getting some pretty big overheads
It's multioctave perlin ๐
still very slow
- editor safety checks
cant you check how much does the "actual" burst job take to run?
without safety checks its 0.33ms
@outer swift so when you use instantiate, no additional entities appear in the debugger?
also,, I'm only using one octave right now
yeah but job system has random overheads for days. If you dig in the profiler, you can find where it actually calls the burst compiled function
@amber flicker When I use instantiate with a prefab component on the original entity, the spawn system doesn't even run
cant you check how much does the "actual" burst job take to run?
@vagrant surge it's already actual, he told that is job itself from timeline profiler which show you actual timesteps for jobs
@amber flicker Actually, when I think about it ... that makes a perverse kind of sense, since the first job the system does is count all the entities with a certain component on them, and that probably skips the prefab
So since there's nothing to count, the system doesn't run
exactly ๐
Well
Still doesn't exactly help me ๐
So clearly I need a different approach ..?
holy fuck thats slow
even worse than i expected
3 orders of magnitude now lol
have you tried to see how long it takes without the parallel for?
just burst, singlethreaded
try AlwaysUpdateSystem or whatever that attribute is and see if it works? Then if you're worried about the system always running you can look at either early outing or adding a run requirement
1.7ms
@amber flicker Exciting
I'm not really sure why its that slow ```csharp
[BurstCompile]
struct GenerateNoiseJob : IJobParallelFor {
public NativeArray<float> output;
[ReadOnly] public NoiseSettings settings;
[ReadOnly] public NativeArray<float2> octaveOffsets;
[ReadOnly] public int2 worldSize;
public void Execute(int index) {
int x = index % worldSize.y;
int y = index / worldSize.x;
float amplitude = 1;
float frequency = 1;
float noiseHeight = 0;
float2 samplePoint = new float2(x - (worldSize.x / 2), y - (worldSize.y / 2)) / settings.scale;
for (int i = 0; i < settings.octaves; i++) {
float2 sample = samplePoint * frequency + octaveOffsets[i];
float perlinValue = math.mad(noise.cnoise(sample), 0.5f, 0.5f);
noiseHeight += perlinValue * amplitude;
amplitude *= settings.persistance;
frequency *= settings.lacunarity;
}
output[y * worldSize.x + x] = noiseHeight;
}
}
@amber flicker Amazingly, that didn't work
@odd cipher it could be the noise function
Now it just says that the prefab entity doesn't exist
what exactly does that cnoise do
Actually maybe, because I'm also converting the output 1D array to a 2D array
@amber flicker I guess that might mean that the prefab doesn't persist from my init
@amber flicker So maybe I need to create that prefab in the same scope
Hmm
Let's try that
@outer swift try removing the set component? it might be because the ecb hasn't actually created the entity by the time you try and set the value? Unclear if they improved that recently or not.
cnoise pretty optimized and vectorized
y * worldSize.x + x why you doing that
you already have index
oh right, forgot to change that after making it a ParallelFor
@amber flicker That part works unless the original object is a prefab, so I don't think that's the problem
@amber flicker At least it works when I use CreateEntity instead
0.3ms now
hi guys, it seems like the environment lighting is broken when i use the hybrid renderer and HDRP. I used to have the same issue with the URP which i solved by disabling the SRP batcher, but I can't find the option for the hdrp.
@outer swift you want Instantiate to work and you want to use bulk instantiation wherever possible
Just one
btw the noiseHeight += perlinValue * amplitude; can also become a math.mad
@amber flicker Yeah, I'm trying to work out how to do this properly rather than pile workarounds on it.
and sample too
I mentioned that above
Set 128
or 64
1 for batch size bad here
0.2ms
@odd cipher With safety checks disabled? with jobs debugger and jobs stack trace to off?
@amber flicker Since the system was running in the initialize group, it actually tried to run before Start
Yep
@amber flicker And I created all the dependencies in Start
@amber flicker Do it in Awake instead, and everybody's happy
@outer swift nice - with hindsight I should have thought of that
@odd cipher mark the output as writeonly
@amber flicker It's not exactly obvious, and kinda uh
@amber flicker Breaks a lot of the standard intuition about how code is run
@amber flicker Since the system is not actually created until Start either, so there's a bit of chicken/egg mayhem going on here
I think once you know when things happen, it's not so bad. I know you're exploring the pure side of things but this is part of why having content baked at edit time and then used is attractive.
@amber flicker Since the system is always updated, it doesn't look like it actually needs to be created either. Spooky.
Sheesh, looks like you generally don't need to create systems. How very spooky.
I try to access BlobAssetReference<Collider> Value on PhysicsCollider inside a Entities.ForEach(...).ScheduleParallel();
This works sometimes but at other times randomly crashes my Unity Editor and as far as I see this happens after this exception: System.InvalidOperationException: The BlobAssetReference is not valid. Likely it has already been unloaded or released.
I have also tried to check if the BlobAssetReference is valid by doing something like this: physicsCollider.Value != null && physicsCollider.Value.IsCreated
What am I doing wrong?
The function that calls the Job could probably also be improved, as I'm converting the 1D output array to a 2D array

Not this func not involved here you see in profiler actual job itself time
alright
WHich batch size exactly you use?
64
It's ok
noiseHeight = math.mad(perlinValue,amplitude, noiseHeight);
replaced that row to mad?
I'm curious to see the bursted assembly
still 0.2ms
not sure what you mean by 22 WT
worker threads
its probably that then, because our functions are pretty much identical
Well it shouldn't tbh
because we looking at specific instance
on one thread
WT counts shouldn't count here
I'm not sure then
In my case it definitely use SSE because of xmm instructions, not AVX as I can't see any ymm in assembly
@odd cipher This is how your assembly should looks before cnoise
And c noise part
Small cnoise part ๐
I have barely no knowledge of the assembly
I forgot, is index an int or uint?
int
Well, that code already SIMD friendly as you can see, I think that job can't be improved more without huge core rethoughts and rewrites ๐
Yep definitely should be faster than multiplication ๐
Tbh burst compiler much smarter than before ๐
is there a way to get offline documentation for the entire DOTS/ECS API found on pages like: https://docs.unity3d.com/Packages/com.unity.mathematics@1.1/manual/index.html
it's in you package in Library->PackageCache->com.unity.entities@VERSION(Or any other package)->Documentation~
But it's only Manual part
API Scripting part is autogenerated by docfx from code summaries
hi guys, it seems like the environment lighting is broken when i use the hybrid renderer and HDRP. I used to have the same issue with the URP which i solved by disabling the SRP batcher, but I can't find the option for the hdrp.
I'm using the latest entities (0.10.0) with the latest hybrid
Should I use classic rigidbody/colliders or Physics Body/Shape..?
well colliders and rigidbodys don't work with entity's as far as I know ๐ค
Are the component colors in entity debuggers defined somewhere? Anyone know what white means?
rigidbody and colliders are converted into phssics body and shape, so you can use both, but i personally use body and shape
Good old docs, where are you ๐ฆ
These kind of docs @silver dragon ? https://docs.unity3d.com/Packages/com.unity.entities@0.9/manual/system_update_order.html#multiple-worlds
Yep, but with the colors described ๐
green = ReadWrite, blue = ReadOnly, red = WithNone, white = WithAll but checking just existence of component without getting any data๐ค
Would be nice if that was detailed somewhere, yea
I guess universal answer to that is It is just temporary thing, so there is no need of any documentation ๐คทโโ๏ธ
thx @warped trail !
Unity acquires Bolt ๐คจ wonder what that means for dots visual scripting
maybe they want to kill any kind of competition๐
๐คจ o wow
dots visual scripting = scrapped. Bolt now renamed to "visual scripting"
๐
its interesting they have taken this long to buy bolt
both worked on by different teams with increasing overlap in functionality over the next 5 years followed by an announcement to make a new pure dots solution? ๐
yea... seems like intriguing timing
Funny, I don't recall adding magical turbulence to stationary objects.... Well time to work out how I broke this again.
Oooohhhk thats a weird one
When the circled variables were there, they caused the shake
Is there some weird stuff with declaration of variables in a OnUpdate I clearly don't know about?
nope
How is if it changes
Smooth damp changing it isn't?
because in OnUpdate they in local space and reset every OnUpdate call and now they in class space and value stores through all OnUpdates
I'm not changing it from 1,1,1 though
oh sod i see what you mean
I remember why i was planning on rewriting that to use mathmatics now
As the lead developer of Bolt to this day, I am thrilled about the potential of putting this tool in the hands of more creators and allowing them to concretize their ideas in a visual way. Bolt started as a solo endeavor nearly four years ago, and over time, our team and community grew to welcome thousands of visual thinkers. Today, passing the torch to Unity means Bolt will enter an exciting new phase of its life. While letting go of a project you love is never easy, I have met the amazing people at Unity who will carry it forward and I am confident that Bolt is in the best of hands.
sounds like its a source code hand over rather than a company acquisition.
https://ludiq.io/blog/unity-acquires-bolt
Yep it's what they mentioned in blog and on Unity forum
acquired the Bolt visual scripting plugin from publisher Ludiq
oh damn
that's awesome
bolt is great
and i don't even like visual scripting
but new one basically rewrites your nodes into regular C# code
If they make it auto output DOTs I'm jumping ship from coding from scratch ๐
will they rewrite it to DOTS?๐
Unity has been working on its own visual scripting solution for some time. Our solution is built on the new Data-Oriented Technology Stack (DOTS) architecture, while Bolt and Bolt 2 are both designed for the classic, non-DOTS versions of Unity. This helps ensure that there will be visual scripting solutions available for users with DOTS and non-DOTS projects.
seems not
Aka unity will continue to be a steaming pile of contradictory packages for years to come ๐
That's its charm
one of them has to die in the end ๐
seems that pricing won't change either so not sure what changes now that they bought it 
I said it before, I'll say it again, i miss Flash!
None of these "oh which visual scripting package do I use" madness, you had ActionScript cancer and you liked it!
has anyone had a problem with FixedList with type of Enum ? it calls object.Equals when doing equality check so therefore burst gives error
yeah its a problem, you cant put an enum as key in hashmaps either
have to cast back and forth with int :S
Also be careful until next burst release in changing enums from byte to other types and back.
Burst cache incorrectly detect ICD types with enums which switched to byte and back, recommend you clean BurstCache folder inside Library
And can miss recompilation for some jobs which using that type
This is bug which I faced and we investigated that with guys from Burst team. Luckily problem finally founded and fix will be in next Burst release preview.12 as they told. Guys work really hard!
Anybody point me to a resource to understand what DOTS is? I've bumped up to 2019.3, not sure if there is something to take advantage of. Thanks!
enjoy^^
it might be tiny little bit outdated, we no longer use JobComponentSystem and we use SystemBase instead, after watching and understanding those videos you can check the ECS manual to see the differences, manual also has good examples
Oh, thanks for the tip! I know it's in flux.
@pliant pike they are translated into ECS components as far as I know
Right brain, I don't like you, and you don't like me, But we need to make a damn GOAP system with ECs now so we need a truce.
Does math.atan2 need the float2 (the Y and the X) to be normalized? Or will it work anyway?
i imagine you could use bit flags to represent certain actions for goap to figure out which systems to run ๐ค
its just not a good fit to the systems-based batch execution of ecs at all
goaps are in a way, a tree/graph. You navigate it. Virtuals and inheritance are actually useful on it
yea
that's where I have a hard time wrapping my head around - i'm actually curious as to how certain ai behaviours would be defined - aside from swarm like intelligence or fsm
wait we're using SystemBase now? does that mean that we can't use the usual job structs anymore?
you can use job structs, but Entities.ForEach and Job.WithCode are the recommended ways to write jobified code with SystemBase
hm okay. thanks
job struct (IJobForEach) will be deprecated eventually
IJobParallelFor and IJobChunk too?
nope
oh good. i already changed all of my IJobForEach to IJobChunk a few weeks ago. glad that wasn't a wasted effort
wtf
I hope this isn't a new trend
selling Bolt while being under Unity sounds super alarming
But wasn't Bolt acquired by Unity?
can we get rid of the subs if we pay for engine tools individually?
As in, Bolt gets absorbed?
"Bolt will continue to be sold on the Unity Asset Store. At this time, there are no plans to change Boltโs availability or pricing."
Huh.
"Unity will honor the commitment made by Ludiq to offer Bolt 2 at no additional cost to current Bolt users and to new users who purchase Bolt before May 31, 2020 (11:59 PM PST). Eligible users will automatically receive an individual license for Bolt 2 when it becomes available."
Yeah but that just means that
Bolt will be making Unity's Integrated VS
And then Bolt as a product will likely cease to be on Unity
And sold on other platforms
this is like the most pointless acquisition from engine users point of view
usually the engine users actually benefit from it
Eh, I can see why Unity does it
They don't wanna spend time on it. Get a company that does Lol
they didn't bought company ๐
Unity is excited to announce that we have acquired the Bolt visual scripting plugin from publisher Ludiq. Bolt provides a production-ready visual scripting solution for the current Unity architecture. Unity saw this as an opportunity to acquire the highly popular plugin to help artists and their teams improve workflows.
I see.
So they basically bought source code. So they can integrate it.
That would be beneficial to the end user
but Unity doesn't even dev Bolt
I'm currently failing to understand the motive in all this
To get an integrated VS
In the meantime we're having a lot of conversations about the road ahead regarding Bolt 2 and DOTS visual scripting, but we're not ready to announce any plan yet.
Why spend time on getting it done, when Bolt already has something? Just get that, then integrate.
Seems like what they did to me
Probably a strategy to get some semblence of coherency with Unity
Lots of features lately that have been unfinished or broken
I just don't see the point of getting Unity owning the product while still charging for it
but then again, Unity has done stupid stuff before too
like literally trying to sell learning projects to their users
and putting learning content behind payway
that makes no sense to me when others just give that stuff out so they get newcomers jumpstarted
yeah that was a really odd move
thats just dlc to tutorial projects ๐
๐ค
exactly
Corporate entities look at things differently than we do
๐๐ฒ๐ฌ๐ป๐ธ๐ฝ๐ป๐ช๐ท๐ผ๐ช๐ฌ๐ฝ๐ฒ๐ธ๐ท๐ผ
I didn't understand why Unity thought they "heard us loud and clear" when they introduced the Game Settings AI thing.
But it turns out that, Unity likely heard that from industry people, not indies.
So really, this is likely just one of those moves. It's one of those moves where you think "What?" but they have looked at this very differently than you have.
maybe continue to sell bolt so when dots visual scripting arrives users are like screw paying to use gameobjects, im moving to dots ๐
but dots vs is moving toward game objects ๐
just for the record, I'm not crying out loud that they don't give free stuff, I actually pay Unity every month and have done for a while in past too, hence wondering where they are going with this
I dont even actually care about bolt at all as I'm not really into VS
I'd be fine with letting designers and artists play with VS in Unity
I'm not
At least then they can come to me and go "I want this" and then I formalise it
it's a bad path
imagine you need to pay extra for dots tooling
on top of the engine tooling you already pay monthly fee for
which they btw, just raised
they need more money to buy stuff like Bolt, to sell it to you ๐ค
Inflation will make prices rise forever, though.
Question is why Unity raised the prices.
the havok thing is bit weird too, in past when they licensed tech, they just absorbed the cost in the engine price / sub cost
instead they went with the MTX approach on that
unity store is a huge cash cow
unity probably got a TON of money from stuff like Bolt
it's not outrageously expensive, it's just if this trend continues, we'll not see the end of it
there are a few packs that basically everyone buys
visual script packs, lightmap addon, input addon is common to see
The guy who is on top of Unity atm is from EA right?
I think they see that one changing now
Or at least the AAA industry
from EA i think
ea, yes
Makes sense that the asset store would continue as it does now.
I mean, with SRPs alone, they've made a lot of old mandatory things obselete
ive allways found it very weird how unity has had a crappy input system for more than a decade
like.. it shouldnt be so hard to make it not-terrible
especially HDRP gives out practically most of the features out of the box that people would have bought separately in past
A lot of people tended to just use SDL2 @vagrant surge and then never have to worry about input ever again
@vagrant surge the new one is still pretty bad :/
hell you can build a better input system than unity has on your own C#/C++ engines in like a couple days
something unreal-engine style works fine and its very easy to build
I mean the usage of it doesn't suck, it's just too bugged and is missing features so you can't really use it in production
I like the new one. Still rough around the edges and missing some important features, but it's miles better than input manager.
yeah, I don't disagree
just wish it was more robust
like, actually work on controllers I have here
(and have to support)
I guess it's a matter of the focus.
Unreal Engine focuses on having in-engine features and less on the Marketplace providing that.
Unity is the opposite. They expect to have some stuff, but you can write yourself most of the stuff you need or get it from the Asset Store.
Different strategies
I need some more control over input state for some more complicated composites
Is there simple documentation on writing tests for Systems?
Or am I just going to have a lot of fun "wasd"'ing around haha
uhh look at the ECSTestsFixtures in the package
You can create a test world, create the system in that test world, update the system, and write tests to check the component data of the entities in editor time
yes ๐
i attempted to integrate some unit tests in a couple ue4 games
calling it a failure (both times) would be a huge understatement
I feel for you vblanco
Thank you @fallow mason
ue4 framework is basically untestable
without going really far
In this Unreal Fest Europe 2019 presentation, Software Engineer Jessica Baker talks about Rare's new philosophy on automated testing to deliver Sea of Thieves as a constantly changing service. Jessica also shares some of her best practices to make writing thorough tests more o...
these guys made sure that they had full coverage basically from day 1
and they wrote their own test runners and modified the engine extensively to make them work well
what you see in that ue4 test video is fake. Its all custom
Ah so you can write integration tests ๐
yeah, its going to be integration tests because even basic stuff will likely test a huge % of the engine
Seems like a lot to learn but it will be (hopefully) worth it
ECS works very well with unit tests. When i was doing some stuff with rust (the language) and ECS, i had a lot of unit tests
the "pureness" of ecs maps well to unit testing
create test world, run system a couple times, check output
yea I am used to the more data driven approach so this should be useful
Amethyst for Rust/ECS?
or just having fun making ECS on your own?
wasnt amethist, but i did use the Specs ecs which is the one on amethyst
@coarse turtle there are 2 main ecs now in rust. One is called Specs, it follows a model similar to entt or entitas. Its older, and has extensive auto-multithreading
the other is Legion, which is more like the unity approach. Its much faster, but stuff like custom component storage isnt there
and add/remove comps is much slower
Specs is actually damn fun because it will automultithread the hell out of your systems
it also forces you to make systems thread-safe, which can be a bit painful. For rendering (which has to access global state) i had to do some unsafe trickery so rust allowed me to do it
seriously tho, rust facilities for multithread are godlike
Rayon library is some of the most crazy black magic ive seen. You can spam parallel-fors for days, and the lib is very smart to minimize the overheads of launching jobs
so in general you can basically make every ecs loop you have into a parallel for, and it will be fine
What is the overhead of the smartness?
How is it achieved though?
i have no idea
No free lunch right?
but i dont know of an equivalent to it in any lang
all i know is that rayon multithreading, both its async launches and its parallel for, are super spammable
It could of course just be a matter of someone who got a eureka moment and found a better way to do things. Just sounds weird if there is no cost.
in cpp if you run parallel STL, you will slow down things unless your work sizes go past X
@tardy locust i believe its because it only launches new jobs if it sees there are free cores
Hm, that could be.
but the exact implementation of it is something im not sure about
But it would still have to schedule those jobs for later no?
it does them "inline", in a way. Its parallel fors are blocking
not like unity jobs that get launched in the background
and i think that now that rust has async/await, the hax level went even higher
because you can await async tasks and similar
yes
Be a Service Layer
without a doubt im sure that it outperforms unity job system by several orders of magnitude
plus it allows launching threads from anywhere, not just main thread
Question is if you could offload that multithreading to a Rust support setup and back without too much overhead.
on my tests, the "schedule overhead" of Specs (which uses rayon on its backend) was super super low
that's a nice find ๐ I'll have to tinker around with the rayon lib sometime
rayon is AWESOME
its a straight up selling point of rust
.iter().plow() should have been the method signature hahaha
i have no doubts rust is by far the language to grab if you are doing multithreaded simulations
the best part is that you can liberall spam parallel for
But what I'd like to know
and if its unsafe
the compiler just screams at you
so if it compiles, it multithreads with no data races
Is if I can make a rust parellel setup that does all the multithreading and Unity just passes data off to that and receives data back locally.
This way Unity only has to delegate data to Rust and Rust does all the heavylifting.
yeah but its really not so simple
I didn't say it was simple.
the reason rayon is so stupidly hax is because rust offloads a bunch of checks into compile time
I was just interested to know if it would be feasible and useful
would be too much of a work to be worth it
it could be, just passing information safely would be difficult
I see.
I have never tried doing anything between Rust and C# so wouldn't know. Of course it's already harder to do because Unity's sandbox does not like to share
however the overhead of converting unsafe types into safe types could be worth it..
this does a parallel for multiply + reduce
in cpp you can do the same with std algorithms
but it will be slower
much more so, in fact
on small sizes, rayon might not even launch worker threads to avoid overheads
That might be why it's so fast
perhaps
And efficient
The difference between making a job and not could mean the difference between fast and slow, because of allocations and whatnot.
Especially if you look at it from the perspective of volumes of jobs
yeah, in the article he says that it only launches jobs if there are workers availible
unity launches jobs no matter what
Over the last week or so, Iโve been working on an update to Rayon, my experimental library for data parallelism in Rust. Iโm pretty happy with the way itโs b...
very old article tho
now I want to go back and make my world simulation again .. lol
If I use
//Yeah I am deallocating nodes
Entities.Foreach((IDontKnow variable) =>
{
var tempNodes = nodes;
}).ScheduleParallel();
Is tempNodes a copy or the same reference of nodes?
I can't use the nodes variable because I change it inside the Entities.Foreach, so things mess up
Because while some entities are reading from nodes, other are writing to nodes, so it crashes after a while
ToComponentDataArray returns copy
Yeah but I want to use a copy in the Foreach for each entity
I don't want them to write and read from the same array or things mess up
tempNodes and nodes itself structs and they copy BUT because they store pointer even in copy it's same number and points to same memory allocated from ToComponentDataArray which mean if you change tempNodes it change nodes (but not chunk because of ToComponentDataArray is copy and not reference to chunk memory)
Ok ty
you want copy of nodes for each entity with IDontKnow ?
How can I make a copy in tempNodes? NativeArray.CopyFrom?
I want a copy of nodes for each entity
Yes
naive way to do this is to allocate NativeArray<NodesData>(query.CalculateEntityCount() * entity count of your foreach)๐
but i don't think it is a good idea๐ค
I am trying with
Entities.Foreach(...
{
tempNodes = new NativeArray<NodesData>(nodes.Length, Allocator.Temp);
tempNodes.CopyFrom(nodes);
...
}).ScheduleParallel();```
I am making the build (I can't test things in the editor, my laptop is too slow)
something like this maybe? ๐
```cs
var nodes = query.ToComponentDataArray<NodesData>(Allocator.TempJob);
var countA = query.CalculateEntityCount();
var countB = queryB.CalculateEntityCount();
var copies = new NativeArray<NodesData>(countA *countB, Allocator.TempJob);
Entities
.WithStoreEntityQueryInField(ref queryB)
.Foreach((int entityInQueryIndex, IDontKnow variable) =>
{
int startIndex = countA * entityInQueryIndex;
int endIndex = start + (countA - 1);
for(int i = startIndex; i <= endIndex, i++)
{
copies[i] = ... ;
}
}).ScheduleParallel();```
Wait wait, probably there has been a misunderstanding, but I've solved the problem
anyone know of a viewer tool that can read the text from burst inspector, its scattered with < color > tags etc
hybrid v2 seems even more broken than hybrid v1 from more testing ugh
๐ฆ thats really not great to hear. I'm using it but all seems ok so far, but im not exactly doing anything with it yet
Whats wrong with it?
well just weird stuff like if my subscene is open, i cant press play(errors out), shader graph using vertex position doesnt work properly, this one might be hdrp but the automatic exposure compensation is really odd when theres no ambient light, something random triggers subscene entities to be dumped but not recreated in a closed subscene, some occasional but immediate errors on start which are fixed after stopping and playing again etc
i didnt have anywhere near this much odd behaviour with v1, i chalk some of this up to hdrp 9.x still not being in public preview but its still frustrating
and urp in v2 only supports 1 directional light ๐ no other lights? have you tried it with multiple lights other than a directional?
I have not tried with any lights apart from the default directional, I also didnt know that it only supported 1 light
That will be a issue ๐ฆ
i know it will support urp's featureset in the future, but its like I dont even know if these things are just havent gotten around to it yet and a current limitation or its a bug. v1 supported multiple lights
all of the supporting packages of ECS suck ๐ฆ i really want animations but that dosn't work
and i want to use unity Transport for my MP and again not compatable with latest ECS
yeah animations, spent a good deal of time trying to make humanoid rigs work but no dice(is it a bug, or a limitation lol)
๐ i just gave up, will wait for the next version
and kinda annoying when submitting a bug for physics and qa telling me i can modify my package if its causing issues ๐ค
๐
in my last prototype i had modified physics
relised pretty quickly that was a bad idea
BlobArray/BlobRef it turns out, really add a lot of junk to the asm ๐ฆ
My prototype mission/quest system, im so happy ๐
Time to show off???? We just wrote nice article about our core mechanics which all, as you know, implemented through DOTS ๐ https://medium.com/@eizenhorn91/diplomacy-is-not-an-option-a0ecc8aac69
Cant you just have my moment ๐
Someone should keep you toned 
yes ๐ except the UI
@storm ravine Man that sounds very close to what i am building, except I'm focusing MP first
Well, we ~4 years in development ๐
๐ im about 1 month
@storm ravine Do your units have/do any local avoidance or collisions?
@storm ravine how big is your team?
1 artist, 1 writer, 1 GD, and 1 programmer (me) now we hired one more programmer (because I want to sleep) and audio and UI 2D art on outsource
Wow the number of units you can support is insane
that looks like a project where it would suck to be the only programmer ๐
cool! fairly small team then! props to all the work you have done so far. game looks legit lit!
altho I can imagine the pain on collab work with dots when everything is experimental
Well all things in game our own, no assets, and only audio\2D (UI) art from outsource
Well
๐
๐ I'm having to use assets where I can, mainly polygon models and A star from https://arongranberg.com/astar/
I'm not smart enough to build that custom
that a* implementation can be a head scratcher ๐
I'm also using Enet and Ceras for networking untill unity transport gets more stable
I remember using it on some of the first unity projects I was at and it needed some hacks to play nice
Yea im basicly rewriting some core parts of it to work with ECS
Well A* itself pretty easy thing
^
Flowfields too
I guess, ๐ but its all the other bits, optimizations and data layout/stores
it's just, most users do love to have the tooling and all algos to make it look more polished
Polished looks ugly and unnatural
prebuilt tooling doesn't help much on dots land though :p
I was more of thinking stuff like path smoothing
yea im not using that just yet ๐
This is tricky part - made that feel "real", I spent around half of year to nice looking navigation and collision
Btw, regarding our little "Unity Meta Files are dumb" discussion earlier. Currently have a meta file that did not change whatsoever, yet it's listed as "changed" xD
oh man, half a year just on pathfinding stuff...
navigation and collision
Optimized for crowds
dynamic rebuilds etc.
And everything at runtime without any prebaking
because of procedural worlds
how did you even do collisions? im guessing not unity physics?
Not Unity. All systems in our game custom - Animation, navigation, physics, rendering
pretty sure dots physics wasn't even a thing when he started :p
I cant even imagine
And had only entities core ๐
when did you start your game? right after the dots announcement?
Game was near to final (80%) and was in development ~2 years
And at GDC 2018 we decided jump to DOTS
And I start rewrite every thing
grow and expand
Are you glad you changed to ECS?
Of course
it looks amazing
how do you handle/structure the game data, like the units and buildings?
im using JSON files and addressables. JSON is all the stuffs (name, max hp, resource costs......) and the addressables are the prefabs (for each phase, under construction/final) and materials
yeah not only does it look super impressive, but being built when dots is like in its teething stage is also super impressive ๐ถ
We dropped JSON, it's inefficient. I wrote many Editor tools for fast not programmers data management and editing, like 1 click making our dots animation from fbx without any preparing or actions from artist. Map generator previewer with nice config, game data configs, building set editor , with all required safety stuff for excluding human error etc. All loads through addressables (prefabs, assets, configs, etc). Also we using our own persistent ID system and not relating to unity guid system. Everything async and main thread never stuck or freeze at loadings, procedural generation etc.
Well again thread of our game! Stop, lets cheer @opaque ledge quests systems! It's nice progress!
Very nice, I'm eventually planning to have a compiled (bson? binary) instead of json, but i also want to support modding
aww โค๏ธ haha
@opaque ledge Yea very nice ๐
anyone got clues how to use the dots animation package for basic clip playback?
no blending and fancy stuff
i dont think anyone here uses dots animation
a) is the animation package compatible with the recent dots?
b) it doesn't have any samples of it's own?
With a dedicated game server, how do I specify which scene to start up with? I'm seeing my NetCode bits not execute ... kinda looks like my scene isn't loading?
@naive parrot I tried very hard but havnt managed to get animation to work ๐ฆ
@sand prawn In your first scene have a script that reads the command line arguments and then loads the right scene
then when your launching the server you pass in the settings (server.exe -scene "SCENE NAME") or something like that
see https://docs.unity3d.com/Manual/CommandLineArguments.html and google custom command line args
Ah, ok. So there's no way to trivially specify a startup scene?
for now, I don't even need it to be CLI, I just need SOMETHING to load
oh it should load the first scene in your player build settings list
Hm. I don't seem to be seeing that...
My DOTS Sample-based code works in this scene in the editor, but nothing runs in the DGS build
if i int divide a 1D array to chunks of 4, then ill have to pad by 1 if there's a remainder right?
public static unsafe void SetFlags(int* flagsPtr, int length, ref NodeFlags addFlags)
{
var flagToSet = (int4)(int)addFlags;
var batchFlags = (int4*)flagsPtr;
var batchLen = length / 4 + math.select(1, 0, length % 4 != 0);
for (var i = 0; i < batchLen; i++)
{
batchFlags[i] |= flagToSet;
}
}
@sand prawn I haven't built in a while sorry. I would think that if your scene is first in the build settings (https://docs.unity3d.com/Manual/BuildSettings.html) it should work.
I dont use any sub scenes tho so might be something different there
or your crashing on start? try a debug build
No, main scene is loading (tested by building a script component with just a debug log in it)
So I was on crack
What's happening is that the code that looks for ServerSimulationSystemGroup never finds one
oh netcode.... i guess something is wrong with the world init stuff
I've rolled my own and disabled all of unitys startup stuff
Oh, interesting... why's that?
fwiw, I think the code I wanted was just #ifdef'd out
durh
:p
if i int divide a 1D array to chunks of 4, then ill have to pad by 1 if there's a remainder right?
@mint iron that should be the case (had to try it with some arbitrary #s)
so I've built my own so i can setup/inject some custom stuff (my netcode, and some addressables) and so i can have full control over the update loop (I have server ticking in fixed update, but also doing some stuff in some update(s) )
thnx, yeah needed a sanity check lol, i've padded the end of the array so it doesnt matter if it runs over.
Your netcode?
๐ im crazy and building a MP RTS
Using ENET and stuffs for core MP as i wasnt happy with Unity Transport (which also isn't compatible with latest Entities)
heh yeah, I've done the package juggling
what specifically did you need latest-entities for?
I do eventually plan to swap back to Transport as i think i could get better performance, but ive used enet before and could get running in a day or so
didnt really, i just wanted latest packages for everything ๐
does anyone know if theres a way to copy all components from 1 entity to another?
instantiate a copy of the entity?
the target entity allready exists
Oh
and the source ๐
hmm - i actually don't know ๐ค
maybe you can mimic how EntityManager.Instantiate(entity) on the lower level
yeah, i kinda need that as well, to 'clone' an entity
for me its more of a modifier tool.. I use the gameobject conversion flow then i want to Add some new components to the final prefab entity and ideally i dont want to have to code each one i want to add by hand
Hi all does sorting a dynamic buffer ( .asNativeArray()) sort and save to the underlieing buffer?
var data = BUFFER.AsNativeArray(); data.Sort(new Comparer());
From what I've read .AsNativeArray dosnt copy anything and still refers to the same buffer data
it's just manipulating the buffer directly
yup, turns out it was another bug that was messing with my data, making me think that the sorting was failing or something
Woooo, finally got my networking stuff all nice and smooth ๐
Nice ๐ Is this using NetCode?
No, custom, based on some of the NetCode ideas, using ENet and Ceras (serializer), I will be using Unity Transport when its a bit more stable
How many ComponentSystemGroups are you using?
I am using in the order: PrePreUpdate, PreUpdate, Update, LateUpdate
I don't know how good are these names, probably I need also another group before PrePreUpdate
you shouldnt use it like that imo, group up the systems that has a common thing
i have PlayerSystems for example which includes, PlayerMovement, PlayerMovementRaycast, PlayerInteraction etc..
Well I am organising things in this way:
In the PrePreUpdate I have the input/AI systems, in the PreUpdate I have some modifiers and in the Update I have the actuators.
An example is a weapon system:
- In the PrePreUpdate I have the check for the input and if I am pressing the mouse button, in a component called Trigger I set Value to true.
- In the PreUpdate I have some systems that check if I have enough ammo in the magazine, if enough time has passed between the last shot and the current one (fire rate)... If not, the Trigger.Value is set to false because the weapon can't shoot
-In the Update the LauncherProjectile check if Trigger.Value is true, if it's true it launches the bullet
i mean.. as long as it works out for you, as long as you are comfortable with the workflow, all is fine ๐
only thing i would watchout for is Transform system, which LocalToWorld component is updated, so if you are using LocalToWorld component before Transform system that means that component is 1 frame old and not the updated one
Ok
Maybe I should use better names.. something like:
InputDataUpdate, DataModifierUpdate, DataActuatorUpdate.
But I don't know which set of names would be more intuitive for other people (PrePreUpdate vs InputDataUpdate..)
why would you think about other people ? are you making an asset ?
Nope
For me, i go with InputDataUpdate, it simply makes sense
Ok
is there a way to call somestruct.equals(default(somestruct)) with burst?
performance by default.