#archived-dots

1 messages ยท Page 203 of 1

light mason
#

what if child is offset to parent

#

it should just return the wp

#

no matter what

zenith wyvern
#

As far as I know it does

light mason
#

something is wrong

#

so im have a simple grid

#

im just query a child in the grid

#

never find

#

but when i un parent it does

zenith wyvern
#

What's the query?

light mason
#

the exact same entity un-parented is a hit

zenith wyvern
#

So that job doesn't run when it's a child?

light mason
#

it runs but the child localToWorld and Translate is not the world pos

zenith wyvern
#

Translate is relative to the parent

#

Aka local position

#

But LocalToWorld.Position should always be world position

light mason
#

that what assumed

#

let me place the parent so that one of the children is at 00 and see what i get

#

odd

#

its a hit

zenith wyvern
#

Are you sure you should be rounding there

#

If you're dealing in a grid it should probably be floor

light mason
#

do i need to do something special when i instantiate the parent

#

ok ill do that

#

but i have ui pringint as mouse move and that seems correct

#

mmm

#

i just notice that child from other parent get a hit that are not at 00

zenith wyvern
#

And comparing equality on floats is never a good idea. You should convert them to int3s before comparing. No idea if that's the issue but

light mason
#

ok

#

let me place an entity in scene and not instance it

native trail
#

Thanks ! This was the most helpful advice i've ever heard about ecs :D

light mason
#

ok looks like i was mixing localToWord and translate

pulsar jay
#

I am curious: Did anybody here try or manage to combine addressables with entities? I am currently loading prefabs via addressables and then converting them into prefabs in multiple systems.

gusty comet
pulsar jay
#

I am currently thinking about moving the conversion step into the addressables system and later on possible convert dureing edit time and remap the keys to load the already converted prefabs

gusty comet
pliant pike
gusty comet
#

Oh you replied to the wrong person initially. Had me really confused lol

pliant pike
#

yeah sorry

pulsar jay
#

Yeah I am also using scriptable objects for some stuff already. But then there are some things that are just prefabs (e.g. VFX effects) that I would like to load and instantiate

pliant pike
#

I'm not sure if you can convert sound effects, but if you can get the raw data you can convert it however you want

pulsar jay
#

doesnt exactly matter what it is atm. Couls also be an enemy prefab for example

pliant pike
#

actually I think I came up against problems using addressables with Systems

pulsar jay
#

It would be great to just call Addressables.LoadAsset<Entity>("Enemy"); and get the already converted prefab

pliant pike
#

I found and used this code that worked

#
public static int TryGetUnityObjectsofTypefromPath<T>(string path, List<T> assetsFound) where T : UnityEngine.Object
    {
        string[] filepaths = System.IO.Directory.GetFiles(path);
 
        int countfound = 0;
 
        Debug.Log("Filepaths length " + filepaths.Length);
 
        if(filepaths != null && filepaths.Length > 0)
        {
            for(int i = 0; i < filepaths.Length; i++)
            {
                UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(filepaths[i], typeof(T));
                if(obj is T asset)
                {
                    countfound++;
                    if(!assetsFound.Contains(asset))
                    {
                        assetsFound.Add(asset);
                    }                        
                }
            }
        }
        return countfound;
    }```
pulsar jay
#

But loading from AssetDatabase only works in editor doesnt it?

pliant pike
#

actually you might be fine in a system I had to use that because addressables wouldn't work in a GameObjectConversnionSystem

#

yeah

#

its if you want things converted before run time

pulsar jay
#

Did you try converting prefabs at edit time?

#

I figured there are methods to store and load entities as binaries which I thought about using

pliant pike
#

if you put them in a subscene then they are basically converted at edit time

pulsar jay
#

yeah I thought about that. But thats not really extensible and would basically replace the addressables system

karmic basin
pliant pike
#

weird theory but would it not be more optimal to have collision check on the environment objects, say if you know the max speed of the moving objects check the distance surrounding the evironment objects at that max distance, if they are close enough then you do the sphere casts or raycasts whatever, I'm curious if anyone has done it that way before ๐Ÿค”

toxic crest
#

is it valid and safe to declare const members in a job struct?

#

of a blittable type of course

coarse turtle
#

yea - const members are just readonly data - I've done that without issues

light mason
#

wondering if someone could help me out

#

i have a Lambda that drags an abject around

#

work with Translation

#

but as soon as I start using LocalToWorld is stops working

#

i need to use localToWorld because the obj are parented

#

im not sure what im doing wrong here

#

im setting to 2 ,1, 2 just to eliminate the input

#

but nothing is moving

#

or if this looks correct that would be good to know too

gusty comet
#

@karmic basin I dont think the package has any method for CCD or DCD - I think the character controller does this manually using raycasts and whatnot. I tried the failsafe approach but started having weird issues

stone osprey
#

Quick theory question... kinda targets the ecs and its persistence. I basically managed to persist a bunch of entities in a database. That includes their relations. But i have one issue... my persisted player entity for example. This one references a bunch of other entities in the database as items ( item - entities ). So in order to make the player work properly, i need to load him and all his referenced item-entities. But what if those item-entities reference other entities again ? And those referenced reference other ones ? Do i always need to load the whole reference-tree ? Does every game load all references between entities ? Or are there tricks to determine how far i need to load something ? Is this even possible in an ecs ?

gusty comet
#

Or at least if there's any CCD implementation in the package itself I'm not aware of it (without setting up a rigidbody or copying the character controller from the physics example)

ocean tundra
#

@light mason you should use translation

#

You could grab localtoparent and use that to figure out the world position to local position

#

But you should only write to Translation, local to world will be overridden by the transform systems

dark cypress
#

You can just write to it after the transform systems run.

ocean tundra
#

Oh yeah that would work

light mason
#

@ocean tundra do you have an example .. this is driven me crazy

ocean tundra
#

I dont sorry, im at work and dont have my projects here

#

but try Liburia's idea

#

just UpdateAfter TransformSystem

light mason
#

i just was @dark cypress chat , so i have to set my system to update after transformsys?

#

ah

#

typed at the same time let me try

light mason
#

ok so i have [UpdateAfter(typeof(TransformSystemGroup))]

#

and this in the system

#

so i can drag and move

#

but as soon as i delete NodeMoveComponent the node jumps back to it original position

#

its driving me bananas

dark cypress
#

try setting both translation and ltw

light mason
#

if i ref translation and ltw the job never runs

#

at this point im not sure if this is a bug or not

#

ok so it does run but i get double transform on children

light mason
#

how do i go from ws to local space

ocean tundra
#

@light mason pretty sure theres a LocalToParent component that has the matrix toconvert to local

light mason
#

I guess where im hittting a wall is the coord i was to set the entity too in in ws

ocean tundra
#

actaully i think if you used that you would take world pos and get a local pos relative to parent

#

not sure if thats waht your after

light mason
#

yea i think what makes sense

#

i just have no idea how to get that ws to ls

ocean tundra
#

take your position and devide? by the matrix

light mason
#

so i add my ws point to a matrix

#

and devide my LocatToWorld ?

ocean tundra
#

@light mason i really hope you understand matrixes

#

but im pretty sure you should never touch matrix values directly

#

theres some helper methods in the new maths library

frosty chasm
#

Hi, i wanted to use DOTS but i can't see Entity in package manager

sly jasper
#

If I want to copy a very large float4x4 array into Matrix4x4 array, are there any good ways to do so?

light mason
#

ok got it working

#

adding the mul of the inverse of locatToWorld and the worldPoint

#

yea i have the basic down of matrices but im still finding my why around the API

#

api

lusty otter
#

I need to generate a waveform texture from audio clip data and I'm using Job system to speed it up, but AudioClip.GetData doesn't have a native container variant.

#

Is there a way to make a native array of a managed array so I can pass it to the job without making another copy and taking up twice the memory?

#

The job only needs read access.

coarse turtle
# lusty otter Is there a way to make a native array of a managed array so I can pass it to the...

You can try to pin the array and grab a pointer to pass to your jobs or use the fixed statement;

// Fixed
float[] blah = new float[x] { ... };

fixed (float* ptr = blah) {
}

// Pinning
GCHandle handle = GCHandle.Alloc(blah, GCHandleType.Pinned);
IntPtr intPtr = handle.AddrOfPinnedObject();

// Pass this to job
float* ptr = (float*)intPtr.ToPointer();

// Free the pinned resource
handle.Free();

// Job Example
unsafe struct SomeJob : IJob {
  [NativeDisableUnsafePtrRestriction]
  public float* Ptr;

  public int Length;

  public void Execute() {
    for (int i = 0; i < Length; i++) {
      float content = Ptr[i];
      // if you want to access the pointer
      float* f = Ptr + i;
    }
  }
}
ocean tundra
#

I know we are not meant to change the state of a struct from a Method but is there any issues if we do so anyway?

#

I'm reading data from a network stream, i then create the struct and pass in the DataStreamReader to load up the rest of the values

#
        {
            EntityId = reader.ReadInt();```
ocean tundra
#

Also anyone know how to use DataStreamReader.ReadBytes

#

i have no idea how unsafe pointers work

#

this seems like crazyness

            fixed (double* timePointer = &Time)
            {
                reader.ReadBytes( (byte* )timePointer, sizeof(double));
            }
#

and to write if anyone is curious
writer.WriteBytes((byte*) &time, sizeof(double));

sly jasper
ocean tundra
#

Well it seems that the read/write bytes I'm doing doesn't work

#

Anyone have any ideas?

quaint bear
#

Hello to everyone or anyone who can point me to a general direction of code..
So I want to make an editor window which will be populated with entites in my world with their entity index.

I want to select a button in that list and then that entity should be highlighted inside entity debugger.

Something like

selection.activeGameObject= gameobject. 

//Similarly,
selection.activeEntity= entityList[entityIndexFromList] 
//The above should select the entity from the entity debugger and show the components in inspector as usual.. 
//Just need an easier way to find entites, will expand this to use specific components later.. (Dots Editor package is not that friendly)
#

Please ping me if you have any ideas. I'd love to hear some suggestions.. thanks!

whole gyro
lusty otter
quaint bear
ocean tundra
#

Does anyone have any ideas how to get a nice unique ID for every entity in a subscene. The ID needs to be saved in the scene (inside a monobehaviour) so it persists

#

If it helps this ID is the entities network id, both client and server load the same subscene but cause of entity remapping the entity index and version can change so I can't use that. So need a ID to help link them

karmic basin
#

So a UUID ?

pliant pike
#

I think I got a a unique id from AssetDatabase.AssetPathToGUID("Assets/Scr....

karmic basin
#

Nice one, though only for assets ๐Ÿ˜›

charred thistle
#

I wanted to learn DOTS again, but I haven't played with him for so long that I don't even know where to start =/

agile dome
#

I found samples very useful when I was exploring Unity Tiny. Pinned post has all the links

odd ridge
#

how do I implement collision detection in DOTS? say I have thousands of characters, I want to detect when a character is close enough to start fighting another

coarse turtle
warm osprey
#

How does EntityManager.SetEnabled(entity, true) know, which of entity's children acquired the Disabled tag by EntityManager.SetEnabled(entity, false), and which of them acquired the Disabled tag by other means? Because EntityManager.SetEnabled(entity, true) will not remove the Disabled tag from children that acquired it by other means.

#

I'm asking because I'd like to create a large multitude of hierarchies on a worker thread using ECB, which are disabled at creation time. I'd like to enable them at a later time with EntityManager.SetEnabled (so I don't need to traverse the hierarchy myself to remove the Disabled tag from the children and grandchildren). But I just can't find a way to do that correctly.

ocean tundra
#

@pliant pike @karmic basin I've considered guids but size wise they are kinda big 128? Bytes where a int is just 32

amber flicker
#

(or buy my tagging solution on the store - but that sounds a little overkill ๐Ÿ˜‰ )

ocean tundra
#

Hmmm so everything has a nice easy guid, but at runtime the server maps that guid to a nice small int and keeps that list in sync over the network

amber flicker
ocean tundra
#

Yea there's lots of annoyance to this id thing

#

Putting in a app version check is on the todo list

#

And honestly don't think I can use addressables, many of my older versions did. But I've embrased subscenes and I don't think we can make a subscene addressable

amber flicker
whole gyro
#

Has anyone been able to serialize entities from a subscene? I recently switched from GameObjectConversionUtility to subscenes for converting my prefab entities. Its all working great in game, however, when I try to serialize the world using SerializeUtility, it fails to serialize any entities from the subscene. I believe this is because SerializeUtility doesn't support remapping and serializing entity references in SharedComponents, but the subscene is automatically adding a SceneTag shared component with a reference to the subscene entity. Do I need to manually remove these subscene components before serialization?

ocean tundra
#

@whole gyro wait there's a component on each subscene entity with the original subscene entity?

#

How was it not automaticly remapped?

#

As for serialize untility I've used it lots without subscenes and it was super annoying but never with subscenes

whole gyro
#

I was able to get serialize utility working before I switched to subscenes (after doing some mesh -> ID substitution). Only difference now are these extra components.

#

Maybe I need to use SerializeUtilityHybrid... I just really don't understand what I'm supposed to do with the ReferencedUnityObjects that it gives me back when I call Serialize().

#

Yeah okay, removing the SceneTag component before calling SerializeUtility.SerializeWorld() works fine. Only difference from what I can tell is the entity window no longer groups the entity under the subscene.

whole gyro
ocean tundra
#

@whole gyro thanks for clarifying. Having the original entity doesn't actually solve my issue. I'm thinking some sort of editor script that can create nice int IDs and save it into a mb with IConvert

shut hare
#

How can you get a entity through a gameobject with the new hybrid workflow ?

ocean tundra
#

@shut hare I think it works the other way, Entity => gameobject

#

you could have a MB that you add to the entity, then in a system set a public Entity field on the MB

shut hare
#

I made the logic the other way around with the old workflow GameObjectEntity

ocean tundra
#

the MB would need to be added as a hybrid component

shut hare
#

what do you mean by MB ?

ocean tundra
#

MonoBehaviour

shut hare
#

ok so the MB would be empty ?

ocean tundra
#

basilcy, just a entity field

shut hare
#

isn't it the same thing as the GameObjectEntity class ?

ocean tundra
#

No clue sorry

shut hare
#

its ok thx i'll tinker on what you said

plush meadow
#

As far as I understand, entities with different meshes are split into different chunks to reduce drawcalls. I just want to make sure that if each of those entities all have different transform matrices (like scaled differently, sheared and such) it will still have the same effect right?

#

I'm not very knowledgeable about graphics stuff so sorry if this is too obvious of a question

coarse turtle
#

not to my knowledge, because the LocalToWorld is not a shared component data, it can fall within the same chunk

Mesh 1 -> chunk has LocalToWorld matrices, A, B, C with different values
Mesh 2 -> chunk has LocalToWorld matrices, W, X, Y with different values

So A, B, C should fall within the same chunk because they share the same archetype + SharedComponentData, same goes for W, X, Y - it will fall into the same chunk that Mesh B is a part of

plush meadow
#

I see, so that's still useful at least

#

But will having different matrices have any effects on number of drawcalls?

coarse turtle
#

depends on how it is drawn, I assume you are using hybrid renderer - which I have little experience in using

plush meadow
#

I am using hybrid

coarse turtle
#

generally I don't think so, since hybrid renderer probably uses indirect drawing/instancing to reduce the drawcalls. Someone else whose worked with it more actively can provide a much better answer than me

plush meadow
#

I see, your answer still helped a lot though

worthy rampart
#

generally speaking no one would ever be wanting to render the same mesh with the same transform

sly jasper
#

And I think the renderer is using direct instancing. There is a batch limit of 1023

sage mulch
#

Is there any way to access a material property for an entity without using ShaderGraph?

ocean tundra
#

yup

sage mulch
#

Could you link me to documentation please? Everything I've found is for ShaderGraph

ocean tundra
#

Oh wait

#

im pretty sure that needs shadergraph as well

sage mulch
#

Yike

#

Ok ty

#

Just spent ages learning how to write shaders lmao

#

Should have done my research

ocean tundra
#

๐Ÿ˜›

#

i remember skimming over some fourm posts AGES ago about how to enable the overrides for custom shaders

#

no idea if they succcessed

sage mulch
#

Ah ok

#

Wonder if that's planned for the future

#

Or if they're just leaving custom shaders behind

ocean tundra
#

honestly if your in URP or HDRP i would just use shader graph

sage mulch
#

Is there a performance impact?

#

I figured it would be slower than writing one tbh

ocean tundra
#

well the whole old render pipline is being replaced with those

sage mulch
#

Ah

ocean tundra
#

umm not too sure, I think URP is faster

#

but HDRP is prettier ๐Ÿ˜›

sage mulch
#

This is a very general question, but would you say anything that is possible via written shader is possible via ShaderGraph?

#

My shader is super weird and relies on the camera direction, idk if ShaderGraph even supports that

ocean tundra
#

URP is meant to match features of built in, but be faster, HDRP is meant for the crazy HD graphics

#

not sure sorry, my shader graph skills are super low

sage mulch
#

Np, ty for the help!

ocean tundra
#

i mainly use URP as it is, little to no customization

#

eventually i want to get better at it but graphics always seems to be lower down on my list

sage mulch
#

Yeah I'm just trying to do some multi-directional sprite nonsense

#

2.5d

ocean tundra
#

sounds cool tho

#

maybe do them in code, with jobs + burst it could be super fast

#

and you get more maintainable c# code instead of shader magic

sage mulch
#

That's good advice, ty

#

I'll def look into it

ocean tundra
#

good luck, sorry i couldnt help with the shader stuff

safe lintel
#

no you dont need shadergraph

#

but you do obviously need to make your shader be compatible with one of the renderpipelines and hybrid renderer compatible

#

theres a bit in the shader that goes like CBUFFER_START(UnityPerMaterial) and this is where you declare that properties and then a little below another entry where you declare again that they are instancing compatible UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata) ie UNITY_DOTS_INSTANCED_PROP(float4, _BaseColor)

ocean tundra
#

Anyone tried getting DOTS and hybrid renderer working over 2 screens?

#

I need a hook during the Conversion flow on a MonoBehaviour, anyone know if that exists

#

Before conversion, a component attached to the SubScene needs a callback like OnEnable

light mason
#

have a question i was wondering if someone could help me our with

#

if i have an Enitites.ForEach( DynamicBuffer<Foo>

#

and i use and cmdBuffer to create a new Instantiate of foo

#

can i use add(foo) inside the lambda

#

as in Add to the buffer of and entity i instantiated with ecb

#

hope that question makes sense

#

or is there an command buffer method i should use to add the new element

#

ok i found AppendToBuffer()

vagrant surge
#

thats from the Rust gamedev community, for a new engine project. The interesting part is that the ecs is a hybrid ECS

#

components are stored in archetypes and data chunk by default, but its possible to remove them from there and put them into sparse sets like in entt or entitas for some component types

ocean tundra
#

hmmm its a interesting idea

#

being able to specify if the component should be optimised for iteration speed or add/remove performance

#

honestly sounds like a good idea, more controls to us

vagrant surge
#

indeed

#

he also implements some of the ideas from Flecs like archetype graphs

#

that act as a big optimization around add/remove component for archetypes

#

one of the interesting things about such an approahc for the hybrid

#

is that you can go even more hybrid

#

not just storing the components into sparse sets

#

but for example something like a hashmap

#

or other storage that could store entityID->component

ocean tundra
#

but also does optimising tag components to have little/no cost and adding the enabled component optimisation/feature also give us the same things

vagrant surge
#

not exactly

#

being able to use sparse sets for some components makes the typical "state machine" pattern work a lot better

#

important to know that this ecs also makes tag components much faster and has component enable/disable

ocean tundra
#

very cool

vagrant surge
#

ecs libraries are starting to go quite a bit beyond the feature set of unity ecs

#

on the cpp side we have Flecs which is highly advanced, and then this now for rust

ocean tundra
#

maybe after we get those 2 features in DOTS (in 2 years ๐Ÿ˜› ) they could consider something like this

vagrant surge
#

btw, Rust works incredible for ECS

ocean tundra
#

yea i bet

vagrant surge
#

its just a perfect fit for the language

#

rust is a functional-ish highly parallel language

#

where memory management is a huge pain due to the borrowchecker

#

buuut

#

if you use a ecs to manage the memory for you, thats a total headache you remove

ocean tundra
#

i doubt ill be learning rust anytime soon

#

work is all mobile/web/c#/.netcore

#

and free time is all unity ๐Ÿ˜›

#

i really like the idea of us being able to choose that optmization

#

and it would be quite simple too, unity could probably make it into a Attribute we add on our IComponents

deft stump
#

C# forever

gusty comet
#

thats like godot adding dynamic gi before they had occlusion culling, or even bare minimum acceptable frustum culling

#

in bevy's case it shouldn't be that surprising I guess, because the whole engine came into being because the author didn't like amethyst's ecs (amethyst itself is upgrading their ecs btw, at the cost of killing all their momentum!)

safe lintel
#

no editor is a big stopper for me ๐Ÿ™‚

#

do wish unity put more of their development in the open though

deft stump
#

I wish Unity makes their engine open source

#

Or other than that... have their trello board open for the public to see

safe lintel
#

probably only the second is really feasible

dark cypress
#

How can I get the entity itself in IJobChunk?

coarse turtle
# dark cypress How can I get the entity itself in IJobChunk?

You pass in an EntityTypeHandle to the job struct

struct ChunkJob : IJobChunk {
  [ReadOnly] public EntityTypeHandle EntityHandle;
  
  public void Execute(ArchetypeChunk chunk, ...) {
    var entities = chunk.GetNativeArray(EntityHandle);
    for (int i = 0; i < chunk.Count; i++) {
      var e = entities[i];
    }
  }
}
dark cypress
coarse turtle
#

very similar to how you get a ComponentTypeHandle, from SystemBase it's calling the GetEntityTypeHandle() function

from ISystemBase it's usually systemState.GetEntityTypeHandle()

pliant pike
#

no matter how many times I've seen the word polymorphism and it explained I still never understand it leahS

dark cypress
#

Thank you.

light mason
#

Can I have Entity field on an GeneateAuthoringComponent and set it later in a system?

#

or is that not a allowed

safe lintel
#

what do you mean?

light mason
#

I have public Entity on in a [GenerateAuthoringComponent]

#

the entity i want to ref will be created in a sys

#

or should i spilt that into a seperate comp and create and set in a sys

dark cypress
#

[GenerateAuthoringComponent] just makes a monobehavior for your component.

safe lintel
#

I dont see why not. GenerateAuthoringComponent really only relates to the editor workflow

dark cypress
#

The component itself functions as normal.

light mason
#

so like a node lib you create in editor

#

you instantiate but you want to set a ref go other entity

#

node are prefabs in the example above

#

Bad example above but hopefully it makes sense

ocean tundra
#

Is there a good way to get a NativeHashMap to auto grow as it fills up?

worthy rampart
ocean tundra
#

dont think i can do that from a job tho

worthy rampart
#

I don't think ya can either

ocean tundra
#

hmmm

#

maybe it already auto grows

#

From the comments: The number of items that the container can hold before it resizes its internal storage.

#

nope guess not

timber ivy
#

@ocean tundra you were suggesting a* to me, does a* allow you to tell the agents to follow a path at some offset?

viral comet
#

How often can I bump a thread on the Unity dots forum?

#

Cant find any info/rules

timber ivy
#

Do i need to use capture variables inside entities.foreach that ref the component?

ocean tundra
#

@timber ivy thats not really a a* (or any pathfinding) thing

timber ivy
#

it kinda is, because the built in pathfinding always finds the shortest path between two points

#

and it results in the ai moving in a perfectly straight line

ocean tundra
#

with pathfinding it helps to break it into 2 parts

  1. the acutal pathfinding, this is finding the best path between 2 points
    2, the actual following of the path, this can be many different options depending on the game type
#

i belive that built in pathfinding has both concepts mixed together

timber ivy
#

Any ideas how i can get the ai to spread out and not fall in a straight line?

ocean tundra
#

but for me, i've been messing with RTS games, so a space game pathfinding and medevial pathfinding both works the same for step 1, but following is completly different

timber ivy
#

this is what i got going on now

#

and it just looks like shit

ocean tundra
#

so again depends on the game, for my space one i had units in a 'squadron' the squad would pathfind (step 1) and then use flocking steering behaviours to follow

timber ivy
#

the navmesh is litterally the whole sidewalk

#

but they utilize only the center

#

(this is unities built in navmesh and pathfinding btw)

#

i tried offsetting the destination

#

but that didn't change anything

ocean tundra
#

so for crowds i would use pathfinding + (steering behaviours OR RVO (also known as local avoidance)

#

so yes the path would always be the same for all those people

#

but the actual following is different

timber ivy
#

Ah so id have to code my own navmeshagent system basically

#

instead of using unities?

ocean tundra
#

i've never used unity's but i would guess yes

worthy rampart
#

I'd also vary the speed on em slightly

#

And make sure they can avoid collisions with each other

ocean tundra
#

yea thats a great idea

worthy rampart
#

As no one literally walks in sync

timber ivy
#

yeah

worthy rampart
#

People walk slower/past each other

timber ivy
#

it looks so robotic rn

worthy rampart
#

It's the little things like that

#

That take it from looking robotic to not

ocean tundra
#

i'm trying to find a good article on steering behaviours, there was a good one that had cool animations

worthy rampart
#

Also do they move their arms

ocean tundra
#

local avoidance is a MASSIVE pain ๐Ÿ˜›

worthy rampart
#

Or anything like that

timber ivy
#

nah there is just an idle animation rn

#

I haven't really messed with animating it yet

#

just wanna spread them out a little for now but apparently that isn't possible with built in navmeshagents

ocean tundra
#

i think these were the ones that made the most sense to mee

timber ivy
#

ig this just gives me an excuse to make a dots compatible pathing system

timber ivy
#

Awesome

ocean tundra
#

(damn embedded links taking up the whole page, sorry everyone)

timber ivy
#

awesome thank you roy

ocean tundra
#

not sure how fitting for dots they are

#

will likly need to rebuld loads

timber ivy
#

I will be able to make something happen surely but

#

for now this will get me started at least

#

its actually nuts to me that something like pathfinding for AI is so limited with the built in shit

ocean tundra
#

yup

#

but sadly compatibility with DOTS is lacking

timber ivy
#

Thats cool

#

prolly a little heavy for me though

ocean tundra
#

a star pathfinding project sure

#

but dotsnav looks really simple

#

nice and clean

light mason
ocean tundra
#

Please use code tags

light mason
#

wondering what im missing here

#

for the image?

ocean tundra
#

for code

light mason
#

what code

ocean tundra
#

any code

#

dont take pics copy paste it into code tags

light mason
#

it wont let me add code

ocean tundra
#

are you using code tags?

light mason
#

yea

#

it just dissapears

ocean tundra
#

                            networkDriver.BeginSend(connection.Value, out DataStreamWriter writer);
                            writer.WriteByte((byte) GameNetworkProtocol.CurveData);
                            //todo generate a nicer typeId
                            var typeId = 1;
                            writer.WriteInt(typeId);
light mason
#

that why i was wondering if you saw any code from me

ocean tundra
#

weird works fine for me

#

using `?

#

3 of them

#

start and end of code

light mason
#

just `

#

ooo ok

ocean tundra
#

but yea that code looked fine

#

whats the issue

light mason
#

so the data doesnt appear to get set

ocean tundra
#

you mean the data getcomponent?

#

you will need to call setcomponent somewhere

timber ivy
#

Wonder what would happen if i parented my ai to an empty object

#

and offset the child by a value

light mason
#
                var data = GetComponent<NodeBezierMasterComponent>(connectEntity);
                // Set EndNode Entity  Hit target node
                Entities
                    .WithoutBurst()
                    .ForEach((Entity e, int entityInQueryIndex, ref NodeBaseComponent s, in LocalToWorld l) =>
                    {
                        data.EndNode = e;
                        data.CurveDotsMax = 10;
                        ecb.SetComponent( connectEntity, new NodeBezierMasterComponent()
                        {
                            CurveDotsMax = data.CurveDotsMax,
                            StartNode = data.StartNode,
                            EndNode = data.EndNode
                        });
   
                    }).Schedule();

                
                
                
                // Create Dots 
                Entities
                    .WithoutBurst()
                    .ForEach((Entity e, ref NodeConnectComponent c, in LocalToWorld l) =>
                    {
                        Debug.Log("____0");
                        Debug.Log(data.CurveDotsMax);
                        for (int d = 0; d < 10; d++)
                        {
                            Debug.Log("Creating curve dots like never before son!");
                            Entity curveDotEntity = ecb.Instantiate(nodeLibBuffer[3]);
                            ecb.SetComponent(curveDotEntity, new Translation {Value = new float3(inputRecordData.MouseGridX, d, inputRecordData.MouseGridZ)});

                        }
                        Debug.Log("_____1");
                        ecb.RemoveComponent<NodeConnectComponent>(connectEntity);
                    }).Schedule();```
#

Debug.Log(data.CurveDotsMax); is 0

#

what am i missing here

ocean tundra
#

soo

#
                        data.EndNode = e;
                        data.CurveDotsMax = 10;``` will never survive
#

your not saving data again

#

also these are both jobs, thats not how you share data between jobs

light mason
#

ok so if NodeBezierMasterComponent is a singleton how do i write data into i from different entitie in a forEach

ocean tundra
#

well you shouldnt

light mason
#

because I cant capture either

ocean tundra
#

as it will constanly be replaced

#

your looping over every entity with .ForEach((Entity e, int entityInQueryIndex, ref NodeBaseComponent s, in LocalToWorld l) =>

#

theres no guarantee of ordering

#

whatever the last entity you loop over will be the one your saving to the singleton

#

not really sure what your trying to achieve

light mason
#

im have a nighmare getting tick to work

#

having

ocean tundra
#

what are you trying todo?

light mason
#

trying to add the code but it not working

#

it on a cell hit w node

ocean tundra
#

no dont add code ๐Ÿ˜›

#

explain the high level steps your wanting

light mason
#

what i added before was not correct

#

I have a singleton

#

when i hit a node or enity of NodeBase I want to update the singleton

ocean tundra
#

what do you mean by 'i' and 'hit'?

#

as in player collides?

light mason
#

no it mouse in a grid

timber ivy
#

@worthy rampart you're a legend man. By making each ai having a randomized speed set, it made the offsets happen naturually cause it causes the path to be recalculated when the agent has to steer past slower moving agents

ocean tundra
#

@timber ivy keep in mind the agents will be recalculating every X (frame? seconds?) which is not great

timber ivy
#

Huh?

ocean tundra
#

performance wide

timber ivy
#

i mean

#

i don't think it will be an issue

#

i got 1200 rn

#

30 fps on a business laptop

light mason
#

wait.. i just need to GetComoponent in the lambda

#

right

timber ivy
#

and the ai stream in and out based on camera position, so i don't really think there will ever be more than a few hundred on the screen at any time tops

ocean tundra
#

@timber ivy sweet

#

my performance goals are crazy high so that would never work for me ๐Ÿ˜›

timber ivy
#

how many are you trying to have on screen at once?

worthy rampart
#

Glad I could help :)

#

Have fun

ocean tundra
#

@light mason still lost at what your trying to do sorry
when i did mouse grid stuff i did the following:
raycast to world
take Hit and devide by grid size, this would give me the grid int x and y
i had a native hashmap of int2 (x y) to entity to find the entity for that grid

#

@timber ivy ALL of them ๐Ÿ˜›

timber ivy
#

I wonder if giving each one a random "width" for the agent collider would add more variety as well

ocean tundra
#

i usually try to make management/strategy games and want to have no unit caps (limited only by CPU speed ๐Ÿ˜› )

timber ivy
#

yeah you can't really get away with streaming them in and out

#

and reusing them like i can

#

with rts type games

ocean tundra
#

yup ๐Ÿ˜ฆ

timber ivy
#

Speaking of streaming

#

i wonder when unity will get built in level streamer

#

like ue4 has LOL

ocean tundra
#

maybe, i think subscenes are a step in that direction

timber ivy
#

Yeah I agree

ocean tundra
#

they are kinda painful still, but their super quick / background loading seems solid

timber ivy
#

is it better than LoadLevelAsync

ocean tundra
#

i dont think it would be that hard to build the next layer with them as they are

#

all you really need is a way to map int2 (chunk X and Y) to a scene GUID

light mason
#

@ocean tundra ok let me regroup here , thank for talking it over with me

timber ivy
#

I have one i wrote a while ago that works that way

#

but it uses LoadLevelAsync and asset bundles

#

the GUID is just the asset bundle name

#

worked ok i guess but deff had some frame drops

#

are subscenes usable with DOTS?

ocean tundra
#

@timber ivy what do you mean by usable ๐Ÿ˜›

timber ivy
#

can I use them in parralel jobs?

#

or are they only exposed to main thread

ocean tundra
#

umm both??

#

๐Ÿ˜›

#

theres a SceneSystem you use

#

call methods on that from main thread

#

OR create a entity with the right components using a ECB

#

(the system hepler thread does that for you)

#

then it all automagicly happens

#

eg

 var sceneEntity = world1.GetExistingSystem<SceneSystem>().LoadSceneAsync(data.SceneGUID,
                    new SceneSystem.LoadParameters()
                    {
                        Flags = SceneLoadFlags.NewInstance
                    });
#

internally that does some stuff to find the scene reference and create a entity with a few components

#

for me seems to work fine

#

worst part is I cant find any good hooks into the conversion process

#

specifily i would like to convert a subscene 2ce, into a Server and Client version

timber ivy
#

Hmm since it converts everything to entities

#

does that mean some of the built in components in unity

#

aren't compatible with subscenes?

ocean tundra
#

theres that hybrid/companion thing

#

that does work with subscenes

#

you have to manually call something but you can choose to persist old MB's and unity components into the subscene

#

but by default i dont think it does that with anything

timber ivy
#

Ah right

#

got ya

#

thanks!

ocean tundra
#

and this is all the docs

#

@timber ivy oh and livelink is kinda a pain

timber ivy
#

livelink?

ocean tundra
#

most of my issues have been around that, as the concept is great, edit your authoing GO and it will just 'magicly' update the entity version

#

during runtime

#

or even during a build

#

but in practice its a pain to keep working

#

livelink basicly will stream over your editing changes during runtime, you can even attach to builds and do it

timber ivy
#

interesting

ocean tundra
#

in concept its great

#

and it actualy works, in smaller demos/samples

#

but im struggling with it. again mainly cause server client.

#

i want it to work, but only into the server world, my standard networking stuff can take care of sending the data to a client

#

but you cant edit or control livelink at all

#

no way to turn it off for a world either

#

Question for everyone
What built in components do people think should have networking support by default?
So far I have Translation, Rotation, Scale
What else do people expect to be synchronised?

timber ivy
#

Are you creating a net library?

ocean tundra
#

yup

timber ivy
#

Tbh man

#

I don't think they should be automatically synced

#

idk what you're going for

ocean tundra
#

no its up to the user to decide if it gets synced

timber ivy
#

but it sounds like you're trying to make something high level

worthy rampart
#

Roycon I think you should give the models a tiny scaling

#

Russel

#

Sorry

#

Like 5%

ocean tundra
#

sorry the question is more like, Which built in types should have support for networking

worthy rampart
#

Random

timber ivy
#

ah

#

thats a good idea too derek

#

and roy something I always hated having to manually sync back when I used pun was animations

worthy rampart
#

I'd give it as much variance as you can

#

Without it looking wierd

#

Eventually you'll probably want some different models too tho

timber ivy
#

Yeah i will have some diff ones soon

#

there is still like

worthy rampart
#

There's always 100 other things to do

timber ivy
#

9k free modelsa nd animations on mixamos website

#

that i am going to grab here soon

#

to use with this

ocean tundra
#

@timber ivy Ooo i need to dig into the animations package to see what animation components i need to add for syncing

#

good idea TY

timber ivy
#

no problem

#

but please make this optional

ocean tundra
#

yup

timber ivy
#

and give the user the ability to serialize their own data for transport

ocean tundra
#

its 2 parts

timber ivy
#

what are you using to handle the networking itself?

#

c# sockets?

ocean tundra
#

Code gen, which creates the types to allow networking

timber ivy
#

nice thats cool

#

but what are you using to transport data cause

#

if you're doing an rts

#

i really wouldn't use C# sockets

ocean tundra
#

then on component you select what data types to sync

timber ivy
#

or anything that uses c# sockets internally

ocean tundra
#

nope im using Unity.Transport atm

timber ivy
#

Idk what it uses internally

ocean tundra
#

but it should be easily swapable

#

some very low level udp c++ socket i think

timber ivy
#

might want to check into

ocean tundra
#

yup

timber ivy
#

league of legends uses enet

#

so its proven at least

ocean tundra
#

but it should be swappable, all i need todo is create some different code gen templates and put some toggles into the code generator

#

yup my last prototypes used enet

timber ivy
#

yeah that guy has some

#

Really good resources on his github

ocean tundra
#

the only reason ive started with transport this time is i want Full job support

timber ivy
#

oh someone used it with jobs

#

and ecs

ocean tundra
#

where with eNet i found integrating with jobs a pain and just gave up ๐Ÿ˜›

timber ivy
#

there was a post in the dots forum

#

about how he did it

#

So yeah

#

unity.transport deff way easier to use if you want full job support

ocean tundra
#

interesting

timber ivy
#

He used io threads

#

and a lockless q instead

#

so there wasn't the constant overhead of spinning up a new job

ocean tundra
#

yea makes sense. thats what my first prototype did too

#

only 1 tho, the network thread

#

oh and a serialisation thread ๐Ÿ˜› so 2 threads

timber ivy
#

yeah so it was the same as his ๐Ÿ˜‰

#

2 threads + main thread for game code

#

I did something similar in this

#

still need to finish that ๐Ÿ˜ฆ

ocean tundra
#

server to server communication sounds cool

timber ivy
#

Yeah i was working on

#

handing over a player

ocean tundra
#

the ability to break apart the server to have more resources...

timber ivy
#

from one server to another when I got side tracked with work

ocean tundra
#

could have sooooo many entities

timber ivy
ocean tundra
#

i feel like to do that right the gameplay needs to kinda enable that

timber ivy
#

yeah

#

tbh

#

what i was doing was

#

connecting to the new server

#

then disconnecting from existing

#

after you get too far

#

so you were not constantly jumping servers if you walked back in fourth

#

The thing that kinda fucked with me though was making the handover seamless

ocean tundra
#

yea..

timber ivy
#

like

#

if you were aiming your gun

#

and walked across

#

your entire player state got reset

ocean tundra
#

for something like that, i would look at actor frameowkrs, something like project orleans would give you that whole dynamic server adding and removing

timber ivy
#

yeah

#

those things are so complex

#

tho

ocean tundra
#

you would need a bit of custom code to handle the position based server

#

yea very

timber ivy
#

idk if you ever really messed with akka

#

but that shit is so damn complex

ocean tundra
#

orleans would get you like 50% there tho

#

orleans and akka are very simlar

timber ivy
#

but even then

#

youd have to get the gameplay code right

ocean tundra
#

yea the other 50% is still huge ๐Ÿ˜›

timber ivy
#

to handle server handovers

ocean tundra
#

with orleans you wouldnt handover

timber ivy
#

what would you do?

#

just keep adding new servers?

ocean tundra
#

the indivudial actor would move but your connection to orleans is to the clustor

timber ivy
#

ah really?

ocean tundra
#

it will eventually notice that all your messages are now going to server x instead and move your connection

#

somehow you could probably bump that to do it early

#

the biggest issue is orleans recommends something else inbetween, like web apis to handle auth and things

timber ivy
#

between the user and the cluster?

ocean tundra
#

yea, the cluster is meant for 'backend'

timber ivy
#

could just have a relay server inbetween

#

that just bounces messages back and fourth

ocean tundra
#

yea probably

timber ivy
#

but not really suitable for some games as that would just make latency

ocean tundra
#

but again more to build

timber ivy
#

but for an mmo

#

it would be fine

minor sapphire
#

has anyone had issues with ICustomBootstrap not loading when using a custom build configuration, but it works if you do the default unity build (ctrl-shift-b)?

#

boostrap just not getting called ๐Ÿ˜

ocean tundra
#

oh no

#

dont say that

#

i use a Custom Bootstrap

#

but i havnt started any builds yet

#

@minor sapphire got any links for how to setup the builds? and ill give it a try

#

we need to use that new build pipleine thing right?

minor sapphire
#

yeah

#

take a look at this thread, he has the same issue

#

but

#

it looks like it might be a package issue

#

if you have your own ICustomBootstrap (not in a package) you might be fine

#

I'm about to test moving the bootstrap out of the package

ocean tundra
#

well thats annoying, i eventually want to distribute as a package

minor sapphire
#

I haven't confirmed yet

timber ivy
#

what on earth is icustombootstrap

ocean tundra
#

its some 'magic' you can use to control where/when your systems get created

minor sapphire
#

it's a way to override the default bootstrap, the bootstrap sets up the world and default systems

ocean tundra
#

i use it to configure a Server and Client world with different Systems

minor sapphire
#

yes which is my situation too

ocean tundra
#

and also to exclude my systems from the default world

#

are you building some network tech too?

minor sapphire
#

no I'm trying out dotsnet

#

it has bootstrap for server/client...

ocean tundra
#

Is there a way to tell what packages are installed in a project?

minor sapphire
#

from code?

ocean tundra
#

Ideally I only want to add Types that are actaully installed to a project, eg no point adding Animation networking support if no animation package installed

#

yea from code

#

i guess i could just read the manifest json

#

seems like a terriable idea tho

minor sapphire
#

Hmm if you know what packages you are looking for potentially you could use reflection

ocean tundra
#

yea probably refelction ๐Ÿ˜ฆ

minor sapphire
#

if it's an editor only situation, why not read the manifest? ๐Ÿ˜„

#

oh but I suppose they could have local packages

#

maybe reflection

ocean tundra
#

didnt think of local packages

#

yea refelct over every loaded assembly seems like the best way

#

then over every single type ๐Ÿ˜›

ocean tundra
#

When people want to send a network command (from client to server) (eg player move) which sounds better?

  1. Find the player entity and add a item to the command buffer
  2. Add a command component to any entity (not a buffer so can only add 1 per entity)
minor sapphire
#

2 seems non-viable. One command per frame?

ocean tundra
#

well you could create more then 1 entity

#

or if its a unit in a rts add it to many units eg every unit you have selected

#

im starting to think that both approchs might be right, per entity commands for things like unit movements and a more 'general' command pattern for other things, eg chat or building construction

ocean tundra
#

oh burst isnt on by default interesting

#

Thats about 650 worst case entitys syncing translation and rotation every frame

#

The delay is cause I've hardcoded a 1sec delay in untill i get a proper network time working

fallen ridge
#

Cool one wowie

sage mulch
#

Is it possible to access a ShaderGraph shader's property through a System?

#

URP

ocean tundra
#

@sage mulch Did we already have a discussion about this?

#

Maybe I sent the wrong link

#

Does ECS clean up entitys with no components on them?

deft stump
#

they get reused

ocean tundra
#

wait so ECS does deal with them

deft stump
#

yeah.
They get reused.

north bay
ocean tundra
#

How do I query for them. Is there a empty query somewhere?

north bay
#

I don't think there is, how do you end up with empy entities?

deft stump
#

and why would you need to get empty entities anyways?

#

to fill them up again?

hollow sorrel
sage mulch
#

@ocean tundra yeah we did, was hoping for some more input on it. Thanks again for the link but I can't seem to see the "Hybrid instanced (experimental)" toggle. Is the "Exposed" toggle that I do see the same thing, just renamed?

frosty siren
#

Can someone clarify what ISystemBase is for? What can we do with it for now? I have read that ISystemBase is to write main threaded job with burst.

zenith wyvern
#

It lets you burst your OnUpdate method, so job scheduling itself will be bursted. It's currently very limited though and only supports IJobChunk.

frosty siren
#

Oh, i see. You know, lambda style code for dots is here for at least 2 years and i completely forgot how it feels to write all logic in self defined jobs. So Entities.ForEach is something default for me now)

karmic basin
#

Wait no

#

I don't remember sorry for the ping xD

#

But I think it changed name yeah at some point

sage mulch
#

all good haha, appreciate the response

#

i'll just keep trying

karmic basin
#

I don't have it in 2020.2.5

#

Oh but you're not interested in GPU instanced, you want to override property, right ?

#

Then yeah check that box and follow the manual

#

And double-check if you're in v1 or v2

karmic basin
sage mulch
#

Thanks! I went ahead and enabled v2, enabled "Override Property Declaration -> Hybrid Per Instance" on my ShaderGraph's Property. I then wrote an IComponentData struct and System to interact with that struct per instructions. I then attached the AuthoringComponent of the struct to my GameObject and dropped a ConvertToEntity on it. The System seems to be running correctly (per the Entity Debugger) but the property doesn't change on the shader. Any thoughts on this?

#

(attaching some screenshots)

#

Also there has been no console output regarding a missing IComponentData struct (which the instructions says would happen) so I think it is being recognized, just not changed? nvm I think I'm wrong about this part, don't believe there would be any output

timber ivy
#

can someone explain the authoring workflow to me please?

#

the documentation is kinda vague and either it j ust magically works on its own or they are leaving some shit out

slim nebula
#

you put it in a subscene and everything in the subscene magically gets converted to entities

#

or you put a convert to component on it, and that converts it

timber ivy
#

what about [GenerateAuthoringComponent]

#

does that just generate a monobehavior you can use on prefabs

slim nebula
#

GenerateAuthoringComponent creates a monobehavior with the same fields as the component and adds the component to the converted entity from the fields

#

sometimes the generation doesn't work well and you need to write authoring manually but most times you dont

timber ivy
#

any benefits of using authoring over createarchetype if you dont need the editor serialization to edit the fields values?

slim nebula
#

the idea of authoring is converting developer editable/readable data into a format that's more efficient for the computer to process.

#

if the efficient way for the computer to process the data is just inherently readable then no you don't really need authoring

#

the idea is to allow fast development and fast runtime simultaneously by adding a small amount of boilerplate code

timber ivy
#

Thank you for all the info simoyd

#

appreciate you

slim nebula
ocean tundra
#

Is there any way to 'ask' if a entity has other components?
Eg If (EntityManager.HasOtherComponents<Component1, Component2, Component3>(entity)?

#

maybe something todo with archetype?

slim nebula
#

just .hascomponent for each component I think

#

pass in the entity that has the one component

ocean tundra
#

the issue is i'm building a tool/library, so i wont know about all the possiable user components

#

i only know about my components

slim nebula
#

hascomponent<YourComponent>(entity) will return true if YourComponent is on entity regardless if there are other components on entity

ocean tundra
#

yup, but i need to know if there are other user components on it

slim nebula
#

you want to iterate through components of unknown type?

ocean tundra
#

yea i guess

slim nebula
#

I think you'd need the architype for that yea

#

uhhhhhhh lemme look I think I have a vidja that had it

ocean tundra
#

all good

#

ill get digging into the archetype

#

can we use them in jobs?

slim nebula
#

uhhh I forget if you can use them directly or you might need to create a copied array of the data

ocean tundra
#

hmm

#

ill get digging in a bit

#

not urgently needed

slim nebula
#

yeah nope the code I remembered still requires the type to be specified. I dunno

#

why do you need to know if other components exist? Seems like some paradigm is being broken here

#

typically you'd be querrying data that you know exists

ocean tundra
#

ok so im working on networking stuff ๐Ÿ˜›
one of the things users will need todo is send commands (examples include, move unit command, build building, sync time)
some of those can be added directly to the player entity (those are nice and easy)
some will be added to entities a player control (eg unit move)
but some might be pure throwaway (eg chat, create new entity, attach chat command, attach target players)

the throwaway ones (event entities) should be cleaned up by my systems, BUT the commands attached to player entities (eg units) should not

slim nebula
#

you could make your components system components. then when an entity is deleted, the other components go away and only your system components are present. you could add one additional normal component that gets deleted that you can detect WithNone<>(). then you delete your throwaway components entities, and the other entities continue working fine

#

it sounds like a destructor pattern. system components do that

ocean tundra
#

hmmm maybe

north bay
#

Are you only looking for a way to clean them up?

ocean tundra
#

yea for now

#

ill try the system components

#

but if that dosnt work looks like EntityArchetype has a calculate difference method that might work too

#

ty for the idea

#

havnt really used many system components yet

slim nebula
#

I've been using them a bunch in pairs like that to handle clean up.

#

each system can have a pair of tag components to handle cleaning up instances of random junk, tracked by an entitiy

#

I have some animator instance stuff and some room instance stuff. I don't even known what all components are on there anymore. everything only worries about what it itself touches

ocean tundra
#

yea thats the best way

karmic basin
acoustic spire
#

Interesting finding
I replaced DynamicBuffers with components containing UnsafeLists (of size 4096) in my Minecraft clone and actually got performance boost.
I moved everything - blockTypes, vertices, indices, uvs

Storing blocks in DynamicBuffer:
 - Generating :
     total    9.7354 ms in 100 iterations
     avg    0.0973 ms
     max    3.6375 ms
     min    0.046 ms
 - Meshing :
     total    7710.938 ms in 100 iterations
     avg    77.1093 ms
     max    581.9719 ms
     min    50.339 ms
Storing blocks in UnsafeList:
 - Generating :
     total    8.455 ms in 100 iterations
     avg    0.0845 ms
     max    3.3248 ms
     min    0.0388 ms
 - Meshing :
     total    2053.0682 ms in 100 iterations
     avg    20.5306 ms
     max    82.3683 ms
     min    10.5827 ms
ocean tundra
#

with the dynamic buffers you were testing in a build?

#

well with both tests were in a build?

acoustic spire
#

No. Why I should?

ocean tundra
#

there are a TON of safety checks everywhere

#

but in builds they are all gone

karmic basin
#

@sage mulch they have samples scenes, you could try to compare with your setup, check everything is the same

acoustic spire
#

Ah. They can be turned off in editor. One moment

slim nebula
#

there's still stuff you can't turn off. build is much faster than editor

ocean tundra
#

yea true, but i wouldnt be surprised if theres still some unity safety checks somewhere that you cant disable in editor

acoustic spire
#

Is it possible to build Play mode tests too?

north bay
#

Huh, I haven't seen any checks that aren't guarded by enable_unity_collections_checks on the C# side so far

ocean tundra
#

im pretty sure theres some around burst

#

as in builds a exception inside burst code kills your app right? in editor it dosnt

slim nebula
#

i disabled every check I could find in the menus and it's still much slower than my standalone build

north bay
ocean tundra
#

not sure

acoustic spire
#

so, without safe checks and jobs leak detection

Storing blocks in DynamicBuffer:
 - Generating :
     total    10.6013 ms in 100 iterations
     avg    0.106 ms
     max    5.152 ms
     min    0.0386 ms
 - Meshing :
     total    3466.3829 ms in 100 iterations
     avg    34.6638 ms
     max    176.7178 ms
     min    19.2338 ms
Storing blocks in UnsafeList:
 - Generating :
     total    8.4996 ms in 100 iterations
     avg    0.0849 ms
     max    3.4231 ms
     min    0.0374 ms
 - Meshing :
     total    1971.4737 ms in 100 iterations
     avg    19.7147 ms
     max    104.2451 ms
     min    10.2631 ms
ocean tundra
#

My thoughts are for any performance stuff profile in builds, editor just adds too much stuff ๐Ÿ˜›

north bay
#

True, but the editor should be good enough for estimations

slim nebula
#

i mean. does that generating and meshing process change the architype of the entity that the buffer is on?

#

like a dynamic buffer will have it's initialization size in the chunk data

#

whereas your unsafe list would always exist outside of the chunk data right?

#

I think dynamic buffer tries to balance between those two extremes: 1) second memory allocation outside of chunk vs 2) limited size in chunk

#

whereas you know the exact requirements of your list

#

so I feel like maybe it makes some sense

ocean tundra
#

theres a attribute you put on dynamic buffers to tell unity where to put your data

acoustic spire
#

It'll take some for me to make this project be built but I got interested in that too. There is the bigger problem with UnsafeList that makes it unusable - I can't assign its data to Mesh since it has no API for pointer nor converting to nativearray

ocean tundra
#

InternalBufferCapacityAttribute

north bay
acoustic spire
#

any reference? I didn't find that

north bay
#

Let me look it up really quick

ocean tundra
#
    chunk along with other component types in the same archetype. When the number of elements in the buffer exceeds
 this limit, the entire buffer is moved outside the chunk.```
#

so a fixed size unsafe list is probably all inside the chunk right?

north bay
timber ivy
#

so you guys think dots vehicle physics is even remotely possible yet?

slim nebula
#

i mean all the math operations are available. What else would it need? project tiny showcases a racing game.

timber ivy
#

Well there are no wheel colliders in the physics api yet

#

how would I even begin to replicate that?

ocean tundra
#

dont lots of people just custom make those anyway

timber ivy
#

no idea

ocean tundra
#

what is there to a wheel collider? just keeping the main body up off the ground (suspension) and then they are the spots to apply forces from (which you can then use some math to work out things like grip)

slim nebula
#

that's very game specific

ocean tundra
#

oh and i guess turning, not really sure how to do that but again i expect thats just maths

timber ivy
#

prob pretty complicated maths tbh

ocean tundra
#

turns out you shouldnt be turning the wheel colliders anyway

timber ivy
#

you rotate them when you turn no?

#

also

ocean tundra
#

so i guess its just about applying some rotational force

timber ivy
#

ima look into this

#

idk anytime i've made cars i just rotated the front wheels to turn

ocean tundra
#

You do not turn or roll WheelCollider objects to control the car

#

right in the docs ๐Ÿ˜›

timber ivy
#

hmm

timber ivy
#

it works if you do it tho

#

LOL

#

or rather

#

worked in early unity 5 days

#

ig that ws quiet some time ago

ocean tundra
#

๐Ÿ˜›

timber ivy
#

oh rofl

#

thats right

#

there is a steerangle property

#

on wheel collider

#

so the docs are correct

#

can an entity have multiple of the same component on it?

ocean tundra
#

no it cant

#

can be a buffer component tho

timber ivy
#

yee

ocean tundra
#

are you still talking about wheels?

#

i would probably make them separate entities

timber ivy
#

really?

ocean tundra
#

yea

timber ivy
#

4 entities per vehicle wouldnt be an issue?

ocean tundra
#

i dont think so

#

they wouldnt be colliders, i would raycast down from each wheel, do some maths and assign the result into a component

#

then the car systems update after, read the result from every wheel, do something ๐Ÿ˜›

#

also if each wheel is a child entity its SUPER easy to have more or less of them

#

eg a bike or making a massive truck with 20 wheels

timber ivy
#

So

#

Do I have a wheel component as well as a wheel entity?

#

will the authoring workflow take care of this for me?

ocean tundra
#

of course

#

how else would you query for the wheels?

light mason
#

wondering if someone could help me with a question.

#

Is there anyway to know the entity count inside a lanbda

#

kind the equivalent of creating an EntityQuery and CalculateEntityCount per frame

#

basically i only want to run a Entities.ForEach if i have an entity count over 1

ocean tundra
#

@light mason ecs will already limit your On update to needing more then 1 entity

#

But you can do that calculate entity could and wrap the entities.foreach will a if

light mason
#

ok good to know

#

thank you @ocean tundra

karmic basin
#

@timber ivy Check the physics samples from unity

#

They made some vehicles work

#

like a truck

#

I think they tried a tank also if I remember well one of their Unite videos 1 or 2 years ago

gusty comet
#

i have question, its possible to use dots in Mirror/UNet networking? i mean if i have networkbehaviovur and i will convert that thing to entity and idk if that thing will break some things

gusty comet
#

or someone knows some networking which supports DOTS already

rare dew
#

there's DOTS Networking

rare dew
#

@gusty comet ^

gusty comet
#

its worth using that?

#

or its not stable af

deft stump
#

just like the rest of dots

gusty comet
karmic basin
#

Use World.DefaultGameObjectInjectionWorld to access the default world. @gusty comet

gusty comet
gusty comet
#

i mean old input values had Gameobject, World

karmic basin
#

now it's GameObject, GameObjectConversionSettings

#

Have a read on the manual to refresh your knowledge ?

gusty comet
#

what about blob asset store

gusty comet
#

also, any methods made in monobehaviovur should use ECS?

karmic basin
gusty comet
#

i mean like if method is executed every update

#

nvm

karmic basin
#

Yeah I don't get it

#

Systems have their own SystemBase.onUpdate() method. That's something else than MB.Update()

#

If that was the question ๐Ÿคทโ€โ™‚๏ธ

gusty comet
#

i speaking about something like, its 1 method and that thing is doing for example, get all entity and change value or something, then that thing should be done in ecs than just normal monobehaviovur?

karmic basin
#

Oh, you can access Entities package from MBs. But better do it from ECS systems

#

let's say you want to draw debug gizmos on entities transform, yeah you could plug a quick dirty code on a MB OnDrawGizmos, query entities from here to access their position and draw your gizmos.

#

But if you have entities, you want to go all in and process their components through systems

#

Otherwise what would be the point of entities in the first place ?

#

Mainly you would work on entities from MBs for the conversion system

#

or for authoring them easily from the editor before that

#

authoring their components* I mean

#

Hope that answers your question

#

Simplest way to iterate through entities and change value would be with a ForEach query first.

#

So again, read that manual before going further

#

If you're still lost, check the Unity official github repo, they have an "ECSsamples" that showcases main concepts gradually

merry fossil
#

hey y'all what's the current state of the DOTS visual scripting?
i heard it was abandoned in favor of bolt? hopefully not?

karmic basin
#

There's a forum post on that matter

#

Officially it's "still worked on" but they're gonna stop pushing updates and releases to us

merry fossil
#

i just looked at literally 5 forum threads and did not find that answer straightforwardly

karmic basin
#

Yeah and maybe a blog post for the future of visual tools

#

the idea is they want to merge ALL their visual graph tools to look the same (and have the same backend I guess)

#

I think they gonna keep both for some time, eventually merging at some point

#

But no real precise roadmap I'm aware of

merry fossil
#

jesus christ. so they're pulling an "okay we don't want to abandon or release anything, really, so we'll just put out 3 different versions" again?

#

like with the 3 different UI systems we now have

karmic basin
#

What killed it for me, is they stopped codegen since a few drops :/

zenith wyvern
#

There won't be any more dots specific vs solution afaik

#

Right now they're focused on bolt, eventually that solution will have dots support

merry fossil
karmic basin
#

codegen FROM VS, sorry

gusty comet
#

visual scripting can make dots easily or what?

#

but from comments about bolt its just not too good for performance

karmic basin
#

Well next Bolt version planned before Unity acquired them was improving performance and close to release, but they cancelled that to integrate it with Unity

#

People are angry about that :/

karmic basin
merry fossil
#

i wish they would just open source their engine and let people extend themselves. we would have such benefits ๐Ÿ˜ฆ

gusty comet
#

ohh no no

#

imagine open source

merry fossil
# gusty comet imagine open source

i do imagine open source, literally every day as a programmer. 99% of what i use is based on open source software (and so does everyone else)

gusty comet
#

not always open source means it will be good

merry fossil
#

of course there are "bad" open source projects with bad leadership. but there are extremely good benefits to open source. also: unreal literally did just that and it made their engine wayyyy more attractive to many devs

gusty comet
#

GhostAuthoringComponent got removed from netcode or what?

vagrant surge
#

the original visual script, before-canning version, codegened into burst C# systems

#

now they have two blueprint ripoffs

gusty comet
#

idk, in docs i see that thing exists

deft stump
#

go?

#

GameObject?

#

Why?

gusty comet
#

GhostAuthoringComponent

acoustic spire
#

Should these 2 blocks of code be equivalent? In both cases it will wait for all jobs completed, right?

// 1
_handle = Entities.ForEach((int entityInQueryIndex, Entity e) => {
// ...
}).ScheduleParallel(Dependency);
_handle.Complete();
// 2
Entities.ForEach((int entityInQueryIndex, Entity e) => {
// ...
}).ScheduleParallel()
#

Works differently for me

north bay
#

Those are not equivalent. The first says Schedule this and right after stall the main thread till it's completed.
While the second says Schedule this but let the main thread do other stuff.

acoustic spire
#

But I call Complete so it should block until jobs in foreach finish

#

ah, one min

#

So, I thought the 2nd actually wait for completion

acoustic spire
#

Can't get it. I'm trying to skip scheduling new jobs if there are still active jobs from previous update

void OnUpdate() {
  // Skip this update if we have active running jobs from previous update
  if (!_handle.IsCompleted) return;
  _handle.Complete();
  _handle = Entities.ForEach(...).ScheduleParallel(Dependency);
}

But getting error like it doesn't skip scheduling

The previously scheduled job MeshingSystem:<>c__DisplayClass_BuildingMeshData writes to the BufferTypeHandle<Game.ChunkMeshVertices>
sage mulch
#

From some more experiments it may be because I'm using trying to override the color of a SpriteRenderer. Maybe this isn't supported yet

safe lintel
#

dont think spriterenderer is supported by the hybridrenderer yet

zenith wyvern
sage mulch
acoustic spire
karmic basin
#

@safe lintel @sage mulch Sprite renderer is supported as a hybrid component, but I don't know if that support extends to overriding its properties ๐Ÿค”

safe lintel
#

If its a hybrid component its just gameobject land, hybrid renderer wont touch it. afaik material overrides arent part of either renderpipeline yet

pliant pike
#

is there a way of checking if a singleton buffer exists ๐Ÿค”

dark cypress
#

What are best practices for RNG?

I've seen a blog that suggested using a singleton array with 1k random instances, and throw them into parallel jobs based on thread index, but that feels weird.
Another approach is to dump random instances into components. And since IIRC it's just an int it shouldn't take much.

ocean tundra
#

@pliant pike HasComponent works for buffers i think

pliant pike
#

ok, yeah that means I have to first get the entity, I guess that's the only way

#

thanks

timber ivy
#

Would anyone mind taking a quick look at my github and see if im making any huge no nos with dots?

#

Also what is the steps to create a package out of your code?

ocean tundra
#

@timber ivy Did you find any steps/guides?

gusty comet
#

ECS already have animations/physics systems?

ocean tundra
#

check out the pinned message

#

yes to both

#

physics is in agood state

#

animations still very early

gusty comet
#

while looking at pure ecs soo, ECS means every thing should use entity system?

#

like static object in game

#

or dynamic

ocean tundra
#

yes to both

#

they are both 'pure' ecs/entities

gusty comet
#

soo if i want ECS then everything should use ECS?

ocean tundra
#

yes

#

you dont have too tho

#

theres hybrid options

gusty comet
#

yes i see, changing gameobject to entity and using still mb

ocean tundra
#

check out the docs in entities, conversion workflow, hybrid

gusty comet
#

i think while i have rooms in my game and if i tried doing pure ecs then uhm idk if that will work with multiple textures/meshes

ocean tundra
#

it will

#

thats the hybrid renderer