#archived-dots

1 messages Β· Page 164 of 1

tardy spoke
#

Some of the CAD software I use for manufacturing is 2k a year per person which I think is more than Unity

#

$30 a month??? lol

#

that's insanely cheap. it must be because Unity takes a royalty split of profit?

deft stump
#

he's been paying for unity before the price hike

vagrant surge
#

they take 30% of everything sold in the marketplace

#

and big licensees pay millions of dollars to buy unity source code

#

also bunch of things like adds/servers

violet cosmos
#

Unity Plus is $33 a month when paid yearly

deft stump
#

wait what?
so paying yearly yields you to pay more!?

#

isn't it supposed to be less?

violet cosmos
#

New pricing scheme this year I think

tardy spoke
#

@vagrant surge wow that's a smart source of revenue I didn't even think about

violet cosmos
#

@vagrant surge Who takes a cut? Unity?

vagrant surge
#

unity gets mad amount of money from store

#

yes

violet cosmos
#

What store?

vagrant surge
#

asset store

violet cosmos
#

Ahh, yah. They definitely take a cut of that. Which is acceptable, I think they're offering more value in their store than say Apple or Google which takes the same cut at an insane volume

#

Because I can download something from the Asset Store for $40 that saves me days/weeks/months of work and enables me to offer a higher value end result to clients and my personal projects

#

The developer charges a bit more, and cool. Unity takes a cut, and cool.... That money goes into making Unity better

#

OK why the fuck did Unity use lowercase for the static utils like math/quaternion/etc?

#

I just see that and my F2 finger gets itchy

deft stump
#

@violet cosmos believe me, we asked the question

#

and the shortanswer is... we dont know.
someone higher up just approved it

violet cosmos
#

Stupid, they're not value types

#

I guess Unity can pretend like they are, except math. Unless they have a value type planned for math πŸ˜›

#

math mygame = math.workpls(123-90fas09-a09324l;jasdf);

#

That's the new random seed game generator that uses AI to just make a game and all the art

#

So, yes... lowercase is genius!

#

someone's thinking ahead

deft stump
#

insert tapbrain meme here

tardy spoke
#

Weird hypothetical question:

It's expensive to create video games and hire programmers, obviously. An unproven video game company is unlikely to be able to raise with investors (and you wouldn't want to anyway, they're a pain to deal with). But say you wanted to create a video game company, and you didn't have any of these resources.

I was thinking about trying something like this in my city down the road (waaay down the road) to see if it gains any traction.

Would you ever consider this agreement (if your current living situation allowed it, obviously if you have a family or obligations this likely wouldn't be optimal):

The company is started by someone, who is the "owner" and has to have ultimate say, because realistically someone does.

The agreement is that the profit of all video game sales is split amongst everyone in the company evenly. There is no pay or salary.

Basically the company mainly acts as a democracy voting on who they want to hire - since it costs everyone in the company to hire people in, the hiring decisions are likely to be fairly good.

I wonder if a company of that structure could exist/grow and be competitive in the marketplace. It seems to me like companies with this arrangement may spring up as "side-hustles", because then it's not a threat to financial security but an opportunity for a hobby to become a source of income.

violet cosmos
#

That's called a "flat structure" and some studios use it. But, honestly there's downsides

tardy spoke
#

@violet cosmos Awesome! I was always curious if that was a "thing" hahah

deft stump
#

Steam uses it

violet cosmos
#

Valve uses it, they're honestly not tiny

tardy spoke
#

Are you kidding me!? That's so fucking cool

violet cosmos
#

But, it's used here and there in small studios too

#

But, like I said there's downsides. It really really really depends on the people you bring on

#

You bring one toxic person into a flat structure and it's all downhill

#

You need to account for experience/expertise though. That everyone gets an equal say is kind of crap

safe lintel
#

i think valves flat structure is a misnomer

tardy spoke
#

@violet cosmos totally agreed. It's difficult to get rid of people in all companies and makes people get pretty nervous

violet cosmos
#

I think some people prefer to be led too

tardy spoke
#

@safe lintel it's probably evolved into a hybrid

#

it'd be hard to imagine a company that big being able to maintain any sort of true flat structure

safe lintel
#

given all the reports, having sway in the company is kinda what gets things moving. in theory its flat, but at the end of the day its the people whove been there the longest who unofficially pull the strings

tardy spoke
#

@violet cosmos yeah it would 100% be about hiring the right people. A lot of people are not self-directed, totally agree - but that's not always a bad thing either, if you have someone good at organizing that can queue tasks for them it could also be a great thing, haha.

At the end of the day all companies regardless of hierarchy come down to the people in 'em. One bad hire can tank a small company is the difference

violet cosmos
#

I think there's a better way than pure flat.... You just have good base pay, with quality revenue sharing, and good leaders

#

most people don't want to be the boss. They dream of it, but they really really don't

tardy spoke
#

Yeah, good base pay requires having resources at the start.

violet cosmos
#

Especially when it comes to making a decision that could keep the lights on or close the company next month. Nobody wants to be the boss

tardy spoke
#

I went into a startup thinking management was easy. I now know it is literally an impossible job. Unbelievably difficult.

When you imagine yourself being the boss you imagine people agree with you and getting the work done because things are just "common sense". They are not. No one agrees with you. And now they're all yelling at you and eachother. Again. Over a small detail. That isn't even part of their job or have anything to do with their department.

#

Managing the right hires is easy, because you're already on the same page. Managing the wrong hires takes all damn day.

violet cosmos
#

OK, so now I need to figure out how to initialize this thing...

deft stump
#

Managing the right hires is easy, because you're already on the same page. Managing the wrong hires takes all damn day.
@tardy spoke it's also demotivating too if the bad hire doesn't do what he needs to do even after a thorough talk.

#

You talk to them, you understand their problem or something.
you adjust their tasks.
but they still won't do it!

#

Aaaaaaaargh

#

What do you want from me! XD

tardy spoke
#

@deft stump Agreed. That could be an absolute disaster. Particularly if the company is small, and even more particularly if it is flat/democratic, since you may not be able to get rid of them, hahah.

#

Yeah, it's also that classic problem of "can't do it" vs "won't do it". Ultimately that's the same problem though, but one is possibly fixable, haha.

deft stump
#

at that point you consider firing them but you can't! HAHAHAAH

tardy spoke
#

Totally, haha. Another problem I see at the start of a flat structure would be "okay, we need someone to answer the phones. We either need to find a receptionist and pay them the same split as us just to answer the phones, or we need to find a dev that also for some reason wants to answer phones..."

deft stump
#

lol and no decent dev would want to answer phones that's deep in his zone

tardy spoke
#

lol that's what I mean. Some people get offended by this, but different roles have different "value" in a company, and it's generally reflected in someone's salary. Devs are creating the actual product that is sellable, so they get paid a lot, and the sales people selling it get paid a lot. You're going to end up with a mismatch of someone doing lower "value" work with no ability to pay them less. IE you're paying a janitor the same salary as the devs, though they're not doing the work that "pays for themselves" haha.

#

But that is super cool this is already a "thing". I'd never heard of flat structure stuff like that before. Super cool.

solid flume
#

Can I modify components inside jobs?

#

I don't know exactly how to pass a reference to one, or if its possible else I'd test it

violet cosmos
#

@solid flume In the ForEach you accept a bunch of components as parameters. Those marked with "ref" can be changed

solid flume
#

I dont know what the ForEach is, I literally just learned jobs and compute shaders and marching cubes in the last 24 hours

tardy spoke
solid flume
#

I need to be using ECS for this?

#

Can I mix having some ECS and the rest traditional unity stuff?

tardy spoke
#

This is a simple example. The "SystemBase" class basically obscures what's happening with jobs behind the scenes, so you don't see the job handles.

This is pretty much the class you'll be using most of the time to modify components. Which is nice, because it's nice and easy, haha. πŸ™‚

solid flume
#

Thanks a lot! I'll look through it

tardy spoke
#

Yeah, the most confusing part of ECS at first is basically it looks more complex to get started than it is just due to syntax having changed over time.

solid flume
#

I watched a few videos here and there, and as soon as I got to someone saying "I can't explain why but this line needs to be here otherwise X doesn't work" and seeing multiple lines just to instantiate gameobjects I kinda just left

tardy spoke
#

seeing multiple lines just to instantiate gameobjects ... not sure that's going to change anytime soon, hahaha

#

but you can easily convert GO's from the editor if it's just a one off just by applying the "convert to entity" script.

solid flume
#

Are ECS entities compatible with traditional unity gameobjects? So can I use ECS to generate terrain at runtime, and have the rest of the game on the normal monobehaviour thing?

#

Oh

#

So I just do what I want to do, add convert to entity and it just works?

tardy spoke
#

Uhh Entities and GO's don't play along well. They basically don't exist in the same world at all.

#

Your GO physics won't affect entity physics, vice versa

deft stump
#

It's generally a good idea to not mix Trad and ECS.

tardy spoke
#

in fact your GO's won't even be rendered in game

solid flume
#

Oh

deft stump
#

You either go one or the other

solid flume
#

I think I'll stick to traditional for now, since I'm learning a lot, and get to ECS when I feel I'll need it

tardy spoke
#

there are some ways to kinda... get around things and do that kinda stuff.

#

but they're more trouble than their worth imo.

deft stump
#

the hybrid approach is just there for now, as a bridge while unity is working on bringing all the stuff traditional has now into pure ecs

tardy spoke
#

@solid flume probably do a bunch of fun ECS experiments and familiarize with job system which can be used in regular monobehaviours as well πŸ™‚

#

I personally would start learning ECS now because I think it really has a lot of advantages as the game scales. That's where it really shines. The opinionated architecture and stuff to me is very valuable, since my odds of being able to make an OOP game with a good architecture at scale are virtually zero, haha.

solid flume
#

I tried doing marching cubes using the job system, and it first turned into GCAlloc hell, then I had tons of issues with parallel writes so I just learnt compute shaders and had it functioning within an hour or two

deft stump
#

being able to make an OOP game with a good architecture at scale are virtually zero, haha.
oh I feel the same.

tardy spoke
#

My opinion on it is Joachim is a better programmer than me, and he's also obviously familiar with OOP, and if he's leaning towards risking his company moving the entire thing to a new programming paradigm, I don't personally have much of a leg to stand on to disagree with 'em, hahah.

solid flume
#

I see how ECS is useful for tons of similar entities, but if I need a one-off what do I do?

deft stump
#

same thing.
you can run your system on the main thread.

tardy spoke
#

Or you could instantiate with code if you wanted

#

create the entity from scratch

#

Actually, this example is even simpler

solid flume
#

I like the ECS approach conceptually, honestly

deft stump
#

@tardy spoke you think they'll actually replace the traditional unity?

#

I for one lean that they wont. since there's a lot of assets in the asset store that will die if traditional unity is deprecated

tardy spoke
#

@deft stump I couldn't say, but if they do I doubt it would be anytime soon. Probably 10-20 years away if they ever did, at all? It would probably come in the form of an entirely new product.

solid flume
#

But I make mobile games as a hobby, and my bottleneck always turns into one or the other shader. So far I haven't really done anything to be stuck shaving milliseconds off CPU time

#

And how do ScriptableObjects interact with ECS?

deft stump
#

@solid flume they dont.
you have to convert them into a blobasset

tardy spoke
#

@deft stump yeah, but they're not just competing with themselves or their past performance, they have to compete with Unreal and now Godot, which means innovation has increased in value. Your asset store won't sell any assets if people stop using your engine, right?

#

And you gotta offer a Unique Selling Proposition to keep people on your engine

solid flume
#

Does unreal not have ECS?

deft stump
#

nope

tardy spoke
#

Unreal does not.

#

Nobody does.

#

Except... maybe somebody.

solid flume
#

Wow

#

Minecraft runs on a c++ ecs system

dark cypress
#

Plenty of games are made with ECS.

#

Just not public engines.

tardy spoke
#

ECS systems are popular, but a full implementation in a game engine I believe is unique to Unity?

solid flume
#

Interesting

tardy spoke
#

I could see Godot getting it though because open source nerds love putting crazy tech in

#

Like if you look at Blender now it has everything under the sun

deft stump
#

custom game engine devs will most likely make their engine in ecs

tardy spoke
#

and they're not tied to the profitability problem

solid flume
#

Dont tell me blender has ecs

deft stump
#

nope

tardy spoke
#

Blender at one point had it's own game engine in it

solid flume
#

Also, I was thinking of shifting to godot for 2d since I really like their node based concept, and I kinda hate unity's 2D tools, especially for pixel art

tardy spoke
#

It still might

deft stump
#

@solid flume remember that the OOP paradigm pretty much sweeped the entire industry. So expect alot of software to be written in OOP.
game engines are no exception.
it's only when you need to consider how much processing time you could be saving is when they consider going DOD.

#

I blame you java

tardy spoke
#

The Unity team said in one of the vids that they wish they hadn't made Unity in OOP and the only reason they did it was because it was all the rage when they started 15 years ago lol

solid flume
#

I've grown thinking in OOP, it's pretty much how I tackle problems by default

tardy spoke
#

I think it was a vid. Might've just been Joachim on a forum post.

#

Or maybe I just made that up... pretty sure I saw him say that.

solid flume
#

How long has ECS as a concept been around? And why is it only everywhere now?

violet cosmos
#

Hm, well... adding IConvertGameObjectToEntity on the struct doesn't work when using GenerateAuthoringComponent. Was a lovely idea though

deft stump
#

@solid flume since 1997 I believe? dont quote me on that

#

or 2002

tardy spoke
#

ECS has been around for a long while. There's nothing new in software, as they say. Most innovation happened between 1940-1970 and basically everything is just repeating now

violet cosmos
#

I'm really really surprised there's not some way to have/mark up an init process on the struct with GenerateAuthoringComponent

tardy spoke
#

The reason for ECS popularity IMO is because Moore's law broke

#

Moore's law stopped, so they switched to adding cores. What handles multi-threading well? ECS!

#

Also mobile gaming is popular and profitable... what is good for mobile gaming? Multi threading!

violet cosmos
#

Yes, IConvertGameObjectToEntity works with a MonoBehaviour but it's annoying to have another class that just reads a value

deft stump
#

ECS wasn't made for multi-threading...

#

Unity just slapped their internal job system into ECS and it jsut worked XD

tardy spoke
#

@deft stump if I'm not mistaken the architecture is pretty damn ideal for multi-threading compared to other architectures?

solid flume
#

I'm gonna learn ECS, but probably post october

tardy spoke
#

Is there a MORE ideal architecture than ECS for multi threading?

#

Probably. I wouldn't know. But it seems pretty good. πŸ€·β€β™‚οΈ

violet cosmos
#

Isn't there a DOTS/ECS forum?

solid flume
#

I thought ECS's main benefits came from insanely better memory layout

violet cosmos
#

Where do you provide feedback to the Unity devs?

deft stump
#

on ECS? go to the forum

tardy spoke
#

@violet cosmos there's a beta program you can actually join if you want to give direct feedback

#

somewhere

violet cosmos
#

OK, for either/both... Where?

deft stump
#

I thought ECS's main benefits came from insanely better memory layout
@solid flume yes. it's main benefit is better memory layout.

tardy spoke
#

I was thinking of joining it, because if you can make it so I can understand it, anyone will be able to understand it hahah

deft stump
#

which helps the CPU, by a HUGE margin compared to OOP.

violet cosmos
#

Found it

tardy spoke
#

Yeah the better memory layout is true, but could you make something that is more suitable for multi threading but with a worse memory layout, or are they two peas in a pod?

deft stump
#

honestly, games is the only area in programming where you consider the performance cost of each line of code.
in other areas is f-all!

#

πŸ˜„

tardy spoke
#

Yeeep. People can wait an extra millisecond for a webpage to load.

#

No need to spend half a year multi threading it... haha. Node.js I believe is all single threaded.

solid flume
#

Does this have a direct impact on web games?

deft stump
#

I wish we could all go back in time...
and write code the manly way...
ASM

#

XD

twin raven
#

"Dots in general is deterministic. Floating point in burst is deterministic on the same architecture." - Joachim Ante
Does that mean that 64bit iOS and Android are deterministic?

#

I mean cross platform deterministic

tardy spoke
#

First of all it's weird a persistent allocator could have a memory leak during runtime isn't it? Unless it was accidentally being deleted/overwritten.

tight blade
#

I blame you java
@deft stump for real though. looking into the effect Oracle's marketing spend has had on the industry is kind of terrifying

deft stump
#

@tardy spoke its most likely an editor thing.
I have that experience too with my persistents.

tardy spoke
#

@deft stump weird. It's also not pulling data from it right, but I'm not very experienced with these and it could just be because I'm illegally accessing it from a system

#

To me it seems like that shouldn't need a buffer or anything to just read it, but I could be mixing up systems here

hollow sorrel
#

when i setPlayer loop of one world as current player loop, other worlds not updating
@radiant sentinel
sorry wasn't able to reply until now
what code are you using for this? if you're using getplayerloop it should get the most recent version so should work fine

#

World.update is not working
@radiant sentinel
are you using the default sim/presentation/init groups? world.update only updates those by default

#

@tardy spoke i dunno about your memory leak issue but using strings as key is rarely a good idea

radiant sentinel
#

@radiant sentinel
are you using the default sim/presentation/init groups? world.update only updates those by default
@hollow sorrel
No im not use them

hollow sorrel
#

@radiant sentinel then either you can add simgroup and add your own systems under that, or subclass World and override Update to also update your own top-level group

radiant sentinel
#

@radiant sentinel
are you using the default sim/presentation/init groups? world.update only updates those by default
@hollow sorrel
Can i write a system to update other worlds? Im using this technique. I want know ,is there any performance problem at this technique?

tardy spoke
#

@hollow sorrel yeah, I won't leave it strings, just my super sweet test.

hollow sorrel
#

@radiant sentinel yea World.Update from a system in a different world is fine

manic aurora
#

hm, if you have multiple worlds, do they always update their component groups in series? looks like it’s doing every simulation group one by one, then every presentation group, etc, but these worlds have no dependency on each other

radiant sentinel
#

@radiant sentinel yea World.Update from a system in a different world is fine
@hollow sorrel
Im using group.update
Not world.update
World.update not work

hollow sorrel
#

if you're directly updating that group that's fine too, there's no real difference between that and World.Update if all it has is your own group
all World.Update does is update sim/presentation/init groups so you'd have to override it if you want different behaviour (but updating group directly is fine too)

radiant sentinel
#

Ok thank you πŸ‘i want change to sim/pres/init

hollow sorrel
#

@manic aurora yea that's because by default worlds get injected into the player loop
simgroup always updates in Update, presentationgroup always updates in PreLateUpdate, init in Initialization stage of playerloop

violet cosmos
#

So, if I have entities that are made from Prefabs, what's the best way to destroy the GameObject instance and the entity at the same time?

manic aurora
#

Ohh, that makes crazy sense, thank you Scorr

tardy spoke
mint iron
#

why is that a memory leak?
probably because its static, things get crazy in the editor with entering and exiting play mode and recompiles. You can tap into the application state change event and add some code to dispose on enter/exit but its confusing AF.

amber flicker
#

Yea not worth the trouble - if you need to, just allocate persistent in a system oncreate and put up with having to reference the system imo

radiant sentinel
#

@hollow sorrel thank you
[UpdateInGroup()] is not work for new worlds. How can i fix that, i should implement a function to do that?

tardy spoke
#

@mint iron ah right, good call. Yeah, the static declaration is what seems to breaking it, however if I change it to virtually anything else then it becomes inaccessible, haha.

Hmm... could just store all the State in separate components. Then you don't have the singleton disadvantages when it comes to unit tests, as well the components are accessed discretely so the systems are only affecting the components they need to affect directly - and not loading all state unnecessarily. Likely harder to maintain though.

proper silo
#

Hello! I am trying to convert a FixedList to a Native array, but event with a code as simple as that running in the OnUpdate, I get "NullReferenceException: Object reference not set to an instance of an object" error that happens at line 36, any ideas ?

tardy spoke
#

Actually @mint iron here's a weird idea. Make the Systems write out to individual state components. Make another system that reads those state components and generates a NativeHashMap.

"Inject" that System into any System that requires to read from state. So they read in from that, write out to the components.

is that just an unnecessary extra step, or is that smart? Haha

amber flicker
#

@tardy spoke sorry on phone but eg β€˜var persistentArray = entityManager.GetOrCreateSystem<MyStaticStuffSystem>().UberNativeArray;’

#

And in MyStaticStuffSystem you have β€˜public NativeArray<> UberNativeArray;’ then in oncreate allocate persistent

#

It’s one way anyway

tardy spoke
#

To me that seems like you'd gain a lot of efficiency in having a source of state that is ALWAYS read only and the ability to write out only to the directly affected components, as opposed to writing back to the entire object holding state

#

@amber flicker yes, I am liking this. Will give it a shot. My singleton attempt already burned and failed. I'm a man on the edge with nothing left to lose now. πŸ™‚

mint iron
#

not sure what you're saying with the writing back to entire object.

tardy spoke
#

Well, if I have a native hashmap, and a System, the System needs to communicate back to the hashmap to write over it

#

I assume while it does that it's locked for other systems to access it

#

I think with the "circular" system I proposed there you may be able to optimize that a bit, though it does have to do at least one "write" to itself

#

So you would have 1 system doing a write to the native hashmap once per frame as opposed to potentially like 30

#

Well, I guess they get sync'd at sync points anyway don't they?

#

Because all the changes could be buffered

#

So maybe it wouldn't matter, haha

#

Might just be an unnecessary extra step that only makes sense in my head but doesn't make sense in the real world.

violet cosmos
#

Why are there not any good recent docs on destroying entities, especially in a hybrid system?

tight blade
#

i think as a community we're post docs lol. We've all stopped asking why there arent docs and have moved on to accepting our roles as digital information brokers, trading the most up to date fragments of decent intel

violet cosmos
#

haha

tardy spoke
#

I didn't even bother googling for "getOrCreateSystem" docs. I know there's nothing but scraps waiting for me at the end of that one.

#

My documentation is Intellisense.

violet cosmos
#

So, how do I go about destroying entities and their associated gameobjects in a hybrid system?

tight blade
#

I just make jokes, I don't actually have anything helpful for you on that front

tardy spoke
violet cosmos
#

The AngryDOTS has an example, but it uses IJobForEachWithEntity, and if I try to convert the OnUpdate to ForEach there's no clear path to make that a JobHandle

hollow sorrel
#

@radiant sentinel yeah it's not automatic, you can check Unity.Entities.Hybrid/Injection/DefaultWorldInitialization.cs -> AddSystemsToRootLevelSystemGroups to see how unity does it
basically you wanna get the attribute, check if target systemgroup exists in the world and then add it to its systemupdatelist

tardy spoke
#

Hmm, in ECS what is the ideal "main" monobehaviour equivalent just to run some code? Is it just a SystemBase and only executing in OnStart() and cutting out the update loop? Or just a actually use a monobehaviour on a GO or what? Or will there never be "one" approach since right now it's so context specific to authoring/runtime?

violet cosmos
#

this is so frustrating

tight blade
#

don't worry, its not nearly as frustrating as it will be

tardy spoke
#

Welcome to the suck.

violet cosmos
#

Why is there absolutely no examples of anything

tardy spoke
#

and even less examples of things done recently after all the syntax changes haha

violet cosmos
#

And everyone posts code fragments that are completely out of context like they just work across different *System types

tight blade
#

lol, sorry, I spent all last night hacking, today is my "catch up on work for my day job day" so im just hanging around being snarky

tardy spoke
#

I thought being snarky was your day job?

hollow sorrel
#

@tardy spoke depends on what you're doing i guess
a good rule of thumb i try to follow is if it manipulates data in the ecs world, then it should be a system in the ecs world even if it only runs onstart
kinda like an encapsulation sorta way, then you can assume your components only get touched from inside the same world

tight blade
#

@violet cosmos im the one who lured you here from the Unity slack to begin with lol

tardy spoke
#

@hollow sorrel agreed, that's been my thinking as well. And I think SystemBase is probably a fine class to do it with though I wonder if there's any overhead of instantiating and leaving a System even with no update loop.

violet cosmos
#

I need to learn this, but I'm just miffed that nobody at Unity is making a recopies doc. Their docs are way out of context how to actually use it

tardy spoke
#

Some of the examples in the manual are wild. I've read some of the examples, thought it was completely the wrong thing, then asked here and it does exactly what you thought it does.

tight blade
#

yeah. And I mean partially these jokes are to help set your expectations, because trust me, we've all gone down the anger route, and most of us have ranted on the forums at least once. Jokes aside though, maybe show us some code you found on the forums that that doesn't make sense and we'll help walk through it with you

tardy spoke
#

There's a reason they removed DOTS from the package manager. It's us.

violet cosmos
#

Fuck it, I'm using the example and letting Unity complain all it wants about IJobForEachEntity πŸ˜›

hollow sorrel
#

afaik the cost is a couple of if() checks per frame that systembase does to know if it should run, but that shouldn't be something to worry about
if it bothers you you could maybe remove the system after it runs (but i prob wouldn't bother unless you have 1000+ systems doing this)

tardy spoke
#

Seeing as my code basically all uses .withoutBurst().Run() I have much more pressing performance concerns. πŸ™‚

hollow sorrel
#

oh

tight blade
#

hahaha

#

youre killing it with the "no premature optimization" mantra over there

tardy spoke
#

By the time removing a single if statement is the greatest optimization I can do for my game I will be a very, very, very good programmer.

#

@tight blade totally. Also my game is barely complete at all due to my expert use of YAGNI. I'm not even convinced yet my player needs something to do in my game, so I haven't bothered implementing that.

tight blade
#

oh man, yeah. I dont want to touch player interaction either. At least I'm having fun and learning math while struggling through the physics calculations

violet cosmos
#

So I have this test scene, and I'm using ConvertToEntity on a GameObject, but I don't see the SubScene in the editor... Any thoughts on why?

tardy spoke
#

Subscene?

#

It wouldn't generate a subscene I don't believe

#

Right click on your hierarchy and go "create new subscene" or whatever, any GO's under that will convert to entity's automatically - Surprise!

tight blade
#

I have a working understanding of complex and imaginary numbers now. If Id been struggling against the player interaction Id only have a working understanding of imaginary documentation

tardy spoke
#

But I don't believe if you convert with iConvert it automatically makes a subscene and puts the converted entity in it, I don't think that's how it works... but now I'm curious haha

violet cosmos
#

@tardy spoke haha, thanks! I didn't realize it was a manual process. Kind of makes sense though, especially if we can additively load, then I can load in prefab sets that are pre-converted

tardy spoke
#

Yeah, it's not obvious. Unsurprisingly, subscenes are not well documented πŸ€·β€β™‚οΈ

#

The most unusual thing in this Discord group is I don't think anyone has ever told someone to RTFM

hollow sorrel
#

subscenes are this thing that just showed up one day and unity was like "here you go guys have fun" before disappearing into the shadows

tardy spoke
#

Lol, yep

violet cosmos
#

Yah, I honestly love the concept of them, if they work like I'm imagining they will. I'm building on Hybrid and with lots of prefabs

tardy spoke
#

Yeah, I think that's what they're for pretty much. They can be pretty quirky though.

#

I think Unity was like "uh oh, everyones complaining how hard it is to convert their GO's into entities..."

violet cosmos
#

I think converting GameObjects into entities is the path... They honestly should be focusing on that right now, before moving more systems into ECS

tardy spoke
#

I think that's actually what they are doing. It seems to me like they're dropping the idea of a seperate DOTS interface or whatever and going to be adapting all the default authoring tools

tight blade
#

you know what would be cool in a community like this? documentation bounties (of some kind). all of us are lazy programmers who prefer to complain about the lack of up to date tutorials but not create them once we've learned. Some kind of fun little bounty to claim for even recording useful slack conversations about something and tagging it with searchable topics

violet cosmos
#

I honestly think that there has to be a way to work with the familiar MonoBehaviour flow and still move the crux of the stuff into ECS. GenerateAuthoringComponent is a great example of that

tardy spoke
#

@tight blade I was thinking of creating some tutorials but then I thought ... they'd probably all be wrong, hahaha.

#

I tried sending @minor sluice money for a beer for helping me but he sent it back LOL

tight blade
#

yeah, exactly. by the time you're sure you're right about it, youve moved on from thinking its something difficult enough to require you making the effort to document it

tardy spoke
#

lol that's totally right

violet cosmos
#

What we really need is a GitHub with recipes, that are branched by ECS versions

tardy spoke
#

And you lose your ability to relate to someone who literally knows nothing about it

#

which makes it hard to create those absolute beginner tutorials

#

A repo of code examples for commonly performed ECS actions would be great

violet cosmos
#

Like, how to destroy things correctly :P

tight blade
#

yeah. and honestly they dont have to necessarily be right as long as they contain a link to your name here on the discord, so that people can just go read your gist and then message you here to be like "hey, did this work? is this the final version you ended up going with?"

tardy spoke
#

Like even though @amber flicker just TOLD me what to do explicitly, and I'm sure it's actually a fairly trivial amount of code to someone who understands the concepts, I don't know how to instantiate other worlds, I don't exactly understand what they are, and in all my time spent gathering documentation I have never come across much about them, so it ends up taking waaaaay longer than it should because of the lack of documentation.

tight blade
#

^^ that way, people at least have a trail of breadcrumbs to find out who else has the same question, if not the answer

tardy spoke
#

Well, we were talking about moving my crappy google resources page to that github thing

amber flicker
#

Haha.. You don’t need to create another world fyi

tardy spoke
#

so we could start gathering it all there

tight blade
#

that'd be good. I wonder if you can build, like, gist portfolios for an organization

violet cosmos
#

If any ECS masters dump a bunch of 0.13 up to date code in my general direction, I'll cut it up and make a GitHub (and selfeshly want to learn)

tardy spoke
#

@amber flicker oh, lol I totally misread that. Someone had a solution I think that stored persistent data in another world and I got it mixed up.

#

If anyone dumped a bunch of 0.13 code examples I would horde them to myself and become a god. Then I'd get all those free beers by helping everyone.

#

Profiteering

tight blade
#

sounds like you'd have earned them

tardy spoke
#

😎

amber flicker
#

I’m just going to drop a small reminder here that best practices for mb’s and go’s took a long time to establish and even then... what even now is the β€˜right way’ to do X? I think it’s improving over time and I think at a rate better than earlier Unity. Dots is very opinionated I think in quite a useful way in the long run, making it a bit painful to get going in the short term

tardy spoke
#

Well I don't think everyone would be here hitting their head against walls repeatedly if they didn't forsee dots being immensely useful, hahah.

#

Worth the headache...

amber flicker
#

I’ll be hopefully shipping a couple of assets this year with code included - I anticipate things like that will become a lot more common too and hopefully feed into the useful examples pool, even if they are paid for

tight blade
#

right, yeah, I mean we're being haters, but we love the product

tardy spoke
#

I honestly would be making tons of ECS tutorials right now but I'm legit not competent enough to do a lot of it. I could demonstrate a couple like GetSingletonEntity which I remember stumped me for a while

#

Actually, I make video tutorials like allllll the time.

If people get stuck on things and want to write a "script" and the code or whatever, I'll gladly turn them into tutorials and throw 'em on YouTube.

#

We can just check that they're "right" with this discord group first haha

amber flicker
#

I don’t think many people feel qualified and those that too are in a world of unsafe and caring a lot about the fundamentals- less useful for getting started

tardy spoke
#

well if this group says a piece of code is fine then that's definitely more than good enough to put it out there responsibly

#

with fairly good certainty it's not the worst practice ever hahaha

amber flicker
#

Haha πŸ˜‚ I better stop commenting on code

tight blade
#

yeah, thats why I think a gist repo that included your @alexwilkinson#13251325 handle would be great. that way, if somebody has the same question they'll look at yours, and might come one here and ask you about it, and youll say "yeah actually I should update that, I fixed a bug where ___." or "yeah i should take that down, I abandoned that, it never worked"

tardy spoke
#

lol people love funny videos, leave your name in the code you write and stuff.

The nice thing with systems and components is it would most the time be easy to rig up a project that runs the code and demonstrates it clearly, since all systems are fairly decoupled from the project itself

#

Well we could leave in the readme to find us here lol

#

Realistically I'm going to likely be kicking around here for months

#

I do not anticipate ECS mastery occuring anytime soon.

tight blade
#

yeah. same.

amber flicker
#

Code monkey’s doing a great job I think. Takes all the work of teaching to prep consistent and understandable content.

tight blade
#

yeah, thats true. and the people in his discord could also benefit from the gist repo we could create, and maybe he could even give it a mention in one of his videos

tardy spoke
#

Code Monkey is good. His content is better for people who are better programmers than I am, but that makes sense because most programmers attempting ECS would be.

Ideal for me would be Code Monkey where he actually explains "why" things work more.

violet cosmos
#

OK, so now I have a few things moving around, and they're getting destroyed. Would have taken me a few hours in MonoBehaviour but took me two days to learn in ECS and even then, the destroy gives me warnings (that I'm using to be deprecated API)

tardy spoke
#

but those "why"'s are obvious to an experienced programmer, which is realistically his audience

#

Game Academy.School's tutorials are more "why" oriented and I like 'em, but the stuff they demonstrate is the typical stuff that works well for ECS.

tight blade
#

right, yeah. I think his tutorials are at the perfect level of depth, so that would support your statement

tardy spoke
#

Yeah, a good programmer would be like "this is slow" if he explained literally everything he was doing

tight blade
#

ohhh, wait. sorry, I thought you meant TurboMakesGames

tardy spoke
#

TurboMakesGames I don't mind

#

he does a pretty good job

tight blade
#

yeah, I actually prefer Turbo's stuff

tardy spoke
#

But all these guys have the same problem in common

#

They demonstrate what ECS is GOOD at

tight blade
#

true.

tardy spoke
#

They need to demonstrate applying ECS to common problems you have where the answers are not obvious

#

because that's really where the insights are

#

I'm not saying do things ECS is inherently bad at, but interesting ECS approaches so you can understand the difference between the classical approach and the new approach

tight blade
#

but of course, thats not where it makes sense to make a video, because it will likely change

tardy spoke
#

It's where it would make sense to do a video RIGHT NOW

#

but yeah the practices will change

amber flicker
#

I think... with data first, it isn’t like monobehaviour days. The right way to do something is much more dependent on what you’re exactly trying to achieve. I think that’s partly what makes it harder to tutorialise.

tardy spoke
#

I think ECS is easier by far to demonstrate than OOP

tight blade
#

thats where it helps to have folks like us with a gists repo. something that is more of a living, documented, but C# executable conversation about the edge problems of ECS and DOTS

tardy spoke
#

It would be nice if Unity could somehow support the initiative as well. I'm sure they're aware that the documentation is lacking and would support an initiative to bolster it if we had something to show.

violet cosmos
#

The issue with Git is it's so much friction to push changes

amber flicker
#

β€˜I just want to spawn a prefab’ is one line in mb. In dots you start with 5 questions interrogating that.

tardy spoke
#

@violet cosmos I agree

violet cosmos
#

What would be nice is a hybrid Git/Wiki

#

Such a thing doesn't exist though

tardy spoke
#

@amber flicker that's ONE aspect hahaha. That's a sore spot.

#

A lot of the other aspects are simpler than OO counterparts. Probably. I hope. Hahaha

violet cosmos
#

ECS is going to be lovely, once it's documented

#

I honestly like it more than MonoBehaviour for about half the tasks

tight blade
#

we also dont need to share a git org. we can each publish gists to your own github account (the big IDES even have a shortcut to publish selected text to gist), and then we just need to currate them

#

and we can pick a reasonable mechanism for that

tardy spoke
#

I think Unity may not realize the benefit of documenting ECS and the value / time trade off... like I'm not even asking for new features. Sure, they'd be nice, but I think a game is possible with what's there - I just need to at least know how to use it haha.

#

Would it not be better to put them in one place?

amber flicker
#

I think it’s most aspects. β€˜I want my camera to follow the player’ - immediately you need to know if you have multiple cameras, what is your player (mb or entity) etc etc. I think the answer to most of those β€˜i just want to x’ questions are frustratingly specific for someone getting started

tardy spoke
#

Honestly, I think the YouTube video way and then in the tutorial videos I'll literally just say "come on Unity's discord if you have questions"

#

If the goal is to get people in here to discuss it

#

the reason is the YouTube tutorial videos will likely show up way higher in google search results than a github repo will

#

you could put a lot of stuff on a github repo and have it not rank on google even for obscure ECS searches

dark cypress
#

This channel is surprisingly dead TBH. I expected there to be a lot more people here.

violet cosmos
#

@tardy spoke GitHub can show up in top search results, if there's a lot of links to it

tardy spoke
#

@violet cosmos yeah, a lot of links to it... but it's very niche content so it's unlikely there will be

#

well, we could do both actually

tight blade
#

@tardy spoke I mean sharing the links in one place and even displaying them in line in one place makes sense, but

  1. not everyone wants to make gists, but I do. you could make a youtube and I could publish gists. we just need to curate them into one place. a hub of snippets and discord names of subject matter investigators.
  2. github makes it hard to push changes, as discussed
tardy spoke
#

I could just make vids of the stuff in the repo lol

#

Great minds!

tight blade
#

so yeah, we need a wiki with inline cross account gist display and inline youtube videos

tardy spoke
#

Where would we find such a beast?

tight blade
#

im off to google to investigate!

tardy spoke
#

πŸ‘

tight blade
#

first discovery made: gist also stands for gastrointestinal tumor. this is gonna be harder than I thought...

hollow sorrel
dark cypress
#

That's a great system.

tardy spoke
#

hahahah

violet cosmos
#

We need better docs and examples

tight blade
#

what a wonderful day that will be

violet cosmos
#

haha, truth

tardy spoke
#

$5 says Unity hires all of us if we actually create comprehensive documentation for ECS.

violet cosmos
#

I wish someone had docs to point me to, and I'd gladly RTFM

tardy spoke
#

And makes us redo the rest of their documentation. We die documenting.

#

@violet cosmos agree. I'd love to RTFM.

tight blade
#

our shared identity as a community - "would love to RTFM"

tardy spoke
#

This project will be great though, because in the end it will likely save everyone a bunch of time.

#

Everyone learns faster, haha

violet cosmos
#

You know, I just had an idea....

#

What if I made a wrapper around GitHub, that would let people submit changes... But those changes just got pushed via a branch called "community requests" to a second hidden account

The trick there is making a text editor for different things and letting them group in multiple changes

#

Then maintainers could review the changes and bring them in easily

tight blade
#

Ive been in the startup game long enough to know when to use someone elses work instead of building it yourself:

checking on pricing/free tier options for this https://bit.ai/

violet cosmos
#

There was a Wiki for Unity snippets, but can't seen to find it. It was super useful too

tight blade
#

Personally I think the discord tag to ask a person questions is important, because there are snippets I could post that I'm not sure are really correct, but if someone reached out to me later I could go "oh, I found this mistake with that" and go and update the wiki. Otherwise id be maintaining snippets that Im not even sure if anyone ever used or needed or cared about, and Id have to be sure I was right before posting anything

violet cosmos
#

That's the issue with Github... Making a line or two change to implement an interface/concept is really a chore

#

In a Wiki, that's easy, but... Doesn't really help people see structured samples (as in something they can drag into Unity assets)

tight blade
#

if this works the way I think it does, we can get around that problem..

#

dude this is insane

#

just scan the page. but the idea is you can just paste in a link to the gist and it always fetches the latest version

#

so it would always be owned and changeable instantly by the person that made it

violet cosmos
#

You can do that with any piece of source, if you just add the correct path

violet cosmos
#

Yes, the trick, is contributions. We want smarter people than us to be able to easily contribute

tight blade
#

right. need to have this publically editable.

violet cosmos
#

I think a Wiki is the place to start man, with some templates

#

and a dark theme πŸ˜‰

tight blade
#

hahaha, yeah. A github wiki is probably the place to go

violet cosmos
#

and some sort of OAuth

#

No, a GitHub wiki requires people to pull forks to make changes

#

A wiki wiki

tight blade
#

not for the wikis

#

the wikis work like wikis

#

I dont mean a repo that we host as a wiki

#

I mean the wiki feature of github

violet cosmos
#

I mean a wikimedia instance

#

Then people can make accounts and make edits inline. They don't need to be contributors

#

anything that reduces friction is a win

tight blade
#

right, but you know thats the case with github wikis too, right?

#

I mean I dont have a preference very strongly, wikimedia is fine, it just sounds like you think github wikis cant be edited except by pull request or by contributors

tardy spoke
#

Pfft, while you guys have been sitting here arguing I have already implemented another broken NativeHashMap. 😎

#

I agree, Wiki's are nice for being low friction

tight blade
#

hahahaha

violet cosmos
#

I just haven't ever seen that... Do you know a wiki on GitHub that is publicly editable? I'll try to put some dong on it

tardy spoke
tight blade
#

lol, dont put some dong on it, but here's the repo for the guys that work on Unity Arcadia

#

its a clojure integration with Unity, and these guys have been working hard on it for years

tardy spoke
#

I don't mind paying to host a wiki or whatever

#

Comp sci degree ... thousands of dollars... hosting a wiki... like $10 a month

#

good deal for education

tight blade
#

its available on any public github wiki

tardy spoke
violet cosmos
#

Cool, that's fine by me then. I guess I never noticed

tardy spoke
#

Just kidding.

tight blade
#

hahaha

tardy spoke
#

Also, actually if you click my wiki you'll notice it's actually also on my github.io page

violet cosmos
#

We should definitely put some contribution guidelines up

tardy spoke
#

which is kinda cool. Can have a webpage aaaand a wiki, but that's kind of ... redundant I guess

violet cosmos
#

I'm a big fan of copy/paste templates for that

tardy spoke
violet cosmos
#

Another option, I have VPS servers and can host for free

#

But, don't know any good and secure .net wikis

#

But, likely anyone has a GitHub account and I like the reduced friction there

#

Even if the content lacks

tardy spoke
#

Also that code alone has a memory leak and doesn't work πŸ€¦β€β™‚οΈ

How am I instantiating these NativeHashMaps so wrong???

#

maybe it can't be public.

violet cosmos
#

Allocating as Persistant?

tardy spoke
#

Shouldn't it be persistent it's the state of the game??

#

that is used by other systems lol

#

I'll try tempjob but that's only supposed to last like 4 frames

violet cosmos
#

Does something else have a reference to it then?

tardy spoke
#

Disabled until I figure out why this has a memory leak

#

but things will

#

Inject this system into other systems to get access to that I believ

hollow sorrel
#

how are you checking this leak? are you getting a unity warning?

tardy spoke
#

Yeah, but also the other system was unable to read from it apparently

hollow sorrel
#

oh btw the weird thing in your screenshot is you're making a new local hashmap with the same name as your class field

#

didn't know that was possible

tardy spoke
#

... maybe it's not πŸ€·β€β™‚οΈ

#

that could be the issue haha

dark cypress
#

It's not. You're making a local field and not disposing of it.

tardy spoke
#

I thought I was being efficient. Turns out I was being wrong. πŸ€”

violet cosmos
#

haha, now that I see it I can't unsee it. It's the tab spacing gods punishing you

#

I don't think I've seen a screenshot from you yet that doesn't have some function tabbed in a line πŸ˜‰

tight blade
tardy spoke
#

It's beautiful

tight blade
#

yeah, it'll do. Anyone want to be added to the org while im on here? obviously mostly everything we can do in that wiki

tardy spoke
#

Yeeeeee

tight blade
#

I think I already sent you an invite

#

cause you posted your github profile

violet cosmos
#

Add @InnerScript pls

tight blade
#

on it

#

alright, youre both invited as owners

tardy spoke
#

Cool!

violet cosmos
#

But, why did you name it .github.io?

tardy spoke
#

Yeah that makes it a website, but the wiki doesn't go on the website

#

the wiki is a repo wiki, not web facing

tight blade
#

because, if we care to, we can make use the repo to auto publish a blog

tardy spoke
#

^ This guys a genius

#

Love that guy

tight blade
#

I mean, I dont know if we will, or if that even makes sense given everything weve already said about github and the pr process being a friction point

violet cosmos
#

I think it makes more sense to name it clean

tight blade
#

might be a good place to put uneditable content like contribution templates though @violet cosmos

violet cosmos
#

And also put Unity in the name, so it's more searchable

#

Just name the project: Unity-DOTS, the account name is fine

tight blade
#

reasonable. You're an owner in the organization so you have the authority. I didn't name it that to prevent a cease and desist from Unity proper.

violet cosmos
#

They don't do that, it's a Unity focused project

tight blade
#

gotcha

violet cosmos
#

Could you imagine that shit show ?

tight blade
#

right. I think though, that since we are forming this within what they consider to be the "Official Unity Discord", Im mildly more risk averse

#

that said, I just wanted to get things started. I'm gonna post gists to that wiki until another is made

violet cosmos
tight blade
tardy spoke
#

Will something in a SystemBase class field in ECS always run before another system's OnCreate?

hollow sorrel
#

class field initialization is same as constructor initialization isn't it

tardy spoke
#

You're asking the wrong person.

dark cypress
#

Correct.

tardy spoke
#

I googled it and that was my conclusion, but I'm afraid to say anything about OOP hahah

dark cypress
#

Compiler makes a constructor out of your class-level initialization.

hollow sorrel
#

in that case yea they ensured that around entities 0.9 or so
before that it would run oncreate right after constructor but now systems are all created first and oncreate runs later

tardy spoke
#

Great! That seems more logical to me

#

and like it would avoid a ton of issues haha

hollow sorrel
#

yea they explicitly mentioned getsystem should be usable in oncreate

tardy spoke
#

Excellent!

#

Something in ECS works as you'd expect. Add it to the wiki.

#

Ha, turns out when you add things to the right scope... everything works.

#

The singleton state thing I also just had in the wrong scope for some reason

#

lol well now I have two ways to create a persistent data storage, guess I should put them on the wiki πŸ€·β€β™‚οΈ

stone osprey
#

Quick question... Lets say i wanna represent a task in the ecs... For example a player walks towards a tree and chops it down. This chopping takes 5 seconds, the task we wanna represent inside the ecs... How would we do that ? Task Component ( time, max ), TaskSystem processing them and firing a event once finished ?

tardy spoke
#

Probably a Timer component and a Task component and a System that looks for entities that have both and manages them.

If (TaskComponent == "choppingWood" && TimerComponent > 5) --> start TimerComponent increasing --> add component to tree ChoppedDownComponent --> reset TimerComponent to zero --> Set TaskComponent to "idle".

And another System processes trees that have the chopped down component to make them fall over (or anything that has the choppedDown component to make it fall over...)

#

I'm sure there's smart ways to organize this because you may need multiple timers and stuff for different tasks, etc

#

or if you can do tasks simultaneously

stone osprey
#

@tardy spoke thanks a lot ! Thats a really good idea :) what do timer and task contain ? Timer simply a int counting up and task the duration ? ^^

tardy spoke
#

No worries! Some of the other guys may have more elegant solutions than that.

TimerComponent {
Float Value;
}

^ (you just increase it by time.DeltaTime in your system, writing it back to the component)

TaskComponent {
Native string? Fixed string? Some kind of Object/Dictionary/NativeHashMap? I'm sure someone here can chime in with a best practice there. I would have to ask myself to be sure, haha.
}

#

Timer would be a float because you'd likely want to use time.DeltaTime or whatnot. if you wanted to round it to an integer best do that with display logic I assume

stone osprey
#

Oh wait... Didnt saw you modified your example above, that makes sense, thanks ! Im often stuck with different design approaches... We could either fire callbacks once the task is done, or we could create a entity acting as a event.. what would you choose ? ^^

tardy spoke
#

Could add a component called FinishedComponent depending what you're doing

dark cypress
#

Can you callback in pure ECS?

tardy spoke
#

Well technically I think you can do pretty much anything if you run .withoutBurst().Run(); right? Because then it essentially is just a monobehaviour at that point, isn't it?

#

With burst and jobs I don't know... a callback would have to reference something somwhere so I would think it would break all that more often than not?

dark cypress
#

I guess a mainthread callback is fine.

#

I'm also very averse to adding and removing components, since that changes archetypes.

tardy spoke
#

Yeah, you'll lose all your ECS optimizations and I have a feeling that doing that likely could get you into some odd coupling scenarios and binds that ECS is designed to avoid

#

That's true, way cheaper to modify. Would be better to have a "Finished" Component on everything that is a boolean or int or something that can just be modified

stone osprey
#

I think in terms of flexibility it would be better to use callbacks/events... But i cant decide between them, callbacks are easier to implement but single threaded... Ecs event entities are harder to create but can be multithreaded without problems

dark cypress
#

Entity creation is always mainthread.

tardy spoke
#

What is the purpose of the callback? whatever functionality it's doing may also be easily implemented in ECS. Or maybe not, hahah.

dark cypress
#

Addons are easy with callbacks.

#

It depends on how often you expect to add the component. If it's for a task "tree chopped", then changing the archetype will be worth the time saved from having the system that queries that component iterating over that entity.

#

Because you don't chop trees every frame.

stone osprey
#

Well easier for attachint logic in dead ends... For example if you have a file/class where you define some entities and you can simply attach a "OnTaskCompleted", simply attach a callback and thats it... Using entities you would need to code a system for this first

mint iron
#

you can stash the callback action in a dictionary, and then when the system detects whatever the work is, has finished, it uses an id associated (presumably stored on the work entity) and uses it to lookup the callback, and calls it.

tardy spoke
hollow sorrel
#

i feel like callbacks are something you want to avoid in DOD

#

they're not cache friendly

tardy spoke
#

I would just add "Persistent data storage" and toss my two simple examples up there while they're completely barebones.

#

and people can mod/improve them if they're too low level, hahah.

mint iron
#

yeah i think it only makes sense for legacy systems interop

tardy spoke
#

Something in my instincts tells me they probably are at odds with the design pattern. That's almost like using a GOTO command in the context of ECS design imo

mint iron
dark cypress
#

I was about to drill into you about that goto diss.

tight blade
#

no strong opinions, I think we're all working on it. thats the joy of a wiki

#

just put it up there in whatever form

#

we'll figure it out

tardy spoke
#

Cool, cool

#

I'll start migrating the site's learning resources over as well in their own section. Might as well?

#

Haha GOTO. Add the halting problem into yo codez

dark cypress
#

You should never goto up. Other uses are great.

hollow sorrel
tardy spoke
#

I have nothing against GOTO, I'm just saying, if you're gonna follow a design pattern... usually best to follow the pattern, haha

#

obviously there are exceptions

dark cypress
#

Can't follow the pattern of C# loops because for some strange reason you can't break 2 and continue 2

hollow sorrel
#

what do you mean

#

@dark cypress

tardy spoke
#

I'm confused about "event entities" because shouldn't they be called event components?

#

or is just because they end up on an entity? And am I thinking of the right thing? Hahah

dark cypress
#

break 2 breaks the outer loop

#

break 3 β€” even higher level

#

You probably don't need more than 3.

tardy spoke
#

I break 9000 on the reg

#

strike fear into anyone that does my code review

hollow sorrel
#

oh yea event components might be right term i'm just thinking entities because might be cheaper to create a seperate small event entity than change a big entity's archetype

north bay
#

Never heard of that, is that a js, python thing?

dark cypress
#

I think js or php has break levels.

tardy spoke
#

No, because I've never heard of it or seen it

#

It's a PHP thing

dark cypress
#

Creating entities is faster than adding components.

tardy spoke
#

Never seen it used in JS anywhere.

dark cypress
#

From when I last looked into event entities.

tardy spoke
violet cosmos
#

I was waiting for NuGet so had a few minutes

tight blade
#

nahm you dont have to. that edit button you saw before was for a sidepanel they added, which we can also add. right now the TOC is autogenerated from whatever pages we have, so theres no "edit button" for the navigation

#

wrt alex needing to accept

mint iron
#

so what is this? a collab for writing examples/how-tos?

tardy spoke
#

How are you using Jekyll and the web side of things without the repo being named github.io

#

this so cray

tight blade
#

the github pages thing and the github wiki thing are different things

#

every public github repo automatically has a wiki

tardy spoke
#

Yeah, there's no webpage, correct? Someone just threw that on there in case we ever... do that?

#

Yeah, right

#

Where are the pages located for the wiki for editing? Hahah

tight blade
#

well, the wiki is public, so anyone can go there

#

the files, are in the wiki

#

/zoolander

tardy spoke
#

... how do I edit this wiki πŸ€”

tardy spoke
#

Yeah, I don't have that button, hahah

#

I do on my wiki there ^

tight blade
#

whoops... hard refresh that page

tardy spoke
#

Ah, yep. Weird, thought I had

#

I was so confused hahah

tight blade
#

yeah. ehem.. that must have been some DNS caching behavior in your us region, you see

#

I definitely didnt just find out that theres an option I have to tic to make non contributors able to edit.

tardy spoke
#

hahahah

#

Not sure what to call my segment, it's not technically persistent data storage

#

"Accessing data between Systems" or something is probably more apt but more vague

tight blade
#

again, we'll figure it out.

tardy spoke
#

Or maybe sharing data between systems and we could throw the other more advanced techniques in there as well

#

πŸ‘ alright, I see how we're doing this.

tight blade
#

hahaha or at least that would be my proposal. we'll lock it down a bit more soon if we get a better sense of how to make it most searchable, useful, clean etc

#

but for now I have no idea

violet cosmos
#

It would be nice if GitHub had a better way to format the side bar automatically, but that'll just need to be cleaned up

#

Don't worry, what's important right now is people are throwing content on it

tardy spoke
#

Just gotta figure out how to edit the sidebar to remove that page now

#

Oh, that'll prob need custom sidebar I'm guessing

violet cosmos
#

☝️

tardy spoke
#

yeeeep

#

Should we do that now or later?

violet cosmos
#

Later

#

Content first, clean up later

#

Did notepad.exe always not search partial matches? So if I have a word like HeyBuddyAuthorize and search for "auth", case insensitive with the cursor on the top line.... No results

#

Oh, Dumb. it was somehow set to "up" πŸ˜›

tardy spoke
violet cosmos
#

Note you can use C# in the markdown and it comes up cleaner

tardy spoke
#

I was just about to ask lol

violet cosmos
#

don't worry too much, it's just a guide to help people copy and paste. You did good, no need

#

The most important thing, imho besides clear code is the version of ECS/DOTS it's for

hollow sorrel
#

wow you can add stuff without being added to the repo?

#

technology these days

violet cosmos
#

That's the thing that's lacking in so many other docs: What effin' version?!

#

I read some and am like "Did you roll up your Unity 2019.1 and ECS 0.2 from last year and make a tutorial in July of 2020, ya jark?"

tardy spoke
#

Version in ECS is pretty critical at the moment

#

More so than it will be later on for sure. Pretty big changes.

deft stump
#

can I add.
4. OR - you're a crazy enough person to make and release a game with preview technology

tardy spoke
#

I fit all of those. Except maybe #1. I'm just assuming #1 is true because I want 100,000 zombies - that feels ECS-ey.

deft stump
#

oooh I can clone the wiki

#

XD

tardy spoke
#

Haha steal it and make a competing wiki

#

Make ECS documentation even more fragmented and terrible

zinc plinth
violet cosmos
#

Fixed it, thanks @deft stump

#

I really think people need a reality check, especially after Unity spent 2018 and 2019 pushing it, then totally dropped the ball on documentation and are in the process of burying it

zinc plinth
#

1.0 end 2022-23 minimum

manic aurora
#

the reality check for me was i stopped using dots for a year to let it mature, and when i came back they were pulling it even further from public use lol

#

lot of improvements though, it's nice coming back and comparing

dark cypress
#

They made the big news to get established devs on to give them feedback. No need to advertise anymore.

#

Makes sense to me.

manic aurora
#

yeah, you just need enough of us crazies who will go "no documentation? eh we can look at the source"

zinc plinth
#

this can be fun aswell as the absolute opposite of fun

#

going through physics collider code was not fun

dark cypress
#

Depends on your goal. If you want to make a production-ready game it's the latter.

#

Or you could mess around while parallelizing everything and marveling at burst performance.

deft stump
#

I'll contribute to the wiki. and maybe add an examples project XD

#

my now-abandoned bullet hell game is has all sorts of nuggets of fun

mossy ermine
#

Hi, I have a question. I just started to learn Unity (I haven't done any project so far, this is my first). I wanted my game to be multiplayer so I started to look a the different approaches for networking. The one that I was interested in was Netcode from DOTS (I don't know if this is the official name). Then I learned that if I want Netcode, I need to learn ECS (might not be a good idea for a unity beginner?)... So here I am! All that story just to ask, is that normal for unity to take sooo long to simply open my small project? It takes about a minute just to open it every time?

violet cosmos
#

@deft stump If you have lots of useful self-isolated code snippets, that don't fit well into Recipes... We could maybe make a "code snippet" section

#

Like, I view a recipe as taking on an existing challenge. A code snippet is something useful that's only a few lines

#

I really wonder where that Unity wiki went with all those code snippets and shaders. Anyone know?

dark cypress
#

something useful that's only a few lines
Not in DOTS ex dee.

violet cosmos
#

@dark cypress Well, if you have say... a super optimized ballistic trajectory routine, or a "floor follow", that's a snippet. And perfect for integrating into a Component, right?

#

Just ComponentClass.cs ComponentSystem.cs using the template

dark cypress
#

If you're trying to replace the old snippet wiki β€” sure. I was thinking that no task in our ECS takes a few lines.

violet cosmos
#

I should put some of my recent snippets in there, and see if anyone improves on them 😈

#

Where is that old snippet wiki @dark cypress ?

dark cypress
#

I think this is the one?

violet cosmos
#

Yah, I get s cert warning and no CSS

#

I should scrape that site before it ends it's death throes and disappears

dark cypress
#

The base domain just redirects to unity.com, so that's a good idea.

tardy spoke
#

@mossy ermine a minute seems excessive... it may have been installing packages. Try closing and reopening.

If your threshold for pain is high and you're familiar with OOP you could start with ECS.

dark cypress
#

Or better yet β€” if you're not familiar with OOP.

tardy spoke
#

I'm not even familiar with OOP personally but my threshold for pain is exceptionally high so it works out.

dark cypress
#

Knowing OOP makes it very hard to transition into DOD.

tardy spoke
#

I know what you mean, but not knowing OOP which wraps ECS makes understanding the implementation of it difficult, so it's kind of... you can't really win hahah

deft stump
#

what if your hate for OOP is high and want to escape the OOP circle?

#

then ECS is for you!

#

queue salesman sfx

mossy ermine
#

Well this is what I did just before my post, to close it and open it again it I saw the loading time of 1 min... It feels to happen as soon as I convert my project to DOTS :/

tardy spoke
#

DOTS is testing your pain threshold.

#

It tries to ween out the weak ones early.

#

Once it stops smelling your fear it'll probably load faster.

deft stump
#

1min of open loading time?
laughs in 72 mins

mossy ermine
#

Honnestly, I kind of like the idea behind DOTS, it's just taht I'm sooo much at the start the learning process of unity that it makes it difficult to learn it haha I feel like it's hard to find good tutorials/docs some times

tardy spoke
#

I mean Unreal engine has like 4 hour compile times so... time isn't really the same in game development I guess haha

mossy ermine
#

well every time I open it it's written "importing" for a long time :/

deft stump
#

time doesn't exist

tardy spoke
#

@mossy ermine we are literally writing additional documentation right now. Like we started today. Which is scary because I don't even really know what I'm doing.

#

Yeah, the "importing" thing if it says "iteration 1" then "Iteration 2" it might be some sort of glitch or bug.

violet cosmos
#

I don't think newbies to Unity should be diving into DOTS just yet

mossy ermine
#

hahah it's a good thing for the doc!

violet cosmos
#

The regular MonoBehaviour workflow makes great games, still does.

tardy spoke
#

Well, I mean it's no harm done to try, even if you decide not to do it?

#

You still learn some stuff

#

Plus our documentation is going to make it a LOOOOT easier

deft stump
#

@mossy ermine if you're at the start of learning Unity I dont suggest jumping into ECS.
get a feel for the OOP side of Unity.
after that dive into the job system.
once comfy with nativecontainers. maybe then you can dive into ecs.

violet cosmos
#

I'm writing that right now... Carefully. Maybe πŸ˜„

#

(in the FAQ)

tardy spoke
#

@mossy ermine that's just they're opinion. I'm all for beginners jumping into ECS! It's one of those things where you don't want to get into it because it's easy, you want to get into it BECAUSE it's hard, haha.

violet cosmos
#

I thought about doing it but though, well... I have some time and low and behold there's someone new to Unity looking at the docs already hahaha

mossy ermine
#

maybe that's a better idea :/ my main problem was that I could not decide wichc networking system I wanted!

tardy spoke
#

Look up SpatialOS

#

It's super cool.

#

And I believe it's built for ECS primarily

#

Because I think they built it with ECS.... or at least some DOTS tech... maybe just burst and jobs

mossy ermine
#

The client side prediction was attractive, it's what brought me into DOTS haha

#

I'll take a look at SpatialOS I guess!

mint iron
#

our neighborhood @stiff skiff works on that i think

tardy spoke
#

@mossy ermine yeah, you can try out our new ECS documentation also as well in a bit and see if you can get a hang of it, haha. We'll see how good our documentation is.

mossy ermine
#

but some stuff are outdated

#

but for sure, OOP seems easier to learn, maybe for a first project this is the way to go, idk :/

tardy spoke
#

Hmmm

#

Personally I would go ECS and OOP at same time and if you find ECS too frustrating go OOP till it's more mature and the documentation is better

mossy ermine
#

I gotta say, it is frustrating, but sooo much satisfying to accomplish what you were trying to do!

tardy spoke
#

Haha yeah, it's just like a really hard puzzle... and you can compare/contrast OOP with it while you're doing work in both.

mossy ermine
#

hahah soo true! When I saw that I was like, is this the official way to do it! But still this is clever!

tardy spoke
#

Lol, I try not to write like that because I find ECS confusing enough. If I wrote that in my code I know when I come back to it later I will have no idea what it does and have to figure it out again, haha.

deft stump
#

^ that's much better

tardy spoke
#

Easier on the brain.

violet cosmos
tardy spoke
#

Pssht, disagree

#

DOTS is like prison. You want respect, you walk up to the biggest guy and knock him out. DOTS is that guy.

#

I think it's not so much experience based, it really is threshold for frustration based. How many weeks can you spend making no progress or going backwards before you give up? If more than 12, DOTS may be right for you!

#

I wonder if sometimes the people from Unity read this chat and just laugh

mossy ermine
#

@tardy spoke hoo I like that, that makes a lot a sense πŸ™‚

#

@violet cosmos thanks for the link, I might refer to it in the dark days !

tardy spoke
#

Haha, yeah, right?

ECS code can be written so it's fairly easy to understand just by reading it, but a lot of the tutorials and stuff don't seem to write things that way for some reason

#

@mossy ermine we'll be moving these resources over to the new wiki of tutorials and stuff we're making, but you'll probably want to have a look at these

https://sites.google.com/site/unityecsresources/ <-- tons of mostly recent tutorials on ECS, ranked for beginner, etc

mossy ermine
#

I got a question tho, can't you just use the EntityManager from the Systembase instead of creating a commandbuffer?

dark cypress
#

Official unity docs say that ECB playback is faster than doing EM actions 1 by 1.

mossy ermine
#

thanks, I'll keep that link πŸ™‚

dark cypress
#

Also you can use burst with ECBs.

tardy spoke
#

My understanding (which is likely wrong) is EntityManager basically executes things immediately, which when you're doing multi threaded stuff causes a lot of issues. You can't write data to something another thread could be reading in.

A command buffer takes all those commands and plays them back at a "safe" point, which is when all the threads re-synchronize to the main thread every once in a while, when it's safe to edit/manipulate data.

That's what the "playback" command is saying. Do this stuff when it's safe to do it.

mossy ermine
#

ho ok, got it, thanks @dark cypress !

#

make sense!

deft stump
#

@mossy ermine you can.
it's just that you're going "out" of your burstable code to do your EM stuff.
ECB is just bootleg EM but it runs in burst, thats why its faster

mossy ermine
#

gush, I gotta learn how Burst works, this is not something I'm used to

tardy spoke
#

If you try to do it ECS is at least friendly enough to give you an error and tell you what to do to make it work.

#

It will tell you explicitly to disable burst and multi threading, which is actually really easy in most cases

deft stump
#

you dont need to learn burst. It's basically free realestate performance now.

mossy ermine
#

ok, nice good to know

tardy spoke
#

In that code example I gave up there, you would just switch .run() to .withoutBurst().run() ;

mossy ermine
#

well not to learn it but to make compatible code

deft stump
#

avoid managed types in burst.
avoid reference types in burst.
I think those are the 2 rules for making your code burstable.

tardy spoke
#

I think getting things to run multi threaded isn't that hard if you take the easy wins... I would bet some people are probably extremely good at getting a lot of systems to run multi threaded and I would bet that rabbit hole goes deep.

mossy ermine
#

yes I took a look a little bit and as I remember this is a .net compilet limitation so we have to use struct wichc is lightweight anyway

tardy spoke
#

A lot of systems you write will run in parallel without any extra work or consideration. If things simply iterate over certain components and only use the data within those components, you're already golden. And that's actually quite a few Systems.

#

Because Unity has some magic going on for that scenario where it figures out the threading for ya.

#

I believe.

mossy ermine
#

So is that something to avoid to even use the EntityManager from SystemBase? I should always queue command with a ECB?

tardy spoke
#

For example, I have a test cube I want to rotate. It's not affecting anything else in the world...

I think it would be harder to write this in a way that isn't multi thread/burst compatible than it would be to write it in a way that is.

dark cypress
#

If you have a non-insignificant amount of commands to run β€” yes.

#

Keep in mind there are batch functions in EM for creating entities and whatnot.

tardy spoke
#

@mossy ermine I believe that this is virtually always true with ECS - you want to buffer commands to sync points that can be buffered to sync points as much as possible, always

#

I don't think there's ever a case where creating additional sync points could be useful?

deft stump
#

I believe there's an article of which is faster: ECB vs EM's batch functions

toxic mural
#

Another nice thing about ECB is you don't have to worry about the order systems run in, within the ecb

#

*within the ecb 'window' at least

mossy ermine
#

ok that's something I'll try to keep in mind

tardy spoke
#

Yeah, I would take the reduced headache of having to worry about system execution order even at some performance drop

deft stump
#

Ah this one

#

WAIT I NEED TO WORK! AHAHAHA

mossy ermine
#

Humm @tardy spoke in your sample, do you really need to schedule? Sorry for the probably obvious question but I'm wondering :/

toxic mural
#

lol, game torrahod and their stock images

tardy spoke
#

@deft stump trick with that though is that blog is getting fairly old

#

you figure this is still accurate?

#

like the ECB team is still optimizing ECB, there's talk on it on Unite 2019, so it may be more optimized

mossy ermine
#

thanks @deft stump for the link

deft stump
#

still relevant for the discussion.

tardy spoke
#

var w = new World("Sample"); is that actually the syntax for creating a new world? Lol. Seems fairly easy!

#

w.EntityManager.CreateEntity(arc, entityArray); ... I must look into this. Does the new world have all the same execution systems and stuff or do you have to inject those or initialize in a certain way

deft stump
#

I did try EM batch operations.
but lord knows how many nativecontainers I made just to make it work!

#

XD

dark cypress
#

@mossy ermine There are 3 ways to run jobs. .Run() which executes the job immediately on the main thread. .Schedule() which will run the job sequentially, but on a thread, and .ScheduleParallel, which run the entire thing in parallel(in this case it would do a job per entity, so if you had 100 entities and 100 threads, you would have all of them in a separate thread)

deft stump
#

isnt schedparallel on a chunk level not on the entity level?

dark cypress
#

Oh yeah, you're right.

#

My bad.

#

It would run on as many threads as you have chunks that fit those 100 entities.

mossy ermine
#

Humm ok because what I did so far is always to just call the loop without any .Run or .Schedule or .ScheduleParallel

#

like this

toxic mural
#

Does that not yell at you?

tardy spoke
#

@mossy ermine If it runs, I imagine it would run on .Run() but that's a great question.

mossy ermine
tardy spoke
#

Hmm, are you sure that's actually running Spimort?

mossy ermine
#

and yes it's seems to be running :/

tardy spoke
#

Because if you don't have the PlayerComponent on something that System would just get skipped and not execute

mossy ermine
#

Well I also have this

toxic mural
#

Are you using an older version of the package? I get a syntax error in the unity console if there's no Run()

deft stump
#

I should add in the wiki "How to visualize in dots for the visual learners"

#

you agree @tardy spoke ?

tardy spoke
#

Absoloutely

#

I can make some vids of our best tutorials to try to get more exposure for the wiki.

#

So if yours is dope

#

... then I'll do that, haha.

dark cypress
#

You're gonna have to pose for the thumbnail looking very shocked with the title "10000 BILLION ENTITIES????!? HOW CAN THIS RUN?"

tardy spoke
#

Yeah is that a trend? Taking pictures of yourself looking like an idiot for YouTube thumbnails?

dark cypress
#

It works.

tardy spoke
#

Seems ubiquitous

#

I see it everywhere

#

TurboMakesGames has mastered the art of the YouTube thumbnail

toxic mural
#

Oh I guess the .Run() or .Schedule() or .Parallel() is a Systembase thing but doesn't apply to ComponentSystem

#

*requirement

mossy ermine
#

humm, as far as I know I am at the latest version :/

deft stump
#

you also need to make funny faces too alex

tardy spoke
#

ComponentSystem was replaced by SystemBase I think

mossy ermine
#

ho yes, I am using the ComponentSystem and not systembase

deft stump
#

ComponentSystem was repleaced by JobComponentSystem and then was replaced by SystemBase.
I think they're already marked for deprecation

tardy spoke
#

🀯 πŸ”«

#

the exploding head emoji looking like brains makes that extra morbid.

mossy ermine
#

Ho I see, so I should use only systembase!

tardy spoke
#

It's more future proof. It's the "same thing", really.

#

If you're following a tutorial hopefully it doesn't cause any strange effects

mossy ermine
#

well you got to use .run on systembase so πŸ˜„

dark cypress
#

I'm glad they made the foreach method chain. It was so cumbersome to write all the boilerplate for jobs before.

toxic mural
#

You can use Schedule and Parallel too, its just that you have to make it explicit which you're using

mossy ermine
#

yes πŸ™‚

toxic mural
#

I went full parallel at first, but once I learned you could link entities to managed objects with AddComponentData I'm falling back into the old ways

#

Sorry AddComponentObject I mean

tardy spoke
#

Are they keeping a class that has that jobs boiler plate still in it? Would be cool for learning. I assume there still is one because there's like a zillion classes.

dark cypress
#

The boilerblate isn't gone.

#

The foreach just makes it for you on compile.

mossy ermine
#

any advantage in using AddComponentObject?

tardy spoke
#

@toxic mural ... got any examples of that? I think you might have a more efficient way than I do for doing that, I use AddComponentData to add an ICD (that uses a class instead of a struct) that holds a reference to say a GO camera, can you add it directly somehow?

toxic mural
#

Wait, you can add a class that implements IComponentData, using AddComponentData?

tardy spoke
#

hmm hang on

#

I'm not sure what I'm saying. Lol, let me check.

toxic mural
#

Actually I think you cannot link to a gameobject directly from an Entity. It has to be a component on the gameobject

deft stump
#

yes

#

you can make a class ICD

mossy ermine
#

but burst won't works?

tardy spoke
deft stump
#

of course it wont

tardy spoke
#

@mossy ermine yep, no burst if you reference managed stuff

toxic mural
#

Herers how I do it, ignore the stuff about RAM, its a hacking sim so its the game game ram its talking about, lol

tardy spoke
#

lol awesome

#

I'll take some screenshots hang on

toxic mural
#

So your way might be better, depending on how you retrieve the managed reference, GetComponentObject is very picky about the type you pass it

toxic mural
#

Well cool I like that

tardy spoke
#

Yeah, it's weird

#

I actually did it with text assets as well haha

toxic mural
#

How does it work with GetComponent? Do you receive the PlayerCamera instance?

#

EntityManager.GetComponentData() I mean, not gameobject.GetComponent

#

They talked so much about how we can't have managed code or reference types, but bam here's passing a monobehviour into AddComponent, lol

tardy spoke
#

Hmm, I'm not sure how it technically works, but let me find the part in the tutorial video I jacked it from, the guy explains it I'm pretty sure

toxic mural
#

Oh I get the difference, GetComponentData<T>() is a generic so you have to know the type ahead of time, GetComponentObject() you only have to pass in a ComponentType struct

mossy ermine
#

Again, I feel like I don't know what I'm doing but so far what I did is the opposite, passing the PlayerEntity to the CameraGO script so I can for instance follow the player with its component data

#

Is that a good way as well?

tardy spoke
#

@mossy ermine I don't see why not? Either way I think one has to reference the other, so if the complexity is about the same, should be fine?

#

Also you may like that video ^

mossy ermine
#

I'm watching it right now, really interesting!

tardy spoke
#

That guy is pretty awesome at ECS, but I wish he did the typical ECS organization. The video gets REAAAAALLY hard to follow after a couple hours, at least for me, hahah.

toxic mural
#

Yeah me too. It just blows my mind because I thought reference types were forbidden

tardy spoke
#

He jumps around in the code like crazy because somehow he can just remember where everything is. Pretty nuts.

#

Yeah, I'm not sure... they really don't seem to be? I dunno if it's a "bug" or a "feature", hahaha

mossy ermine
#

what is the typical ECS organization?

tardy spoke
#

It's easy

#

I'll show ya

#

I might not be following the exact conventions, I think System may usually go on the end of the filename and not the beginning, but point being, you have a folder for components, a folder for systems.

Obviously how you structure the code inside may get more convoluted, but Systems are generally supposed to stick close to the single responsibility principle I believe

cerulean dawn
#

nice

tardy spoke
#

But my point was, it would be nice if he actually split his code into components and system files AT ALL, haha. He codes them kinda all together.

mossy ermine
#

ok I see!

#

So far I'm like that! I did not know that there was a standard haha

tardy spoke
#

Haha, yeah totally, it's a great standard because it just kinda makes sense and is what everyone seems to do anyway. πŸ€·β€β™‚οΈ

#

Thats one cool thing about ECS vs OOP. OOP isn't nearly as standardized in terms of organization / structure.

toxic mural
#

Wow I wasted a lot of time by not knowing about this class IComponentData thing.

#

Thanks for that video

tardy spoke
#

Like if we all worked on an ECS project we would all pretty much know how it's structured, but if we all started an OOP project we would have to spend days discussing the architecture haha

#

@toxic mural yeah I show people that vid all the time because I was like "... what??"

#

If that is a bug I sure hope they never fix it hahaha

mossy ermine
#

well I only came here tonight to ask about my loading time issue but obviously I learned way more πŸ™‚ thanks!

tardy spoke
#

@mossy ermine no problem! πŸ‘ I hope you got the ECS route. It's pretty cool stuff!

mossy ermine
#

Thanks, you guys were really nice to answer my newbie questions!

#

btw, my main language is french so sorry for my weak english typing :/

tardy spoke
#

You're probably better than I am. 😎 Hahah. Everyone here is super nice... for some reason. Odd for programmers. I think it's because smart people gravitate to DOTS, and I find it's always the smartest people who truly understand how deep the rabbit holes go become humble because they realize that they don't really know anything. πŸ€·β€β™‚οΈ

toxic mural
#

^^^

mossy ermine
#

hahah I'll try to stick with DOTS and not abandon my project because of it! πŸ˜„

tardy spoke
#

@mossy ermine awesome!

toxic mural
#

Wow there's a whole section on managed ICD in the manual that i guess I just never read

#

brb, seppuku

tardy spoke
#

lol i've never seen it in the manual either

#

Oh shit, there is

#

Well that's good... I guess it's here to stay then haha

#

The state system would pretty much just be a NativeHashMap or something in that figure. ^

#

The potential advantage I thought is that for a lot of the systems that affect state but don't need to immediately change it, they could just write their changes out to components in parallel, and those components basically would act as a "buffer" for their state updates.

hollow sorrel
#

2 seems kinda redundant, if you're writing to components why not read from them directly

tardy spoke
#

Yeah, I'm thinking you could get the same effect anyway by simply putting timers in the systems to delay the change state updates or something

#

the big win I figured might be ease of creating parallel jobs compared to referencing the state directly in a read/write way

#

because your systems are then only "ref" - ing the components they are effecting, instead of ref-ing the entirety of the state NativeContainer, so you'd be able to more easily execute Systems in parallel. Could be totally wrong there, though.

#

and working on local copies of the state at the time of execution or whatever

#

but I'm thinking as soon as you have a single system that needs read/write to the state on every update you might lose all the benefit

hollow sorrel
tardy spoke
#

haha is that hidden data?

hollow sorrel
#

i dunno what it is you're doing but generic question seemed like generic answer would fit

#

could you give more concrete example

toxic mural
#

Has anyone used MemoryBinaryWriter ? Does Unity provide a way to get a byte[] from the byte* it provides?

tardy spoke
#

Hmm. I can sure try.

Okay, so you have say something that needs per frame State updates. State is just a NativeHashMap let's say.

Ok, player location likely needs to have it's State info updated per frame for the server or something. Or we'll just assume for whatever reason it does, even if it doesn't.

But something like say whether or not a quest has been completed can wait half a second to update to State.

What's the most performant way to handle both of those situations? It seems like having many Systems all referencing that NativeHashMap object is going to slow everything down quite a bit.

#

As they'd be forced to not run in parallel I believe.

Well, let's just say you had to do something like hold the State of 10,000 boxes and their locations. What's the most performant way?

Does the approach change at all if you only needed them to update their location State say twice a second?

hollow sorrel
#

if by state you mean their data then prob would just have 10,000 box entities or an entity with a dynamicbuffer that holds them if they don't have to be entities

#

if you need direct non-linear access like you'd want from a hashmap then you could set up a seperate hashmap on a system that points to these entities/buffer id

#

what i meant by hidden data is generally you don't want to have data that actually affects the state of the game in a specific system because a system shouldn't own game state

#

having acceleration structures for faster lookups is fine, but (generally speaking) you want to build them from data that lives inside entities

#

if you were to serialize and deserialize the world you'd just rebuild your accel structures but wouldn't have to serialize them as well

#

you might end up with some data duplication here so might not be most performant, but you'd have proper seperation between systems and data

#

@toxic mural haven't tried with membinwriter specifically but looks like it just returns a list ptr so you could try UnsafeUtility.AsRef<NativeList<byte>>(ptr);

toxic mural
#

Thank you! I was slowly working towards CopyPtrToStructure but I knew it didn't need to be copied, just recast

#

oh wow is AsRef new in 2020.1? As usual I was looking at an old (2019.4) version of the docs

#

Wish they'd make that clearer

hollow sorrel
#

guess so, dunno if it'll do as intended tho when looking at it again

#

but not sure what else you'd use

toxic mural
#

Well the other option is write to disk, then read it with System.IO.File.ReadAllBytes() but that seems silly lol

#

on the other hand that way I wouldn't have to dip into unsafe code

#

I mean instead of passing a MemoryBinaryWriter to SerializeUtility.SerializeWorld, there is also the option to pass it a StreamBinaryWriter I guess

hollow sorrel
#

i'm guessing it points to the first element in the list so as long as you have the length should be able to recover a list from that without copying
just dunno what the correct way to cast a list back out of it is

toxic mural
#

Yeah a length is provided

solid flume
#

Can I run compute shaders in jobs?

#

If so, how?

craggy orbit
#

compute shaders are a GPU thing, jobs are a CPU thing. so afaik, no, you can't

#

and last i checked you can't use references in jobs, so you can't even reference the compute shader to set parameters inside of a job

upper tiger
#

Hey all, I have a problem with my ECS system.

I am making a system that deals with projectiles hitting targets. I was thinking of doing an Entities.ForEach with each projectile, checking if they have hit their target and subtracting the targets health away. Problem is I could have multiple projectiles hitting a target at the same time meaning multiple parallel things trying to access the same HP value on one entity. Pretty sure this would cause race conditions. Is there a way I could do this in a parallel fashion?

spark glade
#

You could write to a queue in parallel

#

let me find the exact class name

upper tiger
#

use a nativequeue?

spark glade
#

I'm doing the same on an IJobChunk basis

#

Yeah you can use NativeStream.Writer and in your IJobChunk MyWriter.BeginForEachIndex(chunkIndex); with MyWriter.EndForEachIndex();

#

It's very efficient

#

And then you can just have a consumer system that plucks them 1by1 out of the stream

#

which is also super fast

upper tiger
#

is that esseentially doing the operations ins eries avoiding race conditions?

spark glade
#

I think so. Somewhere you need to go sequential.

upper tiger
#

yeah its looking that way

spark glade
#

Unsure if there is some black magic algorithm to get around it. But this approach is most likely going to be fast enough for anything you might be planning.

#

I use it for an AbilitySystem in my game and it works butter smooth, even on mobile

upper tiger
#

heh, looks like you're doing what i'm currently starting to do

spark glade
#

😱

#

I retract everything I said!

#

It's definitely impossible πŸ˜‰

upper tiger
#

well, targetting, firing projectiles, destroying units etc

#

not that its a novel idea lol

spark glade
#

haha yeah I know

upper tiger
#

havent looked into chunks yet though, guessing they are more efficient somehow

spark glade
#

Iirc Entities.ForEach is just sugar on to of an IJobChunk.

#

IJobChunk gives you some flexibility for optional componenttypes, which is very nice. (Entities.ForEach can't do that, syntax wise)

upper tiger
#

and the efficiency comes about because things are laid out in RAM in defined blocks which makes indexing fast?

#

cool, ill look into that

spark glade
#

Memory layout is one of the reasons Unity's ECS is so fast, yes.

stone osprey
#

im struggling again with ecs design decisions... this time : code flexibility and decoupling. Lets say we wanna construct a "Condition" Mechanic, a little spawner entity which only spawns other entities once its spawning condition is true... currently i have two approaches in mind : 1- Condition Component ( List of bools ), SpawnSystem reading its Condition Component and spawns stuff when all bools are true. 2- SpawnCondition Component and a SpawnSystem operating on that SpawnCondition only. As you can see those approaches are pretty similar, BUT the Condition component could be used for various other mechanics, as some sort of "Interface". While the SpawnCondition could only be used for the spawning mechanic... What is considered cleaner ? What approach would you choose and why ?

vagrant surge
#

@stone osprey forget about it and hardcode the hell out of it

#

when you need 3-4 different spawners you then think of a way to make it generic

stone osprey
#

@vagrant surge Alright thanks ^^

#

besides that... anyone having a clue how does the unity ecs multithreading works in detail ? Im using artemis ODB ( Java ) for my game server and i wanna add support for multithreading... so i hoped i could replicate unitys ecs multithreading if i would understand it in detail... Does unity use "proxy" entities ? Or does it group systems which are allowed to run in parallel ?

vagrant surge
#

it spams parallel fors

#
  • runs systems in parallel according to read-write dependencies
#

ive implemented my own version of it for ue4 lol

#

its not that hard

deft stump
#

it also uses native multithreading instead of C#'s multithreading

stone osprey
#

Alright thanks ! ^^ what about "sequantial systems" in dod ? Lets say we build our own flexible condition system (like above) : Condition, WriteIntoConditionSystem, ReadFromConditionSystem, ClearConditionsAtEndOfFrameSystem... as you can see all those require to run after another, is this considered clean in ecs ? Should this be avoided and if so, how do we build a similar system in terms of flexibility ?

deft stump
#

I believe thats normal for ecs

opaque ledge
#

yeah its normal

tardy spoke
#

1- Condition Component ( List of bools ), SpawnSystem reading its Condition Component and spawns stuff when all bools are true.
@stone osprey

Pretty sure you might as well keep the condition Component generic? No harm done at least starting that way and changing it later if you need to, but I suspect it'll force better architecture decisions trying to keep things more generalized.

That said coming up "general" booleans or whatnot for that condition Component that works with a lot of systems could get confusing depending on requirements.

If it was me I would probably start with the Conditions Component only having "Conditions Met" boolean and trying to do the heavy lifting with the various Systems checking conditions repeatedly instead of storing condition data on the Component... but depending on how computationally complex checking for conditions are that may not be ideal.

On the other hand if you did keep the data on the Component in multiple booleans you could be like "Oh, this condition was already met, so I don't have to run this expensive part of the code again". Hmm. I understand your struggle, haha.

To offset the cost of Systems constantly checking if requirements have been met, you could save on cycles by making some of your condition Systems "lazy". It's probably often not critical to update their specific Condition component each frame - for example, if you need to start spawning monsters at a location, does it matter if they start spawning 1/2 a second later? Probably not. Alternatively if the System's condition checks are crazy computationally expensive you could have the lazy systems check something like 2 condition Components per frame each, spreading the workload out over time.

Not sure what the best answer is. I think in my own project I'm going to go for the lazy process X Components per frame approach for all the Systems I can. If you come up with a better way let me know, haha. πŸ™‚

tardy spoke
tight blade
#

my thought is that theres a way to auto publish the wiki to pages, I just havent figured it out yet

violet cosmos
tight blade
#

then we'll have the power of jekyll themes

tardy spoke
#

Well, my main concern is like, if you want to move a column of a table, it'll take you like an hour since it's all hardcoded haha

#

It looking like shit is a far second

violet cosmos
#

@tight blade if you move the Wiki to pages, then there's two sources. It's less than ideal

tight blade
#

@violet cosmos c'mon man, thats not what I said πŸ˜‚

tardy spoke
#

He's gonna parse the wiki into a webpage

#

AUTOMAGICALLY!!

violet cosmos
#

But... why?

#

Do you point people to go to the GitHub or the Web Page?

tardy spoke
#

Prettier, better ranking, more street cred

violet cosmos
#

When people search, it comes up twice

#

What is what?

tardy spoke
#

lol we'll be lucky if an unknown github repo comes up once. Or our unknown webpage.

tight blade
#

I mean having an autogenerated docs site from stuff in github isn't a particularly unusual pattern

#

the wiki is the tool that automatically handles git tool management of a publically editable wiki

#

but like yeah, this is all solving problems you didn't even mean to bring up @tardy spoke lol

tardy spoke
#

It doesn't solve the table authoring problem?

#

Though I don't know if that is really solvable

#

But if you're talking about friction making people not update stuff, those tables are full of friction, haha.

tight blade
#

well, only if they want to change the structure which is probably a low use case