#archived-dots

1 messages · Page 176 of 1

solid flume
#

Once I get less mad I might come back to this and possibly try a third party framework

hollow sorrel
#

what's the issue

solid flume
#

All I can figure out is that my pathfinding isn't working

#

Somehow the algorithm never reaches the end node

#

And in general it's become so messy and I've barely gotten started

#

It's becoming annoying to deal with my own code

hollow sorrel
#

relatable

tardy spoke
#

Really? I find it squeaky clean and love the architecture

#

but then again... I am a total killer.

#

Also @solid flume if you're using a SystemBase you can do Entities.WithAny().ForEach lambda, which helps keep the amount of code down.

I definitely won't argue in OOP land I find I'm writing about half the lines of code for the same functionality as in ECS, but I find the ECS logic easier to follow at scale

#

I think one of the biggest unsung advantages of ECS is mentally you're doing way less "context" switching in your brain. Most of the Systems follow similar patterns, etc.

molten plover
#

is there a point to write something using dots if there is only a single instance of it, like the player

opaque ledge
#

well, alternative is to use MB, i rather use a system, you should run it on main thread

safe lintel
#

@molten plover imo you get better code clarity and modularity with dots over object orientated programming. though in its current form you lack so many benefits from stock unity that i wouldnt recommend it unless you are very adventurous and a good self learner

runic crystal
#

reposting from general-code :
trying to adapt my job to use meshdata but man it's confusing
like bro the job is just supposed to change the y coordinates of all the vertices in a mesh and I still don't get how I can just get a copy of the mesh in the job, modify that and then get it out of the job and apply it to the mesh
current version of the mess I'm writing for anyone that might have an idea
https://hatebin.com/odatypymvq
https://hatebin.com/gpkvoomaiq

harsh owl
#

I want to attach an Sprite to an Entity, it's for my UI to show an Icon, no burst or systems will ever touch it.
Should I put it through ComponentObject or through SharedComponentData?

#

Or there is a new way of doing it?

opaque ledge
#

why Shared ? ComponentObject seems fine i think

harsh owl
#

well, ComponentObject needs to be an Component, which have tons of useless fields. but ISharedComponentData always puts entities in different chunks if they have different values.

dry dune
#

wow installed latest beta and got a dark theme in free version... omg finally! 🎉

safe lintel
#

component object. if you have to ask about using ISharedComponentData, its probably not for you

harsh owl
#

I am not asking about using it, I am asking about which is the least bad to store managed data

#

I know how to use when it is to be actually used as a ISharedComponentData rather than just a data storage method

runic crystal
#

slightly related to my problem :
if I repeat a job every frame am I better off keeping its nativearray(s) permanent or disposing of them and creating new ones every frame

safe lintel
#

i think if you can safely reuse the array as a persistent one its fastest but if not it shouldnt be a problem to dispose and make a new one every frame.

spark glade
#

Btw, is anyone running successfully on 2020.1 and can run their game on a Android device?

runic crystal
#

kk

#

the day I figure out meshdata this thing is gonna be optimized as shit

opaque ledge
#

@spark glade not me 😦 i was working on a project for 8 months and turns out it doesnt work well for android builds

#

i am working on a hyper casual game now with MBs

solid flume
#

2020.1 doesn't like android?

opaque ledge
#

i think hybrid renderer v2 doesnt like android

solid flume
#

Ah

harsh owl
#

slightly related to my problem :
if I repeat a job every frame am I better off keeping its nativearray(s) permanent or disposing of them and creating new ones every frame
@runic crystal keep and resize on demand, been working just fine for me doing that. Remember to dispose of it though.

solid flume
#

Okay so I'm safe

#

... for now

runic crystal
#

yeah I just changed it to that and it's even more performant

#

literally the majority of the cpu time for my function is now the lines I posted above

harsh owl
#

AFAIK ToArray() might be the issue, since that does allocate a new array and then copies data.

runic crystal
#

I tried copyto and it ended up being worse iirc

#

also there's a spike from GC collection every few frames but at this point idk what it is

zinc plinth
#

why are you editing meshes every frame, that's like the worst idea possible

#

use shaders for this

runic crystal
#

cause it's to animate the water and I want to be able to sample the height of the water at any given point in code

#

for like, boats & shit

zinc plinth
#

then use shaders

runic crystal
#

you can't pull vertex position out of shaders iirc

hollow sorrel
#

that .ToArray() is gonna be hugely slow and allocate GC every frame because it's allocating a new array

zinc plinth
#

why would you pull vertex data out of shaders

your shaders are here to tell how your mesh should look, not to get data from it

runic crystal
#

cause I'm calculating waves on water
and I need to know the height of said water not just to render the water but also for stuff that interact it it
like, floating objects

zinc plinth
#

your water mesh should be a plane, and you put your animations on shaders

runic crystal
#

I just explained why I can't do that

zinc plinth
#

you won't ever get good performance by editing shaders each frame, be it with ecs/burst or not

#

just get the same function you use to calculate the water height/waves in the shader and reuse it in the objects's shaders you place on the water

runic crystal
#

right so if I ever change literally anything to the function I need to change it in the shader too

zinc plinth
#

you only have to change it in the shader because you'll write it in hlsl

hollow sorrel
#

mesh.setvertices should let you pass in the nativearray directly which should be better
i agree with torsina tho, shaders sound like a much better solution for this

#

would be 1000x faster

solid flume
#

You might have forgotten a couple zeroes there

zinc plinth
#

yes ^

#

shaders are absurdly cheap

runic crystal
#

so like
if I write the function in a shader
can I directly call the function in c# somehow or I need to do something like blitting

solid flume
#

Until the point where you use them to to marching cubes

#

Although considering the operations and the magnitude it's still very fast

#

Write a shader. Create a material with that shader. Put it on the water mesh

#

You can set properties of a material through code

runic crystal
#

also yes SetVertices is hella faster

zinc plinth
#

you'll never call that function from c#, this is for shaders to know where to place stuff, your transforms will never change

coarse turtle
#

another option is to use DrawMeshProcedural, construct the GraphicsBuffer/ComputeBuffer to generate the water waves

runic crystal
#

ok but I want my boats etc to be affected by physics
as in, properly float in the water (and at the right height of the water depending on where they are) but also just sit in place on hard surfaces like an island

#

so I can't really just deform everything that floats in their shader

solid flume
#

Does your game really need very good water physics and simulation?

zinc plinth
#

then rewrite the func in c# aswell and just rotate your bots accordingly, you can't use physics for this water physics

runic crystal
#

I don't need the waves etc to be super realistic but I do want floating objects to be realistic to some degree

zinc plinth
#

physics colliders in Unity.Physics have static shapes once baked

runic crystal
#

I know

quasi trellis
runic crystal
#

thanks

quasi trellis
#

it is not done in dots, but you might be able to translate it to it

runic crystal
#

I'm not working in dots, just using jobs and was advised to post here as well

zinc plinth
#

huh, that 4 point under water trick is neat

runic crystal
#

yeah in that tutorial the dude is not only moving the vertices from the cpu, he's also not using jobs at all to do it

#

all main thread

#

so huh

#

oof

#

the way he does buoyancy is cool
the way he's taking care of the waves is not

zinc plinth
#

why ?

runic crystal
#

nvm he switches to a shader at the end

#

I'm dumb

#

but yeah
having to just write the same formula in the shader and in c# code seems wrong but I guess there isn't really any other solutions that doesn't require a massive brain

lusty otter
#

Transferring data from CPU to GPU is also expensive.

tardy spoke
#

This isn't DOTS related but I'll post it here anyway since this channel is home to the elite programming strike force - the best of the best.

Just writing an editor script to replace a bunch of prefabs with new prefabs that have identical names (a bunch of prefabs I've converted from having textures to only having vertex colours).

The way I've seen this done before is to grab every GO in the scene and point them to the new prefabs (copying rotation, scale, etc) but writing that seems tedious in comparison to how simple it would be if I could just overwrite the original prefab assets directly.

The reason why I want to overwrite them and keep the references is because the scenes of everything that was built with the prefabs would stay intact.

Seems like there should be a way to do this that doesn't involve the scene at all.

violet cosmos
#

MeshBaker has something like that in it. You can chose new prefabs or bake in place

harsh owl
#

Context: I am going through all ingredients currently being cooked in my utensil to check for how long until the first one burns and how long until all of them are cooked.
To do this, I am using the ISharedComponentData for the cooked item result (which is present in the utensil and all ingredients).
Question: Is there any difference between [iterating over all ingredient chunks and taking data from each ingredient through the chunk] vs [Getting all the ingredient entities and get the data through the entity]?

#

Also, how do I use a ArchetypeChunkIterator? I assume it's a better way to iterate through chunks than using CreateArchetypeChunkArray

runic crystal
#

for anyone that was here yesterday :
maybe I don't have to write the function to simulate waves both in shaders and in code
maybe if I use a compute shader to write the height of the water to a texture once per frame, and then use that texture in the shader & sample it in c# when needed for non graphics stuff, I have the function all in one place instead of in 2

harsh owl
#

oooooh boi, ya going in a danger territory messing with compute shaders

#

you better off doing it twice, especially with the whole memory latency of getting GPU processed data

#

you will be dealing with the C# part using 2 frame old data

zinc plinth
#

@runic crystal just write that damn function 2 times --'

runic crystal
#

kk

zinc plinth
#

ho come on! why do they have to reset Parent to Entity.Null when you copy entities between worlds ><

#

I guess all references to entity indexes that don't exist in the new world are deleted --'

#

Wat ```Burst error BC1001: Unable to access the managed method object.Equals(object) from type Game.Scripts.ECS.Components.MeshBaking.BakedMeshHash

#

why is it thinking this is not blittable --'

   public struct BakedMeshHash : ISharedComponentData
    {
        public uint3 Hash;
    }```
coarse turtle
#

object.Equals(object) - it's likely the default Equals implementation which casts object -> BakedMeshHash

// Default implementation
public bool Equals(object other) {
  return Equals((BakedMeshHash)other);
}
zinc plinth
#

ye but why is burst annoying me with this ? I'm just trying to add/set shared component from ecb

#

ahhhh ok Afaik, SetSharedComponent is not supported by Burst. This underlying method EntityCommandBuffer.AddEntitySharedComponentCommand takes an object as a parameter which is definitely not possible in burst. https://forum.unity.com/threads/burst-new-release-1-2-0-preview-10-we-need-your-feedback.789473/

#

I tried to burst that job and so yea burst's angry >.>

zinc plinth
#

tbf it's a bit annoying that they don't handle blittable and non blittable shared components diferently

#

there could be some rly good performance boost to it :x

harsh owl
#

there should be an burst-able function to let you set the SharedComponentData index, you can get it, but you can't set it afaik

zinc plinth
#

huhh ?

zinc plinth
harsh owl
#

there is a function to get which SharedComponentData index the chunk is referencing or something

#

index, as a int value

#

what it actually internally uses

#

but there is no function to set that value in burst code

zinc plinth
#

well there's no such api for command buffers sadly

hollow sorrel
#

it kinda sucks there's entitymanager, ecb and exclusivetransaction which all use roughly the same api but they get updated seperately

#

ecb eventually got most the api changes entitymanager got but exclusivetransaction is still stuck in 0.0 land

zinc plinth
#

what's the purpose of exclusive transaction ?

hollow sorrel
#

lets you do structural changes from non-main thread, like from jobs (but it won't let main thread touch entitymanager during this time so it's not a replacement for ecb)

#

used for procedural gen / loading worlds and then moving entities from loading world into main world

#

oh also i'm temporarily using it as replacement for ecb, i'm adding components on world A from world B but if they are more than 4 frames apart ecb starts crying because it uses jobtempalloc

#

exclusivetransaction doesn't have that issue, but that's also how i noticed it was missing a lot of api, like it doesn't have batch add/remove for example

minor bloom
#

Hi guys, I have a problem which could just take common sense to fix but I can't seriously figure out what to do

I have a problem with the DOTS physics as every time I convert to an entity it destroys and I don't know why, I know I have it on convert and destroy but after watching tutorials and some other videos on it, for me. It just doesn't work

#

can someone help me fix this

winter depot
#

Do most people rely on parent-child relationships to break down bloat of Archetypes? As in instead of having all components that Offensive might have attached to a primary entity (along with movement/defensive/etc) it is on a separate entity and is linked via parent?

hollow sorrel
#

yeah i think splitting and linking entities is fine if they get too big, but referencing the linked entity's components is random access so would only recommend if they're seperated enough that they don't have to look up data from the linked entity much

winter depot
#

I would imagine the biggest thing would be translation data for calculation of range and collisions and what not

#

That would be based on the parent and all the others would need to look up that data?

hollow sorrel
#

yeah you got two options in this i think

  1. every time you need translation, look it up from the parent
  2. have a system copy that translation onto the other entity, might be faster if you're accessing that seperate translation a lot from different systems because then you could get more cache hits when iterating
#

1 is fine if you only need it for one system

winter depot
#

Yeah, my approach was already going to 2, if I decided to offload the components to children entities

#

But that would mean every cycle for entities moving it would be writing to a multitude of other components across other entities. Still on the fence

hollow sorrel
#

yea

#

right now i do that with seperated sim entities and render entities

#

render entities need sim entity's position

#

so it's copying every frame

winter depot
#

Its not too heavy? I would be in the same boat, but for probably 4-5 different entities/components this way

hollow sorrel
#

i think it's fine
without the copy it'd be a lot more lookups per frame so would be worse
i think only downside is that copied components take up a bit of space in your seperated entity's chunk

#

if you wanna optimize it you could use a change filter to only copy when translation has changed if it doesn't happen every frame for you

#

also it's a bit of boilerplate to write the copying part for each component but meh

#

i'd be interested to know if there's a more efficient way of doing this tho, i just haven't figured it out so far

winter depot
#

Right, almost feels like SharedComponentData

hollow sorrel
#

ooo glad you bring that up maybe that's a decent approach too

#

so afaik sharedcomponentdata is entitymanager has a list<object> and scd has an index into that list, right?

#

could maybe build up a seperate nativearray<translation> lookuptable that you copy the primary entity's translation into

#

and just an index into that table on the secondary

#

and it should be faster than a component lookup because component lookup is actually like 3+ lookups

#

hmm dunno, might be worth looking into if performance becomes issue there

#

so far i feel copying data into the other entity is very simple so if that works then eh

winter depot
#

Yeah, I am just trying to find what unity would say is the correct approach but having a hard time looking for an example they may have done where they manage a problem like this. I think copying feels simpler so that is likely what I will do

zinc plinth
#

feel like I would be better off recreating the entities in the new world instead by hand

#

which is quite stupid to think about

#

and not like I can put this on an other thread cuz CopyEntitiesFrom is only from EntityManager..

winter depot
#

I was just looking into doing something like that, but instead I am trying the <Prefab> approach

zinc plinth
#

I could just delete them and recreate them in the world if need be, but god this bring so much complication

winter depot
#

prefabs?

zinc plinth
#

these entities are childs of prefabs and they only contain renderers not logic

#

so I'd have to piece back together the prefab

#

and I'm splitting hair just by thinking about it

#

this whole thing is already complicated enough

#

urg

winter depot
#

I see what you mean

#

If both were prefabs, and you had a system only looking for prefab tags I assume it would be easier

zinc plinth
#

I could "replace" the renderer component with my own component containing the same data, and when I need the source renderer back I re-replace it with RenderMesh

#

if only DisableRendering worked acegikSparkles

winter depot
#

Yeah, currently doing my own rendering, we should be seeing new animation tools for ecs though in the next few weeks right?

zinc plinth
#

heh ?

winter depot
#

I thought I read a post about it, let me see if I can find it

dry dune
#

if only DisableRendering worked
DisableRendering works for me

zinc plinth
#

hdrp will shit at you if you use it

#

it will still cull and eat your cpu time for breakfast

dry dune
#

i'm using URP

zinc plinth
#

I agree that renderer is prevented, but then why tf is it culling that --'

winter depot
#

I can't find the post, but I am 90% sure I didn't dream it 😮

zinc plinth
#

why aren't we able to set a shared component index --'

#

god ecs is tilting me today

blissful gorge
#

was wondering why the performance test of my job had 72 GC allocations when it should have 0. Found out that if you go to Jobs -> Leak Detection -> Full Stack Traces (Expensive) was the culprit, and Jobs -> Leak Detection -> Off gave me 0 GC allocations in my performance tests. Friendly reminder to turn that off if you're trying to perf test your jobs.

mint iron
#

always exciting when we see new faces in the channel, welcome!

low tangle
#

new blood for dots to consume

hollow sorrel
#

@zinc plinth wow 4 seconds is crazy, is it making copies of mesh + material as well or something?

#

crazy as in serializing the entire world + deserializing it into a new one would even be faster i think

#

maybe something funky going on

zinc plinth
#

I'm guessting it's somehow not internally using shared component indexes and instead manually copy the new value each time

#

I'll try to do my "replacing component" approach and keep the entities in the same world when I get not too annoyed at ecs

#

it would be even better if I could use these damn indexes

#

but it's an internal method 🙃

#

huh it's moving the chunks

zinc plinth
#

omfg I can't even do my replacement method in jobs because I can't get the RenderMesh inside it cuz it's not blittable --'

#

isn't there some fucky way with GCHandles to get a managed type into a (non burst) job ?

#

like I'm that desperate about it ;-;

calm edge
#

What are my options for rendering in DOTS? Just Hybrid Renderer?

zinc plinth
#

yea

#

or your own renderer but gl

mint iron
#

possibly but it depends on if you own it or unity does, because unity is gonna ignore .net GC handles and do what it wants. Like how they forcibly remove native Go/Mb and .net is like whaaaat, null, regardless of if it still has references.

zinc plinth
#

need to check if I'm not just getting null from my gchandle in job

#

well handle.Target isn't null ThinkMan

#

so that's a first step

#

RenderMeshSave is a copy/paste of the code from RenderMesh (with IEquatable changed to right type ofc)

#

in debugger the command type is 40235

#

huuuhhh why >.>

#

hoooooo

#

I forgot I'm using this ecb concurrently >.>

#

o.0 it worked

#

holy shit it worked

#

how let's see how much this takes

#

so now this takes 531ms including 515ms of ecb playback, yikes

#

and that's only for 20K entities on a 100 by 100 grid

#

that's with a Debug.log in them tho

#

hmm is there some way I could speed up that playback time ?

#

I have 6.3 seconds of playback on the frame the mesh baking system group does work whenlifegetsatyou

zinc plinth
#

I wonder how much faster are entity queries for ecb commands rather than doing stuff per entity

#

and if the cost of adding and removing a tag specifically for this will not outweigh the benefits

#

HOLY SHIT

#

fast this thing is

#

3.75 seconds with ecb -> 53 ms with entity queries

#

8.4s -> 1.7s

#

and I can still do alot more I think

#

now that I know entity queries are so damn worth

zinc plinth
#

so out of 1s for the GetMeshBakingGroupRendererSystem, I have 370ms of buffer retrieval o.0 (80K instances)

stiff skiff
#

@zinc plinth Do you get the same performance improvement if you do this with collection safety checks off?

zinc plinth
#

these improvements were only from refactoring my code

mint iron
#

have you tried measuring with safetys off thou

zinc plinth
#

can try Shrugging

stiff skiff
#

It could be they are the same speed. But since the query version doesnt create that INSANE amount of allocations for the safety sentinels

#

(Never profile things with the collection safety on)

zinc plinth
stiff skiff
#

I'm scared to ask, why are there still so many allocations ?

zinc plinth
#

100ms less

stiff skiff
#

So at the top of your profiler, there is a button to enable the stack traces for allocations

#

clear the profiler after hitting it and record some more

#

and you can see what is causing the allocations

#

365685 allocations is kind of nuts

zinc plinth
#

I know what are causing them, I use managed collections in these jobs

#

this frame is not what the game runs at, it's the mesh combining step

#

only runs on the grid on 1 frame

stiff skiff
#

Is this an open source project?

#

Would love to dig through it at some point

zinc plinth
#

nah, will maybe make it a boilerplate for grid based games in ecs if I'm happy by the features and perf and put it paid on the asset store, otherwise I'll just use it for my game

stiff skiff
#

👍

zinc plinth
#

for now mostly angry at hdrp and unity physics for performance

glossy summit
#

Is it possible to do a Entities.ForEach() with an optional component?

#

Or maybe there's an easier way to do what I want 🤔

#

When created some of my entities have a DisableRendering component

#

Based on some conditions, some of the entities will need to start getting rendered, so I'll need to remove the DisableRendering component

safe lintel
#

cant remember if the lambda has options for that, but as a workaround you could just use HasComponent<DisableRendering>() and if it does remove it

glossy summit
#

Hm, how do I get the source entity from the Entites.ForEach @safe lintel ?

#

🤔 can I add the Entity itself as a param

safe lintel
#
Entities.ForEach((Entity entity, int entityInQueryIndex, ref MyComponent myComponent)=>{
    if(HasComponent<DisableRendering>(entity)){
      //do stuff
}
})
glossy summit
#

Dope, thanks! That's exactly what I was looking for

glossy summit
#

Hmm, anybody know what I'm doing wrong if this shows up?

Entities.ForEach Lambda expression makes a structural change. Use an EntityCommandBuffer to make structural changes or add a .WithStructuralChanges invocation to the Entities.ForEach to allow for structural changes. 

If I understand the docs correctly enabling with structural changes remove the multithreaded capabilities of the foreach, how would I get around this?

safe lintel
#

you dont, consider that removing or adding components requires sync points, so you can defer it with entitycommandbuffers or do it immediately withstructuralchanges. the entities docs has more info on this

calm edge
#

If I want to use the Hybrid Renderer, do I have to match one of these three component sets?

opaque ledge
#

yeah, if you convert an entity witih a mesh filter and mesh renderer Unity will automatically calculate stuff and put thosse components for you

calm edge
#

I'm creating them manually

calm edge
#

looks like I just needed RenderBounds which gets transformed into the other bounds

twin raven
#

@zinc plinth What do you exactly mean by changing from the use of ECB to entity queries?

calm edge
#

In ECS is it generally better to use tags or a dirty flag on a component to signal something needing updating?

hollow sorrel
#

depends on a lot of things, changing chunk (adding component) is expensive but it's cheaper to query an archetype than it is to check a dirty flag per component
so if you are adding/removing tag on the same entities every frame, better to use isdirty, if not then component tag is usually fine

#

also current plan is to add a disabled flag to each component so in the future that could be a thing to consider too, adding the tag beforehand and enabling/disabling this flag when you want to setdirty

#

as in plan from unity side

#

should be better than a dirty flag in a component itself

karmic pilot
#

What is currently considered best practice for runtime changeable configuration data which is NOT set in the editor? Use a central ConfigurationSystem which is keeping state and being queried by other systems or make individual components and use e.g. GetSingleton<T>() on those components in systems that need the configuration? This would currently lead to a lot of individual components which would each use up a single chunk due to the archetype being unique.

amber flicker
#

Oops, misread your post at first. Configuration data that's mutable. Possibly shared statics? If you're worried about wasted memory then you could also combine a lot of components on one 'Settings' singleton entity? Rather than one component per entity?

karmic pilot
#

yes mutable, like one more specific example:
we receive addressables catalog paths at runtime (can be changed multiple times during the lifetime of a session), remove old catalogs, load new one, transform urls for CDN and then set the resource locations. while this is in progress, there should be no other system (like the ones downloading or instantiating individual addressable assets) doing any work on addressables, as the cache might be completely out of sync until the whole refresh is done

zinc plinth
#

@twin raven I was adding and removing a shared component per entity on more than 80K entities, results in almost 4 second of ecb playback. In the other hand if I create a entity query for the system with a special tag that I add and remove right before and after my changes, I can get these 80k entités in an entity query instead, and the speed difference is 100x if not more because EntityManager has a version of it's api for entity queries as the subject of the change

amber flicker
#

@zinc plinth Apologies if you already know this (maybe someone else will find it useful) - if you imagine every entity has an archetype and it indexes into an array of archetypes to know what components it has - when you do what (at least I call) a 'batch' operation with an entityquery, it's effectively changing a single entry in that array - so it's blindingly fast - no moving entities or chunks around

hollow sorrel
#

oh wow i thought an update mentioned they added those batch entityquery methods to ecb seperately but seems like they forgot sharedcomponents

zinc plinth
#

I know now? I looked at the code for this yesterday @amber flicker

amber flicker
#

it's almost free to change the archetype of every entity of a certain archetype, no matter the number - so cool 👍

calm edge
#

if I'm adding a system to a world manually, do I have to put it in the right update group myself?

#

it seems I need to call group.AddSystemToUpdateList(system) as well

hollow sorrel
#

@calm edge yep there's no automatic method for it

#

you gotta read out the attribute yourself if you want to auto add it to group

#

here's the method i use

#

assumes that that group already exists in world tho

#

if you're adding a bunch of systems from scratch all in one go, you want to add them to the world first and then add them to update lists

#

because otherwise you'll be trying to add to system groups that don't exist yet

#

ran into that issue before

zinc plinth
#

that's a sweet hatebin acegikMeow

zinc plinth
#

why is there no api to add the same component(not shared component) to a query/native array of entities...

#

I just want to add Parent to all my grid tiles (._. )

amber flicker
#

you mean adding a component with a specific value? Add + Set at the same time?

zinc plinth
#

yea

#

I think my only option is to either to one call per entity, or make that component a nativearray of component containing the same value for all of them

#

which is pretty stupid if you ask me

amber flicker
#

well I agree a convenience method like that would be cool. I guess how it would work under the hood is to bulk add component then have a job iterate over it and set it though - which is something you could do? So long as you don't change the archetype one by one

#

It doesn't sound quite like your use-case but just fyi the entityManager instantiate method can instantiate hierarchies of entities and modify parent/child relationships as expected.

zinc plinth
#

yea but the transform system group fucks me over by ripping off my parent component cuz I do n't set it in the frame they're spawned in

#

(it's complicated)

#

huh, wonder how I could make this faster than per-entity(second method) ```
private static void SetupGridTileDatas(NativeArray<Entity> gridTiles, NativeArray<GridTileData> gridTileDatas, EntityManager em)
{

    }

    private static void SetupGridTileData(Entity entity, EntityCommandBuffer ecb, GridTileData gridTileData)
    {
        if (gridTileData.Usable)
        {
            ecb.AddComponent<GridTileUsableTag>(entity);
        }
    }```
#

wonder if it will run better if I filter in a bursted method to get the entity array indexes for each type I want to add

mint iron
#

i dont have the a reference handy but is there a method to set archetype / add component with a native array of entities?

zinc plinth
#

queries will be way faster on big scales tho I think

mint iron
#

then it will probably be batched within the same chunk and faster than ECB/per entity; would mean making two arrays of GridTileData.

zinc plinth
#

you mean one per GridTileData field ?

mint iron
#

i was thinking split NativeArray<GridTileData> gridTileDatas into two, a list of .Usable ones and non-usable.

#

then add the component to the entire array of entities that are usable

zinc plinth
#

well if non usable you just don't do anything no ?

mint iron
#

yeah, true that

zinc plinth
#

Usable might rly not be the only field in this too

#

and prolly not all of them will be tags but have some data inside (ore counts, stuff like that)

mint iron
#

the problem with EntityQuery is that it can only filter on existence of component, so at some point you have to do the per entity branch

zinc plinth
#

ye queries aren't rly an option here

amber flicker
#

this is pretty obvious but you want your job to tag whichever subset is expected to be smaller of the entities you're processing - it's easy/cheap to bulk flip tags later

mint iron
#

you might be able to force them into different chunks manually without changing the archetype and then you could iterate them seperately even though they're the same archetype. The benefit there is you can do even faster batching by changing the archetype on an entire chunk at a time because you know it only contains the right entities, they wouldnt be mixed.

zinc plinth
#

to do anything with the subsets I need to create them first, they don't exist before this method

jobs or just bursted code for filtering on each field of GridTileData ?

#

I guess a IJobParrallelFor would fit nicely here 2Bthink

#

since this is handling >40k entities

#

so would look like this ```
public struct CreateGridTileDataFilteredEntityArraysJob : IJobParallelFor
{
[ReadOnly]public NativeArray<Entity> GridTiles;
[ReadOnly]public NativeArray<GridTileData> GridTileDatas;

        [WriteOnly]public NativeQueue<Entity>.ParallelWriter UsableEntities;
        
        public void Execute(int index)
        {
            Entity gridTile = GridTiles[index];
            GridTileData gridTileData = GridTileDatas[index];

            if (gridTileData.Usable)
            {
                UsableEntities.Enqueue(gridTile);
            }
        }
    }```
#

guess 256 would be a good batch, there's rly not alot going on in here

amber flicker
#

there is actually a filter job specifically for this kind of thing I think... doesn't really matter - doubt it'd be any faster

zinc plinth
#

huh, what's the interface name ?

amber flicker
#

maybe IJobParallelForFilter? just seeing if I could check

zinc plinth
#

yup that's it

#

how is it different tho ThinkMan ; it's the same Execute

amber flicker
#

been a long time since I looked at it... might be that it saved boilerplate in the pre-lambda days but is pointless now?

zinc plinth
#

it has a specific "job producer type", no idea what that does

#
/// <summary>
  ///   <para>All job interface types must be marked with the JobProducerType. This is used to compile the Execute method by the Burst ASM inspector.</para>
  /// </summary>
  [AttributeUsage(AttributeTargets.Interface)]
  public sealed class JobProducerTypeAttribute : Attribute
  {```
#

so does it gets compiled diferently ? thonk

#

maybe some more loop optimization ?

#

will try both and see

amber flicker
#

hmm yea, revisiting this I'm sceptical it's still relevant - looks like you used ScheduleAppend? Is that a thing? 😄

zinc plinth
#

well there's a bunch of shit in that producer type

amber flicker
#

looks like it's main thread only... no idea if it's been updated in the past couple years...

zinc plinth
#

Execute, ExecuteAppend, ExecuteFilter, ScheduleAppend, ScheduleFilter

#

I'l just use parallelFor lol

amber flicker
#

yea, worth checking but it doesn't look relevant anymore

zinc plinth
#

I want multiple outputs anyway, not just one set

#

k all done, now to record baseline for the per-entity way and compare 😁

#

that's a really curious pattern

#

why did one of my message get deleted Wat

#

the stripes are 16 tiles long

#

the physics colliders are in the right place tho ThinkMan

#

aand I crashed my unity by enabling gizmos facepalm

hollow sorrel
#

what's your per-frame physics time

#

with those billion colliders

#

tho i guess wouldn't matter much if nothing is moving or casting

zinc plinth
#

they're still rebuilding each frame, and on 4 worker threads(forced) at 5ghz I'm at around 1ms of physics

#

I want to do my own thing for this since I literally only want raycasting, but didn't get good ressources on how to do that yet

#

and I have alot on my plate already

#

but yea, super confused about this glitch

hollow sorrel
#

are there not supposed to be stripes

zinc plinth
#

no it's supposed to be a rectangle of tiles lmao

hollow sorrel
#

not sure but looks as if you have some jobs touching the same data instead of only their own

zinc plinth
hollow sorrel
#

lol

zinc plinth
#

I don't have jobs touching the translations

#

hooooo

#

maybe it's from the query thonk

#

cuz it's not ordered the same way as my arrays

mint iron
#

could it be crossing multiple frames? the non-system jobs are not forcibly finished each frame

zinc plinth
#

nah I complete all my jobs

#

I think it's cuz I'm using the query to set index specific data from my arrays

#

and it's not working well cuz not the same ordering

#

thank god AddComponentData isn't batched so I don't lose much perf I think AddComponentData<T>(EntityQuery entityQuery, NativeArray<T> componentArray) https://i.imgur.com/J11svOA.png

#

so I can swap to the NativeArray variant (pls tell me it exists ;-;)

#

IT DOES'NT WTF

#

urggggg

#

more loops I come then --'

#

ayyy fixed

#

97 -> 146 >.>

#

but hey still better than 1s

#

I can't find my filter job in profiler Wat

#

the tag is applied tho 2Bthink

#

2ms for 256 batch size seems awfully high tho

#

there's no burst error but this seems so weirdd

#

wait, there would be way more than 5 instances if it was 256 entity per call

#

so it's doing multiple batches per thread in the same call ok

#

time to go after the 300MB of memory I'm leaking each start now lol

hollow sorrel
#

1ms not bad for 80k

zinc plinth
#

they're planes soo

#

but that's still an awfully unnecessary 1ms

#

cuz I just want raycasting :/

hollow sorrel
#

ye true

zinc plinth
#

once I'm done with leaking I'll prolly go for this since I'm done with my mesh source saving now acegikSparkles

#

the replacing RenderMesh method works wonders

#

ho I already tracked them all lol

#

neat

#

without safety checks or memory leak detection I'm at 4.5ms, 3 of which are from hdrp...

#

(if you couldn't tell by now I don't like hdrp much)

#

except it has vfx graphs which I rly want ;-;

#

ok so, need to check how raycasting works in Unity.Physics

#

that's uhhhh, complicated

safe lintel
#

ugh doing some non dots coding my code is turning into such spaghetti! mb updating static class which refers to non static class and classes within classes to not make some monolithic mess, i hate it already

zinc plinth
safe lintel
#

wait is it just me or does recompile during play now recreate the default world? when did this change happen 🥳

zinc plinth
#

I always stop playmode when I recompile

#

also, feels bad jacksondunstan doesn't have a NativeTree in his collections

safe lintel
#

i was using stop for a long time because the anything entities related would error like crazy but it seems with the latest packages its actually recreating the default world now?

#

dots hotreload is kinda a dream scenario for my own uses

hollow sorrel
#

recreating as in like restarting?

#

that doesn't sound that useful, same as stopping and playing

finite breach
#

Is there a way to get entities based on the ComponentType?

safe lintel
#

use an entityquery @finite breach ?

#

@hollow sorrel one less button to press goes a long way when you chalk them up over time. its why i hate unity's habit of nesting every damn menu item under more menus, just make the editor ui customizable like maya or something ffs

hollow sorrel
#

that's true

#

what i'd like to see tho is serializing the current world before compilation and restoring the gamestate after

safe lintel
#

oh for sure reloading proper state would be best. i know they plan on it given theyve said they want to support hotreloading like current unity, just no idea when its gonna come. but this is a welcome first step towards that

viral sonnet
#

hey all! I'm currently getting "InvalidOperationException: Attempted to access BufferTypeHandle<SpellCombatEffect> which has been invalidated by a structural change." because i update the buffer in for loop with new values. any workaround?

#

i've updated buffer data before so it's weird. it seems i can only add/remove

worldly pulsar
#

Seems like you do {Add|Remove}ComponentData between getting the buffer and writing to it

viral sonnet
#

i did indeed. thanks! 🙂

finite breach
#

@safe lintel Thanks! My brain melted after 8 hours of google "researching" DOTS again to the point where you miss the obvious 😐

safe lintel
#

if you havent read it already, the entities docs are a good reference point 🙂

late yew
#

Hi all, sorry if this seems obvious, but im trying to add Entities to my project, and with it being removed from Package Manager, im not sure how to go about that ... Do i set up a github package link?

zinc plinth
#

@viral sonnet if you're doing structural changes while you look your buffer use ToArray and not AsArray

#

Don't forget to dispose it afterwards tho

#

Also, marijnz's native octree seems exactly what I need for my custom rayczsting, except it doesn't have an api for rayczsting as is and it's in the TODO for 5 months now ;-;

#

So I have to find a compatible raycasting query for octree and implement it in c#..

#

But after that I just need to throw the AABBs of my grid tiles with their entity as element and boom it's done

tight blade
#

Im on a weird mission, but maybe one of you has an idea. I basically want to make an entity that replicates the movements of another entity but on a delay

#

so I guess the naive way would be to fill up a buffer of positions and have the other entity consume those positions?

#

also hello, long time no see

amber flicker
#

@tight blade yea, buffer would do it. Just be careful to only push as much as you pop I guess. Or you could e.g. set the target pos every 10 frames, lerp between and set position to last point when you overwrite it. Depends why you're doing it, how accurate you need to be, what your perf requirements are etc.

solar ridge
#

Anyone here have any experience with the CopyTransformToGameobject tag?

finite breach
#

@safe lintel Oh I have! It's is not my first run at DOTS but you know how well hidden the "not so standard things" are. 🥺

tight blade
#

@amber flicker hmm, yeah actually thank you for the lerp idea. I totally forgot about that option. I think that will be necessary to use in some degree

stone osprey
#

How do we actually chain several ecs mechanics together ? Lets say we have implemented the following systems, each firing events once they done : Collision, Task, Drops... And we want to achieve the following, once a player collides with a tree ( e.g. ), a task gets started that takes 10 seconds and once its finished we wait till the drops are generated in order to insert them into the players inventory... how do we achieve this inside a ecs ? Any good tipps ?

#

Each of those system fire events to inform other systems... like "CollisionEnter", "TaskFinished" or "DropsGenerated"

mint iron
#

You'd need some sort of pending/conditional task entity and a system to manage them, once the conditions are met/time elapsed it could perform the delayed action. I did a super simple version of this for staggered delayed destruction so items looked like they were exploding in a pattern.

stone osprey
#

@mint iron Thanks ! Could you describe this a bit further ? ^^ How would it look like ?

safe lintel
#

i create entities for each event, so like lets say you raycast and hit a tree, create entity with a component that has a timer(could also stuff an entity prefab id to it), after that timer is finished do a lookup to the player inventory and add whatever item(ie the entity prefab that was stored in the timer event entity)

mint iron
#

yeah pretty much that; i originally tried to make it too generic and as i added conditions that only applied in certain circumstances the struct got too heavy, so if i tackled it again in the future i think id make multiple structs for each specific purpose where possible and a system or ForEach within a system manage each one separately to keep things clean. You can abstract pretty much anything in that way, e.g. queue stuff up to be spawned rather than doing it at the origin and have a system dedicated to performing that action.

amber flicker
#

So... the only two things that have been mentioned at all re dots timelines... (.enabled states coming 3weeks - 3months - as of mid-May) and new animation samples 'sometime next month' i.e. August).... I just want to check I'm being impatient. Or should I start to be concerned that there's been zero communication about either those things or that epic ~100 thread post?

safe lintel
#

i was gonna say that i wish that thread prompted official responses

stone osprey
#

Thanks ! Im also using event entities... and thats what makes things pretty difficult... in my case i want to keep things flexible ^^ So you would simply attach more components to those events/entities in order to execute custom logic ? For example : OnCollisionEventEntity -> Attach "SpawnProgress" -> System iterating over OnCollisionEventEntity + Spawnprogress in order to spawn those progresses ?

safe lintel
#

also that i wish it was still going, imo it kinda got hijacked a little bit from unity could communicate better and heres why to here are the problems with unity dots and i want these changes 😆 (kinda guilty of participating in steering it offtopic but thought it might spur some official response)

amber flicker
#

I can totally understand staff steering completely clear of that post.. but I hoped we might get a 'blog post coming at the end of the month thread' or something

#

the silence is pretty deafening rn

stone osprey
#

Or what do you guys mean by queueing them up ? ^^

safe lintel
#

@stone osprey tertle on the forums made some event system that a lot of people seemed to like, could be generic? but for my own uses its too complex 🤪

stone osprey
#

Nah i mean queing them as actions ^^ Like -> OnCollision -> Spawn progress -> On finished -> .... e.g.

safe lintel
#

well the queue would be determined by the systems processing them and their lifetime, like
OnCollisionSystem [makes event entity with CollisionOccuredEvent]
SpawnCollisionEventSystem [processes entities with CollisionOccuredEvent, if a timer hasnt reached a certain point, just wait, if it has spawn item? or spawn more event entities that get processed by more systems down the line]

#

@amber flicker i dunno, kinda thought it could warrant a reply. at least the majority of people in the dots subforums are mature and a frank discussion could be had.
a blog post that doesnt actually give people something substantive just invites all the riff raff 😉
kinda painted themselves into a corner with how they have approached this, big marketing stuff mixed with later on hiding packages, but the all the marketing pages are still up guiding users to a void... 😅

amber flicker
#

I have several theories atm. 1) Everybody's been told they can't publicly say anything about direction or timescales - specifically just the DOTS team though, 2) Everyone's on holiday.. told to spend time with families or such, 3) There are lots of passionate discussions ongoing still about whether to abandon DOTS, make everything DOTS or make two editors and they still haven't decided. Or all 3.

opaque ledge
#

abandon DOTS ? madness

safe lintel
#

abandon DOTS 😕 have you actually seen any unity people allude to this??

amber flicker
#

nope - and I obviously hope not

#

seems quite a few games industry folk expect them to roll it back - I don't but who knows what's going on internally

deft stump
#

I dont think they'll abandon it.
it'll be in the backburner for sure though. Like really really far back into the back burner

safe lintel
#

my take: i think its just poor communication tbh, everyone is continuing to work away. for us using it though its like waiting for paint to be mixed before you can even watch it dry.

amber flicker
#

Even when there's an outcry of "you're not communicating... please communicate"? ¯_(ツ)_/¯

deft stump
#

their communication to the community sucks.
too formal, too stiff, too enterprisey when their users are pointing out facts at them.

safe lintel
#

they need someone like laurent is doing for the visual scripting team, to kinda liason info with the community(that poor guy is like the punching bag for unity's own missteps)

opaque ledge
#

maybe they are making very juicy updates 🥺

amber flicker
#

yea a lot of the teams have so much better communication (UI Toolkit too for example) - it makes the difference more stark

safe lintel
#

yeah totally

#

really comes down to the individual teams i guess

mint iron
#

my take is, they got burned pretty hard in a few threads like the visual dots topic, and some of the staff seemed to be getting quite agitated and perhaps not responding in a manner that would help their case. They might be revising their communication strategy...

opaque ledge
#

yeah that guy is too... excited about voicing his opinion

amber flicker
#

I think there's very likely a very human component to this. That said, at some point "our engine team" really has to report in. Even officially.

safe lintel
#

oh that one guy i wish would post succinctly

fluid kiln
#

Any net code crackheads here that manage to make the getting started cube move? My server seems to not be receiving the input command data? Anyone has encountered that problem? More info and code here: https://forum.unity.com/threads/netcode-getting-started-server-does-not-enter-foreach-of-the-ghost-movement-system.962253/#post-6267171

fair flame
#

It sounds like you need to create a CommandSendSystem and a CommandReceiveSystem

public class SendInputCommandDataSystem : CommandSendSystem<InputCommandData>{}
public class ReceiveInputCommandDataSystem : CommandReceiveSystem<InputCommandData>{}
fluid kiln
#

I do have those, I didn't put it in the forum because it's boilerplate code but it is there in my list of systems 🙂

#

Is there anyway to verify on the client side what is sent to the server by this system?

#

Thank you tho!

fair flame
#

Hmm okay, I haven't had a problem with it so I haven't had to debug what's being sent, not sure where you'd hook that in

#

Are you setting the CommandTargetComponent server side?

fluid kiln
#
public class GoInGameServerSystem : SystemBase
{
    protected override void OnUpdate()
    {
        Entities.WithNone<SendRpcCommandRequestComponent>().ForEach((Entity reqEnt, ref GoInGameRequest req, ref ReceiveRpcCommandRequestComponent reqSrc) =>
        {
            EntityManager.AddComponent<NetworkStreamInGame>(reqSrc.SourceConnection);
            UnityEngine.Debug.Log($"Server setting connection {EntityManager.GetComponentData<NetworkIdComponent>(reqSrc.SourceConnection).Value} to in game");

            var ghostCollection = GetSingleton<GhostPrefabCollectionComponent>();
            var serverPrefabs = EntityManager.GetBuffer<GhostPrefabBuffer>(ghostCollection.serverPrefabs);
            var prefab = Entity.Null;
            for (int i = 0; i < serverPrefabs.Length; i++)
            {
                var ent = serverPrefabs[i].Value;
                if (EntityManager.HasComponent<PlayerComponent>(ent)) prefab = ent;
            }

            var player = EntityManager.Instantiate(prefab);

            EntityManager.SetComponentData(player, new GhostOwnerComponent { NetworkId = EntityManager.GetComponentData<NetworkIdComponent>(reqSrc.SourceConnection).Value });

            EntityManager.AddBuffer<InputCommandData>(player);

            EntityManager.SetComponentData(reqSrc.SourceConnection, new CommandTargetComponent { targetEntity = prefab });

            EntityManager.DestroyEntity(reqEnt);
        }).WithoutBurst().Run();
    }
}```
#

OMG !!!

#

I'M SETTING THE COMMANDTARGETCOMPONENT ON THE PREFAB

fair flame
#

Haha, yep that'll be it I'm guessing

#
new CommandTargetComponent { targetEntity = player }
fluid kiln
#

@fair flame Thank you so much after 12 hours of headbashing my capsule is now moving on the server haha

#

While I'm here, is there anyway with the Physics body to restrain movement in certains axis like on the RigidBody?

zinc plinth
#

I think someone here managed that but had to blow a few fuses to get it working lol

fair flame
#

I think you can freeze rotations by setting the relevant inertia tensor axis to float.MaxValue. For translations you might be able to use joints but there's no easy setting like with PhysX rigidbodies

tiny ore
#

The project comes with sources, right? It should not be complicated to add that to the solver.

#

I know that because we implement these restrictions in our physics engine, and it's not complicated (only a few places will move the entities: velocity integration, position correction, constraints solvers normally)

zinc plinth
#

aha aha aha aha

#

godspeed to you for that PES_Salute

tiny ore
#

We'll, if you know a bit or two about physics engines...;)

tight blade
#

@stone osprey interestingly what you're talking about is precisely the kind of use case the VS tool is designed to address

stone osprey
#

@tight blade VS tool ? ^^

tight blade
#

they seem like kind of a mess though. Early on they had a concept that the DOTS users were really happy about. then they gave the tool to some big game companies who knew nothing about DOTS and they hated it, so they redesigned the whole thing to be more monobehavior like. Then, it seems, Unity decided they lost their patience with the dots vs and decided to in house Bolt

#

now it seems like bolt will be the primary visual scripting tool and the VS stuff will become a sad extension of bolt that delivers some satellite performance benefits to mostly monobehavior style authoring

zinc plinth
#

I just saw this, and there's almost no mention of ecs/dots at all in the 2021 roadmap lmao https://blogs.unity3d.com/2020/08/13/the-road-to-2021/

Unity Technologies Blog

We are excited to share our plans for 2021. We’ve listened to your feedback and established our plan based on what we’ve heard. Our 2021 product commitment is simple. It’s about giving you production-ready features, workflows, and components based on what you have told us you ...

#

how does it feel to work on dead tech 😀

hollow sorrel
#

bolt probably has worse performance than the vs stuff, bolt 1 performance is abysmal

dire crown
#

visual scripting is stupid

hollow sorrel
#

bolt 2 would've had amazing performance because it codegens all your visual graphs to actual C# code

#

but they canceled it 🙂

dire crown
#

focus on the engine, stop these stupid acquisitions

tight blade
#

lol @zinc plinth so brutal

#

ugh. will the IPO end this whole experiment?

mint iron
#

First, this means expanding the focus beyond the Data-Oriented Technology Stack (DOTS) netcode space to solve for current-Unity GameObjects

dire crown
#

yeah i lol'd when i read the netcode part

#

they haven't been able to make a stable netcode in the entire existence of the engine

zinc plinth
#

meanwhile you're walking in a wasteland while doing dots netcode lmao

dire crown
#

now they are tackling 2 versions at the same time

tight blade
#

seems like for a public company they almost have a fiduciary responsibility to axe dots

mint iron
#

i wouldn't go that far, investing in the future it legit or you'll be left behind

zinc plinth
#

meanwhile I still can't use latest entities/hybrid renderer because I use addressables :)))

hollow sorrel
#

yea i was gonna say, if they have more money due to IPO that's more reason to spend on DOTS since it's basically R&D

tight blade
#

right, because IPO's are known for stirring companies to forgo short term growth in order to secure long term viability.

mint iron
#

in pretty much all sales the key people stick around for a year or two then leave a dirty husk. Usually burning everything in order to meet their bonus targets. Not that i'm cynical 😄

hollow sorrel
#

@zinc plinth why not

zinc plinth
#

because it crashes on compile lol

hollow sorrel
#

rip

zinc plinth
#

good compatibility™️

#

and prevew addressables versions don't even work half the time

#

another dead package

hollow sorrel
#

it sucks that you can't just load/unload specific assets normally

zinc plinth
#

just use Ressources Kappa

#

don't you love having to throw everything into a name sensitive folder to be able to get your stuff ?

hollow sorrel
#

lol

gusty comet
#

Hello, trying to get material properties working in dots. I have a shader graph with properties set up like so as well as a material property component & system (https://paste.ee/p/XQCCK). 'UpdateMaterialPropertiesTag' is being added to the entity properly but 'UpdateMaterialPropertiesSystem' isn't listed in the Entity Debugger's list of systems & so it's not updating the material property. Using hybrid renderer v1

zinc plinth
#

Why v1?

#

@gusty comet

gusty comet
#

my understanding is that v2 isn't compatible with Unity 2019

zinc plinth
#

I don't think that's true 6_ThonkHmmm

Latest entities versions do require 2020 tho

gusty comet
#

I'll see if I can install v2

zinc plinth
#

You don't "install" it tho, they're both in the same package. Unless you're on a very early hybrid renderer package

gusty comet
#

V2's minimum version of Unity is 2020.1 according to the docs. if I can't find a solution I suppose I'll try to recreate the project in 2020

zinc plinth
#

You can just upgrade it from the hub

#

Latest is 2020.1.4

gusty comet
#

well that's true 🙂

mint iron
#

and material properties don't work in v1

zinc plinth
#

Reasons to upgrade then 👏

fluid kiln
#

Is NetCode unoptimized, did I code it wrong, or is my PC shitty? (NetCode 0.3 - 1 player controlled capsule with physics body/shape)

gusty comet
#

thanks for the help. seems I'm upgrading lol

zinc plinth
#

Not seeing what actually makes your graph go like that won't make us be able to help you @fluid kiln

fluid kiln
#

How can I tell? 😮

zinc plinth
#

Scroll down?..

#

And select a frame in your spike

fluid kiln
#

Yeah but which section

zinc plinth
#

Just expand main thread and jobs and show us

fluid kiln
#

haaa got it, sorry not used to the profiler yet

zinc plinth
#

Said expand main thread please

fluid kiln
hollow sorrel
#

could also check timeline view

#

so you don't have to scroll zoom 1000x

#

i mean hierarchy*

zinc plinth
#

How much entities do you have in your world, and do you have burst turned on without expensive memory leak check

fluid kiln
#

Ha I like hierarchy better, ty.

On my server there's 10 entities, 18 on client. Where is that checkbox?

zinc plinth
#

Jobs > Burst > Enable compilation

fluid kiln
#

Ha I had enabled fullstack to debug something

#

I'll see if that helps

zinc plinth
#

Yes it will, it's written it's expensive.....

fluid kiln
#

makes sense 😉 thank you sorry for not knowing my shit haha

zinc plinth
#

And do you have burst turned on

fluid kiln
#

yes I do

zinc plinth
#

Good

fluid kiln
#

Well the first two checks in the Burst menu

zinc plinth
#

What are your frame times now

fluid kiln
#

33ms, much better thank you 🙂

hollow sorrel
#

yikes

fluid kiln
#

Still high?

zinc plinth
#

I never used dots net code, but that sounds a full

#

Is it thzt un optimized? @hollow sorrel

hollow sorrel
#

no

#

either doing something weird or you have double vsync on

zinc plinth
#

Redhow the profiler please @fluid kiln

fluid kiln
#

Even on server/client? Well actually now that I closed some windows I'm more around 20ms

zinc plinth
#

Re show

hollow sorrel
#

what's taking up most of the time in hierarchy?

fluid kiln
#

Script by far

hollow sorrel
#

yea ok but if you expand the hierarchy tree

fluid kiln
hollow sorrel
#

that's timeline

#

doesn't look like double vsync at least so can cross that one out

zinc plinth
#

11ms for server

fluid kiln
hollow sorrel
#

huh

zinc plinth
#

how du you get a 11ms server with 10 entities

fluid kiln
#

Good question 😂

hollow sorrel
#

doesn't it normally show the system names under there too

#

what entities version are you on?

fluid kiln
#

Hey I just followed the getting started guide haha

#

As for the version let me check

#

0.14

hollow sorrel
#

ok that's recent

#

weird

zinc plinth
#

Does netcode have an example project?

fluid kiln
#

There's the FPS sample and the Getting Started code

#

It's my TickServerSimulationSystem and TickClientServerSimulationSystem that add up to 13 ms

hollow sorrel
#

are you on a laptop by any chance

fluid kiln
#

No no I have a pretty "good" rig

hollow sorrel
#

that's weird then

#

i heard it's not very optimized yet but 11ms for server that doesn't do much yet seems really bad

fluid kiln
#

well now I'm worried lol

hollow sorrel
#

could you check window > analysis > entity debugger

#

should show per-system timings

fluid kiln
#

sure thing

hollow sorrel
#

might have to use dropdown to pick server world

zinc plinth
#

Well you already know the server system time

#

It's 11ms

fluid kiln
hollow sorrel
#

yea but serversimulationgroup should have different systems

fluid kiln
#

It's the physics system

north bay
#

Do you have JobsDebugger enabled?

fluid kiln
#

Yes

north bay
#

Try disabling that

#

But that still sounds very wrong

fluid kiln
#

Oh wow

north bay
#

Do you have mesh colliders with 60k vertices inside each other?

fluid kiln
#

Now my StepHysicsWorld is 0.7 ms

#

WIthout JobsDebugger

hollow sorrel
#

whaaat

fluid kiln
north bay
#

Burst is enabled?

fluid kiln
#

Jobs -> Burst -> Enable Compilation?

north bay
#

Ye

fluid kiln
#

Yes

#

I didn't use [WithBurst] anywhere tho

zinc plinth
#

Show the server system group timing

fluid kiln
north bay
#

My GhostSendSystem takes 0.16 ms with one client and 47 synced entities

fluid kiln
#

Mine averages 0.5

zinc plinth
#

Also, wouldn't the server system group run in it's own executable without any rendering?

#

Idk how the server gets it's standalone in netcode

fluid kiln
#

I'll run server only

zinc plinth
#

But yea, if you have bad performance, stop all the debugging first KannaFacePalm

fluid kiln
#

No rendering when I run just the server

#

Good to know ^^

#

Also C# debugging in on rn

zinc plinth
#

...............

fluid kiln
#

hahahah

zinc plinth
#

Are you kidding me

fluid kiln
#

I kinda forgot it existed because I like to debug my code in VS, I rarely touch it

zinc plinth
#

The f are you thinking by complaining about performance with literally every piece of debugging tool enabled in your editor..

fluid kiln
#

I honstely didn't know it had such an impact

#

Ha yeah I'm down to 5ms frames now

zinc plinth
#

Well now you know

fluid kiln
#

Thank you guys

#

Time to uninstall

north bay
#

5ms with a basically empty world?

fluid kiln
#

5ms spikes, more like 2.5

zinc plinth
#

He has hdrp, so -2ms already @north bay

fluid kiln
#

idk what's good or what's not lmao

#

urp actually

zinc plinth
#

You're getting 1.3ms of cou on urp?

#

Cpu *

#

Turn gpu instancing on if you didn't already on your materials

#

It's in the advanced settings

safe lintel
#

what cpu?

zinc plinth
#

Would guess à 16 thread by the amount of job workers

fluid kiln
#

Yup

hollow sorrel
#

trying to check the effect of jobsdebugger on my project but it's throwing all sorts of errors 😆
passing temp allocator instead of tempjob to jobs and making structural changes while looping entities
weird that it's fine to do that even in build unless you turn jobsdebugger on (would think leak detection or burst safety checks is the one that catches those but nope)

zinc plinth
#

Ehehe

fluid kiln
#

AMD Ryzen 7 1700 8 cores 3.10ghz

#

What advanced settings are you talking about @zinc plinth ?

zinc plinth
#

Of your materials

#

If you used urp shaders that is

north bay
#

@hollow sorrel I feel you, from time to time i turn it on and fix them lol. DOTS Physics has been a hassle with that

hollow sorrel
#

yeah now i'm like wait i've been doing things wrong all this time??

zinc plinth
#

I'm praying Native Octree get'e raycasting queries so I can skip on a whole ms of unity physics lol

hollow sorrel
#

wasn't your plan to combine the colliders or something

#

into one big un

zinc plinth
#

Bah can't do that in the end, too much of a pain

hollow sorrel
#

i feel u

zinc plinth
#

And prolly mostly impossible anyway

#

I just want a good Native Octree OchakoPray

#

Cuz I don't have the knowledge at all to do that pr lol

north bay
#

I was about to say check the Dots Physics implementation out, but my brain starts melting when reading through the code

zinc plinth
#

I switched to urp and now getting 2.5ms instead of close to 5, without fucking physics I'll get 1.5 ms with 80% being transform system group on like 120k child entities

#

Yea same @north bay

tawdry lotus
#

anyone using unity transport on mobile devices? I am having problems with android devices, can't bind socket, not sure where to ask, asked in forum but nothing

zinc plinth
#

Hemm is unity transport part of the dots stack? Never heard of that package ^^'

north bay
#

Kinda, that's a transport layer they made after the FPS Sample

zinc plinth
#

Ha

tawdry lotus
#

netcode works over transport

#

netcode is dots I believe

hollow sorrel
#

it's basically the LLAPI of netcode

tawdry lotus
#

but I suppose here is the only place to ask

hollow sorrel
#

where netcode is HLAPI

#

in unet terms

#

yea it's right place (don't have the answer tho)

zinc plinth
#

I think there was some burst compilation errors on Android, maybe thzt's part of the problem?

tawdry lotus
#

ok, thanks

#

I have runtime issues, build starts withour problems but fails with socket error

north bay
#

Did you check logcat out or whatever the android logging is called?

tawdry lotus
#

I ahve android internet permissions

zinc plinth
#

@tardy spoke maybe you have some experience with transport?

tawdry lotus
#

I feel like I am the only one using unity transport, probably nobody is so crazy as I am

north bay
#

Haven't tried it on mobile yet

dire crown
#

it never worked for me, i ended up replacing it

fluid kiln
#

Netcode sure, transport by itself tho :(

tawdry lotus
#

@dire crown what are you using now?

dire crown
#

ended up switching to steam networking since that was the platform we were on

tawdry lotus
#

ok, thanks, yeah, not my case

north bay
#

The new Steam Socket thing?

dire crown
#

this was a few years ago, i don't think its new. they have added more support to it right?

#

but yes steam sockets

north bay
#

Oh wow it's already out for 3 years?

#

lol

dire crown
#

it was the older api

fluid kiln
#

Does DOTS Physics Body use the gravity in Project Settings or is it set elsewhere? My body is falling verryyy slowly

dire crown
#

pretty sure its part of a script you add to the scene

fluid kiln
#

"PhysicsStep" thank you!

fluid kiln
#

Is there any way to use terrain in DOTS yet? I can't seem to make it work with entities

dire crown
#

not out of the box

#

you will have to create your own collider

stone osprey
#

Its me again... this time a question about converting logic from oop into ecs... Where do we move the logic of methods to during the convertion ? A little example :

#

Lets say we had a class in the past which represents a inventory... it has add/remove/get methods, but those methods dont only put the stuff into the list... they also check if the item can get merged ( Minecraft like stack mechanic )... where do we move this logic inside a ecs ?

zinc plinth
#

The stuff creating the entity is in Convert

The continuous logic is in systems

stone osprey
#

The problem here... the "add" method from the inventory is not continuous

#

So should we define a "AddToInventory" component and its own entity as some sort of command for adding stuff to the inventory ? Or how do we convert this `?

zinc plinth
#

Create a Public method in your inventory system, and fetch your system from other system when you need it

That or create a buffer of items to add to inventory (more sane approach, would still be nice to have the method doing this in the inventory system still)

deft stump
#

I would do something like this:
make a lookup entity.
make a DynamicBuffer component attach it to the lookup entity.
make a system and wrap your add method in a bool within OnUpdate.
and have another system flag that bool whenever it wants

stone osprey
#

Thanks a lot, both of you ! What about this approach ? We define a entity that is used as some sort of command to add stuff into the inventory ? ^^ For example : Entity{..., AddToInventory } -> AddToInventorySystem processes them and adds the content to the inventory ?

stone osprey
#

Oh i see, i killed the whole chat

fluid kiln
#

I would probably use an entity like you said, it gives you more control. Let's say you can have an add to inventory entity. WIth a addtoinventory component that has a target, an item, etc...

#

Then you have a system that looks for AddToInventory components, and produces the command, then deleting the entity

#

@stone osprey

#

Unless there's a downside to this method that I can't see

stone osprey
#

@fluid kiln Thanks for your feedback ! Im still struggling here... couldnt really decide what way to choose. But your answer gave me confirmation. I love flexibility and this is clearly a variant which is not hardcoded at all 🙂 Probably its also better for multithreading, due to the asynchronous processing of those command entities. The only downside here is the boilerplate code ^^ instead of "inventorySystem.add()" you always need to create a entity and attach the right component, but well... theres always a downside

fluid kiln
#

Yeah, and that also means for every "command" your game has, you'll have to create a component and a system. I'm fairly confident ECS will get more and more user friendly with updates, meaning less boilerplate code in the systems. But considering we're in ECS, it makes sense to me to create an entity for that. That's where it's really different from OOP, you wouldn't create a class just for one operation.

#

Don't take my word for it tho, I'm fairly new to this

mint iron
#

i think it makes sense, and what i like about it, is that its helpful for debugging because you can pause the game and go check the entity inspector and see the current state, see that x y z commands were produced properly, and step through to see if they're handled properly. It also decouples your producers from consumers/handlers.

stone osprey
#

I totally agree with that, thanks @fluid kiln @mint iron 🙂 Im also pretty new to the ecs, theres also not that many articles about ecs architectures/patterns... that makes it even harder to come along a decent solution

tardy spoke
#

@tardy spoke maybe you have some experience with transport?
@zinc plinth unfortunately I do not. 😦

gusty comet
#

Alright I upgraded and I'm running 2020 with the latest packages but still having issues with material properties. Each property is set up like so in shader graph. The script has a simple class that I created following the hybrid renderer v2 docs. The system doesn't show up in the Entity Debugger at all https://paste.ee/p/5uoXd

opaque ledge
#

you have to create your own struct and add it to the entity that has the material

#

Unity wont create an unique struct for your material property

gusty comet
#

I really appreciate the help

mint iron
#

we are the only discord channel here that actually answers questions 😄

fluid kiln
#

and we're proud about it 😄

#

I'm having such a blast with ECS and NetCode, it's awesome

mint iron
#

nice! i havent tried it yet, its working well for you?

fluid kiln
#

Yeah it's surprisingly intuitive once you get your assimilated OOP concepts out of your head, for the netcode it's another beast, I spent 24 hours trying to make a capsule move

#

But now I've unblocked and having quite an easy time with it

#

I'm gonna make a tutorial to cover the shitty Getting Started doc

mint iron
#

nice! there's some folks around making a wiki on github of stuff, could be a good addition

fluid kiln
#

i'll check it out!

fluid kiln
#

So as of 2020, what is the best solution to manages strings in ECS?

#

I can't use monos because they need to be sent over via NetCode

coarse turtle
#

send it as a byte array and reconstruct it as a string?

fluid kiln
#

I see FixedStringXX in Unity.Collections, might be an easier to use than converting to bytes

coarse turtle
#

FixedStrings work too

fluid kiln
#

Are they slow?

coarse turtle
#

well internally they just store bytes

fluid kiln
#

so it basically does the conversion for you? that's good

coarse turtle
#

yeah

tight blade
#

@fluid kiln mind if I add your knowledge nugget to the library of wisdom?

#

oh you havent made it yet!

fluid kiln
#

It's you who manages the library of wisdom? I'll let you know once I do :p

tight blade
#

i am but one of its humble servants

mint iron
tight blade
violet cosmos
#

FYI, I'm stepping away from DOTS for a bit

hollow sorrel
#

another one bites the DOTS

#

i mean dust

violet cosmos
#

I might try it again, for pure Jobs in a few months, when I get into optimizing the proc gen systems, but that's mostly to not tie up the main thread...

tight blade
#

thank you for your contributions! We'll be here when you get back!

violet cosmos
#

Yeah, it's a bunch of half baked things not thought out for how developers need... But to make some shiney demos. Count me out

I'm building a thing, not a demo

tight blade
#

or, if you dont need to come back, then best of luck in your endeavors and thanks for dealing with the struggle with us!

violet cosmos
#

Glad I could contribute in some way, but I do kind of want those three weeks of my life back 🤣

hollow sorrel
#

instead of comparing those 3 weeks with not using dots, compare with continuing to use dots and suddenly you have 3 years of extra life 🙂

tight blade
#

hahaha yeah true dat

fluid kiln
#

Good luck out there @violet cosmos

violet cosmos
#

instead of comparing those 3 weeks with not using dots, compare with continuing to use dots and suddenly you have 3 years of extra life 🙂
@hollow sorrel I couldn't imagine how that would work 🙃

fluid kiln
#

The way I see it, you won't start from scratch once DOTS is more mature

tight blade
#

Yeah. Honestly as a single gamedev with a full time engineering job, my game wont be ready to ship next year (although that is my resolution), I'm okay with playing the long game.

#

Oh, dont get me wrong though, @violet cosmos, thats not a contradiction to what you're saying or your conclusion, or your general strategy

violet cosmos
#

Not me. It doesn't work for me, and any affordance they make for what I need would be a significant change

Also, I view it as a technical debt. It will have to change, the API is very likely to go through other huge revisions, especially if you're using hybrid

You're not ahead if you've filled your garage with piles of shit you need to shovel out

tight blade
#

You're absolutely not wrong.

#

I used to follow the Arcadia dream. a lisp based repl driven code interface to unity.

#

they're incredible devs, and theyve been working their asses off, but its always going to be 2 steps behind

#

because Unity can't finish a damn package to save their lives 😂

violet cosmos
#

It's fine if you want to nibble at that technical debt release by release, I get it. For certain things, ECS and Hybrid could work

Jobs will work in the niche use cases too

But I'm not going to build anything around ECS until Unity cleans house on the API

#

Also, I don't trust Unity

tight blade
#

And again, you've been generously offering your contributions to knowledge while you've been waylaid here

#

so, like, you've put in your time, you gave it a fair shot

#

I think you've a right to say "fuck this"

violet cosmos
#

Look at URP. It's core selling points are: Shader Graph and mobile performance

It's now on version 8.2.0 and guess forgot to add a core mobile material type to Shader Graph? 🤣

safe lintel
#

technically on 10.x is the latest

violet cosmos
#

Still, doesn't have Simple Lit as a base material afaik

#

Two years going, people asked for that

#

The only way to get it is to buy a $30 asset, or make it yourself

#

I only trust Unity in general, not in implementation details hehe

safe lintel
#

well source is there, drop the shackles of shadergraph

#

phil-lira has some excellent shader examples on his github

violet cosmos
#

Oh, I know how to write shaders. I have a whole custom thing for built in and shaders I'm porting to URP as we speak

But, it sure would be nice to say "Hey, I wonder what this looks like with some X and Y" and bang out a graph

Others are not so fortunate to know hlsl obscura too

safe lintel
#

i get it, current stuff kinda is ass in some places, thats the price of being an early adopter 😉

violet cosmos
#

The point wasn't on my capability, the point was how sometimes Unity often forgets what the day to day developer needs to be productive

#

It eventually gets there

#

Anyways, I'm still heavily invested into Unity and will continue so for awhile to come

I honestly do like URP. Was just commenting today in fact that it's refreshing to actually be able to read through and deconstruct core shaders. Built in was a hot mess

tight blade
violet cosmos
#

I think because you're usually building a command buffer, and if you need to update an enity it gives you the ability to update the same one

#

Lets say, two systems and four queries could update one entity

fair flame
#

entityInQueryIndex refers to the index of the entity being operated on by the Entities.ForEach loop (relative to the set of all entities returned by the loops query). It's necessary in the setComponent call (and the instantiate) to sort a deterministic playback order for the concurrent command buffer

deft stump
#

you guys have an example on raycasting ?

dull copper
#

physics docs do

wary anchor
#

Hi all. Quick sanity check question:
I have a modular objectives system set up and am implementing 2 different game modes. The different modes require different behaviour from existing systems (eg enemy behaviour, camera-follow/movement code etc).

The two main ways I see to do this are:

  1. multiple sets of systems, each gated by different game-mode-specific singleton components
    or
  2. Single set of systems, game mode data stored in the singleton component that's required for the systems and a check within update for which game mode logic to use.

I was leaning towards 2) until I started writing this. Is it better to have multiple systems that don't run because there's no component fulfilling the RequireSingletonForUpdate(), or to have a conditional being checked in each of the systems every time they run? Both feel a little bit of a compromise!

azure nacelle
#

I was wondering if anyone knows of a way to retrieve the material hit with the Unity.Physics raycast. Specifically on entities.

gusty comet
#

What is dots can someone explain the benefits and what it’s for?

opaque ledge
#

performance \o/ but its not ready for production, only go for it if you want to play with it

#

so basically, its new way of coding to get advantage of multithreading and burst (which is Unity's super performance code compiler.. and stuff)

gusty comet
#

So burst it like il2cpp but faster

deft stump
#

DOTS is the umbrella term for a suite of preview/experimental new engine features that is aimed for performance.

So burst it like il2cpp but faster
yes

gusty comet
#

Ooo

amber flicker
#

It's also a lot about working with linearly laid out memory for cpu cache efficiency. The ECS part of DOTS is more about working with structs, avoiding as much traditional MonoBehaviours and managed data as possible - which aren't thread-safe - (ideally just syncing at e.g. start & end of frame) to allow you to easily go wide across threads.

granite spoke
#

I'm back with two small videos of what we are building with DOTS , This is our firework like show system https://www.youtube.com/watch?v=oUo_j4nYr00&feature=youtu.be

and this is quick but about what the game is all about until now on. https://www.youtube.com/watch?v=sRDeffqQPQg&t=3s

We are 7 weeks into pre-production with one semi-junior dev coding and me guiding it as senior technical guy and we have 2 game designers on the project too.

Shoot me questions if any regarding inventory, quest, ... any general systems. character and vehicle movement is not started yet so don't ask regarding those 😄 We're going to start using unity's physics samples

P.S We had a bit of prior experience with DOTS on a canceled project (cancelation wasn't related to dots) and heavily read code and watched unity videos and read their docs

Shows happen in stadiums and you make beautiful moments, visual amazements to behold and complete tasks to earn tablets to sell and get better gear, awesome vehicles and see the world.
You go to other stadiums, create roads and tunnels and rule the world of show business and m...

▶ Play video

In this video we show the core loop of the game and the driving mechanic

▶ Play video
#

I'll make development videos or posts with questions

viral sonnet
#

does anyone know a workaround in using EntityCommandBuffers and the problem that CreateEntity or Instantiate return -1 as entity?

safe lintel
#

afaik that should be a temp index that gets remapped to the proper id after the ecb system runs

#

or do you mean always just -1?

tight blade
#

wtf. remember my question about this line? well apparently the name of that parameter is fixed. if you give it a different name, even if its in the same position with the same type declaration it wont compile 😂

#

"yup, passed my unit test, we're good here. Dev Complete" - that dev

rancid geode
#

it is documented in the docs

fluid kiln
#

Okay y'all, with the new NetCode I want to send a RPC that references a ghost other than the client ("NPC" spawned by the server). How can I reference the ghost in the RPC so that the client can find it? The only value I can find matching the entities on the client and server is the ghostId

tight blade
#

I wonder if anyone on our wiki has an example of spawning entities from entities

coarse turtle
#

Hmm isn't that just an EntityManager.Instantiate(Entity)?

fluid kiln
#

^

tight blade
#

yeah, I guess I'll end up doing it that way. The idea was to do it in a job in parallel

coarse turtle
#

might be what you're looking for if you're doing it on a large scale and bringing it over from the set up world to the default world

tight blade
#

then I have to learn about alternate worlds

#

lol, I guess that will be tomorrow's labor

tight blade
#

is anyone able to spot in this code why there are native containers not being properly disposed?

#

its curious that I get that error 3 times

#

ahh, I bet its that blobassetstore

#

welp. no idea how to fix that.

fluid kiln
#

dark mode is free now btw :p

zinc plinth
#

@tight blade dispose BAS on frame + 1

#

also

#

use a single call to CGOH if possible, it is extremely costly and create a full blown conversion world each time

#

put them under an empty root go, add some tag to each of them to identify then and get their entity back that way through (either child if you wait frame + 1, or filter through the LinkedEntityGroup)

tight blade
#

yeah, this whole spawner is a wash perf wise. I started the night trying to get everything running in a job with an entity command buffer, now I'm just trying to get anything to run without errors

#

good tip though, regarding hierarchy.

zinc plinth
#

also if this is exec multiple time store prefabs of each of these LEG and just reinstantiate the entities

#

if a prefab entity has a LEG the EntityManager will instantiate all the entities in that LEG

tight blade
#

whats that acronym stand for?

zinc plinth
#

LEG = LinkedEntityGroup

tight blade
#

nice. thats awesome, thanks

fluid kiln
#

Thank you for the links! I couldn't seem to come up with a good enough google search myself

opaque ledge
#

@tight blade you have to dispose BlobAssetStore as well

rough crown
#

Guys, I need some help to understand the new Unity mathematics package.

Currently I'm doing a jobfied version of the code shown below (its based upon the third person tutorial of Brackeys)

#

When I tried to do a Job corresponding to this method I've tried

#

However my character is moving at wrong angles now (not sure where the calculation is wrong).

craggy orbit
#

@rough crown the mathematics package uses radians instead of degrees. instead of converting to degrees you can just leave the angle as-is

rough crown
#

@craggy orbit thanks, solved my issue, is there a method to convert the camera euler angle y to radians?

craggy orbit
#

yeah there's a math.radians() that you can use to convert degrees to radians

rough crown
#

Thanks a lot for the help!

pliant pike
#

I dont suppose anyone knows why I'm getting this error Library\PackageCache\com.unity.jobs@0.5.0-preview.14\Unity.Jobs\IJobParallelForBatch.cs(63,30): error CS0117: 'ScheduleMode' does not contain a definition for 'Parallel'

#

what package or version am I missing

mint iron
#

try going into preferences and rebuild the project/solution

opaque ledge
#

Hmm, are you using 20202.1 ?

#

i think thats a change in 2020.2

pliant pike
#

no 2020.2.0a

#

so your saying I should go back to 2020.1

opaque ledge
#

yeah i think so

#

let me check my jobs package version

#

hmm yeah mine is 0.5 as well but i dont get an error like that, using 2020.2.0b

#

are you using Turtle's event system ?

pliant pike
#

I'm loading a package from someone else so maybe its fixed to that version of theirs

opaque ledge
#

yeah

pliant pike
#

👍 thanks, that worked

opaque ledge
#

nice 👍

fluid kiln
#

@fluid kiln https://forum.unity.com/threads/dots-netcode-0-3-0-released.955890/page-2#post-6256991 and https://forum.unity.com/threads/dots-netcode-0-3-0-released.955890/page-2#post-6266304
@viral sonnet I'm not sure if I see the final solution. Are you still using your ghostlookupsystem or is there a more direct approach using GhostField?

fluid kiln
#

The GhostLookUpSystem works really good tho thank you!

viral sonnet
#

@fluid kiln Currently I don't know a better version. RPCs sadly don't use any funtionality of the GhostField. You could add them to the ghost as [GhostField] but then you need a ghostClientId and ghostServerId, so not that great also as it's confusing to have runtime data in sync. I've extended the lookup system with a Entity to ghostId hashmap so both ways of looking up exists. Never needed it before but at one point I needed the ghostId and I only had the entity, no ghostcomponent, so instead of GetComponent I just made another lookup. Should be more performant I think.

fluid kiln
#

So in your TargetComponent (I assume you're making some sort of RPG), do you hold a reference to the entity or the ghost hash? That means that every time I want to access the entity of the target I need to use the system? So if I have 5 systems that uses the TargetComponent, that's 5 lookups per frame per entity.

viral sonnet
#

99% of the time I use the entity itself. Only in sending/receiving RPC calls I lookup the ghostHash

fluid kiln
#

So just so I'm understanding correctly, you set the TargetComponent locally with the target's entity. Then you send an RPC with the ghost's hash, and then on the server they use the lookup to convert it to the entity?

viral sonnet
#

correct

fluid kiln
#

Perfect, thank you!

viral sonnet
#

you're welcome

#

oh, and don't forget to put a [GhostField] on the Entity in your target comp. Otherwise it's not getting synced to all the others

fluid kiln
#

See I did that, but I don't understand how all the other clients can reference that entity?

#

If it's synchronized by the framework, why isn't it done in the RPC component too?

viral sonnet
#

ghostfield does the server<->client entity referencing automatically

fluid kiln
#

But not in the RPCs yet?

viral sonnet
#

yeah, i asked the same question 🙂

fluid kiln
#

Yeah I saw, I just makes sense to me, but I guess it'l lbe added in the future :p

viral sonnet
#

at first I thought I could just change the target entity on the client but then it didn't work and I was ohhh authorative server, right. Client has zero control over ghosts

#

it can only predict and if that fails -> rollback

#

one time i forgot i added a cooldown comp and didn't predict it. constant rollbacks and lags. haha

fluid kiln
#

Yup! Which makes sense. I'm wondering tho, if my "Player" entity has a target component on the server and on the client, when I set the target locally and then send the RPC, will the few frames in between the reception of the RPC set the client's target to null?

viral sonnet
#

no as it's predicted and ghostfields get saved in the prediction history. if you get a rollback the correct target entity will be there

fluid kiln
#

Okay okay, I'm slowly starting to grasp all of this

#

thanks!

#

The netcode is pretty cool to use so far, I'm enjoying itr

viral sonnet
#

np, yeah, without a good grasp it's hard making good designs. i'm still learning too. i think netcode 0.3 is pretty good so far

opaque ledge
#

i want new packages 😦

viral sonnet
#

what helps is that i've worked with the FPSSample back in the day and re-built it from scratch. That was painful but I know what's going on that way

fluid kiln
#

I bashed my head against the Cube example for a good 24 hours, but after that it kindof clicked

viral sonnet
#

hehe, like everything in programming, once it clicks it's pretty great

#

and writing multiplayer code is easier then ever. i used all versions of their netcode and now it's at a point where the experience is mostly, wow, it works. cool

fluid kiln
#

Yeah I'm really excited, I haven't done much netcode before but I'm surprised at how simpler it is than it looks. Being new to it, it's excited just to see a remote client moving around from another 😂

viral sonnet
#

i started serious network coding in 2015 and I quickly found my limits ^^ i could get stuff to work but it was either heavy on cpu, bandwidth or both. stuff like snapshot compression, i can't do that shit ... lol

fluid kiln
#

Do you think the new NetCode will help in these aspects?

viral sonnet
#

yeah, it already does

north bay
#

what helps is that i've worked with the FPSSample back in the day and re-built it from scratch. That was painful but I know what's going on that way
@viral sonnet Did the same, when netcode came out i transitioned to that

#

Only problem i have with NetCode and ecs in it's current state is the job overhead. I cannot schedule any of my systems which are inside the prediction group since that instantly adds way to much overhead.

viral sonnet
#

yeah i'm waiting for a new ecs version. scheduling and acquiring data is so slow. I use mostly Run. I don't expect more than 1 core on serves anyway.

#

I did some heavy testing in a timelapse feature, where I wanted to simulate several hours as fast as possible and Schedule drained the whole flow

#

basically, when acquiring the data is slower than the actual system code then Run is better

safe lintel
#

have they acknowledged that scheduling is slow and can be improved?

viral sonnet
#

Joachim acknowledged the schedule problem but i haven't seen any update in it since then

fluid kiln
#

So is it normal that so far in my ecs project, in a lot of my systems I had to use WithoutBurst and Run instead of Schedule

viral sonnet
#

at this current state it's normal

#

as long as you don't use WithStructuralChanges you're mostly good

#

EntityCommandBuffers are also slow

north bay
#

I don't think i use a single WithoutBurst inside my Simulation group

fluid kiln
#

You have to use WithStructuralChanges every time you add a component?

viral sonnet
#

i think they are still not bursted, don't quote me on that

fluid kiln
#

Cause that's most of my systems lol

viral sonnet
#

not with an EntityCommandBuffer

north bay
#

I think most of functionality of EntityCommandBuffers is bursted by now

fluid kiln
#

Haa, so I should use the buffer instead of straight up the entitymanager?

viral sonnet
#

SetComponent >>> EntityCommandBuffer.SetComponent

fluid kiln
#

Looks like I got a bit of refactoring to do

viral sonnet
#

so writing back to GetComponentDataFromEntity is faster

#

i just don't understand why really

#

guess there's much overhead, i've never debugged what's going on the Playback of ECBs

#

for anyone using netcode right now. use this barrier: ``
[UpdateAfter(typeof(GhostSimulationSystemGroup))]
[UpdateInWorld(UpdateInWorld.TargetWorld.ClientAndServer)]
public class EndGhostSimulationBarrier : EntityCommandBufferSystem
{
}

#

if you write to the barrier in prediction systems you can have current data in systems running after the prediction while using ECBs. otherwise it's 1 frame behind

#

i nearly went crazy getting the sequence right with a mix of data i needed in this frame but only had available in the next

fluid kiln
#

Would that fix the very faint jitter when I move my capsule?

viral sonnet
#

i don't think it does anything for movement unless you have systems running after the prediction which change movement

#

if you have jitter you either have a problem with frame timings or slight drifts in prediction

fluid kiln
#

I'm not sure if it's even jitter

#

Problem right now is I have this component

public struct TargetComponent : IComponentData
{
    [GhostField]
    public Entity target;
}```

When i set target on the server, it becomes null on the client
viral sonnet
#

is the target a ghost?

fluid kiln
#

yes

#

I might be my RPC actually<

viral sonnet
#

test it out manually to see if the syncing works. if it does the problem is in the rpc

fluid kiln
#

How do I test it manually?

#

Oh you mean just set it in code

#

Sure!

viral sonnet
#

yeah, set the target on the server to something you know will work.

#

could even target itself

fluid kiln
#

i'll set it on instantiation

#

Yeah it works when I set it

#

Mmhh

#

Do you see a problem on my RPC systems? Don't worry if I'm asking to much I'll find it eventually 😂

#

Because when I send the RPC' the server receives it and sets the target, but it's not updated on the client

viral sonnet
#

maybe try [UpdateAfter(typeof(GhostLookupSystem))]

#

for ChangeTargetServerSystem

#

also for any other system that uses the lookup

fluid kiln
#

It already is :/

#

At least in the system list

#

I'll add it anyway

viral sonnet
#

hm, otherwise it looks exactly as my system

#

i'm just using commandbuffers ^^

fluid kiln
#

To send the RPC, I create an entity and attach the IRpcCommand component to it to be picked up by the system. Is that right?

viral sonnet
#

yeah

fluid kiln
#

Because I see that the RPC entity isn't deleted on the client side when I delete it on the server

#

🤔

viral sonnet
#

hm, so you need to find out if the rpcs are sent/received

fluid kiln
#

Well I log the console when it's sent to the server and when it's received

#

The server receives it and even sets the target, it's weird

viral sonnet
#

and the client does too?

#

nvm 🙂

fluid kiln
#

ughh!!! I wasn't deleting the SendRPC entity, just the ReveiveRPC one

#

I didn't realize they were different!

viral sonnet
#

hm, i don't delete my send rpcs on client

fluid kiln
#

You probably don't instantiate them the same way I do

viral sonnet
#

sure, i do the same thing. create an entity and put the rpc comp + sendcomp on it

#

i just don't do it in a system. working in the same frame as adding networkstreamingame is dangerour i think

fluid kiln
#

Yes this one is deleting, but I create an entity so that I can initiate the RPC from elsewhere