#archived-dots
1 messages Β· Page 164 of 1
$30 a month??? lol
that's insanely cheap. it must be because Unity takes a royalty split of profit?
he's been paying for unity before the price hike
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
Unity Plus is $33 a month when paid yearly
@vagrant surge wow that's a smart source of revenue I didn't even think about
@vagrant surge Who takes a cut? Unity?
What store?
asset store
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
@violet cosmos believe me, we asked the question
and the shortanswer is... we dont know.
someone higher up just approved it
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
insert tapbrain meme here
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.
That's called a "flat structure" and some studios use it. But, honestly there's downsides
@violet cosmos Awesome! I was always curious if that was a "thing" hahah
Steam uses it
Valve uses it, they're honestly not tiny
Are you kidding me!? That's so fucking cool
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
i think valves flat structure is a misnomer
@violet cosmos totally agreed. It's difficult to get rid of people in all companies and makes people get pretty nervous
I think some people prefer to be led too
@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
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
@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
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
Yeah, good base pay requires having resources at the start.
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
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.
OK, so now I need to figure out how to initialize this thing...
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
@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.
at that point you consider firing them but you can't! HAHAHAAH
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..."
lol and no decent dev would want to answer phones that's deep in his zone
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.
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
@solid flume In the ForEach you accept a bunch of components as parameters. Those marked with "ref" can be changed
I dont know what the ForEach is, I literally just learned jobs and compute shaders and marching cubes in the last 24 hours
@solid flume
I need to be using ECS for this?
Can I mix having some ECS and the rest traditional unity stuff?
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. π
It's good to try to find tutorials that use SystemBase and they're likely to be fairly recent. I've compiled a list of mostly recent learning resources here, if you're interested.
Thanks a lot! I'll look through it
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.
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
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.
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?
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
It's generally a good idea to not mix Trad and ECS.
in fact your GO's won't even be rendered in game
Oh
You either go one or the other
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
there are some ways to kinda... get around things and do that kinda stuff.
but they're more trouble than their worth imo.
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
@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.
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
being able to make an OOP game with a good architecture at scale are virtually zero, haha.
oh I feel the same.
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.
I see how ECS is useful for tons of similar entities, but if I need a one-off what do I do?
same thing.
you can run your system on the main thread.
@solid flume
Or you could instantiate with code if you wanted
create the entity from scratch
Actually, this example is even simpler
I like the ECS approach conceptually, honestly
@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
@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.
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?
@solid flume they dont.
you have to convert them into a blobasset
@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
Does unreal not have ECS?
nope
ECS systems are popular, but a full implementation in a game engine I believe is unique to Unity?
Interesting
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
custom game engine devs will most likely make their engine in ecs
and they're not tied to the profitability problem
Dont tell me blender has ecs
nope
Blender at one point had it's own game engine in it
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
It still might
@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
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
I've grown thinking in OOP, it's pretty much how I tackle problems by default
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.
How long has ECS as a concept been around? And why is it only everywhere now?
Hm, well... adding IConvertGameObjectToEntity on the struct doesn't work when using GenerateAuthoringComponent. Was a lovely idea though
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
I'm really really surprised there's not some way to have/mark up an init process on the struct with GenerateAuthoringComponent
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!
Yes, IConvertGameObjectToEntity works with a MonoBehaviour but it's annoying to have another class that just reads a value
ECS wasn't made for multi-threading...
Unity just slapped their internal job system into ECS and it jsut worked XD
@deft stump if I'm not mistaken the architecture is pretty damn ideal for multi-threading compared to other architectures?
I'm gonna learn ECS, but probably post october
Is there a MORE ideal architecture than ECS for multi threading?
Probably. I wouldn't know. But it seems pretty good. π€·ββοΈ
Isn't there a DOTS/ECS forum?
I thought ECS's main benefits came from insanely better memory layout
Where do you provide feedback to the Unity devs?
on ECS? go to the forum
@violet cosmos there's a beta program you can actually join if you want to give direct feedback
somewhere
OK, for either/both... Where?
I thought ECS's main benefits came from insanely better memory layout
@solid flume yes. it's main benefit is better memory layout.
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
which helps the CPU, by a HUGE margin compared to OOP.
Found it
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?
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!
π
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.
Does this have a direct impact on web games?
"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
I figure I might as well just ask because it's probably something simple I'm just missing. Why is that a memory leak? This is a monobehaviour Singleton class
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.
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
@tardy spoke its most likely an editor thing.
I have that experience too with my persistents.
@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
It doesn't like this from within a SystemBase
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
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
are you using the default sim/presentation/init groups? world.update only updates those by default
@hollow sorrel
No im not use them
@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
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?
@hollow sorrel yeah, I won't leave it strings, just my super sweet test.
@radiant sentinel yea World.Update from a system in a different world is fine
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 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
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)
Ok thank you πi want change to sim/pres/init
this is World.Update() for reference
@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
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?
Ohh, that makes crazy sense, thank you Scorr
Hmm, haven't managed to fix it yet. Even switching it to a standard dictionary has same problem.
Came across a good resource for jobs though, haha.
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.
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
@hollow sorrel thank you
[UpdateInGroup()] is not work for new worlds. How can i fix that, i should implement a function to do that?
@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.
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 ?
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
@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
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. π
not sure what you're saying with the writing back to entire object.
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.
Why are there not any good recent docs on destroying entities, especially in a hybrid system?
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
haha
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.
So, how do I go about destroying entities and their associated gameobjects in a hybrid system?
I just make jokes, I don't actually have anything helpful for you on that front
https://sites.google.com/site/unityecsresources/ @violet cosmos pretty sure they do it at some point in "Game Academy.school - DOTS game playlist" tutorial. You also might like the DOTS-BOTS tutorial. It's pretty interesting.
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
@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
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?
this is so frustrating
don't worry, its not nearly as frustrating as it will be
Welcome to the suck.
Why is there absolutely no examples of anything
and even less examples of things done recently after all the syntax changes haha
And everyone posts code fragments that are completely out of context like they just work across different *System types
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
I thought being snarky was your day job?
@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
@violet cosmos im the one who lured you here from the Unity slack to begin with lol
@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.
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
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.
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
There's a reason they removed DOTS from the package manager. It's us.
Fuck it, I'm using the example and letting Unity complain all it wants about IJobForEachEntity π
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)
Seeing as my code basically all uses .withoutBurst().Run() I have much more pressing performance concerns. π
oh
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.
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
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?
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!
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
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
@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
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
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
Lol, yep
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
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..."
I think converting GameObjects into entities is the path... They honestly should be focusing on that right now, before moving more systems into ECS
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
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
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
@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
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
lol that's totally right
What we really need is a GitHub with recipes, that are branched by ECS versions
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
Like, how to destroy things correctly :P
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?"
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.
^^ that way, people at least have a trail of breadcrumbs to find out who else has the same question, if not the answer
Well, we were talking about moving my crappy google resources page to that github thing
Haha.. You donβt need to create another world fyi
so we could start gathering it all there
that'd be good. I wonder if you can build, like, gist portfolios for an organization
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)
@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
sounds like you'd have earned them
π
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
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...
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
right, yeah, I mean we're being haters, but we love the product
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
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
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
Haha π I better stop commenting on code
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"
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.
yeah. same.
Code monkeyβs doing a great job I think. Takes all the work of teaching to prep consistent and understandable content.
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
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.
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)
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.
right, yeah. I think his tutorials are at the perfect level of depth, so that would support your statement
Yeah, a good programmer would be like "this is slow" if he explained literally everything he was doing
ohhh, wait. sorry, I thought you meant TurboMakesGames
yeah, I actually prefer Turbo's stuff
But all these guys have the same problem in common
They demonstrate what ECS is GOOD at
true.
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
but of course, thats not where it makes sense to make a video, because it will likely change
It's where it would make sense to do a video RIGHT NOW
but yeah the practices will change
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.
I think ECS is easier by far to demonstrate than OOP
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
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.
The issue with Git is it's so much friction to push changes
βI just want to spawn a prefabβ is one line in mb. In dots you start with 5 questions interrogating that.
@violet cosmos I agree
@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
ECS is going to be lovely, once it's documented
I honestly like it more than MonoBehaviour for about half the tasks
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
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?
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
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
This channel is surprisingly dead TBH. I expected there to be a lot more people here.
@tardy spoke GitHub can show up in top search results, if there's a lot of links to it
@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
@tardy spoke I mean sharing the links in one place and even displaying them in line in one place makes sense, but
- 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.
- github makes it hard to push changes, as discussed
so yeah, we need a wiki with inline cross account gist display and inline youtube videos
Where would we find such a beast?
im off to google to investigate!
π
first discovery made: gist also stands for gastrointestinal tumor. this is gonna be harder than I thought...
i see you guys are preparing for the day ecs officially gets released and this channel turns into #π»βunity-talk/#π»βcode-beginner
"how do i make man move"
"read the damn wiki"
That's a great system.
hahahah
We need better docs and examples
what a wonderful day that will be
haha, truth
$5 says Unity hires all of us if we actually create comprehensive documentation for ECS.
I wish someone had docs to point me to, and I'd gladly RTFM
And makes us redo the rest of their documentation. We die documenting.
@violet cosmos agree. I'd love to RTFM.
our shared identity as a community - "would love to RTFM"
This project will be great though, because in the end it will likely save everyone a bunch of time.
Everyone learns faster, haha
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
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/
There was a Wiki for Unity snippets, but can't seen to find it. It was super useful too
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
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)
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
You can do that with any piece of source, if you just add the correct path
Yes, the trick, is contributions. We want smarter people than us to be able to easily contribute
right. need to have this publically editable.
I think a Wiki is the place to start man, with some templates
and a dark theme π
hahaha, yeah. A github wiki is probably the place to go
and some sort of OAuth
No, a GitHub wiki requires people to pull forks to make changes
A wiki wiki
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
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
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
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
hahahaha
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
https://github.com/PowerCowYYC/PowerCowYYC.github.io/wiki I just created one... is it editable?
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
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
its available on any public github wiki
He's right. I just deleted their navigation.
Cool, that's fine by me then. I guess I never noticed
Just kidding.
hahaha
Also, actually if you click my wiki you'll notice it's actually also on my github.io page
We should definitely put some contribution guidelines up
which is kinda cool. Can have a webpage aaaand a wiki, but that's kind of ... redundant I guess
I'm a big fan of copy/paste templates for that
@amber flicker did I understand correctly or is this just wtf
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
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.
Allocating as Persistant?
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
Does something else have a reference to it then?
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
how are you checking this leak? are you getting a unity warning?
Yeah, but also the other system was unable to read from it apparently
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
It's not. You're making a local field and not disposing of it.
I thought I was being efficient. Turns out I was being wrong. π€
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 π
It's beautiful
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
Yeeeeee
Add @InnerScript pls
Cool!
But, why did you name it .github.io?
Yeah that makes it a website, but the wiki doesn't go on the website
the wiki is a repo wiki, not web facing
because, if we care to, we can make use the repo to auto publish a blog
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
I think it makes more sense to name it clean
might be a good place to put uneditable content like contribution templates though @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
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.
They don't do that, it's a Unity focused project
gotcha
Could you imagine that shit show ?
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
nice. this wiki, then https://github.com/DOTS-Discord/Unity-DOTS-Discord/wiki
K, it works now that I stopped 360 wrong-scoping myself. Just a question though, is this fragile?
Will something in a SystemBase class field in ECS always run before another system's OnCreate?
class field initialization is same as constructor initialization isn't it
You're asking the wrong person.
Correct.
I googled it and that was my conclusion, but I'm afraid to say anything about OOP hahah
Compiler makes a constructor out of your class-level initialization.
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
yea they explicitly mentioned getsystem should be usable in oncreate
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 π€·ββοΈ
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 ?
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
@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 ? ^^
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
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 ? ^^
Could add a component called FinishedComponent depending what you're doing
Can you callback in pure ECS?
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?
I guess a mainthread callback is fine.
I'm also very averse to adding and removing components, since that changes archetypes.
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
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
Entity creation is always mainthread.
What is the purpose of the callback? whatever functionality it's doing may also be easily implemented in ECS. Or maybe not, hahah.
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.
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
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.
https://github.com/DOTS-Discord/Unity-DOTS-Discord/wiki/Recipes @violet cosmos @tight blade which one of you is working on this? I'll toss some "Recipes" up or something if someone lets me know how they want it organized?
Should we just have the Recipes page link off to examples of each concept?
i feel like callbacks are something you want to avoid in DOD
they're not cache friendly
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.
yeah i think it only makes sense for legacy systems interop
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
pretty much did this for MB event listeners for UI https://github.com/jeffvella/UnityEcsEvents/blob/master/UnityEcsEvents/Runtime/EventRouter.cs
I was about to drill into you about that goto diss.
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
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
You should never goto up. Other uses are great.
event entities are usually easiest but not the most performant because archetypes
xzvj's system looks like good solution
alternatively there's https://gitlab.com/tertle/com.bovinelabs.event (with thread for extra info https://forum.unity.com/threads/event-system.779711/) that also aims at handling ecs events in performant way
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
Can't follow the pattern of C# loops because for some strange reason you can't break 2 and continue 2
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
break 2 breaks the outer loop
break 3 β even higher level
You probably don't need more than 3.
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
Never heard of that, is that a js, python thing?
I think js or php has break levels.
Creating entities is faster than adding components.
Never seen it used in JS anywhere.
From when I last looked into event entities.
@tight blade no edit button? Hmmm maybe I have to accept your invite or something
I was waiting for NuGet so had a few minutes
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
so what is this? a collab for writing examples/how-tos?
How are you using Jekyll and the web side of things without the repo being named github.io
this so cray
the github pages thing and the github wiki thing are different things
every public github repo automatically has a wiki
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
well, the wiki is public, so anyone can go there
the files, are in the wiki
/zoolander
... how do I edit this wiki π€
On my own wiki I have this beautiful edit button.
Yeah, I don't have that button, hahah
I do on my wiki there ^
On yours I do not
whoops... hard refresh that page
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.
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
again, we'll figure it out.
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.
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
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
Surprising there's no internal linking feature, lol.
It's beautiful!
Just gotta figure out how to edit the sidebar to remove that page now
Oh, that'll prob need custom sidebar I'm guessing
βοΈ
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" π
Look at that beautiful footer. Stuff of legend.
Note you can use C# in the markdown and it comes up cleaner
I was just about to ask lol
Waaaay better.
I'll have to retrofit it fit your contribution template still, but that's no problem
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
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?"
Version in ECS is pretty critical at the moment
More so than it will be later on for sure. Pretty big changes.
can I add.
4. OR - you're a crazy enough person to make and release a game with preview technology
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.
Haha steal it and make a competing wiki
Make ECS documentation even more fragmented and terrible
https://github.com/DOTS-Discord/Unity-DOTS-Discord/wiki/Single-Source-of-Truth-and-Database-like-behaviour-in-ECS @tardy spoke should need to check but 99% sure native containers are slower than managed collections in managed code
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
1.0 end 2022-23 minimum
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
They made the big news to get established devs on to give them feedback. No need to advertise anymore.
Makes sense to me.
yeah, you just need enough of us crazies who will go "no documentation? eh we can look at the source"
this can be fun aswell as the absolute opposite of fun
going through physics collider code was not fun
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.
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
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?
@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?
something useful that's only a few lines
Not in DOTS ex dee.
@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
If you're trying to replace the old snippet wiki β sure. I was thinking that no task in our ECS takes a few lines.
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 ?
Yah, I get s cert warning and no CSS
I should scrape that site before it ends it's death throes and disappears
@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.
Or better yet β if you're not familiar with OOP.
I'm not even familiar with OOP personally but my threshold for pain is exceptionally high so it works out.
Knowing OOP makes it very hard to transition into DOD.
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
what if your hate for OOP is high and want to escape the OOP circle?
then ECS is for you!
queue salesman sfx
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 :/
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.
1min of open loading time?
laughs in 72 mins
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
I mean Unreal engine has like 4 hour compile times so... time isn't really the same in game development I guess haha
well every time I open it it's written "importing" for a long time :/
time doesn't exist
@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.
I don't think newbies to Unity should be diving into DOTS just yet
hahah it's a good thing for the doc!
The regular MonoBehaviour workflow makes great games, still does.
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
@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.
@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.
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
maybe that's a better idea :/ my main problem was that I could not decide wichc networking system I wanted!
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
The client side prediction was attractive, it's what brought me into DOTS haha
I'll take a look at SpatialOS I guess!
our neighborhood @stiff skiff works on that i think
@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.
true! I took the knowledge from https://docs.unity3d.com/Packages/com.unity.netcode@0.0/manual/getting-started.html
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 :/
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
I gotta say, it is frustrating, but sooo much satisfying to accomplish what you were trying to do!
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.
Woah, that is a super weird way to only run a System once.
Clever, but not really intuitive at all, haha.
hahah soo true! When I saw that I was like, is this the official way to do it! But still this is clever!
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.
@mossy ermine here's how I do something similar.
Much more explicit.
^ that's much better
Easier on the brain.
https://github.com/DOTS-Discord/Unity-DOTS-Discord/wiki/FAQ#im-new-to-unity-should-i-use-dots-or-ecs
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
@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 !
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
I got a question tho, can't you just use the EntityManager from the Systembase instead of creating a commandbuffer?
Official unity docs say that ECB playback is faster than doing EM actions 1 by 1.
thanks, I'll keep that link π
Also you can use burst with ECBs.
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 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
gush, I gotta learn how Burst works, this is not something I'm used to
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
you dont need to learn burst. It's basically free realestate performance now.
ok, nice good to know
In that code example I gave up there, you would just switch .run() to .withoutBurst().run() ;
well not to learn it but to make compatible code
avoid managed types in burst.
avoid reference types in burst.
I think those are the 2 rules for making your code burstable.
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.
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
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.
So is that something to avoid to even use the EntityManager from SystemBase? I should always queue command with a ECB?
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.
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.
@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?
I believe there's an article of which is faster: ECB vs EM's batch functions
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
ok that's something I'll try to keep in mind
Yeah, I would take the reduced headache of having to worry about system execution order even at some performance drop
Ah this one
WAIT I NEED TO WORK! AHAHAHA
Humm @tardy spoke in your sample, do you really need to schedule? Sorry for the probably obvious question but I'm wondering :/
lol, game torrahod and their stock images
@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
thanks @deft stump for the link
still relevant for the discussion.
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
I did try EM batch operations.
but lord knows how many nativecontainers I made just to make it work!
XD
@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)
isnt schedparallel on a chunk level not on the entity level?
Oh yeah, you're right.
My bad.
It would run on as many threads as you have chunks that fit those 100 entities.
Humm ok because what I did so far is always to just call the loop without any .Run or .Schedule or .ScheduleParallel
like this
Does that not yell at you?
@mossy ermine If it runs, I imagine it would run on .Run() but that's a great question.
well again, I learned from https://docs.unity3d.com/Packages/com.unity.netcode@0.0/manual/getting-started.html
Hmm, are you sure that's actually running Spimort?
Because if you don't have the PlayerComponent on something that System would just get skipped and not execute
Are you using an older version of the package? I get a syntax error in the unity console if there's no Run()
I should add in the wiki "How to visualize in dots for the visual learners"
you agree @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.
You're gonna have to pose for the thumbnail looking very shocked with the title "10000 BILLION ENTITIES????!? HOW CAN THIS RUN?"
Yeah is that a trend? Taking pictures of yourself looking like an idiot for YouTube thumbnails?
It works.
Seems ubiquitous
I see it everywhere
TurboMakesGames has mastered the art of the YouTube thumbnail
Oh I guess the .Run() or .Schedule() or .Parallel() is a Systembase thing but doesn't apply to ComponentSystem
*requirement
humm, as far as I know I am at the latest version :/
you also need to make funny faces too alex
ComponentSystem was replaced by SystemBase I think
ho yes, I am using the ComponentSystem and not systembase
ComponentSystem was repleaced by JobComponentSystem and then was replaced by SystemBase.
I think they're already marked for deprecation
Ho I see, so I should use only systembase!
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
well you got to use .run on systembase so π
I'm glad they made the foreach method chain. It was so cumbersome to write all the boilerplate for jobs before.
You can use Schedule and Parallel too, its just that you have to make it explicit which you're using
yes π
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
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.
any advantage in using AddComponentObject?
@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?
Wait, you can add a class that implements IComponentData, using AddComponentData?
Actually I think you cannot link to a gameobject directly from an Entity. It has to be a component on the gameobject
but burst won't works?
@toxic mural see the PlayerCamera?
of course it wont
@mossy ermine yep, no burst if you reference managed stuff
Herers how I do it, ignore the stuff about RAM, its a hacking sim so its the game game ram its talking about, lol
So your way might be better, depending on how you retrieve the managed reference, GetComponentObject is very picky about the type you pass it
Well cool I like that
passing a camera GO to an Entity that is instantiated by IConvertGameObject MonoBehaviour
Yeah, it's weird
I actually did it with text assets as well haha
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
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
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
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?
@toxic mural check this out.
@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 ^
I'm watching it right now, really interesting!
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.
Yeah me too. It just blows my mind because I thought reference types were forbidden
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
what is the typical ECS organization?
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
nice
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.
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.
Wow I wasted a lot of time by not knowing about this class IComponentData thing.
Thanks for that video
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
well I only came here tonight to ask about my loading time issue but obviously I learned way more π thanks!
@mossy ermine no problem! π I hope you got the ECS route. It's pretty cool stuff!
Thanks, you guys were really nice to answer my newbie questions!
btw, my main language is french so sorry for my weak english typing :/
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. π€·ββοΈ
^^^
hahah I'll try to stick with DOTS and not abandon my project because of it! π
https://en.wikipedia.org/wiki/DunningβKruger_effect#:~:text=In the field of psychology,recognize their lack of ability. <-- you pass this hump when you get smart enough, hahah.
@mossy ermine awesome!
Wow there's a whole section on managed ICD in the manual that i guess I just never read
brb, seppuku
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.
2 seems kinda redundant, if you're writing to components why not read from them directly
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
as a wise man once said in this channel
haha is that hidden data?
i dunno what it is you're doing but generic question seemed like generic answer would fit
could you give more concrete example
Has anyone used MemoryBinaryWriter ? Does Unity provide a way to get a byte[] from the byte* it provides?
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?
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);
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
guess so, dunno if it'll do as intended tho when looking at it again
but not sure what else you'd use
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
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
Yeah a length is provided
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
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?
use a nativequeue?
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();
much like here: https://github.com/WAYNGROUP/MGM-Ability/blob/master/Runtime/Systems/AbilityEffectTriggerSystems.cs#L87-L117
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
is that esseentially doing the operations ins eries avoiding race conditions?
I think so. Somewhere you need to go sequential.
yeah its looking that way
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
heh, looks like you're doing what i'm currently starting to do
well, targetting, firing projectiles, destroying units etc
not that its a novel idea lol
haha yeah I know
havent looked into chunks yet though, guessing they are more efficient somehow
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)
and the efficiency comes about because things are laid out in RAM in defined blocks which makes indexing fast?
cool, ill look into that
Memory layout is one of the reasons Unity's ECS is so fast, yes.
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 ?
@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
@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 ?
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
it also uses native multithreading instead of C#'s multithreading
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 ?
I believe thats normal for ecs
yeah its normal
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. π
@tight blade @violet cosmos https://github.com/DOTS-Discord/Unity-DOTS-Discord/wiki/External-Information-Sources <-- I notice markdown tables leave a lot to be desired. Any ideas easier/prettier way to format tables of resources?
my thought is that theres a way to auto publish the wiki to pages, I just havent figured it out yet
https://github.com/insthync/awesome-unity3d - just following this example
then we'll have the power of jekyll themes
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
@tight blade if you move the Wiki to pages, then there's two sources. It's less than ideal
@violet cosmos c'mon man, thats not what I said π
Prettier, better ranking, more street cred
lol we'll be lucky if an unknown github repo comes up once. Or our unknown webpage.
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
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.
well, only if they want to change the structure which is probably a low use case