#archived-dots

1 messages Β· Page 97 of 1

tired mulch
#

Is there any goods links or sources to learn about the more resource specific things you guys are mentioning.

#

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

dull copper
dull copper
magic frigate
#

Where does this bad boy get made? Is it from the ghost authoring comp's autogenerated stuff?

#

RequireSingletonForUpdate<EnableNetCubeGhostReceiveSystemComponent>();

raven badger
#

I got lost on that too, The NetCube part is actually the project name, so replace that with whatever you called your project

meager nacelle
#

is there a way to get the job worker thread ID within a job?

magic frigate
#

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"

trail burrow
#

did they actually release the dots netcode package properly yet?

#

or do you still have to jimmy it in via the manifests file?

magic frigate
#

still requires the manifest as of a few hours ago

flat talon
#

@meager nacelle yes, just put "int index" as the first param in your IJobForEach Execute() method

trail burrow
#

@magic frigate whats the change needed? i deleted my project and cant find it on the forums

meager nacelle
#

@flat talon that's not what I asked

remote coyote
#

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"

flat talon
#

@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;

arctic vector
#

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

flat talon
#

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.

remote coyote
#

with Entities.ForEach, you can get the int nativeThreadIndex automatically set if you use it as a parameter

#

in JobComponentSystem

arctic vector
#

@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?

mint iron
#

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.

arctic vector
#

Aaaaa

#

The documentation framed it slightly differently

#

@mint iron thank you, that is the nail on the coffin I was looking for πŸ˜„

mint iron
#

np πŸ˜„

#

@arctic vector whats MeleeStrengthComponent ? the attack range?

magic frigate
#

@trail burrow I added this stuff to my manifest.json

trail burrow
#

figured it out :p

magic frigate
#
    "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",

flat talon
#

there is also a newer netcode release

com.unity.netcode 0.0.2-preview.1
com.unity.transport 0.2.1-preview.1

arctic vector
#

@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

mint iron
#

its an interesting problem to optimize, each dealer looping through each taker, it multiplies scarily.

arctic vector
#

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

neon kraken
#

Hello,
How i can make an action when some object collide my object (this is for make an conveyor) ?

Thanks.

hollow sorrel
#

are you using dots physics for that

neon kraken
#

yes, i search an way for like OnColisionEnter

hollow sorrel
#

the UnityPhysicsSamples project has an example in Demos > 2. > 2d. Events - Contacts

#

basically you make an ICollisionEventsJob that gets the collisionevent info

flat talon
#

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

neon kraken
#

thanks @hollow sorrel

remote coyote
#

@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.

worldly pulsar
#

@flat talon do you need to worry about it if the app is shutting down anyway?

neon kraken
#

just for know, dots its not still available for 2D game ?

flat talon
#

@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

neon kraken
#

ok, thanks @flat talon

worldly pulsar
#

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.

dull copper
#
# 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.```
odd bay
#

30-40 players is nice, but you'd think they'd test with 100 players due to how popular the battle royale genre is

coarse turtle
#

time to see what breaks in my game once I upgrade it

dull copper
#

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?

odd bay
#

I thought they were all server authoritative

dull copper
#

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

odd bay
#

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

dull copper
#

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

vagrant surge
#

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

odd bay
#

does vblanco work at epic now? I remember seeing his awesome gpu lightmapper and the forums

vagrant surge
#

you are mistaking the guy

#

the lightmap guy is luoshang

#

and he IS in fact working at epic now

odd bay
#

whoops lol

magic frigate
#

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

sharp nacelle
#

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.

meager nacelle
#

@flat talon that's not right either. I don't need the thread Id, I need the job's worker thread id

trail burrow
#

@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

hollow jolt
#
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

fair condor
#

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?`

vagrant surge
#

@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"
sharp nacelle
#

@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.

vagrant surge
#

@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

sharp nacelle
#

@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.

vagrant surge
#

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

sharp nacelle
#

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.

vagrant surge
#

@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

sharp nacelle
#

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?

vagrant surge
#

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

worldly pulsar
#

So when you change an entity archetype on the server all the ghosts just stop updating?

trail burrow
#

@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

arctic vector
#

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?

vagrant surge
#

@trail burrow thats kind of garbage

#

whats even the point of the ecs then ? if everything replicated will have to be super rigid

trail burrow
#

@vagrant surge you tell me

#

/shrug

vagrant surge
#

well, forbidding archetype switch is about as "easy mode" as it gets for this stuff

trail burrow
#

It's fairly common

#

You can add or remove non replicated components ofc

#

But that's not very interesting

vagrant surge
#

very limiting

trail burrow
#

Yes

vagrant surge
#

i guess you will need to do child entities and the like for dynamic stuff

trail burrow
#

Probably but that comes with the massive caveat of partial replication

dull copper
radiant sentinel
#

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?

arctic vector
#

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));

safe lintel
#

what does DamageDealerTag look like?

worldly pulsar
#

pretty sure it should be AddComponent(idx, e, new DamageDealerTag())

safe lintel
#

are you guys using asmdef's for your projects? finding the assembly reload time pretty much negates any speedup in compiling

arctic vector
#

@safe lintel It's just a tag component

#

@worldly pulsar tried that, also complains about handling typing(

coarse turtle
#

wonder if burst can handle effectively 0 sized structs on the command buffer πŸ€”

safe lintel
#

pretty sure it can

#

yep just checked i do it all the time

arctic vector
#

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

safe lintel
#

its not anything super simple like mistakenly not derriving from icomponentdata or a class

arctic vector
#

nope

#
public struct DamageDealerTag : IComponentData { }```
safe lintel
#

maybe its just an editor bug and needs to be restarted? more maybe its the serializable bit?

arctic vector
#

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 πŸ˜‰

fresh vector
#

Does the RenderMeshV2 system not material batching yet?

ocean tundra
#

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?

coarse turtle
#

I dont think it flows down the hierarchy

#

like how you'd expect disabling a gameobject works

ocean tundra
#

@coarse turtle yea I'm thinking that too

#

guess I need to loop over all children and their children ect and add it

#

etc*

untold night
onyx mist
#

hey guys whats the difference between a native hash map and a native multi hash map? is the latter simply for parallel operations?

arctic vector
#

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

onyx mist
#

ohh i see thanks dennis!

arctic vector
#

np!

onyx mist
#

one more question, couldnt you just use an array as the value in a hashmap?

arctic vector
#

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

onyx mist
#

gotchu

radiant sentinel
#

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?

radiant sentinel
#

I have netcode too.

sharp nacelle
#

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 })
silver dragon
#

@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.

radiant sentinel
#

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

dusty scarab
#
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?

worldly pulsar
#

probably not what you are looking for, but I tend to prefer EntityManager.Exists(entity) over (entity == Entity.Null) for cases like this

dusty scarab
#

That actually solved it

worldly pulsar
#

my guess is A and B get targetEntity = C, A gets there first and destroys C, but B still has targetEntity == C

dusty scarab
#

Yeah, I added the if condition for that reason, but obviously Entity.null wasn't doing the job

#

Thanks!

naive parrot
#

why is entity manager referred to as dstManager in conversion override method? what does dst stand for? πŸ€”

worldly pulsar
#

destination

naive parrot
#

thats it?! can't say am not surprised , well i guess semantically speaking its relevant enough

worldly pulsar
#

The whole api could use a renaming pass to be honest πŸ™‚

naive parrot
#

i just rename it to entityManager in all my overrides , for sake of readability and immediate clarity

tawdry tree
#

It converts monobehaviors and needs a destination for the entities, which have to be a manager, so it's semantically correct, yeah.

dusty scarab
#

You can use burst and EntiyCommandBuffer at the same time ?

onyx mist
#

Yup the new update made it so. Keep in mind that playback is still not burstable

arctic vector
#

Is there any way to disable the comments that you get when you create new Systems/Components/AuthoringComponents?

warm topaz
#

Does anyone know if there is a way to create entities off of the main thread? Or outside of a ComponentSystem?

arctic vector
#

ComponentSystems are running on the main thread

#

ow I see

#

Yeah you can

warm topaz
#

If I try to call EntityManager.Create() on my own thread it throws an exception

arctic vector
#

wait, let me clarify, are you trying to create entities on a Job?

warm topaz
#

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.

arctic vector
#

Then why not do your spawning on a job? Jobs run in parallel

warm topaz
#

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.

arctic vector
#

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>();

warm topaz
#

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.

viral sonnet
#

Either you use EntityManager on MT or a commandbuffer in another thread

arctic vector
#

^

warm topaz
#

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?

viral sonnet
#

use .CreateCommandBuffer().ToConcurrent()

#

as a reference you can look what JobComponentSystems are doing. it's pretyt much the same

arctic vector
#

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 πŸ˜„

viral sonnet
#

no, you have to get it from main thread

#

when created you can funnel it to wherever you want

arctic vector
#

Ow yeah and then pass it over to the thread

#

gotcha

warm topaz
#

Having troubles with my ecs package not compiling. Something about burst...

candid willow
#

@warm topaz Sharing the error might be a good idea

warm topaz
#

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.

candid willow
#

Looks like API version conflict? Are your Entity packages matching?

warm topaz
#

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

candid willow
#

Yeah Entities, Burst, and Jobs

#

Yeap try updating Burst to 1.2.0

warm topaz
#

oh shoot thanks

#

Unity auto installed this version so I didn't check.

candid willow
#

Yeah its all very touchy

warm topaz
#

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();```
viral sonnet
#

oh good, yeah, you used jobId 0 which doesn't exist I guess

warm topaz
#

well actually I didn't use concurrent.

viral sonnet
#

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?

warm topaz
#

My goal is to move as much of the game logic into it's own thread. Leaving the main thread for just unity things.

viral sonnet
#

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

warm topaz
#

Nothing is holding me back from using jobs except that jobs cannot be used for everything.

#

Some things cannot be parallelized.

viral sonnet
#

if you can write your own threads it should be possible ^^

warm topaz
#

I will more then likely be using jobs for a lot of things later because it's hard to ignore burst lol

viral sonnet
#

it is πŸ˜„

#

do you have an example what you can't do in jobs?

warm topaz
#

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

coarse turtle
#

yes - you can create your own world

viral sonnet
#

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

warm topaz
#

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.

viral sonnet
#

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.

warm topaz
#

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. πŸ™‚

viral sonnet
#

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

warm topaz
#

ahh ok, that's something to think about thanks

viral sonnet
#

np man, good luck on your optimization

arctic vector
#

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

viral sonnet
#

i read that you have to delete library and re-import again

arctic vector
#

yeah

#

did it

#

it works now

wooden falcon
#

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

viral sonnet
#

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

wooden falcon
#

Can you use dictionaries in jobs?

viral sonnet
#

yes, nativemultihashmap or smth like that

wooden falcon
#

I tried using a NativeHashmap<> and it complained that I should use a different data structure

viral sonnet
#

take a look at the ecs samples - advanced boid

#

it's used there

wooden falcon
#

Alright, so basically, do a collect pass to setup the structure and then use that structure in the later passes?

viral sonnet
#

correct when it's dynamic

#

or nvm

#

i see what you meant

wooden falcon
#

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

viral sonnet
#

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.

wooden falcon
#

integer grid in this case

#
public struct Tile : IComponentData {
    public int3 pos;
}```
viral sonnet
#

ok, yeah then you can make a translation from coordinate to array indices. gets annoying though when you have negative coordinates

wooden falcon
#

My idea is to do a first pass to calculate int3 min, max

viral sonnet
#

seems good, bounds don't change

#

?

wooden falcon
#

It's a builder so hopefully I can keep track on when they are changed

#

But I was thinking of just using temp lists

faint scarab
#

how can i fix this i just upgrade to 2019.3.1f and entity 0.2 then i got error when i play

arctic vector
#

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

dull copper
#

hmmm, just realized that the live link is useless as long as hybrid is broken πŸ˜„

untold night
#

I mean, the trick where you parent stuff seems to work

dull copper
#

it requires serialized dots subscene to work, so, nothing on GO side will adjust to it

faint scarab
#

@arctic vector thanks to good advise. I just fixed my problem. πŸ™‚

candid willow
#

Is the PhysicsSamples project out of date for standard ECS patterns?

dull copper
#

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

candid willow
#

Nice, thanks

#

That project looks like its written differently than the ECSSamples project

dull copper
#

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

amber flicker
#

@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 πŸ™‚

gusty comet
#

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?

chilly bobcat
#

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

viral sonnet
#

@gusty comet Yeah, not sure what's the deal with children. I've removed them from the authoring gameobject.

warm topaz
#

@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.

frosty siren
#

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.

coarse turtle
#
        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;
frosty siren
#

yeap, this is exactly what i do in my job

coarse turtle
#

I havent upgraded to the latest entities yet just so you know

frosty siren
#

what AddJobHandleForProducer do?

stuck saffron
#

it says you wait for the job to complete before performing the actions in the buffer

coarse turtle
#

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

frosty siren
#

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.

neon kraken
#

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.

gusty comet
#

@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.

slow epoch
#

@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

dull copper
#

wonder if there's still packages they need to update before releasing dots shooter

remote coyote
#

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

dull copper
#

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

dull copper
#

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

remote coyote
#

Huh

#

Not really DOTS related but

prime cipher
#

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.

prime cipher
#

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 😦

amber flicker
#

Anyone messed around with creating worlds and adding systems to a separate world?

mystic mountain
#

Yeah, you can check out the custom bootstrap on NetCode

amber flicker
#

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.

mystic mountain
#

No idea if you can crossworld.

trail burrow
#

you cant afaik because entity indices/versions can conflict

amber flicker
#

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

chrome pawn
#

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

amber flicker
#

large mesh? tried with a simple cube?

chrome pawn
#

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

amber flicker
#

and the shader is the unity standard shader?

chrome pawn
#

no, it is a shader graph shader though

#

ill sanity test with standard real quick

amber flicker
#

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

chrome pawn
#

great lol

#

same thing with URP/Lit: disproportionate amount of time going to PresentationSystemGroup > RenderMeshSystemV2 > UpdateDynamicRenderBatches > Add New Batches

amber flicker
#

URP not planned to have hybrid render support until sometime late next year...

#

(I know)

chrome pawn
#

you're meant to use the legacy render pipeline with DOTS??

amber flicker
#

no, hdrp

chrome pawn
#

welp, this was supposed to be a webgl game

#

but then again I had a feeling webgl + burst was also going to be impossible

amber flicker
#

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.

chrome pawn
#

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?

amber flicker
#

(caveat, I'm not sure about the current webgl hazards - of which there are many I'm sure)

chrome pawn
#

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?

amber flicker
#

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.

chrome pawn
#

SDC?

amber flicker
#

I don't know anything about the new SRP batcher sorry

#

SDC type I meant ISCD -> ISharedComponentData

chrome pawn
#

but yeah CPU time in the render loop is the primary concern atm

#

ah got it

amber flicker
#

*typo.. geez

winter veldt
#

is adding/destroying an entity of a defined EntityArchitecture fairly cost-effective? or is it like adding/removing components (performance-wise)

worldly pulsar
#

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).

deft niche
#

not exactly sure about adding/removing components though since that changes the chunks

worldly pulsar
#

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.

deft niche
#

Thats true πŸ™‚

vagrant surge
#

its exactly 2 times whatever many components you got memcopy

worldly pulsar
#

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)

vagrant surge
#

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

worldly pulsar
#

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

vagrant surge
#

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

worldly pulsar
#

If I recall correctly you pay for it a lot at query time (at least in Entitas, never used Entt)

vagrant surge
#

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

worldly pulsar
#

Didn't Entitas re-allocate the query result array if anything changed since last query?

vagrant surge
#

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

worldly pulsar
vagrant surge
#
        public TEntity[] GetEntities() {
            if (_entitiesCache == null) {
                _entitiesCache = new TEntity[_entities.Count];
                _entities.CopyTo(_entitiesCache);
            }

            return _entitiesCache;
        }
#

what in the actual fuck isthat

worldly pulsar
#

it's set to null on any add/remove component and then reallocated every time you query

vagrant surge
#

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)

worldly pulsar
#

_entities is a HashSet, and iterating those is super slow in C# iirc

vagrant surge
#

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

worldly pulsar
#

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

civic glen
#

its as fast to enumerate a hashset as any other queryable. The price is paid up front on the insert, not on its access.

vagrant surge
#

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

worldly pulsar
civic glen
#

so does list, and dictionary

#

i didn't say it was fast, its just AS fast as the rest

worldly pulsar
#

Dictionary - yes, but list has a nice packed array its iterator goes through

civic glen
#

what do you think happens when an element is removed from the middle?

worldly pulsar
#

of a List<>?

civic glen
#

yes

worldly pulsar
#

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

vagrant surge
#

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

worldly pulsar
#

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.

vagrant surge
#

in the "OurMachinery" blog, they comment that they offer 2 base data structures

#

dynamic array

#

and hashmap

#

and thats it

dull copper
#

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

coarse turtle
#

yea

dull copper
#

I mean, they surely will work on this as the response said, but didn't expect this

coarse turtle
#

same here πŸ€”

magic frigate
#

What was Megacity doing then?

#

I'm assuming instantiating the assets at runtime

vagrant surge
#

megacity does not have that many objects

#

it has a few basic meshes that it repeats a ridiculous amount of times

untold night
#

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

arctic vector
#

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

hollow sorrel
#

dunno if they mean realtime or unity time could be next year who knows

stuck saffron
#

Well good news is that next year is a month

deft niche
#

pretty sure the fixes would come in quicker.

#

Basic stuff like ConvertToEntity is completely broken in 0.2.0

safe lintel
#

i hope the fps sample or animation arrives with the next update

deft niche
#

I wouldn't count on that πŸ˜›

tired mulch
#

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

hollow sorrel
#

as in like 1 entity renders multiple sprites?

tired mulch
#

Yeah

hollow sorrel
#

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

tired mulch
#

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 πŸ˜…

hollow sorrel
#

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

tired mulch
#

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?

hollow sorrel
#

any particular reason you don't want 1 entity per sprite btw

tired mulch
#

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

hollow sorrel
#

there's a pixel perfect camera package that should still work for ecs since it runs on camera lvl, not on renderers

tired mulch
#

Oh really? I see

hollow sorrel
#

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

tired mulch
#

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

hollow sorrel
#

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

tired mulch
#

Alright sure

zenith wyvern
#

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

zenith wyvern
#

    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

remote coyote
#

Holy blob the DOTS Animation package use a lot of blobs

slow epoch
#

@zenith wyvern i though jobs can only be scheduled from the main thread?

remote coyote
#

hm, what's a baked clip, I wonder

#

var bakedClip = UberClipNode.Bake(m_LinearHierarchyNoRootClip, new ClipConfiguration());

#

bakes multiple clips into one?

zenith wyvern
#

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?

slow epoch
#

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

zenith wyvern
#

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

slow epoch
#

I think jobs have the method Run() which will run the job on the main thread

zenith wyvern
#

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

slow epoch
#

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?

zenith wyvern
#

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

dull copper
#

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

zenith wyvern
#

It is yeah

#

Gotcha, thank you. So basically I have to block the main thread at some point to upload the changes

dull copper
#

also main thing is to be able to process data in jobs

#

its especially important if you do proc gen a lot

zenith wyvern
#

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

solar ridge
dull copper
#

@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

#

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

solar ridge
dull copper
#

also new jobs and collections

solar ridge
#

... new serialization perchance?

dull copper
#

no idea, usually jobs and collections just get updates along with new entities package

solar ridge
#

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 😭

dull copper
#

ah, didn't see new package for that

#

only for entities, jobs, collections and hybrid rendering

solar ridge
dull copper
#

still waiting for Unity Physics update as that's still coming up

solar ridge
#

Actually the new entities is already on the package manager πŸ˜„

dull copper
#

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

solar ridge
#

No changelog yet however πŸ˜›

hollow sorrel
#

changelog is in the package

dull copper
#

yup

#

I had to manually update collections

#

I think some other package put the older thing there

hollow sorrel
#

i'm just waiting for 0lento to post it as is tradition

dull copper
#
## [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).
amber flicker
#

Nothing interesting for me but glad they fixed the Android build pipeline

dull copper
#

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

hollow sorrel
#

or this is the new release pattern

#

new 0.x every week

#

7 weeks until 1.0 bois

dull copper
#

I see no flaw in that logic πŸ˜„

solar ridge
#

or we get to 0.1020.3-preview13

amber flicker
#

1.0 by 2020.1... a 0.x release every other week ?πŸ˜…

dull copper
#

oh wow

#

we can now use the regular hierarchy to examine entity components live while playing

silver dragon
#

uh, nice!

dull copper
#

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

amber flicker
#

nice

dull copper
#

this will make debugging so much easier

#

I won't miss trying to find relevant things from regular entity debugger :p

hollow sorrel
#

that's pretty cool

#

you need dots editor package for that right?

dull copper
#

yes

#

they didn't update it for 0.3, I'm still using the same version I tried with 0.2 entities

slow epoch
#

What brings the dots editor package?

safe lintel
#

ah nice you can even create and move gameobjects and see their entity representation as well

dull copper
#

@slow epoch basically the ability to preview entity conversion from the gameobject side

safe lintel
#

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

stiff skiff
#

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

trail burrow
dull copper
#

@stiff skiff did you notice the collections changelog I posted right after entities changelog?

#

or did you refer to that change

stiff skiff
#

Missed that, was browsing the animation package source

dull copper
#

* Added fixed-size BitField32/64 bit array.

stiff skiff
#

Just looking for new stuff to integrate into our API's so we can use less "homebrew" bits of code

trail burrow
#

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

stiff skiff
#

Yeah its a bit tricky, we currently don't support any of the concurrent stuff really

trail burrow
#

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

stiff skiff
#

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?

trail burrow
#

@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

stiff skiff
#

Wait, so a UnsafeBitSet with an internal pointer to the bit buffer, wont work? But would work if Unity put it in their library?

trail burrow
#

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

stiff skiff
#

True, the fact that its a struct would make that confusing

trail burrow
#

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

stiff skiff
#

Mmm might use a variation of this then

stiff skiff
#

I'll certainly have a look

#

Starred πŸ˜‰

trail burrow
#

^^

stiff skiff
#

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

trail burrow
#

i still find it too early to try to build anything 'serious' in it

#

too much stuff missing

stiff skiff
#

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

trail burrow
#

i've been thinking about doing a large deterministic thing on ecs

#

physics/etc.

dull copper
#

for anything bigger, we'd really need the hybrid rendering to work perfectly

trail burrow
#

@dull copper do you know if it's possible to replace the allocators the ECS uses? πŸ˜„

dull copper
#

no idea πŸ˜„

winter depot
#

Wait, where did NativeString go?

gusty comet
#

ArgumentException: A component with type:BoneIndexOffset has not been added to the entity. anyone know a fix for this

gusty comet
#

I see

winter depot
#

Oh NativeString is still there, just now using Unity.Collections is needed

safe lintel
#

@ me if you get anything to animate, been trying for a while but the clip conversion stuff eludes me

gusty comet
#

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

safe lintel
#

you just add it manually to your manifest, its on the regular registry

gusty comet
#

alright, thanks

gusty comet
vagrant surge
#

let me know what you think, even if its still wip and basic

worldly pulsar
#

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

vagrant surge
#

classic

coarse turtle
#

@vagrant surge looking forward to decs πŸ™‚

vagrant surge
#

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

worldly pulsar
#

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 πŸ˜›

vagrant surge
#

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

deft niche
#

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 ?

worldly pulsar
#

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.

vagrant surge
#

of course it doesnt. Generic systems are a huge no

deft niche
#

@worldly pulsar You can still use generics.. but have to specify it like this..
[assembly: RegisterGenericComponentType(typeof(MyGenericComponent<int>))]
[assembly: RegisterGenericComponentType(typeof(MyGenericComponent<float>))]

vagrant surge
#

generic components also really dont tend to work well, in any ecs

worldly pulsar
#

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.

vagrant surge
#

ah

dull copper
#

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

stiff skiff
#

So whats this ENABLE_SYSTEM_V2 in 0.3.0 ?

eternal ice
#

Does DOTS support iOS build with Enity 0.3.0?

knotty radish
#

Has anyone tried to make a build with netcode with the netcube sample ?

#

😦

dull copper
#

@knotty radish apparently you need the new build setup for anything that uses subscenes

knotty radish
#

Already using it

dull copper
#

you can find examples for that on DOTS sample repo

#

ah ok πŸ™‚

knotty radish
#

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

gusty comet
#

I am really looking foward to a production ready state of DOTS. The whole ECS workflow for me makes so much more sense

knotty radish
#

I will ask on the forum to be sure about it (may have missed something)

knotty radish
#

So this seems to be the build manager package (barebone) which is nice

#

Custom steps and other things should come soon after that

untold night
#

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.
clear stream
#

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?

mystic mountain
#

enabled debugging?

#

hooked up project before press play button?

wary anchor
#

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.

worldly pulsar
#

Why are those in Packages/ in the first place?

wary anchor
#

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?

worldly pulsar
#

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

wary anchor
#

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

worldly pulsar
#

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.

wary anchor
#

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

worldly pulsar
#

World.Active was just renamed

#

to a really long name I can never remember

wary anchor
#

something about injecting? that looks entirely wrong. I'll just have to go back they've broken almost everything about my game

worldly pulsar
#

DefaultSomethingSomething

wary anchor
#

DeffaultGameObjectInjectionWorld I'm not doing any kind of injection that looks like BS to me

worldly pulsar
#

that's the one

wary anchor
#

no, they're going to have to name things properly. Not using that

#

thank * for git!

worldly pulsar
#

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 🀷 )

wary anchor
#

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

amber flicker
#

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?

worldly pulsar
#

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

amber flicker
#

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

worldly pulsar
#

var cdfe = GetComponentDataFromEntity<Thing>();
Entities.ForEach((Entity e, ref OtherThing other) => { /* can use cdfe here */ }).Run();

amber flicker
#

ahhh ok awesome

worldly pulsar
#

the captured variables are moved to the fields of the auto-generated job

amber flicker
#

smart - don't know why I didn't intuit that, thank you

worldly pulsar
#

I figured that out after like an hour with DotPeek πŸ˜› (not sure I've actually tried this with burst tho, but should work)

amber flicker
#

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)?

worldly pulsar
#

they are completely different things under the hood

amber flicker
#

πŸ₯Ί

slow epoch
#

Everytime i check here for the issues ppl is having i end up more confused about ecs

worldly pulsar
#

and no, with the new (a.k.a. JobComponentSystem.Entities.ForEach) there is no way to provide your own query

amber flicker
#

cool - I now see how you can do NativeDisableParallelForRestriction though which is also cool

worldly pulsar
#

yup, the builder has a bunch of WithX() methods, like WithStructuralChanges(), WithoutBurst(), WithDeallocateOnJobCompletion(array) etc

wary anchor
#

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

worldly pulsar
#

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.

mint iron
#

@wary anchor good to know, i manually upgraded properties because inspector for physics was broken for like 6 months?

worldly pulsar
#

also: the hack they used to provide an error message for Entities.ForEach(()=>{}).Run(); is a work of art

amber flicker
#

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 πŸ˜…

wary anchor
#

@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

worldly pulsar
#

@amber flicker assign everything you need to new local variables right before the Entites.ForEach() and capture those

gusty comet
#

How feasable would it be right now to write a 2D game, that utilizes ECS from the ground up using 2019.3 ?

wary anchor
#

Dunno, let me know if you manage to install ecs within 2019.3.0f1, I can't get it working when upgrading from 0b12

gusty comet
#

what causes issues for you? The entity package worked just fine for me

#

havent done anything yet but it installed just fine

wary anchor
#

would to take a screenshot of the left side of your package manager please? I have conflicts of all sorts going off here

gusty comet
#

Although I used a fresh installation

wary anchor
#

thanks, so maybe burst and collections need to go too

worldly pulsar
#

I feel like the majority of the problems people have with dots boil down to Package Manager being not very good at package managing

amber flicker
#

@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

gusty comet
#

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

wary anchor
#

@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

amber flicker
#

@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.

gusty comet
#

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

amber flicker
#

no eta on when drawing sprites will be supported afaik

worldly pulsar
#

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.

gusty comet
#

hmm that is a bit meh, I was hoping to avoid that. Because it means I have to write the baseline code twice

worldly pulsar
#

not really, use ECS for logic and then have Display gameobjects

gusty comet
#

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

worldly pulsar
#

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

gusty comet
#

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

worldly pulsar
#

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)

amber flicker
#

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.

gusty comet
#

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.

worldly pulsar
#

no, it's the basis of the whole conversion pipeline

gusty comet
#

yeah the authoring component is what utilizes that now

#

it implements that interface

wary anchor
#

that used to work

gusty comet
#

this is how the template looks

worldly pulsar
#

does it compile in Unity? (I suspect your .sln/.csproj wasn't updated)

#

because that most definately should work

wary anchor
#

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!

gusty comet
#

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.

worldly pulsar
#

but seems detrimental if you build it from the ground up that way.
not sure what you mean by that

gusty comet
#

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

amber flicker
#

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

worldly pulsar
#

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

gusty comet
#

Yeah again this seems like a massive workflow overhead to me.

worldly pulsar
#

It's actually one of the major selling points of dots for me πŸ˜›

gusty comet
#

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

worldly pulsar
#

One thing to keep in mind is that you never think about authoring monobehaviours in runtime

gusty comet
#

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

worldly pulsar
#

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

gusty comet
#

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.

worldly pulsar
#

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>

gusty comet
#

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

worldly pulsar
#

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?

gusty comet
#

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

worldly pulsar
#

But that's all on the runtime side

gusty comet
#

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

worldly pulsar
#

authoring components are all about creating the data in the first place

gusty comet
#

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

worldly pulsar
#

ok, so how would you see my List<Transform> Waypoints -> NativeArray<float> workflow?

gusty comet
#

Thats not a concrete example.

#

What is the task that needs to be solved?

worldly pulsar
#

It is a very concrete example, I have an AI that will move between waypoints. I need to define those waypoints on the level.

gusty comet
#

Yeah and that would be handled by several systems not one.

worldly pulsar
#

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

flat talon
#

@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

gusty comet
#

Yeah I get the economic reality of it Siggi, sadly I do.

flat talon
#

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

zenith wyvern
#

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

wary anchor
#

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

gusty comet
#

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

flat talon
#

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

worldly pulsar
#

@zenith wyvern My question was to Yuuki about how that would work without the conversion pipeline πŸ˜‰

zenith wyvern
#

Oh sorry I'm tired

flat talon
#

Rett we saw a glimpse of that in the "DOTS mode" in Tiny, the hierarchy was showing entities

zenith wyvern
#

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

gusty comet
#

Nah that was me misccomunicating then, that was never my intent

trail burrow
#
  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?

flat talon
#

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

trail burrow
gusty comet
#

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

zenith wyvern
#

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

gusty comet
#

and tutorials are outdated faster then you can look at as well

wary anchor
#

@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

gusty comet
#

because the whole DOTS techstack would fit so well for what I am trying to do

worldly pulsar
#

@trail burrow for me it was updating the Collections package manually I think. Look through what packages offer to upgrade.

trail burrow
#

@worldly pulsar ah.. thanks

gusty comet
#

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

flat talon
#

I DO however want to see an entity hierarchy at runtime.. the entity debugger really isnt that great .)

gusty comet
#

Because right now I seem to fail to grasp the process

trail burrow
#

is there even 2d support?

gusty comet
#

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

zenith wyvern
#

For a sprite you'd have to make your own renderer, or make a quad using the meshInstanceRenderer

flat talon
#

Tiny will support 2d again some time after the next release (that focuses on 3d)

coarse turtle
#

@gusty comet I might have an example - still in process of upgrading it

gusty comet
#

That would be immensly appreciated. If you got it upgraded please @me

#

I learn best when I poke at working code

flat talon
#

@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

gusty comet
#

That seems resonably up to date!

flat talon
#

cool, perhaps you can start poking at that πŸ™‚

worldly pulsar
#

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.

slow epoch
#

I'm really curious, what's the difficult part about making the field editable?

amber flicker
worldly pulsar
#

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"

viral sonnet
#

@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.

gusty comet
#

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

worldly pulsar
#

And that is correct. Authoring components are just about a convenient way to create that data.

viral sonnet
#

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.

gusty comet
#

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

worldly pulsar
#

If you had your own renderer you could literally just do this:

[GenerateAuthoringComponent]
class RenderMe : IComponentData {
    public Mesh Mesh;
    public Material Material;
}```
viral sonnet
#

what's the overhead? you put ConvertToEntity on the go and have a textured cube

worldly pulsar
#

and this serves both as an authoring component and runtime component

viral sonnet
#

meshfilter, renderer already works in conversion

gusty comet
#

The issue to me seems that those conversions are specific and not systemic arent they?

worldly pulsar
#

yup, for hybrid renderer it's all just built-in

#

define "systemic"

gusty comet
#

Literally what ECS does, in pseudocode for any entity of type enemy that has a position do something

worldly pulsar
#

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

gusty comet
#

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

worldly pulsar
#

the authoring component is not supposed to even exist at runtime

gusty comet
#

yes not at runtime but in the editor

#

which again makes the authoring conflict with runtime, when it should not

viral sonnet
#

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

gusty comet
#

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

viral sonnet
#

you call it overhead but a designer doesn't want to code

gusty comet
#

Yeah so shove all the work onto the programmers so the designers can faff around, that is not exactly a practical solution

viral sonnet
#

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

worldly pulsar
#

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.

gusty comet
#

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

worldly pulsar
#

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

gusty comet
#

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

worldly pulsar
#

They mark it 'preview' for a reason

gusty comet
#

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

worldly pulsar
#

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.

viral sonnet
#

it's certainly better than the ComponentDataProxies as MB from before

gusty comet
#

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

flat talon
#

@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.

viral sonnet
#

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

gusty comet
#

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

viral sonnet
#

correct ^^

gusty comet
#

plus I am not fond of its python like gdscript syntax

amber flicker
#

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?

trail burrow
#

editor just spins

#

locking one core completely

worldly pulsar
#

I have no clue how to do chunk iteration with the ForEach, would probably use ComponentDataFromEntity for that and check per-entity

trail burrow
#

dont think you can do chunk iteration with ForEach?

amber flicker
#

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)...

trail burrow
#

Doubt that's possible considering the hard coded nature of the generics