#archived-dots
1 messages Β· Page 138 of 1
You can write some extensions to make it slightly easier if you're constantly using a DynamicBuffer for some type
Never seen much on shared statics, I'll see if i can dig up more on them than what i can see in the burst docs
Its.... AWESOME
its perfect for global datas
you just have to figure out the way to construct it, but its basically copy paste from the manual
I was gonna say, the docs just setup an abstract and ignore the construction part of it
thats basically it, you just copy it and change "int" part to whatever you like, and you just create another class as your keys and thats it
I assume one class can have multiple shared static parameters?
provided they each have a unique key
I can pass a normal Array to a Job? Or does it have to be a NativeArray?
yep
@loud matrix
it has to be Native Array, normal array is a class so its managed
@formal scaffold not sure if you know of them but there are fixedlists that can be used inside components
@safe lintel No I don't are they documented in the ECS Documentation?
yes
not in manual tho i think
Okay thanks I'll check them out
you have to check collection's scripting api section
yeah sorry its in collections https://docs.unity3d.com/Packages/com.unity.collections@0.5/api/Unity.Collections.html
is it me or is there very little info on NativeHashMaps? I can find the docs, and many many posts of people just pointing at the docs saying NativeHashMap is the solution, but nothing much else.
what do you need to know about it?
Don't really know what i want to know about it, just trying to learn more about what it is and it's use, The docs don't contain a definition for the thing, so I'm having to guess as to its usage from the functions currently.
Googling HashMap will tell you more about the structure in general but it really is quite simple
Like a dictionary - NativeHashMap can store one value per key, NativeMultiHashMap can store multiple values per key
You can write to them in parallel if you want/need to and you mostly use it via TryAdd and TryGet I believe
You would need to use Allocate.Persistent and also dispose of it appropriately
Ahh thanks, Now to work out where and how to dump this into a static i can access
From the looks of it I'm probaby better off ditching my blobAssets and storing my data as a NativeHashMap inside a shared static
As you already have it, personally I would say fill a nativehashmap full of blob asset references
static public NativeHashMap<int, BlobAssetReference> AllBlobs = new NativeHashMap<int, BlobAssetReference>(Allocate.Persistent); or something
I was thinking of it being more useful to have things string Id based rather than int based in the BlobArray
sure - however you want to handle keys
you can start with strings and change later potentially
Ahh right, i see why this was suggested to me now, with the reference to the hashmap i can just add stuff into the static reference, well that does solve my current issue quite well
ass stuff π
Now if only i could remember why i was using blobassets in the first place, could swear i had some other reason for it.
yea it's good - the hashmap ensures it's full of unique keys and when you get the asset reference, it's giving you a reference to your blob - so you shouldn't have any duplication of data and it'll all be quick
at least.. this is pretty theoretical - don't want to state that this is the optimum solution for you but from what you've described it's how I'd tackle it
It sounds like a better solution than I've managed to find so far
I'll have a play, see what i come up with, and then what new fun random stoping block comes up
last one was me discovering the debug.log is a nono in jobs, god knows how i never saw that anywhere
hmm I thought that worked π
without burst and run, sure
o - it's been a while since I used debug.log in a job
I've likely had multiple solutions that worked perfectly over the weeks, so now my mental knowledge of what actually works is kind of screwed up.
My last real issue was having a static reference to the blob assets, so even with a shared static i can make something work π thanks again for the help
Who knows, maybe I'll be able to stat making the game part of the game soon 
baby steps^^
it will be very hard to learn stuff if you try to convert your existing monobehaviour workflow to ECS without actually knowing what ECS is all about and how their workflow works
My Mono workflow is have a bootstrap and ignore everything thats not pure ECS so, not hard. Everything In my project is currently just test code mostly, only thing I actually did fully is player control
I tend to not start fleshing out a system until I have done some testing on it to know I'm not going to have to rip it all out. Or else I'd have a lot of ScriptbleObjects and be reallllly pissy if I had to scrap them.
ugh, still no fix for ArgumentException: A component with type:BoneIndexOffset has not been added to the entity. π
are you looking to add animation or just disable that message?
someone else' solution World.GetOrCreateSystem<CopySkinnedEntityDataToRenderEntity>().Enabled = false;
mine was to remove the other skinned component from the entity on conversion so it didnt trigger
This may not be about ECS per se, but it is related. It's the question about Unity's serialization.
Let's say that I have an authoring component or such, the struct field is serialized and default-created via a constructor.
Let's say that I want to add one more property to that struct. Say, a float. I also update my constructor, now my authoring component passes 1f to it.
What will happen in this case with Unity's serialization: will the authoring component's struct float property be 0f or 1f provided that the component is already serialized and not created just now or from scratch?
Well it works, but ... I've created a monster!
StaticDatabase.Items.Data.Value.data[cargoBuffer[i].index].name
Reference ception
@mint iron are you trying to use joachim's vertex anim repo?
no i just have a character with skinned mesh renderer in a subscene as a placeholder and the exception was annoying.
ah
i think you could just add in the anim package as well, if you arent animating it should just convert the model properly
having trouble just getting something to render at all with the new hybrid 0.50
feel like im taking crazy pills
mmmk, helps if i read the documentation
What problems?
Oi, not reading the docs, getting your head in a tizzy and getting stressed out is my job @mint iron
π i didn't have ENABLE_HYBRID_RENDERER_V2 define, and they changed the package manager to apparently not automatically list preview packages as upgrades, so there was a newer version of URP i didnt see.
π
do you ever envision switching to one fo the srps for the lifetime of your game eizenhorn?
Yes, I not only digging DOTS but SRP's also, because graphic programming is my second favourite thing, but we decided not switch to them at current state π But I always have couple test projects with latest HDRP and URP π
was curious given that you are kinda living on the edge using dots in production, srp + dots currently kinda feels like tiptoeing on the edge
- Addressables (using them actively) and UI Elements (which currently in frozen state in our project) π
We just haven't enough time for making workaround replacements for our shaders. But some day... π
You cant still use Addressables inside ForEach(Run) right ?
Without burst and with Run they should
i remember someone mentioning that Addressables was doing "invalid IL code" even it was used with WithoutBurst Run
We not use AssetReference in systems directly, thus can't tell you more, we use them for load things at application start asynchronous and converting all stuff to blobs, entity prefabs etc. and then we just use this regular things.
We not using them in a middle of game, because just don't need that π
how do you handle hybrid components that need assets ? if you have that kind of hybrid components
Many parts of our game procedurally generated, and all other things doesn't take much memory. full build takes just ~100mb π
how do you handle hybrid components that need assets ? if you have that kind of hybrid components
@opaque ledge which one (just example for understand your question)
lets say you have an unit on map and you want to have an health bar above the unit's head, assuming you are going to use Quad for it, that means you need a material asset to show to healthbar, or lets say unit is invincible and now you are going to make that healthbar yellow to indicate that unit is invincible etc..
i am doing all these from MB side, i just call the function from ForEach but MB side takes cares of the addressables and stuff
And this things same - I converted every thing at start
await doesnt work in ForEach for example
and have singleton entities with maps of things
yeah i understand that
also I wrote custom guid system
which not relates on unity serialization mechanism
and every thing have unique persistent ID
Which we using in all places
but i thought that was a bad practice since you are holding assets that you are not using inside memory, this is why Resources folder isnt used anymore
for get mesh\entity prefab\ etc
Bad practice if you have many things
we have small assets database
was your game for mobile ?
fair π
With this approach we also serializing\deserializing whole worlds to files as game saves, fully save game state, even animation frame, and when loading your swordsman will hit enemy right from millisecond when you saved that π
We have couple of pre-serealization\post-deserialization systems
just like Skyrim π
one of the best thing about ECS is serialization, everything is data so you dont need to do anything special π
how are you doing animations ?
from MB ?
Which moves things to different worlds, replace blobs and reference things to regular components with this unique ID, thus on serialization we don't serialize blobs and reference types, and store only easy serializable things
And on deserialization we process deserialized entities and remap from ID to blobs, animation meshes etc.
Thus when we release patch or dlc with changed parameters\meshes etc. even saved games correctly will handle that changes and will use them without problems
how are you doing animations ?
@opaque ledge custom rendering system with custom shader for animation. And animations baked in to textures. I also described all that yesterday π
ah okay, thats one level up above me π
I'm genuinely impressed since the first time I read your forum post about using it in production @storm ravine π
Updated a couple of packages this morning trying to get Linux build working, but running into something that seems like it SHOULD be unrelated to package updates:
Library\PackageCache\com.unity.netcode@0.1.0-preview.6\Runtime\ClientServerWorld\ClientSimulationSystemGroup.cs(148,56): error CS0103: The name 'm_systemsToUpdate' does not exist in the current context
Looks like this code SHOULD be using m_systemsInGroup, how did it ever compile?
Is there a new NetCode being released soon? Anyone know?
ah, there was a forum post about this
basically wait for new net package i suppose
@opaque ledge Oh, awesome. Thanks
Hum. Not super helpful in itself, though, is it?
Wonder if there's a temp. hackaround
Yep they moved many systems fields from protected to internal in latest release
A bit frustrating that they're not following their usual path and deprecating these until their own libs catch up
This SortSystemUpdateList() looks like a horrific hack anyway
@low tangle Heya, sorry to ping, there was a snippet for creating SystemBase inherited class, was that you who made/linked that ?
If so, can you put it again π
do you need to dispose a NativeMultiHashMap when clearing it?
ClientSimluationSystemGroup https://hastebin.com/kazulokoce.cs
ServerSimulationSystemGroup https://hastebin.com/ceremisofe.cs
That's the workaround that i use @sand prawn
clear marks the memory inside it as empty, it does not release the memory
Thank you^^
i know but it shouldnt be triggering a dispose error when just clearing right?
no it should not
Yea, and writing back to systemsToUpdate through reflection
oh was allocating a command buffer, was not the hashmap at all π
@north bay Thanks, that gets me some progress. I feel icky, though. Gonna go shower
It is. See it positive now Unity is forced to give us a new Netcode package π
oh neato, new packages (been off computer for a while)
earlier today we were all like, why didn't we know about this?!?!!
lol
well, ECS samples are still 2 months old
kinda weird that they dont push them since they keep them up-to-date internally....
@mint iron well now you know I haven't written a bot for that...
..which I totally should have
wondering when the next 2d entities will drop π€
oh, new entities now finally use that 0.3 platforms
since hybrid is updated, that hdrp lighting issue should now be resolved
and according to the forums they are working on the ambient probe fix
also, netcode package hasn't been updated and its not compatible with this latest update batch π
nothing new there though
they're doing something interesting with ArchetypeChunk, it can now have sub-chunk slices / EntityBatches (defined within the ArchetypeChunk)
/ spam
@dull copper you're a bit late π
I know π
changelogs already was in chat above π
heh
well that was a wasted effort then π
hmmm
since the platforms update was gone through, it means this is live now as well:```Build pipeline major overhaul: build pipelines are no longer asset based, and instead must be implemented in code by deriving from BuildPipelineBase class. Build steps are no longer mandatory but can still be used by deriving from BuildStepBase.
what do they refer to with the build pipeline assets? π€
I initially thought they were going to get rid of the build configuration assets but thats something different (or at least the old build conf assets still seem to work)
I did have to install platforms.windows package
in past you could just use platform alone
oh I thought the build pipeline assets were the build configuration assets too
Huh.
Does latest platforms package finally work with latest entities?
yes
it depends on 0.3 now
like mentioned above, I had to install platforms.windows manually for the building to work from build conf asset
Cool. That was the last package I couldn't get to the latest version without errors. The completionist part of my brain will be happy to have checkmarks on all my packages :)
try to install netcode package now π
Nooooo don't tell me that! I just added it last week!
In this session Unity evangelist Mike Geig chats with Peter Andreasen and Martin KΓΌmmel from our internal production team. You might know them as the authors of projects like FPS Sample, Megacity or DOTS Sample. Their focus is on ensuring our solutions and features are working...
In this session Unity evangelist Mike Geig chats with Peter Andreasen and Martin KΓΌmmel from our internal production team. You might know them as the authors of projects like FPS Sample, Megacity or DOTS Sample. Their focus is on ensuring our solutions and features are working together in production environments. They'll discuss what we've learned from their previous projects, and what the team is working on now.
Yep unfortunately it was short session π
To dispose a NativeMultiHashMap in a scheduleParallel Foreach (SystemBase) I can't use WithDeallocateOnJobCompletition()...
Should I dispose it at the end of OnUpdate()?
It says NativeMultiHashMap<int, float3> is an unsupported type for WithDeallocateOnJobCompletition
NativeMultiHashMap don't even support parallel writing..
You should indeed Dispose it at the end of OnUpdate, or at least after your job is complete
You can even pass the dependency to the dispose method to do it after the job is completed
Ok
Also, there's this: AsParallelWriter()
@wide fiber So you can use that to support parallel writing
π
It still doesn't work, I've tried in multiple ways (as you can see in the comments) but it always gives me the error (full error at the end of the paste)
Do you really get the same error when you use the ParallelWriter?
Show me a version where you use the ParallelWriter and it gives you the error
I think you forgot the code π
Well, you're still using the non-parallel one in your parallel job
The second Foreach?
Yeah
But I also see that you're only reading from it
So you don't need a parallel writer in this instance
Yeah
You just need to mark it with ReadOnly
In the ForEach
Entities.WithReadOnly(targetsQuadrant).ForEach(...).ScheduleParallel()
Ok
And then don't use the parallel writer anywhere
As your first foreach is a .Run
Which you can turn into a parallel one with a parallelwriter though
π
But one problem at a time π
Also, you should pass the dependency to the Dispose method of the native container, as it will be disposed before the jobs of the ScheduleParallel will get a chance to run
So I should put targetsQuadrant.Dispose(Dependency)?
Yep
@scarlet inlet about ForEach and different attributes, all attributes from job will work with Entities.ForEach it you create custom struct like you does that before for IJobForEach, (but without IJobForEach obviously) and use that struct inside ForEach. like that:
@storm ravine oh interesting thanks. I will keep that in mind, although it's less convenient
Depends. For big ForEach it's convinient, because code will be much cleaner and much more readable
In comparison with all this .WithReadOnly, WitnNativeXXX .WithoutXXX etc. π
And if systems use regular jobs code will be in similar fashion π
But for 1-2 line ForEach is yeah a bit boilerplate π
In my codebase I use that as described - for big ForEach - wrapped struct
For small - inline
Anyway it's up to you, I just gave you info about attributes π
interesting point of view yours
got a reply btw: https://forum.unity.com/threads/equivalent-of-noalias-for-entities-foreach.880057/#post-5789422
damn I think they might have broken a safety system thing when mixing JCS with SystemBases π¦ (edit: rolling back entities doesn't fix it, leaving me very confused)
Unless someone can see where I'm being dumb here? https://hastebin.com/burexahono.cs
Is it possible to use dots in combination with IL2CPP? I am asking because I wonder if I could use DOTS on the HoloLens2 which seems to only support Unity builds via IL2CPP.
Not sure about that device specifically but IL2CPP itself is fine.
Is there a reverse of NativeArrayUnsafeUtility.GetUnsafeBufferPointerWithoutChecks?
@bold pebble Yes, DOTS supports IL2CPP
@amber flicker System1 IJobChunk out of dependency chain, expected error.
Internal BeforeUpdate completes only jobs in dependency chain
Ah
Run
missed that
1 sec
with the JCS version you don't get an error in editor when hitting play?
I've tried with multiple editor versions, multiple package versions and in a clean project
because it not scheduling any thing
and Run right here
Ah
Yep
As I tol above
dependency chain
previous system (Sys2) use same type - Rotation
And you try to write to rotation
in ArchetypeChunkComponentType
Both versions of System1 write to Rotation
yes
but problem is System 2 read
And you write when it read
Race condition
which safety check tell you
yes.. but if you comment in the SystemBase version of System1, it works fine
even more simplified version: https://hastebin.com/akeyalemih.cs
may i ask why are you using JobHandle.CombineDependencies?
because this is a simplified version of code with multiple jobs
And in system 2 you don't need manually handle dependency it will handle that in System2 automatically
so how could I modify the JCS to include the dependency? Other than by doing what I've already done (via the query and the lack of [ReadOnly])
the SystemBase version compiles down to a version of JCS right?
Well, similar, it compiles with better codegen, but idea of dependency chain - same
So... are you suggesting that System2 is actually auto codegen including a reference to System1's job when System1 is a SystemBase? Surely not
that's cool... I guess I'm asking how I can add Rotation to the dependency chain in the case of a JCS
Problem is completing dependency chain
It's already here (Rotation in chain)
if you put complete on inputDeps in JCS you'll see that job which read will complete
hmm thank you.. I see. Does that mean every SystemBase is calling .Complete() on inputDeps?
Or replace to Schedule
your code works fine in my projectπ€
@warped trail which editor/entities version?
@warped trail put both systems
9.1 and latest alfa
you need at least one version of System1 commented in as well as System2
i just copypaste this https://hastebin.com/akeyalemih.cs
hmm interesting.. I'm on latest beta.. might try latest alpha
@amber flicker for fix that fot JCS put Complete on inputDeps or use Schedule instead for IJobChunk whih inputDeps
jobsdebuger on and full leakdetection
yup thanks @storm ravine understood that now.. just a bit confused how SystemBase is automatically handling that - I may try and look through source
oh, it works when you have something with rotation in scene and error with empty sceneπ
Yes
because otherwise system just not run
It's absolutely expected (behaviour and error both)
And recommend you drop JCS
the thing I can't understand is how this has only just become a problem for me.. π€· .. oh well
I'd love to drop the JCS but unfortunately it's a beast, very much in the hot path and very hard to replace without chunk api
Why?
It's very easy to change
you change only system itself
there is nothing super different between them (exclude that SB better)
Super fast replacement (even just by replace in file) JCS -> SB and inputDeps->Dependency
And just remove OnUpdate argument and return value
You still use same jobs (exclude IJobForEach)
sure, that part is easy.. the issue is at the moment there's a lot of conditional logic that chunk.HasComponent works very well for - not having to pay the cost of CDFE hascomponent
you can use IJobChunk in systembase π€
No one force you replace IJobChunk to ForEach
Moreover ForEach compiles exactly in to IJobChunk under hood
oh sorry, I misunderstood that you could have IJobChunk with SystemBase for some reason
No
nothing changed except OnUpdate signature and replacement inputDeps to Dependency (from system looks point of view, not count codegen)
You still use absolutely the same jobs (except IJobForEach which deprecated and Entities.ForEach it's replacement for that job type)
yup, that makes sense... thanks.. in my head SystemBase is tightly coupled with moving things over to lambdas but of course, that's not what you were suggesting π
Does turning a method into a lambda call optimise anything? Or is it syntactic sugar?
Once I get the pointer of a NativeArray using UnsafeUtility, how do I access the NativeArray with the pointer?
And how do I dispose of the NativeArray once I'm done with it?
GetUnsafePointer GetUnsafePointerReadOnly ? Ahh missread...morning
Well call Dispose π
Well you have pointer, you want get element
from pointer
Yes?
Yes, ideally I want to turn that pointer back into NativeArray so I can still use the methods and what not.
I don't have access to the original NativeArray that I get the pointer from, only the pointer now.
var ptr = arr.GetUnsafePtr();
UnsafeUtility.WriteArrayElement(ptr, 0, 5);
UnsafeUtility.WriteArrayElement(ptr, 1, 4);
UnsafeUtility.WriteArrayElement(ptr, 2, 3);
UnsafeUtility.WriteArrayElement(ptr, 3, 2);
UnsafeUtility.WriteArrayElement(ptr, 4, 1);
Debug.Log(UnsafeUtility.ReadArrayElement<int>(ptr, 1)); //Will be 4``` Simplified version with UnsafeUtility for example
Yeah but that means I need to change everything that uses it
Read\Write by ptr, but don't forget about safety, you always should know length of your array for exclude writing out of this array memory bounds
What do you mean
Like my function accepts a NativeArray, but now I need to write an overload that accepts a pointer.
I want if it's possible, to just turn the pointer back into NativeArray so nothing else needs to be changed.
Well thus you should use NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray
it will give you NativeArray which points to same memory
{
m_Buffer = dataPointer,
m_Length = length,
m_AllocatorLabel = allocator,
m_MinIndex = 0,
m_MaxIndex = length - 1
}``` How it looks under hood, where dataPointer is your pointer
What should I put as allocator?
I also read that you need to use SetAtomicSafetyHandle to set things up.
Allocator π€£ What a question
SetAtomicSafetyHandle Yes if you want safety system for that
But for that you should have initial array not as ptr and get handle from
So I just do ConvertExistingDataToNativeArray(ptr, length, Allocator.None)?
What about disposing, I can use it for that as well?
Why None
This obvious that you should use same allocator as initial array π
Because you work with pointer to memory which allocated with specific allocator
I guess I'm just confused what it's actually doing under the hood.
If the original NativeArray already have memory allocated, and I'm just trying to access the same memory with the pointer
And you work with that array like you work with original one
Then why do I need to pass it an allocator again if it's not allocating anything new?
Allocator itself it's just marker
which marks how allocate and deallocate memory
hwo your new array will know that allocator label for freeing memory if you have only pointer from original array
I posted image above
for same reason you put length too
because it's just helper parts of struct
Ahh okay got it.
So I just need to pass in the same things as when I created the NativeArray initially.
Yep, but anyway you need SetAtomicSafetyHandle because of internal checks
technically all work but will throw null ref error
because it will try to check safety here and m_Safety null
What does the safety handle stuffs do under the hood?
Prevent you from shooting in to feet
So basic stuffs like index out of range check, etc?
No
for that it has simple checks inside idexers\methods
Check if no one write when you read or read when you write
Cool.
So do the conversion, set the safety handler, and basically I can just use that as if it was the original?
Yes.
About dispose, because I can be not clear about that above
you should dispose only original one
Hmm
So I still need to keep the original NativeArray for disposing?
Can't I use the converted one for disposing?
Technically you will dispose and original one when you dispose new one, but because of safety handle it will complain that array not disposed, but if you'll try to dispose original one it will complain that it's already disposed π
Memory will be freed, but pointer (just number) in struct wasn't set to null
It can be tricky
That shouldn't cause any trouble though right
So it's just annoying error messages even though memory are correctly freed.
Memory yes, but it's not fine and error is trouble
π°
To give more context to what I'm doing, because you can't do NativeHashMap<int, NativeArray<float>>, I'm trying to use pointer in place of it.
And all future operations will just operate with the pointer and not the original NativeArray, which I won't have it anymore.
For that case I just wrote my struct
without any safety handle stuff
not native array, just struct which contains some utility methods and couple of pointers
And ofcourse couple of my own NativeContainers which also useful
but don't forget cover that by tests from every side
That's certainly an option but is there really no way around it?
Well you can store your original arrays somwere on system for example which only have on create on destroy
and dispose them on destroy properly
btw Eizen, you mentioned you report the bugs you find to ECS team ? i reported a bug that makes editor crash when a certain system runs, but it works pretty fine in build
i reported it 2 weeks ago but no answer
how much do they take to answer for your case ?
I don't know how many original arrays will be there and that's why I need a NativeHashMap of them
I spoke with them directly
They will answer, it just depends on how case importat, all have priority
For example? i reported a bug that makes editor crash when a certain system runs,
I mean what you see in crash and editor log
And what exactly cause crash, show that system which cause crash
I don't know how many original arrays will be there and that's why I need a NativeHashMap of them
@lusty otter well because safety handle you should use your own struct here
Main point of safety prevent you from something which you can corrupt easily
i already gave them the project, and necessary information, they only need to click 2 buttons to see π
but yeah fair, i just hope that it will be resolved soon
Welp, I guess in the end I still need to write an overload for functions that expect to work with both NativeArray and the custom struct then.
π
That means I'll have to change all my things to use my own struct.
It feels like we are just reinventing the wheel here
I know safety system is there to prevent people do dumb stuffs, but if I know what I'm doing and go so far, then I feel like there should just be a way to let us do it.
Well this is things which should be investigated on app architect stage π
Well you also can use unsafe collections here
but it anyway force you rewrite code to that unsafe collections
and this limitation about native container inside native container here from the beginning
This is why initial game architecture process important π
I use that case of NHM with custom struct for that region edges (magneta lines) (don't look at trees pattern and disabled fog of war π it's sandbox test scene for prototyping things)
I'm basically just making my extremely simplified ECS, NativeHashMap<int, array> the int here is just an entity identifier, and the array is fixed sized.
My project is also really tiny and nothing complex so I decided it's better to just use Job System and do with my own instead of introducing all these preview instability.
Well it was fine for us from first versions π
With own solution it's not guarantee you stability π
Right, but that decision aside, I'm really just trying to solve that problem of using NativeArray inside of NativeHashMap.
unsafe collections or own struct your options π
Yeah that's what I'll have to do it seems.
Just kind of a bummer that I couldn't just use pointer of NativeArray for rest of its lifetime.
Well because it's not just pointer but bunch of additional things
And not intended for that usage π
Because (how you all spoke it) regular joe wouldn't use that like this π
Heey guys
can somebody tell me how I can pause my game with dots with GO i could do timescale = 0 but I can't find a simular thing with dots
Same
i do that with singleton components, and make my gameplay systems require for that singleton component existence
If you can't "find" timescale inside system it's because you just should use not Time property but UnityEngine.Time
In our game we have own time system π
well I use dots physics will this work also
well they havent saparate tick yet, and anyway relates to timescale
And what prevent you from just put timescale = 0 by space press in any place and check if physic will stop π
it's sort of things which even not require any specific test sandbox, just one row because you already have something with physics in your game π
Hey, so have a bit of structural thinking question; I have three different kind of teleporters. One that moves a entity within same "space", one that moves from normal space=>special space, and one from special space=>normal space. (the three cases are different in fetching components etc) So I'm using triggers to check if entity enters teleporter. Currently I'm using a component for "teleportable" and different kind of component for each of the teleporters. I do the logical things in the TriggerEventsJob, which each are total of 30 lines something for checking if components exist etc. Would it be better to merge the teleporters into one component, and have a ID of what type of teleporter it is? Which would mean that I could use the same trigger and send a response with the entity, do a switch on a later job with the logic? Any good ideas of how to structure these things? x)
@storm ravine heads up, your suggestion didn't work. Add to put WithReadOnly anyway
you have to create struct outside of ForEachπ€
var tmp = new ComputeGroundCollisionJob
{
...
};
Entities.ForEach((...)=>
{
tmp.Execute(...);
})```
Because of lambda scope π
Yes struct outside
because in this case you access this containers already inside lambda which require them being ReadOnly, etc. at this moment
What should alignment be when using unsafe malloc for an array of floats?
Just size of float?
Array of floats is pointer to that array in your case?
And note about UnsafeUtility.AlignOf<T> it's hardcoded 4 bytes for any type π
Yeah I'm going to make my own struct to store array of floats
It would just has a pointer field, a length field.
Malloc when creating and assign the pointer to field, and Free when I'm done with it.
Be careful with just lenght field on struct because it will copy by value you will modify data pointer properly for all structs with same pointer but length field will be own by every struct π
Just remember that
You can use just UsafeUtility.AlignOf<YourStruct> which will be anyway 4
Thatβs fine, itβs meant to be fixed sized so length should never be modified (or pointer either)
Thanks.
Guys, when I press the play button it gives me an error (it's at the end of the pastebin).
The error's line is 97, it says I am reading from a write only container (I've not declared a WriteOnly container..)
You might need a concurrent structure access for the NHM
Because you using that in parallel context, you can't read and write here at the same time because of possible race conditions, which from safety check prevent you and throw error.
π€
I am not writing and reading at the same time, I said UpdateAfter(QuadrantSystem)
Shouldn't it wait for the quadrant system?
is there something different about dot product with DOTS? i've got 2 entities facing towards each other (0, 0, 0) vs (0, 180, 0) and the dot product for their rotations is 0. shouldn't it be -1?
UPDATE: directions work, just not quaternions
Computer don't know that you know that π
Also
it's pure native container
dependency not handle that
you should track dependencies manually
Ah you have shared type well thus you don't as side effect of tracking Translation it will solve that for you
You should only use WithReadOnly here
ReadOnly it's your case here
@storm ravine so in the Foreach of the HunterRadiusSystem I should put .WithReadOnly(QuadrantSystem.Quadrants)?
Yep
And it should work? (No other things to do?)
Ah no
Because of both systems
schedule independant jobs
They have shared Translation type
But because in both cases it's in thus they read only
and safety system decide that this systems jobs can run at the same time
WithReadOnly definitely will be required here
but dependency tracking also required here
Ok, I should study better how dependencies work
Just for fast check try put quadrant system deps to some static JobHadleField and use this dependency int HunterRadiusSystem and combine that deps and use as input for ScheduleParallel in HunterRadiusSystem
And don't forget add WithReadOnly for that ForEach
Static field only for fast check that it's problem
But it's definitely that π
Ok ty, I'll try in a few minutes π
@mint iron writing something loooong π
@mystic mountain i think for situations like that, assuming its still under a query RequireForUpdate and rarely executed, i would do whatever is most readable and pleasant to work with. Performance shouldn't really be a consideration there - if it only occurs at worst once every few seconds, then it probably doesn't matter if it takes 0.15ms or 0.01ms. I'm starting to prefer using multiple tag components instead of a merged component with id; because it tends to make the code cleaner when you can have a cleanly triggered system by ForEach or group multiple ForEach blocks within one system if they're related. Even in perf critical situations, the tag approach is often worth the cost upfront unless it needs to be added/removed a lot. The only thing to be careful of is that in GetComponent chunk calls they iterate every type used, its fast but if you're getting a LOT of components on one entity then it will cost you.
I knew
hehe
@storm ravine it says WithReadOnly can only be used with a local variable (QuadrantSystem.Quadrants it's another class)
Yes var map = QuadrantSystem.Quadrant
So if I try and access a blobString directly I'm told I need to access it by ref. And if I try to access it by ref I'm told to access it by ref. I'm sensing a issue here.
ref BlobString desc = ref Database.Reference.Items.Data.Value.data[cargoBuffer[i].index].description;
@mint iron Cool, thanks for the input. Since it's a TriggerEventsJob I don't think I can exclude it from always be queried as the teleporter and player are always present.
And yes that madness is a blob string
post exact error please
\Scripts\CargoSystem.cs(21,21): error MayOnlyLiveInBlobStorageViolation: BlobString may only live in blob storage. Access it by ref instead: ref BlobString yourVariable = ref ...
I was still using QuadrantSystem.Quadrants inside a function called inside lambda π π
Yes it's what I wrote above
π
@mystic mountain ahh i see what you mean now, well hopefully it will stimulate other people to repsond! π https://discordapp.com/channels/489222168727519232/497874303463850004/705752718693761051
@loud matrix I guess it error also contains Access it by (non-readonly) ref instead?
Thats the entire error minus my folder structure
The reference to it is yes
namespace Database
{
public abstract class Reference
{
public static readonly SharedStatic<BlobAssetReference<ItemBlobAsset>> Items = SharedStatic<BlobAssetReference<ItemBlobAsset>>.GetOrCreate<Reference, ItemsKey>();
private class ItemsKey { }
}
}
does the .data array indexer return by ref?
Well
Hey @dull copper have you tried the build configuration pipelines with subscenes by any chance π€
No the data is just a BlobArray
And if i reference it to then get the description I get the same error
@coarse turtle oh right, I haven't
but I do know they work without subscenes as that I did test π
I'm not really looking to get back in trouble with dots subscenes again
ah ok - no worries just curious if you tried it by any chance
do you have issues with it?
Will it complain if you do ref var blob = ref Database.Reference.Items.Data.Value; and then acces blob.data[idx].description?
That's what im trying now
Technically that should solve it at first thought
Honestly I've no idea if its a direct issues with subscenes - it might just be w/ Android gradle π€
ref BlobAssetReference<ItemBlobAsset> reference = ref Database.Reference.Items.Data;
ref BlobString desc = ref reference.Value.data[cargoBuffer[i].index].description;
Debug.Log(desc.ToString());
that doesn;t have a compil;ation error, however it does error on run
string desc = reference.Value.data[cargoBuffer[i].index].description.ToString(); too?
And which error btw
And one more
Burst error BC1016: The managed function Unity.Entities.BlobString.ToString(Unity.Entities.BlobString* this) is not supported
Yeah it runs fine without burst
strings not supported directly in burst
This is why you see that error
They added limited support for debug strings
Well that problem solved then? π
i switched over when trying out the sample code and pasting it here to avoid confusion :p
Now i just need a new job logger that doesn;t cap out at 3 logs for some reason, or get debugging in Visual studio working with native debug mode compilation
Burst new package π
finally
btw, just noticed UnityNow finally has easily navigatable webpage: https://resources.unity.com/unitenow
Oh goodie, I heard through the grapevine they were adding string support of some kind
Where is the talk Mike?π‘
GDC Summer will be completely virtual as well btw
maybe he'll prepare it for that π
altho at this point, I could see Unity moving all their stuff for UniteNow/virtual Unite
## [Burst 1.3.0-preview.11] - 2020-04-30
### Fixed
- Fix potentially different hashes returned from `BurstRuntime.GetHashCode32/64` if called from different assemblies.
- Fixed an issue where Burst was misidentifying F16C supporting CPUs as AVX2.
- SDK level bumped for MacOS to ensure notarization requests are compatable.
- Fixed a typo `m256_cvtsi256_si32` -> `mm256_cvtsi256_si32` and `m256_cvtsi256_si64` -> `mm256_cvtsi256_si64`.
- The compiler is now generating a proper compiler error if a managed type used directly or indirectly with SharedStatic<T>.
- Fixed a bug where implicitly stack allocated variables (`var foo = new Foo();`) in Burst were not being zero initialized, so any field of the variable that was not initialized during construction would have undefined values.
- Fix potential race condition when accessing on-disk library cache
- Fixed a bug where Burst was sometimes producing invalid code for iOS 11.0.3+.
### Added
- Added support for `System.Threading.Volatile` methods `Read` and `Write`, and for the `System.Threading.Thread.MemoryBarrier` method.
- New FMA X86 intrinsics. These are gated on AVX2 support, as our AVX2 detection requires the AVX2, FMA, and F16C features.
- `UnsafeUtility.MemCmp` now maps to a Burst optimal memory comparison path that uses vectorization.
Fixed an issue where Burst was misidentifying F16C supporting CPUs as AVX2. π₯³
tbh, I don't know if AVX2 is even worth enabling at the time
I guess it gets more common with Ryzens
but its still quite nice on consumer CPU's
when I last tested it, AVX2 did have small gain to AVX but it wasn't notable difference
i hate this new package managerπ€¬
2020.2.0a9?
yeah
yes, I ranted about that earlier
it's like EVERY UX change Unity does
they first screw it up monumentally
then people start crying about it on forums and in 6 months, they've fixed half of the issues
same pattern repeats all around the engine where they change things
they never seem to ask actual users about these changes beforehand.. so basically every UX update ruins basic usability
what's the new package manager look like?
horrible π
π
I mean, I do like the new color coding
it looks like giant waste of space
but they've totally made it so much less usable again
main list it twice long now because they put useless info and icons there
they force you to expand for dependencies and samples
also they can't even display full package description without you having to expand the 4 line long description despite there's like 20 rows free on the bottom
oh :/
it looks a little bit better with dark themeπ
also this folder+ icon on all packages list....
like, it's listed... why point out that I can install it
whole icon is 100% pointless
and clutters the visuals
at least they could put it on same line
I hate the space wasting on the big list the most
I now have to scroll to even see my installed packages
in the old setup I could fit all in single screen
So i'm using the DOTS sample Game Debug script https://github.com/Unity-Technologies/DOTSSample/blob/master/Assets/Unity.Sample.Core/Scripts/GameDebug/GameDebug.cs modified to remove the bits i don't need and just keeping the string logging for now. Whenever I use this, or similar scripts in a job it only seems to want to log twice, then srops. If i do it without burst it runs every update but when scheduling its only 2 times (2 times, then an error then once more if there's an error for some reason).
Any idea why this is?
IOException: Sharing violation on path D:\Documents\Projects\Unity\UGUIDots.Samples\Temp\Android\gradleOut\local.properties
Hmm shoot wondering what's causing this with the build configs - guess I'll post on the forum π€
math.cross is the function to get the angle from two float3? (I am noob)
no
Sorry I need a function to get the angle between a point and a quaternion
Basically I need to know how near (in rotation, so "how much aligned") is my turret to the target. The target is a point in the world, for the turret I have the Rotation quaternion
I want the turret to fire when the angle is near enough
When it's aligned enough to the target
(Sorry for my bad English)
dot product is what you need
Ok ty
If you need exact angle you can get it
But I have a quaternion (the rotation of my turret) and a float3 (the position of the target), math.dot doesn't accept 2 arguments of these types
I am not very good in math π
math.mul(rotation.Value, new float3(0,0,1)) will give you forward vector of your turret if your rotation is in world space π€
Ok
But stop
Ty
math.dot accept 2 quaternions
{
var dot = math.dot(q1, q2);
return !(dot > 0.999998986721039) ? (float) (math.acos(math.min(math.abs(dot), 1f)) * 2.0) : 0.0f;
}```
I wrote some methods for myself, and math.dot definitely accepth 2 quaternions
Yeah I know that but I have a quaternion and a float3, not 2 quaternions (I have found the way)
And it's in radians
just multiply result by * 57.2957801818848
will give you eulers
math.degrees()
π
Hey,
Does anybody have an idea how to fix this? Google and Forum didn't help finding a solution.
ArgumentException: A component with type:BoneIndexOffset has not been added to the entity.
@wide fiber Well mul of your quaternion to forward vector will give you world forward
Trying to get a SkinnedMeshRenderer renderer through HybridRenderer V2 in URP. I already added the Animations package but that didn't change anything.
It's known bug iirc
CopySkinnedEntityDataToRenderEntity throwing that behaviour, as temporary workaround disable that system and destroy
I wasn't sure if it should work in the newest version. Thank you for clarifying!
math.mul(rotation.Value, new float3(0,0,1)) will give you forward vector of your turret if your rotation is in world space π€
@warped trail Rotation (the Unity component) is in world space? Could I also use LocalToWorld.Forward instead?
i guess you canπ€
did they rename Animation package to Animation Rigging or is that something else
@mint iron that is something else. The Animation package is semi-private
@wide fiber but be aware that LocalToWorld is basically data from previous frameπ€
Ok
@wide fiber but be aware that LocalToWorld is basically data from previous frameπ€
@warped trail no, depends where you use it before or after transform system group
But anyway 1 frame doesn't matter here
My game is a top down 2D shooter, sprites rotate in the Z axis (I forgot to mention this π
)
I've tried also LocalToWorld.Right and .Up but they give me wrong values.. I'll post pastebin
Maybe I've solved the problem
So
var angle = math.degrees(math.dot(localToWorld.Right, otherPointPosition));
should work? (Objects rotate on the Z axis)
degrees converts from radians to degrees π
math.dot returns what?
not radians π
Ah ok..
And how can I convert the return value of math.dot into degrees? (It returns a float, I don't know what it is)
Look at my Angle above
for 2 vectors you need something like that:
{
return math.acos(math.dot(v1, v2) / (math.length(v1) * math.length(v2)));
}```
Ok ty :D
these update is cool, you can easily add components to subscenesπ€
@mint iron its just animation https://packages.unity.com/com.unity.animation
public unsafe struct UnsafeFixedArray<T> where T : struct {
public int Length;
public Allocator Allocator;
public void* Pointer;
public UnsafeFixedArray(int length, Allocator allocator) {
Length = length;
Allocator = allocator;
Pointer = UnsafeUtility.Malloc(length * UnsafeUtility.SizeOf<T>(), UnsafeUtility.AlignOf<T>(), allocator);
}
public T this[int index] {
get => UnsafeUtility.ReadArrayElement<T>(Pointer, index);
set => UnsafeUtility.WriteArrayElement(Pointer, index, value);
}
public void Dispose() {
UnsafeUtility.Free(Pointer, Allocator);
}
}
Does this look good?
looks fine, i'd put the ptr first as a general rule so it can be cast if needed without calculating the offset
how long is your length going to be?
Small, 64 currently.
have you considered using FixedList64?
That's how I used to do it, for what I'm doing (64 of floats) I need to use FixedListFloat512 and waste half the space.
@safe lintel how would i install it?
When I play my game, after a few seconds the unity editor crashes randomly (also if I build the game, the build crashes). I can't understand the problem, does Unity log things on some file?
are you using Visual Studio?
VS code
@lusty otter just out of curiosity, have you considered creating FixedList256 yourself? π€
what i do, is find the crashes folder (mine is C:\Users\{user}\AppData\Local\Temp\Unity\Editor\Crashes) and then open the .dmp file in visual studio, Start Native Debug and checkt he call stack, it will sometimes know the exception line in source code if your project was generated with all the packages, otherwise you can glimpse an idea of where issue lies from the callstack.
Hello,
Is it requited to use ECS, meaning entities concept, to be able to use Job and burst ? I'd like to thread and "burst" a method that needs to compute datas and applied them to Monobehaviours.
@gusty comet no u can just use Burst/Jobs without ECS.
@warped trail How would I do that?
@mint iron there aren't folders created today at that path.. When the editor crashes basically it first freezes, then it closes randomly, without the pop-up of the crash
ugh, thats the absolute worst situation.
@lusty otter just look at source codeπ€
Also the length is small but it can vary, it's still would be a headache to create and change lots of them whenever the length I'm using changes.
If I build the game when it crashes a "pop-up" (I think the UnityCrashHandler.exe) appears
The crash stack might be inside the editor log
It's in appdata
C:\Users\Username\AppData\Local\Unity\Editor
Ok
Is that file deleted and recreated every time I open the Unity Editor?
(How can I understand when the log has been written?)
Anybody know why GetSingletonEntity<MyComponent> might return 0 when I can confirm there is exactly one entity with that component in the debugger?
does it have Prefab or Disabled components on it?
it might have a Disabled...
Does Convert wrap-up before the first InitializationSystemGroup call?
I see what happened..
Once I add a disabled component, I can't get that entity anymore with GetSingletonEntity
So I succeed the first time only
i think so, except that runtime conversions with IConvertGameObject will convert whenever the GameObject is instantiated, and SubScenes are pre-converted but get added to the world in the InitializationSystemGroup in SceneSystemGroup so if you need to access that data you'd [UpdateAfter]
Good to know, thanks xzjv!
I have 2 burst errors, you can see them at the end of the pastebin, the first error is at line 33, the second at line 154
Boxing a value type to a managed object is not supported is the first error.. Can't I use .HasFlag()?
try checking the flag manually, HasFlag has always been absolutely rubbish in c#
Ok, I'll try..
The second error?
Loading from a non-readonly static field is not supported
Can't I use static variables?
Maybe I should put .WithReadOnly()
you can use static readonly variables
in an EntityQueryDesc, if the component is a dynamic buffer, does it change anything to the syntax(ComponentType.ReadOnly<DynamicBufferType>()) ?
in an EntityQueryDesc, if the component is a dynamic buffer, does it change anything to the syntax(
ComponentType.ReadOnly<DynamicBufferType>()) ?
@zinc plinth not from what I've seen
alright, thanks !
@mint iron but I can't use read-only variable, I change the value of that variable outside the Foreach.
I can't even use .WithReadOnly() because float2 is unsopported
i think flag enums arent supported in Burst
@opaque ledge did you say you were using nativeHashMaps in a shared static?
yes
I'm having a play with it, does seem a lot easier than Blobs to access and setup.
It does not seem to like the shared static, you ever have issues with creating the shared static? It thinks ive created it before Unable to create a SharedStatic for this key. It is likely that the same key was used to allocate a shared memory with a smaller size while the new size requested is bigger I've probably doen somethig dumb in there somewhere :p
Flags are fine in burst, its just checking some bits
public static unsafe class UnsafeExtensions
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe bool IsFlagSet<T>(this T flags, T flag) where T : unmanaged, Enum
{
return (*(int*)&flags & *(int*)&flag) != 0;
}
}
Yeah they are working in another script normally (where I don't use .HasFlag())
I have 2 burst errors, you can see them at the end of the pastebin, the first error is at line 33, the second at line 154
The first error is caused by HasFlag()?
store it in field outside of ForEach
like with Quadrants
and just use that field inside
@storm ravine are you using the unity Animation package or you rolled your own custom solution?
Well I can tell my animation story third time through 2 days π
sorry :S
I'll give you link to previous messages
i only processed that you were using it through shaders, which animation package does too.
thnx
store it in field outside of ForEach
@storm ravine I think the problem is float2..
It doesn't give me errors for the other static variables
Is there any way to stop Static Optimize Entity? Or do I need to keep stuff in seperate hierarchies?
It gives me an error also at the "getter":
public static float2 MapOffset => _mapOffset;
I'll post code and errors in a few seconds
At the declaration
It gives me errors also for the other types
Again - you should store them OUTSIDE ForEach in local variable
Yeah but there is a problem also at the line 28
Ah sorry
Which is outside functions
it's different system
1 sec
Yeah, it's static fields on system
Same
you should store them outside ForEach in local variable
I hate the fact that I need to store a local variable to use the global static one.. can't the compiler add it automatically :(
Ok
Even if they wouldn't be static
and just non static fields on system
you'll get error
The burst compiler should support this
It's not burst compiler thing
I mean burst compiler of course but not fully on that π
π
you can put them into native array and you can access them inside your ForEach
Now I can't even build, I'll send the errors
and you have to dispose after ForEach
@opaque ledge Are you talking with me?
yeah π
The variables are of different types
make different arrays then^^
Ah ok
you can put them into native array and you can access them inside your ForEach
@opaque ledge unnecessary, they just should be declared ourside of local lambda scope. Even with native array you'll see same error if that native array is system instance field. There is no need use native containers here at all π
π€
yeah i see, yeah you have to catch them outside of ForEach, locally
And for just float\int etc. same rule
It gives me these errors when I build
I think now it should be workinf
And just my personal note - this bunch of statics is a mess for me π it require additional dependency managment meeeh π It potential place for problems with disabled domain reload π Code become ugly π But it's only my toughts π
What should I do to improve? I don't know other ways to do it
(Well actually I've disabled domain reloading to start playing faster, because I am temporarily using a pc that is really slow)
It works, ty :D (sorry if I am stupid but I am still learning a lot of things, I am 16 years old so yeah)
Well statics of coure simple
But when project grow....
If you look above at video of our region system. I just use singleton entity which can be queried anywhere, which store areas regions and links. some system query and fill values, other systems also can query that entity and read values, dependency chain builded automatically based on component type of that entity
this component type is class IComponentData, not struct
And cleanup system just query all similar type singleton entities end dispose native containers
So singleton entities may be better for this?
An entity with a component that is singleton
Also it allow you use Require methods for preventing systems run utill required entity with maps\configs\etc. not created yet
π
Thus you can easily load every thing asynchronously (this is what we doing for every thing)
how do you do camera culling Eizen ?
I converting that and have controller system for that
i am doing with adding/removing tags but i was wondering how you do it
and query camera through my component type wrapper
This is camera inside wrapper
And wrapper
all components on camera converted through companion
And system with var cameraRootEntity = GetSingletonEntity<MainCameraRoot>();
@mint iron just add it to your manifest latest is "com.unity.animation": "0.3.0-preview.9" but its not compatible with the samples unless you update it yourself, preview.7 is compatible though
i cant figure out how to use humanoid animation clips with it though π¦
And on conversion I just put Camera entity reference in to root entity component field
Ang can get camera entity from cameraRootEntity easily
Aaaaah culling
sorry miss that part of message π
Tired a bit
I have region system
and every object know in which region he is (by sampling cell position) and region know animation renderers in region and rendering system iterates through visible regions. Because I have custom animated only buildings parts (which static usually) and units\citizens\fish it works fast on ~50k, tbh even without culling it works without problem π All trees rendered by HybridRenderer, I just wrote small wind shader fot them. Same for cliffs just static entity with regular shader. And for ground again custom triplanar shader with HybridRendere
cause unity doesn't do what he need :S
Because we started using DOTS when nothing was a thing except basic jobs\burst\systems
And I wrote all that for myself
lol was thinking the same thing earlier
And if it works very well for our game and optimized, why I should drop and use something from Unity? π
Same for navigation, physics etc.
"this guy just like the unity splashscreen"
you should put it on the asset store then profit
And because we have full control here and implement only things which we need, without any additional things which may (or may not) have even small cost
"replacement game engine" for unity
id buy it
Well, navigation and fog of war will be on asset store
Old video
We implemented fog o war as post processing effect with Job system, which collects fog affector) instead of old way with second camera, which was very expensive, cause of culling, and our navigation system highly improved!
OOOOOH i forgot to buy fog of war asset in spring sale off π¦
is it still going π
but your men run through the trees π
just kidding around, looks awesome
we decided that for convenience, trees walkable
You can look video above with region system
where I enable debug move
you can see red cells
One more old video
First iteration of siege machines
Without rotation smoothnes etc.
Red cells in case of buildings and cliffs it's rasterized to map obstacles (sandbox scene without enviroment randomization don't look at this)
Technical look at our improved region system
About collision and local obstacle avoidance in my custom collision system and navigation
this video is wicked https://youtu.be/2Pc8pZ3DfjE?t=32
cause the its fun seeing hordes of guys get smashed and go flying
sorry, yeah, child of the 90s, i sometimes throw in a 'wicked' or 'rad' here and there
awesome, i'm from NZ but I've tried learning German, and now i need to learn French. I have a lot of respect for people who can speak multiple languages.
this video is wicked https://youtu.be/2Pc8pZ3DfjE?t=32
@mint iron And camera controller here also old π Currently I drop that and wrote new one, much more convenient and smooth.
i saw people taking materials from a stock yard, do you have to mine resources and then use that stockpile to build stuff?
it looks like they are billionsπ€
i saw people taking materials from a stock yard, do you have to mine resources and then use that stockpile to build stuff?
@mint iron yep all resources is not numbers in UI
It's real objects
if you have 100 wood
youl see exactly 100 wooden planks on storages in sum
thats so unnecesary lol. Great stuff
construction and producing not abstract too
If you need 20 wood and 10 stone for building
You put building on map
And builders shoud transfer 20 wood and 10 stone from storage in real time
if builder died (from hunger, age, desiese) he drops resource
and porter should go, pick that resource and transfer back to storage
Until produced resource (food for example) not transfered from farm to granary - it not counts in UI
only after transfer you can use that
and if all porters died and you havent food in granary will be hunger
even if you see many food on farms
Also died peoples is real things which spread desease
and gravediggers should transfer them to cemetery and bury them
Construction example
i can see you are taking inspiration from dwarf fortress
most of those mechanics are a thing there
thats also quite a lot of complexity, is it all done in DOTS?
Nope at all. Stronghold mostly π with settlers and they are billions
how many systems you have
Fully on DOTS
what a madlad
how do you think it scales on such amount of mechanics?
as in dev-time, programming flow
around 80-90 systems I think
It scales very well on them
ususally systems very atomic
Like Day\Night system just rotates sun. Food Consuming system just reduce food in granaries and calc hungry people and decide they hungry long time (some range) and if yes - mark them to be killed at end of frame
All DOD very convinient for me. After many years of OOP programming (enterprise, before gamedev and mix of OOP and COP in Unity)
old video too
Here you can notice cemeteries, where every tombstone is real buried citizen π on 1:10
looks awesome π€
Medievil they are billions, looking good π
and here i was just being happy because i implemented quest/mission system π
joking btw, wishing you my best π
Getting
InvalidOperationException: The type Unity.Collections.NativeList`1[System.Int32] used in SharedStatic<Unity.Collections.NativeList`1[System.Int32]> must be unmanaged (contain no managed types).
after burst 11
What version were you on previously?
10
"The compiler is now generating a proper compiler error if a managed type used directly or indirectly with SharedStatic."
but its NativeList with int generic
and it was working properly
This is why you can't use NativeContainer inside NativeContainer
i thought that was because they were simply not blittable, not because they are managed
why do we dispose them if they are managed ?
and why it worked properly before ?
Not properly there was bugs which you just not caused
so it was a bug that it was working 'properly' ?
They not working properly, you just not noticed problems π
On forum you cand find threads
I just can't remember them exactly
why do we dispose them if they are managed ?
@opaque ledge you disposing pointers inside
well i am kinda screwed then
native containers contains managed things too
how am i suppose to fix this problem
not only pointers
Come CurlyOne,, join me in confusing blob bliss
i am kinda sad rn
what if you swapped it to its unsafe counterpart? π€
yeah thats what i am going to try
whats worse is that the dispose sentinal will get garbage collected because no class holding on it, and report a leak :S
btw if someone interested in our game (as game, not tech part, about tech part I'll post on forum and here, because they directly connected with DOTS), and look funny roadmap, gifs etc, join our game discord, because it will be offtop to put it here π
is there a way to use unsafe with the systembase lambda?
just like accessing a colliders pointer
yep, thats how you cast raycasts actually π
just access them? π
like old IJFE private unsafe struct MyJob:IJobForEachetc not sure what to do for the ForEach
wrap unsafe part to unsafe {}
ahh thanks
alright, making to Unsafe versions actually solved it (at least no errors)
for shared component filters in entity queries, the filter is by the overall value of the struct or ?
for shared component filters in entity queries, the filter is by the overall value of the struct or ?
@zinc plinth it should be the value in the struct - I'm pretty sure they use a hashcode to determine equality.
Hard to read sentence π But if I understand your question right - it's up to you, because you implement IEquatable
Oh right in ISCD you also have to override IEquatable - think @storm ravine is right - it might be using that instead π€
And if your IEquatable implementation use 1 field it will filter by that field, if you use more and calculate hash by 2-3 and more fields it of course will relate on that, because you will use them for hash calculation
Anyone have any resources for someone far too used to runtime languages and needs a refresher on managed/unmanaged with unity? I can't find much outside of basic "this is the stack, this is lifo" memory stuff with c#. It's coming up an awful lot with ECS and i think i should probably have a firmer grasp in my head. not sure what I should be googeling :p
this guys videos might be helpful https://www.youtube.com/user/briantwill/videos
i like how no nonsense it all is
Hmm there is this little library I used, https://github.com/mtrebi/memory-allocators (done in C++ but the concepts should translate)
we got nothing going on, post your questions
The question is currently just what in unity is managed or unmanaged, but I know there are things I don't know to ask, that;s why I'm looking for some more resources.
But it's not Unity specific π C# docs should cover that π
Or I understand your question wrong?
I've not seen them called that when looking for c# docs related to it
unmanaged keyword for example? π
Why are c# tutorials and docs eigther written as babies first code or arcane runes?
?
The microsoft docs are a extremly hard read, but the alternative seems to generally be literal introduction to c#, but they sprinkle in a single useful, nugget every 30 min video.
Hm, MS docs one of easiest imo
I've had to dive into them a couple times before when fixing up .net websites we still support at work from like 10 years ago, so we didn't get off on the best foot
my mind cant handle microsoft docs, i need to search problem + stackexchange to make sense of things most of the time π
i need that eli5 breakdown
One thing I can't seem to find defined is if unitys "native" functions are synonymous with unmanaged, as I've heard some sources say to just assume they are, others disagreeing. Looking at nativeArray in the docs it says it exposes a buffer of native memory to managed code, so it sounds like they're using it as a bridge between the two. But without looking up every function it's hard to tell.
