#archived-dots

1 messages ยท Page 204 of 1

ocean tundra
#

it supports massive rendering (megacity)

gusty comet
#

megacity only runs on high end pcs?

ocean tundra
#

it runs on iphone

gusty comet
#

uhm

#

i already exporting megacity from zip and i want to see that

ocean tundra
#

i just remember watching the unite vids

#

never tried it myself

#

and to use megacity in latest ecs is a massive update process

gusty comet
#

megacity is using old one yes?

ocean tundra
#

yup

#

make sure you use exact versions of everything

#

it might work

gusty comet
#

now i just want to see netcode working with ecs because for now its bugs and its just not working, like its issues with time delta and i need to use vsync because some guy from unity team said that

ocean tundra
#

yea i gave up on netcode

#

making my own

gusty comet
#

its possible to use easily ecs and custom networking?

ocean tundra
#

def not easy

#

nothing about networking is easy

#

depends on your target game type i guess

gusty comet
#

my game is just facility nothing big for render just game based on rooms

ocean tundra
#

i want a rts/strategy/management and netcode def wont work for that

gusty comet
#

currently we using Mirror networking but yes its just still monobehaviovurs

#

and aka based on unet

ocean tundra
#

first/third person controllers would probably work fine with netcode

#

honestly if you have it working in normal unity i wouldnt update

gusty comet
#

its working but performance side its shit

ocean tundra
#

youll be going very var back to ground 0 and rebuilding everything

#

theres tons of optmization options in normal unity

gusty comet
#

game is generated from seed and occlussion culling uhm nah

#

sometimes i have like 30 fps but looking in another way i getting like 10

ocean tundra
#

have you actually tried any optmization tricks?

gusty comet
#

idk

ocean tundra
#

also is it code or rendering causing the issues?

gusty comet
#

its basic rendering

ocean tundra
#

rendering wont benifit too much by ecs

gusty comet
#

we tried HDRP but its hard

ocean tundra
#

most of the performance gain is being able to jobify your gameplay code

#

well hdrp is not for performance

gusty comet
#

if i looking at profiler its just most by rendering

ocean tundra
#

yea sounds like you need to look at rendering performance tricks

#

things like LODs, merging models, impostors (is there a large view distance?)

#

manual culling/urp custom culling might be a option too

gusty comet
#

we have settings for graphics, shadow distance and draw distance everything is low

ocean tundra
#

graphics wise it dosnt look anything crazy, should def be able to optmize that

gusty comet
#

that gameplay is not latest and most things is fixed like player pos sync and other stuff

#

but yes, for me game is running like at 10-30 fps

#

its not good while what game need to render is not big

timber ivy
#

yo roy

#

would you mind taking a quick scan of my project

#

lmk if i didn't any dumb shit in ecs?

#

i can drop a link

ocean tundra
#

i only really know the core stuff, havnt done much job stuff yet

#

send me a pm in a few days

#

not a ton of time atm

timber ivy
#

aight will do

gusty comet
#

i just idk why aka game is running like shit, and most reviews on steam is like GAME is crypto miner, performance is bad

timber ivy
#

for those that do have some time id love to heaer your opinions on my code

gusty comet
#

also its EARLY access and most is just bitching about that

ocean tundra
#

@timber ivy Ill ask you to review mine at some point ๐Ÿ˜›

timber ivy
#

no problem haha

gusty comet
#

any good way to optimize game by just rendering?

#

basic render pipeline or urp

ocean tundra
#

honestly i have no clue

gusty comet
#

all rooms have realtime light

ocean tundra
#

get googleing i guess ๐Ÿ˜›

#

try baking?

gusty comet
#

we cant bake while its prefab and map is generated from seed

ocean tundra
#

yea ive run into that

#

my solution was to move the procedural generation into the editor, and then generate like 1000s of scenes (as prefabs) during my automated builds, then ill bake them all out

#

was annoying getting lightmaps from many scenes merging together

timber ivy
#

Im trying to create a custom navmesh for dots

#

anyone see an issue with just

#

creating X amount of points

#

that represent a shape

#

and anypoint within those points

#

is a valid walkable area?

#

like a bunch of rects for a lack of better words

#

im not really finding much info on creating triangular meshes

lusty otter
#

I've found an issue where NativeArray<T>.CopyTo(T[]) would fail for some reason in Android build, adb logcat shows ArgumentException: Object contains non-primitive or non-blittable data.

#

The struct is definitely primitive and it works just fine in editor, the same struct also goes through Bursted jobs without issue.

#

I've found an old issue tracker related to IL2CPP which is what my project uses, so it's probably that.

#

I don't have time to trim down for a minimal reproduction and file a bug report, but in case anyone hits the same problem, I solved it by doing a manual loop to copy instead of using that method.

#

Not efficient but what can you do.

ocean tundra
#

@lusty otter damn I'm using alot of copy to

lusty otter
#

It's not consistently failing, only seems to fail at that specific point in my code for seemingly no reason at all ๐Ÿคทโ€โ™‚๏ธ

light mason
#
var nodeLibEntity = GetSingletonEntity<NodeLibraryBufferComponent>();
var nodeLibBuffer = EntityManager.GetBuffer<NodeLibraryBufferComponent>(nodeLibEntity);
Entity masterEntity =  EntityManager.Instantiate(nodeLibBuffer[0]);
Entity masterEntity1 = EntityManager.Instantiate(nodeLibBuffer[1]);
#

for the life of me i dont understand why this is not working

#

anyone see any thing wrong her

#

e

frosty siren
mint iron
lusty otter
#

Oh true.

#

Well I'll leave it for now because it's a part of the code that's not performance critical, and I'll just see if it magically gets fixed sometimes later.

gusty comet
#

how i can convert that?

#

what means, regenerated

slim nebula
#

it means the stuff in Assets/NetCodeGenerated needs to be deleted and generated with the new version

gusty comet
#

also i looking at GhostSnapshotValue and that thing got removed and idk any replacement for that

slim nebula
#

that deserialiize thing is not required anymore I don't think. it just gets generated now I think

#
        public struct Request : IRpcCommand
        {
            public long Version;
        }
#

ICommandData needs tick and that's it

#

what is the context of GhostSnapshotValue?

#

I forget what that was

#

perhaps the code around it will ring a bell for me

gusty comet
#

now i just trying to update dotssample to latest packages on 2020.2 unity

slim nebula
#

oof yeah I dunno what that is but.... I've tried updating dotssample before and there's a LOT in there that's changed

#

the whole animation system has been completely revamped and the old version of the package isn't available anymore

gusty comet
#

i see, every thing from animation is just dont exists

slim nebula
#

yea. is unity.animation in preview yet? when I checked late last year it was still unlisted (had to manually add github link)

#

I think you'll be doing a lot of rewriting to update dotssample sadly

#

if your plan is to use that sample to learn... you've got a catch 22

gusty comet
#

i just want to see some sample with netcode and most things like dots animation/physics

slim nebula
#

dots animation isn't really ready tbh

#

there's plenty of dots tutorials on youtube and in the docs and pinned in this channel

#

best place for netcode is getting started guide

#

not many ppl working with netcode but I've faught my way through it so feel free to ask questions

gusty comet
#

netcode is only UDP? or transport have option to make custom one like steam networking

slim nebula
#

netcode is UDP only

#
Unity Technologies Blog

This blog was last updated, 27th April 2020. As many of you know, we put UNet into maintenance mode because we believe there is a better way forward with our new connected games stack. Since this announcement, we have learned that many of our developers need guidance about the best path for their game during [โ€ฆ]

#

personally my plan is to use UDP for player-server interactions and I plan to try and get gRPC running for server-server communications

gusty comet
#

also, sync of pos is better by done sending just pos/rot than inputs?

worthy rampart
#

depends killers

slim nebula
#

depends on the game. sending pos will let clients just teleport anywhere. if you're subtracting the new pos from the old pos on the server to protect against this then it's really the exact same thing

worthy rampart
#

that's very susceptible to hacking

pliant pike
#

does Allocator.Temp not work anymore or something? I get an error saying must use TempJob etc, I 'm not even using it for a job I'm just using it in Onupdate() ๐Ÿ˜•

slim nebula
#

i use it everywhere but I'm not on super latest code I guess

#

what's the wording of the error?

pliant pike
#

InvalidOperationException: The Unity.Collections.NativeArray1[Unity.Entities.Entity] GatherEntitiesJob.JobData.Entities is allocated with Temp memory. Temp memory containers cannot be used when scheduling a job, use TempJob instead.`

slim nebula
#

is this inside a query with .schedule()?

north bay
#

Do ToEntityArray and ToComponentDataArray still require a TempJob allocation? What version are you on @pliant pike?

pliant pike
#

nope @slim nebula

#

2020.1.0b1.1725

slim nebula
north bay
#

Oh sorry, entities version

slim nebula
#

this seems to worrk for me

#

oh,, i'm on 2020.1.17f1 which is maybe close to ur version

pliant pike
#

I'm using ToEntitieArray()

slim nebula
#

i dunno

pliant pike
#

I'm basically just getting the entity to get a buffer then disposing after that entity array straight after

slim nebula
#

those aren't inside a query tho. they are just in onupdate directly

#

you sure you aren't passing it into a job later somewhere?

pliant pike
#

yep there's not even a job in the system, its just an input system

slim nebula
#

oof yeah no idea man

pliant pike
#

no worries tempjob will do just as good I guess

gusty comet
#

syncing position of players while game is based on rooms in facility and its 16+ players

#

or more

#

its not like fast shooter or something

#

just explore facility and escape

slim nebula
#

it could definitely work yes

zenith wyvern
# pliant pike I'm using ToEntitieArray()

The reason it won't let you use temp there is because you can't pass temp to/from any kind of job, even a job that runs on the main thread. A temp container can never safely change scope

#

So ToEntityArray involves a bursted job that tries to output a nativecontainer

pliant pike
#

how comes ToComponentDataArray works that's also a bursted job ๐Ÿ˜•

zenith wyvern
#

I wouldn't have thought it would, huh

pliant pike
#

yeah maybe simoyd was confused I can't test it with mine because it was a buffer

north bay
zenith wyvern
#

Definitely possible, I could be working off outdated info

slim nebula
dark cypress
#

Can I control which order the OnCreate system methods are called? I have a simulation system that reads from an initialization system in OnCreate, but they don't run in that order for some reason. Even though I'm calling GetOrCreateSystem to get it.

ocean tundra
#

The order goes all OnCreates => Initilize systems OnUpdate => Sim OnUpdate => Pres OnUpdate

dark cypress
#

So that's a no? I can't initialize my systems in OnCreate if they depend on other systems being initialized in OnCreate?

ocean tundra
#

i dont think you can control no

#

what are you trying todo tho?

#

oncreates can get the other systems

zenith wyvern
#

You're saying a init system runs it's OnCreate befre your Sim System's OnCreate?

ocean tundra
#

then in onupdate you access them to get stuff

zenith wyvern
#

Err the other way around

dark cypress
#

I'm trying to cache an array from a system.

ocean tundra
#

yea i always just cache the system, then do system.Array to access the array

dark cypress
#

Aight, guess I'll go with that.

zenith wyvern
#

I would have thought OnCreate would respect system order as well, that's lame that it doesn't

ocean tundra
#

copying Native collections can be a bit tricky, as its a struct so when you copy you come SOME of the instance info (IsCreated for example) and if you dispose it only the one you dispose IsCreated gets changed

#

the actual items is not copied tho

slim nebula
#
        protected override void OnCreate()
        {
            StationManager = World.GetOrCreateSystem<StationLoaderUnloaderSystem>().StationManager;
            InstanceManager = World.GetOrCreateSystem<InstanceLoaderUnloaderSystem>().InstanceManager;
        }
#

this should create the system if it doesn't exist

#

GetOrCreateSystem

dark cypress
#

Doesn't call OnCreate for me.

slim nebula
#

oh

#

i mean. you could put things into the constructor I guess maybe?

#

not sure if that causes problems :S

timber ivy
#

So waitup

timber ivy
#

unity doesn't let you upgrade projects to new versions anymore?

slim nebula
#

select a version dropdown @timber ivy

timber ivy
#

yeah ignore me

#

just saw that

#

my bad

timber ivy
#

Can you use interfaces with components?

#

and then

#

query from the interfaces type?

ocean tundra
#

@timber ivy no i dont think so

#

the issue is you take a struct (value type) and box it into the interface.
I think this does stuff with the underlying memory

#

makes it into a reference type

timber ivy
#

ah ok

#

thanks bud!

ocean tundra
#

all good

#

there are 2 options to kinda let you reuse code like interfaces would give you

timber ivy
#

i guess things like inheritance patterns are what ecs tries to avoid

ocean tundra
#

generics and code gen

timber ivy
#

Ill just design around it.

#

can a component reference a regular struct?

#

not really a reference at that point ik but jw if i can

ocean tundra
#

yup thats fine

#

yea its not a reference

coarse turtle
#

as long as the struct contains blittable data

timber ivy
#

ye

ocean tundra
#

the data will exist within the compoent

coarse turtle
#

you can do something like this too if you need to:

unsafe struct SomeStruct : IComponentData {
  SomeBlittableType* Pointer;
  IntPtr IntPtr;
}
ocean tundra
#

WriteGroups are a interesting concept

#

is there any more info on them anywhere

#

not sure ive got my head around them completly yet

coarse turtle
#

i think it's just the manual and looking at the transform systems as the key examples

#

i tried to use them once but I couldn't figure it out fully

ocean tundra
#

from a quick read, looks like external components can modify my entity querys

#

but theres some sort of overriding/extending options too

timber ivy
#

is there a way to manually create a monobehavior for the authoring stage?

#

like

ocean tundra
#

you can implement a interface

timber ivy
#

ok will it be possible to use two diff variables on the component and monobehavior?

#

two diff variable types*

safe lintel
#

ive tried to digest write groups several times and still failed

ocean tundra
#

@timber ivy what do you mean by 2 diff variable types?

timber ivy
#

like

#

I want to have 3 variables on my component

#

3 bytes

#

red green blue

#

and Color

#

on the generated monobehavior

ocean tundra
#

yea thats fine

#

but not generated

#

you would manually create the MB, implement that IConvert... interface

timber ivy
#

how do I tag it to a specific component?

ocean tundra
#

in the Convert method you read your color values and manually add the component

timber ivy
#

ah gotcha

ocean tundra
#

manual IConvert's are my fav way to get data into entities

#

the generate attribute feels too limited

#

and full on conversion systems is a bit much

timber ivy
#

ig i could just make a custom inspector

#

instead

#

no?

ocean tundra
#

@safe lintel the way im kinda understanding them is its a .WithNone that gets specified using attributes instead of on your actual query

#

no clue if you can create custom inspectors for generated authoring types

#

probably can

timber ivy
#

cause

#

then i could just

#

use a color field

#

and save the data in ongui

#

and really

#

for every variable

ocean tundra
#

honestly feels like simlar amount of work to create the mb, have a public color field and implement IConvert

#

up to you what you want your workflow to be

timber ivy
#

yeah yu're right its similar

#

but idk the authoring system

#

just doesn't click for me

north bay
#

I really like IConverts instead of the per component (GenerateAuthoring) approach. With custom convert scripts you can actually specify all components your systems need without having your gameobject inspector consist of +20 empty components...

ocean tundra
#

really? i'm actually starting to really like it

#

yea thats why i started with IConvert, having a TON of generated authoring types or 1 fancy mb with all my fields which adds all my components

north bay
#

I had all of those as GenerateAuthorings before

#

Now I just put them into one character script and done

ocean tundra
#

damn

north bay
#

Super clean and easy for me to reason about

#

Those are basically all components (without config data) my character needs for a specific gamemode

ocean tundra
#

this is my component, basicly you mark what types you want networked, and internally it does a ton of stuff, adding both client and server types to the entity and creates a background entity for the server

north bay
#

You are working on a networking framework?

ocean tundra
#

i need to tidy that inspector ๐Ÿ˜›

#

yup

north bay
#

What genres are you targeting?

ocean tundra
#

rts/stragety

north bay
#

Ohhh

ocean tundra
#

basicly games that have lots of the same stuff ๐Ÿ˜›

#

perfect for dots

north bay
#

Feel free to share some stuff once it is ready (testable) ๐Ÿ˜‰

ocean tundra
#

yea im considering making it open source

#

i've built the same stuff a few times now

#

but never really polished it

#

This is the code generator, external types are added to the list manually, but you can attribute your own types to add networked support, commands are all attributes as they need to be custom built

#

the idea is you can mark any struct (blitable) type and get that synced over the network

#

and even specify what fields you want to sync/watch

proper cliff
#

If I add the DOTS packages to my project, but end up not using it, can I remove them cleanly or will they do hinky stuff to my project that I can't easily undo?

ocean tundra
#

@proper cliff make a backup and try it

#

it will probably be fine

proper cliff
#

yeah figured that would be the answer ๐Ÿ˜›

#

I use source control so I should be covered

timber ivy
#

if i do generatingauthoringcomponent

#

and then

#

add the generated component to a gameobject via code

#

wil things still work out correctly

ocean tundra
#

umm kinda confused by that

timber ivy
#

like

#

gameobject.AddComponent

ocean tundra
#

when you say add generated compoent to gameobject

#

are you talking about in editor?

#

or runtime?

timber ivy
#

editor

ocean tundra
#

that should be fine

timber ivy
#

then when i press play it will convert them all to entities automatically correct?

ocean tundra
#

yea

#

kidna

#

are you using subscenes?

timber ivy
#

nope

#

not yet anyways

ocean tundra
#

then yea i think conversion happens right after you press play

#

in the first frame

timber ivy
#

uhm

#

what is the component name generated?

ocean tundra
#

name of componentAuthoring?

#

no clue

timber ivy
#

like

#

When I try to do addcomponent

#

its trying to add icomponentdata component

ocean tundra
#

yea that needs to be the auto generated component

timber ivy
#

instead of the one generated by codegen

north bay
#

You cannot reference the generated component

ocean tundra
#

well i guess you need IConvert then

timber ivy
#

so i cannot addcomponent<T> it?

ocean tundra
#

ive actually seen that complaint on the fourms

timber ivy
#

thats lamee

ocean tundra
#

i think the generated component is private or something

#

someone was using reflection to get it

north bay
#

I think that will be fixed once we have roslyn based codegen

ocean tundra
#

Ooo roslyn? like source generators?

north bay
#

Yea

ocean tundra
#

i tryed to get those working and it sucked

#

super hard to get working in unity

north bay
#

I don't think you can in the current version

timber ivy
#

is it not generating source files as of now?

ocean tundra
#

just gave up and made my own ๐Ÿ˜›

north bay
#

You have to change your compiler or something

timber ivy
#

its just generating a dll? xd

north bay
#

Ehhh

#

It's processing your dll

#

As far as I know

ocean tundra
#

yea i think they generate a new dll from your dll

slim nebula
#

is this what you mean?

ocean tundra
#

but i guess you cant reference the new dll

timber ivy
#

yes @slim nebula

slim nebula
#

like you want to reference the authoring component? why?

timber ivy
#

im trying to AddComponent<T> the generated component

ocean tundra
#

editor stuff

timber ivy
#

because i am making an editor script

slim nebula
#

like to a monobehavior?

timber ivy
#

yes

slim nebula
#

ohhhhhhhhhhhhh

timber ivy
#

it creates a gameobject

slim nebula
#

sorry my bad

timber ivy
#

attaches generated component

#

and then when i press play it will convert it to entities

slim nebula
#

yeah you can't reference the authoring component

#

would be a circular dependency

timber ivy
#

that is super lame but

#

ill figure something out

#

how?

ocean tundra
#

IConvert

#

its the answer ๐Ÿ˜›

timber ivy
#

so

#

remove [GenerateAuthoringComponent]

#

and

#

create my own monobehavior

#

that impliments iconvert

ocean tundra
#

yup

timber ivy
#

am i missing any steps?

slim nebula
#

i mean your type gets built into an assembly, then your code gen uses refleciton on that assembly to create the code. It would be a circle to then use that by the original assembly

ocean tundra
#

their example is super simple

#

thats all you need for your color component

timber ivy
#

awesome

#

thank you roy

#

I still dont understand how its a circular dependency the code is in your project how is referencing it a circle

ocean tundra
#

dll 1 (your code with your component) <= generated dll1 (authoring component)

slim nebula
#

if it changes you wont be able to compile your project

ocean tundra
#

cant also have dll1 use generated dll1 cause it references dll1

slim nebula
#

because your code would reference the generated type

timber ivy
#

does the generated type reference our code?

ocean tundra
#

yea

#

sorry my arrow was around the wrong way

timber ivy
#

but if it edits the existing dll

#

they are in the same dll

slim nebula
#

it builds without it, then adds it

ocean tundra
#

na it makes a new dll

#

not edits

#

wayyy harder to edit a existing dll

slim nebula
#

but if it references the type and you change it then you can't compile the generated code, but iif you delete it to regen it then your code doesn't compile because you needed it

#

anyway, you can make dll2 and should be able to reference the type

#

I dunno if it's public tho

ocean tundra
#

yea but relying on generated code is a terriable idea ive discovered

slim nebula
#

you can work around circular deps with interfaces in your own types in the 2 dlls

ocean tundra
#

i generate a ton of files, but if something goes wrong then generation fails. leaves me with failing code cause files are missing

slim nebula
#

yeah generated code is probably owned by the person who wrote the generator. so it's almost like internal unity code.... referenccing it is prolly bad

ocean tundra
#

yup. thats why i wanted source generators

north bay
ocean tundra
#

oh damn

#

wonder how they did that

#

wish we could plug into their code gen

#

but its internal

#

and it dosnt exist in your code

north bay
#

It comes together with the entities package in assemblies ending with .CodeGen

#

And you really don't want to touch it, it's a mess

ocean tundra
#

๐Ÿ˜› which is super duper complicated

slim nebula
#

you code still needs to compile first without it. so you can't reference it

ocean tundra
#

yea

north bay
#

Let's see how this will go...

ocean tundra
#

yup

#

one day tho

slim nebula
#

yeah rofl

ocean tundra
#

will be a while off i think

north bay
#

My guess is 2021.2/2022.1

timber ivy
#

2021.2 is already out

ocean tundra
#

what noo thats way too quick

north bay
#

The IL post processing time is just so f* annoying

timber ivy
#

nvm

#

2020.2 is out

ocean tundra
#

yea im already using 2021.1

timber ivy
#

it stable?

ocean tundra
#

ummm

#

no

#

๐Ÿ˜›

timber ivy
#

i remember the first 2020 editor that came out

ocean tundra
#

but its wayyy better then any beta/alpha ive ever used

timber ivy
#

you'd be chilling at the progress menu

#

for like 10 years

north bay
#

2021.2:
Scripting: Update Roslyn to 5.0.102, Update NetCore to 5.0.2

Idk if that version already includes source generators

ocean tundra
#

WHAT!!

#

link please

north bay
timber ivy
#

unity uses netcore now?

north bay
#

Bottom of the page

timber ivy
#

when did they move from mono to netcore?

ocean tundra
#

wow i really didnt expect anything like that anytime soon

slim nebula
#

i've been waiting for it

#

hopefully they don't botch it too hard

ocean tundra
#

maybe they havnt? and its just editor?

slim nebula
#

they announced what 2018 they were gunna do it

#

maybe 2019 I forget

#

fuck

ocean tundra
#

i read somewhere that .netcore referred to a background tool

slim nebula
#

that's the version I WANT

timber ivy
#

so unity doesn't use mono at all anymore?

slim nebula
#

not even on 2020.2 yet tho rofl

#

might just wait for 2021.2 to get more stable

#

but 2021.2 is that lts? or do I have to wait for 2022.2?

ocean tundra
#

I do expect that will be .NET 6 though, not .NET 5, since .NET 6 is the LTS release from Microsoft. ```
north bay
#

I'm getting some mixed information right now

slim nebula
#

ooo multi year

#

ouch

ocean tundra
#

yea sounds like thats for editor/background tools ๐Ÿ˜ฆ

#

maybe the editor now uses updated roslyn tho

#

even if its still mono underneeth

north bay
#

I'm really looking forward to code gen

ocean tundra
#

@north bay you can do it now tho

slim nebula
#

it would be super sick to allow client side c# scripts

ocean tundra
north bay
#

I want unity to do it not me ๐Ÿ˜„

#

15+ seconds IL time on recompile

ocean tundra
#

source generators still dont give you a templating language

north bay
#

Because of stupid Entities.ForEach calls

#

I went from 40 seconds to 15-20 by getting rid of half of my entities.foreach calls and replacing them with manually written IJobChunks

ocean tundra
#

well that expains my creeping compile times ๐Ÿ˜›

slim nebula
#

i mean they mention safe which is a plus. the syntax doesn't make me immediately barf. i might look at it. would be ideal to just have proper c# tho

ocean tundra
#

marking 1 type as syncable = 7ish systems with Entities.Foreach

slim nebula
#

what's more efficient with manually written IJobChunks? can you post an example?

#

@north bay

ocean tundra
#

the advantages of source generates is that they generate 'into' your dlls at coding time, so you can reference and use the new types

north bay
#

Compilation times

#

Nothing runtime related

slim nebula
#

ohhhh

#

wew yeah they really need some like intermediate compile cache or something

ocean tundra
#

@north bay whats the best way of making all the IJobChunks? did you just take the generated jobs and copy them into your project?

#

or full on manually wrote them?

north bay
#

No, I manually rewrote them

ocean tundra
#

oh damn

north bay
#

Took me a week

#

At least 150+ systems

#

Also took that opportunity to optimize the jobs to use HasComponent on the chunks so... whatever i guess

ocean tundra
#

IJobChunk is the fastest runtime wise?

north bay
#

Basically using chunk operations where possible. But I really like how simple Entities.ForEach is to get running

#

Like the boilerplate you have to write for jobs is just so annoying

ocean tundra
#

yup

#

not too bad for me as ill just have to update my 1 template ๐Ÿ˜›

north bay
#

I think there's a new one that is able to operate on subset of entities instead of on a chunk basis for parallel work

#

So that might be better

slim nebula
#

man I gots all the code snippets

#

got me a rythm goin now

ocean tundra
#

haha yea i need to build those up

#

@north bay Do you know what the new job type is called? i should probably start learning/rewriting my entities foreach

#

if not now then soon when i start focusing on performance

north bay
#

Ehhh

#

I think it's IJobEntityBatch

timber ivy
#

What namespace is IConvertGameObjectToEntity in?

#

im in the process of reinstalling visual studio so i can't just right click it

ocean tundra
#

@timber ivy get rider

timber ivy
#

is it free?

ocean tundra
#

namespace Unity.Entities

timber ivy
#

it says it can't be found

ocean tundra
#

na but the costs are so so worth

#

asmdef's?

timber ivy
#

IConvertGameObjectToEntity

#

yeah and im able to use

#

the create add component etc

#

I reference Unities.Entities assembly

ocean tundra
#

damn so much code for manual jobs

#

Ooo and this IJobChunk has been superseded by IJobEntityBatch, which should be used for new code.

#

Is a chunk component the same thing as a Shared component?

safe lintel
#

i think many chunks can have the same shared component, but chunk components are not shared

ocean tundra
#

Thanks

#

still unsure where i would even use them yet

#

i expect if i was doing more chunk based manual jobs it might make sense

zenith wyvern
#

Is there some way to stop hybrid renderer from adding sprites to gameobjects with spriterenderers that get converted?

pulsar jay
#

Does anybody know what causes this error: "Trying to render a batch from the Hybrid Renderer V2 with SRP Batcher OFF. This is not supported.
Please turn SRP Batcher ON to use the Hybrid Renderer V2."

#

SRP batcher ist turned on in the render pipeline settings ๐Ÿค”

vernal glen
#

opengl?

#

there's a minimum version required for the SRP batcher

safe lintel
#

@pulsar jay basically if you have hybridv2 enabled, need to enable srp batcher.

pulsar jay
#

@safe lintel yeah thats the thing - SRP batcher is enabled

safe lintel
#

ah, in that case do you have v2 enabled?

pulsar jay
#

or is there another place where it needs to be enabled?

safe lintel
#

as i think its the opposite if v2 is not enabled

#

check your scripting defines in the player settings if you have ENABLE_HYBRID_RENDERER_V2

pulsar jay
#

yeah its in there

#

I am currently trying to update packages and see if it goes away with more recent versions

safe lintel
#

restart unity? all out of ideas if that doesnt work

pulsar jay
#

already tried that

#

it also only happens in built

#

but I already made multiple builds with restarting in between

safe lintel
#

i made this script a while ago because for whatever reason unity decided to auto disable the srp batcher on its own, so for recompiles id reenable it. i suppose you could try it out for scene loads and see if srp batcher is somehow being disabled https://pastebin.com/g68NtaQN

#

but one more thing, if you made a packages only build and just plopped in a cube and still get that error, probably a bug to report

pulsar jay
#

great thx for the script

gusty comet
#

playmode, hdrp, hybrid renderer v2, why i see low fps?

safe lintel
#

use the profiler

karmic basin
#

Also disable safety checks and such

covert cairn
#

new to dots, how do i rotate my entity?
i tried this

rotation.Value = quaternion.Euler(math.mul(rotation.Value, rotator.axis * rotator.speed * deltaTime));

but it rotates only once

#

rotation is IComponentData

safe lintel
#

repeat the code the next frame? not sure what the rest of your code is doing

gusty comet
#

@covert cairn how and where are you calling that code?

covert cairn
#

in Entities.ForEach

#

i have translation which works fine and my entity moves but the rotation happening only once

#

here's the complete code

        Entities.ForEach(
            (ref Translation translation,
                ref Rotation rotation,
                in MoverComponent mover,
                in RotatorComponent rotator) =>
            {
                translation.Value += mover.Speed * deltaTime;
                if (translation.Value.y > 4) translation.Value.y = -4f;

                rotation.Value = quaternion.Euler(math.mul(rotation.Value, rotator.axis * rotator.speed * deltaTime));
            }).Schedule();
north bay
#

You are creating the same quaternion each frame.
Try something like this instead:
rotation.Value = math.mul(rotation.Value, quaternion.AxisAngle(rotator.axis, rotator.speed * deltaTime))

covert cairn
#

@north bay thanks that fixed the rotation

#

one weird doubt, lets say there's 2 system both of which take in the Move & Rotate component, at runtime will both of them be executed so the final translation & rotation is sum of the two systems or only one will run?

amber flicker
#

be aware though that with hierarchies, the local to world matrix is updated in the Transform system, once per frame. So if you want to position something in system 2, based on the world position of an entity after system1 has run, you need to think about that.

gusty comet
#

Hey guys, I'm trying to setup a new dots project in 2020.2... And to get the samples because I wanted to check the physic last updates. Bunch of errors, last one is that I'm missing ECSTestsFixture. Di you know which package I should add please?

covert cairn
amber flicker
#

yup absolutely ๐Ÿ‘

pulsar jay
#

@safe lintel I tried your script but it does not trigger as SRP batching is already active. Also the error does only happen in built. Could it be connected to me still using the classic build pipeline?

safe lintel
#

not sure. i thought the new build pipeline primarily addressed subscenes in builds but maybe it affects other things? i think id do a packages only build, (and then maybe a packages + scripts only build) and see if rendering something super simple like a cube/sphere works or not

pulsar jay
#

yeah I guess I have to try that

whole gyro
# pulsar jay Does anybody know what causes this error: "Trying to render a batch from the Hyb...

Also happening to me in builds. The game seems to be rendering things just fine though. Someone just asked about this on the forums yesterday: https://forum.unity.com/threads/how-to-please-turn-srp-batcher-on-to-use-the-hybrid-renderer-v2.1067003/

karmic basin
#

oOOoOooo he's the author of dotsnav ๐Ÿ™‚

safe lintel
#

which version of unity are you guys using?

whole gyro
#

2021.1.0b4

#

I'll try updating to the latest beta

whole gyro
#

Same error in 2021.1.0b8

safe lintel
#

ok was curious and made a new project, just urp sample scene and latest hybrid renderer and the built player renders entities properly with hybridv2 and srp batcher

#

wonder if its some specific combo of packages now

#

or hdrp?

acoustic spire
#

How would you handle situation when there is a huge lag in a frame because of heavy entity processing (~1000 entities) but you can only determine that you need to process that entities in this exact frame?
I need to somehow spread the load on multiple frames because burst + parallel jobs is not enough and there will be even more load in future.

  1. I suppose I could schedule a single job but I have no idea how to make it to safely write data back to entities - I can't use ECB since computing would be not a single frame job i.e there are no sync points
  2. I need to manually determine which amount of entities possible to process without framerate drop and keep it in special singleton that stores remaining "dirty" entities for next updates. It's easier approach but I don't like because I'll need to constantly change the value of maximum allowed entities for smooth fps.
ocean tundra
#

@acoustic spire ~1000 entities should be a brease

#

what are you doing?

acoustic spire
#

Let's say they are chunks

ocean tundra
#

but some ideas are:
you tag only X entities, and have X number of tags, each tag can be used to run a job with less entities

#

and you only update 1 'tag' each frame

#

idea 2
theres a new WithFilter or something like that, its kinda rough still but allows you to provide a native list of entities, ONLY those entities will be ForEached over

#

Idea 3

#

You can use a SharedCompnnetData to move your entities between chunks
then you schedule a job /Foreach only for entities where SCD = X

#

so in your case where your 'discovering' that the entities must be processed this frame, probably idea 2 would be best

#

as you can quickly spit entities out into a native list

#

Idea 3 would probably be better but you dont want to be moving entities around that much

#

so if you could preprocess them (eg at entitiy creation or subsceens) and sort them into SCD Update Groups that would be best i think

acoustic spire
#

WithFilter seems like a quite flexible approach. With some queue in component it would be even better. AFAIK you can't put native queue in component but probably can store it in system and convert elements to tags

ocean tundra
#

yea no collections in components

#

and i think thats the wrong way to be thinking about this

#

as you would end up with random access

#

eg foreach entity with your collection of other entities to update

#

instead you want to be , foreach entities that need update

#

personally i really like the SCD approach, you could even make it time based which will give you the most flexilibilty

acoustic spire
#

What about a separate world? Is it a good idea? I don't know much about it but suppose it can be detached from frames

ocean tundra
#

actually time based would be bad ๐Ÿ˜› as you would need to change after every update

#

seprate world could work

#

it really depends on what your trying todo

#

other worlds are great for things like: loading in background, procedual generation, creating a TON of entitis, splitting rendering and simulation

acoustic spire
#

To send lightweight entities (say, requests) to this world and copy processed data back to "primary" world.

ocean tundra
#

but requests for what?

#

that copy back would be a slowish sync point

#

so i use 2 worlds for my networking stuff (all custom not netcode)

#

with no real issues, but im not moving entities between them

acoustic spire
#

basically I do procedural and vertex generation so I need only a little set of properties like position, seed etc. as input

ocean tundra
#

does it have to be completed 'this' frame?

#

i think the better option would be a manual job that is semi long running

#

but seprate worlds would probably be simplier

#

make sure you remove the presentation group

#

and probably things like physics

acoustic spire
stable siren
#

Hey, I have a bool component on my particle entities that says if they are involved in a dynamic collision. This is calculated in a different system. Now I want to loop through these (true) entities sequentially (order doesn't matter) and perform the collision. I don't think I can use foreach for this but I am not sure... What should I use?

ocean tundra
#

you can still use foreach

#

just the first line is If yourbool == true

acoustic spire
#

@ocean tundra thanks for help

ocean tundra
#

however i imangine you have TONS of particle entities and only a few can be in a collision at once?

sand prawn
#

Can also use empty "flag" components as markers for stuff like that

ocean tundra
#

yea 'tag' components are probably the way to go

stable siren
ocean tundra
#

they will move your entities between chunks ๐Ÿ˜ฆ

#

but that optmization is comming one day

stable siren
#

ok so adding/taking away a component each frame from every particle?

ocean tundra
#

another opetion is what i suggested to @acoustic spire you can gather a native list of all your entities (maybe where your setting collision = true) and provide that into Entities.WithFilter(list).FOreach

#

but im unsure if this feature is stable

#

adding/remoing each frame is bad

#

but its only on collision start right

#

so not as bad

stable siren
#

collision start?

ocean tundra
#

when your partical collides?

stable siren
#

Sorry I don't understand quite what you mean

#

I don't really mind running over all N as this is still only a O(N) operation

ocean tundra
#

When collison happens (so not every frame) then you add tag component,,, then process,, then later (next frame using a CommandBuffer?) you remove it

stable siren
#

oh right I get you

#

yeah I suppose it will involve a component addition then removal each time

ocean tundra
#

yea

#

unity has said theres 2 optimisations coming to help
tag components - can be made much faster to add/remove to entities
enabled - all components will get a Enabled bool somewhere, meaning you can set enabled = true instead of adding a component (and moving between chunks)

#

but no clue when any of these will land

stable siren
#

ah ok fair enough, I have a deadline soon so probs can't wait for that

#

tbh as I am calculating stats each frame also I think I will probably just stick to a bool component

ocean tundra
#

yea

stable siren
#

What I am worried about is the sequential part

ocean tundra
#

a bool would be easist to update to the enabled flag

stable siren
#

as I need to conserve momentum and energy

ocean tundra
#

i dont belive you can control ordering

stable siren
#

Luckily I don't think the exact order matters

#

it just needs to run like a good ol fashioned for (int i =0 ; ...)

#

then do each collision in turn

#

in OOP terms I just want a system to run once and then go through all the collisions in any order

#

even if I don't set the for each to run in parallel will the values be updated in between each case?

ocean tundra
#

i dont understand your last question

#

if your using foreach (.... ref Type data)

#

data.thing = x

#

that will be updated immediatly

stable siren
#

So I need to perform a collision and update both the particle and the other object before going to the next colliding particle

ocean tundra
#

but you cant have random reads, where your reading from another entity

#

yea the updating of Other will be your bottleneck

stable siren
#

yeah that's what I was worried about

#

it doesn't have to be that fast as there will probably only be a few particles each frame

#

At the moment I have nativearrays of the other objects components, how can I write to that in the Foreach?

ocean tundra
#

dont think you can

#

well

#

you can

#

but the data wont be copied back to the entity

stable siren
#

ok well I suppose i could have a placeholder and just update the final value to the entity?

ocean tundra
#

might be better to do your loop, and NOT update at all

#

instead write out to a native list of some sort

#

then you loop over the list after and use that to write back

#

so you look over all

#

every entity that has a collion could be written out into a mutihashmax (entity1 = hits = entity2, entity 3 ect

#

so you get a list of every entity hitting the others

#

then you loop over it again in another job

#

and group that data back into your pairs (entity 1 = entity 2)

#

finally loop over your pairs and random write the data back as needed

stable siren
#

OK that seems like a good plan, I don't really need to be using an array of other objects yet as I only have the one so far. Just to get that working I think just having a placeholder variable for its velocity is the way to go. As you said earlier if I update this single variable in the foreach, its new value will be passed into the next foreach right?

#

Then I can just write this back to the other object at the end?

acoustic spire
#

How to make a custom world to run in background though? I can tick it manually from "caller" world but it won't be actually executed in background, right?

hard wagon
#

Does anyone here have any experience with MaskableGraphic class?

#

Yeah like... Thanks for telling me it's "Dirty" but exactly what is "Dirty"???

dark cypress
#

Dirty usually refers to "In need of update" or "changed"

hard wagon
#

... very weird way of saying these vertices are dirty, better clean it by redrawing over it...

#

thanks

ocean tundra
#

@acoustic spire You cant

#

cant have a world updating in background

#

jobs can only be scheduled on the main thread still

#

even if the whole world is seprate ๐Ÿ˜ฆ

sleek idol
#

can anyone help me get started on dots animation? what resources are available

#

and that's it. is there anything else useful in getting started?

gusty comet
#

is dots okay to build for web? I'm trying but I have a bunch of errors

zenith wyvern
#

Afaik Tiny is the only supported way right now

ocean tundra
#

@gusty comet Someone told me that someone else got it working

#

no clue myself tho

ocean tundra
#

so how do we select empty entities?

#

I am creating millions of entities ๐Ÿ˜ฆ
I'm building a command/message system for my networking, the user may add a command component to ANY entity, if its a networked entity the command will sync over to the matching entity on the other side, but it could also be a throw away entity (like the entity event pattern)
I remove the command component and send it off over the network
BUT im left with empty entities building up
I need to either

  1. select empty entities and throw them at EntityManager.DestoryEntity
    OR
  2. Figure out if the command entity is empty of other components, if so i can remove using a command buffer
#

any ideas how to do either of those?

amber flicker
safe lintel
#

@sleek idol import the dataflowgraph samples from the package manager and go thru them first before tackling animation

sleek idol
#

Thanks

#

Is there a good place to know that?

safe lintel
#

if you mean some websites that have articles further explaining it - no

#

it took me several attempts to really understand it but thats most likely due to my limited brainpower ๐Ÿฅฒ

#

and its fairly decently explanatory(its called guided tour in code), more so than the animation samples imo

worthy rampart
#

does anyone have an example of a job returning a list of things

#

basically I'm doing some processing and then for a small but indeterminate amount of them after the operation I want to loop over just the ones I need to

#

can I just allocate a nativearray and assign it as a field to the job then put the objects onto the end of it?

zenith wyvern
#

I would think you'd want a NativeList rather than an array but yeah

worthy rampart
#

native list is a thing

#

:0

#

those don't auto allocate do they

#

if they hit cap

zenith wyvern
#

They resize themselves yes

worthy rampart
#

hm

zenith wyvern
#

Up to a limit based on cache line size I think

worthy rampart
#

is native list in a different assembly

#

VS isn't telling me it exists

zenith wyvern
#

You need the com.unity.collections package

worthy rampart
#

I had a version of it

#

but it looks like I am able to get a new version

#

hm

#

native list doesn't let me write to it in parallel

#

I don't care about order

worthy rampart
#

oh cool

proper cliff
#

The description for DynamicBuffers sounds a lot like a NativeList. What's the difference?

zenith wyvern
#

NativeList is a native container and can be used completely separate from ECS. It also can't be used in a component or associated with an entity in a safe context

#

A dynamic buffer is specifically for associating a resizable list with an entity

proper cliff
#

ahhh ok, thanks

#

I'm still in the learning phase, going through lots of tutorials

worthy rampart
#

yea I ended up switching away from ECS

#

just utilizing jobs

proper cliff
#

I'm hoping I'll be able to keep ECS and jobs to a minimum, just use them where I really need them instead of doing everything ECS

ocean tundra
#

honestly i find mixing ecs harder then pure

#

but if you can identify a 'sub section' of your game thats kinda isolated you have better luck then me

light mason
#

wondering if someone could help me with a simple question

#

if i have an entity on a component , how can i check if that entity exists in a system

#

reactive based on if a has been set

#

if (ComponentEntity == Enity.Null ) was my attempt but that does not catch it

ocean tundra
#

EntityManager.Exists

#

or if your using any of the **FromEntity things they also have a .Exists

light mason
#

excellent , thank Roycon

north bay
light mason
#

whatif it in a job

north bay
#

You do need internal package access for that tho

light mason
#

i see

#

is there a commend buffer cmd I can used for EM.Exists

north bay
#

For the usage in jobs?

light mason
#

yea

north bay
#

You can pass ComponentDataFromEntity or the thing I posed above to jobs

light mason
#

ok ty

static dune
#

Is this a true statement?

JobComponentSystem/ComponentSystem - deprecated and will be removed eventually.
SystemBase - combines better from both + better codegen. Only this recommended for usage.
zenith wyvern
#

Yes

static dune
# zenith wyvern Yes

Good stuff. I'm trying to keep on track with what's preferred in Unity DOTS but I keep getting confused with all the different tutorials/documentation.

#

Is there a good source of truth for this stuff? Maybe a wiki or a tutorial series that's regularly updated?

#

Also, any good explanation on what SystemBase does better over the JobComponentSystem/ComponentSystem?

zenith wyvern
zenith wyvern
#

ComponentSystem is ancient as this point and should just not be used. You can already schedule jobs on the main thread with .Run so there's no reason to use it

safe lintel
#

i did notice that input seemed broken on the latest samples. had to fix it manually ๐Ÿค”

worthy rampart
ocean tundra
#

yea probably a good idea

worthy rampart
#

I would love to embrace ECS when it's ready

#

but there's too much tooling missing right now

ocean tundra
#

๐Ÿ˜›

#

yea i've just gone for it, but clearly missing tons of things

worthy rampart
#

I mean it's super fast and cool

#

When I made a little demo of like 25k spheres in a pyramid

#

falling onto the floor

#

and rolling

#

at 60fps

#

I was like :0

#

but then I started juggling converted game objects and it was a bit much

ocean tundra
#

i acutally like the sub scene workflow

#

but its almost too limiting

#

i want mods

#

but subscenes make that SUPER hard

safe lintel
#

mods would be nice. really nice ๐Ÿ˜ข

ocean tundra
#

my thoughts are some sort of load step, after the subscenes have loaded, with all the prefabs
my file format has some sort of prefab id, can find and then update the prefab with mod info

#

would be nice to actaully edit the subscene data, but loading that, editing it and then saving it again sounds super hard

#

my first attempt at mods was kinda simlar tho, i loading all the gameobjects (not as entities)
converted them manually
then applyed the mod data
then used world serialaztion stuff to save the world out

#

was a pain

#

Anyone have any ideas on how to support mods?
not a scripting language tho, thats a whole different subject more around data modifications/additions/removals

#

and is there a already designed 'data' language, for describing this stuff?
like mods often have a load order
and multiple mods can edit the same 'thing' in a game
do i need to custom create a file format to descibe this?

#

but then need a way to take a entity => to json, and back again

frosty siren
#

How can i avoid system update when entities of EntityQuery i use in that system are exist

ocean tundra
#

you mean not existing?

#

if your using entities.foreach it already does that

#

only updates when entityquery count > 0

#

if you want to do it manually, call RequireForUpdate(yourEntityQuery)

frosty siren
#

No no no. In my system i use Entities.Foreach for normal use (entities exists - update pls), but also i use some queries to extract data for calculation, but i don't want system to update by those queries.

frosty siren
ocean tundra
#

yea

frosty siren
#

hm

#

lol, i'm sorry, i always try to search by myself before asking, but today my eyes failed me. Thank you a lot ๐Ÿ™‚

light mason
#

can i create text input fields for tiny?

ocean tundra
#

i think tiny has a ui system somewhere

#

but never used it sorry

toxic crest
#

just curious, should I be asking job system stuff here or in #archived-dots ? (I'm not using ecs but figured I should check)

solar spire
toxic crest
#

oh haha snap. I meant to ask that in general code

#

either way, same question

solar spire
#

The job system is a part of dots so here's fine anyway

toxic crest
#

k cool thank you.

#

I'm curious if I should be following the pattern used in MeshData and MeshDataArray for structs that I create for usage in jobs

#

In the way they handle the underlying native data I mean.

#

They don't give direct access to the fields themselves but rather expose methods that copy a pointer to it and implement atomic safety handles etc

#

I figured that way I could return read-only native arrays that point to my underlying read/write native arrays when appropriate

#

but at the same time, the safety system only exists in-editor and in play-mode from what I understand; doesn't exist in shipped builds

ocean tundra
#

Why is this code throwing
Unknown Type:`{0}` All ComponentType must be known at compile time & be successfully registered.

            var time = Time.ElapsedTime;

            Entities
                .WithAll<PlayerMasterEntity>()
                .ForEach((Entity e, int entityInQueryIndex) =>
                {
                    buffer.AddComponent(entityInQueryIndex, e, new SendTimePingCommand()
                    {
                        ServerTime = time
                    });
                })
                .ScheduleParallel();

            _endFixedStepSimulationEntityCommandBufferSystem.AddJobHandleForProducer(Dependency);```
#

Its only happening when Burst is on

#

But my components are nothing special, standard IComponents, all structs

#

No generics or anything magic

#

hmmm commented out the buffer.add.... and still getting weird exceptions, something about The UNKNOWN_OBJECT_TYPE has been declared as [ReadOnly] in the job, but you are writing to it.

#

wtf.... I updated the namespace (i had moved it to another folder and forgotten about namespace) and its fine

dusky wind
#

whats a simple way to check an entity matches an archetype? I can use a query and use .Matches(e), but that doesn't seem to work in a job

#

basically i'm queuing a list of entities for a system to process, but in the meantime the entity may have lost/added components which will throw errors for the job they are being dequeued into. when dequeuing i want to verify it still has all the components it needs

dark cypress
#

You can get the archetype of the chunk in IJobChunk

dusky wind
#

its going into an ijobparallelfor

#

and the dequeuing is in an ijob/lambda job

#

so don't really have chunk info

stone osprey
#

Question of the day : Whats more performant ? Lets say we have a velocity and rotation component. Therefore we have one Entities.ForEach loop, iterating over all velocitys and one iterating over all rotations. We have 1 k entities with both components. That means we actually loop 1k times over velocity and 1k times over rotation = 2k times in total.

We could actually create a Entities.ForEach loop that targets both components and then it only runs 1k times over them.

The question here is... Are many loop, with light calculation or less code faster than less loops with heavy or a lot code ?

gusty comet
#

Hey guys, has someone used the dots animation package? The animation clip of the example are "corrupted" (even with the same versions). So I don't have a clue of how it should be done properly

worthy rampart
#

The answer can vary based on how the memory for the components you are talking about get laid out

#

So try it both ways and check the profiler

#

My gut for what you just described is that a single loop would be better

stone osprey
#

@worthy rampart Well ok... The problem is that im actually done with the most parts of my game and i always choosed multiple loops over combined loops due to the flexibility ๐Ÿ˜… those are things that didnt came into my mind

#

Actually... Both should be O(n) if i remember complexity correctly

worthy rampart
#

The speed difference here wouldn't be algorithmic

#

It'd be due to hardware differences

#

Cache line sizes

stone osprey
#

Hmmm... Thats right, so it really depends on the size of the components. Nevertheless i thing that the speed difference shouldnt be too big. Probably its overoptimization

worthy rampart
#

That said combining two for each loops that run on the same components one right after the other is a relatively small change

safe lintel
#

@gusty comet what do you mean corrupted?

gusty comet
safe lintel
#

Did you try redownloading the samples? There shouldnt be any problems

gusty comet
#

Yeap I openned the freshly downloaded samples directly with it's own unity version. But if you say you had no problems, I'll do it again after my window update

gusty comet
#

Yeah works perfectly now x) Thanks

safe lintel
#

while you're at it, download the dataflowgraph samples from the package manager too. Important for understanding animation in its current state

pliant pike
#

can I not use GetEntityQuery() in an external struct?

#

on another note you can't put DynamicBuffers on separate entity's into a single NativeArray either can you

sharp flax
#

I'm doing some stress tests on my android (11) mobile with jobs & burst. I've been able to build using Mono, but if I switch to il2cpp and arm64, the build succeeds but something related to burst throws an error after the application is launched, and it doesn't run. The error says Unable to find internal function Unity.Burst.LowLevel.BurstCompilerService::GetOrCreateSharedMemory . Am I missing something or is it time for bug reporting? I've tried updating the burst version that is installed as dependency to the jobs package, but same thing. Using 2020.2.6f1 and latest jobs package btw.

karmic basin
karmic basin
#

You're talking about GetENtityQuery's in a job struct ?

#

OoOoooh "from multiple entities", I missed that part ^^ yeah you can still do that. You will end up with a system and or jobs done on multiple steps, but that works

#

Basically, you gather info from n sources instead of 1, but that's okay

#

gtg eat, you guys tell me if I'm drunk and utterly wrong

ocean tundra
#

Hey all
I've been thinking about mods and decided I'll use my code gen stuff to make a Dots Modding kit and wanted to run my rough approach by people
This is only for DATA type mods, but it should be possiable to include asset changes in the mod too (Models, Materials, Sounds ect)

During dev we add [Moddable] attributes to our components (probably on the Field members too)
Then run the code generator - this will generate strongly typed systems that will apply the mod data

In editor
Setup some setting like mod directory paths
Make sure all moddable things have a 'mod id' (probably a guid)

During runtime
Create a entity and attach a ordered buffer of mod file ids along with a LoadMod component which specifies some load settings (things like apply to prefabs, apply to all entities ect)
I will then load the mod data, construct some blobs, then loop over every mod and apply its data to the world/prefabs

Making a mod:
A mod will be a collection of http://jsonpatch.com/ files
file name is the moddable id

There will also be some ways to extract the reference json file
Basicly looping over every moddable entity and its moddable components and creating a json file compatible with jsonPatch

#

Scripting/code based mods is something i want too, but still unsure how to do that

toxic crest
#

The ReadOnlyAttribute and WriteOnlyAttribute for NativeArray<T> members are only used by the safety system within the jobs system on the native side right?

#

like, when I don't have any jobs operating on data using members marked [ReadOnly], I can operate on it in the managed side without issues right?

#

I'm trying to sort out if I should be passing copies of native containers to jobs and copying the modified data back into the external original containers once a job is done or if I should just be passing the actual data to the job

ocean tundra
#

native containers dont copy their data when you copy them

#

they copy some 'stuff' like IsCreated

#

but the actual underlying items never get copied

#

also i dont think native collections have a 'unmanaged' part

#

instead all existing with c# space

toxic crest
#

I'm meaning an actual copy into a new buffer.

ocean tundra
#

?? like native array .CopyTo?

toxic crest
#

yeah

ocean tundra
#

why not send the origional data?

toxic crest
#

thread safety

ocean tundra
#

then maybe try a native slice?

#

that wont copy the data

toxic crest
#

but I do want a separate copy in these cases

#

thats what I'm wondering. Do people always just pass in the actual data or do they sometimes pass copies and resync after the job completes

#

my main concern is can I still write to a NativeArray member marked as read-only outside of a job when no jobs are executing on it if I were to just pass the actual data to jobs instead of copies

#

but I'll just test and see lol I'm just being lazy and asking while I'm working on other stuff :p

ocean tundra
#

i always pass the actual data

#

but its often structured so it dont have many jobs writing to the same indexs

toxic crest
#

yeah, I think I'm overthinking this lol

ocean tundra
#

just dont write to the data on the main thread

#

do it all via jobs

#

and pass/handle dependancies

#

then you wont have any conflicts

hollow sorrel
#

@ocean tundra seems like a decent idea
out of curiosity tho what problem does jsonpatch solve? why not just use the entire json and replace?

ocean tundra
#

Json patch Is to help with mod data conflicts

#

So the mods are more likely to be compatible

#

And also support removing or replacing components

hollow sorrel
#

remove/replace could just be handled events by your game tho

#

are people going to hand write these add/remove jsonpatches?

ocean tundra
#

yea that would be the idea

ocean tundra
#

the idea is that somehow (during build?) us game devs can create the mod json reference file per moddable 'thing' and distribute that with our game for modders, that data is never actally used, instead using faster prefabs/subscene data
but a mod maker can look at that file and see things like, moddable unit has attack power of 5, they can then create a json patch file replacing that

#

and if 6 different mods want to change that attack power field they can, but the last one with a 'replace' wins

hollow sorrel
#

yeah that makes sense, just think it's putting a lot of faith in your modders
just adding or replacing one field is now 4 times as much to type as regular json and make sure is fully correct with commas and everything

ocean tundra
#

hmmmm

#

true

hollow sorrel
#

it sounds very robust and flexible, but also a pain to work with ๐Ÿ˜…

#

that's your tradeoff to make tho, i was just wondering

ocean tundra
#

maybe have 2 options?
let the modder copy the json reference file directly and edit as they like, during mod loading that file is compared to the origional reference file and a patch file is created
if its already a patchfile then no need to do the compare

#

that gives simple mods a easy path, and for harder/more complex mods they can directly write the patch files

hollow sorrel
#

yeah if both are an option that'd be neat
but i also know if i were a modder and in case i'm not targeting already existing specific mods that mine needs be compatible with, 100% i will just take the path of least resistance and not bother with future compatibility

ocean tundra
#

yea true,, the main advantage of json patch is you can effect other mods, using just the main file editing prevents that

#

but as long as reference file editing creates a patch it would be compatable with most mods by default, they just wont be able to target/modify other mods that add new components

#

also the modder could always start with reference file editing, and then copy/access a generated patch file and build on that

hollow sorrel
#

ya

#

compatibility by default sounds pretty good

ocean tundra
#

ty for the feedback ๐Ÿ™‚

shut yacht
#

I'm a beginner who recently became interested in DOTS.
I'm asking a question because I'm curious about the opinions of the users who are actually using it.
I don't know exactly about these things yet.
The advantages that they claim seem surprisingly outstanding.

But on the other hand, the experience I've seen in the community says:

  • It is still under development and unstable.
  • As the version changes, too many concepts and usage changes occur, making it inappropriate to learn or develop something.
  • Difficult to use and complex
  • Debugging becomes very difficult.

Despite the great advantages of DOTS, these experiences seem to tell me that they are not yet suitable for practical use.

q1) Do I really need these?
q2) Is it appropriate to learn and use these from now on?
q3) One of the assets I am using requires the Burst, Jobs package. If I understand correctly,
if I don't use attribute even if I install them, there is no difference in the existing system.(Operational problems, performance, etc.)
Is there any issue that could be a problem when installing Burst and Jobs in the existing project?

Any experience or advice from you is welcome.

ocean tundra
#

@shut yacht so DOTS is awesome

#

but its still early

#

thats why its been hidden via the package manager

#

it really depends on the game you want to make if you want to use DOTS or not

safe lintel
#

yea generally if you install those packages but dont use them they should be more or less inert

ocean tundra
#

everything you say is true, its slowly getting more stable, breaking changes are less and less, complexity is either explained or hidden away, and debugging is getting better

safe lintel
#

under the hood jobs is used by unity already, and depending what you have installed burst may or may not be a hidden dependency for other packages

ocean tundra
#

in time it wont have those issues, but still awhile away

safe lintel
#

all depends on your appetite for the early adopter experience.

#

i think that generally unity want you to kinda steer clear unless you are a really persistent self learner or kind of an expert user already. that said just jobs and burst are out of preview and ready to use for the masses i think.

shut yacht
#

@safe lintel @ocean tundra
Wow, thank you so much.
It was a great help to me who knew nothing.
My question was solved so clearly. ๐Ÿ˜†

Is there an approximate roadmap or goal that Unity has officially proposed?
(Note: Eventually, it will completely replace the existing system. / It will be released in Unity 202x version. etc.. )

ocean tundra
#

honestly no ๐Ÿ˜ฆ really sucks, they were getting better at road maps/planning for DOTS but then the shift to focus on stability came and DOTS communication has dropped off

#

also i recently found out some DOTS sub packages are on development hiatus, i expect cause their devs were pulled elsewhere inside unity

#

specifically the AI Planner package

#

but i think it happened to kinematica too

safe lintel
#

i dont view those things as being put elsewhere actually. they kinda both utilized jobs(i think) but they were monobehaviour front facing

#

so my assumption(more of a guess) is that they actually put a stop to the monobehaviour dev and focus on ecs workflow instead because it wouldnt make sense to make those next gen packages not work within the context of ecs/dots

shut yacht
#

I have given up on kinematica with similar ideas (for similar reasons).
It's sad that something similar happens here.

The advantages of DOTS look amazing.
I hope the development will be normalized so that we can enjoy them.

Thank you again for giving me a surprisingly clear and quick answer to the field I don't know.
I hope you have a good day.๐Ÿ˜„
@ocean tundra @safe lintel

ocean tundra
#

@shut yacht what sort of game do you want to make tho

#

RTS/Strategy/Management games would all benefit soooo much from DOTS

shut yacht
#

It is a single game with high graphics requirements for a 3D base.
Many objects, such as RTS, need to be simulated at the same time, or physical interactions do not account for much.
What requires DOTS is an Asset called Magica Cloth.
It is used to simulate the physics of cloth material.
(Because I felt that the basic Cloth of Unity wasn't enough)

In fact, in the case of my ongoing project, I don't think there is much advantage.
It is still in the early stages of the project and it is possible to redesign it.
Therefore, I was looking at the amazing performances and charms that DOTS showed and I was researching if there was anything that could be used.

ocean tundra
#

Is it a hobby?

#

and whats your normal unity experence level?

worthy rampart
#

@ocean tundra as someone who has done a fair bit of modding, having the ability to partially patch something sounds great

#

even if it causes a little bit of boilerplate for each part

#

I'd rather have only the parts that I'm changing in my mod

#

than to worry about reconciling everything

#

on updates

ocean tundra
#

@worthy rampart sweet ty for the feedback

#

nice to hear its not completly crazy ๐Ÿ™‚

#

sounds like some sort of mod tool to take any reference files the modder uses make generate a patch and output it, then all mods will be patches
but there will be a simpler "authoring" flow for mod makers

shut yacht
#

As a programmer, I have been working in a field other than a game for a few years.(C++, c# was used primarily.)
I quit the company early this year and formed a team to develop indie games through Unity. (I expect 2~3 years.)

ocean tundra
#

yea since it dosnt sounds like a hobby project probably not worth taking on even more risk

#

but there are some released games using DOTS

worthy rampart
#

616 I recently tried to use dots on my not so hobby project

#

And decided it wasn't quite worth the risk

#

There's lots of missing features still

#

And bugs

#

The hybrid workflow is a little wierd

#

I think in a year or two it'll be the absolute best choice

#

But it's possible there could be some big changes that force a rewrite from now until then

#

You can get some good performance utilizing techniques like jobs and compute shaders

#

Without delving into DOTS

ocean tundra
#

Yea, all my stuff is hobby, and im aiming to build and release tools for DOTS not games untill its more stable
So im ok with taking on the risks

worthy rampart
#

Yea that makes sense

ocean tundra
#

@worthy rampart Did you take a look at the JSON patch link (http://jsonpatch.com/)
Just wondering what you think of the patch format

#

and when you were doing modding were there any common file formats you prefered?

worthy rampart
#

the patch format looks useable

#

with proper formatting it probably looks a lot beter than that example

ocean tundra
#

yea single line is a terrible idea ๐Ÿ˜›

worthy rampart
#

don't use xml

#

๐Ÿ™‚

ocean tundra
#

haha ok

#

never really liked xml anyway

#

thanks again @worthy rampart and @hollow sorrel

ocean tundra
#

anyone know how to create unity packages?

sour frost
#

hi, is there a beginners course for unity project tiny programming?

north bay
half jay
#

How can i fast copy values from one NativeHashMap to another? I know only one way that i should iterate through first NativeHashMap and call Add

karmic basin
#

@ocean tundra interesting endeavour. I never done moddable content but that's something I'll try to implement in the future. You say you prefer to focus on tools rather than games while DOTS gets better, but aren't you as much afraid of breaking changes when you build tools ?
@hollow sorrel @ocean tundra about the pain in the butt from json format editing. You could bring a web interface so json gen is less error-prone. More work tough... But could be community maintained.
Also, like I said i never done modding, but to bounce on your statement :

if 6 different mods want to change that attack power field they can, but the last one with a 'replace' wins
wouldnt it be better that the original game uses a "base" power value, and expect mods to add/subtract from it ? Basically asking your modders to work with modifiers instead of overriding values ? i.e. +1 or +20% power instead of a flat =10 and "I don't care of other mods".

gusty comet
#

some guy said unity is using ECS aka dots

#

its true?

#

by default

rancid geode
gusty comet
#

yes but guy said currently discord supports ecs

#

by default

rancid geode
# gusty comet *by default*

and no, Unity is not using ECS "by default" (whatever that means), but Unity is switching some inner systems to run with Jobs + Burst (which are others DOTS techs)

gusty comet
#

and they said gameobject is entity

hollow sorrel
#

discord? ๐Ÿ‘€

rancid geode
#

that guy clearly doesn't know that he is talking about lol

worthy rampart
#

Unity is definitely using Jobs by default

#

Cuz why not

stone osprey
#

So... what should be an entity and what shouldnt be one ? Thats a question im struggling with since months. For example in my case the player is an entity. And he has a inventory that are pointing towards his items. Those items are also entities. So im basically going with the "everything is an entity" approach. Is this "too much" ? What do you think ?

worthy rampart
#

Entities are distinct things that should "own" stuff

stone osprey
#

@worthy rampart So things that are independent ? Like an item in an inventory always depends on another entity. Like a player or mob. So it shouldnt be an entity, because it does not "own" other relations ?

worthy rampart
#

Yea items to me feel like they should just be a struct

#

Not a full entity

#

But that depends

#

On what you can really do with them

#

And how much information they may end up containing

#

Imo do whatever makes the most sense in your head

stone osprey
#

@worthy rampart Thanks ^^ When would you make an item an entity ? In my case... my items are pretty standard. They have a quantity, a name, an id, should be equipable and can be used to buff the wearers stats. But its still dependend on the wearer.

worthy rampart
#

And then stress test it

#

Devise a worse case scenario

#

In terms of how many of them there could be

#

Spawn that many

#

And see if your systems keep up

stone osprey
#

Actually its not about performance at this point ^^ Its about clean code and flexibility. So i dont care about performance in this case

worthy rampart
#

Ah well then separate entities

#

Are probably gonna be easier

stone osprey
#

@worthy rampart So you mean player as entities and their items also being entities ?

worthy rampart
#

Yea but it starts to come down to personal preference

stone osprey
#

Alright thanks ^^ I guess that makes the saving a bit harder. In my case i wanna persist my entities into a database. Therefore references between them are always a bit... problematic. But probably im wrong

worthy rampart
#

If you never have to query for an item

#

Without having it's player

#

Or container

#

Then I probably wouldn't make them entities

#

Just make an inventory component

#

Which holds all the items in an inventory

#

And put that on anything that can hold items

stone osprey
#

@worthy rampart Alright thanks ^^ I think this is actually a good way to combine the ECS with an EC. Like having a player ecs entity with that inventory component. And inside the inventory component there EC entities. This way both would stay flexible.