#archived-dots

1 messages ยท Page 173 of 1

dusky wind
#

I don't suggest it

#

it's a pretty big cache

hollow sorrel
#

how big is big

dusky wind
#

several MB

hollow sorrel
#

hmm

dusky wind
#

it includes the collider geometry and internal engine state

hollow sorrel
#

but it's public?

#

like, able to copy it

#

from a dev standpoint

#

serialize w/e

dusky wind
#

no idea

hollow sorrel
#

i think i'll dig a bit more into that some other time

#

because it seems physics is gonna be the biggest chunk of my sim loop

#

and i technically just need 2d physics

dusky wind
#

I know Project Tiny has a solely 2D physicss

#

but that's not separable right now

hollow sorrel
#

i haven't checked it out but if it's similar to unity's box2d physics then it assumes everything is done on one plane
i basically have a bunch of different physics buckets on different planes and rotations, but the buckets themselves are 2d

#

basically Fez

#

2d game but 3d world

dusky wind
#

I do remember it having tags like the 3D physics

#

Which affords you 32 "buckets"

#

And a group ID which gives Int32.Max seperate groups

hollow sorrel
#

oo

#

what's group ID

dusky wind
#

The 3D physics has this too

#

If two objects have the same positive group ID

#

They collide

hollow sorrel
#

ya i don't think i'll switch to tiny's 2d physics but it sounds relevant for current

dusky wind
#

If two objects have the same negative group ID

#

They collide with everything else except each other

#

And it's an int so you have 2.147b effective groups to work with

hollow sorrel
#

that sounds like it could be used to seperate physics planes

dusky wind
#

Of either type

#

Yep, but each body can only be assigned one group

#

Unlike tags which you can layer multiple on a single body

#

And using groups overrides any tag based collision

#

So I'd use it sparingly

hollow sorrel
#

i'll look into that, thx

violet cosmos
#

Bleh, now the Entity Debugger is just flooding me with errors

hollow sorrel
#

relatable

violet cosmos
#

        QueryPhysicsJob physJob = new QueryPhysicsJob()
        {
            World = physWorld,
            Position = new float3(0f, 0f, 0f),
            Radius = 5f,
            hits = hits
        };

        physJob.Schedule().Complete();

InvalidOperationException: The UNKNOWN_OBJECT_TYPE QueryPhysicsJob.hits has not been assigned or constructed. All containers must be valid when scheduling a job.

?

#

Seems like I assigned it right there, buddy

manic aurora
#

no allocator?

violet cosmos
#

Assigning the alloctor made that go away, thanks

#

InvalidOperationException: The Unity.Collections.NativeArray`1[Unity.Physics.RigidBody] QueryPhysicsJob.World.CollisionWorld.m_Bodies has been deallocated. All containers must be valid when scheduling a job.

#

That only happens after it crosses into my sphere cast

#

Yes, I know I'm making a job and throwing it away each frame. This is just testing

#

It's also telling me that something is not getting disposed

hollow sorrel
#

i don't think you can reuse PhysicsWorld like that

#

try doing world = physSystem.PhysicsWorld

#

it's a struct so prob gets invalidated after a frame

manic aurora
#

need to dispose hits too if you're not

violet cosmos
#

Ah, not persistent. That was it, thanks @hollow sorrel

manic aurora
#

oh my eyes just flat out ignored your hastebin lol

violet cosmos
#

Welp, think I made one too many memory leaks. The profiler is gone

#

rebooting ๐Ÿ˜†

manic aurora
#

that gets me so many times...bunch of no-dispose errors, didn't change anything that should cause them

#

restart fixes it every time ๐Ÿคทโ€โ™‚๏ธ - makes sense and all, just obnoxious it can't recover from that failure state haha

dusky wind
#

PlayabeGraph is a struct

#

does anyone know if it's possible to call Evaluate on it from a Job?

mint iron
#

thats an interesting question

#

i dont have a real playable to test it with but it seems to work

NullReferenceException: The PlayableGraph is null.
Unity.Entities.InternalCompilerInterface.RunIJob[T] (T& jobData, Unity.Entities.InternalCompilerInterface+JobRunWithoutJobSystemDelegate functionPointer) (at Library/PackageCache/com.unity.entities@0.11.1-preview.4/Unity.Entities/CodeGeneratedJobForEach/LambdaJobDescription.cs:363)
violet cosmos
#

That is super interesting...

I wonder if their animation is played on the main thread or is multithreaded

amber flicker
#

Anyone know the correct way to add a system at runtime? I'm currently trying:

var simSystem = World.DefaultGameObjectInjectionWorld.GetExistingSystem<SimulationSystemGroup>();
simSystem.AddSystemToUpdateList(rotSystem);

Some examples I've seen use ScriptBehaviourUpdateOrder.UpdatePlayerLoop(world); but that's obsolete and ScriptBehaviourUpdateOrder.AddWorldToPlayerLoop is the replacement. Conceptually I have no idea what's going on here though - I think I don't want to add a world to a player loop? I want to add a system to an existing player loop?

#

(this is for a [DisableAutoCreation] system that I want to have update in the SimulationSystemGroup)

manic aurora
#

huh yeah i'm surprised that the code you posted doesn't just...work. you shouldn't have to mess with the player loop if you successfully get your new system inside the simulation system group

amber flicker
#

yea I'm on struggle street. Messing around with ScriptBehaviourUpdateOrder.AppendSystemToPlayerLoopList but not having any luck or any understanding ๐Ÿฅด

manic aurora
amber flicker
#

oh.. it could be that I have the wrong script on my gameobject ๐Ÿ˜…

#

haha false alarm! Thank you ๐Ÿคฆ

violet cosmos
#

AFAIK, you only need to involve PlayerLoop if you're making new systems for a custom World, and you want them to tick over at certain times in the update loop

The cheap/quick way to to test is to call OnUpdate for each World system on a MB Update()

amber flicker
#

sure you can do that.. I'd rather not

violet cosmos
#

What's your use case here? Like, timing and Worlds you're injecting the system?

amber flicker
#

same as the other day - I'm making an example scene of how to use my asset with 'pure' ecs

violet cosmos
#

OK, I don't remember, honestly. Is it going into the default world or a new world?

amber flicker
#

default

violet cosmos
#

Instead of using the sorting, you could just use [UpdateBefore] or [UpdateAfter], and I think it auto sorts

amber flicker
#

ah sorry, yea actually removed that because it's not needed

violet cosmos
#

Yup, but that's basically it for injecting into the default world

#

(at some time later that startup)

#

You don't need DisableAutoCreation if you want the system to always be there and waiting. That only serves to delay and take manual control over the injection

amber flicker
#

the point of that is to not have the example system run in somebodies project if they've imported the samples

violet cosmos
#

That's a fair point, and appreciate you as a developer not doing things with samples that require cleanup, but still letting users use them quickly by adding a Component to some MB

#

I despise asset cleanup, truly haha

amber flicker
#

The asset I'm making also doesn't require entities to be installed so I was hoping to package the ecs examples into an included .unitypackage. Unfortunately the asset store guidelines say that's usually unacceptable but I'm hoping they make an exception. Don't know how else to include the examples yet not cause compile time errors (if you don't have the entities package installed).

violet cosmos
#

I'd say... Put the ECS examples on GitHub, in correct PackageManager format, and then instruct the users to use an Add Package from Git URL

amber flicker
#

nah, this is an asset that less tech savvy people may be interested in

#

even I wouldn't really want to bother with that tbh

violet cosmos
#

Or finding a .unitypackage and having to manage it, seems about the same level of technical expertise

tardy spoke
#

It's pretty easy to add the git package, but maybe that's just because I know how to do it ๐Ÿค”

#

Not as "clean" though as unitypackage probably

violet cosmos
#

I'm super used to the new workflow, not sure what 2018 and earlier 2019 versions have for Package Manager, another consideration

amber flicker
#

we'll see.. if both examples (GameObjects & Entities) are packaged into .unitypackage's and you just have to double click to load them, that's definitely my preferred route. If they don't accept that I guess yea, might have to be a git thing, at least for the entities examples.

manic aurora
#

i was wondering how an asset i'm using is keeping out the example systems, and they actually made authoring components for all their example systems so they can have [DisableAutoCreation] but to enable them you just slap the authoring component in your scene

amber flicker
#

oh what asset's that out of curiosity?

violet cosmos
manic aurora
#

asset is DOTSNET

trail burrow
#

Lol dotsnet

manic aurora
#

i'm gonna yoink it long term, because i have my own serialization and transport implementation, but it's quite nice to not have to maintain those things while experimenting

amber flicker
#

so how exactly does adding the authoring component work? does it add the system in awake or..?

manic aurora
#

it actually enables the system in an ICustomBootstrap. authoring component inherits from an interface, bootstrap looks through the GOs for it, if it finds it, it adds the system specified in the authoring component to the type list

amber flicker
#

doesn't that mean the bootstrap is running all the time?

manic aurora
#

do you know how ICustomBoostrap works

amber flicker
#

not really - I thought it was something like reflection that Unity does to pick it up and then run it? unsure

manic aurora
#

implementing this might not be worth your trouble, and it will send you down your original line of thinking (i.e. gotta fuck with worlds and the player loop), but essentially it's an interface that unity checks for your usage of at startup. takes a signature like Initialize(string defaultWorldName) and lets you manually create your worlds

#

then post-creation it does nothing

amber flicker
#

but.. isn't this bootstrap project wide?

manic aurora
#

derp yeah it would, hrm, i wonder how it picks which impl to use if there are multiple, or if it just executes both

amber flicker
#

I think it does all, yea

manic aurora
#

nope just ignores extra ones

#

weak

#

guess that's out then, sorry ~_~

violet cosmos
#

@dusky wind Have you been able to bind colliders to a skeleton rig, and then be able to switch it's mode from being Kinematic to Dynamic and back again smoothly with Unity Physics?

amber flicker
#

That's cool thanks @manic aurora - I think this way is pretty clean

tardy spoke
#

Any ideas on the optimal workflow for this?

I believe my goal is to:

Instantiate entities based on GO's (which will likely in most cases pre-exist as a GO prefab), but I don't want any automated conversion workflow stuff, I just want to specifically ONLY add the GO reference components like Transform, Animator, etc in a nice clean way.

#

Right now you can see it has all the ECS physics and stuff applied if you just use convert and inject... I don't need any of that. Really I just need the entities to track location along with their GO counterparts (copy it from their transform) for some Systems to operate correctly, I believe.

trail burrow
#

@tardy spoke you want to use GOs for visuals and entities for sim?

#

is that it?

tardy spoke
#

Basically, yep

trail burrow
#

then i would separate the two worlds completely, and simply map entities<>go using Entity struct and GameObject lookup table

#

if you want to split them completely

tardy spoke
#

My thinking is that I'll just use the GO systems for now and gradually translate back to ECS over time, so splitting them like that may not be conducive to gradually migrating them all back to ECS over time

trail burrow
#

oh

tardy spoke
#

Not really sure

trail burrow
#

ye ok makes sense

tardy spoke
#

But it is possible just to do a pure instantiation with none of this boilerplate, right? Except for an LTW or something

trail burrow
#

i thought u were doing entire game in entities and just using GOs for rendering

#

i missunderstood

tardy spoke
#

Hmmmm proooobably won't end up that way. Would be cool if I could, hahah

trail burrow
#

depends on the game bieng built if its feasible or not to build all of it in unity ecs

tardy spoke
#

Well, there's a lot of advantages for myself and my noobishness in being able to fall back on GO simply because there's a lot of documentation for it and a lot of stuff is "built" for it.

#

For example, I would have to convert an XR framework to work with ECS over game objects... that would probably not be the most fun use of time.

violet cosmos
manic aurora
#

good summary of their philosophy for fps sample too

#

In DOTS Shooter we are simply pretending the functionality exists

#

nice change though

violet cosmos
#

hehe

#

That would solve a lot of problems with structure updates for sure

amber flicker
#

yea, really is about time enabled states dropped.. getting impatient ๐Ÿ™‚

tardy spoke
#

That's an awesome feature

#

Yeah you wouldn't need ECBs very often

#

Cleaner code

amber flicker
#

well the whole avoiding using tags because of structural changes sorta melts away to a degree.. we'll see what it's like in practice

tardy spoke
#

@violet cosmos can you instantiate a entity without the boiler plate? Like if I have a rigid body on my GO it wants to convert it to a physics body through the conversion process... how do I get around that? Need a more "pure" way to convert it than IConvertGameObject or whatever

amber flicker
#

@tardy spoke that sounds a little odd.. why would you be converting it in the first place?

trail burrow
#

Can i just say that the absolute mess that skull system repo is... just shows how much i don't believe in unitys ECS model, people have to put in sagnificant work just to get something simple as a skill system built

tardy spoke
#

Then I can probably just make another system that copies all Transforms to Translations... hah.

#

@amber flicker I just prefer ECS over OOP ๐Ÿคทโ€โ™‚๏ธ

#

It's how my brain works

violet cosmos
#

@trail burrow yes, trust me I've reviewed that. But... A generalized skill system is a difficult task in DOTS

#

He's making a "build it up from pieces" system, which is what I'm looking at doing too

trail burrow
#

@violet cosmos yeah and it's hard because of the structure of unitys ecs/dots, not ECS in general

amber flicker
#

@tardy spoke you don't need to have any more oop - just leave the GOs out of subscenes?

trail burrow
#

and i'm just looking at it and going ... wtf are they doing

tardy spoke
#

It'll be interesting over time to see if people come up with eloquent ways to do systems like that or if it will become to standard to use OOP for certain system designs

violet cosmos
#

@trail burrow Yah, I didn't use it for that reason. A lot of it has to do with how they need to cast things for generalized parts

tardy spoke
#

@amber flicker I stopped using subscenes

trail burrow
#

@tardy spoke without inheritance, complex generics, complex collections, etc.

#

i don't see it ever being easy to design complex game systems

#

in their ecs

violet cosmos
#

It's not ๐Ÿ˜ฆ

#

Actually, what I was thinking that having a multi-entity system is easier than one-entity-one-ability

trail burrow
#

so then follow up question is: what's the point of it? yeah sure performance... but like, you can just burt jobs+burst for that to get it where you just need it

amber flicker
#

@tardy spoke then I don't really understand ๐Ÿ™‚ - why are you converting them, however you're converting them. I don't see why that adds any more oop code.

violet cosmos
#

@trail burrow Maybe. That's the challenge I'm looking at now. There's still some fuckery with generalizing an interface though. And, you get into this thing where there's a ton of small Jobs being scheduled, which may ultimately be bad.... even if they are all ganged up into one "mega job"

tardy spoke
#

@amber flicker I'm just trying to use ECS systems on prefab game objects basically

#

So instead of Translation you are controlling Transform

trail burrow
#

@violet cosmos yeah, that's what happens when you throw 85% of a language out, calling your 15% subset "HPC#" and think you can create something better than people at microsoft who've been designing shit like this for 30-40 years.

violet cosmos
#

I really need to finish this up so I can see some scheduling penalties

tardy spoke
#

I don't think just because something is old it necessarily means it's good, hah.

#

Well, I mean all programming concepts are fairly old, but you know what I mean

coarse turtle
#

Yeah you wouldn't need ECBs very often
@tardy spoke I've just been using EntityManager batch operations on the main thread, ecbs for conditional archetype changes ๐Ÿ‘€

violet cosmos
#
        public IPlacementProcess PlacementProcess;
        public ITargetProcess TargetProcess;
        public IMechanicsProcess MechanicsProcess;

        public Schedule()
                effectorJob = PlacementProcess.ScheduleInitialPlacement(transform);
                JobHandle targetJob = TargetProcess.ScheduleInitialTargets(Targets, transform);
                JobHandle mechanicJob = MechanicsProcess.ScheduleMechanicsProcess(Targets, transform);

                JobHandle.CombineDependencies(effectorJob, targetJob, mechanicJob);
#

So, then scheduling dozens/hundreds of those under one big job, then calling that to be Complete() when it's all in schedule

amber flicker
#

@tardy spoke your systems should be transforming data. At various points that data needs to by synced with any GO representations. As an example, if you don't want to use Unity.Physics (ECS) then I would guess you will have a lot of pain if you're trying to use DOD/non-oop with physx. So I would choose your paradigm based on which objects you're interacting with maybe.

trail burrow
#

the inter-job overhead is too big for that to be a workable system @violet cosmos

violet cosmos
#

@trail burrow That's my concern, now that I see the scheduling overhead for small non-homogeneous tasks is kind of jank

trail burrow
#

scheduling hundreds of jobs u will take 1/2 frame time just waiting on the scheduling overhead

violet cosmos
#

There's no way for me to group these up either, each "Process" is a different lego piece to be snapped in to change the behaviour

trail burrow
#

we designed our own task system which runs inside of the job system to get rid of the overhead ...

amber flicker
#

@violet cosmos even optimized, taking work and splitting it out takes work.. the more threads, the more work

low tangle
#

yeah the job system is pretty fuckin jank when you throw a lot of jobs at it

trail burrow
#

@low tangle oh yes it is

low tangle
#

its like they built it for a small number of jobs and hoped it scaled well when everything became jobs

violet cosmos
#

Yah, I've got this far before realizing Jobs has the same limitations as ECS... It's designed for homogeneous data/processes

trail burrow
#

@violet cosmos yeah, their archetype system... i mean yeah its fast for homogenous processing

#

but like thats.... not what games do

#

at least not game logic

tardy spoke
#

What are you talking about? My favourite game is "1 million rotating cubes". Used to play that all the time when I was a kid.

trail burrow
#

i benchmarked archetype vs sparse set ecs models, and until you hit like 10k-20k entities sparse set wins and is much faster for add/remove/update/etc. all of it.

low tangle
#

if the entire engine was ready for full homogenous processing of everything, which is totally doable, it would be great

trail burrow
#

and i dont see how they went down this route

violet cosmos
#

But, I have realized there's benefit to breaking each "Process" down into an Entity. That will add homogeneous-ness back into it for ECS

low tangle
#

but its taking a million years to finish even just physics and basic rendering

trail burrow
#

yeah it's all still basically broke innit?

#

rendering, physics, etc.

low tangle
#

good question for mike

violet cosmos
#

So I'd have:

struct Effector : IComponentData {
        public Entity PlacementProcess;
        public Entity TargetProcess;
        public Entity MechanicsProcess;
}
tardy spoke
#

@amber flicker is it really that different to modify the Translation component of an entity or the Transform component of a GO? Of course you lose all ECS performance benefits, but that's not a concern of mine, haha

low tangle
#

I'm at the point now where I'm building a core replacement and only using unity gameobjects for rendering and skeletal animation

trail burrow
#

@low tangle we do the same

violet cosmos
#

Then it makes pooling easier too

low tangle
#

ready to eat the damn transform copy cost

trail burrow
#

@low tangle its not that bad tbh

#

assuming u dont have a lot of entities

#

or only do it on the ones on screen, etc.

low tangle
#

if its not too much to give away, how did you plan out the bridge between the core and the unity world?

trail burrow
#

@low tangle we built custom physics (2d&3d), custom prototype (prefab) system, custom navmesh, etc.

#

everything bespoke

#

so unity is just rendering frontend

#

that's it

low tangle
#

how do you handle unity's scenes colliders and what not

trail burrow
#

we bake into our own scene format

low tangle
#

I'm thinking about post processing the assetbundles - yep

trail burrow
#

we have a custom scene format which bakes the unity scene so it can be loaded by our 'simulator'

low tangle
#

I've got UGC to manage thats in bundles

amber flicker
#

@tardy spoke from what you've talked about before I think ultimately performance is a concern of yours? ๐Ÿ˜… - but regardless... imo DOD isn't great if you're dealing with AoS and it's really tough to make managed code and existing libraries fit SoA

low tangle
#

I was thinking about maybe trying to parse UnityFS / asset bundles

#

saw one reverse engineering of them on github

trail burrow
#

@low tangle the entire game can run outside of unity... i authored one game in unity and then ran it inside of Unigine 2.2 (other engine) when they added .net core support ๐Ÿ˜„

#

it was just a quick test, but yeah

low tangle
#

thats awesome, I was thinking about doing the same but with a custom engine in a year or two

#

depending on engines at the time

#

if the core is already a isolated general ecs system you could port easily

tardy spoke
#

@amber flicker having something I can work on is a bigger concern, haha. I haven't even been able to start building the world yet and that project will take years by itself. I can optimize it later by gradually moving the Systems back to DOTS when the functionality is available.

#

Maybe.

#

Haha.

trail burrow
#

we get most of the benefit when we host simulations on the server, as hosting a .net core process which can schedule things on its own worker thread system to run many worlds inside of one process beats the living crap out of hosting unity headless

#

i think we got something like 10x the scalability

low tangle
#

you might want to cost analyze ECS vrs GO workflow, I've been using unity's since it came out, and while worth it I've also not really been able to finish the game fully because of its lack of finish @tardy spoke

amber flicker
#

All I'm saying is that by trying to DOD with traditional Unity stuff then I guess definitely try out entitas or whatever - something with decent tooling to work that way

trail burrow
#

i'd not use unity ECS workflow for anything i want to finish within the next 2 years

low tangle
#

I don't want people to walk away from it as it is a fun framework and if you've only done OOP you should try it

#

but I dont think you can finish anything other than simple games on it, and dots is attracting people wanting to do complex games ironically

trail burrow
#

tyeah, it's a bit of a joke atm

#

and they are demoing awesome stuff

#

making ppl belive it's ready

#

when all the demos are just huge hacks

#

that BARELY work

#

held together with ducttape

tardy spoke
#

Yeah, that's the issue, as soon as I was trying to get animations to work in a stream loaded subscene I just gave up. Is it possible? Maybe, for a better programmer than me - but in my project simply adding a skeletal mesh hierarchy to a subscene breaks it, an that's when I was like ... there's going to be more problems like this and eventually I'm going to hit something I won't be able to solve.

low tangle
#

that and the nature of how it is right now, is that you build exactly for the thing you want to achieve, so the demos, are just demos

#

skeletal meshes are what broke me as well

#

all of my IK and animations are done with unity animators

tardy spoke
#

It is weird how different ECS would be if they didn't do megacity for a demo and instead did something non-static lol

low tangle
#

you just can't convert them

tardy spoke
#

It's all optimized to build only mega city.

trail burrow
#

@tardy spoke you shouldn't even need to think about this tbh, unity say like "we are your engine team" ... well im sorry then my engine team fkn sucks lol

#

cos the engine doesnt fkn work

low tangle
#

I wont say they suck, but I wonder where there priorities are sometimes

stiff skiff
#

Its great for simple stuff and logic, but I wouldn't use it for anything beyond that

tardy spoke
#

I like the ECS paradigm and I want to use it to code the game, but I don't actually want to be interacting with DOTS until it's way more polished. There's just toooooo many oddities that you can't do anything about.

#

Dropping a skeletal mesh into a subscene BREAKS it. How do I fix that? Lol, there's nothing I can do

#

So I can have a game with no characters

low tangle
#

I highly suggest cutting your losses then and just structuring your MO's with a ecs like system.

#

Managers and flat data structs

tardy spoke
#

That's what my plan was

violet cosmos
#

Yah, that's the conclusion I'm coming to. ECS/Jobs are for independent things

low tangle
#

Jobs and burst should still be used though

#

you can schedule from anywhere on the main unity thread

tardy spoke
#

I'm trying to see if I can still use ECS to do it because over time I'm sure it'll get polished up and useful, but I also looked at Svelto.ECS which is promising, but I'd rather learn something "internal" to Unity than a third party

low tangle
#

oh and all of the Native* structures are fantastic

trail burrow
#

yeah we use jobs as just worker threads for our own task system

#

@low tangle how many have they built now of the Native* ones?

#

Array, List... ?

#

Map?

stiff skiff
#

Set!

low tangle
#

array, list, map, theres a custom set someone made, oh and the maps can be single value or multiple value per key

#

and unsafe variants of each that skip all checks

trail burrow
#

all in unsafe versions

stiff skiff
#

I wish I could use those xD

low tangle
#

theres also a fixed size list that can be embed into structs (mainly for ecs) but if your pointer copying structs they are nice

trail burrow
#
Array, List, Stack, Queue, Bit Set, Ring Buffer, Min Heap, Max Heap, Hash Map, Hash Set, Ordered Map, Ordered Set
#

@stiff skiff its MIT ๐Ÿ˜„

low tangle
#

yep

violet cosmos
#

You know, now that I'm thinking about it... I wonder if I could skip the JobHandle generation part of my code... And just break the whole thing down into one big parallel job to schedule, and keep all of the processes "job safe"

stiff skiff
#

I know, but its a little tricky on my end xD

tardy spoke
#

it's really tough to make managed code and existing libraries fit SoA
@amber flicker yeah, plan is to "not mess" with complex systems that I didn't build and use as is, IE will just use the regular implementation of XR framework, etc.

trail burrow
#

@stiff skiff yeah i know the feeling

#

@stiff skiff if you guys need them just ping me and we can fix something under a diff license

#

easy done

low tangle
#

you have to make a decision at some point, are you here to make a game with the tools you got / the ones that work or are you here to play around and learn new tools

tardy spoke
#

Exactly

violet cosmos
#

@low tangle Yup, after a few weeks of DOTS fuckery, I want to get back into making something

tardy spoke
#

lol same

#

I'm exhausted. Suffering DOTS PTSD.

low tangle
#

I forget how the advice exactly goes, but its something like, each project when starting has a fixed technical debt budget, based on your and your teams talent, plus all other resources. using the newest tech costs you some 'techinal tokens'

#

the more you spend the less and less likely you will ever finish

#

using the tech you already know doesn't cost you anything

tardy spoke
#

Well, tech debt with gaming is actually I would argue not a primary concern as most games have very limited lifespans of only a few years

#

For a SAAS company I feel it's far more important

low tangle
#

not that kind of technical debt

#

its the development debt

tardy spoke
#

Right

coarse turtle
#

Sometimes - it's also just better to version lock your dependencies and wrap up development to focus on other things your game needs (marketing, integration w/ platforms etc)

tardy spoke
#

So in terms of just "difficulty of development"? haha

low tangle
#

custom engine - infinite cost
custom programing language - are you even trying to release anything?
new language to do the project in - lots of cost
new framework - some cost
new architecture style - some cost

#

you should try to innovate, but dont spend more than your budget can allow, otherwise you will be developing the game for 5+ years and you basically have to be a mega success (win the lottery) to make profit on that long of a development cycle

tardy spoke
#

I think innovation should be saved for "experiments" and not "projects".

low tangle
#

I've done major rewrites of my game 5 times since the project started and switched to ecs about two years ago

#

its always gotten better, but never any closer to the actual desired gameplay and quality I've set out to make

#

its been anywhere from fully monobehaviour, to full outside of unity oop to full unity ecs and now is a hybrid of ecs - mb

#

when I wrote it full oop/mb this most recent time, GC and memory pressure murdered the framerate I've had with ecs so bad I just deleted the entire branch

#

I'm at the point where I can keep hacking together my hybrid ecs solution with monobehaviours, or I've got to find some otherway to do it (core prototype)

tardy spoke
#

Something I find interesting though is often it's not the speed of the code, but the speed of the idea. Switching from my own subscene streamer to World Streamer (which uses GOs) world streamer is actually more performant, because his implementation of the streaming is better... I would need to write some pretty good systems to beat it in performance for my game

safe lintel
#

a long time ago I tried going back to mb, im just not a good enough programmer to be able to keep the modules separate and it becomes spaghetti code too quickly with old oo mb approach

low tangle
#

yeah the performance and clean structure of ecs systems allow for good rigor and isolation

#

yeah I'm basically trash at OOP/MB now

safe lintel
#

its honestly the main reason im sticking with it, not for performance but just modular nature of being forced to work a certain way

tardy spoke
#

@safe lintel yeah that's my concern as well. That's why I'm trying to integrate ECS with MB / GO, haha

#

At least I can keep some of the game systems "clean" and decoupled

low tangle
#

thats where I'm at right now with my codebase. for my game, I dont use any of the built in conversion system, it just doens't fit the needs of my game at all

#

everything is ecs first, which then command and drive gameobjects

tardy spoke
#

yeah, that's what I'm trying to do right now

#

How do you instantiate your entities?

#

or get the "commands" to the GO's?

low tangle
#

directly within the system spawning them

tardy spoke
#

ok so you're spawning a light weight entity and attaching it to a specific GO in code?

low tangle
#

if they touch gameobjects, those systems then end up having to be normal Runs and without burst

#

yeah

#

I've got a function for recursing and parsing a gameobject tree, with configs about whats attached, and a simple conversion interface, that allows you to add in regular components as needed

#

its not ideal, but it works for now

tardy spoke
#

Yeah, I'll probably end up doing something similar

#

I just started so I'm just figuring solutions for that now

low tangle
#

thats so you can still utilize unity prefabs

#

conversion utility just produces a nativearray of entitys, so you can massage any of the components inside afterwards

#

root is always element 0

tardy spoke
#

So you avoid the use of convert and inject entirely, right?

low tangle
#

yeah, its built on the assumption that you dont care about the gameobject afterwards

tardy spoke
#

Right

low tangle
#

even the convert and inject mode doesn't work right

tardy spoke
#

So your physics system then is in regular PhysX?

low tangle
#

using physics scenes, auto simulate and sync transforms off yes

#

but I'm really thinking about pulling in a custom physics engine at this point

#

@tardy spoke for reference, its not ideal and you should modify this to fit your game.

#

forgot two buffers


    public struct ParentEntity : IComponentData
    {
        public Entity Value;
    }

    [InternalBufferCapacity(10)]
    public struct ChildEntity : IBufferElementData
    {
        public static implicit operator Entity(ChildEntity e) { return e.Value; }
        public static implicit operator ChildEntity(Entity e) { return new ChildEntity { Value = e }; }

        public Entity Value;
    }
tardy spoke
#

@low tangle awesome! Thanks I'll try it out ๐Ÿ˜„

violet cosmos
#

How expensive is the call like:

ChildrenComponent parentChildren = EntityManager.GetComponentData(parentEntityComponent.Parent, ChildrenComponent);
EntityManager.GetComponentData(parentChildren.ChildOne, SomeCachedDataComponent);

Lets say, I'm going to be calling that very often in the ForEach loop in Systems

low tangle
#

you use the interface the same as unity's just without being able to convert other gameobjects there. its a limit of that system

#

profile it with 1000 calls a frame @violet cosmos

#

only way you can build up your rule of thumb for how expensive something is, is to profile it

tardy spoke
low tangle
#

oh thats a gameobject cleanup system

tardy spoke
#

I'll comment it out for now

low tangle
#

its a system state component, that destroys the gameobject if the entity is destroyed

tardy spoke
#

Nice ๐Ÿ˜„

low tangle
#

    struct LinkedEntitySystemState : ISystemStateSharedComponentData, IEquatable<LinkedEntitySystemState>
    {
        public GameObject gameobject;

        public bool Equals(LinkedEntitySystemState other)
        {
            return other.gameobject.Equals(gameobject);
        }

        public override int GetHashCode()
        {
            return gameobject.GetHashCode();
        }
    }

    [UpdateInGroup(typeof(PresentationSystemGroup))]
    class LinkedEntityDestroyedSystem : SystemBase
    {
        protected override void OnUpdate()
        {
            Entities
                .WithoutBurst()
                .WithStructuralChanges()
                .WithNone<Transform, RectTransform>()
                .ForEach((Entity ent, LinkedEntitySystemState link) =>
                {
                    EntityManager.RemoveComponent<LinkedEntitySystemState>(ent);
                    if (link.gameobject != null)
                        GameObject.Destroy(link.gameobject);
                }).Run();
        }
    }
#

(Transform) [LinkedEntityState] - do nothing
[LinkedEntityState] !(Transform) - destroy linked gameobject if it still exists

#

when unity ecs destroys entities all managed components are removed first

#

I honestly cant remember if this system still works or not

tardy spoke
#

haha. Alright I'm trying it now - am I supposed to have ConvertAndInject on or anything ?

low tangle
#

nope

tardy spoke
low tangle
#

its a manual conversion system, so you have to say somewhere in code, to convert it

tardy spoke
#

Ah, thanks. I just had it my head it was a direct replacement for IConvertGameObject for some reason, haha

low tangle
#

you could easily write this one sec

#


    class ConvertToEntity : MonoBehaviour
    {
        public bool IncludeUnityTransforms;

        private void Awake()
        {
            NativeList<Entity> entities = new NativeList<Entity>(Allocator.TempJob);
            GameObjectToEntityUtility.ConvertGameObject(World.DefaultGameObjectInjectionWorld.EntityManager, gameObject, entities, IncludeUnityTransforms);
            entities.Dispose();
        }
    }
#

I've got multiple ecs worlds so I have to be explicit where I convert things

tardy spoke
#

@low tangle this is awesome! That's exactly what I was looking to build, this is so cool, hahah

low tangle
#

happy it helps

tardy spoke
#

I might see if I can mod it to detect authoring components and attach them to the entity it creates

low tangle
#

yep should be doable

amber flicker
tardy spoke
#

@amber flicker reading now!

@low tangle I think what you've invented should actually be a supported workflow in DOTS lol

#

Like "I want to play with it, but I want to use all of the tech I'm used to"

low tangle
#

eh, its not ideal

#

oh

tardy spoke
#

I mean the idea in general

covert pelican
#

Hi ppl ๐Ÿ™‚ im new in unity, and i discouvered somedays ago that unity will change to data oriented design, i was reading about design patterns (the book of gangs of four), so this pattern i think that are not useful with dots?

low tangle
#

yeah hybrid workflow where you can still use monobehaviours you might got

tardy spoke
#

@covert pelican understanding design patterns in general is always good ๐Ÿ™‚

covert pelican
#

a great ๐Ÿ™‚ thank you @tardy spoke

low tangle
#

@amber flicker I'm gonna attempt to add my story, but I really hate posting on the forums lol.
thank you though, hope something good comes from this

amber flicker
#

thanks @low tangle - kinda weak sauce if it's only my opinion ๐Ÿ˜„

tardy spoke
#

I replied

amber flicker
#

I just want to make sure that they are taking this seriously.. if they release a 'roadmap' like we've seen before..

low tangle
#

exactly

#

that fucking dots graph roadmap

#

from 2018

tardy spoke
#

@covert pelican Lots of resources here to help get started with DOTS ECS stuff!

#

Their marketing team should have their salaries docked for the DOTS expectations/understanding fiasco, straight up. A lot of what was advertised was vapourware, essentially. Marketing stuff that doesn't really exist is BEYOND agile. It's also arguably super unethical.

#

And there's nothing wrong with experimental software, but it should be marketed as experimental, which they SOMETIMES did, but other times kinda didn't.

trail burrow
#

@amber flicker good post

amber flicker
#

@tardy spoke I think that's a bit harsh. I think the engine team got really hyped because they made something really cool. Like a significant step forward for Unity. I think most of the issues stem from the (understandable?) mistake that was thinking Megacity proved out the technology and that with a couple of years polish they could start getting a great experience in the editor.

#

thanks @trail burrow

low tangle
#

Well, they also said two years ago, that it was two years from most things being done with dots in the backend

#

now they say its going to be another two

trail burrow
#

i have so little trust left

low tangle
#

which is frustrating because I took a gamble on that. dots team has a lot of talent in it, and I figured their two year plan was at least somewhat achievable

tardy spoke
#

@amber flicker yeah, but they missed the mark by an absolutely massive degree. I can understand estimates being way off, but I have a hard time believing anyone internally working on this stuff thought these timelines were reasonable.

minor sluice
#

ah, think that was a good post too, and I haven't been here a lot (my ecs adventures are almost over for the time being), but I think those were the common points people mentioned here too

tardy spoke
#

Lol yeah, we're all in this boat now having similar issues based on what was advertised

#

You showed me working projects, I assumed they were possible, right?

trail burrow
#

@low tangle i think 4 yrs from now is reasonable, if they dont backtrack and abandon it ... that is

low tangle
#

thats what I'm thinking as well

#

4-6

#

and that engine probably wont even be unity

tardy spoke
#

And luckily for me my project isn't tied to any sort of need for profitability, but for some people they would be, and to me that's what makes it unethical.

amber flicker
#

If I had been in their position I would have been even more optimistic and reckless ๐Ÿคฃ - so I have a lot of empathy for it happening. It's what's happening now that I take more issue with.

tardy spoke
#

I wouldn't be surprised if they abandon it because the amount of users using is likely very small, but I would argue that's probably because of the marketing fiasco.

low tangle
#

back then I distinctly remember a form post saying, dont use this unless you dont plan on releasing for two years

minor sluice
#

I wish all of you good luck and that unity maybe focuses some more on getting every aspect into ecs and maybe make docs or examples that might be more accessible.

Think if I was to go the ecs route now, it would probably still a mix of doing stuff like animation, particles and rendering with the old approach, and maybe jobs/ecs for some logic stuff or heavy lifting

tardy spoke
#

Lol, I don't plan on releasing for 2 years or more, but I still need to at least be able to BUILD the game in the meantime

low tangle
#

yeah I've settled onto that hybrid approach, and its ass @minor sluice

minor sluice
#

oh..

low tangle
#

it works, like you can do it and finish it

tardy spoke
#

@minor sluice yeah that's exactly what I'm doing now. Using ECS to control GO's so that everything exists that I need to build

violet cosmos
#

My issue with DOTS is over-reach and results in bunch of half baked things that have consistent blockers I would have rather had a bunch of tightly working things, but under a limited scope that don't have blockers.

Then, a road map of "These are the new things we're going to add" and can trust they'll also be a collection of tightly working things

minor sluice
#

I think you can't really use the performance benefits that much then? I never used it, does that work with SharedComponentData and you can't properly use those within jobs?

low tangle
#

but there is so much mixing within those hybrid objects that you waste a ton of time just getting the lifetimes correct

#

and event systems are still slow as hell to write

#

which you really need them when dealing with MBs

tardy spoke
#

@minor sluice I've largely given up on the performance benefits of DOTS, because I can either have a super fast game that doesn't exist, or a game that actually exists and I can scale it back till it runs, hahah.

low tangle
#

yeah you pretty much loose all performance when touching any MBs, sometimes you can defer the mb touching to after the work is done, but that sync point and main thread foreach run negates a lot of the gain

#

I mean, you can make pacman and snake on dots for sure

tardy spoke
#

Hmm, you could run multiple forEach loops on a few systems to separate out the logic before touching MB, but I dunno if there's much gain there.

minor sluice
#

in my current small game I pretty much have the enemies completely in ecs,
and the player is just a monobehaviour who syncs its position to an ecs collider. but it's a really small game.
I'd certainly try to go with ecs for a bullet hell though, (which this game was kind of a test for)

ah okay alex. Seems annoying, but I think that's the better choice!

tardy spoke
#

I mean, in most real world projects you have some "big" systems that you get the most bang per buck for optimizing. For example, my AI systems is really where I would need to spend optimization time, and I'm sure even w/out DOTS I could get them to be performant

low tangle
#

yeah thats what I've got all over, its a lot of extra mental weight to lug around managing them @minor sluice

tardy spoke
#

@minor sluice yeah I ran into issues with subscenes and animations I just couldn't circumvent. Literally completely stuck. Adding a mesh with bones to a subscene broke the entire subscene ๐Ÿคทโ€โ™‚๏ธ

low tangle
#

but having the physics in ecs helps, I dont have that option due to UGC asset bundles

tardy spoke
#

So I literally have no choice anyway and I'm worried more things like that will pop up

low tangle
#

I can't ask users to convert to entities because asset bundles don't even have that option at all, let alone trying to get your users to use a experimental package thats been removed from the public repo list

minor sluice
#

there is one thing, outside of what was mentioned in the forum post above that I am kinda concerned about.

jobs + ecs is really great for performance, but if they wanted to push to make the performance by default the regular approach and lay the way-to-go concepts out in the future to be data oriented.. if they are still thinking about it..

it just seems like so such an accessibility reduction, which is the opposite of what unity tries to aim at in other areas it seems

tardy spoke
#

I wish this workflow was supported by ECS... the "I want to talk straight to GO's" model. Would've been fantastic for people transitioning over that don't need to rotate a million cubes.

#

To me it's odd to throw out 15 years of tooling when you don't really have to... most games realistically don't need all the optimizations of ECS to be playable.

low tangle
#

during work I dream about building a new engine built around a ecs framework first, instead of shoehorning it in... one day...

tardy spoke
#

Svelto.ECS gets more and more appealing.

low tangle
#

really wish unity would just spin off their own second engine and build it right

#

unity 2 : dots

tardy spoke
#

Is Project Tiny even still a thing?

amber flicker
#

yea that's kinda what tiny is

minor sluice
#

haven't worked with bones or animation in that way in ecs yet, so I don't really have an acess to it.
you have used the gpu animation system from ante right?
there seems to be another project with animation stuff which is - i think it is just called dots-sample, but it might be the fps demo they put out with the networking.

oh yeah, what happened to tiny?

low tangle
#

then you wouldn't have to tell 13 year olds that they shouldn't use it

tardy spoke
#

The weird thing is how even people here, who develop DOTS aren't even sure of the state of DOTS lol

#

Like if anyone should know it would be us

low tangle
#

tiny isn't even close to my feature set of a VR sandbox game with high quality graphics, physics, multiplayer and async UGC loading though

#

unless thats changed

coarse turtle
#

idk what happened to tiny, the latest version uses like entities 0.5.0 I think last time I checked?

minor sluice
#

June,
just curious, how do you handle user generated content? because I think this might be something I#d like to try in the future too.

with the addressables system or the old assetbundles? and do you let users upload on a certain platform and make those files accessible to others, or is that however the users want to share it?
so they make their bundle and just send it to others how they want to?

tardy spoke
#

Tiny probably had even less users than the rest of DOTS so it probably got put on the backburner

low tangle
#

old assetbundles, custom manifest files

coarse turtle
#

I was honestly hoping it would roll out w/ an update so I could peek at the workflow

low tangle
#

addressables are just a bolt on vfs inside of the bundles

#

you can write an equivalent in a few hours

minor sluice
#

yeah, I think especially the people who are very active here should have an idea about the state of development, sadly that doesn't seem to really be transparent either ๐Ÿ˜…

ah okay june. what do you mean with the last one? you mean coming up with a system to read files from a certain disk location and load them?

low tangle
#

well, addressables main 'feature' is that you can assign a path to a resource

#

so 'my/main/texture' is what you resource.load

coarse turtle
#

I remember a post somewhere (I think it was on the forums) where they stated that latest alpha stuff would be going to a focus group (so select users/companies) - and it would roll out in later months - which is probably why there haven't been many visible updates

low tangle
#

but that just first queries any resource loader stuff, fetching the bundles from servers or from a path, unzipping into a cache in appdata

#

which btw isn't secure

amber flicker
#

@coarse turtle wasn't that the visual scripting stuff?

minor sluice
#

is there an editor utility functionality that works like Resource.Load just for any path you want?
so like loading any specific asset file from any location without it having to be in an Resources Folder?

low tangle
#

then loading that asset bundle and pulling the file from it, using a string->unityobject mapping within it

coarse turtle
#

@coarse turtle wasn't that the visual scripting stuff?
@amber flicker Hmm I can't remember it was a few months ago

low tangle
#

yes, because you have to manually assign every single object to the bundle

#

which is also bad workflow

#

imagine clicking every single asset you want to export for users to use and saying heres the virtual name for that

#

you can now manually make an asset bundle with that path

#

its awful for devs, even with a script to do it for you

minor sluice
#

hmmhh, I haven't really worked with addressables yet, but I planned to look into it,
sounds like this is probably still not a replacement for the old asset bundles though, apparently? even if it sounds like it in some descriptions

low tangle
#

yeah, for modding its not ideal

#

for dev based content replacements its alright

#

like dlc

#

although, don't take my word for it, evaluate it yourself if it would work

#

and always make sure you don't just do surface level testing, try to do a complex prototype with it, real use case first

#

some stuff on the surface seems like it will work perfect, until you dig in and realize it doesn't support that, or would be a ton of work to do it in the way you need

minor sluice
#

ah, certainly. Thanks for the insight. user based content/modding would be the thing I'd look for too ^^

#

the sophisticated use case stuff that might not work or is supported, there is probably no other way that to dive deep enough into the project and see the use case for yourself first

glossy summit
#

Anybody know why my renderMesh's material is not updating anymore after an upgrade to hybrid renderer v2?

low tangle
#

if I ever had access to unity source, the asset database and bundles system is what I'd replace to better support UGC

safe lintel
#

i wish you could compile a project to have a non baked down asset structure, like the old quake games. just untouched assets in folders where users could modify them as they see fit

low tangle
#

yep, thats exactly it

#

unreal and unity both don't let you do this

#

no clue for unigine and cryengine but I'd assume they use the same

minor sluice
#

but, I think for models and textures at least, it won't be that hard to manually do? just that it requires a bit of additional effort or not?

#

there was an obj loader plugin I've seen and tried, fbx might be trickier

low tangle
#

I mean, we have model creation and texture creation at runtime, so yes you can build a custom system

#

but its never about if you can do it manually, its about working against the engine

#

which that workflow does, a lot

#

memory hungry, awful performance

#

just think of early KSP, that was all obj loading from loose files in the game folder

#

install two mods and suddenly your waiting 10min at the loading screen, as unity shits itself with gc allocs

minor sluice
#

ah okay, I haven't been that into it to had those use cases for real, but long loading times and excessive memory usage sure sounds annoying

safe lintel
#

for non animated models maybe not such a big deal but for animated stuff ive only seen one 3rd party asset for rigged model loading at runtime

low tangle
#

yeah thats because the fbx node format is pure ass, as is most model formats

#

parsing out skeleton data from them is not fun, let alone then doing the animations

minor sluice
#

what was that asset if you don't mind sharing thelebaron?

I think it is probably tricky with skinned meshes, but maybe if you have either the same bone hierarchy/naming conventions or at least adhere to the unity skeleton, maybe it works?

low tangle
#

depending on the type of animation data, it might be just a bunch of quaternions or it might be a bvh tree with delta floats, or it might be a full k:v map of values to bones

minor sluice
#

like there should probably a preset model or information on how people have to set up a character with bone names and hierarchy so it could work?

low tangle
#

model formats are retarded

safe lintel
#

yeah i imagine its not a simple task and honestly i dont think id like to base any significant work off of a somewhat unknown 3rd party asset no matter how well intentioned. it just kinda walls off a significant part of user modding that saddens me

low tangle
#

oh yeah, that and unity's humanoid retargeting is hard to work with at runtime

minor sluice
#

are there also some issues with licensing if people want to make their fbx parser?
or is the problem that there are so many versions of fbx already?

low tangle
#

well, fbx parsing is only a small part of the whole

#

just supporting skeleton mesh loading is not fun but doable, using an aforementioned parser, but then you have to take that skeleton and animate it. Humanoid retargeting? not easy (maybe not even possible iirc) so custom skeleton retargeting? or do you expect the user to use the same skeleton so your animations can apply to the same tree. that means your not using the humanoid animtion system, and suddenly every animation you can buy on the store doesn't work. unless you convert them
also good luck layering animations, onto that, like if the user added some small part that needs a small animation

safe lintel
#

btw good post @amber flicker imo they really need a dedicated pm or two for coordinating dots communication to the general public, like how well willgoldstone does for general unity stuff

#

i truly value every post joachim makes, its great to see someone so high in the company kinda talking about mundane or technical stuff with dots, but I wish all of their devs were that communicative, wouldnt need the pm people if that was the case

low tangle
#

agree with that

#

that and when mike does as well

amber flicker
#

I also live for joachims posts like a fanboi

safe lintel
#

same with the havok guys, those guys are also awesome with the communication

minor sluice
#

oh yeah, I like how active joachim seems to be in forums etc. too,
he even replied to one post I had in the past, that felt pretty good.

layering animations sounds like a pain. probably won't try the skinned mesh modding part. but what is interesting, Sessions a recent unreal game has mod creators where they use completely different models for the humanoid animations,
but that was probably more a work of the modders than anything on the core game itself

low tangle
#

yeah 100%

amber flicker
#

I don't think every dev there (or even some) should be expected to be active on the forums. That's quite a burden for an employee I think. I'd rather they did bountys for employees willing to write up a proper blog post and then pay for them to be edited/add images

low tangle
#

unreals humanoid retargeting is even more manual, and per model basis @minor sluice

#

if your custom models are made to the same skeleton it does work though, which is how most unreal games were built for - common skeleton

safe lintel
#

oh not saying i expect them to be active, just saying I wish they were of their own accord ๐Ÿ™‚

amber flicker
#

have any of you wanting to do the humanoid stuff actually tried the dots animation / dots timeline packages? they basically have a whole bunch of stuff in there for additive evaluation of keyframes etc

low tangle
#

I've used it once yeah, but its not even close at all for handling vr full body IK and animation blending

#

its got a simple two bone solver in it for arm or foot ik

minor sluice
#

heard that the animation retargeting is harder in unreal for example.

low tangle
#

its another audio/animation graph

minor sluice
#

I looked for the timeline dots package but couldn't find it on 2019.4,
I guess that is a 2020.1 thing?

low tangle
#

but invisible at the time, since whatever UI they built for it doesnt have it

safe lintel
#

i fire up the animation samples every now and then and then after like an hr or two i bounce off of it because I cant figure it out ๐Ÿ˜Ž

amber flicker
#

@minor sluice you have to add it manually - not sure if it's 2020 only

low tangle
#

oh damnit, I forgot to mention multiple ecs world support in the post @amber flicker

amber flicker
#

edit button is your frieeend

low tangle
#

its abysmal still, and unity builds everything in mind with there only being one world that things go into

#

on it

amber flicker
#

I think it's important the post isn't a damning of every missing feature though. It's about their communication (imo).

minor sluice
#

oh, is it a public github repo then? I think I didn't find it but I should check again,
you recommended me to check it for the animation curve into blob asset stuff right?

low tangle
#

yeah I understand

#

I feel multiple ecs worlds is a major feature of any ecs

amber flicker
#

@minor sluice yea that's right - can't rember the git off the top of my head.. smth like com.unity.dots.timeline

#

what sucks for you about worlds @low tangle ?

dusky wind
#

is the timeline supposed to be a Timeline equivalent

#

or something else entirely?

minor sluice
#

thx, I'll check again

safe lintel
#

com.unity.timeline.dots

amber flicker
#

@dusky wind kinda yes... but there's not much in the way of ui.. also buy my asset when it's released instead ๐Ÿคฃ (half joke)

dusky wind
#

I swear the package manager fiasco is the stupidest likely product manager driven idea I've seen in years

#

@amber flicker do you allow your asset to be redistributed in open source games?

low tangle
#
  • manually ticking my other worlds
  • loosing all GUI support for viewing systems running within (and their timing data)
  • construction of their systems and the way you inialize their systems feels and looks really jank within a ICustomBootstrap, and its not exactly setup in a way where you can keep the default world, but you can.
#
  • transferring entities between worlds is cumbersome since its either manual or all entities within a world (proxy world helps)
amber flicker
#

@dusky wind sadly not :(. Also I don't think I'll ever do character animation - it's meant more for tweening & ui and that type of thing but I do hope it helps bridge some of the frustration that exists atm wrt UI & seamless workflow across gameobjects, subscenes, entities, editor and code.

minor sluice
#

now I have the the qualified package name in front of me and I still can't find it blobsweat
there is com.unity.timeline but not com.unity.timeline.dots
and can't find anything like the second on the unity technologies github either

amber flicker
#

where are you 'looking' for it @minor sluice ? you have to hit the plus on the package manager and like leave it alone for a few minutes - it'll error if it can't find it

dusky wind
#

yeah I need full blown character animation, and I can't use any paid assets

low tangle
#

yeah you can't do that in ecs, pretty much at all, unless you do the entire skeleton animation yourself

#

at least 3 months from an animation package that works I'd bet

minor sluice
#

I was regularly looking for it in the package manager in the search bar with the filter "all packages"
and for adding with +, I'd either need the package, a tar or a link to a git repository or not?

amber flicker
#

then type in the com.unity.timeline.dots or whatever it was and hit enter

minor sluice
#

oh wow, didn't think this would work, let me try

thought it would have to be something like an https url to a certain website

amber flicker
#

nah just that should work

safe lintel
#

for some reason adding it this way vs manually editing the manifest file takes a looong time for me

amber flicker
#

I think it's because it's adding all the dependencies and doing iterations of compiling.. I think it's what would normally happen but with little ui feedback

minor sluice
#

thanks a lot! seems like it worked,

I wonder how anyone can find that out without help. either you have the right url or you put in the full package name in the manifest with the right version. For some reason I couldn't find something useful on it on google either (might have had to look further)

amber flicker
#

ha yea.. already wrote my piece about that on the relevant forum post

minor sluice
#

great, I hope this can help others too who are in this position,
although without you I also would have never found out that timeline.dots was already a thing ^^

amber flicker
#

er well I think I need to credit @safe lintel for finding that?

violet cosmos
#

Can I use [BurstCompile] on pretty much any compatible struct that isn't a Job? ie: a struct that doesn't use references

amber flicker
#

@violet cosmos it's fine to use any value types in burst stuff afaik.. if that's what you're asking

violet cosmos
#

Well, I'm structuring up some code... They're a bunch of structs that have data and some methods

I want to call a bunch of them in a loop, and would like if the methods were Burst, but not have to cram them into Jobs

amber flicker
#

I think it will just work if you call them from a bursted job?

violet cosmos
#
[BurstCompile]
public struct MyStruct {
    float Something;

    public float MathsPls() { //work }
}

Like, does this just magically work?

minor sluice
#

from the previous messages, seems like thelebaron provided the right package name? so thanks too ๐Ÿ™‚

#

I think I didn't have issues with methods that were inside structs like those and are called from within jobs

#

and I also think that structure can make sense if you either just get a value that relies on a combination of other values in the struct or transforms the values in the struct somehow, without touching any outside structs or classes

amber flicker
#

@violet cosmos You'd have to test. I would expect it to depend on where it's being called from - I don't know if [BurstCompile] does particularly anything in that case but I would expect it to happen automatically even without that attribute if you called MathPls from a function that was burst enabled. I could be wrong.

violet cosmos
#

How do I check it's running Burst?

amber flicker
#

The Timeline view in the profiler should say - you can also test the timings by turning burst globally on/off

minor sluice
#

seems like a lot of the times this is done with static methods in separate classes though.. perhaps?
I get that it would be a violation of the ecs concepts but I never understood why you couldn't have a method in a (component data) struct like that and call it because it seems more like a convention than anything

amber flicker
#

I haven't really found a case for methods in structs yet but I'm sure there are some. I make heavy use of static methods that are self-contained (i.e. you pass everything they need into them) - these are an important part of working with dots and I don't think they're an anti-pattern.

violet cosmos
#

If you have a problem with methods within structs, you're going to have a big issue with DOTS in general haha

amber flicker
#

I don't have a problem with it. I just prefer to keep only data in structs where possible and transformations in systems (which can call static util methods)

minor sluice
#

in my old attempt of an animation curve (2 years ago) that was used in a job, for example I had the evaluate method as a method in the struct itself.
I haven't tested if it was really calculated on threads but

just dug out the code

public class BulletAnimScaleSystem : JobComponentSystem
    {
        [ComputeJobOptimization]
        private struct BulletScaleJob : IJobProcessComponentData<BulletBDStruct, ScalingChangeAnim>
        {

            public void Execute(ref BulletBDStruct bullet, ref ScalingChangeAnim scaleAnim)
            {
                bullet.scaleMultiplier = scaleAnim.curve.Evaluate(bullet.lifeTime * bullet.timeSpeed) * bullet.timeScale;

                if (bullet.destructionFlag != 0)
                {
                    scaleAnim.Dispose();
                }
            }
        }

        protected override JobHandle OnUpdate(JobHandle inputDeps)
        {
            var job = new BulletScaleJob();
            return job.Schedule(this, 30, inputDeps);
        }
    }
tardy spoke
minor sluice
#

I think I saw something like this in a library, let me see

foreach (IComponentData Idata in componentDatas)
                EntityManager.SetComponentData(e, (dynamic)Idata);
#

maybe it works for AddComponentData too?

tardy spoke
#

Awesome! I'll try it out ๐Ÿ™‚

low tangle
#

I think the GenerateAuthoringComponent creates a internal struct during codegen

minor sluice
#

maybe it's trickier here, since you need an instance, but with new c#, I think you can just use default to get the default value of the type?

low tangle
#

you will need to see how they did this, by pulling up the GenerateAuthoring source code in the package

tardy spoke
minor sluice
#

ah cool

tardy spoke
#

Yeah I was thinking I'd have to look at the source

minor sluice
#

oh, you already have the component instance here ^^

tardy spoke
#

and I still will ๐Ÿ˜Ž

minor sluice
#

did the dynamic approach work?

tardy spoke
#

Didn't seem to

#

I think you'd have to do new (dynamic)component , wouldn't you?

#

but it says thats an experimental feature or something hahah

minor sluice
#

not sure how dynamic would work in the context of creating a new instance, I'd probably try to work with the default keyword,
but you already have the component instances you need in the ICDcomponents array? so I hope there is no need for new [componentType]

tardy spoke
dusky wind
low tangle
#

fantastic post, just read it

#

thanks for making a nice well formatted one, ||I didn't have the energy.|| really helps the legitimacy of the post

tardy spoke
#

Niceeee

trail burrow
#

@dusky wind well-written

safe lintel
#

heh tribal knowledge transferal, great description of the state of documentation and examples with dots

dusky wind
#

I'm used to this kind of stuff since my team at work lacks any form of good documentation internally

#

but having this on a public set of packages is new to me.

#

Said wording came from that.

safe lintel
#

kinda assume docs will be the slowest thing to materialize out of all of this. getting good docs for the renderpipelines and stuff has taken ages and imo still not there yet

trail burrow
#

Frankly, it's a joke they cant pull this together in 3 years

safe lintel
#

how long has quantum taken?

trail burrow
#

about 3 years

low tangle
#

is quantum your core? or game?

dusky wind
#

Having worked in a company the size of Unity, actually no bigger.

trail burrow
#

@low tangle quantum is the deterministic framework i've built, which turned into a product called Photon Quantum

dusky wind
#

I can see why it has taken this long.

#

But that doesn't mean I'm happy about it.

low tangle
#

oh no shit? I just was looking at that product the other day

trail burrow
#

Yeah, im the inventor/lead architect/whatever u wanna call it

low tangle
#

very nice!

trail burrow
#

Now the team is much larger than just me ofc

dusky wind
#

Though realistically, I've worked 4 years on something as simple as getting street names put into Google Maps.

low tangle
#

wish it fit my usecase, looked really well designed

trail burrow
#

@low tangle Whats ur use-case?

#

@dusky wind ๐Ÿ˜„

low tangle
#

vr sandbox, user generated content, scripting, gameplay framework for users

dusky wind
#

3 years for an entire game engine is impact-wise larger than what I've done.

trail burrow
#

ah, we have been doing a lot of VR work lately

#

but dont think any of it is public yet

low tangle
#

yeah, pretty used to that lol

trail burrow
#

but the user generated content bit is hard

low tangle
#

everyones been doing stuff in vr but no ones putting anything out there yet

#

yeah its a real pain in the ass

trail burrow
#

we just fixed the 3d physics engines final issues with stacking and all kinds of crap ppl want to do in vr

low tangle
#

next game is going a much different route, sandbox games kill studios

safe lintel
#

ahh stacking, still kind of a weird case in unity physics ๐Ÿ˜…

trail burrow
#

yeah i gotta benchmark their engine vs ours some day

#

i think they will still win because floats vs fixed point

safe lintel
#

if you have good stable stacking yours might be a win just for that feature alone

trail burrow
low tangle
#

very nice

trail burrow
#

all deterministic, full predict-rollback

low tangle
#

would love to see a box tumbling down a hill, then rewinding it back up

trail burrow
#

not very hard ๐Ÿ˜„

low tangle
#

yeah but it looks so impressive

trail burrow
#

but dont have anything to record on this machine

low tangle
#

:^)

#

no worries

#

don't have sharex?

trail burrow
#

no i mnean im on a osx laptop without even the code on it atm

#

using wives macbook air

low tangle
#

oh gotcha

trail burrow
#

you can do infinite snapshots and go back to any point in time if you want, etc.

#

can do all kind of fun game mechanics

#

well, u will run out of memory at some point but

low tangle
#

yeah ofc

hollow sorrel
#

@low tangle damn i thought you would be the last person to go hybrid, i remember you making such a strong case for ecs
you're one of the few reasons i became convinced a full unity ecs game could work hahah
i agree with what you said though, everything has been taking way too long and progress has been babysteps
i don't think it has become any easier to make a game in ecs compared to 12 months ago and that's a damn shame

low tangle
#

yep

#

its been destroying me

#

two years of this ride and I want off

hollow sorrel
#

damn

#

feelsbadman

low tangle
#

I mean, I haven't quit, still am finishing with hybrid

#

but its rough, and I really hope unity start picking up steam again

#

it feels like they really slowed down

amber flicker
#

Not sure who GliderGuy is but their post just now is another interesting take

low tangle
#

a pure ecs engine and game is 100% doable, but we're missing the tools we need, and were not any closer in a year of waiting @hollow sorrel

hollow sorrel
#

yeah i agree

violet cosmos
#

definitely agree

#

I'm rolling back to my single threaded, every which way I turn trying to implement what I need in DOTS, there's some sort of blocker

low tangle
#

its frustrating because, you know its good, and it will be good once its done

hollow sorrel
#

sometimes i wonder if they're making progress internally and are just holding off on releasing for a big marketed release but signs point to doubt

proven minnow
#

I mean, debug.log support came this summer

hollow sorrel
#

i feel like the last big update we had is like 0.3 or whenever they added ecb's/blobassets/subscenes

safe lintel
#

no idea what their gdc plans were but when it was cancelled i was hoping we;d get whatever presentation thing they had planned direct to online video, but then we got a shorter roadmap without any mention of dots, no new big demos etc

hollow sorrel
#

and blobassets feel very half baked tbh

#

subscenes are also kinda but at least they are usable if you use them exactly how they were meant

low tangle
#

yeah but if your use case doesn't fit, then you cant use them at all

safe lintel
#

i agree, that the last year or so of development hasnt really had any big workflow/quality of life improvements compared to the initial release of conversion, and when unity physics was released(imo enabled a lot of stuff), i was hoping for a faster cadence on the other packages too

low tangle
#

when physics was put out, they had the demo with ragdolls, so I took that as a sign that animation experimentally was on its way, which took another unite before anything showed up

#

not animation, I mean skeletal skinning

safe lintel
#

dots editor package is like handy, but for the most part the entity debugger has had all the same info and even more, finding out that editing dots data inside that debugger was literally one line of code that was disabled seems so cheesy

#

yeah that demo they had with the waterwheel and ragdolls...

low tangle
#

yep thats the one

safe lintel
#

me too ๐Ÿ˜ฉ

low tangle
#

I'd been fine with putting together animations systems, writing the IK myself. but nothing, and now the new renderer is hdrp/urp only, and here I am sitting on built in

proven minnow
#

Systembase is a lot better than what came before

low tangle
#

oh god yeah

hollow sorrel
#

dots editor package is entirely useless to me because of what june said before
* loosing all GUI support for viewing systems running within (and their timing data)
and worst part is not supporting custom ticked worlds for systems view is apparently by design and that really hurts my soul

low tangle
#

yup

#

most painful part

dusky wind
#

I actually like the hiearchy information

low tangle
#

I was like oh shit yes, new UI!

dusky wind
#

since I am constantly changing parents for some entities

low tangle
#

systems view 100% empty

dusky wind
#

but that's about the only use I have for it

safe lintel
#

meh id be just as happy with JobComponentSystem and the old IJobForEach if it meant time was devoted to other things(i know thats not how it works though)

low tangle
#

oh yeah I agree

#

those jobs were not hard to write since I had, and still have a macro for it

#

newjobfor - tab - types - tab

dusky wind
#

The new ForEach does make it easier when working in groups though

proven minnow
#

Lots of overhead for IJobForEach though

#

I collapsed down to 50% of code length for a lot of things

low tangle
#

I like how the new one grouped every single action you might want, plus the auto variable ref'ing for read only

hollow sorrel
#

i'm still using ijobchunk regularly because i'm iterating a different world from another world (prob not best solution for the job but works for now)
and entities.foreach doesn't let you do that

#

should prob make a macro haven't thought of that

low tangle
#

highly worth

proven minnow
#

On the other hand, my entities.foreachs now have some gotos, when that was simpler than breaking out functions

#

I'm very ashamed

low tangle
#

dont be ashamed, if it was the right tool for the job then thats it

hollow sorrel
#

ooo that's huge

#

thx june

low tangle
#

yeah np

tardy spoke
hollow sorrel
#

should send those to the dots team
maybe the reason progress is slow is because they're writing boilerplate all day and having someone else spend another day approving the commit

low tangle
#

lol

#

let me know if they help you @hollow sorrel they really help me

hollow sorrel
#

maybe the 10k file for foreach lambda's was written by hand

#

it all makes sense now ๐Ÿ‘€

violet cosmos
#

In a system's ForEach, Is there ways to call something like Physics.SphereCast() with some special markup?

low tangle
#

lmao

#

for Unity.Physics or old physics?

violet cosmos
#

Old physics, Physx

low tangle
#

in OnUpdate outside of any schedule's you can just directly use Physics

#

thats main unity thread there, so its alright

#

within .Run() and .WithoutBurst() foreach's you can as well

violet cosmos
#

Hmm. That's OK to be on the main thread

low tangle
#

yeah, its okay, and its also the only option for old physics

#

no choice on that

#

main thread is faster than you expect anyways

safe lintel
#

my game runs faster on mainthread only lol

low tangle
#

yeah I die inside when I see that lol

#

I wonder if mine does

violet cosmos
#

I have like four half baked versions of this ability system, each blocked off at some blocker or another

low tangle
#

what namespace was the job count limit in, forgot, @safe lintel

#

nvrm found it

safe lintel
#

thats it

low tangle
#

set to 1 right?

safe lintel
#

technically its still 1 worker

low tangle
#

thats what you tested with though right?

safe lintel
#

i dont know if zero works as just mainthread but im pretty sure thats what I was using

low tangle
#

way too many systems to go though and disable Schedule on

#

complained about 0

safe lintel
#

yeah, granted my performance will always be bottlenecked by skinnedmeshrenderer characters so its a bit hard to really scale up a meaningful test

low tangle
#

yeah same boat

#

oh intresting, if you dont set it, it stays

#

have to restart unity or assign it back to max

glossy summit
#

When I hit play, I get a red cube and a blue cube, but they don't change color at all

#

The strange thing is that if I go back to Hybrid Renderer V1 it works fine

violet cosmos
#

Are you using an SRP?

glossy summit
#

URP

#

9.0.0-preview.55

#

and Hybrid 0.8.0-preview.18

violet cosmos
#

There's something in V2, like Material Property Overrides. Check into that

glossy summit
#

Hmm

tardy spoke
proven minnow
#

hcorion: Why not do that it via a simple shadergraph?

glossy summit
#

@proven minnow the example was not something I'm actually building, it was just a small test-case so that I could prove that what I was trying to do didn't work, and get help easier

#

Rest assured, if I was actually just alternating between blue/red I would just use a shader

tardy spoke
glossy summit
#

Anyways, thanks @violet cosmos it was URPMaterialPropertyBaseColor that I wanted to manipulate

violet cosmos
#
namespace Unity.Burst
{
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method)]
    public class BurstCompileAttribute : Attribute

Interesting. So Burst can be used on classes and methods, not just structs

tardy spoke
violet cosmos
#

But apparently it's not recognized, outside of Jobs ๐Ÿ˜›

deft stump
#

A list of components?
why?
I believe you can make a nativelist of components through the EM

tardy spoke
#

An experiment

#

lol

#

I'm going around IConvertGameObjects and I need the functionality of "authoring components" still

hollow sorrel
#

@tardy spoke use the overload where you pass in type as param instead of <>

tardy spoke
#

@hollow sorrel sure, does that give me some kind of alternative way to do the typing?

hollow sorrel
#

what do you mean

tardy spoke
low tangle
#

can't do that

#

was just working on something like that for my netcode

tardy spoke
#

I figured out I can't do it, I just haven't figured out what I can do yet ๐Ÿค”

hollow sorrel
#

does entityManager.AddComponent(entity, icd.GetType()); not work

tardy spoke
#

I have a feeling it will want generic types registered for all this

low tangle
#

if you want authoring component like functionality, your gonna need to codegen the struct like unity does

tardy spoke
#

@hollow sorrel good call, it doesn't error out so i'll give it a shot, haha

low tangle
#

personally I dont, I just create a monobehaviour and the component for it in the same file

#

also you can .AddComponentObject(ent, this) with the interface I included

#

which will add the monobehaviour as a component, its just slower

tardy spoke
#

Woah, it actually did work lol

#

@low tangle yeah I'm just hacking some stuff in there and I'll probably give it a re-write so I understand it better and to tweak a few things. It's awesome though. ๐Ÿ™‚

low tangle
#

alright, no worries

rare umbra
#

Hey everyone,

Iโ€™m returning to ECS after a long hiatus and want some advice on an interaction system. Use case is: a bunch of entities have interaction components on them which defines a distance radius, an interaction duration and a interaction string ID.

If player is within radius of the entity:

  • Display a prompt with the appropriate string id

If the player is pressing the interaction button, count up to the duration. If the button is released before the duration cancel the interaction, if not count it as successful.

I think itโ€™ll be easy to have a system which checks if the player is in range and calls a UI function(showInteractionPrompt())

So my troubles lie in the UI aspects. Whatโ€™s the best way to hide the UI when the player moves out of range?

How should I handle the hold?

Wondering if this is actually multiple systems and not just one :)

I guess it might be easiest to have a playerIsInRange and playerIsInterscting bool on the Interaction Component? This would mean I have a system for:

  • Checking if the player is in range by comparing the radius and transform to player location (and if so checking if theyโ€™re interacting) and updating the component accordingly with a currentHoldTime
  • UI system that checks if the player is in range or interacting and then displays or hides the appropriate prompt

Any thoughts on this are appreciated

tardy spoke
#

@low tangle you're right though, what I have there seems like it works for "tags" but to actually put the component data in I think structs is probably the best way

low tangle
#

yep

#

its pretty dang easy to write them

#

generate tag was never really needed

tardy spoke
low tangle
violet cosmos
#

I need to forget DOTS exists, but it's kind of like just after breaking up with a person... You can't stop thinking about them and they automatically come into your thoughts out of force of habit

low tangle
#

they basically boil down to having a file like this (due to monobehaviours requiring a their cs file name to match the class name)

#

linked just being a helper monobehaviour template

frosty siren
#

@tardy spoke i finished with huge solution that allows me to create assets with serialized IComponentData/IBufferElementData/etc and then generate adding components script. That way i don't do it manually and still can add components at runtime)

deft stump
#

I need to forget DOTS exists, but it's kind of like just after breaking up with a person... You can't stop thinking about them and they automatically come into your thoughts out of force of habit
@violet cosmos I know that feel. XD

low tangle
#

so you can just have the struct as a value in the inspector for that monobhaviour

#

ILinkedEntity is a obsolete older interface I haven't finished refactoring out

tardy spoke
#

@low tangle yeah that seems like a pretty cool solution

low tangle
#
abstract class Linked<T> : MonoBehaviour, IConvertToComponentData
        where T : struct, IComponentData
    {
        public T Value;

        public void AddComponentData(Entity entity, EntityManager manager)
        {
            manager.AddComponentData(entity, Value);
        }
    }
    struct PlayerCamera : IComponentData { }

    class PlayerCameraLinked : Linked<PlayerCamera> { }

tardy spoke
#

@frosty siren sounds interesting, I'm basically just trying to use ECS to reference GO components directly and writing some tooling for that, haha. Basically using ECS with GO's instead of entities.

low tangle
#

easy to declare a new component and a authoring mono for it in the same file

coarse turtle
#
If player is within radius of the entity:
- Display a prompt with the appropriate string id

I think for something like this - you can produce a message (it can be an entity or an element in some kind of 'event' buffer)

You can have a system which reads this message/event and toggle the user interface.

So my troubles lie in the UI aspects. Whatโ€™s the best way to hide the UI when the player moves out of range?

To hide the UI - you can probably cache the entity you want to do the distance check with.

// In your UI injected as entity I'm assuming
distance(player, targetEntity) > some_distance -> new event to turn off the event (can be another entity message or an element in an event queue) that signals you turn off the UI

In the end it might be a series of multiple systems from the top of my head (which is similar to what you mentioned)

  • UITogglerSystem (will read that event queue or message entity and enable/disable the UI)
  • SomeInteractionSystem
    @rare umbra
low tangle
#

name wise though I've switched to Authoring for things instead of Linked, as it makes more sense

rare umbra
#

Thanks @coarse turtle

coarse turtle
#

np ๐Ÿ™‚

rare umbra
#
If player is within radius of the entity:
- Display a prompt with the appropriate string id

I think for something like this - you can produce a message (it can be an entity or an element in some kind of 'event' buffer)

You can have a system which reads this message/event and toggle the user interface.
@coarse turtle

Canโ€™t I just use the interaction component for the UI to figure out what to display? Sending a message is fine except the data already lives within this component, although I guess some iteration and calculation needs to be done every frame

Might be an easy place to start but your way seems perhaps more optimized?

coarse turtle
#

Yeah I don't see why not in using an InteractionComponent with bool fields. I assumed there's like 1 player you want to check with, so you can have a system which performs the distance check and the interaction check and continuously update those bool field.

violet cosmos
#

For you guys who have worked with Unity Physics package, are there any major gotchas? As in, things I would expect to work, but just don't?

coarse turtle
#

I think by going the event route by design you can add more systems which do specific tasks based on the events. (I think something like damage an event messaging system would be a good idea - where you want to spawn maybe like a particle effect, play some audio, and apply some physics to the player, or lock their controls temporarily).

#

So it might scale better based on the needs of whatever you wanna design. @rare umbra

hollow sorrel
#

@violet cosmos i think you already noticed but one thing of note is colliders are immutable shared data (blobassets). in physx you could just morph your colliders every frame by changing dimensions, here you'd need to allocate, destroy and reallocate a blobasset every frame if you wanted to morph or change a collider

violet cosmos
#

Yeah, which is good and bad...

For static entities, where there's a few, I can save a lot of memory with complex colliders

With something like... Resizing the capsule around a VR player as they move and crouch, it's a bit expensive

hollow sorrel
#

i think that'd be fine, you'd just have a seperate collider for standing and crouch
but for games that have constantly changing hitboxes like fighting games (i imagine @dusky wind is gonna/has run into this too) it sucks

violet cosmos
#

Well, the person changes height all the time, depending on the game. You want to match that, ideally frame by frame

hollow sorrel
#

ah yea that's true

violet cosmos
#

But, really.... I just wish Unity had a way to cast into PhysX in Jobs. That's like, the reason to experiment with Unity Physics, but it's all or nothing

dusky wind
#

I've been looking at it yes

#

Supposedly BlobAssetChange is supposed to this

hollow sorrel
#

oh?

#

never heard of that

dusky wind
#

I'm not sure how to do it though

dusky wind
#

Basically, you allocate a new collider

#

delete the old one

#

and use BlobAssetChange to update it

#

but I can't seem to find how to use it

#

it's a bit concerning that all of the colliders are immutable blobassets

hollow sorrel
#

yea for my game as well

#

haven't benchmarked recreating blobassets yet tho

#

updating physx colliders wasn't free either, so if it's still cheaper than that then whatever

#

still sucks api wise tho

dusky wind
#

I'm pretty sure it is

#

PhysX definitely was heavier than just malloc/freeing two blobs

#

Alternatively if you know your sizes ahead of time (i.e. frame data in fighting games) you can preallocate them and just update the BlobAssetReference.

#

Which I might try to do.

hollow sorrel
#

@low tangle apparently there's also a toolbar > Jobs > Use Job Threads which should make everything main thread i think, for ez testing
i would imagine setting the jobsutility workerthread thing to 1 would still have a seperate thread for jobs? not sure tho
anyway my game is barely doing anything yet but it more than halves my sim loop from ~0.75ms to 0.3ms in editor (but even in release build i was getting 0.5-0.6ms before)
which is very sad

#

time to just make a singlethreaded game i guess

violet cosmos
#

That's what I'm regressing on.... and optimizing it for single threads

#

Sure would love to Jobify it but, blockers

hollow sorrel
#

from what i'm seeing you're better off staying single threaded ๐Ÿ˜…

#

for small scale at least

#

not sure where the tipping point is

violet cosmos
#

I think if you have large sets of homogeneous data, DOTS (Jobs and ECS) start to work

#

Or... If you have a very expensive isolated calculation, Jobs works fine spin that up

#

... and, yah. That's it

#

I'm rewriting my ability system, both to isolate it... But also because I learned how it could be done as a mega-job, if those blockers are ever lifted, so I want it easier to convert over to test

#

But, it's going to be single threaded

#

Instead of MonoBehaviour though, I'm writing it as discreet classes that have references. I'll loop over those, and keep the Update loop out of it's business

#

And right now, I can't use anything Jobs (for core gameplay systems) unless I convert my whole fucking game and all internal packages to Unity Physics, because someone forgot to write any useful way to query the PhysX system

#

Not update, just query. Raycasts and Overlap and those bread and butter things that make games work

#

Where I'll probably use Jobs in the future, is for the Proc gen and possibly a custom lighting solution. Because those are expensive tasks that I can queue up

low tangle
#

toolbar > Jobs > Use Job Threads
@hollow sorrel danke

#

just got back from a break, great timing

low tangle
#

dont have that option

safe lintel
#

that definitely does force mainthread but not sure what the equivalent for doing that in a build is

low tangle
#

is that from 2020?

safe lintel
#

eh use job threads has always been there afaik?

low tangle
#

am I blind, because I dont see it

safe lintel
#

oh, hmm maybe it is 2020 only

#

i mustve ditched 2019 pretty early

low tangle
#

must be

hollow sorrel
#

ahh

#

yeah probably, sorry to get your hopes up

#

am on 2020.2

violet cosmos
#

hehe, the first time I opened up 2020.2... I added a cube as a child of another cube, and the child cube got all skewed in a non-affine way

I was just like, wtf is this trash?! hard uninstall

#

I'm on 2020.1, about as close to the edge as I want to get with Unity.... Mostly because there's some new things I want to use to send data to the GPU later

safe lintel
#

2020.2 has been great for me so far ๐Ÿคทโ€โ™‚๏ธ

hollow sorrel
#

just checked source

[MenuItem(kUseJobThreads, false)]
    static void SwitchUseJobThreads()
    {
        if (JobsUtility.JobWorkerCount > 0)
        {
            savedJobWorkerCount = JobsUtility.JobWorkerCount;
            try
            {
                JobsUtility.JobWorkerCount = 0;
            }
            catch (System.ArgumentOutOfRangeException e) when (e.ParamName == "JobWorkerCount")
            {
                UnityEngine.Debug.LogWarning("Disabling Job Threads requires Unity Version 2020.1.a15 or newer");
            }
        }
        else
        {
            JobsUtility.JobWorkerCount = savedJobWorkerCount;
            if (savedJobWorkerCount == 0)
            {
                JobsUtility.ResetJobWorkerCount();
            }
        }
    }

thought jobworkercount minimum is 1, but just checked and seems docs also say 2019 = minimum 1, 2020 = minimum 0

low tangle
#

lol figures

#

yeah I was able to set it to 1, but it still was running the one thread as expected

low girder
#

I need a mentor for Hybrid ECS/ Job System if anyone can help me. I can compensate for the time ;-;

hollow sorrel
#

what is it you want help with

low girder
#

Well I need 1000 agents go towards the nearest marble and destroy it. Having a lot of agents call the coroutine to calculate the distance between itself and all the marbles (which are also 1k), is pretty heavy

#

so I am hoping to do all the calculation via ECS to fix that

#

The dots system is not beginner user friendly and there is not much information about it but I would like to learn from someone who does understand it

violet cosmos
#

Do you have ECS in use now?

low girder
#

Everytime I tried to write one up, I keep reverting it back because I hit a roadblock. I just have the normal MonoBehaviour script

#

That's why I need someone to mentor me :(

tardy spoke
#

@low girder https://github.com/DOTS-Discord/Unity-DOTS-Discord/wiki some articles and stuff to get started. I'm terrible at DOTS/ECS, but it's not so bad once you get the basics.

A good idea would also be to look into just optimizing your code with jobs and possibly burst, and avoiding switching much over to the actual DOTS stack unless it's really necessary for the performance.

Will a different type of optimization not work, like calculating solutions less frequently, etc?

low girder
#

@tardy spoke thank you so much for the articles. I will have a look at them.

Hmm not yet. I have a coroutine that has a foreach calculating the distance between the actor and the marbles to find the closest target. Will having it yield return new WaitforSeconds delay make an impact?

#

I'm open to any kind of optimisation, I'm just very amateur with my programming skills atm

deft stump
#

@low girder is this a part of your main project (if you have one)? or are you just experimenting?

#

asking coz, with unity ecs, you will need to rewrite your entire code base. (mono + ecs, is a lot of headaches and sleepless nights)
whereas, it might be beneficial for you, imo, to just use the job system and the burst compiler.

tardy spoke
#

I assume that actually simply using a yield that returns a wait actually possibly could give you the performance you need, haha. Other solutions might be an iterative approach that calculates the solution for specific marbles per frame, but that's probably more work. If the yield per results does the trick, that's great!

Not to say learning DOTS/ECS isn't interesting and worth the while. It's not quite "finished" yet, and difficult to develop complete projects with since not all the pieces are quite there, but it's still pretty cool to mess around with.

low girder
#

@deft stump it's for a test project :( the code I have is super simple so I dont rewriting. Isnt it possible to just have it as Hybrid ECS?

I am open to other dots system, it's all the same to me since I have zero experience in either of them

tardy spoke
#

Yeah, it's theoretically possible. Sometimes ECS/DOTS and Monobehaviours and game objects don't play together as nicely as expected though.

#

For example, they use a different physics system... hahah...

deft stump
low girder
#

Oh I see. Alright then I should focus on other solutions since this is for a test after all. Thanks Alex

#

Thank you mfragger

tardy spoke
low girder
#

Awesome! well i've looked and followed many. All It achieved was frying my brain. If those don't work then I will have a look again about optimising the code

twin raven
#

Is there a reference sample of how one should go about having simulation world (fixed timestep) separated from presentation world?

solid flume
#

https://www.youtube.com/watch?v=KwwHvH3GZsQ <-- take a look at that to get an idea what you're in for since that's doing at least soooomething along the lines you're looking for.
@tardy spoke Why do I need a billion lines for OnTriggerEnter

#

I'm thinking of using unity ECS for agent based modeling

sick agate
#

This text really confused me. It says "you should use the equality operator, not relational operators". Then in the example it uses a relational operator. Can someone clarify it please?

minor sluice
#

I'd say it depends on the use case for what you need

sick agate
#

second sentence says "singed integer overflow is a defined behaviour in c#". I just googled it and found this: https://stackoverflow.com/questions/26225119/is-c-net-signed-integer-overflow-behavior-defined. which means if I add one to 2147483647, it gives me -2147483648 back. Therefore, the sentence is invalid and the example below is valid

minor sluice
#

yes, that's what overflow means, not sure how frequent this case is with version number increases, but it looks like they consider it happening in real use cases since they mention it like that


have a question too

What is the preferred way to do frequent entity composition changes in a query,

I'd like to:

  • avoid to copy large amounts of struct data by using refs instead of value copies,
  • the behaviour mostly makes structural changes, so it might be better to directly use an EntityManager instead of a command buffer

but I can't have an entity foreach query with an entity as param when I also add new entities within the query (even if I call Run() so it is synchronously executed)

so..
could the preferred way be to make an entity query, get the array of the entities and the componentDatas and then iterate through the indexes, with getting the elements with ref returns from the array?

sick agate
#

hold on a second. If b is more recent, it will give me -2147483648 back. so if we back to the example, it makes no sense.

solid flume
#

It works out with how numbers are actually represented in binary

#

For an 8 bit number, 127 is represented normally, and -127 is basically written as 128

sick agate
#

I do not think ">" operator would check if the first sign is zero or one for negative or positive

solid flume
#

There are more details, but the gist is similar

#

I think this is why they're recommending subtracting

minor sluice
#

the issue is that this is a fringe case,
so there can be times where it wraps back to -2147483648 and then this is the case but it should be rather rare,

but let's examine the example,

(VersionB - VersionA) > 0

means version b is more recent

if b wrapped and has -2147483648 and the other has like 2007483648, this is wrong yeah

solid flume
#

since the difference would probably be positive, even though versionB as an int is negative

#

0111 1111 is 127 in binary, 1000 0000 in one's complement notation is -127 even though literally speaking its actually the decimal equivalent of 128

mint iron
#

@minor sluice i would probably try to use EntityManager.SetArchetype if possible and set the component data on them if required in burst. If memory serves you may also be able to AddComponent/RemoveComponent individually with a query. But generally this is a big problem, if you use an ECB it will create an archetype for every intermediary step and copy the data around when you add/remove components which is pretty damn bad. In the future when they get the enable/disable componnt in, then you might be able to just disable instead of remove which would be way faster.

sick agate
#

@solid flume does not the first bit from the left side, represent the sign of the number? -128 should be 1111 1111

solid flume
#

In one notation, yes

#

Sign magnitude does that

#

But in one's complement, the negative of a number is it's binary inverse

#

127 is 0111 1111 and -127 is 1000 0000

#

The first bit tells the sign

#

The last 7 tell the magnitude

sick agate
#

alright so -126 is 1000 0001

solid flume
#

Yep

#

One's complement does have its issues though, and as far as I know two's complement is used more often

#

-x is ~x +1

#

Essence stays the same

minor sluice
#

I only know a certain archetype component set, I will still have to manually add/remove some components
(also just found out that ref returns won't work with native arrays, so that approach kinda falls through)

I just thought that.. since command buffers just schedule operations to be executed synchronously the same way like you'd do it with EntityManagers anyways, if there wasn't a better way t directly use the entityManager

#
Entities
  .ForEach((Entity entity, ref EnemySpawnSource spawnSource) =>
       {
           // since we're iterating over entities, can't add additional entities like this, would need to use a command buffer, but is this the best approach?
          Entity enemy = entityManager.CreateEntity();
       }).Run();
#

maybe I should correct, it is not only adding components to existing entities, it is also creating new ones (and only adding components to them),

might switch to an archetype approach later as it is more performant, but at the moment I'm just curious about how to best approach this

#

some elements in spawnSource componentData are changed in the operation too

#

maybe there is a possibility to predetermine all the components I need and choose an existing archetype based of it later, for sure.

sick agate
#

why do not you want to use command buffers?

#

there are already ecbSystem updates like preinit.

minor sluice
#

oh, have only seen the endSimulationECB so far.

I am wondering what's the best practice here?
using the right archetype initially certainly to avoid having to move the entities back and forth between different chunks - but then also how to set up the entity composition commands in the best way?
I think I just go with the command buffer for now, thought it would be possible to just use the entityManager, but that's maybe more of an issue than I thought since creating entities within a query like this can invalidate the query and unity doesn't allowit

sick agate
#

so it is completely wrong.

solid flume
#

a isn't greater than b, but what does a-b evaluate to?

#

Even if you think about it in terms of overflow, it'll be 1

trail burrow
#

@sick agate thats how integer overflow works on signed integers

sick agate
#

@minor sluice usage of entityManager directly from your code should be avoided. It creates a sync point which means all of your jobs that ongoing must be completed before entitymanager do its job. using command buffers for this structural changes is the best way they say, since there are already predefined sync points for different ecbsystems

solid flume
#

If it was in fixed width font you'd be able to see that the bits in the upper debug log is 1 less than the lower one

#

Since the very first bit is 0

minor sluice
#

but isn't it exactly the same with the command buffers? just that the sync points are created at later times and batched?

#

I also intend to run this query on the main thread synchronously

#

so I thought that those sync points aren't really an issue

trail burrow
#

@sick agate okey?

#

this is how signed integer overflow works

#

not sure what to tell u

sick agate
#

dude I do not want to repeat myself just check my upper messages if you want to get involved rather than being a smart

solid flume
#

Dude

#

Debug log a-b

minor sluice
#

I think the question is how to find a reliable way to determine whether the version number of one is really "higher" then the other. since overflow can expected that might be really tricky

trail burrow
#

just cast them to their unsigned version

#

it's just a bit pattern

minor sluice
#

hmmhh, that's a good idea

solid flume
#

You could just use a byte array

minor sluice
#

what happens to -20 for example when casted to uint?

solid flume
#

More work than unsigned but theoretically it goes as high as you want it to

#

what happens to -20 for example when casted to uint?
@minor sluice maxvalue-20

#

iirc

minor sluice
#

oh, sweet, that would be very convenient

solid flume
#

Also, is Entities package not available in 2020.1?

sick agate
#

alright it makes sense now, I thought the example for the sentence that talking about comparing version numbers

minor sluice
#

they changed the visibility settings of adding packages in 2020.1 afaik

trail burrow
#

read up on how twos-complement works if you want to know why signed numbers act this way

#

thast's what the representation is called

#

2s complement or twos complement

solid flume
#

^

trail burrow
#

for signed binary numbers

solid flume
#

I'm talking a lot but I legit just learnt 2s complement 24 hours ago

#

College courses just started

trail burrow
#

also if it looks "weird" that the lowest number is 1000 it's not... you're still "counting" towards larger numbers by adding 1001 etc.

minor sluice
#

for common number formats in c#, isn't this just the one bit at the start of the number which determines the sign?

trail burrow
#

@minor sluice there's three number formats in C#

minor sluice
#

int, float I assume and?

solid flume
#

they changed the visibility settings of adding packages in 2020.1 afaik
@minor sluice I have preview packages enabled

#

But entities doesn;t show up

trail burrow
#

twos-complement (for all integer numbers), IEEE-754 for floats, IEEE 754-1985 for doubles

minor sluice
#

oh okay

trail burrow
#

tho double is just an extension of IEEE-754, but technically it is its own format

minor sluice
#

You can still add them by editing your project manifest, or by typing in the package name under Add package from git URL in the Package Manager.

well, that is annoying

solid flume
#

Why though

minor sluice
#

seems like this is what was with the timeline.dots package I wanted to use too, just that I wasn't using 2020.1 but 2019.4 still

trail burrow
#

@solid flume because they thought ot themselves: how can we make this even more convoluted

#

obviously.

dusky wind
#

The supposed reason is because people aren't thinking twice about installing potentially non-QA'ed preview packages

trail burrow
#

then they should push less non-QA'ed packages, not making it more convoluted to install them

dusky wind
#

I partially agree

solid flume
#

Also apparently there's no visual feedback for using the git URL until unity actually freezes and you realise it's fetching the package for you

dusky wind
#

There definitely should be better distinctions for the quality of a release

minor sluice
#

so now they either magically have to find the forum post or ask here if they want to use a package in a new project with 2020.1 that they already used before. Sounds like a good solution Kappa