#archived-dots

1 messages · Page 104 of 1

proud cape
#

Or any kind of component

last lintel
#

my questions are going to be a bit basic because I'm returning to ECS after a long time of not using it

tall fossil
#

what is DOT?

last lintel
#

but! so I should be able to put a material and a mesh in a sharedcomponentdata and inject that into a job, right?

#

did they deprecate [Inject]?

#

ah, it seems they did. how do I inject into jobs and job systems now?

#

Hm. this ISharedComponentData has no boxing conversation into componentdata. i have no idea how to do that

worldly pulsar
#

@last lintel you should look through the official samples (see pinned post). The API has changed a lot since [Inject] was a thing.

last lintel
#

thanks! this documentation is much better than it was in 2018

#

though it seems like I can't run Graphics.DrawMeshInstanced in job's Execute because drawmeshinstanced definitely takes a Mesh and not a RenderMesh, and won't even let me pass it RenderMesh.mesh

#

I really suck at this

worldly pulsar
#

you can't call Unity API from jobs

glass tiger
#

I thought you could if you added WithoutBurst() ?

worldly pulsar
#

WithoutBurst() lets you use managed types (so e.g. new MyClass()), but most Unity APIs are not thread safe and can't be used in jobs

last lintel
#

so if I want to draw lots of quads from a job, is there a good way to do that at the moment?

glass tiger
#

what if you Run() the job on the main thread

worldly pulsar
#

prepare the data in jobs, call DrawMeshInstanced from the main thread

last lintel
#

right

glass tiger
#

ah yeah that sounds like the way to do it

worldly pulsar
#

(depending on the use case it may be better to manually batch the quads into a single Mesh btw)

last lintel
#

in this case it's map tiles

#

so not really that useful I would think

proud cape
#

Guys now that you are here, does anyone has some insight with my issue in the Physics channel?

worldly pulsar
#

I would definately try batching map tiles into a single mesh

last lintel
#

I'm not too familiar with it, but how would I separate materials?

worldly pulsar
#

You don't, you use texture atlasses and draw with the same material

last lintel
#

what i'm saying is, if I'm turning a thousand quads into one big quad, how do I draw the materials inside it? (again, pretty new at this)

worldly pulsar
#

You are not turning them into one big quad, you are turning them into a single Mesh containing all the quads. Then use uv coordinates into a texture atlas so each quad has the correct texture

#

If the map tiles don't change really often this is pretty much guaranteed to be faster than drawing each tile separately

glass tiger
#

all rendered with the same material/shader correct?

worldly pulsar
#

yup

glass tiger
#

can you even have a mesh rendered with multiple materials

last lintel
#

yes, although i vaguely remember unity's inspector warned me against it one time haha

#

'multiple materials on the same mesh are bad for performance' or some such

glass tiger
#

I think I vaguely remember something like that too

worldly pulsar
#

Not really (Unity has the concept of submeshes, but that's basically just multiple meshes packed into the same Mesh object (this is a bit bigger topic and mostly irrelevant to what we are talking about))

last lintel
#

well you can put a material and its normal map onto the same mesh

glass tiger
#

gotcha

last lintel
#

so how do I go about batching meshes?

worldly pulsar
#

there are tutorials online 😛

last lintel
#

great 😛

glass tiger
#

if I'm making a 2d game where I have a player entity that needs a collision shape, body and sprite, should those all be components on the player entity? or entities of their own that reference the main player entity to update their transforms?

worldly pulsar
#

do you have a reason to make them separate?

glass tiger
#

mainly scaling the sprite independently of the collision box

#

or rotating it

#

if I make them separate entities though it becomes difficult to query them doesn't it

#

hmm

#

I guess essentially I'm unsure how the traditional GO transform hierarchy is supposed to translate to entities

#

I did notice that if you select "convert and destroy" it creates an entity for each child GO, but "convert and inject gameobject" only creates one entity for the parent GO

sterile tartan
#

Ok, so coming back to game dev after a fews years I'm now getting acquainted with DOD approaches. I was indie so I only used OOP and it was fine. Also having ML experience it's not something very alien to me. But then it begs the question: can games be made to run on TPUs? 🤔

amber flicker
#

I've noticed I think just the first time I call DefaultWorldInitialization.DefaultLazyEditModeInitialize() after editor launch I get a >45s wait and noticed the audio thread appears to be taking all the time? Any insights @digital scarab? 😅 (audio thread could be a red herring - perhaps actually an initial compile of some sort). Interestingly I don't see this if I make a code change before launching the editor (so it does a compile on launch) so this is likely just noticeable due to my longer compile times.

vale nymph
#

So trying to work with the new DOTS Sample project from Unity and looking at the youtube videos of the sample, I noticed in the video's they talk about the [GenerateAuthoringComponent] they put on the ComponentData. However in the project they have seperate code files for Authoring. Does anyone have any experience with this and can explain why they choose to do it that way?

worldly pulsar
#

writing your own authoring lets you do a bunch of things the generated one doesn't do, like process data at conversion time, reference prefabs etc

vale nymph
#

Thanks @worldly pulsar that confirms some of my assumptions!

autumn sleet
#

Anyway we can synchronize changes made in Editor on a Authoring IComponentData with converted and injected Entity? GameObjectEntity workflow is deprecated and I don't want to write a system to synchronize the changes back.

glass tiger
#

how do you set an entity's name via code

autumn sleet
#

@glass tiger EntityManager.SetName?

glass tiger
#

thanks

#

I was checking on the entity object itself but I guess the entity manager is responsible for maintaining the name mapping

hollow jolt
#

any planes to add support for a multi tag file ? something like this ( Tags.cs ) :

using Unity.Entities;
[GenerateAuthoringComponent] class Tag_Player : IComponentData { }
[GenerateAuthoringComponent] class Tag_Rocket : IComponentData { }
[GenerateAuthoringComponent] class Tag_Field : IComponentData { }
[GenerateAuthoringComponent] class Tag_PickUp : IComponentData { }
[GenerateAuthoringComponent] class Tag_Locked : IComponentData { }

It gets a bit too much when there are heaps of single lined files over time.

#

.
recon i can make something like a custom menu item that would re-generate those files from a scriptable object, but hope there is something quicker tho

warped trail
#

You can have something like enum value in MB with IConvertGameObjectToEntity and store all this Tags in single file

worldly pulsar
#

@hollow jolt they are working on it, some editor limitation apparently

hollow jolt
worldly pulsar
#

?

hollow jolt
#

that was easier then expected

glass tiger
#

is there any reason to extend ComponentSystem now that the AlwaysSynchronizeSystem attribute exists for JobComponentSystem

amber flicker
#

basically no - JCS should cover all your needs and there's been mention that ComponentSystem may be depreciated at some point in the future

glass tiger
#

makes sense

winter veldt
#

@last lintel did you make any headway? i've done a bunch of mapping to meshes myself. it's fairly easy in a basic sense, which is more or less overkill anyways, but can be improved upon a bunch

low tangle
#

they are planning on removing it because the internals of JCS changed, it uses the faster paths (burst) for structure changes. that and they want people to use the simpler lambdas

#

its kinda like v4 of systems

winter veldt
#

the what now? are we meant to always use jobs? or just JCS is just going to be the default and pass through the inputdeps

low tangle
#

you can do main thread non job work in JCS now

#

simply .WithoutBurst() and .Run() instead of schedule

#

.WithStructureChanges() if you want to create/edit entities though the EntityManager

zenith wyvern
#

You can still use burst on the main thread for the record

low tangle
#

yeah, but most main thread work is likely monobehaviours and what not, cant burst that

worldly pulsar
#

The only features missing from JCS that CS has I can think of are Entities.WithAll<X>().ToEntityQuery() (no direct equivalent in JCS), and using generic types in the WithAll and friends (so

class IncrementMyComponentSystemFor<T> : ComponentSystem {
    JobHandle OnUpdate(JobHandle deps) {
        Entities.WithAll<T>.ForEach((ref MyComponent m) => m.Value++);
    }
}

will work in the old CS, but the JCS equivalent won't compile

#

both cases are rather unusual

zenith wyvern
#

You can use WithStoreEntityQueryInField if you want the query generated by the foreach

low tangle
#

tbh generics like that are really anti dots
I've seen quite a few people on the fourms doing that, and its just never made sense why you would ever need to do that

winter veldt
#

entities scares me. haven't tried using it yet 😛 seems kinda complicated.

low tangle
#

it isn't

#

interfacing to the rest of the unity world is complicated

#

the whole point of entities is to be dead simple data processing

zenith wyvern
#

Yeah it's not too complicated, the hard part is just getting used to the API

worldly pulsar
#

@zenith wyvern I guess you can do Entities.WithAll<X>().WithStoreEntityQueryInField(ref _query).ForEach((Entity e) => {}).Run(); in OnCreate, but... yuck... (both ForEach and Run are mandatory)

zenith wyvern
#

Which with the new ForEach is dead simple

low tangle
#

most unity devs seem to not be used to fluent api (aka functional programing chaining of function returns)

zenith wyvern
#

Well the query is created at compile time so you can use it before the actual Foreach for whatever you were trying to determine, so there shouldn't be any need ot run an empty foreach

#

It's a bit magicky but it works

low tangle
#

pretty sure you can still just pass in a query for one part, but you have to not have overlaps with the rest of your foreach

zenith wyvern
#

Oh this isn't to pass in the query, but to capture the implicit query generated by the Foreach's withall/withnone expression

#

So you can use the query beforehand to determine if the foreach should be run in the first place

low tangle
#

what

zenith wyvern
#

Yeah it's a bit weird but it works great

worldly pulsar
#

@zenith wyvern there is a way to do this without the .ForEach(...).Run() part?

low tangle
#

oh I think I know what your talking about

#

you should really just clean up your query conditions into your oncreate

#

instead of extracting one with a code generated body

zenith wyvern
#

@worldly pulsar The WithStoreEntityQueryInField will ensure that, at compile time, your query contains the implicit query generated by your ForEach

#

So whatever you needed the query for, you can use it before the foreach ever runs

low tangle
#

just create the matching query in your create and CalculateEntityCount() on that

#

not the one for the foreach

zenith wyvern
#

Exactly

winter veldt
#

so question. if say, i want to do the entities thing, requiring 2 components, and optionally having a third... would it be .WithAll<T1, T2>().WithAny<T3>() ?

low tangle
#

yes, but you have to decide which ones data you have to look at

#

if you wanted to look at T1, T2 you would put those as ref's in the foreach lambda (the second to last part)

#

because those are implicitly as part of the query

zenith wyvern
#

I guess you would need a CDFE to check if the optional one exists in that case?

low tangle
#

this requires there to be a openclientconnection

#

without having to say with all

worldly pulsar
#

@low tangle I know, I just miss the old Entities.WithAll<X, Y>().WithNone<Z>().ToEntityQuery(); Typing ComponentType.ReadOnly gets tiresome 😛

low tangle
#

yeah, its weird for me since I've got 180 systems that all are explicit querys in the on create for readability

#

then the foreach's are just using the query in them

#

all of them just With(query)

#

so I can't bulk move all classes over easy, I have to reconstruct the querys in foreach syntax

worldly pulsar
#

oh, yeah, the .With(query) is another feature missing from JCS

mighty whale
#

latest version of unity absolutely destroyed the game lol

#

did someone had the same problem ?

low tangle
#

really hoping they add it, might need to ask on the fourms @worldly pulsar

#

just been so busy getting this game update out to even think about doing that

mighty whale
#

im talking about 2019.2.18f1

worldly pulsar
#

"absolutely destroyed" is not a very specific problem

mighty whale
#

sorry hum i meant the physics broke

zenith wyvern
#

That's still not very specific

mighty whale
#

its a minecraft clone im doing as a learning project and walking on cubes now bump my character

worldly pulsar
#

btw @low tangle why would you say having generic systems/generic methods in a system is anti-dots?

mighty whale
#

well that's not the only problem but the rest is very difficult to describe

#

it's broken in a very weird way :(

zenith wyvern
mighty whale
#

well the game is 100% ECS so i thought it could be useful to go here

zenith wyvern
#

What version of entities and dots are you using? I'm not sure the latest versions work on 2019.2 do they?

low tangle
#

this is all my opinion, but so far dots has been all about concrete handling of everything, direct stream processing, so it makes no sense to 'handle all the cases' (generics) when I should just be handling the cases my game will actually be handling. so far its been way more sane to deal with / reason about what the game is doing. @worldly pulsar

mighty whale
#

well it worked perfectly with 2019.2.4f1 :x

#

we were using the 0.2.0 but my friend tells me its also broken in 0.2.4

low tangle
#

I dont have a single generic system or generic classes really. I've got a single 'magic' thing I'm working on, which is my network serialization, but thats using explict code gen'd bodies, like unity's networking high level api. also for refrence, thats like 1/20 of all systems in my game.

zenith wyvern
#

I'm pretty sure since 0.4 of entities they require 2019.3. That doesn't mean it won't work, but that there's no support for older versions

mighty whale
#

ok so i'll try 2019.3 thanks

zenith wyvern
#

Generics is nice just to save typing

#

It does usually make your code way harder to read though

low tangle
#

I take that very serious

#

code readability > amount of code

zenith wyvern
#

That's very fair, but depending on what you're doing and if you're the only one who's touching it, it can be a huge benefit

#

I can see why they wouldn't go out of their way to support it though

low tangle
#

I've been work on this codebase for a year and a half now. I dont need this shit harder to read

zenith wyvern
#

Wow, that must have been annoying to keep that up to date with the changing ECS apis

low tangle
#

it has been yeah

zenith wyvern
#

Is this the terrain thing you mentioned before?

low tangle
#

I've used it since the first preview, which was very worth it

#

oh no, that was just for fun

#

thats a little project for parsing and loading all of oblivion from their data formats

#

loads esm's and esp's directly

winter veldt
#

where do i use WithStructureChanges()?

low tangle
#

if you use EntityManager.CreateEntity .AddComponent .RemoveComponent

zenith wyvern
#

Any time you're creating or destroying an entity or component

left oak
#

Sorry to interrupt, but I need a bit of a sanity check: if I have a shared piece of data (lets call it a big bitmap, or something) that I need to share between many entities, but I need to use the VALUE in a job, I shouldn't use ISharedComponentData, but perhaps a BlobAssetReference stored in a ChunkComponentData? The naming conventions are weird...

zenith wyvern
#

Probably if you're resizing a dynamic buffer too, not sure about that

low tangle
#

BlobAsset is exactly what you want @left oak

winter veldt
#

yeah but i don't see WSC in the intellisense. i'm using entities 0.5.0p17

#

is there a newer one or something?

left oak
#

Thanks, @low tangle

low tangle
#

let me double check for you

zenith wyvern
#

I've found intellisense is a bit iffy with the Foreach. Usually it fixes itself if you create the barebones structure of the Foreach first

low tangle
#

its there

worldly pulsar
#

What I found is the semicolon after .Run(); tends to fix the Intellisense

low tangle
#

I'm using visual studio 2019 16.1.6 with almost no issues on it

#

I've gotten a few crashes on a c# plugin but its usually a enormous file that does it

zenith wyvern
#

I'm on 15.9.18 and it definitely fails to fill out Entities functions until I actually complete the foreach first like Rett said

winter veldt
#

oops i forgot to change it to a JCS

low tangle
#

maybe they've updated it a bit then

#

visual studio thankfully is getting slimmer with updates so there less painful

#

I think 2020 isn't too far out now

#

dang lookin good

winter veldt
#

ok, so i run it, but thats a void, wheres the jobhandle to return?

zenith wyvern
#

Show the code

worldly pulsar
#

.Run() executes on main thread so doesn't return a job handle

low tangle
#

^

winter veldt
#

ah. well thats what i want anyways

worldly pulsar
#

to schedule a job use .Schedule()

winter veldt
#

i see that now

#

i'm just trying to convert a componentsystem to a jcs to try out this fancy stuff 😛

worldly pulsar
#

if you don't have any dependencies to return (and have [AlwaysSynchronize] on your system) you can just return default;

winter veldt
#

should AlwaysSynchronize go on any JCS that doesn

#

have a dep?

zenith wyvern
#

From the docs

AlwaysSynchronizeSystem can be applied to a JobComponentSystem to force it to synchronize on all of its dependencies before every update. This attribute should only be applied when a synchronization point is necessary every frame.
#

All I know is it can cause dependency errors if you're trying to use dependent objects on the main thread

#

If you don't use it

winter veldt
#

sorry i need to read the docs, but making sure i'm looking at version i'm currently using is always a pain

glass tiger
#

always make sure to click that blue "view latest version" button at the top

winter veldt
#

i didn't know that existed! thanks

glass tiger
#

np

left oak
#

Does this imply that a JCS doesn't synchronize with its dependencies unless instructed to?

glass tiger
#

it synchronizes automagically according to the dependencies the job uses doesn't it

winter veldt
#

well the sync comes from the order handles are chained right? so in a JCS with no handle made (not using a job) there's noting to tie it o

zenith wyvern
#

It's only if you need it to synchronize on the main thread specifically. Otherwise you would be passing in inputdeps to the .Schedule

glass tiger
#

if your job reads one piece of data and writes to another, it's aware of those dependencies and uses them to manage synchronization

left oak
#

oh, so this attribute should be paired with some main thread code you're running?

glass tiger
#

as I understand it AlwaysSynchronizeSystem is an attribute you always want to use for JCSes that are meant to run on the main thread

zenith wyvern
#

Basically if you use a component in a main thread job called with .Run, and that component is used in a threaded job anywhere, then you will get a dependency error unless you have [AlwaysSynchronizeSystem]

glass tiger
#

yeah

zenith wyvern
#

It's very weird and not intuitive, hopefully they will come up with something better

glass tiger
#

once you know the rule of thumb it's not too bad

#

but yeah it's weird when you're learning

#

a single entity should not/cannot ever have multiple of the same type of component, correct?

zenith wyvern
#

As far as I know yeah

glass tiger
#

I was making a component for the player's inputs for a particular frame, and then the player entity would keep track of a list of them to have a record of what the inputs were

#

I guess in this case the right way to do it is a single component that has an array that holds all the input frames

#

and those input frames are just structs, not IComponentData structs

zenith wyvern
#

Yes, in most cases when you would want that you can use multiple entities or a dynamicbuffer or a fixedarray

glass tiger
#

hmm haven't looked into either of those yet, I'll check now

left oak
#

NativeQueue could be good if order of inputs is important

#

but that'd be stored in a system i guess

#

if you only have one player, then it'd be fine

glass tiger
#

I'm still unsure of the different types of components beyond the simple general purpose ones

zenith wyvern
#

If you want the data to be read anywhere outside the system you're better off avoiding nativecontainers, else you end up in dependency hell

glass tiger
#

yeah I'd like to keep it generic to support multiple players

left oak
#

oh yeah, ive got a summer home there, @zenith wyvern

#

I'm not tracking inputs, per se, but the effects of inputs in the world as Transactions, which need to be able to play both forward and backward, for undo/redo functionality. That has been a headache.

zenith wyvern
#

As I understand it the physics systems has simliar problems to solve, you can always look to it for inspiration

left oak
#

That's a good insight. I'll have to dive into that package a bit.

#

Although, I tried to do the same to understand how RenderMeshSystemV2 actually gets the RenderMesh values to work on, which I deeply regret: like staring into an old god's eyes.

zenith wyvern
#

Yeah I couldn't make heads or tails of that either. For people smarter than me I guess

low tangle
#

theres a video of mike talking on how it works

#

could probally dig it up if you want to understand it a bit better

left oak
#

mike's voice is so reassuring, he always lulls me into a false sense of understanding what he's talking about

zenith wyvern
#

@low tangle I would be interested in that if you don't mind

low tangle
#

trying to track it down but I cant remember which megacity video has it

zenith wyvern
#

Is that it?

low tangle
#

that should be it

#

let me skip a second

#

yup thats it

remote coyote
#

Mike Acton is a rockstar for programming

low tangle
#

the only gotcha on this is that subscenes morphed slightly since this

#

to make them more general instead of just for megacity

#

but this is roughly/almost exactly how rendering is done in v2

zenith wyvern
#

Gotcha, thanks for the information! Although I feel like this may be obsolete once we get the promised renderer updates in a few motnhs

left oak
#

if only they could morph V2 to make it more general instead of just for megacity -_-

zenith wyvern
#

I'd still like to know how it works

low tangle
#

it wont exactly be out dated

#

the updates will be somewhat similar to this (this is dead simple and good)

#

skip to 16:10

zenith wyvern
#

Huh, it's weird to hear him talk about how simple it all is considering how truly hard to read that code is

low tangle
#

exactly

#

the data is simple and simple to understand, but the code is much harder

#

but its like the quality triangle

#

fast, readable, cheap to write

zenith wyvern
#

Pick 2

low tangle
#

yup

zenith wyvern
#

Makes sense, I appreciate you letting me know this exists too, thanks. Should be helpful

low tangle
#

one nice thing about dots though, when you do it right you can optimize later on when you actually need it. so I've personally been choosing readable and cheap for all of my systems / logic. and only very few are heavily optimized (namely the ones that scale up to a million ish entities in need)

zenith wyvern
#

Yeah I remember when I was doing the instanced sprite renderer thing I ended up using generics to save some typing, it ran great but the code ended up being a nightmare to decipher. I think I may take your approach moving forward, hahah

low tangle
zenith wyvern
#

I'll add to to the queue, thank you

low tangle
#

np

#

the way I reason about it is, do I really need x?

#

if its no or maybe, I delete it end of story

#

I've got everything in a repo so if I ever want it back I get it

#

I'm a firm believer in deleting every bit of code that isn't needed. and generics is kinda like generating a infinite amount of code variations

#

but there are totally cases where it works really well, like serialization

winter veldt
#

well that was indeed quite easy.. and simplified a LOT. thanks everyone!

zenith wyvern
#

At times I've found myself wondering if I shouldn't just write my own code generation to solve certain problems. As bad as generics can be I wonder if that wouldn't be much worse

low tangle
#

code gen is just another form of meta programming, and a pretty powerful one

#

most of dots uses code gen in some form, and the networking library's high level parts are all code gen

#

it seems really natural for some reason, really fitting to solving some problems

#

I mean if you think about it in the lisp way, code is data too, which should be manipulated if it helps solve your problem

zenith wyvern
#

It always feels weird to me in C#. There's not really many built-in language features to make it easier that I've seen

low tangle
#

reflection?

#

code gen happens in the editor not at runtime, so might as well use its power there

zenith wyvern
#

That's true. I guess if I'm already creating a readability problem, might as well go all in trying to make it as easy on myself as possible

low tangle
#

the code generated doesn't have to be unreadable

zenith wyvern
#

I was more worried about the generation code itself

opaque ledge
#

Hello, i was trying to play with Dynamic buffer and i encountered an issue, so here are my scrips: this is my main monobehaviour script to spawn entities,

    {
        var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
        var archetype = entityManager.CreateArchetype(
            typeof(LocalToWorld),
            typeof(Translation),
            typeof(MarketData)
            );


        NativeArray<int> array = new NativeArray<int>(10, Allocator.Temp);

        for (int i = 0; i < array.Length; i++)
        {
            var entity = entityManager.CreateEntity(archetype);
            var buffer = entityManager.GetBuffer<MarketData>(entity);

            buffer.Add(new MarketData { basePrice = 1, currentPrice = 2, demand = 3, supply = 4, targetPrice = 5});
        }

        array.Dispose();

    }

my marketdatastruct:

public struct MarketData : IBufferElementData
{
    public int supply;
    public int demand;
    public float basePrice;
    public float currentPrice;
    public float targetPrice;
}

And my jobsystem:

{

    public struct MarketUpdateJobStruct : IJobForEach_B<MarketData>
    {
        public float deltaTime;

        public void Execute(DynamicBuffer<MarketData> marketDatas)
        {
            for (int i = 0; i < marketDatas.Length; i++)
            {
                var marketData = marketDatas[i];
                var data = marketData.currentPrice + deltaTime;
                marketData.currentPrice = data;
            }
        }
    }

    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new MarketUpdateJobStruct()
        {
            deltaTime = Time.DeltaTime
        };

        return job.Schedule(this, inputDeps);
    }
}

The thing is my current price is not increasing, when i Debug.Log those values it looks like its increasing but not in reality.

zenith wyvern
#

I wonder if eventually Unity won't give us access to whatever they use for code gen

#

Some utilities to make it easier at least

low tangle
#

you can actually do that if you wanted

#

you should take a look at the "Type" class

#

its pretty easy to get data from unknown things

zenith wyvern
#

@opaque ledge You need to assign back your data to the buffer after you change it

low tangle
#

@opaque ledge I dont see any reason to have that temp array of 10 you have there

#

yep, its not a ref struct like most component data

opaque ledge
#

marketData.currentPrice = data;

#

this doesnt work ?

low tangle
#

marketDatas[i] = marketData;

zenith wyvern
#

You're creating a copy of the data inside the buffer

low tangle
#

you need this at the end to assign the value back into that index

zenith wyvern
#

Then changing the copy, but not assigning it back

opaque ledge
#

oh wait, i need to create a new marketdata struct and assign that to that index ?

low tangle
#

no

#

you just need this line at the end\

#
marketDatas[i] = marketData;
#

var marketData = marketDatas[i];

zenith wyvern
#

@opaque ledge Remember that you're working with structs. It's a value type

low tangle
#

this line is asking for a copy of the marketdata at that index, you now have a local version

opaque ledge
#

oooh it works now 😄

#

yeah, sorry my experience with structs is pretty low, i know that it takes a value but since when normally we deal with ref struct i thought when i access the element in index that would be ref as well

#

but thanks, i understood now

low tangle
#

👍🏻

opaque ledge
#

this is so fun xD

#

but.. it also looks complicated

low tangle
#

it gets easier to reason about it after you get used to your new tools

left oak
#

The temptation to fill-in the current gaps in DOTS is tremendous: I started implementing sngdan's double-buffered drawmeshinstancedindirect rendering system, then realized I was putting myself on a whole development track parallel to unity's own development of rendering, so I trashed it, and am patiently waiting for unity to fill in the gaps themselves.

low tangle
#

awhile back I went and played around in a custom c project to reason about some ecs ideas outside of unitys api
highly suggest this if you want something close to how to unity's works
https://github.com/SanderMertens/flecs

#

yeah waiting on them to finish up the gaps is so painful. I really wish they could just drop the whole hybrid stuff and go all out on finishing the rest of the systems

opaque ledge
#

I was going to ask, there are many cases with 'tag' components, but i also heard that if you add a tag to an entity or remove, it causes to chunks to be recalculated, is adding or removing components(or adding entities or removing entities) expensive operations ?

#

Feels like tag components can be very useful and abused, i thought i would ask

low tangle
#

they are slightly expensive but you should not even think about performance when you start out

#

no, abuse them

opaque ledge
#

yay 😈

zenith wyvern
#

They have gotten a lot faster now that you can use ECB in a bursted job

low tangle
#

I highly suggest reading the existence based processing chapter of the DOD book

left oak
#

check out 5argon's benchmarks on tagging

#

and def read the whole DOD book

low tangle
#

that chaper alone will help you understand how good getting your arch types right can be

#

and it argues against shying away from them just because of the mem copy

#

hell mem copys are about as fast as you can get anyways

#

dont make your code less readable just because "performance"

left oak
#

yeah, I just reread DOD for like the third time, and I've upturned my whole concept of what "should" be an entity

opaque ledge
#

oh btw the reason i created that native array is because thats what code monkey does and it gives me some practice creating native containers 😄

glass tiger
#

DOD book?

opaque ledge
#

what is the DOD book ?

low tangle
#

starting to think about lots of loosely tied thin entities? @left oak

left oak
#

yes, @low tangle

glass tiger
#

what beautiful styling

low tangle
#

one thing that really started working fire was thinking about m vrs n amount of lookups in a system. but theres a flawlessly performant way of dealing with it

#

let me find a example

left oak
#

yeah the whole tables == unordered sets thing is hard to grock

zenith wyvern
#

I have that book, I'm finding it hard to figure out how I can take what it's trying to teach and apply it to Unity's ECS

left oak
#

but very powerful

zenith wyvern
#

I blame that on my own slow learning process though

low tangle
#

if you have a query, that needs to look up your body based on a id alone (the best way) then hell, why not just add a non required query to your system, hash them at the start (which can be a job) then use said lookup inside of the system

#

the actual pattern in the code is so simple and clean that you can practically copy paste it to the start of each system

left oak
#

for me, the difficulty is removing entity -> entity references, and trying to make do with linear access

low tangle
#

your system then just checks if the id is present in the hashmap and your good to go with a ref to the actual entity

#

thus avoiding the mess of adding direct entity refs

#

I no longer have fat components, so producing something is multiple entities

#

if you need data, find it

left oak
#

yeah, i'd describe my learning ecs has been going from fat systems/entities/components to thin systems/entities/components

low tangle
#

if you need data every single frame and it needs to be faster, then you actually sort and make it easier to fastly get it

#

exactly

#

oop is hard to break

#

and dod is hard to get at first

#

I've read the dod book about three times now, and it finally all clicked. now I'm thinking about general purpose patterns to use

#

entity existence as actions is another great one to get

#

instead of a entity that does x, then y, then z, why not instead 3 separate small entities that each trigger x,y,z to happen
this allows for each one to be consumed to cause the action to happen, which is existence based processing

#

no entity mutations or tags for stages are needed

left oak
#

that's quite good

#

I've been trying to rework my transforms for linear chunk access

low tangle
#

I think from the names alone you can figure out what this causes to happen

#

and thats a simple entity emission from another processed event

opaque ledge
#

So, to burst compile a struct(or a job struct rather), i wont be able to put any managed stuff to that struct right ? so i cannot use UnityEngine API ?

low tangle
#

correct

left oak
#

so many of my old entities are just entries in a dynamic buffer on a single entity

zenith wyvern
#

Yes, unless you use unsafe code you can't use managed types inside burst or jobs

left oak
#

so i don't have to do entity -> entity random lookups

opaque ledge
#

so.. why is the performance is so huge ? i just did a test, i made 2000 entities with 500 of those market data struct, and it was taking like 50-60 ms, and with burst it started to take 0.04-0.05 ms

#

how come this huge performance come exactly ?

zenith wyvern
#

Burst is that good

#

Is basically what it comes down to

opaque ledge
#

it feels like this burst compiling made data orianted programming popular then ?

zenith wyvern
#

You're making a lot of sacrifices to be able to use it and in return you get great performance

low tangle
#

I find looking things up and querying is really powerful for decoupling entites

#

so I'm trying to go as thin as I can for everything now. instead of fat monsters that are used in 10s of systems

zenith wyvern
#

Data oriented design was around long before OOP

low tangle
#

yup

#

its just stream processing

left oak
#

DBMS

#

ftw

opaque ledge
#

yeah i know that, but what about burst compiling ?

low tangle
#

its a combo of a bunch of lines of thought

zenith wyvern
#

It used to be the normal way to do things, then OOP was made to try and make code easier to understand

opaque ledge
#

i mean if it wasnt burst compiling, unity wouldnt work on ECS no ?

zenith wyvern
#

And in return that made the code harder for machines to run efficiently

opaque ledge
#

yeah

zenith wyvern
#

So now we've gone in a nice big circle and we're back to DoD

left oak
#

stream processing is my holy grail: how can I run a transform across an unordered set (table) without external references

opaque ledge
#

at least for gaming yeah

low tangle
#

exactly @left oak

#

the best part though

zenith wyvern
#

If you believe the marketing then burst is supposed to make C# run faster than similiarly written C++ code

#

I'm not too sure about that but it seems pretty good so far

low tangle
#

why I fired up my test project, guess whats stupidly good at stream processing? GPUs

#

if its done right to minimize the latency you could all the heavy processing on a gpu, maybe even the entire game.

zenith wyvern
#

But what about the sorry souls running integrated graphics

left oak
#

yeah, that's how i got pulled into Graphics.DrawMeshInstancedIndirect

low tangle
#

still works on cpu then

#

cpus are still good at stream processing, it would just be slower

zenith wyvern
#

Aren't there still lots of phones that don't even support compute buffers though?

low tangle
#

older apis yeah

left oak
#

webgl doesn't either

#

i think

low tangle
#

but most phones you would even want to run on support compute

#

if they dont then I already dont target them

#

thats like opengl4 / es2

zenith wyvern
#

Not too worried about grandma being unable to run your game on her flip phone huh

low tangle
#

not even a little

#

I make vr games lol

zenith wyvern
#

Grandma deserves to experience the virtual world too

left oak
#

yeah, I went back to Hybrid for the grandma's sake, lol

low tangle
#

stock renderer, with dummy gameobjects for rendering here

#

the ecs on a gpu game is gonna be cuda and a side project anyways

#

I'd never lock things down that hard for a main game

glass tiger
#

anybody know if the new input package plays well with ECS

#

seems like the input actions are event-based? not sure how querying them works

zenith wyvern
#

I remember seeing a thread about there being some incompatability, I'm assuming they've fixed it by now

#

0.5 just came out

glass tiger
#

maybe I'm meant to poll the input actions in the system

#

hmm

#

or maybe somebody's made a thread about it

zenith wyvern
#

Oh I don't think it's integrated with ECS at all

glass tiger
#

ah

zenith wyvern
#

You still have to read all your input on the main thread then translate it into ECS data

#

Maybe keep an eye on project tiny to see how they're integrating input

glass tiger
#

gotcha so I still need to make my own input component structures

low tangle
#

yes

#

its pretty easy to do and you have full control

glass tiger
#

very well

#

yeah it doesn't seem too bad

left oak
#

they've made very little headway towards supporting touch input, I believe

#

"All I can offer at this point is a rough list of the things we consider important/bigger ticket items after 1.0.
DOTS support
Broader device support
"Routed" input for actions (i.e. input triggering action X prevent action Y from triggering)
Gesture support
Extended haptics
Images and models for controls and devices"

#

from the forums

#

considering they're not yet at 1.0, I wouldn't hold your breath

glass tiger
#

crazy how long input has taken

opaque ledge
#

Has anyone played around with BlobString ? i couldnt make it work

left oak
#

yeah, ive been following it for a while, but it never seems quite ready

#

@opaque ledge have you checked out the BlobificationTests.cs file in your packages?

#

that's the only example ive looked at

opaque ledge
#

thanks, i will check it out now

#

Hmm, there is no any example of how to allocate/create one

#

there is only one method with "ValidateBlobString" which validates a blob string and nothing else

left oak
#

static unsafe BlobAssetReference<MyData> ConstructBlobData()
{
var builder = new BlobBuilder(Allocator.Temp);

    ref var root = ref builder.ConstructRoot<MyData>();

    var floatArray = builder.Allocate(ref root.floatArray, 3);
    ref Vector3 oneVector3 = ref builder.Allocate(ref root.oneVector3);
    var nestedArrays = builder.Allocate(ref root.nestedArray, 2);

    var nestedArray0 = builder.Allocate(ref nestedArrays[0], 1);
    var nestedArray1 = builder.Allocate(ref nestedArrays[1], 2);

    builder.AllocateString(ref root.str, "Blah");
    builder.AllocateString(ref root.emptyStr, "");

    nestedArray0[0] = 0;
    nestedArray1[0] = 1;
    nestedArray1[1] = 2;

    floatArray[0] = 0;
    floatArray[1] = 1;
    floatArray[2] = 2;

    root.embeddedFloat = 4;
    oneVector3 = new Vector3(3, 3, 3);
    
    var blobAsset = builder.CreateBlobAssetReference<MyData>(Allocator.Persistent);

    builder.Dispose();

    return blobAsset;
}
opaque ledge
#

oooh okay thanks, sorry 😄

left oak
#

np, ecs is a pain in the butt

opaque ledge
#

i pressed "find all references" on str and empty string, which couldnt find any

low tangle
#

blobs are great but the api is a real pain in the ass at first

opaque ledge
#

i guess i have to create a root first for some reason

left oak
#

yeah, it's all a mystery: like a literal "mystery": an obscure dark ritual practiced by a cult

opaque ledge
#

so i guess i gotta learn this blobstring for.. string stuff which i certainly use it everywhere

glass tiger
#

HappyBlob

low tangle
#

that or NativeString

glass tiger
#

blobs are a mystery...

opaque ledge
#

oh there is a nativestring ?

low tangle
#

yep

opaque ledge
#

lol nice emote

zenith wyvern
#

New in 0.5 I think

low tangle
#

fit into components too

#

NativeString64 is what I use a lot

opaque ledge
#

but in order to a string like struct to be live in a component it has to be a struct that contains a blobstring right ?

#

right ? 😄

low tangle
#

no

#

you can only manipulate the string / construct it on main thread, but the nativestring is just a big fixed chunk of bytes

opaque ledge
#

but you cant put a native collection into a IComponent right ?

low tangle
#

yes

#

nativestring64 / 512 etc are not collections

opaque ledge
#

i cant seem to find it on scripting api of 0.5

#

do you have it ?

#

i will never know 😱

zenith wyvern
#

FixedString is the new replacement for NativeString in 0.5. Look in packages/collections/tests/fixedstringtests

#

It's very new and there's no official docs for it so you have to do some digging

opaque ledge
#

yeah sounds like it, i am unfortunately too noob for that kind of stuff

#

i wonder if there will be a tag component to reduce the performance hit on tag component add/remove somehow

#

but i guess as June said its almost neglible

left oak
#

tagging is good for preventing whole systems from running, so that's how I evaluate the cost.

low tangle
#

they moved namespaces from Unity.Entites to Unity.Collections

#

in 0.4 entites update

#

@opaque ledge @zenith wyvern

zenith wyvern
#

Yeah I think FixedString is meant to replace NativeString if you just want a simple way to store strings in a component

#

They also added FixedList to store a simple resizable list inside a component

low tangle
#

native string isn't deprecated though

zenith wyvern
#

Dunno, I remember seeing a Unity dev say it yesterday

#

There's a pretty comprehensive set of tests for FixedString and I don't see any for NativeString

#
 * Added FixedString types, guaranteed binary-layout identical to NativeString types, which they are intended to replace.
#

From the changelog

low tangle
#

good note

#

I'll start bulk converting mine over then

coarse turtle
#

hmm quick question - if you do CmdBuffer.Instantiate(...) how are ComponentObjects handled in the instantiation? I'd assume the entity would be linked to the same ComponentObject 🤔

#

ah cool - just found out they're linked to the same ones 🙂

last lintel
#

@winter veldt I did, though I had to leave DOTS for the time being. What I ended up doing:

#
  • Finding a tutorial for mesh stitching with SkinnedMeshRenderer
  • realising that all I really wanted was a custom mesh of 32x32 quads
  • spent a fair while finding out how to create a custom asset from the procedural quad
  • made a material with two textures and figured out how to set the individual quads to one of those two
#

now i'm stuck on a more tricky UV problem because I've got this random texture from another game (as practise/test) which is 1024x64 and I thought it would be simple to set the UVs to something within that ... but not so. everything I do looks abysmal

#

if I can figure this out (and a few more bumps in the road, no doubt) I might end up switching to DOTS at some point to set UVs. I can only imagine that the process of copy the UV array -> edit the UV array -> send it back to the mesh -> would be faster in DOTS/ECS

inland root
#

@last lintel setting / remapping UVs sounds like a job better suited for a shader / shadergraph?

last lintel
#

quite probably, I'm just very uneducated about shaders 😄

#

I ended up hacking it together

#

it's enough that I can work on other stuff without going insane for now

glass tiger
#

oh boy

#

trying to learn how Unity.Physics works from looking at the Physics examples just felt like biting off way, way more than I can chew

#

all I want to do is implement collision separation for my 2D player's kinematic body

opaque ledge
#

so what does that leave Dynamic buffer ? If a component can have a resizable list, then there wouldnt be a reason to create dynamic buffer unless its for specific purpose

trail burrow
#

@digital scarab How does the actual usage of FixedList/FixedString look like? I couldn't find any in docs

verbal pewter
#

Interesting, so FixedList is an option over DynamicBuffers as long as you don't need the container to be resized?

untold night
#

Basically it's like a list, but the Capcity field is fixed, based on the number of bytes in the container / your element size

verbal pewter
#

Nice! There's a data structure I had to turn into an Entity so that I could add an array to it, but with this it sounds like I don't need them to be entities anymore.

untold night
#

So FixedList32 has 30 bytes of capacity (with 2 bytes reserved for length of element, this is the case for all of the FixedList* variants)
so if it's ints or int-sized, that's 30 / 4 = 7.5, round down for safety, 7 elements of capacity, with 2 bytes unused

#

with FixedList64, that's 62 / 4 = 15.5, or 15 elements of cacpacity, with 2 bytes unused

#

there do seem to be concrete versions for byte, int, and float too, so you don't need the generic versions for those

verbal pewter
#

Makes sense. In my case I'm storing float4 values, so 16 bytes each I think?

untold night
#

yeah. ranges are 32, 64, 128, 512, and 4096

verbal pewter
#

Alright, 128 should work in that case. Thanks!

#

And FixedList is new in 0.5.0?

untold night
#

yes, seems to be that way along with the FixedString* NativeString* replacements

#

and a bunch of Unsafe goodies

#

and some bit array things

trail burrow
#

oh they are actually like that

untold night
#

and a ring buffer

trail burrow
#

you cant pick the size

#

that's kinda ghetto

verbal pewter
#

Hahah

trail burrow
#

i get you cant resize them

#

but it would be nice to be able to actually pick the size when you define them

untold night
#

but it can be stack-allocated and stored in IComponentData without any issue

trail burrow
#

i.e. i need a component list to hold 12 integers

verbal pewter
#

Right, which is awesome.

trail burrow
#

or w/e

#

and that absolutely is possible to do, i dont like it having pre-defined sizes?

#

that is both inflexible, and wastes space

untold night
#

unfortuantely:

  1. This isn't C++, we cannot do that thing with templates that take arguments
  2. This is also for alignment purposes. There's no padding in any of these and I think they're specced to common cache page size multiples
trail burrow
#

@untold night uhm, it sure is doable

#
    fixed Byte _Test_Backing_[128];

    public FixedArray<FP> Test {
      get {
        return new FixedArray<FP>(Unsafe.Ptr(ref _Test_Backing_), 8, 16);
      }
    }
untold night
#

but you can't make a generic type parameter an int that you can use to set the size:

struct MyArray<T, int U = 32>
{
 fixed T m_Backing[U];
 // ... accessors and such
}

Sorry if I wasn't clear enough

#

this is a thing you can do in C++

trail burrow
#

no sure, 100%, but you can setup collections like the one above in C#, it is a bit more work but it at least gives some flexibility

untold night
#

so you can have std::array<int, 12>, or what have you

trail burrow
#

yes, i know how C++ works 😄

untold night
#

sorry. I'm fading out

You probably want UnsafeList<T>

It's like NativeList<T>, but with all the safety bits removed

trail burrow
#

No, that's not what I'm asking for :p

#

I'm just asking that it'd be nice to have some flexibility, for the inline fixed stuff

untold night
#

yeah, but I think that's a C# issue, and they picked the sizes that fit the most use-cases

i don't think you can do fixed buffers with a parameter for size

trail burrow
#

no, but you can do what i did above

untold night
#

externally defined from the stuct itself i mean

trail burrow
#

which achieves the same result-ish, but with a bit more work

#
public struct Foo {
    fixed Byte _Test_Backing_[128];

    public FixedArray<Bar> Test {
      get {
        return new FixedArray<Bar>(Unsafe.Ptr(ref _Test_Backing_), 8, 16);
      }
    }
}
untold night
#

ok I get it now,

trail burrow
#

16 elements of 8 bytes (Bar) each array

untold night
#

looking at the backing stores it looks like they've not even used fixed.

they litterally defined byte seqence structs of various sizes, with explicit field offsets and used them throughout the Fixed* types as backing stores.

this is almost assuredly for packing guarantees

trail burrow
#

they can't have a packing guarantee

#

since they dont know what comes before/after in the struct the lists are in

untold night
#
[StructLayout(LayoutKind.Explicit, Size = 16)]
  internal struct FixedBytes16
  {
    [FieldOffset(0)]
    internal byte byte0000;
    [FieldOffset(1)]
    internal byte byte0001;
    [FieldOffset(2)]
    internal byte byte0002;
    [FieldOffset(3)]
    internal byte byte0003;
    [FieldOffset(4)]
    internal byte byte0004;
    [FieldOffset(5)]
    internal byte byte0005;
    [FieldOffset(6)]
    internal byte byte0006;
    [FieldOffset(7)]
    internal byte byte0007;
    [FieldOffset(8)]
    internal byte byte0008;
    [FieldOffset(9)]
    internal byte byte0009;
    [FieldOffset(10)]
    internal byte byte0010;
    [FieldOffset(11)]
    internal byte byte0011;
    [FieldOffset(12)]
    internal byte byte0012;
    [FieldOffset(13)]
    internal byte byte0013;
    [FieldOffset(14)]
    internal byte byte0014;
    [FieldOffset(15)]
    internal byte byte0015;
  }

🤷‍♂️

trail burrow
#

yeah not quite sure why they did that

untold night
#

packing in terms of the buffer/Fixed* itself

trail burrow
#

yeah but the packing for a fixed byte _bytes[16]

#

is identical

#

to the above

#
[StructLayout(LayoutKind.Explicit, Size = 16)]
internal struct FixedBytes16 {
  [FieldOffset(0)]
  internal fixed byte bytes[16];
}
#

is identical to the above

#

in memory layout at least

untold night
#

a question to ask on the forums I guess.

I'm fading out pretty hard

#

good talk

trail burrow
#

o/

#

ciao

verbal pewter
#

Does anyone have any resources that go over the basics of blobs? I've seen them mentioned a few times now but can't figure out what they are/when to use them 😄

opaque ledge
#
    {
        public BlobArray<float> floatArray;
        public BlobPtr<float> nullPtr;
        public BlobPtr<Vector3> oneVector3;
        public float embeddedFloat;
        public BlobArray<BlobArray<int>> nestedArray;
        public BlobString str;
        public BlobString emptyStr;
    }

    static unsafe BlobAssetReference<MyData> ConstructBlobData()
    {
        var builder = new BlobBuilder(Allocator.Temp);

        ref var root = ref builder.ConstructRoot<MyData>();

        var floatArray = builder.Allocate(ref root.floatArray, 3);
        ref Vector3 oneVector3 = ref builder.Allocate(ref root.oneVector3);
        var nestedArrays = builder.Allocate(ref root.nestedArray, 2);

        var nestedArray0 = builder.Allocate(ref nestedArrays[0], 1);
        var nestedArray1 = builder.Allocate(ref nestedArrays[1], 2);

        builder.AllocateString(ref root.str, "Blah");
        builder.AllocateString(ref root.emptyStr, "");

        nestedArray0[0] = 0;
        nestedArray1[0] = 1;
        nestedArray1[1] = 2;

        floatArray[0] = 0;
        floatArray[1] = 1;
        floatArray[2] = 2;

        root.embeddedFloat = 4;
        oneVector3 = new Vector3(3, 3, 3);
        
        var blobAsset = builder.CreateBlobAssetReference<MyData>(Allocator.Persistent);

        builder.Dispose();

        return blobAsset;
    }```
#

this code is from Unity.Entities.Tests/BlobificationTests

#

i never used blob asset as well but maybe this can help you

#

@verbal pewter

worldly pulsar
#

@trail burrow I'm not sure I see how your Foo is different from FixedList128<T> (other than the fact FixedLists have 2 bytes used for Length). Both cases have a fixed size backing buffer you can't change at definition time.

trail burrow
#

@worldly pulsar you can change the values on the FixedArray<> in any way you want?

#
public struct Foo {
    // 16 elements
    fixed Byte _Test_Backing_[128];
    public FixedArray<Bar> Test => return new FixedArray<Bar>(Unsafe.Ptr(ref _Test_Backing_), 8, 16);

    // 24 elements
    fixed Byte _Test2_Backing_[196];
    public FixedArray<Bar> Test2 => return new FixedArray<Bar>(Unsafe.Ptr(ref _Test2_Backing_), 8, 24);
}
#

the FixedList128<T> etc are locked, you cant do a FixedList96<T> or a FixedList150<T>, etc.

#

yes my way is more 'work'

worldly pulsar
#

Oh, you mean define a backing field + wrapper accessor, ok.

#

I thought you proposed Foo as a library type 😛

trail burrow
#

no

worldly pulsar
#

I guess the major annoyance would be replicating the .Add() interface

opaque ledge
#

how can i run a system, lets say every 5 seconds ?

#

instead of every frame

verbal pewter
#

@opaque ledge Someone can correct me if I'm wrong, but I don't think there's a built-in way to do that. Out of curiosity, can I ask what the use case is?

opaque ledge
#

Well, i am doing a space game, and every faction sends a trade ship from one of their station to some other station(if AI decides to that is) in my non-ecs project i was sending out an event every 5 seconds so each cooperation would send a trade ship on that every event.

#

I was wondering if i should have a float timer field on my struct and increase it by delta time everytime its run and when that timer reaches 5 that means event is off, after processing that i would reset the timer.

verbal pewter
#

Yep, that's what I would do.

opaque ledge
#

what happens if job takes more than 1 frame tho 🤔

verbal pewter
#

My take on it is that any time-dependent things like incrementing the delta time should be done in the main thread rather than a job. I'm no expert on DOTS though, so someone else might have a better perspective on it.

warped trail
#

You can create custom system group which can update in fixed time steps but you need to edit source files to make this functionality available to you

opaque ledge
#

ah, i rather wait then 😄

verbal pewter
#

Also, just thinking out loud, but it feels kind of dirty to have an elapsedTime value on every faction entity, where in reality you'd really just want one value shared by all those entities. I'm not sure what the best practice is for accomplishing that is with DOTS, though.

opaque ledge
#

i was kinda hoping new Time.DeltaTime would give delta time unique to jobs, but i think its a long shot 😄

warped trail
#

at least look at ComponentSystemGroup.cs mayby it will help you 🤔

opaque ledge
#

Burst error BC1045: Struct System.ValueTuple2` with auto layout is not supported

#

😦

#

i was trying to return a tuple from a job struct to be used in that job struct but i guess its not burst compilable

verbal pewter
#

@opaque ledge Btw, thanks for the link to the BlobBuilder docs!

opaque ledge
#

👍

verbal pewter
#

I think I understand their use, but wanted to write out a possible use case to see if I've misunderstood. In my procedural city gen program I have Networks (ie, "Roads") that are made up of Nodes and Connections. Nodes and Connections need to store references to each other. Right now I'm doing this by storing either a float2 or float4 value as the "key." When I need to access the value I do a lookup in a buffer, matching the key values.

From the sound of it, I can instead create Nodes and Connections as blobs and store the BlobAssetReference in the Nodes and Connections instead of key values. That would allow me to access the Node/Connection data directly without doing any lookups. For anyone familiar with blobs, does this sound about right?

#

Also, @untold night or anyone familiar with the new FixedList, how do you go about calculating the FixedList size you'll need for Unity types such as BlobAssetReference?

autumn sleet
#

@untold night "but it can be stack-allocated and stored in IComponentData without any issue" no point of doing that because it will crash Unity if you will try to access the allocated buffer next frame or within next system execution since the stack memory will be cleared.

opaque ledge
#

how can i reach entitycommandbuffer from jobcomponentsystem ? seems like in componentsystem you can use "PostUpdateCommands" but not sure on job version

verbal pewter
#

@opaque ledge The Enity Command Buffer doc says this: "For jobs, you must request EntityCommandBuffer from a entity command buffer system on the main thread, and pass them to jobs. When the EntityCommandBufferSystem updates, the command buffers will play back on the main thread in the order they were created. This extra step is required so that memory management can be centralized and determinism of the generated entities and components can be guaranteed."
https://docs.unity3d.com/Packages/com.unity.entities@0.1/manual/entity_command_buffer.html

dull copper
#

"we did it correctly, hobby devs are clueless"

mystic mountain
#

I have spawnable entities in my project, these come from e.g. selecting a specific ship, and is managed with SOs referencing a GOs. I don't want to fill up all scenes I might use with conversion for all prefabs entities. Currently my approach has been in spawnsystems to fetch these singleton SOs that hold GOs to convert them, and then use them. But I'm not sure if there is any downside to this? And what BlobAssetStore means in the context of using GameObjectConversionSettings. My second thought would be of using a subscene I load from Resources which contains authoringComponents referencing the SOs that will convert the prefab entities. Anyone stomped into the similar issue with any cool solution? 😛

low tangle
#

@verbal pewter for the new JCB you can do with structural changes to the lambda if it's a main thread run. If it's instead one that you need a ecb, but you are still finishing it that frame you can simply alloc one there and playback it at the end of the system then dispose

#

If it's a job based one you will need to grab a reference to a entity command buffer system in on create, then call the method that's roughly get command buffer, and a second one add job handle for producer so that system has your job handle to call complete on when it runs

silver dragon
#

@mystic mountain I have prefabs with unique IDs and a Monobehaviour which holds a list and converts them to entity prefabs in OnEnable with ConversionUtility. My spawner system registers them in a NativeHashMap<int, Entity>. When a spawn request arrives my spawn system looks up the prefab entity for the given ID and spawns it with EntityManager.Instantiate.

verbal pewter
gusty comet
#

ok

silver dragon
#

@gusty comet Seems to be a internet connection issue

#

At least package manager is working on my side right now

gusty comet
#

its a firewall issue not internet connection issue

silver dragon
#

Isn't it the same sometimes?

verbal pewter
opaque ledge
#

yeah i did it 😄

#

i made an event system using tag components, and i remove the event tag component after i am done with it

#

i am kinda happy 😄

verbal pewter
#

Alright nice 🙂

safe lintel
#

@dull copper I think he's agreeing with you though?

dull copper
#

@safe lintel Unfortunately this is an areas where hobbyists get hit the hardest, because they naturally gravitate towards high level flows and lack the experience to see those are where the most churn is likely to happen. was direct try to get under my skin

#

this is what that person does on every reply for any of my comments

#

they are always dismissive

#

Combined with Unity not keeping tutorials up to date it's not a great place for hobbyists to be right now. is quite wrong too

#

because all official DOTS docs and samples are kept up-to-date

#

only things that are outdated from Unity are old video tutorials but that's quite impossible to keep them updated even due to the whole concept

safe lintel
#

i guess i just dont see it as a dig on you? 🤷‍♂️
i get the sentiment, samples is up to date, but there are a number of old tutorials out there that dont get updated. theres also a dots landing page with a bunch of old outdated videos, but no mention is made that its outdated. the samples repo itself is not really publicised outside the forums?

frosty siren
#

i didn't update DOTS for a long time and now time has come. So how we should initialize world in 2020? cause i see no autocreation anymore. I saw some posts on forum abour it, but can't now find them

safe lintel
#

add to the fact that documentation is in a weird state now with the old manual and api has zero links or notes of the package stuff in another thats almost sequestered away, it doesnt give beginners much in the way of a good starting point

dull copper
#

I guess, it's just really easy to see the comments in different light with the past discussions taken into account 🙂

safe lintel
#

imo they need to clone will goldstone or someone like him just for dots, a singular voice to get a lot of the repeated feedback sorted

#

yes i am definitely missing any past history so just from that short interaction is my take 🙂

dull copper
#

I don't really see the difference between hobbyists and professionals like that

#

I've seen really crazy low level stuff done by hobbyists

safe lintel
#

i agree there totally

dull copper
#

anyway, thanks for your thoughts, gave things more perspective 🙂

safe lintel
#

np, i enjoy the meta discussions

coarse turtle
#

@frosty siren are you talking about default world initialization or manually created ones?

frosty siren
#

i mean that i updated entities and now default world not creates on start. so now i need to know how to initialize it. Am i need now to manually call DefaultWorldInitialization.Initialize(string, bool) ?

#

or i have some kind of issue?

solemn ice
#

Is there a legit way to either select an entity in the Entity Debugger of just directly getting the inspector view of an entity you get when you select and entity in the Entity Debugger? I would like to get this from another editor tool.

low tangle
#

@dull copper that is a really frustrating thread to read

#

I've literally got a released game build on dots minus rendering nothing else

#

Yet, no dots totally isn't ready

opaque ledge
#

Default world should be initialized when game starts i think

#

what do you see in your entity debugger when you play ?

verbal pewter
#

@frosty siren Unless I'm misunderstanding what you're asking, you now get the default world using: World.DefaultGameObjectInjectionWorld.

dull copper
#

@low tangle it is, I'd really suggest not to read it 😄

#

I've unsubscribed from it like 10 times but someone always keeps replying to me there

#

I should just ignore those

mystic mountain
#

Anyone who could explain to me the difference of Child of entity and being in the LinkedEntityGroup?

verbal pewter
#

Has anyone had issues updating the Entities package? Can't upgrade to either 0.4.0 or 0.5.0, getting the following error: Cannot perform upm operation: EBUSY: resource busy or locked, open 'C:\Users\Edvard\Documents\CityGen\Library\PackageCache\.tmp17812YrbLUf4pFhah\copy\Unity.Entities.Tests\EntityQueryBuilderTests.cs' [NotFound] UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

zenith wyvern
#

@mystic mountain I believe if an entity is a child and it's in a linked group and you destroy the "parent" entity it will destroy all the children in it's linked group, I'm not 100% on that though

trail burrow
#

@verbal pewter this is a problem with your computer

#

Not with packages

verbal pewter
#

@trail burrow Hmmmm, it's strange cause I can upgrade any other package just fine.

zenith wyvern
#

@verbal pewter Close unity and delete your library and temp folders

verbal pewter
#

@zenith wyvern Alright, will give it a shot. Thanks.

zenith wyvern
#

Oh that's from the actual package cache, weird.

verbal pewter
#

I'm upgrading to the latest version of 2019.3 to see if that makes a difference.

dull copper
#

Entities 0.5 has 2019.3.0f1 set as minimum on the package

#

so I'd guess they don't support older betas

verbal pewter
#

@scarlet basinnto Yeah, I was using that version.

frosty siren
#

@opaque ledge it's empty

mystic mountain
#

@zenith wyvern Hm ok. I'm looking at difference of how conversion handles a gameobject that has physics shape and child tree of colliders vs the same without physics shape. It seems that when you have physics shape it keeps the hierarchy as children and parents, but without it only kept first child, then the remaining GO's that were below in hierarchy are only in LinkedEntityGroup but not parented/children of something.

zenith wyvern
#

So it only retains the parent/child gameobject hierarchy if you're using the physics shape? That seems weird, not sure why they would do it that way, I'm sure there's some reason

#

And go figure there's not even a mention of LinkedEntityGroup in the docs

opaque ledge
#

@frosty siren imo, update entity related packages and your unity

mystic mountain
#

@zenith wyvern Maybe it's more specific for physics conversion, also note that it combines the children into 3 composites.
(below non physics shape)

zenith wyvern
#

This says LinkedEntityGroup has to do with prefabs, are you using prefabs at all?

mystic mountain
#

Yeah, I'm using the GameObjectConversionUtility.ConvertGameObjectHierarchy

zenith wyvern
#

If you were comparing a conversion with a prefab vs one without a prefab that could explain it

mystic mountain
#

@zenith wyvern Same thing but without the LinkedIndexGroup showing

verbal pewter
#

In case anyone runs into the same issue with the Entities package, updating my version of Unity seemed to fix it.

mystic mountain
#

So I guess it's only for destroying, and that if there is no physics shape, it regards all entities with a physics body as it's own entity since it "should be" static

#

Actually not the same thing..

zenith wyvern
#

TBH I'm not familiar enough with the conversion system to provide any useful information, all I can suggest is to look at the source for the hybrid conversion system

#

Or make a thread about it

opaque ledge
#

how can i do nested entityquery in jobcomponent system

#

error says when i try, it returns a reference type and that is only allowed in Run() and WithoutBurst()

low tangle
#

foreach loop in a foreach loop? @opaque ledge

#

if so, you cant in the new ones yet, there still working on them

viral kindle
#

I'm curious, what is the current state of ECS? Is it properly supported in editor? Is the API ready? Are all features supported fully?

opaque ledge
#
    {

        var jobHandler = Entities.WithAll<Kanwis>().ForEach((Entity baseE, DynamicBuffer<LocalMarketComparissionBuffer> baseCompare, DynamicBuffer<MarketData> baseMarketDatas, in Translation baseT) => {

            var baseEntity = baseE;
            var baseTranslation = baseT;
            var baseMarketData = baseMarketDatas;
            var comparision = baseCompare;

            //Entities.WithAll<Kanwis>().ForEach((Entity entity, DynamicBuffer<MarketData> marketDatas, in Translation translation) =>
            //{
            //    var targetEntity = entity;
            //    var targetMarketDatas = marketDatas;
            //    var targetTranslation = translation;




            //});

        }).Schedule(inputDependencies);

        // Now that the job is set up, schedule it to be run. 
        return jobHandler;
    }```
trail burrow
#

@viral kindle meh-level support

#

you can build stuff with it

#

but it's not complete/finished

#

can probably build a game if you know how to do shit yourself, etc.

opaque ledge
#

if i remove the comment on nested it gives the error

low tangle
#

core api has had minimal changes and its pretty solid (jobs, jobforeach, jobhashmap, chunks, components)
high level api was stuck in dev hell for figuring out how to do proper hybrid

#

its still pretty shit and I just avoid it mostly

#

thankfully everything in dots is optional

viral kindle
#

I assume that whole scene disapears as soon as you press Play because ECS

trail burrow
#

including DOTS itself, thankfully 😄

low tangle
#

not exactly no, if you do the full hybrid conversion yeah

#

everything just goes into the entity debugger basically

trail burrow
#

they really need to improve the tooling and debugging experience

#

it's a PITA

low tangle
#

can view any entity in the scene there. 2019.3 and the newer entitiys now have a live link on the gameobjects to show the conversion

trail burrow
#

trying to debug while job system has stalls, etc. is basically impossible

viral kindle
#

So if you use ECS, you no longer have actual Editor

low tangle
#

no you do?

trail burrow
#

@viral kindle editor when not in play mode

#

you can convert GOs to entities

#

etc.

#

but when you start playing you dont have the 'editor' in that regard no

low tangle
#

you can also just not use the conversion api

viral kindle
#

But what's the point of ECS then?

low tangle
#

its meant for people to convert slowly, but thats a joke because not all of unity converts

trail burrow
#

that it's faster, that's about it

zenith wyvern
viral kindle
#

I mean what's the point of ECS if you do not convert objects

#

"you can also just not use the conversion api"

trail burrow
#

you can do it by hand, set everything up, etc.

#

without the GO/MBs

#

which is valid ofc, if thats ur thing

#

or your game is proc gen heavy, etc.

low tangle
#

you just write the entities logic without having to deal with conversion

viral kindle
#

MB -> ESC is done offline?

low tangle
#

no

#

runtime

#

except for subscenes

vagrant surge
#

yes and no

low tangle
#

they are done at editor time

vagrant surge
#

both offline and runtime

trail burrow
#

TBH the conversion workflow is such a janky solution

low tangle
#

it feels like a solution to a workflow problem that doesnt exist

#

but most people are not willing to convert anyways

trail burrow
#

it just feels like a big hack

#

the conv workflow

clever depot
#

i also wish they would just put their efforts into making it native, and just saying there is no conversion process 😕

trail burrow
#

which i suppose, is exactly what it is

viral kindle
#

"both offline and runtime"
What?

zenith wyvern
#

I mean what's the point of ECS if you do not convert objects
@viral kindle
There's some use cases where dragging and dropping things in the editor just doesn't make sense

#

Like procedural generation

low tangle
#

basically there is a option for either @viral kindle

viral kindle
#

To be sure, by "offline" I mean "not in finished product but before release"

low tangle
#

they mean in the editor at some point before creating a build

#

which is offline / before build is baked

trail burrow
#

im just tired of things being broken and buggy

vagrant surge
#

that tps shooter lol

trail burrow
#

and not being able to rely on the engine that I use to work properly

#

@vagrant surge lol, you mean the 'netcode sample' ?

#

'dots netcode sample'

low tangle
#

the dots shooter

trail burrow
#

or w/e it is called

low tangle
#

its newer

#

pastel maze level

trail burrow
#

the one using the new netcode

#

yes

#

that one

viral kindle
#

I guess I will wait for final version still then

zenith wyvern
#

Even the latest one kinda feels like it's held together with duct tape

trail burrow
#

it's such a joke lol

low tangle
#

has the unity animation system in it

#

its very rough and clearly using stuff just exposed for it

#

not even close to a preview api

zenith wyvern
#

Which might not be a problem but at Unite they kinda presented it as this fully fleshed out example that works great

trail burrow
#

and has a few thousand lines copy pasted from the fps sample lol

low tangle
#

I'm waiting on that animation system to get a proper release

#

yeah they did

zenith wyvern
#

And it's definitely not that

low tangle
#

I was expecting animation to be much further along

viral kindle
#

Wait, it still does not have proper animation?

low tangle
#

it does

trail burrow
#

no

#

it doesnt

viral kindle
#

Thanks for clearing this up guys

trail burrow
#

lol

zenith wyvern
#

Depends on your definition of "proper" I guess, hahah

low tangle
#

it just has a uber complex matrix submission process for the skinned mesh renderers

trail burrow
#

@zenith wyvern This is my WHOLE issue with DOTS. What they are trying to do is cool, the performance is nice, etc... but they keep presenting it at unites like "THIS IS DONE AND AMAZING" and it so clearly ISN'T. DOTS as a whole is still alpha level code quality.

low tangle
#

you probally mean the do everything garabage animation system regular unity has

#

I'm talking about skinned meshes in dots

viral kindle
#

"everything garabage animation system regular unity has"
I mean, this system works

zenith wyvern
#

@trail burrow I agree with you for the most part, but they are a business so I guess they have to do what they have to do on the marketing front

#

Just a huge bummer when we end up seeing what they give us as a result

trail burrow
#

@zenith wyvern Oh sure, it's just... they've been presenting it like it's done for two years lol, but it's still at best an alpha.

low tangle
#

takes about 3x longer than their first release

#

they never quite say what is done

#

only reason they get away with it

trail burrow
#

they have their own version of dll-hell

#

upm-hell

#

😄

#

i wanted to build this new tech im fiddling on as a hobby inside DOTS

low tangle
#

do it?

trail burrow
#

no, i chose .net core 3.1 instead

#

because it's just... like, i can't get it to reliably do what i want

low tangle
#

thats cool too

trail burrow
#

the scheduling issues with the job system

#

and unity not being super stable for long running processes

low tangle
#

huh

trail burrow
#

dots being well... buggy

low tangle
#

I've had my dots game running for 3 days straight without issue

trail burrow
#

@low tangle that's great with anecdotal evidence 😄

viral kindle
#

"I've had my dots game running for 3 days straight without issue"
How and why?

low tangle
#

lol...

#

server for my game

#

vr sandbox

viral kindle
#

Oh, makes sense

low tangle
#

its just the full version of the game with no rendering

#

now that its fully dots, (voice chat was the last to convert) it now has stable memory usage

#

sits at a +- delta of 3mb with a few people on

#

which is amazing compared to when it was all monobehaviours and would rise and fall about 200mb

trail burrow
#

i've had too many random crashes and shit happening with unity in general and dots/burst specifically

#

to feel like i can rely on it

zenith wyvern
#

Nice to know there's at least a few people who seem to have fully fleshed out games running in dots, even in it's current state

low tangle
#

I've noticed 2019.3 the crashes went wayyy up with domain reload off in the editor play settings

#

yeah but I've been working on this since dots came out and its been a up and down ride

#

glad I never jumped onto the high level shit

#

it all rubbed me the wrong way, and the current is only marginally better

zenith wyvern
#

I guess you're talking about the conversion system specifically?

low tangle
#

yeah

#

that and subscenes

zenith wyvern
#

Very fair

trail burrow
#

subscenes, ugh.

#

tried to get that working

low tangle
#

I can't use them since lots of my game is loaded from asset bundles

#

theres no future api for me either from unity

#

so it sucks knowing I'll just have to replace most of asset bundles with a custom format eventually

#

that is if unity ever gets feature parity with other systems

trail burrow
#

im finally gonna get to jump ship to UE later this year

zenith wyvern
#

I'm probably reading too much into it but it kinda feels like subscenes were just a thing they came up with to make Megacity work and then they ended up running with it

trail burrow
#

as its looking now

#

@zenith wyvern that's their whole dev process lol

#

for literally everything

low tangle
#

good luck with that, I tried to switch several times to UE in the past

trail burrow
#

"oh this is cool i suppose we use this now"

zenith wyvern
#

Maybe so

low tangle
#

hate that engine arch with a passion

trail burrow
#

@low tangle luckily i don't build games, i build middleware 😄

low tangle
#

thats good then, you will be able to sell your plugins for way higher then

viral kindle
#

I tried UE twice

#

It's workflow is aweful

trail burrow
#

The workflow is just designed for larger teams

zenith wyvern
#

As someone who's always learning as they go UE just doesn't feel practical for me, I feel like you really need to know what you're doing to be able to tolerate the compile times

trail burrow
#

@zenith wyvern default way is blueprints, and then convert to C++ when you need perf

viral kindle
#

Yeah, and part of design is coffe break every time you change anything

trail burrow
#

If you use C++ from the getgo for everything in UE u gonna have a bad time

#

blueprints is the default way you should build things

#

and move to C++ when u need perf, build completely fresh functionality, etc.

zenith wyvern
#

Yeah, that also felt like such a foreign workflow to make everything revolve around blueprints

trail burrow
#

If you're used to Unity/C#, UE feels foreign af yes

zenith wyvern
#

I'm sure it's great when you get used to it but it's hard to beat the simplicity of the unity inspector and the play button

trail burrow
#

I mean literally the ONLY reason I'm staying with Unity is because C#. C# is such a good language/platform

viral kindle
#

My first approach to UE went like:

Me: "I want EMPTY SCENE"
UE: "Player? Can do! And I will also add a gun for free! Great deal!"

trail burrow
#

iteration times are fast

#

@viral kindle You're mostly just showing your ignorance with these complaints lol

#

i.e. didn't read past the first page of the manual

low tangle
#

set gamemode and pawn to empty

#

but thats besides the point

zenith wyvern
#

I don't know, I think saying it's a FPS focused engine (or seems that way to someone coming to it as a beginner) is a fair criticism

trail burrow
#

absolutely

#

it's an FPS engine that can be used for other things

low tangle
#

I can't stand not making games in a data oriented way anymore. everything being uobjects and object hierarchies just doesn't suit games anymore

trail burrow
#

DOD kool-aid 😄

low tangle
#

we should be moving to linear memory and linear processing of things, not more objects calling super.update() tick()

zenith wyvern
#

I think if someone enjoys making games using DOD and finds it preferable to OOP it's not really fair to say they're drinking koolaid. Just because OOP works great for you, not going to for everyone

#

And it's not like DOD is new

trail burrow
#

@zenith wyvern OOP and DOD are not opposite/competing technologies

zenith wyvern
#

Yes, but OOP is a huge pain in the ass for myself and lots of people, compared to making games with DOD

trail burrow
#

ECS and OOP are 'competing' technologies, DOD can be used with either of them

low tangle
#

alright well you want to argue so I'll just head back to work

trail burrow
#

im leaving for the day so 🙂

viral kindle
#

@trail burrow // I'm not saying it's UE's fault. But I will just have hard time fitting myself to that workflow.

#

I'm sure it's fine for poeple who work in this enviroment

#

And especially if your game fits what UE was made for

zenith wyvern
#

I'm with you, I find it much harder to use than Unity, and the insane download sizes and compile times don't make it any easier

viral kindle
#

I need to finally give UE at least a week of tutorial/manual learning

#

Who knows, maybe it will be better in long run

#

Same with Godot

zenith wyvern
#

Starting to feel like Unity is falling so far behind in departments where UE has been really fleshed out by this point though, like networking.

viral kindle
#

Networking at this point in Unity you know... does not exist

zenith wyvern
#

Yup. They've tried and retried so much I'm wondering if they'll ever get there

viral kindle
#

Unity is far from Unreal on many fronts now, sadly

low tangle
#

tbh off the shelf solutions is exactly what I'm trying to avoid

#

its why I disliked the hacked together network priority of unreals bog standard old networking

#

that hasn't had any major changes since unreal 2

#

its just been incremental changes

zenith wyvern
#

I'm not too familiar with it but I've heard people swear by it

low tangle
#

and any major game that has major networking requirements (mmos etc) just gut it right away

zenith wyvern
#

I guess it's a pretty low bar though considering the competition

low tangle
#

the only large amount of networking that is done on it was fortnite and pubg

#

which both required hacks to make it work

zenith wyvern
#

And had a lot of help from Epic I'm sure

low tangle
#

network priority also eats cpu performance since its non linear accessing all the objects to do a distance check and then store memory there

#

before cache thrashing and going to the next

zenith wyvern
#

Another place where dod can help out I suppose

low tangle
#

there was as test of a guy who literally added a ecs framework to unreal, and it ran about 10x faster than doing the same in unreal objects

#

for a simple space fighter game with ships flying at you

#

but unreal isn't setup for batch submission of matrices and what not like unity so its unable to get some real performance out of it

zenith wyvern
#

I thought I heard unreal is working on their own ECS now is that right?

low tangle
#

not exactly last I heard, they just made yet another subsystem for particles that is very ecs like

zenith wyvern
#

Ahh

low tangle
#

if you wanted to abuse it you could do ecs processing in it

#

but thats a hack

safe lintel
#

pretty sure it was vblanco who did that ue ecs implementation

low tangle
#

I've got the thread bookmarked somewhere

#

if I ever went back to unreal thats what I'd work on

verbal pewter
dull copper
#

unreal isn't fps focused engine at all, but if you look at their netcode and specifically client prediction code, it only exists for their character controller, in fact all that code is embedded on single 10k+ line c++ file

#

that one magic files contains like 5 different subsystems that should have been separeted years before UE4 was even a thing

#

I guess this is one of the things in that engine that worked on some old UE so they decided to keep it going

#

@vagrant surge would probably know the best here what Epic is cooking in regards of DOD

low tangle
#

yep

#

thats just the bone stock character controller too

dull copper
#

it's root of all evil, yes

low tangle
#

the rest of the networking is very undesirable as well

dull copper
#

super slow and perf heavy too

low tangle
#

yeah

vagrant surge
#

epic games isnt really adding an ECS, as far as i know

#

what i do know is that they are improving unreal for bigger worlds and better data management in general

#

for example subsystems, which are managed-singletons, or stuff like ISPC which is equivalent-ish to Burst, used for the new physics engine and some animation nodes

#

on the actor (gameplay) level, they are adding push-networking, which is setting stuff as dirty manually, to skip the "iterate all and check who changed" sstep in networking

#

and they are also adding class-data, which is to have some data that is shared beetween all object from a blueprint

#

like, say you are making a RTS, and have a bunch of unit data. Your Unit actor can be thin, and most of its paremeters are on this shared data thing

#

they are using it to thin a bunch of stuff

#

in general they are working towards making ue4 not-garbage for open world and large scale games

honest dirge
#

@verbal pewter that was a really useful video! Thank you.

low tangle
#

thats good

#

dirty bits are a waste of performance though (if you read the dod book it actually talks about dirty bits)

verbal pewter
#

@honest dirge Np!

vagrant surge
#

@low tangle its more like dirty lists + dirty bit

#

objects have multiple replicated properties

low tangle
#

yeah I know

vagrant surge
#

when you dirty an object property, it adds that object to a list of dirtied objects, and sets the "dirty" bit for the property that got dirtied

trail burrow
#

the whole thing of using dirty flags vs. computing the delta and finding changes every farme, etc.

#

is... not a clean cut decision

#

both approaches have their uses, and it depends on what you're replicating

#

i'd say that in general, the dirty bit systems (i.e. eventual consistency) is the more generic setup that works for more kind of games

#

than the straight delta/change detection setup, where you scan for changes manually

#

it's... like there isn't a clear winner, but dirty bit system has more uses IMHO.

#

but if you have the type of game, where delta compressed snapshots is the best solution, then having it all in linear memory is great ofc

#

because it's a lot of fkn data to scan 😄

dull copper
#

if you know ue4 architecture at all, you'll know how bloody slow they are there to iterate anything

#

even basic operations have huge overhead

#

I could see dirty bits working fine on codebase like that

verbal pewter
#

Hmmmm, so I was hoping to create a FixedList of BlobAssetReferences but it seems like that's not possible? The type 'Unity.Entities.BlobAssetReference<RockMine.CityGen.Networks.ConnectionEdgeData>' cannot be used as type parameter 'T' in the generic type or method 'FixedList64<T>'. There is no boxing conversion from 'Unity.Entities.BlobAssetReference<RockMine.CityGen.Networks.ConnectionEdgeData>' to 'System.IComparable<Unity.Entities.BlobAssetReference<RockMine.CityGen.Networks.ConnectionEdgeData>>'. [Assembly-CSharp]

trail burrow
#

it's not as clear cut as dirty bits being better or worse than delta snapshots

#

it depends massively on the use case

#

for example, a dirty bit/eventual consistency setup will use less bandwidth than a straight delta snapshot system

#

and it will use less CPU, even in the case of linear memory DOD type stuff

untold night
#

@verbal pewter - I'd use BlobArray for arrays in Blobs, as they're meant to be read-only. If you meant a FixedList of BlobAssetReference, I believe they're a just pointer (8 bytes on a 64-bit machine).

verbal pewter
#

Yes, the latter. To be honest I'm not sure if it's something I'm doing that's throwing that error or what.

untold night
#

@autumn sleet - Sorry, I was tired. You can allocate it on the stack since it's not on the heap, and you can store a Fixed* on a component, as since it's size is known it doesn't need the safety system and is safe to store there.

#

oh wait, I guess the type needs to implement IComparable to go in a fixed list

#

and BlobAssetReference only implement IEquatable

verbal pewter
#

Yeah, curious why BlobAssetReference doesn't.

untold night
#

well, what does comparing two blobs mean? They have no semantic ordering on their own, which is the reasoning I can see for not implementing IComparable<T>

frosty siren
#

@opaque ledge i completely forgot to update unity, thx, this fixed all issues

verbal pewter
#

Ah, ya, fair enough. Too bad 😦

opaque ledge
#

👍

verbal pewter
#

Oh man... can't use float4 either 😮

#

The use case for FixedList suddenly shrunk considerably.

opaque ledge
#

do you guys thing, in current state of ECS, its possible to make a decent sized game ?

#

i already went %50 on my game, and i was wondering if its worth to convert into ECS, but i am having hard time tbh

verbal pewter
#

Sounds like @low tangle has managed to.

#

I would focus on converting the parts that are performance bottlenecks.

opaque ledge
#

he is good tho 😄

#

like, i tried to make a 2 quaries... and i am stuck 😄

verbal pewter
#

As they say, premature optimization is the root of all evil 🙂

dull copper
#

if you are 50% through, are you really prepared to throw 100% of your code away to get going with this half done system? 🙂

#

there has to be good reason to swap IMO

opaque ledge
#

well, technically my game could use lots of performance gain from ECS

#

but not really 'essential'

dull copper
#

perf gains totally depend on your game too

opaque ledge
#

yeah, i have lots of calculation going on so

safe lintel
#

id probably recommend you dont switch tbh

opaque ledge
#

i mean i want to learn ECS, but someone has to make a comperehansive guide for OOP to Data Design 😄

mystic mountain
#

Have you ever looped over an array? Now do this for all of your code ;D

safe lintel
#

also prepare to be lacking sound, animation and pathfinding as there are no native ecs versions of them that are really friendly to use. you will need to stick with the old way for many things, and you might find its just not worth the hassle given you are both learning a new way to code, and dealing with incomplete, nonexistent/and or buggy features

coarse turtle
#

Hmm i think I might be on @safe lintel on this, like I enjoy using it - but in hindsight (comparing to using MonoBehaviour Unity or a custom engine) - right now I'm in a position where I'm like "okay this is kind of like building a custom engine") - a lot of things I've been making are actually from scratch (UI, basic physics) which also got me thinking the other day, why didn't my friend I just continue our own custom engine for the game 👀

safe lintel
#

if you want to learn it feel free 🙂 id just caution you for throwing out your existing project in an effort to convert it all to dots

dull copper
#

if anything, at least start doing some smaller scale prototypes with your game mechanics first

safe lintel
#

@coarse turtle i kinda regret jumping on this train this early too 😬 there are pros and cons but its a bumpy ride thats for sure

dull copper
#

see how it feels like

#

I personally love observing new tech coming along but DOTS in general has gone some many stages now and is still going through that it's been probably bumpiest ride in whole Unity history

#

also personally hate the whole conversion workflow

#

I really wanted to see full dots editor

#

it just adds the pain on fully adopting the new setup IMO

safe lintel
#

personally conversion is the least of my own issues, its like the strange intersection of srps & dots has issues, issues with job scheduling that i for the love of god cant track down, and lastly incomplete features forcing you to do a strange patchwork between built in and native interaction

coarse turtle
#

Hmm to that point with seeing how it felt - that actually convinced my friend as a workflow since it was "feasible" to setup with some monobehaviours for certain things that we could migrate it later - but at this point we were like "yea we'll embrace these changes - it's quite a nice learning experience - even though a lot of things are built from scratch" 😅

But yea my fault for not vetting the whole thing more thoroughly early on- overall I'm okay with the current conversion process since we have a lot of custom conversion scripts for the things we need for our game

opaque ledge
#

yeah i love DOTS, like i like the designing, Component data, Buffer elements, systems, i mean there are so neat, plus the performance boost, but i have hard time to put my toughts/plans into code, i can do it on OOP but not on DDO

coarse turtle
#

We spreadsheeted a lot of things early on (since we had existing code from our own engine) and just focused on the "minimal" amount of data required to do x thing

#

and we built from there, so it was a lot of here's our high level design, now what do we really need and how many of these entities are there going to be

safe lintel
#

@opaque ledge i do really enjoy the ecs system nature, feels way better than using monobehaviours or trying to force monobehaviours into a similar manager > component workflow

coarse turtle
#

i'd focus on the thinking "What is the data you need to do x things" and kind of think of it like a "database" for a lack of a better phrase (you'll need these data/attributes from some_space (like a table) with this query to get the data), the dod book @low tangle mentioned can give you insight too @opaque ledge

low tangle
#

yes

#

I'm busy doing a game test atm so I cant chat

zenith wyvern
#

You can always transition performance sensitive code to use bursted jobs to start with, should be much easier than trying to convert an entire game to ECS

#

If performance is your only concern @opaque ledge

#

Should also give you a good idea of how the whole ECS framework works under the hood without having to dive in the deep end

opaque ledge
#

yeah

#

i think i will stick to monobehaviours for this game

coarse turtle
opaque ledge
#

so i wanted to ask to DOT experts, so i am making a space game, where lets say there are 30 stations, there are 5 factions owning 6 station each, each station has a market with their own supply and demand and market item's price is changing according to that supply and demand (and base price) so i want each cooperation to create a trade ship, and carry items from stations to stations respecting buy low sell high, so how would you program a system to do that.

#

I first places faction tag to those stations so each cooperation can get their own stations, but i just couldnt do double query to compare market to market and choose the most lucrative route to send trade ship to.

#

So i am like, if i cant even solve this i really cant make a game using ECS 😄

zenith wyvern