#archived-dots

1 messages ยท Page 242 of 1

coarse turtle
#

var handle = Job.WithCode(() => { }).Schedule();

graceful mason
#

@rustic rain

[UpdateInGroup(typeof(FixedStepSimulationSystemGroup))]
public class MapGridNeighbourManagementSystem : SystemBase {
#

but I think now, by default every system goes into that group anyways from my recent test

#

@coarse turtle I get, cannot assign void to inplictly typed variable

rustic rain
#

wait a second. What components will be in Instantiated entity from this prefab?

coarse turtle
rustic rain
#

so, looks like DOTS creates a lot of components itself

graceful mason
#

ok nice one thanks, I needed to be using Unity.Jobs

#

so last q, how to make it so nothing is waiting on it (e.g I can pick it up a few frames later without fps hits)?

rustic rain
#

I guess converted objects will have those components no matter what?

#

I removed everything from object, but it still has all those components I don't really need

#

I'm assuming I can remove all components I don't need in Convert()?

rustic rain
#
        //This will add our dependency to be played back on the BeginSimulationEntityCommandBuffer
        m_BeginSimECB.AddJobHandleForProducer(Dependency);

Any tip for exactly this is doing?

viral sonnet
#

Now that Unity announced that Hybrid is the way forward. How are you guys handling ECS Physics? I don't want 2 running physics simulations that need to be synced. Any straight forward MB implementation that uses ECS Physics for collision?

zenith wyvern
zenith wyvern
#

On the command buffer job managed by the ecb system

#

Basically it tells the ecb system that it needs to force complete all these jobs before it runs the buffer

rustic rain
#

oh, so by default it might run before this job is complete

zenith wyvern
#

Otherwise it will cause a dependency error

#

Pretty much, it has no way of knowing there's a dependency between the ecb system and your system since the ecb system runs on the main thread. so that's how you tell the safety system that there is a dependency

#

That's my understanding of it at least

haughty rampart
zenith wyvern
#

"Hybrid" basically just refers to the conversion system, everything at runtime should be pure entities

rustic rain
#

I feel like the best way to render things is pure code:
Calling DrawMesh() or DrawMeshInstanced()

#

But I might be totally wrong as I never even touched that subject yet

haughty rampart
viral sonnet
#

This means the scope of 1.0 includes strong conversion workflows allowing you to choose ECS for its value in solving specific challenges while leveraging GameObjects for other aspects of your production

zenith wyvern
safe lintel
#

@viral sonnet my somewhat current setup has skinned monobehaviour characters which have ecs physics attached to the bones for entity collision and entity ragdolls, not really sure if its straightforward but its not exactly difficult either, just a bit fiddly to setup

rustic rain
#

Any idea what is better approach to this subject:
For example there's a universal Velocity component, and movement system will move all those entities based on it.
But what if Some of those entities have VelocityModifier component, which shouldn't affect Velocity itself

#

My guess are either creating several systems WithNone and WithAll for this extra component

#

or maybe there's some other solution?

#

I doubt checking entities for components during job is any good

haughty rampart
#

why would velocity modifier not affect velocity???

rustic rain
#

It's just example

viral sonnet
zenith wyvern
#

That's kind of what it sounds like from your description

safe lintel
#

@zenith wyvern hybrid is a bit misused by unity imo, it can refer to anything that uses unityengine based things(ie hybridrenderer uses meshes and materials), as well as when people refer to actual monobehaviour components on entities

zenith wyvern
#

It lets you override certain systems based on extra components

haughty rampart
# rustic rain It's just example

ecs is very use case driven and logic defined. if it's a bad example, then solutions for it could differ extremely and the best solution is not even among them

viral sonnet
#

yeah, the hybrid term is very vague with the Hybrid Renderer. Not sure why it's even called HR when it's pure ECS

zenith wyvern
#

True, kind of pointless to argue over the semantics of what hybrid even means at this point

viral sonnet
#

I understand it as MB + ECS

zenith wyvern
#

Unity has kind of mashed the meaning into nothingness all on their own

safe lintel
#

@viral sonnet yeah but tbh Id like to ditch it because it makes pooling & saving more complicated(for my inferior brain)

haughty rampart
coarse turtle
#

im kind of glad that class based component data still serialize decently w/ subscenes ๐Ÿค”

haughty rampart
safe lintel
#

actually that term has been nebulous from the start, unity were referring to it when the initial proxy components existed

#

so it kinda stuck with the community I guess

zenith wyvern
#

And then they were seemingly using "pure dots" as an actual thing, which is no longer an actual thing as far as they are concerned

safe lintel
#

good old GameObjectEntity

#

@zenith wyvern yeah

haughty rampart
safe lintel
#

and im just explaining how its definition has been used and varies by person to person @haughty rampart

haughty rampart
#

and i stated unity's latest definition of hybrid workflow

safe lintel
#

my comments werent directed at you when I mentioned this previously

rotund token
#

not actually attaching components to entities

rustic rain
#

I don't get it, it updates so fast, it's actually inactive most of frames?

#

I have 2000 objects, I kind of assume that there's should be at least 1 per frame that gets removed

rotund token
#

if it says not run it means no entity query matched

#

it didn't even call update

rustic rain
#

yeah, that's what I mean by "too fast"

#

still "not run" with 20k

#

funny, I really think it's a bug

#

Impossible that most of frames are without queries

viral sonnet
#

put a Debug.Break or Log in the system. You will not catch it in the Entity Debugger

rotund token
#

not trying to take a dig at you more a frustration at work but, why do devs always jump to, there's a bug in the library/compiler first instead of a bug in their own code ๐Ÿ˜

rustic rain
#

nature of most ppl I guess xD

rustic rain
#

it's just funny it's not getting caught by debugger

rotund token
#

yeah but if it only runs 1/30 frames you'll never see it here

#

he's suggesting a debug to show how often it runs

rustic rain
#

ah

rotund token
#

if you debug the framecount you'll know exactly the frames it runs

rustic rain
#

Is it safe to call debug from different threads?

viral sonnet
#

exactly, it's impossible to catch 1 frame systems in the debugger unless you step through every frame and look for it

rotund token
rustic rain
#

2 seconds

#

oh wait

#

I forgot frame count

rotund token
rustic rain
#

How to get some kind of unique per frame value?

rotund token
#

Time.frameCount

#

(not this.Time you need UnityEngine.Time)

rustic rain
#

frameCount can only be called from main thread kek

#

ok

rotund token
#

why is it not being called from main thread

rustic rain
#

I'll just assume it's the way it is, because it's threaded

rotund token
#

you're testing how often the system runs

#

all you care about is the log in the systemUpdate method

#

not in your job

rustic rain
rotund token
#

OnUpdate is only run if there is a matching query in the system

#

if there is no matching query, it shows not run

#

i.e. your above picture

#

if its run, it will always have a time

rustic rain
#

but how does it know if query is matching before running OnUpdate()?

rotund token
#

it's all handled in systembase

#
        {
            var state = CheckedState();

#if ENABLE_PROFILER
            using (state->m_ProfilerMarker.Auto())
#endif
            {
                state->BeforeUpdateResetRunTracker();

                if (Enabled && ShouldRunSystem())
                {
                    if (!state->PreviouslyEnabled)
                    {
                        state->PreviouslyEnabled = true;
                        OnStartRunning();
                    }

                    state->BeforeOnUpdate();

                    var world = World.Unmanaged;
                    var oldExecutingSystem = world.ExecutingSystem;
                    world.ExecutingSystem = state->m_Handle;
                    try
                    {
                        OnUpdate();```
rustic rain
#

uuugh, I wonder how it'll interact with Harmony patches

rotund token
#

a lot of stuff goes on before OnUpdate is called

#

if you want the system to always update regardless of query, add [AlwaysUpdateSystem] attribute

rustic rain
#

well, system runs about 40 frames per second

viral sonnet
#

hm, why is Convert To Entity with "Convert and Inject GO" not intended for childs for a GO in normal scene. How should this be handled?

#

seems I've to use manual conversion instead

rotund token
#

(there is a chance ConvertToEntity does not exist in 0.5; been deprecated for 2 years)

#

(i should actually go ask unity this)

viral sonnet
#

i would use subscenes but MBs get removed in builds

rustic rain
#

MBs?

viral sonnet
#

MonoBehaviours

rotund token
#

consider how much you like performance, surprised you use MB ๐Ÿง

viral sonnet
#

demo usage ๐Ÿ™‚ I want to support MB spellcasters

#

for animation, movement, etc...

#

is there any intended way currently for GO conversion other than subscenes?

remote crater
#

Is it possible to have a Singleton accessed by many JobComponentSystems and SystemBases?

#

For example, I want to apply damage to entities

remote crater
#

I think writing one damage apply ( armor/shields/etc adjustments)

#

So I just have to make hacky ugly bad style screw design patterns for now

#

I can make ugly code if that ain't available now

rotund token
#

Is it possible to have a Singleton accessed by many JobComponentSystems and SystemBases?

For example, I want to apply damage to entities

Sorry I'm not seeing the connection between your question and example. [You can use GetSingleton in any system, though if you ever edit this you should use GetSingletonEntity and get the actual component in the job]

viral sonnet
# rotund token no

huh, so when considering MBs are not saved in subscenes, there's no real intended way for hybrid then other than the soonish deprecated ConvertToEntity. Man ... haha

rotund token
#

how are gameobjects not saved (via hybrid components which is now deprecated but we can come back to that)

#

lights etc on gameobjects in subscenes etc load in builds

#

personally my approach @viral sonnet would not to be to convert the gameobject part at all

zenith wyvern
rotund token
#

just build a gameobject view data base and put a component/key on the entity in the subscene

#

and instantiate/match them at runtime

remote crater
rotund token
viral sonnet
#

attached MBs on subscene GOs were not loaded. I have not tested adding them manually

rotund token
zenith wyvern
#

It's all I used up until I stopped developing in Unity, which was still the latest version. Subscenes are not well documented enough

rotund token
#

but this is deprecated in 0.5

#

anything not marked as a hybrid component is stripped in subscene

viral sonnet
rotund token
#

(but again not a good idea going forward ๐Ÿ˜… but it should still work in 0.5, but removed in 1.0)

remote crater
#

I gave up making subscenes work yesterday due to no one knowing what was going on. I pull all my scenes in the main scene and enable/disable em now for a hack.

rotund token
remote crater
#

ty tertle

#

a struct?

#

will do

#

This will save me hundreds of hours over the next few years.

rotund token
#
{
    public BufferFromEntity<DamageInstance> DamageInstances;
    
    public void DealDamage(Entity entity, int damage)
    {
        DamageInstance[entity].Add(new DamageInstance {Value = damage});
    }   
}```
remote crater
#

Well maybe a hundred cuz I'd refactor when I saw it becoming a mess

#

WHOA

rotund token
#

you can pass this struct to multiple jobs etc

remote crater
#

I know how to use a struct ๐Ÿ™‚

#

You're a boss tho

#

for bustin out straight 'zample code!

#

Remember, track me down at paradise city and get your greenbacks in a manilla gorilla envelope

rotund token
#

i'm not always the best at explaining things and personally find code examples much easier to understand

remote crater
#

100% yah

#

I understood you with struct

#

I was just impressed

#

you went full on example

#

Thats what a boss does

#

You a boss

viral sonnet
rotund token
#

hybrid is just being marked as internal only pretty much

#

sounds like issues supporting it except for specific components

#

they say to just use managed component data

#

but yeah i'm not sure if there's anything in place to handle the gameobject lifecycle

viral sonnet
#

your game doesn't run on the HR, right? How are you handling this right now?

rotund token
#

my personal game or at work?

viral sonnet
#

at work

rotund token
#

oh no, we don't use conversion at all

#

was written so long ago

#

it's horrible

viral sonnet
#

and your personal one uses HR?

rotund token
#

yeah i only have 2 gameobjects
a direction light
and a UIDocument script

viral sonnet
#

so you're using the animations package successfully?

rotund token
#

haha no, my game currently has no animations. that's future package update problem

#

i've intentionally just not worked on that area at all

viral sonnet
#

hehe, i see. I'm at a point where I got to get some animations though. This part sucks ass

rotund token
#

sorry i kind of lied

#

i do have idle animations playing through animation package but that's about it

#

but yeah most of the code i write myself is more libraries, i don't care that much about actual game implementation

remote crater
#

yah tertle buddy, worked

rotund token
#

i'm a bit weird, i'm all about game architecture

remote crater
#

I'm launching my MMO today or tomorrow

#

I'm beyond weird then

#

Cuz I'm not just architecture

#

I'm about it looking pretty

#

and speed

#

People know me as one of the fastest prototypers out there

#

yet my architecture is super boss too

#

You can tell the difference between a software architect and a software maker

#

the larger the project, the more it is easy to expand for an architect

viral sonnet
#

as I'm building an asset foremost, I'm puzzled how to deal with this. Investing into a deprecated workflow makes no sense but not sure how far the animations package is off. from the blog post it doesn't look to good when they imply we are still able to use GOs

remote crater
#

for a regular software engineeer/coder, often stuff falls apart like a house of cards built on a tower of jello

rustic rain
#

hmm, how New Input System is supposed to interact with DOTS?

zenith wyvern
#

It isn't

#

Not any time soon anyways

viral sonnet
#

sampling in main thread and writing to structs

rotund token
#

if you're interested

safe lintel
#

@viral sonnet im sorta at the verge of canning my old mecanim characters in favor of using the dots anim package, depending on what you specifically need for animation it may already suit your needs. currently events dont exist, and not sure if statemachines exist either.

rotund token
#
    public class InputDefault : IComponentData
    {
        public InputActionAsset Asset;

        public InputActionReference CursorPosition;
        public InputActionReference Move;
        public InputActionReference PrimaryAction;
        public InputActionReference SecondaryAction;

        public InputActionReference CameraTurbo;
        public InputActionReference CameraMove;
        public InputActionReference CameraMoveY;
        public InputActionReference CameraLook;
        public InputActionReference CameraLookMouseEnable;
        public InputActionReference CameraLookController;
        public InputActionReference CameraZoom;
    }```
the reference component is created in a subscene
originally i sampled on update but i decided to stick with the intended inputsystem event approach
remote crater
#

The best way to do it

#

is tokeep your old player controller for gameobjects

#

then just load in the entity pos/rot/velocity, map to gameobject, controil game object with old player controller, then set rot/velocity/etc (not position)

#

Then what happens is

#

You can have your old gameobject style game with its hundreds of levels or whatever

#

and start adding new levels

#

and still have your player act normal

#

just make new enmies

#

its the proper software architecture, like no one knows it

#

I posted the holy grail video about this, and no one seemed to care

#

if anyone wants me to drop it, its an hour long video saying the same thing over and over in different ways

#

I'll conciseify it later once my mmo is outs oon

#

If you understand this video, you do not need to make new games from scratch. You can simply use your gameobject games and entityfy new levels with em. I apologize for this video being extremely rambling on, but I was also doing some dev and I plan on getting you a great video soon, but to some, this will be a God send Holy Grail of Dots ECS ...

โ–ถ Play video
#

For people who dork out over software architecture and wish Dots/ECS could be used in everyone's old GameObject games... You'll be stoked.

#

DOTS/ECS is marketted too hard towards making entirely new games.

#

Its like no one figured this out but me.

rotund token
#

my controversial take is a bit different - you shouldn't use entities if you're writing a hybrid game

#

just use monobehaviours and existing well developed libraries and write jobs for critical code

remote crater
#

By saying this, you do not know what I present

#

The only monobehavior in this is the playercontroller

rotund token
#

i'm basing this off having actually built a hybrid game released it

remote crater
#

Yes

rotund token
#

and it was a huge mistake for my company to rewrite their game with entities

remote crater
#

You don't get it man...

#

Everyone thinks that

#

Because they didn't watch this video

#

I actually have invented an ENTIRELY NEW thing

rustic rain
remote crater
#

Literally, no one on the planet, but me posted this.

#

So, yes, its a huge headache

#

If you try any way but this way, I know this.

#

This is the Holy Grail of hybrid game solutions.

zenith wyvern
rotund token
# rustic rain I don't really get what's going on in OnUpdate besides putting some data in sing...

That's the input result that various system use

    {
        /// <summary> Point in screen space. Screenspace is defined in pixels. The bottom-left is (0,0); the right-top is (pixelWidth,pixelHeight). </summary>
        public float2 ScreenPoint;

        /// <summary> Point in viewport space. Viewport space is normalized. The bottom-left is (0,0); the top-right is (1,1). </summary>
        public float2 ViewPoint;

        /// <summary> Is the cursor currently inside the view port. </summary>
        public bool InViewPort;

        /// <summary> A ray going from camera through the current <see cref="ScreenPoint"/> using <see cref="Camera.ScreenPointToRay(Vector3)"/>. </summary>
        /// <remarks> Displacement is set as a unit vector. </remarks>
        public Ray Ray;

        public bool InputOverUI; // TODO

        public ButtonState PrimaryAction;
        public ButtonState SecondaryAction;
    }```
#

wait this one is probably an easier example

    {
        public float2 Move;
    }```
#

Move is just say controller stick, or wasd

#

any system can read it, player controller, camera controller, map controller etc whatever

#

depending on state of your game

viral sonnet
rotund token
remote crater
#

I have a .zip of an older build

#

And a youtube

#

Its a just a concept

rustic rain
#

so, basically when any move button is pressed, you assign data to singleton and once it's not you assign it to 0,0

#

and all your Character Controller systems are simply accessing that singleton?

rotund token
remote crater
# viral sonnet any github, repo link?

Concept is this: Code your playerController once in monobehavior. Map the entity to the gameobject not being rendered or collision detection. Then take in position/rotation/velocity from Entity at start, processess player controller, output rotation and velocity to entity after.

viral sonnet
remote crater
#

So as you change the player controller, it changes it for your old GameObject Only maps and your future Entity Only maps later.

#

You code one and done.

rustic rain
#

Somebody here asked

#

whether it's ok to call Singleton a lot from different systems

rotund token
#

i hate to say it, but that sounds like the default (and only) hybrid approach gnj

rustic rain
#

I actually now wonder if it is, kek

viral sonnet
#

yeah, we are doing this for years ๐Ÿ™‚

rustic rain
#

ALlthought seems like it's just fear out of nowhere

rotund token
#

i'm not seeing what's special about this?

rotund token
remote crater
#

You can watch the video, I explain it for like 45 minutes straight. This is very very very huge for anyone who has an old game they want new levels with entities, but don't want to rewrite their player controller: https://www.youtube.com/watch?v=GIEV14B20Pc&t=780s

If you understand this video, you do not need to make new games from scratch. You can simply use your gameobject games and entityfy new levels with em. I apologize for this video being extremely rambling on, but I was also doing some dev and I plan on getting you a great video soon, but to some, this will be a God send Holy Grail of Dots ECS ...

โ–ถ Play video
rotund token
#

GetSingleton actually creates a sync point on writers

#

GetSingletonEntity
then using GetComponent in job avoids this sync

rustic rain
#

oh, so it might ruin perfomance by overusing?

remote crater
#

going back to coding.

rotund token
rustic rain
#

you mean size of data matter in this case?

rotund token
#

no, the logic you're executing on your writes

#

say you're generating a giant density field and then write it to a singleton, if you call getsingleton on onupdate you need to wait for that field to be finished generating

#

if you getsingletonentity and then do the get in the job, no main thread sync, the job will be scheduled to after the density field generation occurs

#

most of the time it doesn't matter, it's just that a lot of people overlook getsingleton is really just a entitymanager.getcomponent

#

so same sync rules apply

viral sonnet
#

I'd recommend not using Singleton entities unless for a very specific reason. The alternative is a public field in your system which you can access from other systems too

zenith wyvern
#

It's fine as long as you're aware of how your data is being accessed

rotund token
#

tertle's 4th rule of entities development. Systems should never access other systems
the beauty of ECS is the decoupling of code

zenith wyvern
#

It's literally the same as writing a query for a component

#

Except you know, only on the main thread, unless you use the CDFE like tertle said

rotund token
#

they're all in my head ^_^'

hot basin
#

:<

zenith wyvern
#

I want to know what the last rule

#

Is

rotund token
#

you should avoid single component singletons due to wasted chunks

zenith wyvern
#

And the second last rule

rotund token
#

it's an infinite list that keeps expanding the more i read code people write

hot basin
#

i'm struggling with ECS hard, i suppose to not have references, so everything should be processed by "ticket"/event systems?

rotund token
#

events are controversial and can be abused really easily

zenith wyvern
#

I guess we should be worried if any of our code inspires one of these rules

hot basin
#

like "AttackComponent" with attacker and target?

rotund token
#

events really depend on what scalability you want to achieve

#

(also a lot of the time are just abused and used poorly)

hot basin
#

so how I should manage finding and attacking other units?

rotund token
#

that's a loaded question ^_^'

#

could be here all day

hot basin
#

anything else I came with is huge system with multiple jobs, like 1 job looks for nearby enemies and second one attack with intermediate data between with whatever form I need

#

so result of that system would need one structural change at the end

rotund token
#

so result of that system would need one structural change at the end
Why

viral sonnet
#

structural changes are not good

hot basin
#

sorry my bad, not structural change but ECB set component

rotund token
#

not ideal (depending on what you're doing) but much less bad
what in particular are you struggling to implement? Targeting? Dealing damage?

viral sonnet
#

you might want to look into alternatives to handle this like NativeStream for example. 1 frame data that just gets chained from one job to another is not fit for entities

hot basin
rotund token
#

without going into like, best practices or optimal performance ideas etc
would you just not have a basic 'Target' Component which simply has a reference to the entity your targeting

#

then the attack system can attack it, damage it etc

hot basin
#

but it uses entity refereence

#

and it needs a check

#

seems like something I shouldn't do

viral sonnet
#

often you can't linearize non-linear algorithms

rotund token
#

(side note, I consider the lack of safety on entity references to probably be the biggest flaw in entities atm)

#

by default with how they are used it's hugely problematic and performance limiting

#

i guess lifecycle management would be a better term

viral sonnet
#

true

rotund token
#

the push for static archetypes solves half the problem, but not the destroyed part

zenith wyvern
#

One of my more fun bugs was trying to track down an ecb accessing a destroyed entity. You get zero help at all

#

"The entity is destroyed". Thanks Unity. Thank you.

viral sonnet
#

entity.Exists check is very inconsistent. it's not in ECB destroy but it's in HasComponent

rotund token
#

i liked eizenhorn approach to avoid this and have adopted it

hot basin
#

and Exist uses EntityManager so it can't be bursted?

zenith wyvern
#

You can use BFE.Exists but it's very unintuitive

hot basin
#

it cannot be parallelised*

rotund token
zenith wyvern
viral sonnet
#

CDFE HasComponent can be used in burst jobs

rotund token
#

this way a destroy on an ECB can never break another ECB

zenith wyvern
#

Ohh, so you destroy in that ecb rather than destroying directly

#

Good idea

safe lintel
#

why not just use EndSimulationEntityCommandBufferSystem?

hot basin
#

because something may be writing to it

rotund token
#

System1 calls ecb.Destroy(entity)
System2 calls ecb.AddComponent(entity)

#

game crashes

#

by enforcing all your destroys occur after any other ecb calls, you don't need to worry about rare timing crashes

safe lintel
#

hm, surprised I havent actually run into this yet

hot basin
#

is there any way to have an array beside a dynamic buffer?

zenith wyvern
#

It only happened to me when I was trying to do parenting between entities. I stopped doing that and never looked back

rotund token
#

you can attach FixedList to components

rustic rain
#

Can't you just make your own system groups?

hot basin
#

but it's maxed at 4098

rustic rain
#

so you can put it's in correct order

zenith wyvern
rustic rain
#

and put all your destroy system in it?

rotund token
#

and then you luanch your game, start getting random crash reports with 0 debugging info

#

and spend weeks trying to track down a super rare timing bug

rustic rain
zenith wyvern
#

I really cannot stress how little info unity gives you when you run into this

#

It's literally just 'The entity was destroyed'

#

No info where it came from, nothing

rotund token
#

it's even worse in builds @zenith wyvern

hot basin
#

can't wait for new update, maybe it will help

rotund token
#

it just crashes with a really bad stack

#

or does it on the wrong memory then crashes the next frame

#

or at a completely random time because you've done something bad and corrupted your entity component store

safe lintel
#

another fun little refactor to do while waiting for 0.50

hot basin
#

so, entity references are good?

rotund token
#

they are required

#

i wouldn't say they are good ๐Ÿ˜…

coarse turtle
zenith wyvern
rotund token
#

i haven't implemented it, but my current project i'm looking at having only 1 shared entity reference (Target) then a buffer with any extra secondary references that all systems use

#

so the system that has a creature attack something uses the same target component as another system that the creature is mining wood

#

and then simply validating the target component at the start of each frame and then avoiding all checks on it

#

as a way to do this performantly and safely

#

again - not implemented yet, theory in my head

hot basin
#

I can't belive how much structural changes costs, it would be fairly easy to do this just by adding new component

rotund token
#

(but conceptionally it works really well with my AI)

#

at the end of the day @hot basin what's your scale and target hardware

zenith wyvern
rotund token
#

if you're only making a basic game, few hundred thousand entities and only doing a few dozen archetype changes a frame

#

it doesn't matter if you're not targetting like xbox one/ps4

rustic rain
#

what about mobile?

rotund token
#

depends on your game again

#

but phones are much better than old consoles now

rustic rain
#

you mentioned consoles, I just think whether mobile have anything related to that statement too

rotund token
#

but i don't do mobile development so i haven't experimented with it

untold tree
#

Is there a way to have a local copy of the DOTS packages so I don't have to download them each time I start a new project?

rotund token
#

whereas my life at work atm is making ps4/xbox one work

zenith wyvern
#

Do dots projects even export to mobile?

rustic rain
#

well, they do have build package

#

so I assume they do

hot basin
untold tree
rustic rain
#

Besides megacity showcase was presented on iphone

rotund token
#

appdata Local\Unity\cache\packages\packages.unity.com

#

all your package cache exists there

hot basin
untold tree
#

Oh... I see there. I was doing it from a different location.

#

Let me try again

zenith wyvern
#

Have they mentioned tiny at all in the recent news push?

#

I haven't really been following it

hot basin
#

nope

untold tree
#

Thanks

zenith wyvern
#

There must be a lot of stories about all the project starts and stops that have happened around dots. Poor tiny

hot basin
#

it had strange niche

rustic rain
#

Playable ads

untold tree
#

When will it reach beta?

hot basin
#

I looked it up only to check sprite renderer integration with DOTS

zenith wyvern
#

Making dots games that worked in a browser could be a massive benefit, for things like game jams even

#

But yeah, seems like it never got off the ground...again

untold tree
#

I actually need to use it.

coarse turtle
#

Tiny was interesting since it used bgfx to handle the rendering and miniaudio to handle the audio playback ๐Ÿค”

hot basin
#

do you guys use hybrid renderer?

zenith wyvern
#

In my game I kind of did. It was just a single hybrid entity with a big mesh that I redrew every frame

#

Not really typical usage I guess

hot basin
#

I was using it until 2021 got some shader features I needed

#

and I ended up with my own GPU skinning with GPU animation instancing

#

I wonder what UT will offer in this area

safe lintel
#

yes, though i feel trapped with 2020 and lack of point light support in urp

hot basin
#

in the end I even write my own mechanim-like animation graph as animator is slow as hell

safe lintel
#

hybrid with 2021 and urp deferred was working fine until like b12 or something, and then of course, the stay on 2020 announcement

hot basin
#

I mean I wonder if I'll benefit from this because UT seems to be not interested with this area much

rotund token
#

i use HR (hdrp) in 2021.2.7f1 fine

#

though i haven't tested builds

zenith wyvern
#

Are the SRPs actually in a usable place now? I feel like they were in limbo for years

safe lintel
#

i really dont know what their plans are, but that recent post did mention they wanted to make the sample projects showcasing specific use cases for 1.0, nordeus crowd sim was one of them so I have to imagine they might be considering updating that gpu animation package?

rotund token
#

i'm hoping the animation package is getting some love

safe lintel
#

or maybe it will just be an official example showcasing unofficial workflows to be forgotten to the wind like occlusion probes lol

rotund token
#

considering they said the animation team was basically dropping stuff in 2021 for it ๐Ÿ˜

#

if we don't see something in 0.5 going to be massively disappointed

#

animations by far the thing that's always held pure implementations back

safe lintel
#

by dropping stuff you mean just no public updates statement?

hot basin
rotund token
#

honestly i know a lot about future dots plans... except animations

#

black box on that one

rustic rain
#

what is even animation? in terms of data

hot basin
#

main thing I'm waiting for is enable/disable of components

rotund token
#

keep waiting ๐Ÿ˜…

hot basin
#

but seems it will not be in 0.50

rotund token
#

i don't understand how unity didn't realize this concept was hugely problematic from the start

hot basin
rotund token
#

there are so many issues with it

rustic rain
hot basin
#

number of bones * number of frames big

rustic rain
#

well, I can see how it can be done directly through code then

safe lintel
#

@rotund token what specifically do you have issue with the animation package atm? scalability or something else?

hot basin
#

I probably could minimize it to keyframes and blend, but why bother

rustic rain
#

after all, everything will just come down to different matrix4x4 for mesh

safe lintel
#

like lack of ui? ๐Ÿ™‚

rotund token
#

i want designers/artists to be able to use this package, not programmers

rustic rain
#

oh yeah, I didn't think of it

safe lintel
#

well at least that definitely seemed like it was around the corner

hot basin
#

like Epic does

rotund token
#

i think fundamentally the concept of enable/disable on every component is potentially flawed

#

and should be an optional interface

#

90% of my components i'm never going to enable/disable

hot basin
#

yeah I think the same, probably should be avaiable only for tags

rotund token
#

so it could potentially be doing millions of checks a frame for something that is not needed

#

(that said, who knows how they've implemented it)

hot basin
#

and potentially tags shouldn't be counted in archetypes

rotund token
#

that's a bit breaking

#

for optimized algorithms

safe lintel
#

im not sold on the idea that component sets should be relatively static

hot basin
#

i.e. I have unit, ad that unit will be doing same few things over and over so I would like to have static data and something to tell me it's behaviour

rustic rain
#

you either have data to use or you don't

safe lintel
#

i just think for certain procedural games, changing components at runtime just seems like a more ideal workflow than having everything known beforehand

rustic rain
#

you shouldn't have any data you don't use

hot basin
rotund token
#

my data is not where i want it to be anymore

#

for simd

#

(this is actually the other flaw on enable/disable components, it breaks this)

#

and then they talk about optimizing this by grouping disabled components

#

at which point, you're making structural changes anyway ๐Ÿค”

hot basin
#

yeah, you're right

rotund token
#

hence i have so many questions

rustic rain
#

why avoid structural changes tho?

worn valley
#

Is the enable disable components tied to the networking in ECS

rotund token
#

structural changes kill performance

hot basin
#

bookkeeping is costly

rotund token
#

it limits your working entity count from 100,000s to 1000s

worn valley
#

cause somewhere I read that you can't change components on networked entities

rotund token
#

yeah netcode requires a base static ghost archetypes

#

you can add/remove components (that aren't ghost components)

#

but these won't be serialized

worn valley
#

That is too bad. Seems to break the point of ECS

hot basin
rustic rain
hot basin
#

everything else works as always

rotund token
#

but your data is now not simd friendly

#

unity have publicaly stated they are looking at grouping enabled/disabled components so they would restructure your chunk to
enabled, enabled, disabled, disabled

#

so now your data is friendly

hot basin
#

but as far as I know this is not a structural change but part of the bookkeeping

rotund token
#

by structural change i just mean your data is changing

#

it's doing a memcpy

hot basin
#

I mean that copying entities between chunks is not nessesary

rotund token
#

thats really all adding/removing components is doing if you are swapping between 2 chunks

#

it's the exact same cost as long as you do not need to create new chunks (which does happen a lot)

hot basin
#

but doesn't need those checks

#

just memcopy inside chunk

#

but yeah that needs a lot more than a bitmask

rotund token
#

but you just know people are going to abuse it and make 1000s of enable/disables a frame

hot basin
#

but it's missing the point if it will cost alot

rotund token
#

nearly the entire cost of a structural change

#

is the memcpy

#

ok sorry im saying this wrong

#

i'm saying, if the chunk already exists

#

its nearly just as fast to do it

zenith wyvern
#

Doesn't a structural change force all jobs to complete immediately

hot basin
#

yeah, to prevent race conditions

#

but you are doing it in ECB as a sync point

rotund token
#

the big cost of structural changes is it creates huge amounts of new archetypes and chunks

#

if you managed to organize your code in a way that you only made structural changes that moved components between existing chunks, you could scale this without too many issues

hot basin
#

there should be a way to tell "keep this chunk" in common archetype case

#

you can probably tell ahead of time which archetypes will be used

rotund token
#

anyway way off topic the point was just that, enable/disable components are way more complicated than unity thought and that's why it's taken 18months and counting instead of the original 3 week estimate

hot basin
#

but now it seems that enable/disable components as a thing could be a wrong approach

rotund token
#

in theory it's very ideal right

hot basin
#

but why, you are doing in best case scenario same work as structural changes

#

with a lot of additional work

rotund token
#

stops archetype explosion

#

side note, the more archetypes you have the slower your queries become which effectively slows down all your systems

#

though i believe there is some major improvements to this in 0.5

#

with system queries caching the chunks

hot basin
#

I hope it brings something good

rotund token
#

way back when i joined the company i work at now, they just did the classic approach of constantly add/removing components

hot basin
#

samples included

rotund token
#

ended up with 100k+ archetypes and counting

hot basin
#

as there is not much of learning material now

rotund token
#

the entity queries became incredibly slow

#

something like 6ms/frame was just getting entities for queries

#

(hmm may be slightly miss-remembering, that 6ms might have been when i pushed it over 1mill archetypes. i think it was closer to 1-2ms actually)

hot basin
#

6ms? and no one did anything with it?

rotund token
#

but anyway, it was a measurable performance problem

rotund token
#

still more than we'd like

#

i think we need to increase archetype space by 1.5x

#

unity only allows between 8-12k archetypes before running out of memory

safe lintel
#

how do you count how many archetypes exist?

rotund token
#

these days i've added it to my debug toolbar ๐Ÿ˜„

#

so i dont forget how to do it

hot basin
#

oh nice window

rotund token
#

so i can quickly load up the source code and tell you!

hot basin
#

EntityManager.Archetypes?

#

something like that i think

rotund token
#

EntityManager.GetAllArchetypes()

safe lintel
#

ahh cool

rotund token
hot basin
#

ui toolkit?

rotund token
#

yep

#

i write all my debug code so it can run in development builds

#

and this toolbar controls it all

#

scales the camera etc to not obstruct view (can be minimized)

hot basin
#

so it's like SR debugger but for DOTS?

rotund token
#

technically its not just for dots

hot basin
#

do you instantiate different view for non dots project?

rotund token
#

i don't do non dots projects

hot basin
#

is there a company that do only DOTS?

rotund token
#

we only do DOTS

#

but this toolbar is my personal library

hot basin
#

nice! best workplace ever

rotund token
#

but yeah, you just create a system, inherit from ToolbarGroupSystem, point to a Visual element and it's basically all done

#

its nice in the sense you can put your system in client or server

#

and it will only show if the server/client world runs etc

#

and if you shut it down removes from the bar

#

all the good stuff

#

(i love debugging tools)

hot basin
#

I think I like tools in general

#

It seems I'm making only them lately

rotund token
#

i just like writing tools, frameworks/libraries that makes other developers/designers/artists life easier

#

i don't care so much about writing say, a complex level editor

#

i'm just trying to make this library the most developer friendly experience you could imagine

#

maximum workflow

hot basin
safe lintel
#

that physics debug is beautiful

rotund token
safe lintel
#

current physics debug is just horrid, no sorting hurts my brain

rotund token
#

and i want something i can use in development builds

#

as much as i try to discourage it, management and QA just love testing in builds instead of editor ๐Ÿ˜

hot basin
#

then how do you draw your debug?

rotund token
#

i have a whole drawing library

#

that works from burst

hot basin
#

but what you call to draw?

rotund token
#

sorry what do you mean?

#

like to render it on screen?

hot basin
#

yeah

rotund token
#
            RenderPipelineManager.endCameraRendering += this.RenderPipelineManagerOnendCameraRendering;```
#

depending whether its using new SRP or old pipeline

#

i just inject it into the render pipeline with a commandbuffer

#
        {
            this.commandBuffer.Clear();
            this.BuildFrame(camera, this.commandBuffer);

            context.ExecuteCommandBuffer(this.commandBuffer);
            context.Submit();
        }
hot basin
#

RenderPipelineManagerOnEndCameraRendering* ๐Ÿ˜„

#

so it's just some mesh to render?

rotund token
#

what can i say, i'm a sucker for auto generated naming ๐Ÿ˜„

rotund token
hot basin
#

strange that IDE don't scream at you

rotund token
#

i just forgot to rename it

hot basin
#

thank for explanation! it's quicker than gizmos?

rotund token
#

oh much much faster

#

magnitudes faster

safe lintel
#

how many archetypes does your current(steam) project use approx? just tested for my fps, 680ish in a small test scene

rotund token
#

but last i looked between 6-12k

hot basin
safe lintel
#

didnt you say you run out of memory at 12k?

rotund token
#

we edited the package to increase what's allowed

safe lintel
#

ah

rotund token
#

we were hitting 30k for ages at a somewhat acceptable amount

#

but yeah slowly got it down

#

i think we're still at 3x memory allowed for it

#

i think we only need 1.5x

#

but rather burn 20MB of memory than crash

#

if someone sits down and plays a 20 hour session

rotund token
hot basin
#

now I'm more interested in your rules ๐Ÿ˜„ should make a forum post for it

rotund token
#

i've been meaning to expand this drawing library a bit and support more types and features

#

been sitting idle for probably a year now

#

ive also been meaning to make it public

#

but it currently uses just a tiny snippet of proprietary code i need to rewrite

hot basin
#

yeah sadly you can't share much when made in the company

rotund token
#

its not done in company

#

all this is my own code

#

i share a lot of my code with my company, not the other way around ๐Ÿ˜„

hot basin
#

I made that mistake with my renderer

rotund token
#

(im not as much of a fan of the implementation from an entities perspective but it works in burst)

#

(it's included in a* pathfinding if you own a license)

#

i highly recommend a burst friendly drawing library, either aron or write your own. i don't think we've had a more useful debugging tool than being able to draw out data from burst jobs

hot basin
#

I'm hard case of "I'll make it myself" and made a HPA pathfinding myself

rotund token
#

drawing out pathfinding has been one of our best uses for it ๐Ÿ˜…

safe lintel
#

yeah aline is quite handy @hot basin

rotund token
#

oh yeah here you go, aline has a benchmark which would pretty much match what im doing

#

comparing gizmos and yeah its legit this different

hot basin
#

wow, nice

#

then probably I'll check it out

#

definitely saved, thanks!

safe lintel
#

would buy a native ecs 3d pathfinding project so fast if aron put one out. or anyone really

rotund token
#

i feel like if i wasn't so lazy, i'd have so many assets i could sell

#

because i have exactly that

safe lintel
#

frywallet.gif ๐Ÿ˜‰

hot basin
#

with our own navmesh?

#

or are you using unitys

rotund token
#

i ported recast to dots

#

then added pathfinding to it

#

i also have a version before this that used unitys navmesh

#

pretty sure i posted pictures of that on the forum like 18months ago

#

i added optimal reciprocal collsion avoidance to it

#

which runs amazing well, 200k entities at above 60fps and one day i'll solve my spatial query limitation and double that

#

so yeah, i have all this sort of jazz

hot basin
#

did you publish it somewhere on git?

rotund token
#

nope ๐Ÿ˜ฆ

#

i don't really like publishing stuff until i consider it production ready

#

or simple enough it doesn't matter

hot basin
#

good approach

#

how did you avoidance in parallel?

#

is that ORCA made with this in mind?

rotund token
#

that paper i linked supports it

#

the whole concept is each actor does half the work without communication

hot basin
#

oh nice! saving it for later

#

oh I know what should I ask

#

how do you keep you map/graph for pathfinding

#

I ended up with field in the system

rotund token
#

for my navmesh?

hot basin
#

but I assume that is wrong approach

rotund token
#

as i ported recast it's basically all c++ like code

hot basin
#

I mean between frames

rotund token
#

oh

#

dont have my project open atm and its been a few months but from memory it's likely just stored as a pointer on the system (or on a singleton cant remember)

hot basin
#

dynamic buffer with nodes seems wrong but it's the only way besides unsafe magic that will work

rotund token
#

oh yeah it's stored so i support multiple navmesh worlds

#

for different actor types right

#

you might not like this but, this is how it's stored on a component

#
    {
        private readonly NativeArrayProxy<NavMeshWorld> worlds;

        [NativeDisableUnsafePtrRestriction]
        private readonly AtomicSafetyManager* safetyManager;

        internal NavMeshWorldsProxy(NavMeshWorlds world, SharedSafety sharedSafety)
        {
            this.worlds = new NativeArrayProxy<NavMeshWorld>(world.Worlds);
            this.safetyManager = sharedSafety.SafetyManager;
        }

        public NavMeshWorlds ToNavMeshWorld()
        {
            return new NavMeshWorlds { Worlds = this.worlds.ToArray(this.safetyManager) };
        }
    }```
#

i have this concept of native container proxies

#

basically it lets me store native arrays on components

#

then rebuilds the safety in the system that needs it

hot basin
#

I don't speak in unsafe ๐Ÿ˜„ sorry

rotund token
#

so yeah, to answer the question
it's NativeArray<NavMeshWorld>
stored on a singleton

hot basin
#

singleton monobehaviour?

rotund token
#

singleton entity component

#

NavMeshWorldsProxy : IComponentData

hot basin
#

so it's unsafe ptr to native array?

rotund token
#

not exactly

#

so these native proxies are actually a concept i kind of yoinked from the physics package

#

any other system simply goes GetSingleton<NavMeshWorldsProxy>().ToNavMeshWorld()
which is basically just a wrapper for NativeArray<NavMeshWorld>

viral sonnet
#

why is RaycastInput so damn weird? it only has start/end ??

rotund token
viral sonnet
#

lol google sent me to an old doc haha

rotund token
#

so raycastinput just converts to a ray internally for use

#

and ray says this

#
    /// This struct captures the information needed for ray casting.
    /// It is technically not a Ray as it includes a length.
    /// This is to avoid performance issues with infinite length Rays.
    /// </summary>
    public struct Ray```
#

unless your question was you wanted other features?

#

not the fact it uses start/end

#

instead of origin/direction

viral sonnet
#

huh, i don't have these code comments

rotund token
#

you can't see the actual source?

#

if not time for a new ide ๐Ÿ˜†

#

because unity does an overall exceptional job documenting the source code in their dots packages

viral sonnet
#

no, that's weird. i'm using VS 2022

rotund token
#

oh yeah classic
VS does not show package documentation at least not by default

hot basin
#

wow

#

didn't know

viral sonnet
#

right, that's annoying. yeah unity code comments are stellar

rotund token
#

i believe there might be a way to do it, but don't ask me

#

otherwise resharper plugin lets you see proper source

#

or our whole dev team has pretty much switched to rider because of dots development

#

overall just a superior unity ide imo but dont want to start anything ๐Ÿ˜…

viral sonnet
#

my company uses msdn action pack. otherwise I'd be on rider too probably

hot basin
viral sonnet
#

everyone says how great it is

hot basin
#

yeah I'm also using rider

viral sonnet
#

anyway, thanks tertle, that has answered my question

#

and led me to another task because having no comments sucks

rotund token
#

com.unity.physics@0.6.0-preview.3\Unity.Physics\ECS\Base\Components\PhysicsComponents.cs

#

(avoid me posting a huge amount of source)

#

i have my own copy and have expanded it to other native containers

#

but the concept is based off this file

#

line 176

#

the tldr is it's just the nativearray ptr + length

#

the other part
com.unity.physics@0.6.0-preview.3\Unity.Physics\Base\Containers\AtomicSafetyManager.cs

#

is what lets you regenerate the safety handle to allow the native array to work safely in different systems

#

in collections sometime after 1.1 when they remove dispose sentinal (1.1 is already out, it has a conditional wrapping of dispose sentinels to allow removal)

#

you should be able to simply attach native containers to components

#

and this won't be needed

hot basin
#

wow, they did?

#

so I can actually have NativeArray In component itself?

rotund token
#

there's some stuff about this i can't talk about so i'll leave it at that

#

but collections 1.1 changelog has

Added

    REMOVE_DISPOSE_SENTINEL ifdefs in all containers for future removal of DisposeSentinel.```
#

DisposeSentinel is the class inside native containers that stop them being unmanaged and going on components

#

1+1=?

zenith wyvern
#

Seems like it would have the same restrictions as unsafe containers no?

#

Just faster I guess

rotund token
#

except you know, safe ๐Ÿ˜„

viral sonnet
zenith wyvern
#

Oh like, the safety is going to be handled in a way other than disposesentinal?

#

Huh

rotund token
#

dispose sentinel isn't for safety

#

it's for memory leak detection

#

AtomicSafetyHandle is for safety and its already unmanaged

#

i actually have a collection of semi safe containers

#

containers with AtomicSafetyHandle but without dispose sentinal

zenith wyvern
#

I guess I thought safety was about memory leaks

rotund token
#

so they provide safety for parallel writing etc

#

but don't track memory leaks

hot basin
#

is collection package fixed?

rotund token
#

with entities? no

#

you still need 0.15

#

i'm assuming entities 0.5 will use new collections

#

(on the memory tracking, i actually dont know what magic unity is going to use to track leaks. using a class was such an easy approach)

hot basin
#

oh collections are released now

rotund token
#

(i suspect it'll have something to do with their new memory management)

#

anyway i've said way too much today and done way too little coding

#

be more intermittent

hot basin
#

but latest jobs + collections works?

rotund token
#

if you aren't using entities

#

if you were doing a monobehaviour project with jobs for specific optimization then yes its considered released

hot basin
#

in most projects in my company I don't

haughty rampart
hot basin
#

i'm getting errors

safe lintel
#

anyone using github copilot? when it works, its kinda creepy how well it works

#

made a simple ascii cube unwrapped to faces in comments with numbers at each vertex and it was able to figure it out each face after the first

safe lintel
#

its also very handy for writing non lambda jobs and all the boilerplate code

viral sonnet
#

sounds cool! the code completion from vs2022 is also pretty great.

#

copilot seems way more advanced

safe lintel
#

funnily enough i found the code completion for vscode to be pretty poor

viral sonnet
#

vscode is shit tier ... lol

#

the only redeeming factor is that it's free

#

writing python and setting it up was pretty cool but for c# and bigger projects... ooff

safe lintel
#

yeah its crazy(and also super dumb at times), but for some things you can prime it, like add a comment of your intended functions purpose and it will spit out something that can occasionally be on the money

worn valley
#

Does it do any DOTS stuff?

viral sonnet
#

the first good auto completion I saw was in vs2022. it's often totally on point.

safe lintel
#

yeah it handles dots stuff

viral sonnet
#

like setting all the variables in jobs was pretty much just tabbing though and auto completing ๐Ÿ˜„

safe lintel
#

maybe vs has way improved since but i find even rider isnt that great at it for jobs

viral sonnet
#

vs2022 has improved a LOT

#

kind of welcoming because I use it for work and intellisense was degrading to something really useless over the years

#

either it was slow or had wrong suggestions

#

really interesting what AI has brought to the table in terms of code completion

#

I mean we write similar stuff all the time

#

to have that shared now in a model and the implications of how that will look in a few years is pretty mind boggling

#

especially for such a large repo site like github

#

on the other hand, programmers have cried when new blood was using intellisense. can't think of how we will think when fresh programmers use such forms of auto completion ... haha

#

[old voice] back then we still had to write line per line

safe lintel
#

yeah, at times it feels like star trek holodeck command ish, "give me something that can handle player movement", boom

viral sonnet
#

/* handle realistic graphics */ -> press tab

#

I guess we will get there someday

safe lintel
#

before or after dots ๐Ÿ˜…

viral sonnet
#

dayuuum

rustic rain
#

Or dots saves literally all of them?

#

Even those that aren't used in jobs?

rotund token
#

any archetype that ever exists

#

exists forever

#

nCr explodes pretty fast

#

you have 50 components, and say you have 10 components per entity

#

this gives a potential archetype count of 10,272,278,170

#

how do you reach that many?

rustic rain
#

Uugh

rotund token
#

add/remove them in random ways

rustic rain
#

Why not just have registry of what archetypes should be saved

rotund token
#

say you have component ABCD
you have an entity with component A,
you add B, now you have archetypes A, AB
you add C, now you have archetypes, A, AB, ABC

#

now say you remove components B then C

#

in that order

#

you now have A, AB, ABC, AC

rustic rain
#

Yeah, I get how it grows exponentially

rotund token
#

if you removed them in C B then you'd still have the original A, AB, ABC only

rotund token
#

only created

#

(its something that unity should/will probably address at some point)

#

ALSO something people don't realize is for every archetype you create

#

you actually create 3

#

say you have 1 component, A so 1 archetype

#

unity also Creates A + Disable, A + Prefab

rustic rain
rotund token
#

i reduced our archetype count

#

from 30k

#

to 12k

#

removing 1 component

#

because this 1 component, pathfindingcomplete or something (was a long time ago)

#

was added at very random times/states

#

so it could be added to pretty much any archetype combo in the game

#

and then other components could be added or removed after

rustic rain
#

Sounds just like architecture flaw

rotund token
#

funny enough it only became an obvious issue

#

in entities 0.10 i think it was

#

before that unity didn't have fixed counts

rustic rain
#

So, about archetypes again

#

Does dots create them itself for every possible combinations

#

Or

rotund token
#

any combination you that you create

rustic rain
#

Only when such combination occurred?

#

Like first entity created

#

Ok

#

That makes much more sense

#

But still it's useless waste

rotund token
#

var entity = ecb.CreateEntity();
ecb.AddComponent<A>(entity);
ecb.AddComponent<B>(entity);
ecb.AddComponent<C>(entity);
ecb.AddComponent<D>(entity);

#

this is 4 archetypes

#

even if
A, AB, ABC never actually exists in update

#

because it exists for this fraction of time

#

(this is why instantiating with archetype is important - or better just using conversion. well apart from performance issues)

rustic rain
#

So

#

Once again, why not keep registry of entities you want to keep

#

Create all archetypes at the beginning

rotund token
#

me or unity?

rustic rain
#

And only create new when code tells one

#

Unity

rotund token
#

how can unity know what archetypes you need?

#

it only creates them as you request it

rustic rain
#

You tell it

rotund token
#

well that's exactly what happens if you use conversion

rustic rain
#

So it only keeps archetypes that are used by jobs

#

Kind of force coder to put some code about archetypes in OnStart

#

Entities.TryAddNewArchetype(compA, compB)

#

And if code tries to access unregistered archetype either error it or create it dynamically

#

Nah

#

Just error it

#

Creating new archetype during job excecution seems bad

#

So, any of this makes sense?

#

Maybe I suggest it to unity or smth xD

rotund token
#

what you're suggesting is just adding overhead to what it already does?

#

it's not like it creates random archetypes

#

it only creatures archetypes when you ask

rustic rain
#

You mean when you actually request it in job?

rotund token
#

jobs have nothing to do with archetypes

rustic rain
#

I actually mean to not create archetypes just because entitiy with such archetype appeared

rotund token
#

but an entity doesn't exist without an archetype?

rustic rain
#

But create archetypes because they were requested by code

rotund token
#

an entity is just 2 integer values pointing to an archetype

rustic rain
#

Only 1 archetype?

rotund token
#

yes

#

an archetype is just the definition of components on an entity

rustic rain
#

Ah

#

Ok

rotund token
#

each chunk has an archetype assigned, and inside the chunk is a collection of components

#

the entity index/version effectively just points to this position in memory

rustic rain
#

I thought archetypes are all possible combinations of components that existed

#

And entity knows about all of them

#

Or system somehow...

#

Well, then yeah

#

Just requires garbage collector for unused archetypes

worn valley
#

You can make up an archetype and then spawn an entity of that type

#

I don't like the terminology of archetypes. Really hard to understand

#

There are the archetypes that exist as chunks and then there are templates that you use to create an entity which is then put into the chunk with all the rest of its kind

rustic rain
#

is UI toolkit working fine with entities?

#

I guess you'd need some kind of static object with UI component for it

zenith wyvern
#

Same deal as input - there's no built in interaction with dots. You have to do your ui stuff on the main thread and build the bridge between ui and dots yourself

royal otter
#

Hey can anybody help me with this?
https://github.com/Unity-Technologies/DOTSSample/blob/5a8230597a8c4b999b278a63844c5238dacf51b6/Assets/Scripts/Game/Main/NetworkStatisticsClient.cs
I am trying to use and show the RTT in my game but its value is always zero!

GitHub

A third person, multiplayer sample project. Built with Unity and using the new Data Oriented Tech Stack (DOTS). - DOTSSample/NetworkStatisticsClient.cs at 5a8230597a8c4b999b278a63844c5238dacf51b6 ยท...

rustic rain
#

So I have this prefab for player.
and by following guide I defined this HYBRID_ENTITIES_CAMERA_CONVERSION in build player settings
So what exactly is happening when I create this prefab as entitiy?

#

Gameplay wise camera just moves to position local to spawned Player

rotund token
#

whats the issue @rustic rain ?

#

HYBRID_ENTITIES_CAMERA_CONVERSION just marks camera as a hybrid component

rustic rain
#

why game view is given to freshly created camera

#

and what would happen

#

if you create more cameras like this

#

Also, any tip where do you put your InputSystemGroup?

#

I tried this solution but

#

apparently Unity doesn't want me to use it

#

[UpdateBefore(typeof(FixedStepSimulationSystemGroup))]

rustic rain
rustic rain
#
[UpdateInGroup(typeof(InputSystemGroup))]
public class PlayerInputSystem : SystemBase
{
    private InputActions input;

    private float2 movementValue;

    protected override void OnCreate()
    {
        RequireSingletonForUpdate<InputMovementComponent>();
    }
    protected override void OnStartRunning()
    {
        input = new InputActions();

        input.Player.Movement.performed += context => movementValue = context.ReadValue<Vector2>();
        input.Player.Movement.canceled += _ => movementValue = float2.zero;

        input.Player.Enable();
    }

    protected override void OnStopRunning()
    {
        input.Player.Disable();
    }
    protected override void OnUpdate()
    {
        var inputMovement = GetSingleton<InputMovementComponent>();
        inputMovement.value = movementValue;
    }
}

What is wrong with my system

#

it doesn't appear in debugger

#

during runtime it looks like this

#

I have my group, but no system appears in it

round shoal
# rustic rain I have my group, but no system appears in it

I don't know but I just had an issue where my system had no reason to be updated, which was the issue. I don't know exactly how DOTS decide when to update and when not to, maybe it checks for both "ForEach" and "EntityQueries", read the components they look for and use that to run or skip the update ?

#

I say that because your update has no queries (not sure if GetSingleton count as one)

rustic rain
#

also

#

it's not just not getting updating

#

it's literally not even showing up

#

I mean

#

I just created new system 0 changes xD

#

Maybe I needto declare some kind of work

#

job

zenith wyvern
#

Otherwise by default a system will not update unless it has a matching query (unless it has 0 queries)

rustic rain
#
InvalidOperationException: Cannot require EntityQuery for update on a system with AlwaysUpdateSystemAttribute
Unity.Entities.SystemState.RequireForUpdate (Unity.Entities.EntityQuery query) (at Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Entities/SystemState.cs:748)
Unity.Entities.SystemState.RequireSingletonForUpdate[T]```
#

oh wait

#

I forgot to remove some code I pasted for checking

zenith wyvern
#

As nibbler was guessing, the GetSingleton call creates an implicit query for your system

#

Meaning it doesnt have 0 queries meaning it won't update unless it matches

rustic rain
#

hmm

#
    {
        RequireSingletonForUpdate<InputMovementComponent>();
    }
#

this might be the case

#

secret errors

#

yep

#

that was it

#

some class broke due to name change

#

thanks, actually helped with that info

#

Hmmm, is there a way to remove all components from entity?

#

this entity is created through conversion

#

which I don't really need in the first place

#

or maybe there's a way to create singletons without it?

#

Basically an entity to keep track of player input

#

for all other jobs

#

World.EntityManager.CreateEntity(ComponentType.ReadOnly<InputMovementComponent>());
ok, that was easier than I thought

rustic rain
#

Is there any way to ref component in my own code?

#

outside of job loop

#

I guess after creating component won't move anywhere, so I can just have memory pointer to it?

rustic rain
#

nope, I can't

#

at least not without publicizing entities assembly

zenith wyvern
rustic rain
#

yeah, I kind of wanted to avoid that process and write directly to component

zenith wyvern
#

The "component" is just a piece of data in a chunk. A piece of data that might move in memory any time a structural change happens. The whole point of the entity/entity manager is to track that and provide access to it.

#

Essentially the entity is the "pointer"

rustic rain
#

Singletons move during structural changes too?

zenith wyvern
#

Yes, a "singleton" is just a wrapper around a query that points to a single entity

rustic rain
#

getting by value is fine then

#

I'm trying to think of a way to record input actions, that happen only once per button press

#

Or maybe I could just use direct reference to Input system

zenith wyvern
#

Track the input in OnUpdate, and go from there

rustic rain
#

and subscribe whatever other action system needs to performed event

#

yeah, I either need to make an 'Update' solution

#

or which seems to not work well with ecs

#

event system

zenith wyvern
#

I don't know what you mean by "update solution". What exactly are you trying to do that doesn't work with ecs?

rustic rain
#

by update I mean, just assigning value per frame

#

instead of just doing smth like this

        input.Player.Spawn.performed += _ =>
        {
            
        };
zenith wyvern
#

Why wouldn't you be able to do that?

rustic rain
#

I am, but that would mean

#

I can only access that event in main thread

#

so I can't really schedule parallel jobs that depend on action inputs

zenith wyvern
#
OnUpdate() {
  if( Input.Performed ) {
    Entities.ForEach(Whatever) {
      // Do Some crap as a result of input
    }
  }
}
#

How is that not doing what you just said?

rustic rain
#

oh

#

me dum dum

#

but that still

#

not event subscription

#

but per frame checking

zenith wyvern
#

The "subscroption" style of input polling is still doing the exact same thing. It's still doing an update every frame polling for your event, you just don't see it. I think Tertle posted an example of using the subscription style input events yesterday. I just use the polling method as it's easier for me to follow

rustic rain
#

yeah, but it's still doing it. So why should I do that job again?

#

I know it's just a drop in an ocean

#

but looks like it's just made for OOP

zenith wyvern
#

Brother if you're not willing to make some concessions on how Unity normally does things in order to work with dots you're in for a rough ride

#

Maybe some day we'll have an input system that's beautifully integrated with ecs, but we don't have it yet. For now we have to poll on the main thread and execute jobs as a result of that. That code I posted is the easiest and simplest way to do that

#

Like I said tertle posted an example of what (I think) you actually want yesterday, you can dig from that if you're desperate for the event response style

rustic rain
#

yep, I'm fine with it

#

but doesn't hurt to try find a better way

#

I am digging from it tho

#

at least partially

coarse turtle
#

~~I've got a probably dumb problem. I'm trying to alias a FixedList64<byte>.Buffer pointer into my own custom struct.

So I have something like this

unsafe struct ReadOnlyQueue<T> where T : unmanaged {
  public voic* Ptr;
  public int Capacity;
}

ref FixedList<64> fixedList = ref structWrapper.FixedList;
var readonlyQueue = new ReadOnlyQueue(fixedList.Buffer, fixedList.LengthInBytes);

so I'm looking at readonlyqueue's Ptr content and I can see that it's pointing to the correct address, but the contents of the pointer are different compared to FixedList64<byte>.Buffer's content ๐Ÿค”~~

coarse turtle
#

ah nevermind, figured out my issue, I guess don't alias a pointer contained in a struct and write an extension method which takes a readonly reference

worn valley
#

Pointers are a pain. Does the pointer change at some point after initialization?

coarse turtle
#

ah nope the addresses are the same, so my issue was actually elsewhere where I was writing a sort of "safer" api so no one else has to deal w/ pointers

#

but I guess passing a reference via in versus ref made the biggest difference for me. I should probably look into how in works on a compiler level when I grab a readonly reference to the struct ๐Ÿค”

#

cause that's all I had to change to fix my issue

worn valley
#

I think IN assumes that the data is read only and won't change and ref is readwrite and will always assume it will be written to

coarse turtle
#

yea

#

i figured, technically since I only have a readonly queue, I could just grab an alias to a reference readonly FixedList<64>.Buffer, but I got garbage data when I read from the pointer

#
// NOTE: Pass the FixedList64<byte> as an actual reference instead of a readonly reference.
// Not sure why, but passing the collection by in causes the contents of the pointer to be 
// garbage data when aliased inside another struct.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
// Originally I had it as `this in FixedList64<byte> collection
public static unsafe ReadOnlyQueue<T> AsReadOnlyQueue<T>(this ref FixedList64<byte> collection) 
    where T : unmanaged {
    var size = UnsafeUtility.SizeOf<T>();
    return new ReadOnlyQueue<T>(collection.Buffer, collection.LengthInBytes / size);
}
spiral flint
#

Should any Jobs questions be asked here?