#archived-dots
1 messages Β· Page 97 of 1
Can't say I have a lot of experience with graphics rendering specifically
Just basic understanding (vertices, shaders etc)
but not really how Unity does things
Yeah, we are working on a new Unity Physics (and Havok Physics if necessary) release for Entities 0.2.0 and we're looking into all these issues at the minute. Lots of fun changes to juggle for little bit. Thanks for your patience. from: https://forum.unity.com/threads/unity-crash-when-enter-playmode-with-havok-physics-enabled.782969/#post-5225510
Going through the netcode quickstart https://docs.unity3d.com/Packages/com.unity.netcode@0.0/manual/quickstart.html
Where does this bad boy get made? Is it from the ghost authoring comp's autogenerated stuff?
RequireSingletonForUpdate<EnableNetCubeGhostReceiveSystemComponent>();
I got lost on that too, The NetCube part is actually the project name, so replace that with whatever you called your project
is there a way to get the job worker thread ID within a job?
Aahh, thanks @raven badger . I had no idea the project had anything to do with the generated names.
Strange, it uses the Product name. In this case the ECSSample uses "Jobs"
did they actually release the dots netcode package properly yet?
or do you still have to jimmy it in via the manifests file?
still requires the manifest as of a few hours ago
@meager nacelle yes, just put "int index" as the first param in your IJobForEach Execute() method
@magic frigate whats the change needed? i deleted my project and cant find it on the forums
@flat talon that's not what I asked
Anyone got ECSTestsFixture tests working in Rider, for Unity?
I'm trying to set up my unit tests such that I can run them from Rider, and not have to run the unit test window in Unity
While Rider's unit tests work really well against normal Unity tests, it seems to get stuck in "pending" on ECSTestsFixture tests
Unity still produce a TestResults.xml file, which will hold the test results... but it doesn't feel "integrated"
@meager nacelle Ok if you need the actual thread ID (not just the job id), then I believe this works as a field on the job.
[Unity.Collections.LowLevel.Unsafe.NativeSetThreadIndex] public int threadIndex;
Hi Devs! I'm working with Unity's Job system and could use a tip on the EntityQuery.
I'm essentially trying to make a damage dealer / damage taker system where I iterate over all the damage takers and apply damage to the damage taker based on how far away the damage dealers are to them. For that to work, before I schedule the job I needed to make a query for all the damage dealers, and I'm not sure if I can cache the EntityQuery for this system, as the damage dealers would be created on and off all the time.
Not fully done, but the todos should make it more clear
Caching the query is fine afaik ,its just what components to look for and the results will be different according to what entities exist at the time you ask for results.
with Entities.ForEach, you can get the int nativeThreadIndex automatically set if you use it as a parameter
in JobComponentSystem
@flat talon thank you for your fast response at 5am! So then let me get this straight, say one frame I have 10 damage dealer components available in the world, but some time later I get 2 more damage dealers, would I not need to update the query then as the number of damage dealer components increased?
since if I cache the query, wouldn't it always return me the same data?
no the query is just a set of rules for what components should be returned. When you use the query it uses those rules to find the currently matching entities. So its always up to date. If you were caching the 'results' of the query it would be different.
Aaaaa
The documentation framed it slightly differently
@mint iron thank you, that is the nail on the coffin I was looking for π
@trail burrow I added this stuff to my manifest.json
figured it out :p
"com.unity.transport": "0.2.0-preview.4", ```
just in case anyone else needs to know
oh, and I almost forgot ``` "com.unity.entities": "0.2.0-preview.18",
there is also a newer netcode release
com.unity.netcode 0.0.2-preview.1
com.unity.transport 0.2.1-preview.1
@mint iron itβs more like how much the damage dealer would take away health per iteration
I would need to define the range, which atm is hard coded :/
With a magic number
its an interesting problem to optimize, each dealer looping through each taker, it multiplies scarily.
Yeah itβs an ordeal. For me I have a finite set of entities that at any given moment can become damage dealers, so at least I know the limit for that, while the damage takers could potentially be infinite, so either I should also make an arbitrary limit, or put the excess into data structures like a native queue or something
Hello,
How i can make an action when some object collide my object (this is for make an conveyor) ?
Thanks.
are you using dots physics for that
yes, i search an way for like OnColisionEnter
the UnityPhysicsSamples project has an example in Demos > 2. > 2d. Events - Contacts
basically you make an ICollisionEventsJob that gets the collisionevent info
What are people doing to defer dispose of native arrays that are used as outputs on jobs? In some cases you can call .Dispose() right after reading the output, but in the case of the application shutting down that code might never run.
We looked into the dispose jobs, but those would run before we can read from the output on the job
thanks @hollow sorrel
@flat talon maybe look at the entity command buffer system setup. On their CreateEntityBuffer, they allocate a temp job for the internal entity command buffer and manage the dispose. Idk if that would take you towards some answers you're looking for.
@flat talon do you need to worry about it if the app is shutting down anyway?
just for know, dots its not still available for 2D game ?
@worldly pulsar It creates some error spam in our servers logs, and currently in editor as well
@remote coyote thanks, I'll take a look
@neon kraken Currently you need to create your own 2d framework and sprite renderer in DOTS. Project Tiny is something you are probably interested in, but they wont support 2d (again) until in a few months
ok, thanks @flat talon
Ehh, I wish there was a way to look at the Entity Debugger while stopped at a breakpoint. Or at least a Debug.TakeSnapshotAndLetMeLookAtItLater() call.
https://github.com/Unity-Technologies/multiplayer updated one hour ago to use the latest netcode and transport
# 2019-11-29
## New features
* Unity Transport is a package, see the [Unity Transport changelog](https://docs.unity3d.com/Packages/com.unity.transport@0.2/changelog/CHANGELOG.html) for details.
* Unity NetCode is a package, see the [Unity NetCode changelog](https://docs.unity3d.com/Packages/com.unity.netcode@0.0/changelog/CHANGELOG.html) for details.
* Added a new sample - NetCube - used in the Unite presentation about netcode.
* Removed Matchmaking, SQP and related samples.```
but I somehow doubt we'll get the DOTS shooter project this week anymore
(forum thread about netcode)
What is it?
The Unity NetCode package is our implementation of a server authoritative multiplayer model with client prediction for DOTS. It is the package we are using in the DotsSample from Unite Copenhagen. In this model all simulation is happening on the server and the NetCode is synchronizing networked objects - ghosts - to all clients. The clients send inputs to the server and it is also possible to send light-weight RPCs for control flow.
We have been running playtests with 30-40 players from around the world with it regularly, and also a few playtests with more players. With the compression we have in place the bandwidth is usually well below 100kbit/s on the client in our playtests.
What is it not?
This is the first preview of the new NetCode package. As such it is not a full featured solution, the main focus has been on getting the core of it solid rather than making it feature complete or easy to use. There is also not a lot of documentation available yet.
This is not the only networking model we plan to build, but it is the one we are building first. Other networking models will follow once this one is more mature.```
30-40 players is nice, but you'd think they'd test with 100 players due to how popular the battle royale genre is
time to see what breaks in my game once I upgrade it
this is probably still quite brute force for that 30-40
also this is server auth
is any BR out there running full sim on serverside?
I thought they were all server authoritative
so how have been people able to cheat on trivial things like bypassing healing times etc?
I sure hope those parts on server side now too :p
Didn't know there were cheats for that, I assumed the only cheats were like aim hacks and wall hacks
I don't really play battle royales, so I wouldn't really know
my assumption is that the sheer amount of people playing these games would become super costly if each player was properly simulated on server side
now we only need to trick @vagrant surge to accidentally tell how they do that on PUBG
on unreal, we have 2 mayor bottlenecks at pubg
bottleneck 1 is just that game code is slow as fking balls in unreal
the oop actor architecture does 0 help
bottleneck 2 is that the number of individually replicated "objects" is massive
player actor + player components + weapons + inventory + vehicles + vehicle components.... we probably reach 10.000+ replicated objects
does vblanco work at epic now? I remember seeing his awesome gpu lightmapper and the forums
you are mistaking the guy
the lightmap guy is luoshang
and he IS in fact working at epic now
whoops lol
I often wonder if games like that on unreal actually run animation stuff server side all the time or if they only validate positions whem clients report a hit or something
I can tell you from my personal work-experience working on a survival-game in unreal: we do both. we update animations on the server, but not the exact same ones as on the client. just for very general limb placement and to adjust colliders for crouching etc. Tickrate is also slower.
Shooting is mostly handled client-side, but we have server-side validation based on the general likeliness of a hit at this location based on many variables, like distance, lag-compensation, which bone was hit and how close is it to the one the player reported, etc. We get some false positives and sometimes false negatives, but overall the system prefers to rather believe the player than the server. so far we didn't have issues with cheat tools that exploit that, but we are also much smaller than pubg for example and probably not on the radar of professional cheaters.
@flat talon that's not right either. I don't need the thread Id, I need the job's worker thread id
@sharp nacelle I really like that system, doing client side hit detection with server side validation of the hit (i.e. plausible check)
as it's basically impossible to replicate animations perfectly
but doing it this way means you can shoot people in the finger easily, etc.
but still being secure enough
Error : ... 'InputActionMap' does not contain a definition for 'GetAction' and no accessible extension method 'GetAction' accepting a first argument of type 'InputActionMap' could be found
any ideas why this could happened ?
( in ECS-Physics\Common\InputActions.cs )
nvm i solved it
Hopefully a simple question:
// Target is a scene reference that will be fully converted with ConverToEntity.
public Transform target;
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
var test = new TestThingy()
{
target = conversionSystem.GetPrimaryEntity(this.target),
};
dstManager.AddComponentData(entity, test);
}
So that don't give me a valid Entity, I guess that it being order dependent and all? So how are you supposed to reference scene objects?`
@sharp nacelle most games in ue4 do not run the animation in server
in fact i think skeletal animation is disabled by default on dedicated server builds
but can confirm that whole "client side hit + server side validation"
both PUBG and fortnite do it by sending "where was the shot started + where did the shot hit" to the server, and then the server resimulates the bullet and check if it would be blocked by environment
- other checks like "is the initial launch point the place where player was at that moment" and "is the hit point on the target character where that character was"
@vagrant surge I definitely agree that most don't need to run animations. In our case we found it makes the hit detection much better. But we also have somewhat "slow" bullets and a few bigger-than-usual AI enemies, where determining the position of limbs on the server is a huge help. But still, it's a very slow tick rate and very simplified animations. The performance impact is much more outweighed by the ridiculously slow default movement component of unreal and it's network replication.
@sharp nacelle in something like pubg (or fortnite), having animations in server is literally infeasible
animation on 100 characters that are damn complex would be extremelly hard on the server
would cost a fortune to host
well,now that i think about
it wouldnt cost a fortune
it would be impossible
@vagrant surge hm we manage to have around 40 players + 60 AI with no huge impact. but like I said, we don't play the full animation at all, just very simplified systems with extremely reduced skeletons, etc, tickrate of around half a second, etc.
games like fortnite and pubg have a huge bottleneck on animation. If they had to animate the 100 characters at full rate, we are getting into 100ms+ territory
yeah I can see that. we had that issue in the past but dumped it down to the absolutely bare minimum
but I think we are getting a bot off-topic here π just wanted to give my insights earlier and that's it.
@sharp nacelle if you only need animation for hitreg, have you thought of doing it "lazy"?
do not replicate, do not tick
have a copy of the mesh somewhere below the map
and to test the animation, you set parameters and tick it, and then read the bone locations
btw, if you have so much stuff. Most important tick of ue4 multiplayer. The cost scales by number of objects replicated, not by amount of properties
having a fking massive PlayerCharacter holding a fkton of replicated variables is cheaper than having them spread around
hm... not really actually. like I said, we are mainly bottlenecked by other systems atm. but I agree with the networking part. the amount of replicating objects is definitely an issue we are fighting right now
but to find a curve back to topic: how far is the dots networking so far? I saw some people testing it and talking about it above?
i was looking, and it seems its not possible to replicate when you add/remove components to an objecT?
due to the whole ghost thing with generated code
So when you change an entity archetype on the server all the ghosts just stop updating?
@vagrant surge @worldly pulsar correct if you break the entity contract of one of your replicating ghosts it will not send any more
And no ita not possible to add or remove replicated components
Does anyone know what would happen if you call commandBuffer.AddComponent on an entity that already has that type of a component, would it just be ignored?
@trail burrow thats kind of garbage
whats even the point of the ecs then ? if everything replicated will have to be super rigid
well, forbidding archetype switch is about as "easy mode" as it gets for this stuff
It's fairly common
You can add or remove non replicated components ofc
But that's not very interesting
very limiting
Yes
i guess you will need to do child entities and the like for dynamic stuff
Probably but that comes with the massive caveat of partial replication
this got updated to the latest entites version: https://github.com/Unity-Technologies/DOTS-ProceduralTileStreamingSample
Hello, i have updated my packages. But hybrid renderer not rendering and many of my "systems" not exist on entity debuger. What can i do?
Are there certain procedures to get the Burst compiler to recognize a tag component? I keep getting errors about "Burst Compiler doesn't support this type": CommandBuffer.AddComponent(jobIndex, e, typeof(DamageDealerTag));
what does DamageDealerTag look like?
pretty sure it should be AddComponent(idx, e, new DamageDealerTag())
are you guys using asmdef's for your projects? finding the assembly reload time pretty much negates any speedup in compiling
@safe lintel It's just a tag component
@worldly pulsar tried that, also complains about handling typing(
wonder if burst can handle effectively 0 sized structs on the command buffer π€
It's weird, because it seems to specifically not like that component
I have other component tags that are iniside Burst jobs and they are just fine
I have a feeling that because I moved the component script to a subdirectory it could be causing some weird compilation behavior with Burst
f.e it compiled it once while the component was at root, cached it and then the component got moved and now it doesn't know what to do lmao
its not anything super simple like mistakenly not derriving from icomponentdata or a class
maybe its just an editor bug and needs to be restarted? more maybe its the serializable bit?
Unity attaches that by default when you use their in editor tool, but I'll try taking that out and restarting the editor and vice versa and see if it does the trick π
Does the RenderMeshV2 system not material batching yet?
Has anyone used the Disabled component? I'm trying to use it on a Parent object and I can't get it to work on the children. Does it respect/flow down the hierarchy? Or do I need to add it everywhere?
I dont think it flows down the hierarchy
like how you'd expect disabling a gameobject works
@coarse turtle yea I'm thinking that too
guess I need to loop over all children and their children ect and add it
etc*
For the interested, I've published a new release for Hydrogen.Entities that fixes compatibility issues with the latest Entities package:
https://github.com/periodyctom/Hydrogen.Entities/releases/tag/0.2.1-preview.0
hey guys whats the difference between a native hash map and a native multi hash map? is the latter simply for parallel operations?
native hashmap has one key and one value associated together, while a native multihashmap can have one key and x values associated together
aka:
[key:value] <- hashmap
[key:{value, value, value}] <- multihashmap
You can use both for parallelism writing operations as long as you mark the type of the map with a .ParallerWriter
ohh i see thanks dennis!
np!
one more question, couldnt you just use an array as the value in a hashmap?
the multihashmap has a built in iterator
and when you add entries into a multihashmap, it appends new entries for you
if the key has been matched
And it would be quite cumbersome to implement that as you'd want to use NativeArrays instead of regular arrays otherwise you'd lose out on potential performance
gotchu
Hello, i have updated my packages. But hybrid renderer not rendering and many of my "systems" not exist on entity debuger. What can i do?
I have netcode too.
okay. low-level dots question incoming: I'm trying to create a system (not ecs-system) in which I can declare entity archetypes using lua. As I need to specify which components to attach to a archetype, I need to find the components via string. I saw that there is the TypeManager, but it doesn't hold information about the names of the components, as far as I could see. I want to avoid having to run reflection on every component I add, so a cached approach would be best and I was hoping that there is already something like that in the depth of the Unity.Entities package, before creating my own cache.
Has anyone tried doing something similar and if yes, how did you approach this issue?
What I want in the end is basically something like this:
player = DB.createArchetype("Player")
player.addComponent("Health", { Value = 50 })
@radiant sentinel You have to use the client and server groups for your systems when using multiplayer. Look at the different worlds in entity debugger.
Thank you
My old project based on transport package only and i have removed netcode
Now i have client side crash when i build game
public struct HasTarget : IComponentData
{
public Entity targetEntity;
}
public class HasTargetDebug : ComponentSystem
{
protected override void OnUpdate()
{
Entities.ForEach((Entity entity, ref Translation translation, ref HasTarget hasTarget) =>
{
if(hasTarget.targetEntity != Entity.Null)
{
Translation targetTranslation = EntityManager.GetComponentData<Translation>(hasTarget.targetEntity);
Debug.DrawLine(translation.Value, targetTranslation.Value);
}
});
}
}
Multiple targets are being spawned randomly and the units basically move to closest target and destroy them, but when two units select the same target, I get an error for entity doesn't exist.
(I think its a pretty dumb mistake I made somewhere but I can't seem to find it)
any help?
probably not what you are looking for, but I tend to prefer EntityManager.Exists(entity) over (entity == Entity.Null) for cases like this
That actually solved it
my guess is A and B get targetEntity = C, A gets there first and destroys C, but B still has targetEntity == C
Yeah, I added the if condition for that reason, but obviously Entity.null wasn't doing the job
Thanks!
why is entity manager referred to as dstManager in conversion override method? what does dst stand for? π€
destination
thats it?! can't say am not surprised , well i guess semantically speaking its relevant enough
The whole api could use a renaming pass to be honest π
i just rename it to entityManager in all my overrides , for sake of readability and immediate clarity
It converts monobehaviors and needs a destination for the entities, which have to be a manager, so it's semantically correct, yeah.
You can use burst and EntiyCommandBuffer at the same time ?
Yup the new update made it so. Keep in mind that playback is still not burstable
Is there any way to disable the comments that you get when you create new Systems/Components/AuthoringComponents?
Does anyone know if there is a way to create entities off of the main thread? Or outside of a ComponentSystem?
If I try to call EntityManager.Create() on my own thread it throws an exception
wait, let me clarify, are you trying to create entities on a Job?
Nope. My goal is to move as much of the game logic into it's own thread. Leaving the main thread for just unity things.
Then why not do your spawning on a job? Jobs run in parallel
Job's seem like overkill for instantiating 1 entity. I wanted to see if I can keep as much of my own code on my thread to complicate things less. Having to move back and forth between the main thread and my thread is not ideal.
I will use jobs later to run code that would benefit from it.
Hmm, so if you want to spawn just 1 entity, why do you need a separate thread for it? The cost of initiating a thread would be way higher than spawning that 1 entity on the main thread
btw, I'm pretty certain EntityManager can only be accessed through the main thread and if you want to use it in parallel you can use the commandBuffer: World.GetOrCreateSystem<EndSimulationEntityCommandBufferSystem>();
I have a single thread for my game logic. I will be doing more then just creating a single entity. But this logic is not jobable. I would like to just be able to create an entity on my thread instead of creating a queue and async system to run unity api functions on the main thread.
Either you use EntityManager on MT or a commandbuffer in another thread
^
Ok. I am unfamiliar with command buffer then.
// On Main thread?
var system = World.DefaultGameObjectInjectionWorld.GetOrCreateSystem<EndSimulationEntityCommandBufferSystem>();
var buffer = system.CreateCommandBuffer();
// On My thread?
var entity = buffer.CreateEntity();```
Something like this?
I noticed the system has an Update() do I need to update that on the main thread as well?
use .CreateCommandBuffer().ToConcurrent()
as a reference you can look what JobComponentSystems are doing. it's pretyt much the same
I wonder if it's possible to Get the command buffer outside the JobComponentSystem π€
@warm topaz if you get the command buffer working on your custom thread lmk π
no, you have to get it from main thread
when created you can funnel it to wherever you want
Having troubles with my ecs package not compiling. Something about burst...
@warm topaz Sharing the error might be a good idea
So I'll get back when I figure it out.
Cannot find the field `TypeInfos` required for supporting TypeManager intrinsics in burst at Unity.Entities.TypeManager.GetTypeInfo(int typeIndex) at Unity.Entities.ChunkDataUtility.ReplicateComponents(Unity.Entities.Chunk* srcChunk, int srcIndex, Unity.Entities.Chunk* dstChunk, int dstBaseIndex, int count)
Well since you asked, this one happens when I just build. (2019.3.0f1)
build fails.
also when I run
attribute: Unity.Burst.BurstCompileAttribute
And that.
Looks like API version conflict? Are your Entity packages matching?
Like burst, dots, and ecs?
Jobs: preview.13-0.2.0
Entities: preview.18-0.2.0
Dots Platforms: preview - 0.1.6
Burst: 1.1.2
Yeah its all very touchy
Btw, is TinyProject still available? It's not in the pm.
had to install the c++ game dev component for visual studio but it builds now too.
thanks
@viral sonnet @arctic vector Yeah, cannot use CreateEntity() on my own thread even with the buffer.
private void Start()
{
var system = World.DefaultGameObjectInjectionWorld.GetOrCreateSystem<EndSimulationEntityCommandBufferSystem>();
var buffer = system.CreateCommandBuffer().ToConcurrent();
_thread = new Thread(() =>
{
try
{
// On My thread?
var entity = buffer.CreateEntity(0);
}
catch(Exception ex)
{
Debug.LogException(ex);
}
}){Name = "GameLogic"};
_thread.Start();
}```
Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckWriteAndThrowNoEarlyOut (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <7559bf9767e74ff5906f18401f66cd57>:0)
Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckWriteAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <7559bf9767e74ff5906f18401f66cd57>:0)
Unity.Entities.EntityCommandBuffer.EnforceSingleThreadOwnership () (at Library/PackageCache/com.unity.entities@0.2.0-preview.18/Unity.Entities/EntityCommandBuffer.cs:785)
Unity.Entities.EntityCommandBuffer.CreateEntity (Unity.Entities.EntityArchetype archetype) (at Library/PackageCache/com.unity.entities@0.2.0-preview.18/Unity.Entities/EntityCommandBuffer.cs:915)```
Oh, this seems to be working though...
_thread = new Thread(() =>
{
try
{
var system = World.DefaultGameObjectInjectionWorld.GetOrCreateSystem<EndSimulationEntityCommandBufferSystem>();
var buffer = system.CreateCommandBuffer();
var entity = buffer.CreateEntity();
buffer.AddComponent(entity, new PositionComponent());
}
catch(Exception ex)
{
Debug.LogException(ex);
}
}){Name = "GameLogic"};
_thread.Start();```
oh good, yeah, you used jobId 0 which doesn't exist I guess
well actually I didn't use concurrent.
as long as you stay in start and only do it once it's okay
for subsequent calls in update you'd need it
why are you using your own thread?
My goal is to move as much of the game logic into it's own thread. Leaving the main thread for just unity things.
ok and what's holding you back from using jobs? you will not be able to utilize those threads very well in a static thread architecture
Nothing is holding me back from using jobs except that jobs cannot be used for everything.
Some things cannot be parallelized.
if you can write your own threads it should be possible ^^
I will more then likely be using jobs for a lot of things later because it's hard to ignore burst lol
You know, just normal game logic. If this, else this. Would complicate things so much to job everything.
Can you create you own World?
huh... it's just new World("name") lol
yes - you can create your own world
hm, okay. so most cpu ticks are used for conditions. i see the problem is then bringing data to and out of the thread. at some point it has to be synced back to the main thread. if you are just having conditions you won't get much use out of threads. maybe even on the contrary when the cpu is waiting for data
Eventually all of those conditions and logic add up. All those small things that are too small to jobify. I've experienced this. For quite a while I've been wondering if we can just move all of our logic to another thread to allow for a faster main thread.
maybe I'm underestimating your amount of conditions but I'm pretty sure conditions take longer because of the data than has to be acquired and not the conditional check itself.
yeah, for sure. But conditions can get pretty dang complicated in a very large project. jobifying everything just adds to that complication. Why jobify if you don't need to? It won't give you much of a performance increase. Jobify the things that you know are running slow and will see a big impact. That way you keep your code base simpler where performance isn't as much as an issue and more complex when you want it to chew through data quickly.
Anyways, I gtg. Dinner and games with friends. π
my point is when you are already in the process of making threads you can turn the process that run there into a single job.
no need to hack everything into pieces like some samples would imply
ahh ok, that's something to think about thanks
np man, good luck on your optimization
Did anyone have issues with updating the Burst compiler? I updated to 1.2.0 and now I get compilation errors:
Unexpected exception System.IO.FileNotFoundException: Could not load file or assembly 'Smash, Version=0.3.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
File name: 'Smash, Version=0.3.0.0, Culture=neutral, PublicKeyToken=null'
at Burst.Compiler.IL.Jit.JitCompiler+CachedMethodKey..ctor (System.String methodFullName, Burst.Compiler.IL.Jit.JitOptions options) [0x00007] in <3179d4839c86430ca331f2949f40ede5>:0
at Burst.Compiler.IL.Jit.JitCompiler.CompileMethod (Mono.Cecil.MethodReference methodReference, Burst.Compiler.IL.Jit.JitOptions jitOptions) [0x0001f] in <3179d4839c86430ca331f2949f40ede5>:0
at Burst.Compiler.IL.Jit.JitCompilerService.Compile (Burst.Compiler.IL.Jit.JitCompilerService+CompileJob job) [0x002ce] in <3179d4839c86430ca331f2949f40ede5>:0
While compiling job: System.Void Unity.Jobs.IJobParallelForExtensions/ParallelForJobStruct`1<Unity.Entities.GatherChunks>::Execute(T&,System.IntPtr,System.IntPtr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,System.Int32)
I then reverted back to 1.1.2 but I still get the same error
i read that you have to delete library and re-import again
Anyone have a good resource on how to work on a grid?
What I'm interested in is how to read data from neighbour components
neighbours are usually done with a buffer on the entity
other option is to hash the coordinate and use this as lookup for a dictionary
Can you use dictionaries in jobs?
yes, nativemultihashmap or smth like that
I tried using a NativeHashmap<> and it complained that I should use a different data structure
Alright, so basically, do a collect pass to setup the structure and then use that structure in the later passes?
I'm also wondering if a NativeArray but I guess that the access would be bad with a large enough grid since the tiles would end up stored row by row
depends, if you have an integer grid you could abuse direct access with arrays. if it's float and very rigid you need to quantize to get deterministic access in which case the hashmap wins.
integer grid in this case
public struct Tile : IComponentData {
public int3 pos;
}```
ok, yeah then you can make a translation from coordinate to array indices. gets annoying though when you have negative coordinates
My idea is to do a first pass to calculate int3 min, max
It's a builder so hopefully I can keep track on when they are changed
But I was thinking of just using temp lists
how can i fix this i just upgrade to 2019.3.1f and entity 0.2 then i got error when i play
The easiest way to fix this probably is to remove the [BurstCompile] from the job that you made (if you had made one)
But the annoying fix is that you probably have a version mismatch between burst and your other packages
Double check what version of Burst you have and update to the latest
hmmm, just realized that the live link is useless as long as hybrid is broken π
I mean, the trick where you parent stuff seems to work
it requires serialized dots subscene to work, so, nothing on GO side will adjust to it
@arctic vector thanks to good advise. I just fixed my problem. π
Is the PhysicsSamples project out of date for standard ECS patterns?
physics samples haven't been updated to latest entites api changes but they still work with the newest entities package
you do need to update all following to do that tho: entities, hybrid rendering, urp
also good idea to remove lwrp package because it's only a shell package that installs urp package as dependency now (you can just install urp directly)
that being said, Unity is working on Unity Physics update for the Entities 0.2 so once that's out, they'll update the physics samples too
Nice, thanks
That project looks like its written differently than the ECSSamples project
it's not really that great sample for structure in general
many things are just done on gameobject side there too
it's more of meant to be sample on how you can do certain things with unity physics
basically it's NOT an example on how you'd interact with Unity Physics if you have dots heavy project
more like, how you can use it with any unity project that needs physics
and even there it falls tad short on some things, like the way how they sync physics to gameobjects is super naive on some of the examples
it wouldn't scale well at all
@warm topaz reading earlier messages just wanted to point out something in case it wasnβt obvious. You can create and queue actions to a command buffer on your own thread but then itβs going to playback on the main thread. So if you e.g. instantiate 1 entity, itβs not only going to take up as much time on the main thread as it would have done through EntityManager but also youβll have the other costs. Sorry if that was already well understood π
Hi guys,
while trying out the new netcode package (latest release) i noticed that it is not possible to uncheck properties in the ghost authoring for children. Is this a bug or how is this supposed to work?
Hey, does someone know how to use FunctionPointers?
I'm just wondering can I use them like Func<T>s
Actually I think I figured it out: it's FunctionPointer<MyDelegateType>
probably
@gusty comet Yeah, not sure what's the deal with children. I've removed them from the authoring gameobject.
@amber flicker Iβm fine with unity taking some time on the main thread. My goal is to move all of my logic to another thread so Unity can use the main thread to the fullest.
Every time i want to use ECB of BeginSimulationEntityCommandBufferSystem unity throws me errors like 'The NativeArray has been deallocated, it is not allowed to access it'. I completely confused with this. Can someone show simple code of how to use ECB from those begin/end simulation systems (if i want use them inside job)?
I thought i need to just have a reference to system i want and then just use CreateCommnadBuffer() from it every frame i need schedule my job. But that cause issue of race conditions.
private struct ProduceTransitionJob : IJobForEachWithEntity<LobbyWaitTimer> {
public float Threshold;
public EntityArchetype ReqArchetype;
public EntityCommandBuffer.Concurrent CmdBuffer;
public void Execute(Entity entity, int index, ref LobbyWaitTimer c0) {
if (c0.Value >= Threshold) {
var req = CmdBuffer.CreateEntity(index, ReqArchetype);
CmdBuffer.SetComponent(index, req, new MatchStateRequest {
To = MatchState.Loadout
});
CmdBuffer.SetComponent(index, req, new MatchStateDisposalRequest {
Value = MatchState.Lobby
});
}
}
}
This is a pretty simple job all it does it produce some entities for me to consume later on
Main Logic
var deps = new ProduceTransitionJob {
Threshold = 3f,
ReqArchetype = reqArchetype,
CmdBuffer = cmdBufferSystem.CreateCommandBuffer().ToConcurrent()
}.Schedule(this, inputDeps);
cmdBufferSystem.AddJobHandleForProducer(deps);
return deps;
yeap, this is exactly what i do in my job
I havent upgraded to the latest entities yet just so you know
what AddJobHandleForProducer do?
it says you wait for the job to complete before performing the actions in the buffer
so in a nutshell what it does is allows structural based jobs to run first like IJobForEach<T>, IJobChunk, etc, to run first and the ecb will playback after those jobs are done
but why BeginSimulationEntityCommandBufferSystem needs to wait until jobs done? I thought that if system runs before it must do playback on main thread and only after that next systems will run and schedule jobs.
Hello,
I search how i can make that : https://youtu.be/vAu_ZrqM2Lw?t=37 (an conveyor belt like FactorIO, Statisfactory, or all game with conveyor belt)
But i could not found an tutorial or exemple code for make it (in DOTS or with behaviour) :(
Other question : its worth to use an raycast for make that ?
Thanks for your help.
@viral sonnet got some answer at the forums from timj:
Removing components from child entities is not supported. The checkboxes will strip the component from the entity when it is generating the entity prefab, so instance of the ghost does not have that entity at all if it is unchecked. We only do that stripping of the main entity.
If you just want to disable sending of it you can check the checkbox for "Manual field list" and remove "Value" from the list. That way it will not send any data to synchronize the translation / rotation. The components will still be on the entity, but in the case of transforms they would if you were not using the netcode package too.
@neon kraken If i'm not wrong, those conveyor belts are done in a way that the objects on them aren't real, just part of the mest of the conveyor (Is not an actual gameObject or equivalent) for a graphic and cpu optimization, the actual object is just inside the conveyor and has a "position" from 0 to 1 being 0 the start of the belt and 1 the end of it. At the end, the belt places the object in the belt in front of it or the machine or the ground.
You can make them actual gameObjects but probably the amount of objects you can have on belts is going to be limited. Also you won't find right now a lot of tutorials of DOTS since is quite new and the API (for ECS, HDRP and so on) and workflow is changing a lot, i'd wait a bit if you plan to make a game with them. If you just want to test and learn stuff go ahead tho
Is DOTS Animation in the package manager yet? I guess they probably want to release one more version of them (like they've done with netcode and transport now)
But its all just speculation at this point
The sooner the better
well, it'll show up in the pacman if you add it to manifest manually
usually they delay the PM visibility for relatively new things because they don't want to encourage people to try early versions
Is there any way to launch built game so that unity job system would assume it's say, dual core computer?
I doubt changing cpu affinity from windows for that executable will work for that, because then I'd just have 2 hw threads and still be running 23 worker threads on them?
(On 24 hw thread cpu)
Just trying to figure easy way to test the lower end perf without always running on older computer
Altho cpu clocks would still be an issue I suppose
Huh
Not really DOTS related but
What would be the minimum set of components for an entity, if I want to have a collider on it? It seems PhysicsCollider is not enough. If I - for testing purposes -convert a GameObject with a PhysicsBody(Kinematic) and a PhysicsShape: PhysicsCollider, PhysicsMass, PhysicsVelocity and PhysicsGravityFactor are added, which seem too much and have an impact on my Translation component setting everything to NaN.
Mmmmhh, if I convert a static PhysicsBody it just generates a PhysicsCollider. My Raycast still hits the collider though. Probably something with my PhysicsCollider struct. Manually added component (PhysicsBody) is not working though π¦
Anyone messed around with creating worlds and adding systems to a separate world?
Yeah, you can check out the custom bootstrap on NetCode
oh ty, I'll check that out... though I've just realised I know very little about cross-world... can you address entities across worlds? e.g. does a CDFE work if you have an entity from another world? I assume it couldn't..
Fundamentally, do systems have to run in the same worlds as the entities they want to manipulate? I'd assume so.
No idea if you can crossworld.
you cant afaik because entity indices/versions can conflict
Thanks both. Making a tween lib - thought it would be nice to have all the tween systems in a separate world for neatness but given they will be tweening 'your' entities, I think the systems will have to be in the same world
so I'm trying to render several thousand of the same mesh with the hybrid renderer, and I'm seeing almost identical performance regardless of whether GPU instancing is enabled on the material
whether I have ~6000 batches or 33 batches and ~6000 saved, the frames take the same amount of time and UpdateDynamicRenderBatches is using most of it
this is with SRP batcher off and dynamic batching disabled
large mesh? tried with a simple cube?
editor 2019.3.0f1, hybrid renderer preview.18-0.2.0, URP 7.1.6
it isn't, it's a couple hundred verts with UV + normal and no other vertex attributes, but why would that matter? I need it to work with any kind of mesh
actually: 63 verts, 66 tris
and the shader is the unity standard shader?
ah, I'll take a guess at that being the reason - haven't explored this much myself but afaik there's v limited support atm for hybrid render
great lol
same thing with URP/Lit: disproportionate amount of time going to PresentationSystemGroup > RenderMeshSystemV2 > UpdateDynamicRenderBatches > Add New Batches
URP not planned to have hybrid render support until sometime late next year...
(I know)
you're meant to use the legacy render pipeline with DOTS??
no, hdrp
welp, this was supposed to be a webgl game
but then again I had a feeling webgl + burst was also going to be impossible
it's... ambitious at this point but doable. You could either go the legacy pipeline (nothing that wrong with it), hdrp (strip out as much pp etc as you can) or avoid burst I guess. Fwiw if you only need basic lit, batching & gpu instancing are working with legacy for me I think - you'll just be missing baked lighting, new batcher, material property blocks etc... don't know if that helps you at all. It's a rough time trying to pick a stack atm.
so if I have thousands of identical meshes which all share a shader and texture sets, but each have let's say a unique color, what would be my best option atm?
(caveat, I'm not sure about the current webgl hazards - of which there are many I'm sure)
GPU instancing + MaterialPropertyBlock, or SRP batcher? both approaches are mutually exclusive, yeah?
I haven't been able to figure out yet if SRP batcher can take advantage of GPU instancing or not, it seems geared towards scenarios with many unique meshes
the only other concern is material instantiation and associated costs
iirc with MaterialPropertyBlock I would only need the one material instance instead of thousands?
so.. fundamentally if rendering perf is the main concern there are better people here to respond I'd guess but... it could be worth taking manual control with DrawMeshInstanced or whatever. If you have thousands of unique meshes, that isn't exactly great with the RenderMesh SDC approach anyway.
SDC?
I don't know anything about the new SRP batcher sorry
SDC type I meant ISCD -> ISharedComponentData
*typo.. geez
is adding/destroying an entity of a defined EntityArchitecture fairly cost-effective? or is it like adding/removing components (performance-wise)
Define "fairly cost-effective". It's way faster than creating a GameObject. If you are creating/destroying less than a hundred entities per frame I wouldn't worry about it (same for adding/removing components btw).
not exactly sure about adding/removing components though since that changes the chunks
Yes, it moves the entity to a new chunk. That's essentially a bunch of calls to memcpy, which is not free, but it's also nowhere near as bad as what AddComponent() did in GameObjectLand.
Thats true π
its exactly 2 times whatever many components you got memcopy
I wonder what the average number of components would be on a single entity in an actual production project
Most of my entities have like 3-4 components (+ often times LocalToWorld and everything the conversion pipeline adds for no good reason)
it really depends on the architecture
its like asking "how many components have normal unity gameobjects"
some projects have 1 or 2, other projects have like 10
tho with ecs you usually will have much higher component counts
but stuff like 20+ is really pushing it
What I mean is I don't expect entities with 50+ components to be common. 2-6 memcpy calls is nothing
This is why I said I wouldn't worry about the add/remove component cost unless I was moving like 5k entities between chunks every frame
its higher cost compared to stuff like Entitas or Entt
that have a different ecs model
in those, adding components is extremelly cheap
and O(1)
the main problem of add/remove in unity ecs is that you have to do a full thread sync point
and this fks your jobs
If I recall correctly you pay for it a lot at query time (at least in Entitas, never used Entt)
query time on those 2 is also super fast
you pay the cost in iteration time
on entity counts sub 1000, entt wins against unity at everything
like literally everything
Didn't Entitas re-allocate the query result array if anything changed since last query?
in entitas, all queries are basically vectors
they "listen" to specific callbacks
when you add comp, those get triggered, and if the entity matches, then it gets added into the query
but its not a realloc, its just normal C# List
in entt doing that caching is optional
you can do queries that use no memory at all
and they are surprisingly fast on low component counts, like if you are quering 1 to 3 comps
I mean this array in particular:
https://github.com/sschmid/Entitas-CSharp/blob/master/Entitas/Entitas/Group/Group.cs#L34
(I remember being annoyed at how much GC pressure it generated, not really at it being slow)
public TEntity[] GetEntities() {
if (_entitiesCache == null) {
_entitiesCache = new TEntity[_entities.Count];
_entities.CopyTo(_entitiesCache);
}
return _entitiesCache;
}
what in the actual fuck isthat
it's set to null on any add/remove component and then reallocated every time you query
obligatory bruh moment
why tho, can just return _entities and be cool
entt in c++land does no such bullshit. It will be zero-allocs once its warmed up. (std vectors will realloc when they run out of size)
_entities is a HashSet, and iterating those is super slow in C# iirc
ah
still a bruh
entt does this much smarter. Instead of using a hash set, it uses a different structure
more like a slotmap
works like a hash set, but its fully linear in memory, being 3 vectors, 2 of them fully contiguous
so iterating 1 component is literally iterating a std::vector of that component
100% unbeatable
i didnt know of that perf pitfall on Entitas
from my own projects with it, i was targeting up to 5k entities
on Entt ive ran experimental stuff up to like 100k entities
unity ECS scales to the millions
I would be fine even if they just returned a List<TEntity>, just don't generate a ton of garbage every frame
Ironic that it scales into millions and is pretty bad at cases with 1-2 entities
its as fast to enumerate a hashset as any other queryable. The price is paid up front on the insert, not on its access.
unity ecs has a fkton of "fixed cost" overheads
i havent checked its code to see exactly whats doing to have such overheads
my own ecs experiments on C++ with a ecs ive created that uses the same memory model as unity doesnt have even close to those overheads
@civic glen HashSet.Enumerator has to check and skip over empty slots in the underlying array, maybe not "super slow" but a flat array is still much better:
https://github.com/mono/mono/blob/master/mcs/class/referencesource/System.Core/System/Collections/Generic/HashSet.cs#L1463
Dictionary - yes, but list has a nice packed array its iterator goes through
what do you think happens when an element is removed from the middle?
of a List<>?
yes
all the elements that are further in the list are moved 1 slot back, and .Count is decremented
That's why Unity NativeList has RemoveAtSwapBack - it lets you avoid the cost of moving all the elements and just move the last element in the list in place of the one removed
pro tip, the humble Dynamic Array (std::vector in C++, List in C#, NativeList) is the ultimate data structure
allways think if you really need anything else
couse you probably dont
That being said, hashtables are nice too. I've seen a translation system with 2 List<string> for keys and values and Get() did a linear search through the keys.
in the "OurMachinery" blog, they comment that they offer 2 base data structures
dynamic array
and hashmap
and thats it
oh wow
Joachim's response: ```At the moment all assets are duplicated per scene. Packing controls & sharing optimisations is something we are working on.
For right now the only work around is to instantiate at runtime. Which may or may not be a better strategy for trees anyway.```
well... that's horrible
I hope they figure that out or nobody will make big open world games with DOTS
yea
I mean, they surely will work on this as the response said, but didn't expect this
same here π€
megacity does not have that many objects
it has a few basic meshes that it repeats a ridiculous amount of times
I've noticed some stuff in the 0.2.0 entities package relating to blob assets that seems to point to that happening sooner rather than later. Specifically BlobAssetStore and BlobAssetComputationContext
Anyone have issues with the Burst compiler refusing to handle CommandBuffer types? I'm on 1.2.0.preview9 and the issue is still there
https://forum.unity.com/threads/unable-to-build-a-player-with-buildpipeline.786362/#post-5237801
entities 0.3 this month supposedly
dunno if they mean realtime or unity time could be next year who knows
Well good news is that next year is a month
pretty sure the fixes would come in quicker.
Basic stuff like ConvertToEntity is completely broken in 0.2.0
i hope the fps sample or animation arrives with the next update
I wouldn't count on that π
Is there a good way to have one entity have the render data of multiple sprites from a spritesheet?
I've been using the rendermesh component, but I assume that wouldn't be fitting for this scenario, as it takes a mesh and a material
as in like 1 entity renders multiple sprites?
Yeah
not sure if you can do it with hybrid renderer since like you said it uses mesh + material, but you could write your own renderer that does it
200k sprites thread has some good examples for that https://forum.unity.com/threads/200k-dynamic-animated-sprites-at-80fps.695809/
Yeah I actually had a look at that
So the use of drawinstanced or whatever is called
That is what is initially drawing it to the screen yes?
And I'd want as few of these calls as possible?
And I got slightly confused about some elements, as it looked like that some of the buffers themselves were their own entities
And then separate entities that were bound to the sprites
But I guess I'll look into it more
I'm new to unity in general, so I'm trying to learn π
yea i think they use drawinstanced in that thread
and yea they also use 1 entity per sprite i think, but should be possible to create a system that uses an entity that holds like a dynamicbuffer or something similar with spriteinfo's
might be possible with hybrid renderer too but the ones in that thread are simple implementations so i imagine it'd be easier to understand and create your own system with
iirc hybrid renderer v2 doesn't use graphics.drawinstanced but some other thing, not sure what it was tho
Hm I see
Alright thanks
I'll look more into it
Do you think it'd be too difficult implementing pixel perfect camera with ecs?
any particular reason you don't want 1 entity per sprite btw
I know there is a script that does it with normal sprite renderer
Yeah, the sprites are tiles in a spritesheet
So when I want to render backgrounds and terrains I don't want to render everything at once
And not 1 tile per entity
there's a pixel perfect camera package that should still work for ecs since it runs on camera lvl, not on renderers
Oh really? I see
1 tile per entity would still be performant tho
you'd still only have that one spritesheet loaded once in memory
should be 1 drawcall for everything that uses it
and entities weigh a lot less than gameobjects since an entity is just an id basically
True, but I'd still want to go the extra mile to make it even faster
And I'm doing game development not only to develop a game, I'm interested in lower parts too
So I'd love to learn that anyways
yea that's fair
lemme know when you figure out more, i've been wanting to look into multiple sprites per entity too
it's just been low on my prio list
Alright sure
Is it possible to schedule a job to run on the main thread, after another job?
Where the first job is NOT running on the main thread
void AddMeshFace(float3 pos)
{
var job = new AddFaceJob();
job.origin = pos;
job.verts = verts;
job.indices = indices;
job.colors = colors;
var handle = job.Schedule();
StartCoroutine(UploadJobChanges(mesh, handle));
}
IEnumerator UploadJobChanges(Mesh mesh, JobHandle job)
{
while (!job.IsCompleted)
yield return null;
//job.Complete();
mesh.SetVertices<float3>(verts);
mesh.SetIndices<int>(indices, MeshTopology.Triangles, 0);
mesh.RecalculateBounds();
mesh.RecalculateNormals();
mesh.RecalculateTangents();
}
struct AddFaceJob : IJob
{
public NativeList<float3> verts;
public NativeList<int> indices;
public NativeList<Color32> colors;
public float3 origin;
public void Execute()
{
verts.Add(origin + new float3(0, 0, 0));
verts.Add(origin + new float3(0, 1, 0));
verts.Add(origin + new float3(1, 1, 0));
verts.Add(origin + new float3(1, 0, 0));
indices.Add(0);
indices.Add(1);
indices.Add(2);
indices.Add(0);
indices.Add(2);
indices.Add(3);
for (int i = 0; i < 4; ++i)
colors.Add(Color.blue);
}
}
Only works if I uncomment the job.Complete
Otherwise it gives me
The previously scheduled job NativeArrayMeshTest:AddFaceJob writes to the NativeArray AddFaceJob.verts. You must call JobHandle.Complete() on the job NativeArrayMeshTest:AddFaceJob, before you can read from the NativeArray safely.
On mesh.SetVertices
Holy blob the DOTS Animation package use a lot of blobs
@zenith wyvern i though jobs can only be scheduled from the main thread?
hm, what's a baked clip, I wonder
var bakedClip = UberClipNode.Bake(m_LinearHierarchyNoRootClip, new ClipConfiguration());
bakes multiple clips into one?
The job is scheduled on the main thread but it runs in a worker thread and I want to delay my main thread call (uploading the mesh data in this case) until the job completes without locking the main thread
But maybe I'm approaching this the wrong way, since you can use nativearrays for meshes now can you change the mesh data in the native array without having to call Mesh.SetVertices and/or Mesh.SetIndices after every change?
If you need to add a dependency to your job to start at the end of other you need to set the jobhandle in the schedule of the next job
Also i'd say yeah, modifying that NativeArray should modify the mesh verts but don't know how unity handles that internally
That's what I thought but it didn't seem to just "work" the way I would have though. I tried changing the native array and then calling Mesh.UploadMeshData and that didn't seem to push the changes either. Maybe I'll make a post about it to get some clarity
Also unless I'm missing something you can't schedule a job to run on the main thread right? I can schedule a dependant job to run after the first one but it would run in a worker thread which I can't do if I'm messing with a Mesh
Since that has to be done on the main thread
I think jobs have the method Run() which will run the job on the main thread
That just runs it immediately though, you can't pass in another job to chain off of
The whole point is to avoid blocking the main thread
Then yeah, you need to store somewhere the handle of the first to add it as a dependency for the second job
But no you can't do stuff with meshes inside a job iirc
Why would you need the mesh inside the job?
I don't, I want to change the mesh data, my nativearrays, inside a job, and then push the changes to the mesh after that's done
But I don't want to push the changes until I know the mesh data job is complete so that it doesn't block the main thread
@zenith wyvern this is yours, right? https://forum.unity.com/threads/proper-use-of-native-arrays-with-mesh-setvertices.787577/
but yeah, you still need to upload the changed mesh to gpu, I believe that's what the setters do, nativelist is just datastructure to hold the data
It is yeah
Gotcha, thank you. So basically I have to block the main thread at some point to upload the changes
also main thing is to be able to process data in jobs
its especially important if you do proc gen a lot
Yeah that's what I'm trying to do. Now I just need to figure out how to wait for my jobs to finish before I upload the changes
Le sad 
@vagrant surge the issue that person had was with like 20 unique meshes at maximum, but since he split those preplaced trees into 224 subscenes and current built pipeline duplicates all assets per scene, final build size still took 33GB for streaming assets alone
so the issue wasn't the actual mesh count but not instantiating all the meshes at runtime
I think basically if you used this approach now, you'd just stuff everything in prefabs, which you should do anyway for most scene editing
so, not really sure if there's any real issue here, was just surprized this is one possible thing people can stumble into
I do dig tiled setup myself https://github.com/Unity-Technologies/DOTS-ProceduralTileStreamingSample
having things in tiled prefabs is easy to understand for a level, even if some tiles are way more dense in objects than others
also, you'd still need editor functionality like in megacity where they stream in and out things in the editor as well as most people can't just instantiate things randomly on code

also new jobs and collections
... new serialization perchance?
no idea, usually jobs and collections just get updates along with new entities package
0.6.3-preview is the current branch
fair
Serialization is a package dependency of the entities package now
mmm no. Doesnt look like it π
ah, didn't see new package for that
only for entities, jobs, collections and hybrid rendering
That was what I was looking at in this https://forum.unity.com/threads/serialization-0-6-3-preview-package-performance-issues.782123/
still waiting for Unity Physics update as that's still coming up
Actually the new entities is already on the package manager π
yup
I'm upgrading these to my test project atm
there's some weird version conflict with jobs atm
it's trying to load older version
No changelog yet however π
changelog is in the package
yup
I had to manually update collections
I think some other package put the older thing there
i'm just waiting for 0lento to post it as is tradition
## [Entities 0.3.0] - 2019-12-03
### New Features
* ENABLE_SIMPLE_SYSTEM_DEPENDENCIES define can now be used to replace the automatic dependency chaining with a much simplified strategy. With ENABLE_SIMPLE_SYSTEM_DEPENDENCIES it simply chains jobs in the order of the systems against previous jobs. Without ENABLE_SIMPLE_SYSTEM_DEPENDENCIES, dependencies are automatically chained based on read / write access of component data of each system. In cases when there game code is forced to very few cores, this can improve performance since it reduces overhead in calculating optimal dependencies.
* Two new methods added to the public API:
* EntityManager.CreateEntity(Archetype type, int count, Allocator allocator);
* EntityManager.Instantiate(Entity entity, int count, Allocator allocator);
Both methods return a `NativeArray<Entity>`.
### Changes
Removed the following deprecated API as announced in/before `0.1.1-preview`:
* From GameObjectConversionUtility.cs: `ConvertIncrementalInitialize()` and `ConvertScene()`.
* From Translation.cs: `struct Position`.
* From EditorEntityScenes.cs: `WriteEntityScene()`.
* From GameObjectConversionSystem.cs: `AddReferencedPrefab()`, `AddDependency()`, `AddLinkedEntityGroup()`, `DstWorld`.
* From DefaultWorld.cs: `class EndPresentationEntityCommandBufferSystem`.
### Fixes
* ConvertAndInject won't destroy the root GameObject anymore (fixes regression introduced in 0.2.0)
* Fix Android build when using new build pipeline
* Provide correct application extension apk, aab or empty for project export
* Set package name to be com.UnityTechnologies.Samples
* Set API Compatibility to be .NET Standard 2.0```
hybrid changelog is empty, it only says they updated it for dependencies
same for jobs package
## [Collections 0.3.0] - 2019-12-03
### New Features
* Added fixed-size BitField32/64 bit array.
### Changes
Removed the following deprecated API as announced in/before `0.1.1-preview`:
* Removed `struct Concurrent` and `ToConcurrent()` for `NativeHashMap`, `NativeMultiHashMap` and `NativeQueue` (replaced by the *ParallelWriter* API).
* From NativeStream.cs: `struct NativeStreamReader` and `struct NativeStreamWriter`, replaced by `struct NativeStream.Reader` and `struct NativeStream.Writer`.
* From NativeList.cs: `ToDeferredJobArray()` (replaced by `AsDeferredJobArray()` API).
Nothing interesting for me but glad they fixed the Android build pipeline
yeah. it was mainly a hotfix for convert and inject + android build issue
I'm guessing they bumped the version internally to 0.3 prior to these issues surfacing
would have expected these to have been 0.2.x rather
I see no flaw in that logic π
1.0 by 2020.1... a 0.x release every other week ?π
oh wow
we can now use the regular hierarchy to examine entity components live while playing
uh, nice!
prior to 0.3, convertandinject just destroyed the gameobjects for subscene objects so this wasn't possible there
I'm not sure if it's meant to work like this
but I don't object!
this obviously only works on dots subscenes now just like on 0.2 but main difference is that the GO's don't get destroyed when hitting play, keeping the entity conversion preview live
nice
this will make debugging so much easier
I won't miss trying to find relevant things from regular entity debugger :p
yes
they didn't update it for 0.3, I'm still using the same version I tried with 0.2 entities
What brings the dots editor package?
ah nice you can even create and move gameobjects and see their entity representation as well
@slow epoch basically the ability to preview entity conversion from the gameobject side
also if you open and close while playing, it resets it, kinda cool but was hoping there would be the ability to save changes in play mode though
I noticed that the animations package has a nice NativeBitSet collection type. Will this be moved to the collections package at some point in the future?
There is a BitField32 and BitField64 currently, but I rather like the NativeBitSet's ability to store any number of bits
@stiff skiff https://github.com/fholm/unsafecollections
@stiff skiff did you notice the collections changelog I posted right after entities changelog?
or did you refer to that change
Missed that, was browsing the animation package source
* Added fixed-size BitField32/64 bit array.
Just looking for new stuff to integrate into our API's so we can use less "homebrew" bits of code
that's just an int32 and int64 wrapped isn't it @dull copper ?
TBH the unity collections performance is kind of... not that good, I understand that they are concurrent so absolutely when you need that, it's great.
But when you don't, you're giving up 5-10x performance just to have the ability to use them as concurrent ones
Yeah its a bit tricky, we currently don't support any of the concurrent stuff really
When you really need a concurrent collection, absolutely they are great - but the cost of them is so high otherwise, makes it a bit meh
I still have to undo some bits which messes with the PlayerLoop for multiple worlds hehe
@trail burrow Just wondering about the UnsafeBitSet you've linked. Why does this allocate the bitset struct itself natively as well?
Or is that how most of your library works?
@stiff skiff it's so that you can put a UnsafeBitSet* on a component
unitys collections do this internally, but i suppose they didn't want to expose pointers to user code
Wait, so a UnsafeBitSet with an internal pointer to the bit buffer, wont work? But would work if Unity put it in their library?
sure it would work, but then what happens when you assign that to something else
all of the sudden you have two individual UnsafeBitSet structs somewhere
which point to the same memory
True, the fact that its a struct would make that confusing
yes, that's how unitys collections work currently and i find it to be... a really bad way to expose it
UnsafeBitSet* simply lets you treat it like you would a normal collection in C#, i.e. holding a reference/pointer to it
Mmm might use a variation of this then
https://github.com/fholm/UnsafeCollections/tree/master/UnsafeCollections/Assets/UnsafeCollections/Collections there's a few more collections here
^^
We've stepped into the ecs super early, never really had the time to have a look and see if a lot of our workarounds/hacks could be removed/fixed now
i still find it too early to try to build anything 'serious' in it
too much stuff missing
I'm mostly using it for "storage" as it maps quite well to the rest of what we build
Maps and Lists needed some work arounds, which I might be able to improve now
for anything bigger, we'd really need the hybrid rendering to work perfectly
@dull copper do you know if it's possible to replace the allocators the ECS uses? π
no idea π
Wait, where did NativeString go?
ArgumentException: A component with type:BoneIndexOffset has not been added to the entity. anyone know a fix for this
https://forum.unity.com/threads/0-2-0-preview-13.781937/#post-5206556 this guy having the same problem but the official response to it confuses me
It requires the animation package. Which hasn't yet been released. must mean a package separate from "Animation Rigging"? I have that one already
I see
Oh NativeString is still there, just now using Unity.Collections is needed
@ me if you get anything to animate, been trying for a while but the clip conversion stuff eludes me
also sorry for burying your question Enraged
@safe lintel cant even see animation in package manager, did you have to set your manifest's "registry" to the staging server?
last time I did that it caused a bunch of other problems but I guess that's what is needed
you just add it manually to your manifest, its on the regular registry
alright, thanks
don't know why I even looked π
uploaded the first version of my ECS lib for c++ https://github.com/vblanco20-1/decs
let me know what you think, even if its still wip and basic
Oh, the joy of using preview tech
Something went wrong while Post Processing the assembly (Assembly-CSharp.dll) : Object reference not set to an instance of an object
classic
@vagrant surge looking forward to decs π
at the moment its a minimum-viable-product
i dont have shared components, or version ids, or being able to add/remove components while iterating
some priority things i want to add is some batch operations (add or remove components from an entire chunk at once), and "bitfield" components, where its 1 bit per entity
On one hand I like that the C++ template system is powerful enough to pull the for_each(lambda) pattern without any codegen.
On the other hand I look at line 361 and I'm not even sure I can parse the syntax correctly π
neither do i
that was a snippet of code given to me by the EnTT creator
who IS a template metawizard
//by skypjack
template<typename... Args, typename Func>
void entity_chunk_iterate(DataChunk* chnk, Func&& function) {
auto tup = std::make_tuple(get_chunk_array<Args>(chnk)...);
#ifndef NDEBUG
(assert(std::get<decltype(get_chunk_array<Args>(chnk))>(tup).chunkOwner == chnk), ...);
#endif
for (int i = chnk->header.last - 1; i >= 0; i--) {
function(std::get<decltype(get_chunk_array<Args>(chnk))>(tup)[i]...);
}
}
this is also very magic-y
The ConvertToEntity thing is still weird in 0.3.0
Why does the game object get unparented
π
I was trying to use it in a ui object which needs to be under a canvas.. but using ConvertToEntity pulls it out and destroys the hierarchy again!!
Anyone know any workarounds other than just using GameObjectConversionUtility to convert it in start method ?
Oh crap, apparently the new codegen gets really confused at my ClickHandlerSystem
abstract class ClickHandlerSystem<T> : SingleThreadSystem
where T : struct, IComponentData
{
protected sealed override void OnUpdate()
{
Entities.WithAll<Clicked, T>().ForEach((Entity e) =>
{
OnClick(e);
if (Exists(e))
{
Remove<Clicked>(e);
}
});
}
protected abstract void OnClick(Entity button);
}
Generic parameters are a no-go now. Bummer, I really liked this pattern.
of course it doesnt. Generic systems are a huge no
@worldly pulsar You can still use generics.. but have to specify it like this..
[assembly: RegisterGenericComponentType(typeof(MyGenericComponent<int>))]
[assembly: RegisterGenericComponentType(typeof(MyGenericComponent<float>))]
generic components also really dont tend to work well, in any ecs
it's not generic components
I just want to be able to do:
class EndTurnButtonHandler : ClickHandlerSystem<EndTurnButton>
{
protected override void OnClick(Entity button) => DoStuff();
}
And with the old foreach it automagically worked. The nice thing being this doesn't care what the EndTurnButton actually is, as long as it has the Clicked tag attached to it.
ah
as another topic, apparently Havok Physics crashing is now fixed with Entities 0.3 (havok guy mentioned this on the forums)
I don't dare to touch that package quite yet, it was root of many wonky things happening even if I didn't even use anything from that havok package itself
So whats this ENABLE_SYSTEM_V2 in 0.3.0 ?
Does DOTS support iOS build with Enity 0.3.0?
Has anyone tried to make a build with netcode with the netcube sample ?
Nevermind seems like I need something ugly like this: https://github.com/Unity-Technologies/multiplayer/blob/master/sampleproject/Assets/Samples/Asteroids/Editor/BuildTool.cs
π¦
@knotty radish apparently you need the new build setup for anything that uses subscenes
Already using it
I guess it's just not finished yet since the build step that should have made your build client or server is only used in editor for runtime conversion
I am really looking foward to a production ready state of DOTS. The whole ECS workflow for me makes so much more sense
I will ask on the forum to be sure about it (may have missed something)
So this seems to be the build manager package (barebone) which is nice
Custom steps and other things should come soon after that
I've pushed a new update that covers a couple of changes: https://github.com/periodyctom/Hydrogen.Entities/releases/tag/0.2.2-preview.0
- Made things use entities 0.3.0-preview.x as it's more stable for me than 0.2.0-preview.x.
- Updated doc pages, added new documentation covering reacting to Singleton Conversion changes (loaded/modified/failed).
- Created 2 new system groups, SingletonConvertGroup and SingletonPostConvertGroup, as I had some system update ordering issues and this seemed like a good feature to add. By default convert systems run in the SingletonConvertGroup and singleton conversion reactive systems run in the SIngletonPostConvertGroup. Both run in InitializationSystemGroup.
- This also gives you a clear point to run your own logic after configuration is done after SingletonPostConvertGroup.
hi! I'm trying to debug one of the DOTS programs and am having trouble:
the debugger never gets called. is there a configuration issue or is it just not possible to debug and step through code like this?
Mmmm ```GUID [bc38a1e61f172489a8eb4983c247c3c3] for asset 'Packages/com.unity.collections/Unity.Collections/Unicode.cs' conflicts with:
'Packages/com.unity.entities/Unity.Entities/Words.cs' (current owner)
We can't assign a new GUID because the asset is in an immutable folder. The asset will be ignored.
Why are those in Packages/ in the first place?
so Unity.Collections preview.0 - 0.3.0 isn't compatible with Unity.Entities preview.4 - 0.3.0 by the look of it
@worldly pulsar not sure what you mean, that's where Unity put them?
They should be in Library/PackageCache/, unless you are on a very old package manager, or this is some weird log-only path rewriting thing
I just upgraded the project from 2019.3.0b13 to 0f1
there's nothing but the manifest.json physically in Package
s
Mmm might need to check my asmdefs again
Oh, because that's an Asset Database error and AssetDB has fake package paths to have them nicely displayed in the Project window.
If you tried the usual "Delete the Library" treatment I have no idea.
think I'll just revert, it's complaining about World.Active but that's going to screw my raymarching camera entirely if there's no simple way around it
something about injecting? that looks entirely wrong. I'll just have to go back they've broken almost everything about my game
DefaultSomethingSomething
DeffaultGameObjectInjectionWorld I'm not doing any kind of injection that looks like BS to me
that's the one
They did the rename because they didn't want people to use World.Active too much (breaks their multi-world idea)
Seems like they got what they wanted π
(Personally can't say I agree with the approach, but π€· )
I wouldn't mind facing that stuff if their packages worked together
but they don't, you just end up with pages and pages of errors. It's like their departments just don't talk to each other
sorry for the basic question but I'm not used to the lambdas - what's the syntax for using a CDFE with a Entities.ForEach lambda?
They work just fine for most people, I've never seen the guid error before (and Collections 0.3 is a dependency for Entities 0.3 iirc)
@amber flicker Not sure what you're asking, you mean what the F_DE things are?
also, I assume we are talking about the old ForEach since the new codegen doesn't use those anymore
talking about the new and perhaps it helps to ask in a different way
writing out a job where I want to write to e.g. Translations from other entities, I'd use a CDFE with [NativeParallelDisable..] and pass that in to the job
I'm trying to learn how to write the equivalent with the new lambda stuff
var cdfe = GetComponentDataFromEntity<Thing>();
Entities.ForEach((Entity e, ref OtherThing other) => { /* can use cdfe here */ }).Run();
ahhh ok awesome
the captured variables are moved to the fields of the auto-generated job
smart - don't know why I didn't intuit that, thank you
I figured that out after like an hour with DotPeek π (not sure I've actually tried this with burst tho, but should work)
also trying to work out the difference between Entities.ForEach within a componentSystem and within a JobComponentSystem.. like it looks like inside a JCS you can't use .With(entityQuery)?
they are completely different things under the hood
π₯Ί
Everytime i check here for the issues ppl is having i end up more confused about ecs
and no, with the new (a.k.a. JobComponentSystem.Entities.ForEach) there is no way to provide your own query
cool - I now see how you can do NativeDisableParallelForRestriction though which is also cool
yup, the builder has a bunch of WithX() methods, like WithStructuralChanges(), WithoutBurst(), WithDeallocateOnJobCompletion(array) etc
wait... so Properties needs to be uninstalled from the package manager because that's now within the entities package ARGH I swear this is so frustrating
The only downsides to the new one I know of is that you can't provide your own query, and you can't do weird generic stuff like I used to : https://discordapp.com/channels/489222168727519232/497874303463850004/651511717733466132
Other than that the new one is way more powerful, you can order the arguments however you want, you can use in parameters to specify [ReadOnly], you can pass the components by value etc.
@wary anchor good to know, i manually upgraded properties because inspector for physics was broken for like 6 months?
also: the hack they used to provide an error message for Entities.ForEach(()=>{}).Run(); is a work of art
error DC0022: It looks like you're capturing local variables from two different scopes in the method. This is not supported yet... I think this was the wrong job to start using lambdas with π
@mint iron I still can't get it working, there may be other packages that need to be installed/uninstalled but the error messages don't give any kind of hint as to what needs to be there or not
@amber flicker assign everything you need to new local variables right before the Entites.ForEach() and capture those
How feasable would it be right now to write a 2D game, that utilizes ECS from the ground up using 2019.3 ?
Dunno, let me know if you manage to install ecs within 2019.3.0f1, I can't get it working when upgrading from 0b12
what causes issues for you? The entity package worked just fine for me
havent done anything yet but it installed just fine
would to take a screenshot of the left side of your package manager please? I have conflicts of all sorts going off here
thanks, so maybe burst and collections need to go too
I feel like the majority of the problems people have with dots boil down to Package Manager being not very good at package managing
@gusty comet depends how much you want to utilise ECS.. the more limited your usage, the more possible I guess π - though I'm not sure on current Android/iOS support etc
I only plan a pc release
roguelikes arent exactly good to deploy on mobile
and I mainly would need it to utilize it to be able to have more complex and interacting systems
and since that is turn based I figure it would be a prime candidate to utilize it since I have hardly to worry about race conditions and such
@worldly pulsar you're not wrong.
I have a complex game in progress working with ECS and raymarching, I wrote all the physics and raymarching acceleration myself, I'm not entirely incompetent, yet I cannot upgrade because the package manager leaves me with a totally dysfunctional project with no helpful error messages
@gusty comet it's totally doable to release a game that utilises ecs/dots now - just would recommend early testing of the core functionality. Imo you're better off avoiding things like the HybridRenderer unless you can afford to either work within its limitations, wait for updates or re-write it later.
It would help to know what its limitations are in the first place.
I dont need much beyond drawing sprites and maybe some very simple shaders
no eta on when drawing sprites will be supported afaik
Honestly just use the old style components for anything rendering related for now. HybridRenderer doesn't have SpriteRenderer anyway, same for anything UI related, text, particles etc.
hmm that is a bit meh, I was hoping to avoid that. Because it means I have to write the baseline code twice
not really, use ECS for logic and then have Display gameobjects
A quick youtube search seems to indicate that you can draw sprites using ECS, not sure how relevant that is given the underlying tech has changed so much in the last half year
You totally can draw sprites. I even have a semi-working text renderer. But you need to write all that yourself using Graphics.DrawMesh and friends
That is generally one thing I am having trouble, neither in video or in text format there seem to be any more recent tutorials on actual implementation nor any documentation that is explanatory for that matter.
Oh I would not mind that, I am used to XNA / Monogame
You can now add managed components to entities, so you can have Mesh/Material references without any SharedComponent hacks. Don't expect to render the MegaCity with the renderer you write this way, but it's doable
(whether it is worth your time to do this is a completely different question)
If you want to spend your time writing your own renderer, DOTS is a nice place to do it. However Unity's expectation is that people will use a hybrid approach for at least the next few years and that's where they're putting their energy. Like Rett says, you can write logic and code in ECS that quite easily talks to any traditional monobehaviours.
I mean that could work for me given I prefer MVC patterns which kind of do that in a less direct way
Wheras the model would be split up into components and systems and the view layer would be handled by monobehaviours.
this is now dropped entirely??!
https://docs.unity3d.com/Packages/com.unity.entities@0.0/api/Unity.Entities.IConvertGameObjectToEntity.html
no, it's the basis of the whole conversion pipeline
does it compile in Unity? (I suspect your .sln/.csproj wasn't updated)
because that most definately should work
Mmm weird. I tried hitting play despite the errors after failing to build in visual studio... project runs but isn't displaying anything.
yeah okay so now it's building but broken. Okay well time for exercise to get this anger out.
hurrah it just lost all my references in the editor, shader now is working again.
Well that was a fun couple of hours! Thanks Unity!
I am still not really sure about this all. From what I gather from the talks, the whole system is a bit self defeating. It seems to be designed around converting a project from GameObjects to entities but seems detrimental if you build it from the ground up that way.
Which makes no sense so I am sure I am misunderstanding something.
but seems detrimental if you build it from the ground up that way.
not sure what you mean by that
You still have a whole layer of monobehaviour representing the in editor experience, which kind of is self defeating for me.
since you have to think in both terms and constantly convert. Which is workflow overhead
And a massive one at that
GameObjects and existing Unity approaches are good at edit-time but bad for cpu's at runtime... DOTS is meant to convert things to run much more efficiently at build time... it can't be fully automatic but you can use it as a tool to help convert things into an efficient form
i.e. a hierarchy is very useful at design time
You have a ton of built-in tools to work with monobehaviours. And the only conversion is one way. You design your editing workflow around gameobjects, your runtime around entities and write a conversion between those
Yeah again this seems like a massive workflow overhead to me.
It's actually one of the major selling points of dots for me π
If this where supposed to be literally just as a conversion tool I would be fine, that is what its built for
but as a production workflow that seems suboptimal
especially considering the new physics system is supposed to be dots only
which I assume needs some in editor representation at some point
and then the guesswork will begin on what is what
One thing to keep in mind is that you never think about authoring monobehaviours in runtime
You are making my point for me, I have to think in two seperate categories while developing
which is exactly the workflow overhead I am talking about
because I have to have monobehaviours, the conversion logic that converts to the entities and them communicating, and the pure ECS layer
If you really want authoring and runtime to be the same use the [GenerateAuthoringComponent] and you have more or less the same workflow as with old monobehaviours
But often times you really want the authoring components to be different than the runtime representation
point is right now it seems despite the goal they set out to do it seems more a do not anger the existing userbase over embracing the whole paradigm in the way I think they should.
Like when you have a list of waypoints the AI moves through. For authoring you want to be each waypoint to be a GameObject so you can easly drag them around, draw lines between them in OnDrawGizmos() etc.
At runtime you just want a NativeArray<float3>
Yeah I might be an oddball to want to get away from that to be honest
To really embrace ECS I think you should always think in terms of your data, and that means getting away from that kind of approach
As a programmer - yes. But the authoring components are not for programmers, they are for designers. And they reuse the existing MonoBehaviour tooling.
I mean, in my AI waypoints example - would you really prefer writing the NativeArray<float3> by hand?
With ECS I would not think in those terms would I? I would think in systems. The whole point of it is to atomize tasks into smaller threadable tasks without sideffects.
In the end I would think of it as a graph of systems
That can be easily reasoned about
and the mishmash behaviour kind of compromises that
But that's all on the runtime side
Again, my point is that it shouldnt be, if your editor behaviour is not equal to your runtime behaviour you have to think in two models
authoring components are all about creating the data in the first place
which leads to errors
The representation of the data is not necessarily equivalent to the data in the current model that is what I am taking issue with
ok, so how would you see my List<Transform> Waypoints -> NativeArray<float> workflow?
It is a very concrete example, I have an AI that will move between waypoints. I need to define those waypoints on the level.
Yeah and that would be handled by several systems not one.
I want the runtime representation to be a NativeArray<float3> (or DynamicBuffer<float3> or whatever) for efficiency.
What I'm asking is how - in the editor - you put the waypoints where you want them
@gusty comet The monobehaviors are just "data containers" for the data entry really, no logic there.
They did do a "Pure DOTS" editor, you can see parts of it in last Project Tiny release. My guess is they backed off that path since rewriting everything was a ton of work.
I'm quite happy with using gameobjects with authoring
Yeah I get the economic reality of it Siggi, sadly I do.
You really just think in the DOTS model, but offer an editing experience through GOs and monobehaviors. Their goal is most of the time the auto authoring is enough
Rett, you can make a managed list of points, use the inspector to create a button to spawn new ones. Use gizmos to manipulate the points. Then in your conversion you would move the points into a dynamic buffer on your entity
I have only the bare minimum of monobehaviours. most data comes in from scriptable objects. Then again, my project has a lot of procedural content so the systems can take care of almost everything
What I would love to see is literally just the list of systems with exposed variables that I can be tweaked in the editor, and not have to go through the hoop of the conversion logic
They might do another go at this later once more of the systems support DOTS π But dont forget that they will continue to support GOs and monobehavior workflows, so that stuff isnt going anywhere so they'd have to support essentially two editors if they do pure DOTS
@zenith wyvern My question was to Yuuki about how that would work without the conversion pipeline π
Oh sorry I'm tired
Rett we saw a glimpse of that in the "DOTS mode" in Tiny, the hierarchy was showing entities
For a short minute there it seemed like they were moving toward wholesale replacing gameobjects with entities, or at least having them work identically in the editor. So you would create and work with entities in the editor the same way you do with gameobjects
Sadly it did not end up going that way
Nah that was me misccomunicating then, that was never my intent
Package com.unity.jobs@0.2.1-preview.3 has invalid dependencies:
com.unity.collections: Resolved version [0.2.0-preview.13] does not satisfy requested version [0.3.0-preview.0]```
how to resolve?
yeah but that path was heading in scary places π at one point they were even talking about "DOTS mode" becoming its own separate editor.
While they still have to support GOs+behaviors, I can see how that doesnt make sense to support two
I admit part of it might also be my own frustration because I cant get a grasp on it that way.
Does not help that documentation is pretty much nonexistent
I can definitely see even on the surface how it could become a nightmare to try and support that moving forward. But it was a nice dream to have full control and interactions over entities in the editor at runtime
and tutorials are outdated faster then you can look at as well
@trail burrow I just spent a couple of hours fighting against this godawful package manager. Lots of packages now built in to the Entities package. I ended up going for 2020 alpha instead of 2019.3.0f1 because I couldn't get it to work in there at all
because the whole DOTS techstack would fit so well for what I am trying to do
@trail burrow for me it was updating the Collections package manually I think. Look through what packages offer to upgrade.
@worldly pulsar ah.. thanks
So if anyone has an up to date example of just creating and moving a sprite in the implementation we have right now in 2019.3.0f1 I could poke at the code and figure things out myself
One that utilizes the whole conversion method
I DO however want to see an entity hierarchy at runtime.. the entity debugger really isnt that great .)
Because right now I seem to fail to grasp the process
is there even 2d support?
Well if push comes to shove I can just use 3d planes to represent sprites
with an ortographic camera
I just want to much around with it
For a sprite you'd have to make your own renderer, or make a quad using the meshInstanceRenderer
Tiny will support 2d again some time after the next release (that focuses on 3d)
@gusty comet I might have an example - still in process of upgrading it
That would be immensly appreciated. If you got it upgraded please @me
I learn best when I poke at working code
@gusty comet Did you see the forum threads already? A few people have written sprite systems in ECS in the past, but Im not sure how up to date some of that code is
For example this one: https://forum.unity.com/threads/200k-dynamic-animated-sprites-at-80fps.695809/
That seems resonably up to date!
cool, perhaps you can start poking at that π
But it was a nice dream to have full control and interactions over entities in the editor at runtime
I belive this is still planned (the basic functionality we really need imho is the ability to click things in the scene view and have them selected in the entity debugger + have the entity debugger inspector fields editable).
But this is runtime debugging/manipulation, a completely different problem to what authoring components are solving.
I'm really curious, what's the difficult part about making the field editable?
Did you see this @worldly pulsar ? Not editable and requires subscenes but itβs getting better.. https://cdn.discordapp.com/attachments/497874303463850004/651463973346082817/dots.mp4
I did... on screenshots π
never managed to get it to work in my project, it just says "preview will be available when the objects are converted" or something like that. I suspect the issue is 99% of my stuff comes from prefabs and is EntityManager.Instantiate()d
and everything in the subscenes is "Convert and Destroy"
@gusty comet Just read over the authoring issue. What's really key is that designer/runtime data is supposed to be different. I had the biggest issues for years because designer and runtime data was the same and things either sucked on the designer part or runtime part. Now that it's decoupled this problem just vanished.
It might be because I come from very specific enviroments. The most complex code I wrote was in very narrow specified systems (Interactive fiction) in domain specific langauges where that kind of distinction does not exist. It is all just data, and procedures
Which I at a glance assumed ECS is, what it is all about trying to do.
breaking your work down into data and systems which are basically just procedures on specific subsets of data that you query
And that is correct. Authoring components are just about a convenient way to create that data.
well, when the data fits 1:1 from authoring to runtime there's not much overhead in writing it so I don't know where's the issue then.
Yeah the difference is say I have a cube with a given texture. I still have to do the whole thing as gameobject, assign its texture, then write the conversion code instead of just being able to write one representation of it and see it in the editor
it feels like I do the whole ECS on top of a regular gameobject not instead
perogative word is thats how it feels from the autoring point to me
Which as I mentioned previously, feels like a huge overhead
especially once you scale this to a production project
If you had your own renderer you could literally just do this:
[GenerateAuthoringComponent]
class RenderMe : IComponentData {
public Mesh Mesh;
public Material Material;
}```
what's the overhead? you put ConvertToEntity on the go and have a textured cube
and this serves both as an authoring component and runtime component
meshfilter, renderer already works in conversion
The issue to me seems that those conversions are specific and not systemic arent they?
Literally what ECS does, in pseudocode for any entity of type enemy that has a position do something
conversion is:
for any gameobject that has ConvertToEntity create an entity and call authoringComponent.Convert(newEntity) on all its authoring components
I'm not sure I see your issue here
The issue is on the authoring side the component is still attached to a singular game object and serialized that way or not? So it still would mean that component has to be attached to everything that I classify as the given thing
the authoring component is not supposed to even exist at runtime
yes not at runtime but in the editor
which again makes the authoring conflict with runtime, when it should not
ok, I may not get your meaning but let's say you want to make an enemy from the cube and you have an enemyAuthoring comp. this comp is converted to several IComponentDatas based on the options you set in authoring which could be pretty wide. from melee, to ranged, to flying, different weapons, etc... based on the comps different systems will work on it. the designer representation will be gone in runtime and only exists in the editor
I am aware that it will be gone at runtime, that is not what I take issue with. My thing is with how it is implented right now the editor is useless and I would rather prefer to write it all in code, and that can not be the intended way to do things.
Because all editor representation as it is right now gives me is more overhead to deal with for little to no benefit
you call it overhead but a designer doesn't want to code
Yeah so shove all the work onto the programmers so the designers can faff around, that is not exactly a practical solution
sure it's possible to make everything in code, might also be faster for you but designing is pretty limited then
you also can't mix and match different authoring components then
I'll go back to the waypoint path example. I want to define the data (NativeArray<float3>) of waypoints for my AI to follow. In the "always write the data you will use at runtime" approach, I'd have to directly type in the positions of each waypoint. But I want to move the waypoints around in the scene view, so I define a List<Transform> in my authoring component and turn that into a NativeArray<float3> at conversion time.
Yeah what is the issue with having the edtior UI do the same query you do at runtime?
and just represent that however
Right now if I want to check data at runtime I already have to go into the entity debugger in a list of potentially 10s of thousands of entities and dig it out
There is no query in my authoring
And one major benefit of the conversion is that conversion happens at build time, so you can do major work you want to avoid at runtime
I just cant shake the feeling they released this to the public a year too early after making a U turn on completly moving into ECS
They mark it 'preview' for a reason
Yeah but its like what 3 month away from release at most?
I dont expect any major changes in that timeframe anymore, now that they said that this conversation shebang is to stay for several years publicly
this will be the way it will be for a long time according to their own staff
Because they think this is the best thing it can be, and I happen to agree. Again, this is for the authoring -> runtime problem, not for "Let me see what my entities look like at runtime" problem, which is nowhere near solved right now.
it's certainly better than the ComponentDataProxies as MB from before
Oh I agree on that enzi
Just to be very clear thogh I dont have gripes with the programmatical / execution side of it, my only gripes are literally the gap between it and the editor
and how they choose to close that gap
@gusty comet if you use subscenes then the gameobject data is not serialized on disc.. the conversion workflow actually creates entities and the result of that is saved in the asset. So when you load the subscene you are actually loading a blob of entities directly to memory.. no need to convert or instantiate anything.
i mean, i also rather want to click on the entity in the hierarchy, see it in the sceneview and edit some data but we need some patience for that
Funny thing there is I love how godot does their screen tree hirachy of all things
because you could in theory literally have all your game logic in one main loop scene and just attach and discard subtrees
But alas godots performance is meh
correct ^^
plus I am not fond of its python like gdscript syntax
sorry - another question.. @worldly pulsar possibly? π - looking for how to do the equivalent of chunk.Has() within a lambda? Related, I want to use WithAny with just one type that's optional - is the only way to do that to add another component I know will definitely be present?
trying to enter playmode with dots netcode installed
editor just spins
locking one core completely
I have no clue how to do chunk iteration with the ForEach, would probably use ComponentDataFromEntity for that and check per-entity
dont think you can do chunk iteration with ForEach?
hmm.. not so much the chunk iteration I'm after, more to have an optional component that I access... i.e. .ForEach(in Entity e, in MyComponent m, optional in MyOptionalComponent op)...
Doubt that's possible considering the hard coded nature of the generics