#archived-dots
1 messages ยท Page 163 of 1
You copy vertices in and out of native containers
With a lovely bunch of allocation when you copy back to managed
You can also use mesh data array: https://docs.unity3d.com/2020.1/Documentation/ScriptReference/Mesh.MeshDataArray.html
Hooo I'll have a look at this, didn't know that existed
hooo this seems rly nice
tho it can't work with CombineInstance sadly soo
niiiice
I wanted to cache my resulting meshes, but I'm not sure how they get combined and if there's no offset to the transform matrixes I'm providing for each mesh to combine
like if the 0 0 is the 0 0 of the first mesh or if everything is on world space
which would omega suck
so testing that now
huuuh test isn't really conclusive
I can't seem to get the combined mesh to display ?
(testing on gameobjects)
So, I'm curious how to do something that is a process with Jobs/ECS
Let's say the process always runs in the order A, B, C, D
How do I move data from A > B or A > D?
Is that in Execute? ex: Execute([ReadOnly] ref A aResult) with an [UpdateAfter(typeof(A))] in the system class def?
Also, if the resulting data in A is an array that potentially changes size each frame... how do I handle that? Just allocate a new NativeArray?
Are you talking of jobs or systems
If you want to pass data between jobs put your dependencies correctly and pass around your native containers
@violet cosmos you use NativeContainers (NativeArray, NativeHashMap, Native....) to pass data from one job to another, like the following:
var resultsFromA = new NativeList<int>(Allocator.TempJob);
var jobA = new JobA() { Results = resultsFromA }.Schedule();
new JobB() { Input = resultsFromA }.Schedule(jobA);
Or use Unfase if you like to live dangerouslu 
In this case, I'm going to be running mostly on things that exist not as Entities, but GameObjects/Colliders/etc in the Scene... But, there's a blurry line between ECS and Jobs I haven't quite isolated yet
You can't use managed types in jobs
You can check references between each other using Dunstan's article, but that's it
@zinc plinth actually you can, with GCHandle, but GameObject/Collider and many other UnityEngine.Object stuff can't be used outside MainThread
you can't use managedtypes at all with Burst
So, if I wanted A to run collision detection, every object that it could potentially collide with would need to be migrated into Entity?
Well, not collision detection per se... But things like CapsuleCast, SphereCast, etc
So, if I wanted A to run collision detection, every object that it could potentially collide with would need to be migrated into Entity?
@violet cosmos unless you create a custom collision detection and used the colliders data to create your own custom jobfied colliders
which I would not recommend to do unless you have expertise on that
you can take a look into RaycastCommand, which is a jobfied way to do Raycast with standard unity physics
you can create CapsuleCast/SphereCast/etc based on that
Then that's into pure Jobs, and then... How do I run Jobs in that A, B, C, D scenario where B uses data from A?
@violet cosmos you use NativeContainers (NativeArray, NativeHashMap, Native....) to pass data from one job to another, like the following:
var resultsFromA = new NativeList<int>(Allocator.TempJob); var jobA = new JobA() { Results = resultsFromA }.Schedule(); new JobB() { Input = resultsFromA }.Schedule(jobA);
struct JobA : IJob
{
[WriteOnly]
public NativeList<int> Results;
public void Execute()
{
for (int i = 0; i < 100; i++)
{
Results.Add(i);
}
}
}
struct JobB : IJob
{
[ReadOnly]
public NativeList<int> Input;
public void Execute()
{
for (int i = 0; i < 100; i++)
{
Debug.Log(Results[i]);
}
}
}
What's the best way to check when a Job completed? Polling for IsCompleted seems dumb. IsCompleted isn't async. Forcing Complete seems a bit... blunt
polling for IsCompleted is the correct way
O_o
or just call Complete when you require it at a certain point
You'd think they would have added CompleteAsync so code could be organized ๐
currently, jobs doesn't seem designed to be running across many frames
think the manual check is alright since you usually operate on a system execution per frame basis, but if one used jobs only, i can see that it can make sense
they surely need to add support for that (like Addressables does) if this use case is intended
No, and for this particular chain of inquiry, I'll likely just force Complete and try to aggregate as many things as I can before
So, that brings up another question... I formed a big job that using a system that effects multiple GameObject/Behaviors, then forced it to complete... Now, what's the usual best practice to migrate that data back into the GO's?
apply it in a synchronous context I'd say, not sure if there are better practices
But, when? Update/FixedUpdate/etc are running on their own independent timeline and I can't just block that
if you work in other thread related ways, you could make a queue to store actions that need to be applied then,,
I think it depends on when you need it
I would set it up so it either happens in update /lateupdate or another event method... maybe? I'm not sure about systems, I think there it depends to which system group they are part of?
but could certainly be done in an OnUpdate too I'd think
Hmm, that's where the decision gets blurry for me on Jobs/ECS. Do I migrate lots of other things into ECS so I'm running a parallel physics world so then it can just be magically applied, or do I try to solve a bunch of issues around "when" and "who" for applying results of pure Jobs ๐ค
doesn't physx support parallel worlds in recent versions too?
maybe im wrong, let me check
I can't count on PhysX
ah okay
The reason I'm going down this path is to eek as much performance as I can out of the Quest for a system that is likely to easily grow in size and complexity, and computation time
I'm still new at DOTS, and trying to wrap my head around it for new and existing systems
hmmhh, but physx is already multithreaded? not sure if the unity physics are already faster, maybe they are if everything is properly set up with data in the ecs world
I think I'm OK migrating many things into Entities using MonoBehaviours that are converters
But, I wouldn't mind making things isolated systems either that just work on existing GameObject workflow
@violet cosmos welcome to the fun world of DOTS and Oculus Quest. If you get ECS running on the quest at all with 2020.1 and Entities 0.13, let me know, haha. I can get 0.11 to run, but not 0.13
With the XR toolkit?
Hmmm, that's a huge red flag. I just converted to to XR Plugins, but I'm not using the Integration Toolkit, I have my own API
There's still one thing I'm very confused about, is that demarcation line between ECS and ECS based Jobs and the traditional scene... and how to control that. Does ECS run it's system before any MonoBehavior Update?
Flat pure Jobs I can wrap my head around how to organize
Pure 100% ECS too
It's mixing ECS and ECS Systems with the Scene that I'm still seeking clarity
Lol, someone needs to draw a chart. That question comes up all the time. Someone must know the order of execution?
you can always check in the system window
just ensure to tick the Show Full Player Loop
@rancid geode sure, but I'm in the planning phase now, how to organize. There's nothing for me to check
basically it is :
MB.Update()
SimulationSystemGroup
MB.LateUpdate()
PresentationSystemGroup
@rancid geode sure, but I'm in the planning phase now, how to organize. There's nothing for me to check
@violet cosmos this screenshot is from a pratically empty project, having more scripts doesn't change the player loop order
unless some of your script is modifying the player loop itself
if you don't have DOTS Editor installed you can use the one in the EntityDebugger
if you have the DOTS Editor, it is in Window -> DOTS -> System
Lovely... New 2020.1 project, enabled preview packages... Hybrid Renderer is not in the list of available packages in the Unity Registry
just click +, add from url and type "com.unity.rendering.hybrid"
Learning this is like some weird priest cult. What's next, I have to open the command line and type in a bunch of undocumented commands? haha
they changed the entities-related visibility due its experimental state
@violet cosmos have a read of this https://forum.unity.com/threads/visibility-changes-for-preview-packages-in-2020-1.910880/
@quasi trellis Well, that explains it.... And also, kind of annoying
It's also not a Git URL ๐
How do we construct systems and components in a flexible and clean way... lets say we wanna spawn popups once we click on a entity... we could either decide between the hard coded approach : "ClickOnEntitySystem sending click event, OnClickSpawnPopUp as Component which returns the PopUp being spawned, OnClickSpawnPopUpSystem iterates over click events to spawn popups using OnClickSpawnPopUp" or would you choose the flexible approach : "ClickOnEntitySystem sending click event, OnClick as Component which simply contains a callback/action with code, OnClickSystem which iterates over the events and OnClick components in order to execute the callbacks"... The first approach is only spawning popups while the second approach is pretty flexible and can get extended by callbacks pretty simple... for example we can just hook up new actions and print stuff while a entity was clicked ๐ what would you choose and why ?
what you mean by popups?
popups... uhm... just replace popups with "UI"/"UI-Elements"/"UI-Notifications"... everything that pop-ups ^^
Isn't the accepted pattern to have MouseButton component on all archetypes that need to react to input and set every MouseButton component in a PlayerInput system?
Damn.. i should have said that this is a "server side" example... a general ECS question and not special for unity ^^
https://gametorrahod.com/game-object-conversion-and-subscene/ - This is a book of a tutorial, but it's really helping me a lot
I think I'm going to have to read that over a few times though
Yeah, it's a bit tricky as some of that stuff is a bit older now, but still a good resource
Example: "Companion GameObject"
the principles are the same, syntax or class names may be a bit different
@tardy spoke Could you tell me more about the Quest / ECS issue you're having? Are just entities alone that are not processing, or XR tracking? Or XR Interaction Toolkit?
Also, do you see it work correctly in say, Link mode?
XR kit all works fine, just ECS doesn't seem to "run" at all (on Entities 0.13. Downgrading to Entities 0.11 it works fine). No errors that I saw. Haven't tried linked mode.
It could be something to do with the XR kit stuff, but I couldn't tell you for sure. The XR kit stuff seems functional and doesn't have any errors.
Hmm, is there an issue tracked for this?
Right now I'm mostly on Link mode, in editor with some rare spot checks on Quest via APK to make sure I'm not doing something dumb
Interesting, I have never actually used the Link mode, haha. You're on PC?
I'm on a Mac, I'm not sure it can use the link mode though I haven't downloaded the Oculus desktop app and tried
Yah, I'm on PC. Have the official Link cable (with a short 2m extension run of high quality TB3 compatible USB)
I think the issue is tracked, I found someone else that reported the same issue and that's how I learned downgrading to 0.11 was the solution.
Hm, I think that really depends on the video card on your Mac, and should definitely in Boot Camp https://support.oculus.com/444256562873335/
Do you have other VR headsets that actually work on Mac?
I haven't bothered, because as soon as you start developing for quest the first thing you do is build a controller that works on both quest and your desktop and do most your dev on desktop because it's such a pain putting the headset on/off all the time no matter how fast the build is, hahaha
I'm not sure, my experience is limited just to the Quest, and I'm a fairly new game dev.
I really think if you're getting into VR, it helps to be on Windows. What CPU/GPU do you have in the Mac?
Nothing amazing, I'm sure
got stuff working ```
RenderMesh[] CombineRenderMeshes(RenderMesh[] renderMeshes, NativeArray<LocalToWorld> localToWorlds, LocalToWorld rootLTW)
{
List<RenderMesh> results = new List<RenderMesh>();
Dictionary<string, List<CombineInstance>> combines = new Dictionary<string, List<CombineInstance>>();
Dictionary<string, Material> namedMaterials = new Dictionary<string, Material>();
for (int i = 0; i < renderMeshes.Length; i++)
{
var renderMesh = renderMeshes[i];
var LTW = localToWorlds[i];
var material = renderMesh.material;
if (material != null && !combines.ContainsKey(material.name))
{
combines.Add(material.name, new List<CombineInstance>());
namedMaterials.Add(material.name, material);
}
CombineInstance ci = new CombineInstance
{
mesh = renderMesh.mesh,
transform = rootLTW.Value * LTW.Value
};
combines[material.name].Add(ci);
}
foreach (var namedMaterial in namedMaterials)
{
RenderMesh result = new RenderMesh();
result.material = namedMaterial.Value;
result.mesh = new Mesh();
result.mesh.CombineMeshes(combines[namedMaterial.Key].ToArray(), true, true);
results.Add(result);
}
return results.ToArray();
}```
combines meshes based on their materials (since you can't combine meshes with diferent materials) and outputs the unique RenderMeshes
Awesome! ๐
So, many of the ECS examples deal with Entities and Components that are generally homogeneous... Something like a bullet hell shooter
What is the general strategy for non-homogeneous entities? Lets say I'm not making a bullet hell, but I want to leverage ECS to help organize multi threaded Jobs by component easier. Do I pay a penalty, or is it just a "penalty by contrast"?
"I want to leverage ECS to help organize multi threaded Jobs by component easier. " what do you mean?
I can make Jobs without ECS, just need to manage them and organize the data layout myself
So in "pure Jobs" if I have 30 things, I need to collect the data from all 30, pack that into NativeArrays, schedule the Job and go. With ECS I just write Systems (organized Jobs) that work on component sets, which seems to be better for the particular game system I'm working on, but... Like I said, Entities won't have a very homogeneous structure, so I'm curious how to avoid any pitfalls there
do you mean just if theres penalties of having lots of entities that dont have the same components? like a handful of ab and c, some with c, others with xyz and so on?
Yah, the "archetypes" and clustering penalties
I don't plan on add/removing components (I understand the penalties there clearly), but don't understand the ramifications of having a variety of archetypes that are shallow
i dont think it should be a problem unless you are doing some codegen thing that creates a vast multitude of different combinations
What's a "vast multitude"? thousands? tens of thousands?
im trying to find a forum thread where someone was doing this and ran into memory problems
29k
hahaha I love this comment: "Regardless, I would strongly encourage you to look at how you end up with 29000 archetypes. I'm in no position to judge whether that is a reasonable number for your game, but with that number of archetypes I'd personally be suspicious"
seems like a soft limit as previously he made over 6 million archetypes but i truly dont think this is a common need ๐
Yah, I don't think I'll hit that high. Maybe a few hundred, but I'm more concerned about allocation... Maybe I shouldn't be, since these are briefly lived (only a few seconds) there's likely to be chunk holes to be filled up and it's not allocating anything
lots of archetypes mean higher minimum chunk amount
so 29K archetypes = 29K minimum chunks
a) that starts to be alot of memory
b) the hashtable that handles archetypes won't be as fast at all as with fewer archetypes
and how in the world are you getting 29K archetypes anyway
Hmm, you should be able to access a regular monobehaviour like this and change a variable no?
I'm trying to add a vector3 that moves around to decide when to load/unload Subscenes based on distance. It resides as a monobehaviour variable on the Subscene GO itself.
Additionally I want this vector3 to move around opposite to the player's movement, but I can't seem to change it's value via ECS code, even though I believe it should be able to? Unless subscenes are special compared to regular GO's, they are in a different namespace so not sure.
do you get some kind of errors ?
Nope, nothing
@zinc plinth creating an ICD as a class on another GO to reference it seems to work. No idea why. Doesn't work when on subscene though.
So that'll work for now, but odd.
Do anyone here have experience with ECS? Is it stable enough for production?
yes. no.
Depends on the phase of the moon, pretty much.
If by ready for production you mean that Entities 0.13 doesn't even seem to work on VR builds, then yes, it's ready.
Define "enough".
oh my god mother f****ckers I finally did it. behold my triumph
all three are given the same initial linear velocity: -2 z
the one that is in line floats farther than the one moving broadside laterally. the one with its nose out of the water drifts the farthest. the one that is flat is turning towards the other boat because its drafting off its movement
Lol I'm so bad at capturing video. No one is able to see that video are they?
You can see the second half if you manually click at 13s.
Hahaha perfect.
Hello! Quick beginner and maybe stupid question, but can you schedule job (IJobParallelFor) inside an Entities.ForEach loop, which is also scheduled? It sounds like something you shouldn't do, but I am curious
nope
Damn
So, if for example I have a system that cast a ray along the forward of an entity, and if this ray collide I turn the entity 1 degree, I have to make the raycast test in the forEach, with the rest of the code that turn the entity ?
You can make multiple jobs that run sequentially in one system and pass data in native containers or components between them.
Humm I see, but since I need the entity's forward for the raycast, and it's rotation for the, well, rotation, I could do something like 2 consecutives entities.ForEach, and having the second one depends on the first ?
What are you trying to do with the nested .foreach anyways?
To be honest, I am not sure. I feel like having "too much different stuff" happening in one .foreach is not the optimal way to do things, like having the raycast test with the physic and such + any movement depending on the result of said raycast in just one .foreach
@tight blade that's awesome. What project is it for? Haha
yeah nevermind its still broken haha, the draft way overcorrects when it gets a sudden impulse thrown at the boat
Yeah, if you want to split up the check/action, you could use 2 jobs. Although if you're not using the result of the check in any other place you'd need to think if the split offers you any performance gain(probably not).
lol, it'll be a game one day. sailing game, is the idea
turns out drag is really hard.
who knew.
Make sense! Thank you @dark cypress for taking the time!
Is there any way for me to use MeshData.SetVertexBufferParams() if I don't know the number of vertices the job will generate? Or is the size parameter "capacity" instead of a hard size?
Hm, so IJobForeach is going away? It seemed like a nice way to mark up classes
So... How do I make ordering dependencies with just Entities.ForEach() between different systems to have a precise order of operations?
The same way. Use the UpdateBefore/UpdateAfter for the systems, and pass the handles around in Schedule().
So... I have to pass job handle references around each system?
How were you doing it before?
I thought things implementing SystemBase were automatically loaded and executed
I wasn't, I'm writing something new
They are. All jobs Scheduled() in an OnUpdate() of a system automagically depend on eachother.
You pass the handles if you want finer control.
How do I pass the handles from one automagically run SystemBase class to another automagically run SystemBase class?
What are you trying to achieve? System1.Job1>S2.J1>S1.J2>S2.J2?
No, in ECS you're recommended to write a number of Systems, correct? Each doing something discreet. So I want to have say, three systems. PositionSystem, TargetSystem, MechanicsSystem. They need to run in that specific order
That's simple. Use the atrributes.
OK, so there's still that tag. whew.
I mentioned it a few posts back. Think you missed it.
I think I did, apologies I'm still trying to wrap my head around this and ever changing examples and recent deprecations
Haha, no issues. Doing the same thing myself.
Hm... is there something that replaces [ReadOnly] in the .ForEach parameters?
Unity 2020.1 with ECS 0.13
in
๐
https://youtu.be/V0_WaCKIOJU @tight blade @amber flicker @minor sluice I finally got it working, haha. Continuous Floating Origin player that loads subscenes by proximity.
Seems promising. I couldn't get the version where it moves the world in one move when a new subscene is loaded because I wasn't sure how to access any sort of callback after the subscene was done it's async loading, which would be required to then move the scene into the correct world position.
Woah - that's pretty nice
Haha, I'll keep you posted on how it works out. I'm so tired of working on floating origin stuff at this point... working on the actual game at some point would be a nice change of pace, hahaha
I know that feel - I'm still working on the kinks of my 2d physics engine - I haven't really gotten to my game mechanics extensively lol
I did start playing around with subscenes again - hoping it'd work with some sprites I have
Haha, when it's the foundation of your game if you don't get it right the rest of the work may become pointless, that's the problem, hahah
Subscenes are a bit rough to work with. They have no component on them that actually includes the correct bounds of the objects they contain, which to me is insane, because then that boundary could be used for loading them by proximity, which is one of the main reasons people use subscenes.
Secondly, I couldn't reference a monobehaviour's variable directly on a subscene from a System (withoutburst().Run()), but had to use an ICD on another non-entity to hold a reference to that monobehaviour's variable in order to change it. This could be me not understanding something simple, but it definitely seems odd. Just moving a script off the subscene to a GO works. Even moving the ICD component onto the subscene doesn't work, it has to be on a non-entity GO for the reference to work correctly, haha. It doesn't spit out any errors or anything either.
I think for my case - I'll likely be using them to load some static entities and to declare some prefabs
They seem good at that, at least, haha
If you're doing 2D Codemonkey has a tutorial on subscenes where he demonstrates them in 2D.
Despite ECS's rough edges I still already waaaay prefer it to OOP approaches.
Agree/disagree?
can't deny. with the state of Unity's ECS right now, it's better to just do it in Classic Unity if you want something up and running asap
Isn't that the opposite of what alex said.
We are now enemies
๐ก๏ธ
This is promising...
3500 objects instantiated in subscene all with mesh colliders, and moving (the player is always at 0,0,0 world moves around).
https://www.youtube.com/watch?v=RE9MxzcKMfY&feature=youtu.be
@coarse turtle
That's the whole Synty pirates pack demo scene from the asset store, it instantiates it crazy fast. Noice.
Does DisableRendering component will disable render for all LinkedEntityGroup?
I don't know. I would guess/expect it to only disable for the entities it's added to. If you find out differently though please report back.
i have hybrid render 0.5 version with ENABLE_HYBRID_RENDERER_V2 when i add component to Parent Entity of LinkedEntityGroup and its working only for parent
๐ that's what I'd expect - I sometimes want an 'AddComponentDataToHierarchy' method but I can kinda understand why it doesn't exist
i saw somewhere that DisableRendering will enable on whole LinkedEntityGroup
it would be expensive to walk up the hierarchy for every entity.. I don't think it's likely... there might be some utility method that automatically adds the tag to all of the children though
ECS question ( not unity in general )... I wanna recreate the "Buffer-Systems" from unity to execute some stuff at the start/end of a frame... i can either do this by : "OnStartComponent{action}, OnStartSystem iterating over them to call the actions" or by "OnStartSystem.buffer(action)"... so either by using a component or by direct acess... what would you choose ?
nicely done, @tardy spoke !!
anyone know a good way to do a ground check with unity physics?
@stone osprey can you give some more detail on the direct access option?
actually on both, Im having trouble understanding what you mean by those alternatives
@tardy spoke good job! so basically you load/unload subscenes based on the current position of the character?
I think for the ground check you could do it like with regular physics,
often times that might be a raycast of a bunch of raycasts (I think some people also do something like a sphere cast)
here is a tutorial with raycast example
https://www.youtube.com/watch?v=B3SFWm9gkL8
โ
Let's check out how to use Unity DOTS Physics!
Super Performant Collisions, Events, Triggers and Raycasts!
Get the Project files and Utilities at https://unitycodemonkey.com/video.php?v=B3SFWm9gkL8
Getting Started with Unity DOTS / ECS
https://www.youtube.com/playlist?list=...
I think basically, you could just think of the approach you would take with a non-ecs character controller and then simply translate that
Hello, does anyone know why disposing of a nativecontainer OnApplicationQuit() causes an exception - the container has already been disposed? I'm checking if the container isCreated before disposing, yet the exception still occurs.
why would you want to dispose on animation quit ?
everything is going to be freed up anyway by the OS
cause i get a crapload of errors while in the editor whenever i end play.
yeah, the errors in the editor problem are really a bummer
gon fill up my hard drive before long
and it prevents me from using flythrough in my scene navigation
this is from a system that's not getting destroyed properly
edit: #archived-resources
are you suggesting there's something that I can do from my end to fix that?
I know that I had this error when I destroyed a system, so I just disabled it instead
hmm. I definitely am not intentionally instantiating or destroying systems in my code. I wasn't even aware thats something I could do
usually using using {} is useful... unless under unfortunate "pass container by ref to static method" circumstances where upon it becomes use-less
I did have issues when I briefly tried using static native containers - now I just avoid them
They're not ideal due to the whole domain reload issue anyway
@half jay from my experience DisableRendering doesn't affect the entire linked entity group
@minor sluice yep, it loads and unloads subscenes based on proximity to character. It's a bit trickier than it sounds though because you have to create an alternate system for the detection and have it hold a reference to the subscene. There might be a smarter way to do it, but I couldn't figure it out, haha.
Subscenes also seem to not quite act like regular entities or regular GO's in some odd respects.
https://forum.unity.com/threads/any-updates-on-the-development-of-subscenes.947544/#post-6179985 - sub scene asset deduplication coming soon.. nice
What does that mean exactly? haha
at the moment if you have a tree and put one in each of 1000 subscene tiles, the project will have the size of 1000 trees
ah
I didn't intend for that to be a Stereophonics reference
darn motion blur being so expensive on hdrp.. it's pretty
I havent ever touched HRDP yet. Ive been using my one vertex color shader with no lights for tests for months now. I've forgotten what good graphics look like at this point.
I wanted to make my own little render pipeline but it looked pretty intense haha
๐คฃ don't worry.. no good graphics over here, it just makes primitives look more interesting
Hah that does look cool.
motion blur ~1.5ms for 30k dynamic meshes.. it's not terrible.. I'm just looking at 20+ unused threads for a large part of hybrid renderer v2 + hdrp ๐ฌ (edit: seems srp batcher related.. dunno)
futurenowplz
I really need to learn how to use the profiler better. Been putting it off... seems super handy though, haha.
Sometimes I look at it to feel smart.
do it.. super handy. In case it's useful @CiroContns did a good intro recently https://t.co/y1corSxu96?amp=1
Awesome! Was just googling for some good tutorials, haha
ProfileMarkers is one of the reasons I moved to 2020.1 from 2019.4LTS
To me, if you're using the DOTS tech stack, but don't have a grip on Profiling.... You're kind of shooting around in the dark
Since i've only been programming for a few months... I live in the dark. Like batman.
Best way to learn is to walk into walls and shit. Makes you want to turn lights on, hahah.
Hello, how can i create a world and assign my systems to that?
@radiant sentinel an extra world besides the default world?
Yes> @radiant sentinel an extra world besides the default world?
@tardy spoke
I want other worlds to calculate data of my players and more as systems but i cant find how to create new world at google.
@tardy spoke
I want create matchmaking system to handle online game matches
var otherWorld = new World("Other World");
Yes i have created but when i using GetOrCreateSystem
Icant see my system at entity debugger.@coarse turtle
Ah im not sure about the entity debugger - tbh I haven't really been using that lately
I can find world at entity debuger, but its empty and not any system exist
Hmm yeah sorry, I'm not sure about having it show up in the EntityManager/Systems window
I thought I read that that wasn't implemented yet but I'm not sure
I thought I read that that wasn't implemented yet but I'm not sure
@tardy spoke
Thats mean i cant create new worlds?
Sry my English is not good
@radiant sentinel I'm not sure if this is correct. I believe you can create new worlds, but you can't see their entities listed in the entity debugger yet. I could be wrong.
Ok no problem, thank you for answer
@tardy spoke @coarse turtle
I will test systems without checking entity debugger window.
No problem! ๐
you might want to select the Show Inactive Systems option in the entity debugger as your system probably never ran
Hello! Im pretty new at coding C# jobs, and im having some issues when destroying objects that are on a native list. How can I destroy an object and re arrange the list?
Well, NativeList<T> can't store managed objects (only structs with blittable data)
I mean, it is a float3 array, it stores positions of my instantiated objects, but when I destroy one of them I get memory leak error
Just to clarify, what do you mean by destroy one of them? Like remove one of the float3 from the NativeList?
yeah, I made and object spawner, those objects are explosive objects, and once their hp reach 0, they explode and destroy themselves. That makes a hole in the array, because there will not be an object anymore
Should I show code of the spawner?
Im not even sure if im implementing jobs well here
Well typically you can remove an element from a NativeList<float3> by using the RemoveAt or RemoveAtSwapBack function calls
true, but bomb class and spawner class are different
I'm a bit confused because I believe NativeList has to be value types (blittable or whatnot), not reference types? Is there some sort of reference to the hitpoints or is another system writing the new values to the NativeList?
here is my code https://hatebin.com/adnfcqpqqz
I think im doing pretty much nothing of jobs there, there are many things that Im not understanding about jibs
jobs*
Where are you trying to destroy the element in the code?
in another code, in the bom script
it destroys itself once hitpoints reach 0
https://hatebin.com/gorzzgwcgh explosion script
hmm okay, so I'm thinking the first piece of code, the List<prefab> contains the GameObject containing the Explosion MonoBehaviour
so an idea, is to possibly assign an index to each Explosion GameObject that corresponds with the index in your NativeList<float3>
when the Detonate function is called, you can collect all of your indices of elements you need to remove and remove them from the NativeList<float3>
when you do that - you probably want to update all of the remaining Explosion GameObjects with updated indices as you're now manipulating the size of the list and indices that are removed in the middle of the list needed to be shifted up to be remapped
so if you had 6 potential explosions and the 3rd index detonates:
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ]
[ 0 ] [ 1 ] [ 2 ] [ x ] [ 4 ] { 5 ] <- shift 4 and 5 down to 3 , 4 and update your indices
hmm okay, so I'm thinking the first piece of code, the List<prefab> contains the GameObject containing the
ExplosionMonoBehaviour
yeah
Ohh I got you
I will try that
Ty bud
well, I didnt work
Im gettin error at the same line
Well keep in mind that on line 75/76 of the first script, you're already disposing your NativeArray<float3> so by the time the next frame occurs, the data no longer exists and you're spawning new gameobjects and allocating new NativeArray<float3>s
Well keep in mind that on line 75/76 of the first script, you're already disposing your
NativeArray<float3>so by the time the next frame occurs, the data no longer exists and you're spawning new gameobjects and allocating newNativeArray<float3>s
well, thats true, however the error is happening at the instances array
what's the error exactly?
it is not finding the object once it has exploded, including != null in the list isnt working
You might want to explicitly assign null to the index for cleanup, I don't think Destroy will handle assigned references
this is what I have done
it os active> you might want to select the Show Inactive Systems option in the entity debugger as your system probably never ran
@quasi trellis
Oops sry for image
I should add world to any update system?
Its my code
I'm trying to figure out where the best point would be in the player loop to copy entities from one world to the default world, AND have the systems in the default world have access to them this loop. Is it better to do this in a MonoBehaviour or create a system to handle it? Is there something along the lines of a command buffer that can be used?
are there any details about blob assets ?
@gilded glacier https://www.youtube.com/watch?v=7_rZhp6V8ds
yeah ... maybe a bit more detailed ...
or more precisely, whether it's worth using it, or rather access the data different way
like storing non-blittable objects (prefabs, materials, ...) in an array accessed from systems
using index stored in an entity component
Blob assets are immutable so they can't store non-blittable objects afaik. So you'd have to do it another way?
https://docs.unity3d.com/Packages/com.unity.entities@0.13/api/Unity.Entities.BlobBuilder.html?q=blob a bit more info in the manual if you haven't come across it yet
somehow I managed to store material reference in it
maybe I've done something forbidden ...
Try changing it, should get an error
well, if blobs can only be used with blittable data, then how should I store and refer the non-blittable data, such as materials ?
What's the type of the reference you have it holding or whatnot?
@radiant sentinel entitydebugger only shows worlds that are scheduled to update by the player loop
if you add it using ScriptBehaviourUpdateOrder.UpdatePlayerLoop(world); it should work
@tardy spoke I don't understand ... I have a BlobAssetReference with a type of struct that contains reference to material in the diamond
refer the non-blittable data
In jobs you don't do that. Jobs are blittable-only.
I store my references in global statics.
And refer to them on the main thread.
Sorry, I meant parallel or burst jobs are blittable-only.
You can have normal code on a main thread job.
@dark cypress that's what makes most sense to me, but I am very uncertain since there are not many information on this topic
I'm not really sure if there is a "good" way to do it yet, I see a lot of people holding references to materials on GO's, etc.
GOs are just statics with extra steps, no?
At some point you need a global reference.
I use a singleton
well, it actually is a singleton only because I store bundles in it
@dark cypress I'm not saying it's a better approach, probably worse, just saying that's the way I see a lot of people handle it
and I eventually want to unload it, so I have to keep the reference somewhere
I use GO only for the bootstrap script
and for some scene input data, which can be assigned via the script in inspector
@gilded glacier you should be able to access the materials in your singleton if the job isn't parallel like @dark cypress said? Would that be suitable for what you're doing?
I suppose
Are you looking for a solution that runs multi threaded?
I expect that systems that use non-blittable data, such as the renderer, would have to be run on the main thread
This is an interesting way to hold a reference to an object inside an entity, but it still requires you to run on main thread because it's a reference
make your ICD a class instead of a struct
@low oasis if it's just specific entities (as opposed to copying entire world) you could prob use one of the ECB's from the default world
this also means your custom world has to update before the ECB that you're using
e.g. you could use beginsimulationecb and have your custom world run before Update, for example earlyupdate or preupdate
That's my hacky way to do a lot of stuff. Probably pretty slow, but easy for prototyping, haha.
looks like the entire programming profession can be renamed to duct tape programming
no clean solution for any problem
No clean solution yet, but there likely will be in time. DOTS technically isn't even "released" yet, haha.
They made it invisible in the package manager even on 2020.1
@dark cypress I try, but I look like a lunatic
I'm actually not sure what the plans are for dealing with reference types in ECS... I think they may just be observing the ways people are currently doing it and figuring out how they'll handle it, haha.
Could be worth looking at any demo scenes they have and seeing how they do it.
or they'll break them into the elemental data and compose it into components
isn't unity supposed to be run using dots internally ?
nah, it uses job system internally
Maybe eventually they will though. I think a lot of the DOTS stuff is built on layers of DOTS
i mean all these packages are the engine
the whole burst+entities+collections+physics+buildplatforms etc etc are the new internal guts, its just now visible for us to see whats going on.
Anyone doing a lot of tests for their ECS code? Wanted to try that out soon
Is the ECS test suite rough around the edges or solid?
my tests are: play mode & copious amounts of debug.log ๐
Lol, yep, same. Trying to get something in place before scaling to too many systems and stuff.
only using a couple since not a big fan of unit testing in general but the test framework seems pretty solid imo
but unity just uses NUnit internally which is also used for a lot of regular C# projects so makes sense that it's solid
it's not something unity built so higher chance of being good
I imagine testing in general becomes a diminishing return, due to coupling of tests and code
Eventually you spend more time fixing tests if you have full coverage than hunting bugs down and squashing them without the assistance of tests, haha.
Anyone doing a lot of tests for their ECS code? Wanted to try that out soon
@tardy spoke I pretty much write a lot of editor tests to "unit" test systems
Haha @hollow sorrel cool, I'll look into it. Good to know the tech it's built on.
@coarse turtle what's that look like in practice?
hmm I think it's pretty simple
you pretty much set up entities to test out a scenario
In web stuff we had like, unit tests and integration tests / end to end tests or whatever, what's the usual go to approaches for game dev stuff?
so I think that varies per person, I mostly just end up spawning a few entities setting up a few scenarios, constructing the system and calling system.Update() and assert on the data of the components
one talk I really enjoyed was from Sea of Thieves engineer where she explains the methodology: https://www.youtube.com/watch?v=KmaGxprTUfI
Interesting. Yeah I figured the preferred approach might change because in the web dev stuff you were not often dealing with "time" in the form of an update loop in the same way. Mostly just testing static logic
Thanks! I'll watch it asap
A good boiler plate for setting up the test fixtures is the ECSTestFixtures in the Entities package
how would one create a hash of a vertex buffer ? it seems like alot to process really fast if I want something accurate
What do you need to hash the entire buffer for?
I'm combining meshes and due to what I do I'm combining the same stuff at diferent places in the world; I want to cache my meshes to be able to batch them
the easiest way would be to hash the buffer I guess ?
Guys please help me at creating new world
I need an example and all examples are old
Unity changed everything at new releases and examples not working
@radiant sentinel entitydebugger only shows worlds that are scheduled to update by the player loop
if you add it usingScriptBehaviourUpdateOrder.UpdatePlayerLoop(world);it should work
Yes its work, thank you, but i have not same systems for multiple worlds. But it is show me same systems
@hollow sorrel
what do you mean?
I want create different systems for my new world. But i will see default three groups, same as default world
Sry for my English
ah yea
do you want to manually update your world? or do you want unity to schedule it
yes
unity sorta assumes you always have a init, simulation and presentation group as your root level systems in each world, but which ones get added under that is up to you
Thats mean i have 3 groups by default but in their child systems are different
I have upgraded to unity 2020.2 for 0.13 entities package, now i have new functiona at scriptBehaviorUpdateOrder, ill try them and i will ask you again, can i ask?
you can see how the default world gets instantiated in packages folder
Unity.Entities.Hybrid/Injection/DefaultWorldInitialization.cs
two relevant parts are GetAllSystems() and AddSystemsToRootLevelSystemGroups()
so what you could do is
var systems = DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default);
which will basically look for all ComponentSystemBase in your entire project and add them to a list
then you can create a new method that filters the list of all systems to just the ones you want to add
for example if you were to create your own Attribute [CustomSystem] or whatever that only gets added to the ones you want in your custom world, you could then do
foreach (var type in systems)
{
var attribute = type.GetCustomAttribute(typeof(CustomSystem));
if (attribute != null)
// add system to custom world
}
or if you are using multiple worlds, create an UpdateInWorld attribute with an enum
one thing to keep in mind here though is that you must add it to one of the toplevel groups (such as SimulationSystemGroup), free floating systems that are in your world but not updated by a toplevel group won't get updated
with addtosystemupdatelist
you can see how the default world gets instantiated in packages folder
Unity.Entities.Hybrid/Injection/DefaultWorldInitialization.cs
two relevant parts areGetAllSystems()andAddSystemsToRootLevelSystemGroups()
so what you could do is
var systems = DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default);
which will basically look for all ComponentSystemBase in your entire project and add them to a listthen you can create a new method that filters the list of all systems to just the ones you want to add
for example if you were to create your own Attribute[CustomSystem]or whatever that only gets added to the ones you want in your custom world, you could then doforeach (var type in systems) { var attribute = type.GetCustomAttribute(typeof(CustomSystem)); if (attribute != null) // add system to custom world }
@hollow sorrel
thank you, thanks a lot
np

why does this prints only (0, 0, 0) while my new meshes get rendered correctly on screen
https://i.imgur.com/yyPp1Rh.png https://i.imgur.com/gexydf3.png
I definetely can get the vertices from the origin meshes tho 
^ what I was seeing was my source meshes still being renderer for some reason, my combined mesh's vertices are all indeed on 0, 0, 0
@hollow sorrel hello again,
i want default player loop for default world and my custom player loop for myWorld world. can i have both of them?
@hollow sorrel hello again,
i want default player loop for default world and my custom player loop for myWorld world. can i have both of them?
@radiant sentinel ,thank you , i got my answer. thats true ,the system is working at background but i cant see that ๐
@radiant sentinel yeah adding custom world to playerloop doesn't overwrite the default one
or shouldn't at least
but sounds like you figured it out
I hate that entity debugger makes it seems like the renderer is taking so long but it's just the physics rebuilding --'
I need to switch off using one collider per tile :x
(this is 10K colliders)
I'm already cutting pretty big corners by just disabling LocalToParent updates for my hierachy when I don't move anything
daymn
does it display that way because it's presentationgroup that's waiting for physics jobs to complete? weird it doesn't just show it as physicsjobs.complete or whatever
weren't you making a tile based game
what's the colliders for
raycast on grid to get grid tile entity, and then get the rest
ah i was gonna mention you can just convert mouse pos to tile pos but i guess that won't work if you're trying to select tall buildings by clicking the top and the camera is tilted
you could prob get away with mouse pos to tile pos for a lot of small things tho
I'm prob still gonna raycast, but I'll use my new combined meshes and get an offset coordinate in local space from LTP of the entity I raycasted
since I can throw at minimum 20 by 20 patch of tiles per combined mesh
but that will be when I fix my coordinate problem in the combined meshses >.>
well how am I getting entities otherwise ? I need local space coordinates to get the correct index in my grid tile buffer
the coordinate problem: https://i.imgur.com/lcrEZYU.png
What do you mean by "local space coordinates"
don't you have a way to get an entity at a coordinate
bool haveHit = collisionWorld.CastRay(input, out hit);
if (haveHit)
{
Debug.Log("hit");
Entity hitEntity = physicsWorldSystem.PhysicsWorld.Bodies[hit.RigidBodyIndex].Entity;
EntityManager em = World.DefaultGameObjectInjectionWorld.EntityManager;
var parent = em.GetComponentData<Parent>(hitEntity);
LocalToWorld gridTransform = em.GetComponentData<LocalToWorld>(parent.Value);
var transformMatrix = (Matrix4x4)gridTransform.Value;
var localPos = transformMatrix.inverse.MultiplyPoint(hit.Position);
return new RaycastResult
{
Entity = physicsWorldSystem.PhysicsWorld.Bodies[hit.RigidBodyIndex].Entity,
originPosition = camera.transform.position,
LocalHitPosition = localPos
};
}``` @dark cypress
at a grid local space coordinate yes, one tile is 1 unit forward in x and z @hollow sorrel
which I get from my buffer
what's stopping you from converting a world pos to grid local space
you have your local grid offset right
needing a world pos in the first place??? why do you think I do a raycast
but raycast is just a less efficient way of achieving the same
I'm not sure why you need thousands of colliders.
You can achieve this with just 1 per grid or 1 per world if grids are in a pattern.
how is a screen to world raycast not the way to get a world pos on a plane?.. @hollow sorrel
and I said I needed to change that but for now I took the easy route @dark cypress
Give developers more RAM and they'll eat it I guess.
it's not even ram it's just cpu time
if the physics world wasn't damn rebuilding itself every frame
because it's a grid
you know exactly where it is because you have the grid position in your world
you know exactly where the player is trying to click
you can know exactly what tile a player is trying to click instantly because you just take the offset from the grid
it'd be instant that way
0.001ms cost
I want tiles to be free from eachother, so not possible
what do you mean free
it doesn't matter how much space there is between the tiles, even if your grid tiles are moving all over the place you could still get their tile position in world
because you're already tracking your grid
you know exactly where the player is trying to click
we know the mouse position on the screen, no world pos
and each tiles don't have the same offset from eachother
hmmm ok fair, my mind started focusing on 2d representation for some reason
but in 3d you could just give one collider to your entire grid floor, then you have the world pos the player is trying to click
what did I say earlier --'
I'm prob still gonna raycast, but I'll use my new combined meshes and get an offset coordinate in local space from LTP of the entity I raycasted
@zinc plinth
ah
dots really decided to piss me the fuck off today --' https://i.imgur.com/fA41lTF.png
you can't add chunk components right after creating an entity with an archetype
ayy works if I add it to the archetype with ComponentType.ChunkComponent
How lucky. It pisses me off every day. ๐
Anyone know a quick way to figure out how to detect any unused components or systems?
unused component ?
ho
fun
so, if you have the DisableRendering component on an entity with a RenderMesh, it will still get processed by HDRP
and make my hdrp loop go from 2ms to 27
so I have to destroy my entities while I could need them in the future to rebuild new combined meshes
great
dots isn't finished and the hybrid renderer is really unfinished
you accept this when you start using it
https://i.imgur.com/T5wQPl7.png @low tangle
did a forum thread cuz seems like no one asked before
I read in the docs that .WithChangeFilter doesn't care about writing to the component, but rather about a system being ran that declared write access to it. But that's not what I'm seeing. I have an system that declares write access to my NeedUpdate component every frame, but only writes into it if an update occured. A system that has .WithChangeFilter<NeedUpdate>() however, isn't ran every frame, only when the actual write happens.
If the system that declares write access didn't run this frame, then it doesn't trigger the change filter
But if your system declares write access runs this frame but didn't touch the component at all it will still trigger the change filter
It runs every frame. It's a system that responds to mouse clicks, so the only variable there is the InputMouseButtons component which is written to every frame. The system just checks whether a button was clicked from that component and sets the update component if it was.
How is your code?
If (mouseClick) Entities.ForEach((ref Translation t) => { if (someBool) t = default; }).Schedule();
If you put the code above inside a system that forcelly runs everyframe, it will trigger the change filter for Translation every frame that mouseClick is true, even if someBool is false. If mouseClick is false, even if the system runs, it will not trigger the change filter
Yes, you can
It seems like a compile-time construct.
It seems like a compile-time construct.
@dark cypress foreach compiles to IJobChunk, the same way that you can conditionally run an IJobChunk, you can conditionally run a ForEach
You can see the generated code in the Dots Compiler (is that the name?) window
That's great.
What you said doesn't seem to be correct though. This query is shown in the debugger as having entities matches and the system is shown to be running.
The system running doesn't mean that the entities.foreach is running
It just means that the OnUpdate is getting called
If any of the Entities.ForEach matches the system OnUpdate will be called, but the Entities.ForEacg may not be called (lile in your case due the mouse button not being pressed)
That makes sense.
It is a little confusing, but just because Entities.ForEach involves much "magic" (actually is just code gen, but is not all explicit what is happening without already knowing how it works or looking into the dots compiler)
Thus why I usually use IJobChunk directly instead
what are the several ways i can do to check if an entity is still seen by the camera?
maybe this can help
new burst and platform package ๐
Does anyone remember the link that contains all the different packages in a json format? That was posted here some time ago
the different packages that you need to install manuall now?
No the json which i think the package manager uses to populate it's content
https://forum.unity.com/threads/visibility-changes-for-preview-packages-in-2020-1.910880/
probably this?
Quick question, I just want to be sure that I understand what is happening here on how to create/set a singleton entity (fond in the official documentation).
So the code goes something like:
- get the EntityManager
- Create an Entity with the component you want the singleton to be
- Create a querie that will get the entity we just created (?)
- Set the component of said entity to a "new Singlet" (?)
Is it what is going on? It feels not very "natural" so I have some doubts
the last 2 lines is an example when you need to get a singleton entity in a system
Oh, you do not have to specify that a component is a singleton when creating it ?
because this is the documentation on GetSingleton
Damn, I guess I wasn't looking at the correct/latest documentation! Thank you!
have any of you guys used singletons? I want to increment a count during my conversion system, and access that count rather than having to query for the total number of entities in that archetype....
but singletons...
are so...
weird
oh damn look!
@proper silo is fighting the same battle!
have you had any luck?
Hahaha @tight blade , right now I am just trying to create one, but I'll let you know if I manage to go further than that !
ugh, man its enfuriating
Why do you need a singleton to increment a static counter for a class?
Do I not? theres a conversion system and a running system. the running system needs to get that count. is there some easier way to just increment some globally accessible integer?
Singleton = you only want one of a class to exist.
Im not a C# guy by trade
In the awake/constructor add 1 to a static "numInstances" variable of the class. The static means that there's only one per class for all class instances, and they share it. :)
In the Destructor/OnDestroy/whatever, decrement the counter.
DOTSify this, contextually, however all that works. I just followed you here from shaders to help. But singleton probably doesn't mean what you think...it means "only one instance of this entire class can exist...one time."
hahaha, thats awesome! thanks for following ๐
IDK if DOTS already keeps some counter somewhere though.....
Yeah, that would be lovely if it did. The description for get entity count says that it executes the query every time
its so weird to not have native singletons
I can't tell ya much about DOTS, so YMMV. Maybe you need a separate class or something that not DOTSy.
i mean, it takes about 15 minutes to implement them into an ecs
i know because ive done it
lololol.....and if you had a separate class to keep track of things, you'd probably want it as a singleton so you can reference it from other classes from anywhere....lol.
i implemented them, on cpp, by just having a single hashmap
where key = type
and value = void* allocation of said singleton
IIRC, regular C# classes can coexist with DOTS on the C# side, but you have to be careful of what you want to process.
native singletons are super important in a ecs architecture
you need to store your system state somewhere
and stuff like accel structures
or bridges into external libs
What are different worlds used for? I want to understand when I'd want to use one.
well, static integer incrementing works, so I guess I'm happy haha. I didn't know that static members were writeable.
how expensive it is to change materials of an entity?
Yeah, it's a throwback from C/C++ lang syntax. But static =/= const.
i.e. I'm trying to flash a entity to yellow and back to blue over and over for 2 seconds.
given that its under a shared component. how expensive is this?
@dark cypress you generally use different worlds to allow for better parallelism on stuff, and to run unrelated simulations
unity for example has its own ecs world for physics
How do worlds allow for better parallelism?
whenever you execute a command buffer, that creates entities or adds/removes components, it requires a full multithread sync point
Oh, I see.
So if you have a structure that only needs to sync once per frame or something, but is otherwise separate, you can use that to cause less sync points on the main world.
indeed
another great use for them
is for stuff like level loading
or procedural generation
you can have a background world where your "mid load" stuff is held
and then you copy the entities from there into the actual runtime world
copying entities beetween worlds is pretty cheap
but yeah those are the main uses of it
Thanks, that's helpful.
Interesting
so, if you have the DisableRendering component on an entity with a RenderMesh, it will still get processed by HDRP
@zinc plinth I assume that's also true for URP? Because that's not ideal, haha.
Performance by default except for the most obvious things*
I don't know for URP
No worries, I'll check
finished my mesh combining + hashing/batching
trying to think of what to do next 
what'd you do for hashing
math.hashwide on each vertice
add add the uint3 together while doing it
it's not optimized yet cuz the hashing itself could get thrown at a IJobParallelFor while it's a IJob for now
but since all of that is done at game start..
also
how do I create and playback a ECB myself ? if I call Playback myself I get an error saying it wasalready playbaked
hoooo you create it yourself instead of from a system
I see
ayyyyyy
lost a full second to a system now that I use a ECB to batch all the operations for my grid tiles init
200ms of playback 
daymn
takes (1.2 + 1.8 + 2 + 0.9) = 5.9s to init a 200 by 400 grid resulting in 6ms cpu time afterwards
200 by 400 is roughly the size of the new massive island in one of anno 1800's dlc
and that's running with only 4 worker threads
for 80K colliders it's not
I can't optimize my colliders how I want yet so I'll just wait for entities 1.0 where colliders will be impactedby NonUniformScale
Please correct me if this is the wrong place to post this, but is there any way to give jobs access to large arrays without copying it for every job? I'm implementing marching cubes using the job system and have fairly large lookup tables
@solid flume Why do you need to copy? A NativeArray is just a pointer, you can pass it anywhere.
is that 6ms every frame?
yea @mint iron
I thought jobs copy all their data?
Yeah, they copy the pointer.
Oh
And then use that pointer to refer to the original array.
so native collections are basically collection pointers, and any other data is allocated separately for each job?
Anything that's not ref yeah.
I'm assuming that if I want the array to exist indefinitely the Allocator needs to be Persistent?
Correct.
Do I need to Dispose it on changing scenes? Or exiting the game?
If you stop using it you should dispose it.
What's the best way to spread processing over multiple frames in ECS? For example, I have my subscene loader that needs to check 200 subscenes for distance to the player. It's easy to make it more efficient by just having it check for distance every couple seconds, but that still does all the processing on a singular frame.
Say I wanted it to check the distance to 1 subscene per each frame, so over 200 frames it would have checked them all. What's a good approach for that? Will it necessarily destroy parallel processing?
It needs to be used intermittently throughout the course of the game
profiler looks like this @mint iron https://i.imgur.com/nmuRgSK.png
In that case, should I just have a normal c# array and Temp allocate it when i need to use it?
I was concerned about the potential time used in allocating and then clearing it
especially if I need to use it several times in quick succession
If it only happens when changing scenes it shouldn't be an issue.
not necessarily. A runtime editable mesh needs that array a lot
I meant that its not necessary it'll be used only on scene load
Then keep it loaded. I have a global static native collection being always available for jobs.
Persistent it is then. Thanks a lot
Do you have to dispose it manually or does it automatically get disposed if the game is closed?
OS disposes everything on process close.
Is there a difference between the readonly modifier and [ReadOnly] attribute? Which should I use?
@tardy spoke 200 distance checks with ecs is prob so cheap that adding spreading might even be more expensive
but for things like this you could give them a batch id, then one frame process everything with id 0 then next frame everything with id 1 etc
dunno about best way but that's one way
alright, here we go guys
@tardy spoke checkitouuuuut
simulatin muh water
dude, why are these videos never working??
you need to see the beginning!
It worked for one play through for me, haha. It was incredible while it lasted!
hahaha
The green cube dropped and then things ... drifted in a way I assume they're supposed to
yeah, okay if it worked for one playthrough thats enough. yeah, you can see them all appropriately interacting with each other's drag mechanics
im real happy anyway
Haha excellent. Upload to Steam store ??? profit.
profiiiiiiittt
Hmm frame debugger shows the batches and everything but doesn't actually show the rendering of the frame yet with hybrid renderer seems like
If I need to initialise a job with an array, does it have to be a native array even though I dont need it to be a pointer?
All arrays are pointers. Native collections just wrap it into a value type with their own safety checks to allow it to work in DOTS.
Oh right I should've remembered that. I'm do dumb stuff sometimes
Forgot arrays are pointers
. . .
This is probably a pretty trivial question, but what's the best way to refactor this out? I'm going to end up with a bunch of "state" info for the player that a lot of systems will need access to... is there an ECS best practice for that kind of thing?
Would it just be using a NativeHashMap in a singleton class or something and writing/reading data from/to it from Systems? Or is that way wrong? Hahah
Like a 'lil database!
you mean like other than putting more fields in your singleton component?
Yeah, because otherwise all that boilerplate will be needed for every single system, I believe
that requires that info haha
yeah man I have no idea with that absurd singleton api
im amazed you got it to work at all
GetSingletonEntity you mean?
Yeah, I don't know how Set works, but Get will just get the entity if only one entity has that component on it. I never actually "set" it at all, but maybe one of the conversion systems figures that out and sets it
oh, is that easier? I was trying to use the GetSingleton and SetSingleton and tried a lot of permutations with no success
I'm not sure lol
I was talking about a using a singleton design pattern in a class, not that method
like create a database by making some class that all the systems can access that's holding the player state, but I'm not sure if that's remotely correct and if that will have adverse effects on running jobs in parallel or not
Most of the systems would just need to read from it most of the time
yeah I mean from what I see written about it, all that boilerplate seems to be pretty much necessary for the singleton system. Also, as for paralleling, it works like a regular archetype reference, so I guess every system that accesses it would have to be scheduled sequentially
I think we're talking about two different things, what is this "singleton system" you're talking about? Hahah
there isnt a set i dont think you just create an entity and make sure there's only one with that component
Ohhh, is there a way to do a "singleton class" but ECS style in some sort of fancy "singleton System" ?
I haven't even heard of that
not really, but yes.
there are some API's that are in there, but it seems like its gonna get improved on
its basically just an abstraction over asserting that theres only one of that archetype
what i end up doing is write an extension that wraps it all like `world.GetOrCreateMyThings<Stuff>() which is basically the same as what you would do with a system, except you can define the interface and skip unitys base class bloat
@mint iron yeah I got that confused, there's a "setSingleton" but no "setSingletonEntity"
I mean I assume that's because its an entity, so you would use an entity manager setcomponent - right?
of course that would totally break jobs.
What about "System State Components" ?
yeah its pretty weird, GetSingleton/SetSingleton just gets/sets the component lol with a check to enforce there's only one. I guess it declares your intent which is good.
maybe it's useful for testing or something
lol, Im glad I have no global state needs yet and could just get away with a static var
Yeah I need like a true database style state system I believe haha
nahhh, you just need a good CAS
for things like quest progress, player location, items, etc
"check and set"
I need Redux ๐ค
Haha I'm terrible at web programming, I'm probably better at this than I am at that now, as scary of a thought as that is
sounds like you're ready for seed capital to me
I can't find any examples on google of anyone building a state system in ECS
Hmm... well this is kind of the same idea except instead of storing all state data in some sort of singleton class you could just have it floating around as various components? ... Is that... better?
Have some systems set those components and then some read. If I'm not mistaken a system simply reading IN that component could still run in parallel right? Particularly depending on the time read in that data, IE pass it into the job as a value before executing in parallel?
I think just making a "globalState" entity is probably an alright way to proceed, but it doesn't do much about all that boilerplate in all the systems.
So just a lil' question! Me and a friend just started developing a game using DOTS, and I'm doing all the 3D asset creations (he scripty boi). I'm not really a good programmer so I don't understand it too much, we just communicate what does what for stuff. Anyways! Should I do anything different when making assets? Since it is entity stuff, or is everything pretty much as usual? and he can just convert to entity on runtime and blip it do thing good?
You're good.
Awesome :D
got the singleton stuff, I just create a single entity with a SingletonTag and add all the shit I need on it; just need to make sure to only create it once 
SystemGroups are amazing 
things get so neat
@zinc plinth how do you access it from systems?
entity query with the tag
so on your systems you just query it?
imagine player was "SingletonTag"
I'm just looking for a smart approach because it'll be no time before I have like 30+ systems and it will suck to have to change 'em all haha
particularly when you get to like 200 systems or more ๐คทโโ๏ธ
but it depends
cuz like for my InputState component in the singleton I have this, and then I GetExistingystem and grab my component
[UpdateInGroup(typeof(StateUpdateSystemGroup))]
public class InputStateSystem : SystemBase, GameControls.IBuildingActionsActions
{
public InputStateSingleton InputState;
private EntityQuery _inputQuery;
private GameControls _inputs;
private ButtonControl _selectControl;
private ButtonControl _alternativeBuildingModeControl;
private ButtonControl _rotateControl;
// https://hatebin.com/hzgncyknqh
protected override void OnCreate()
{
base.OnCreate();
_inputQuery = GetEntityQuery(typeof(SingletonTag));
_inputs = new GameControls();
_inputs.BuildingActions.SetCallbacks(this);
}
protected override void OnUpdate()
{
//Debug.Log("Start of frame");
Entity singletonEntity = _inputQuery.GetSingletonEntity();
InputState.Select = (_selectControl != null && _selectControl.wasPressedThisFrame);
InputState.AlternativeBuildingMode = (_alternativeBuildingModeControl != null && _alternativeBuildingModeControl.isPressed);
if (_rotateControl != null && _rotateControl.wasPressedThisFrame)
{
InputState.Rotation = InputState.Rotation.Next();
Debug.Log($"new rotation: {InputState.Rotation}" );
}
EntityManager.SetComponentData(singletonEntity, InputState);
}```
so I don't have 500 times the same query, but components being public from the system they're set on
and then I have a SystemBaseWithInputs when I need inputs in my system ```
public abstract class SystemBaseWithInputs : SystemBase
{
private InputStateSystem _inputStateSystem;
private InputStateSingleton _inputState;
protected InputStateSingleton InputState
{
get => _inputState;
}
protected override void OnCreate()
{
base.OnCreate();
_inputStateSystem = World.GetExistingSystem<InputStateSystem>();
}
protected override void OnUpdate()
{
_inputState = _inputStateSystem.InputState;
}
}```
Interesting! I shall research this, haha. Thanks!
np
Are we not supposed to use SerializeUtilityHybrid? Like is it just for the hybrid conversion workflow
It looks like it makes assumptions about gameobjects being prefabs when not in the editor
I think I just saved myself a coupe hours of playmode debugging
heh i have no idea
i asked for clarity on it on the forums too and no answer
i really hope they find a way to make it just work so you can literally just call serializeworld and not need to do extra busywork
yeah I'm dreading having to get into this entity remapping after deserialization stuff
i can afford to put off saving/loading until (if) they spruce up the usability
spawning entities from JSON would be neat too
anyone know of a mathematical operation to push normalized values away from 0.5? like I want 0.4 to go closer to 0 and 0.6 to go closer to 1
What about simply multiplying it by itself to put it into an exponential curve... haha. 0.4 * 0.4 = 0.16, 0.6 * 0.6 = 0.36 .
Then an additional operation on top maybe could get you where you need to go. Needless to say, I'm not super great at math. Good at problem solving though. ๐คทโโ๏ธ
right, and then id need to renormalize that
And you do not want to renormalize it? ๐ฎ
no, I do want to renormalize it
Yeah, the only thing is depending on the "curve" you want it might not be in the right "place".
so, squaring it doesnt work because it moves numbers away from 1, even though it succeeds at increasing variance
Right
so like Im trying to figure out how I would remap that onto a scale between 0 and 1
Someone will need to bust out the old TI-86 and figure out how to move the curve, haha.
so that .9 is pushed closer to 1 and .1 is pushed closer to 0
lol, its like at that point in the night where I'm too tired to be smart enough to let this problem go for now
I might've seen a tutorial a couple days ago that does something similar, let me have a look
@tight blade There's also a comment at the very bottom by someone who retrofitted it to remap to different ranges. The answer is probably in there somewhere, haha.
I have around 8k jobs running, and according to the profiler they take basically no time to complete, but the GC alloc from disposing of all the native arrays is taking ages. Is there any way I can avoid that?
Can each job dispose of its own variables at the end of execute?
Doesn't seem to make a difference
Also, I have 4 static persistent nativearrays as lookup tables, since I need them often. Every time unity builds, it throws an error that it hasn't been disposed resulting in a memory leak. How can I avoid this?
Do you have an idea for the GC Alloc issue? If the array is small and a fixed size (always 8 elements) is it better to have 8 variables?
I'm not informed on NativeContainer GC stuff, unfortunately.
Ah. Never mind then, the solution has to exist somewhere in the docs/forums
Is there anything like a nativeIntPtr?
So every job doesn't get a copy, but a readonly reference to a value
i think thats only in Editor, its stripped in actual build
iirc it was called Disposable Sentinel, which is there to track safety for multithreading
Apparently IJobParallelFor doesn't allow parallel writing
Is there any job that does?
Pretty sure you just disable the restriction if you can guarantee you won't write into the same index from different threads
โ๏ธ
[NativeParallelDisableRestriction] i think is the attribute's name
you have to use NativeList.AsParallelWriter()
you have to make sure there is enough size before you send it to job because there is no Add method on ParallelWriter, only AddNoResize
Oh
I don't know the size I'll need, but I can probably make a hard cap
I need read and write, so I guess every time I write I call the function?
Does that have a memory/performance impact?
well you generally create a new native list with Allocation.TempJob before you send it to job
The list is persistent. It might need to be edited very frequently so I didn't see the point in reallocating it every time
then yeah, you have to clear/resize it everytime you are about to send it to job
Is 35k too many float3x3?
i think so ๐
i mean you can just try it and see how it works out
True that
Lets hope unity doesn't crash
I still need to mark it with the[NativeParallelDisableRestrictionAttribute]? Because its throwing the same error even with the parallel writer
Also it seems to be called either [NativeDisableParallelForRestriction] or [NativeDisableContainerSafetyRestriction]. Can't decide which so guess I gotta try both
i think former
Both of them work but I get separate answers
I really need to find a way around static nativearray lookup tables
Its messing with the editor
What do you use them for?
Marching cubes
I think I'll just learn compute shaders and use the job system for chunking
Makes more sense
Right now this is such a pain
@solid flume blob assets?
But the restrictions and stuff around how jobs interact with data makes this a pain. I know the fundamentals of the compute shader approach, event tho I don't know how to write one
What are blob assets?
they're just immutable data that you can ref to and take data from.
hehe, in .ForEach().... ref params must become before in params. Is there a reason for this?
is there a way to prevent specific EntityQueries to enable/disable systems ?
I'm new at this, but there's two ways: Add a "tag" component that is empty of values, but just filters the .WithNone, OR add a flag that must be processed on a component, but will be processed for each entity. There's obviously pros and cons to both
Ah, yah had this in my bookmarks: https://gametorrahod.com/tag-component/
Hmm, what's the equivalent of setting Transform.forward with ECS? LocalToWorld is readonly
@tardy spoke good tip on that post. It wasnt quite the answer, but it got me far enough to develop what I needed
Hmm, what's the equivalent of setting Transform.forward with ECS? LocalToWorld is readonly
@violet cosmosquaternion.forward(rotation)
math.forward(rotation.Value); ?
translation.Value = newPos * math.forward(rot.Value);
Yep - just pass in the quaternion - it'll return the forward direction
OK, sane enough. Just don't know enough API obcscura yet
anyone knows why PostUpdateCommands AddComponent<T> is not AddComponentData like the EntityManager method?
@tight blade I was actually fairly drunk last night and realized that wasn't right either this morning.
I'm pretty sure you were looking for a Sigmoid curve or Richard's curve or similar. Glad you figured it out, hahah.
does the Iconvertgameobject interface only gets run when I have the convert to entity script attached to the GO?
In [GenerateAuthoringComponent] for IComponentData, is there a way to initialize based on current editor (or another componets) values? I have a value that I want to set once based on editor data (in this case, it's a cached Last Position)
@deft stump I'm pretty sure it only works when attached to GO
@violet cosmos yeah, put it on a GameObject and set the values?
I'm probably misunderstanding you haha
@tardy spoke I mean, yeah it is attached.
but does it need the Convert to Entity component to run the interface?
@tardy spoke Well, in this case lets say you're tracking motion vectors. You need to initialize something as the "previous", if it's just zero then it's weird, right?
Hmm, good question, I believe it doesn't need to convert to entity to run the interface because I think I had it instantiating a GO twice to two different entities and then disabling the GO
@violet cosmos you could put two pieces of data on the component, one as an initial previous value or something?
again, might not be understanding exactly what you mean, and also that solution may not be ideal, haha
That's unnecessarily complex. If I initialize something on frame 45, then it has a world space position but hasn't run yet. On frame 46 it runs, and we can assume it's moved, but I need to know the position on Frame 45 the first time to accurately track the motion vector
So, I have a "Last Position" cached in the struct to perform calculations
Ah, gotcha
then um... why not just store it in some component?
name it LastPositionComponent
Same problem, how do I initialize it
Also, if it's a component like that, then theoretically anything could touch it
LastPositionComponent.Value = currentPositionComponent.Value - 1 ... haha
initialize?
the moment it runs its already initialized.
you just need to ref it Entities.ForEach
So, I don't like that idea
Also, if it's a component like that, then theoretically anything could touch it
in practice anything can be touched
Unless it runs last, but then it's never ran first and we're back to square one
So, the easiest way is to just have some sort of "constructor" paradigm. That's really what I'm asking for... What's the Initialize/Constructor process in ECS?
(for the entity)
When you add a component you can set a value
well for initializing it.
you CAN set/add the component in runtime via EntityManager.
And you can throw in your data while you're at it too
If you're doing it "ECS" style I think since you have data it has to be held in a component somewhere, so I think that "lastLocation" component may need to exist. There's probably other ways of doing it but I think that would be the "normal" way?
I guess I could have a specific job that is looking for MyComponent without a MotionVector component, then add that MotionVector, and have that run first. Seems like a wasteful lookup because then it needs to be run every frame too
I have LastPostion as a value in my component. The question I'm asking is about initialization based on runtime values
btw @deft stump I just looked through some old code but couldn't find anywhere where I used IConvertGameObject so now I'm not sure if it has to be an entity or not. I'm thinking it probably does have to convert to entity, because otherwise I probably would've used it. Ended up going a roundabout way using the "GameObjectConversionUtility.ConvertGameObjectHierarchy(gameObject, settings);" functionality a lot and I imagine I ended up doing that because IConvertGameObject converts to Entity and I couldn't grab the game object again (because it had vanished, haha).
If I have a value of last position that is set upon initialization, and then I have the value of next position that is calculated the very next frame, could I not calculate the vector from that?
because I have both pieces of data at once
and then set the component to new "last position" after the calc
A bit confusing but I think you may want lastPosition and velocity on same component?
I do, it has the values needed on the component, including LastPosition. Just needs to be initialized correctly (and hopefully in a sane manner that I can maintain)
Hmm, I have an example at authoring time, but I don't have one for instantiating at runtime.
I imagine the runtime one would be similar with AddComponentData upon instantiating and then setting the value
hrmm
Convert might be OK, just a bit annoying because so far I've got plans to make MonoBehaviour free Prefabs using GenerateAuthoringComponent instead
sanity ccheck
So I need to use an MB to initialize, which could have easily handled with some markup in the struct. Maybe I'll add that ๐
dstManager.AddComponentData(gridPanel[i], new PanelRenderBlobData {
PanelRenderMeshBlobAssetReference = blobAssetRef,
index = 0
});
...
this is how to add a component right?
@deft stump I just checked, IconvertGameObject needs the GO to have convert to entity script or be in subscene
@deft stump I'm not a C# master but don't you need the generic type of the component there?
<Whatever>
that works too according to intellisense
yeah cool, just making sure, haha
It's as never wrong as the code you're writing right now.
dont quote me
@tight blade I was actually fairly drunk last night and realized that wasn't right either this morning.
I'm pretty sure you were looking for a Sigmoid curve or Richard's curve or similar. Glad you figured it out, hahah.
@tardy spoke
Hahaha, same, more or less ๐
Failing at ECS leads me to drink which leads me to fail at ECS more. Vicious cycle.
Hello, my World.update not working
I have made a world and im using new player loop by scriptBehaviorUpdateOrder.appendWorldToPlayerLoop
Whene i call update its not work
weird that I get more stuff done when I drink
@tardy spoke where are you failing
Hello, my World.update not working
I have made a world and im using new player loop by scriptBehaviorUpdateOrder.appendWorldToPlayerLoop
Whene i call update its not work
@radiant sentinel
Its work if i set that player loop as current player loop
@opaque ledge haha nah I'm killin' it, all good. ๐
Actually todays project has me a bit confused though, Torsina gave me a good example of implementation but it went a bit over my head just because I'm not familiar with some OO concepts like abstract classes yet, but I'm trying to figure out a good way to hold gameState in a component or some sort of container that can be called from any System
what's the world called where the conversion of go happens?
I don't mean to sound patronizing but isn't it literally called the ConversionWorld ? haha
Don't quote me on that
well I'm trying to get its EM
ah good good^^ I had lots of problems at beginning, thinking about ECS structures and learning you can actually put classes on your entity helped me a lot
the base class approach from torsina is a good easy way to do it.
guys Can i have multiple world that updating without setting as current player loop?
Yeah, I just have to do some research on OO stuff to figure out what abstracts do exactly, then I should be able to just implement it.
I don't like implementing code I don't understand because I know that'll eventually lead to disaster, haha.
abstract just means its intended to act as a base class and usually has abstract members that must be implemented when u derive it.
@opaque ledge put classes on your entity in which way are you referring?
you can put class ICD on your entities and run a system on it with "WithoutBurst" and "Run"
and you can also add MB with AddComponentObject
Right, that's how I've been doing it, haha. ๐
MB ?
Monobehaviour
Right, sorry, haha
Uff, I'm having a slow brain day on this math
I actually didn't know you could add monobehaviours to entitys... I guess it makes sense. I have a couple references to camera GO's and stuff
i have wasted lots of time to think how should i implement UI stuff and then i learnt you can add class ICD, which made things much easier ๐
My only issue is that currently virtually all my systems are .withoutburst and .run which makes me wonder about my software architecture skills, hahah.
because a lot of the ones I'm working on now need access to the player's state (location) which they have to reference
thats not good tho, i am not really pro or anything, but why ECS is better than MB is being able to use burst which requires you to use (blittable)structs only
you can just take the 'snapshat' of the player state in OnUpdate method and use that in your job
Exactly. That's why I'm trying to figure out how to hold the player/games's state in a way that will allow burst/parallelization if they just need to read it
like
float playerHP = ManagedClassPlayer.GetPlayerHP();
ForEach(stuff) =>{
int someRandomVariable = playerHP / 2;
}
sure
How can i update world?
Right. Could I use a singleton class or similar for that @opaque ledge ? And then just have the systems that write to it run without burst or whatever, but the ones that read it just store it locally and run with that?
yeah exactly
Yeah, that was my original idea, I just wasn't sure if that was a "proper" way to do it or would lead to disaster!
@hollow sorrel hello, i have created worlds but i ihabe update problem
@opaque ledge one last question, what would be the best type of container/object to store the state in? NativeHashMap?
hmm not sure mfragger, i never did that kind of stuff, there might be a chance that GridPanelTag entities havent get created yet
NativeHashMap for multiple keys/values yeah
if you want to go for key => multiple values, you can use NativeMultiHashMap
@radiant sentinel whats the issue
sooo how do I get the EntityManager of the ConversionWorld?
that MIGHT answer my problem
@hollow sorrel im using different player loop for each world
When i setPlayer loop of one world as current player loop, other worlds not updating
@opaque ledge awesome! I've never even heard of an object that holds a single key to multiple pair values (that's definitely not often used in javascript...), so I'm excited to find out what kind of animal that is, hahaha.
In JS you just nest arrays and objects inside other arrays and objects which is then called a nightmare. To make it even more confusing arrays are objects in JS... I wonder if they are in C# also. ๐ค
๐
yeah i think so ๐
tho nativehashmap wont allow you to do it
you cant nest native containers to each other
@tardy spoke https://rb.gy/lo7our this is thing for burst accessible storage - lookup databases etc. It looks scary but its not really, its just a uniform way to manage and access custom native containers.
I have so much OOP and comp sci basics to catch up on, hah.
@mint iron perfect! For what I'm doing it's more important to understand the eventual goal than to implement it today. Realistically my project will take years and it's good to hit some limitations on implementations and understand the "why" of moving to different solutions, haha.
well, if you are going for pure OOP, you cant use them in ECS anyway
you cant use interfaces or abstract classes (or classes at all) in jobs
No, I mean just how the ECS system is wrapped in OOP adds a bit of a layer of complexity for me since I'm not familiar with a lot of OOP paradigms
even the basics of understanding what an interface is vs an abstract class etc
No, I mean just how the ECS system is wrapped in OOP adds a bit of a layer of complexity for me since I'm not familiar with a lot of OOP paradigms
@tardy spoke
Objevt oriented programming?
Search and learn about design patterns
Or you should learn about architectures
which actually wont help you in ECS ๐
Yeah totally, my very limited background in programming is all functional programming lol
but yeah, its generally good idea to learn them in time
which is why I like ECS, but the thing is to use ECS in Unity it really helps to know some OOP
which actually wont help you in ECS ๐
@opaque ledge
Finally you need oop to create an architecture
even though yes, ECS is not technically functional programming, etc
You don't need OOP to create software architecture
You don't need OOP to create software architecture
@tardy spoke
You need concepts of that
^
You need design patterns for sure
IE most web-apps to my knowledge are not OOP, since javascript only implemented classes (and they're not really a full implementation) in ES2016
functional programming ftw? ๐
btw, which side are you guys on?
the I-hate-OOP side? or the I-love-OOP side?
I'm the former...
good lord how I hated c# when i first used it. C++ was my first love
more in the middle, I can see how some concepts in OOP work nicely, but I've mainly came from using a C background / functional background
I'm currently on the I hate side, but there's numerous reasons:
- I don't understand it well enough to understand the potential benefits
- My bro and dad are LISP programmers (bizarre, yes. Bro is actually employed as a LISP programmer, which is super odd. D-wave programs their quantum computer back ends in LISP - those are probably the only lisp programmer jobs that exists currently, hahah) so they're obviously biased towards functional as well
- You can still talk about design patterns without OOP, but a lot of people don't seem to understand that, haha. Classes are just functions holding functions.
man, I remember back in college my C# prof used to grill me because I do OOP wrong.
and started... slowly... hate it AHAHAHAHA.
OK, I'm having a serious brain fart... Can someone help me convert this. My previous routine was using Transform.forward to move and angle the object, but I'm having a bit of a struggle getting this equivalent in Transform working in ECS
transform.position = newPos;
transform.forward = newPos - currentPos;
After using javascript though, C# is a beauty of a language. Typescript fixes a lot of Javascript's issues, but it's like... you gotta set it up and it adds overhead, and you gotta keep it upgraded to the right version which breaks things... having a native strongly typed language is awesome.
@hollow sorrel
Finally im updating a parental group at my world and its working. World.update is not working
What is problems of group.update
?
@deft stump that's always the worst when you have a teacher that is so bad they actually make you despise something, haha.
oh no. he's a pretty good prof. Data Struct, a subject I failed 2 times because the profs were so bad at explaining stuff, he made it very easy to understand (given with the context that its my 3rd try).
He's just an OOP fanboy. A DIE-hard-#1-OOP-Simp fanboy
Anyone who uninspires people can be very damaging
I still love C#. great language. f'n amazing!
I jsut dont like OOP
Which imo is a teacher's main job, more so than instilling tangible knowledge itself. Most learning is self-guided throughout life in my experience.
I think I got it with some help from the forums
rotation.Value = quaternion.LookRotation( math.normalizesafe((newPos - placement.LastPosition)), ltw.Up);
Agree, C# is dope. Apparently it's a clone of Java, so I feel like I'm getting twice the value, hahaha.
Yay, ballistic motion. Need more testing but most of my previous algo seems to work now
Oh Java,
I hated it the moment I wrote Hello World
๐
Passed my java course jsut by copy pasting code from my seatmate
My favorite language was ActionScript 3
@violet cosmos nice one! Also you may come across this but sometimes you will need to use math.mul() instead of * in various situations with the new math library, just so you're aware, haha.
in case you ever run into that
Yah, I'm just trying to get it working first
Second day on ECS, first thing I'm converting that is mroe complicated than "move it along a line"
I need to keep code readable now. Micro-optimizations are later
ActionScript 3? is that Flash? Hahah
I need to keep code readable now. Micro-optimizations are later
why make comments if you can make the variables very descriptive
Yah, I was a professional Flash dev for years. I honestly am suprised I didn't make any Flash games. Psyched myself out that I couldn't do it
Haha programmers are interesting sort. They're super conscious about their code and see it as a representation of themselves. I wonder if that'll change in the future.
Now I use Unity enough where I need to pay for a premium version. Which is good, and have my own VR game in progress
What do you need the premium version for?
The good reason? You made over 100k with it? Hahah
unity mars?
I work with clients who have deep pockets, and so I'm obligated to buy premium
aaaah
ah, right
It's not just my income, but the income of the people that use the end result
Makes sense, and I mean Unity for the sophistication of the software is pretty affordable
Yah, $30 a month is nothing for what I'm getting out of it