#archived-dots

1 messages Β· Page 287 of 1

rustic rain
#

not through build menu

gentle harness
#

Where do I assign the scene to the asset then?

rustic rain
#

scene list

gentle harness
#

And where is the scene list?

rustic rain
#

it's a component

gentle harness
#

Ah, that's what you meant

#

I must have misunderstood earlier

#

It works now, sweet, thanks

rotund token
#

the preview one right?

misty wedge
#

Yep

rotund token
#

that doesn't have the burst cache fix

#

i highly recommend you go to 1.7.2/1.7.3

misty wedge
#

What issue does the fix fix?

#

It incorrectly caches burst functions?

rotund token
#

anything before 1.7.1 the burst cache gets corrupted

#

and your jobs won't recompile

misty wedge
#

Ah, that explains a lot

rotund token
#

hence you get random null refs and other issues

misty wedge
#

I was seeing "old" behavior from some burst functions

rotund token
#

this issue is close to my heart because i spent hours working with a burst dev to provide them data as I had a somewhat reliable repo but they couldn't repo it

#

then took them 3 weeks of work to actually track down problem and fix it

#

it's this super weird combination of things

#

but yeah it hasn't made 1.8 yet as the preview was released before 1.7.2

misty wedge
#

Well done πŸ™‚

#

I wasted a few hours on it too today, thanks for letting me know though, I'm sure it would have cost me even more time down the line not knowing

rotund token
#

it was absolutely gutting our build machines

#

which constantly change branches and run integration tests

viral sonnet
#

found a way to still get simd. int instead of bool

rotund token
#

i'm curious what this burst looks like

#

(also what is AddRemoval)

viral sonnet
#

inlined method to ensure ushort doesn't overflow

#

it's one hell of a burst assembly! πŸ˜„

#

even without the bump. give me a sec

rotund token
#

ther is a lot of non simd in there

#

and multiple jumps

viral sonnet
#

yep, but not bump version related. i still have to find out how to improve that

#

first time i split a job and it got from 1.8ms to 0.48ms and 0.11ms

#

the second timing is the posted job

#

i think the jumps are related to how many values are loaded into the register

#

or the jump is related to the continue

viral sonnet
#

i have to say, now that I have a grasp of utilising version changes gracefully, it's a lot of fun πŸ˜„

#

using write handles with RO pointers and bumping version manually was the key. without the custom changeVersion method I would have no idea how to do it

#

Unity should really make this a public method.

rotund token
#

without the custom changeVersion method
technically you can just use GetNativeArray to bump it, you don't need the custom method

#

i just like the custom method to be clear what's happening

viral sonnet
#

sure, it just has a lot of unnecessary overhead. I'd never recommend using that to just bump the version

rotund token
#

hmm, i find it unlikely 1 call per chunk (and that assumes every chunk has changes) is not going to be noticeable on the profiler vs the SetChangeVersion

#

you could also just use GetComponentDataPtrRW as well to remove overhead even more

#

i'd actually be surprised if burst doesn't strip a lot of the overhead anyway as it's returning something unused

viral sonnet
#

it will be noticeable in a full running game with 10000s of chunks. not game breaking sure but why not take the shortcut. The other methods have lookups into arrays that have already been done at that point. never checked if burst removes that. possibly

#

unity hasn't really made it easy to work with versions because of some questionable auto magic without parameters. that stuff could be noob-friendly with just a pre-defined parameter. anyone goes like, bool bumpToGlobalVersion = true. - huh, yeah I want that, or not

#

and versioning is such a key factor to proper ecs usage. i'd bet, most people who use ecs don't use versioning right

#

at the end if the day it's about control and you only have control over versioning in unsafe space. that alone should be reason enough for changes

errant hawk
#

hey so im finally taking a look into DOTS, but I have one major issue when playing (event an empty scene) my FPS tanks massively because of console spam saying there's old allocations being deleted

viral sonnet
#

do you have the netcode package installed?

errant hawk
viral sonnet
#

limit to 60fps. (vsync or Application.targetFrameRate) it's a known issue

errant hawk
#

huh.. weird

viral sonnet
#

wonder why one of those methods doesn't work: ```// works
private UnsafeParallelHashMap<int, BlobAssetReference<SpellBlobRoot>> blobLookup;
blobLookup = *...blobLookup.GetUnsafeParallelHashMapPtr();

on job: blobLookup = blobLookup,
in job: public UnsafeParallelHashMap<int, BlobAssetReference<SpellBlobRoot>> blobLookup

// doesn't work
private UnsafeParallelHashMap<int, BlobAssetReference<SpellBlobRoot>>* blobLookup;
blobLookup = ...blobLookup.GetUnsafeParallelHashMapPtr();

on job: blobLookup = *blobLookup,```

rotund token
#

on job: blobLookup = *blobLookup,
why would you think this was safe?

viral sonnet
#

why not? it's the same as blobLookup[0]

rotund token
#

sorry highlighted wrong line

private UnsafeParallelHashMap<int, BlobAssetReference<SpellBlobRoot>>* blobLookup;

#

how are you pinning your UnsafeParallelHashMap<int, BlobAssetReference<SpellBlobRoot>> in memory?

viral sonnet
#

it's a private variable in the ISystem

#

do you think it gets lost? hm

rotund token
#

what would you expect if you have a private variable int in ISystem

#

i wouldn't have expected the value to be pinned

#

not that I've tested this, but that would not be my expectation

viral sonnet
#

why would I need to pin a pointer to unmanaged memory?

rotund token
#

you aren't pointing to unmanaged memory

#

you're pointing to a struct

#

that holds a pointer to unmanaged memory

viral sonnet
#

oh damn, internal UnsafeParallelHashMap<TKey, TValue> m_HashMapData; i could have sworn this was a pointer. what the hell was I looking at before ...

#

i was looking at internal UnsafeParallelHashMapData* m_Buffer; ok that clears things up then...lol thanks

#

looks like my DB stat change referencing works with removals. that was quite the pointer juggle πŸ˜„

#

had to add this little method ```public int RemoveAtSwapBackReportIndex<T>(DynamicBuffer<T> buffer, int index)
where T : struct
{
buffer.Length -= 1;
// ref var l = ref buffer.Length;
// l -= 1;
// int newLength = l;
if (index != buffer.Length)
{
byte* basePtr = (byte*) buffer.GetUnsafePtr();
UnsafeUtility.WriteArrayElement(basePtr, index, UnsafeUtility.ReadArrayElement<T>(basePtr, buffer.Length));

            return index;
        }

        return -1;
    }``` and I'm confused what they are doing with the ref l and then newLength
#

did you ever test ISystem ECB? is it actually faster?

rotund token
#

i don't expect it to be any faster

#

just let me used ECB in ISystem

#

i'm not really using it because I can live with 2 systems being SystemBase for now

#

since ECBS support for ISystem is coming in 1.0 anyway

#

was just more of a challenge

muted star
#

I just logged some info about the custom transform systems I would like to add to my simulation world.
The custom TransformSystemGroup is successfully added
However all the custom systems like the EndFrameParentSystem aren't added to the TransformSystemGroup, even though they have the correct UpdateInGroup attribute.
Has anyone else experienced this issue before?

devout prairie
#

Maybe your custom system is expecting the older EndFrameParentSystem to exist?

muted star
devout prairie
#

Ah so it's not necessarily deterministic on all platforms

rustic rain
#

what the

#

the hell 8.6ms is wasted on

rotund token
#

Either vsync or the CPU is waiting on gpu to finish last frame

rustic rain
#

no Vsync

#

yet fps is locked on 74.7

#

for some reason

#

I literally have only 9 draw calls from SpriteRenderer

rotund token
#

Compute shaders? Constant gpu uploads?

rustic rain
#

no nothing

#

it's out of nowhere

rotund token
#

Is this editor?

#

Probably just blocked by other editor work

#

Try hit maximise

rustic rain
#

with maximise it's locked on 74.7

#

feels like some weird fps lock

pliant pike
#

whats your monitor hz

rustic rain
#

welp, PC restart helped, kek

rustic rain
pliant pike
#

seems like it got locked to vsync somehow

muted star
rotund token
#

It breaks down when using different chips, like xbox and playstation but in ~3 years we have not been able to break determinism on Windows over a lot of different machines and hardware configurations

#

Now we don't relay on being deterministic due to cross platform play but it is a very useful feature for debugging procedural world generation when someone reports an issue with a seed.

#

One misc point is that il2cpp and mono (editor) will produce different results for float maths even on the same hardware

muted star
tight blade
#

any ideas on what this unity merger means for dots?

muted star
#

I think I just found the answer
Unlike the new systems window the Entity Debugger doesn't display systems which are currently not running 😐

devout prairie
tight blade
#

cool cool cool

devout prairie
#

I wonder if any working on DOTS have lost jobs

tight blade
#

I think they're probably going to cut DOTS development completely. Evidently its no longer just speculation that the company now needs to cater to short term profitability prospects

#

and Unity is specifically not profitable right now, and its very difficult to be profitable during an economic downturn, and much less when you're in the middle of a rebuild. I'm assuming DOTS has been moved to the wings and is now viewed as a pure cost driver

#

I want to be told I'm wrong about this.

#

I'm not really sure I'd believe it, but I'd really really like to be wrong.

frosty siren
#

wow, hope not

#

but honestly dots is the last thing keeping me with unity

tight blade
#

I mean, the company clearly has no ability to be consistent with its own promises, that article mentions that just two weeks ago, the CEO promised its employees they weren't in financial trouble and no one had to worry about their jobs

devout prairie
#

Mm economic downturn yes, and several of the big tech companies have announced hiring freezes etc.. DOTS sidelined i'm not so sure.. I can understand pursuing monetization capabilities more aggressively ( ie the takeover ) cos that's the whole business model, but i think DOTS is going to be important for the future of the engine.

#

I didn't actually realize they'd bought WETA Digital, what was that all about?

frosty siren
#

ironically i'm now read Jason Schreier's Press Reset book about ruining companies and career

rustic rain
#

DOTS is already part of Unity engine ,kek

#

they literally move Physics engine on it

#

no way they drop it

frosty siren
#

yes, but it is only about burst and jobs for particular things

#

when people say development of dots they mean not usual unity stuff with dots under the hood, but dots for developing games

tight blade
#

yeah, data oriented paradigm, ecs, netcode, etc

#

that's the dream

devout prairie
#

maybe worth checking twitter bios etc of any of the known dots devs

tight blade
#

+2 runtime performance for certain physics scenarios doesn't really strike me as "mission accomplished"

devout prairie
#

i think they've committed to LTS for dots 1.0 right?

safe lintel
#

@devout prairie where did you see ai and engineering from the layoffs? From what I saw the biggest visible hit was the gigaya team, that pcgamer article is from that time iirc

devout prairie
#

I guess it could be speculation

safe lintel
#

I’m only just catching up on the merger which hmm part of me thinks is πŸ€¦β€β™‚οΈ the other side is also πŸ’Έ maybe this gets them profitable after all this time

#

I would hope that despite the term merger, unity is the one holding the reins after the dust settles and not the other way around

safe lintel
#

im not happy but tbh that particular forum crew is never happy

viral sonnet
#

haha someone posted the steve jobs video I was thinking of πŸ˜„

#

unity makes a lots of weird acquisitions where I'm like, coooolsees, and how does that help me? then I look at Unreal and they make acquisitions where I could start drooling ...

viral sonnet
#

people don't seem to be happy, yet I'm feeling pretty great in my DOTS bubble. before we see anything about dots being cancelled, we see Joachim's resignation as CTO. i think with him dots is pretty safe

rotund token
#

they literally just announced this week 1.0 pre-release with 2022.2 and 1.0 release with 2022.3

#

people saying it's being cancelled are so weird

viral sonnet
#

i confess i have missed that post! but yeah, this doom & gloom stuff is annoying and weird

rotund token
#
    Unity’s data-oriented tech stack (DOTS) makes it possible to build more ambitious games, and we are in the final stretches of preparing the first pre-release version of Entities 1.0 for launch. Entities 1.0 will bring compatibility with 2022.2, and will be available at a later point during the beta. The full release of Entities 1.0 is planned for 2022 LTS. ```
part of the 2022.2 beta announcement what's new
viral sonnet
#

huh i've read the 2022.2 beta announcement yesterday but seemingly missed the entities 1.0 preview. holy crap, that's awesome πŸ˜„

#

they are on a good track when they say this mid july

safe lintel
#

hm new ai nav package as well?

#

well nice to see that officially we will get some preview packages for 1.0

devout prairie
safe lintel
#

yeah I saw that earlier, thought it was fantastic

#

i got a unity survey not long ago about nfts and monetization and made my feelings about crypto/nft heard πŸ’― 🀑

#

I suppose on the bright side of this whole 4billion dollar acquisition, its not crypto or nft related

devout prairie
#

Thing is I don't mind blockchain or nfts as such, but the monetization above all else is so destructive.. the guy in the article really nails it

rotund token
#

oh man unity gave me a survey about nfts

#

i did not respond positively

#

i actually have a masters in cryptography and studied blockchain a lot when i did this (and this was like 8 years ago)

#

so i'm quite fond of the technology

#

even ntfs have huge applications - one great example is concert tickets

#

you can use nfts to prevent scalping

#

(i was pretty anti nfts completely until i learnt of some actual good real world examples)

#

but yeah i don't think they belong in games purely because i don't think they bring any benefits to gamers

#

the only interesting idea i ever had with nfts and games was simply making access to your game an nft

#

so you print say, only 10000 keys to access your game

#

you make your contract give 20% of resale to developer, and you can't resell for more than the original price

#

therefore you can effectively rent the game for 20% of the cost

#

im not sure this is a good thing at all, but it felt like at least a bit of a win win from all sides. developer gets constant resale $$ and gamers get to play game much cheaper

#

but i thought it was an interesting idea

gusty comet
#

is GetEntityQuery depreciated?

#

hmmm also how do you schedule jobs now that onupdate doesn't give you the jobhandle as a parameter

viral sonnet
# rotund token oh man unity gave me a survey about nfts

those damn nfts man ... devs hate them, gamers hate them. just investors love them. they have some merit for the real world, but in the gaming space... i hope we can soon get over it because every time i hear about them it kills my vibes. the discussion about them is so depressing.

viral sonnet
gusty comet
viral sonnet
viral sonnet
gusty comet
#

except bored apes I guess

viral sonnet
#

ah, I heard about some selling yacht 3d models for high prices. i dunno ... just 🀣

#

i lost pretty much all understanding how and why people spend money. but hey, i can code, that accounts for something

gusty comet
#

so yeah my sense of money has been changed forever too

#

think that's enough off topic stuff for this channel tho

#

@viral sonnet so we no longer need to return the jobhandle, and Dependency just...gets updated?

viral sonnet
#

if you use Entities.ForEach in the update it gets handled for you. otherwise Dependency = new JobStruct { ... }.Schedule(Dependency);

gusty comet
#

ok good to know

#

I would've missed that

gusty comet
#

Is EntityCommandBuffer.Concurrent now ParallelWriter?

safe lintel
#

@rotund token i do like that resale idea, I do think the tech is interesting but 99% of the current uses of it currently are just get rich quick schemes

#

@gusty comet yes

gusty comet
#

hmm someone mentioned somewhere that if I use SystemBase I should make the class partial

#

is that a requirement?

safe lintel
#

yeah for .50/51 upwards

elfin spire
#

What games are you guys making right now? Me a colony sim.

safe lintel
#

"boomer" shooter

rotund token
#

I don't make games, I just make libraries for other people to make games

#

Unfortunately I also don't release these libraries πŸ’©

muted star
#

Does anyone know if it is it possible to get a jobhandle from a .foreach?

rotund token
#

Yes

#

If you pass in a handle you get one back

muted star
#

Nice, then I'll just pass a new JobHandle if I don't have any dependencies

rotund token
#

then writing back to Dependency

#

also if you don't pass in the handle it's still written to Dependency automatically

#

so you can just use Dependency

#

Entities.ForEach(() => {}).ScheduleParallel()

#

is the same as

#

Dependency = Entities.ForEach(() => {}).ScheduleParallel(Dependency)

#

unity just does it for you

#

note that
Entities.ForEach(() => {}).ScheduleParallel(Dependency)
is not the same thing

#

as you are passing in a handle you are saying you are taking control of dependency management and Entities.ForEach now writes the handle back and you have to pass it back to Dependency at some point

#
Dependency = handle;```
#

the tldr:
Entities.ForEach(() => {}).ScheduleParallel()
Dependency at this point will be from the previous job and you can just use that for dispose etc

muted star
rotund token
#

Dependency is created in BeforeOnUpdate

#

based off the dependencies the system uses

#

what your queries read/write components are, ComponentFromEntity etc

rustic rain
#

how does it know about them? codegen?

muted star
rotund token
#

Yes

#

You have to pass in Dependency

#

if you have anohter handle you need to be dependent on as well, you can use Dependency = JobHandle.CombineDependencies(Dependency, myhandle)

muted star
#

Thank you, it's good to know that conflicts between jobs are avoided by using Dependency

rotund token
#

The safety system will scream at you

#

If you leave out dependency

#

It's why it's there, don't turn off jobs debugger unless you are performance testing

muted star
#

In your experience, does using asmdefs increase the frequency of the burst compiler becoming bugged and having to restart Unity?
I'm getting quite a few 'this indicates a bug in the DOTS compiler' exceptions lately.

#

Could it have something to do with using static classes within DOTS code?

unborn totem
#

I have a NativeList pointer question...

Let's say I get the pointer to a NativeList like this

void* ptr = new NativeList<int>(Allocator.Persistent).GetUnsafePtr();

is there anyway for me to use that pointer later to add a new element to that NativeList or access an element from that NativeList?

Basically I am struggling on how I can use this ptr to once again access the NativeList

muted star
unborn totem
#

I somehow doubt that this is what I want to do

void* ptr = new NativeList<int>(Allocator.Persistent).GetUnsafePtr();
NativeList<int> test = new NativeList<int>(Allocator.Persistent);
test.GetUnsafeList()->Ptr = ptr;
rotund token
#

just upgrade to 1.7.2+ (but not 1.8 preview)

muted star
unborn totem
#

For context, I am trying to create a NativeHashMap that stores a key and the value is a pointer to a NativeList

#

that way I can have a NativeHashMap of NativeList values

devout prairie
# rotund token im not sure this is a good thing at all, but it felt like at least a bit of a wi...

yeah that's exactly my take on it there are some great applications for blockchain and nft technology and whether it's a net benefit over fiat currency is an argument that that still needs to be settled.. but this idea of nft companies crowding the investment space for gaming, muscling in to push their agenda, although indy game developers obviously require funding i think it's important to collectively push back against that.

rustic rain
unborn totem
#

So a more complete example of my question would be:

private static NativeHashMap<int, IntPtr> _myMap = new NativeHashMap<int, IntPtr>(1, Allocator.Persistent);
.
. //later in code...
.

// initialize a new NativeList for a new index I am adding
void* ptr = new NativeList<int>(Allocator.Persistent).GetUnsafePtr();
_assetDependecyMap.Add(index, new IntPtr(ptr));

.
. //later in code again...
.

// access the previously initialized NativeList and add a value to it
void* nativePtr = _assetDependecyMap[index].ToPointer();
// at this point I don't know how to use the nativePtr to do what I want
late mural
#

hey, wondering should i use some kind of math clamp function or just use if statements while in an entity for each loop (burst enabled)?

unborn totem
rustic rain
#

it's literally like Dictionary of key, list<value>

unborn totem
#

as far as I could tell, I couldn't just do myMultiHashMap[index] = myValue

#

i had to do something with enumerators, and it got very confusing to me

rustic rain
#

well yeah, because it's list

#

you use Add method

unborn totem
#

i'm talking about accessing an existing key

rotund token
#

is the pattern

#

to use all values that share the same key

unborn totem
#

also when I declare a MultiHashMap, is it like this, or like this?

MultiHashMap<int, int> or MultiHashMap<int, NativeList<int>> ??

#

ultimately I want key: int, value: List of ints

rotund token
#

NativeHashMap<int, int>
is Dictionary<int, int>

NativeMultiHashMap<int, int>
is Dictionary<int, List<int>>

unborn totem
#

ok, that clears that part up

rotund token
#

(not exactly but they are what they are meant to replace)

#

Also they've been renamed for some reason

unborn totem
#

i'll give it another go, though I would prefer the NativeHashMap<int, IntPtr> if it were possible

#

i'm just unsure if I can use the NativeList ptr the way I was trying to

rotund token
#

You can use an unsafelist in there

unborn totem
#

yeah, ultimately NativeList points to an UnsafeList inside of itself, and using .GetUnsafePtr(); gets that pointer

#

but once I have the pointer, I don't know what to do with it

rotund token
#

Yep

unborn totem
#

do I allocate a new unsafe list?

rotund token
#

No just store the ptr in there as intptr

unborn totem
#

yes I have done that part

#

but now that I want to access it later, how do I treat it as an UnsafeList again?

rotund token
#

Cast it

#

That said I don't recommend this

#

The memory management will be a pain

#

You still have to keep all the native lists around to dispose

unborn totem
#

hard to unallocate it?

#

can I unallocate it with the pointer?

#

because those pointers won't be going away

rotund token
#

You need the dispose handle otherwise unity will complain that you're leaking memory

#

Because that's how it checks

unborn totem
#

the AtomicSafetyHandle?

rotund token
#

DisposeSentinel

unborn totem
#

I see

rotund token
#

this is what unity currently uses for dispose checking (in 1.0 this will change)

unborn totem
#

what if I don't create NativeList's and grab their pointers, and just create UnsafeLists?

rotund token
unborn totem
#

heh, ok, I didn't realize initially there would be a difference

#

is it possible to deallocate/dispose UnsafeLists on my own then?

rotund token
#

i still don't recommend using a collection in there over a multi hash map

#

unless you very specifically need to maintain order

rotund token
unborn totem
#

cool.

unborn totem
rotund token
#

don't know why you expect allocating memory in a list

#

will be faster

unborn totem
#

because I'm ignorant mostly

#

i haven't done this kind of programming since college

#

feels like C++ all over again

#

except I think DOTS is trying to be more like C, right?

#

object oriented programming be damned and all that

#

thanks for the help

late mural
devout prairie
late mural
devout prairie
late mural
rotund token
#

If it's just above 0 you should use math.max(value, 0)

late mural
unborn totem
#

weird...calling void* ptr = new UnsafeList(Allocator.Persistent).Ptr is just returning memory address 0x00000000

rotund token
#

you dont need to do that for unsafelist

#

just store it in the hashmap

#

also dont use that version

unborn totem
#

oh I will be, i'm just doing that one line above

void* ptr = new UnsafeList<int>(1,Allocator.Persistent).Ptr;
myMap.Add(index, new IntPtr(ptr));
rotund token
#

use the generic

unborn totem
#

and yeah, i forgot the generic

rotund token
#

just make it NativeHashMap<int, UnsafeList<int>>

unborn totem
#

oh, heh

rotund token
#

(again i don't recommend doing this but that's up to you)

#

just make sure you write the list back to the hashmap when you make changes to it

unborn totem
#

I see. and that's because i'm not accessing the UnsafeList by reference?

rotund token
#

yep it's just a struct

unborn totem
#

if I used pointers like I was doing initially, wouldn't that mean I could skip that step?

rotund token
#

you cant get the ptr from the unsafe list though

#

you'd hvae to malloc a container the size of an unsafelist

#

write a new list to it

#

then use that poniter

rotund token
#

if you add an element, old pointer will be disposed and new memory allocated

unborn totem
#

no? I see. I thought the .Ptr method would have been a pointer to the start of the UnsafeList, essentially, and it would handle itself internally

rotund token
#

Ptr is rewritten to a new value (line 387 UnsafeList)

#

in Realloc<U>

#

so the pointer your holding is now invalid memory

#

            Ptr = newPointer;```
#

because it's been disposed

unborn totem
#

interesting, for me line 252 is where Resize is

rotund token
#

i can tell you're not on latest because you're calling it NativeHashMap

#

and that's been deprecated and using it is now a compile error

unborn totem
#

yeah i'm not

rotund token
#
    [StructLayout(LayoutKind.Sequential)]
    [NativeContainer]
    public unsafe struct NativeHashMap<TKey, TValue>```
unborn totem
#

anyway, I can see what you are saying about the pointer being reset after a new memory allocation

#

I will try the NativeMultiHashMap once again

#

though I'm still confused on how to add multiple values to the same key to it

#

it says calling .Add when a key already exists will throw an exception

#

which makes sense for a Dictionary, but with the way this thing works, it seems confusing

rotund token
#

Add(key, value1)
Add(key, value2)
Add(key, value3)

unborn totem
#

so that doesn't throw an exception?

rotund token
#

No

#

Not if you're using the multi version

unborn totem
#

my docs say it would. that stinks.

rotund token
unborn totem
#

private static NativeMultiHashMap<int, int> _testMap = new NativeMultiHashMap<int, int>();

rotund token
#

Well you're looking at wrong documention

unborn totem
#

i mean I could just try and find out, docs be damned

rotund token
#

Because that's the documentation for native hash map

unborn totem
#

well thanks Jetbrains Rider intellisense

rotund token
#

The native multi hash map is different

rotund token
#

You havent allocated it

unborn totem
#

oh right, yeah I keep forgetting to put that in there

rotund token
#

ok internet dropped for a little so was on phone

#

but i wanted to post htis

#
        /// Adds a new key-value pair.
        /// </summary>
        /// <remarks>
        /// If a key-value pair with this key is already present, an additional separate key-value pair is added.
        /// </remarks>
        /// <param name="key">The key to add.</param>
        /// <param name="item">The value to add.</param>
        public void Add(TKey key, TValue item)
        {
            CheckWrite();
            m_MultiHashMapData.Add(key, item);
        }```
unborn totem
#

oh right, I forgot these "docs" just are generated from method comments

#

must be a version difference, code is the same but comments are different

rotund token
#

oh that's fun

#

πŸ˜„

unborn totem
#
/// <summary>
/// Add an element with the specified key and value into the container. If the key already exist an ArgumentException will be thrown.
/// </summary>
/// <param name="key">The key of the element to add.</param>
/// <param name="item">The value of the element to add.</param>
public void Add(TKey key, TValue item)
{
    CheckWrite();
    m_MultiHashMapData.Add(key, item);
}
muted star
#

Could it be a problem if I have different components which differ in name only?

#

Does DOTS take care of not mistaking one for the other?

rotund token
#

no

#

c# wont have issues

muted star
# rotund token just upgrade to 1.7.2+ (but not 1.8 preview)

I upgraded burst to 1.7.3 but I have an error again.

Assets\Scripts\ECS\Shared\Components\RealPosition.cs(1,1): error SGICE004: Seeing this error indicates a bug in the dots compiler. We'd appreciate a bug report (About->Report a Bug...). Thnx! <3 System.IO.IOException: Cannot create 'F:\Unity Projects\PiscesRTS2021\Temp\GeneratedCode\SharedBetweenWorlds' because a file or directory with the same name already exists.

Is this the cache bug? I added back the asmdefs so it could be caused by that πŸ€·β€β™‚οΈ

rotund token
#

nah

#

this is an entities 0.51 error

#

there is a good chance asmrefs can cause it

muted star
#

I just encountered something odd
First I used a component which had an Entity field but for some reason its index changed when it was moved it between worlds.
Now I'm using a component with an Index and Version field and it's working fine. πŸ€”

rotund token
#

that's not strange

#

that's expected

rotund token
unborn totem
#

Is there any equivalent to the string type usable in DOTS yet? for example, NativeList<string> where string is some other DOTS friendly type?

rotund token
#

FixedStringX

unborn totem
#

is this bleeding edge stuff?

rotund token
#

no

#

been around for ages

unborn totem
#

oh, where X is a number πŸ˜…

#

so FixedString32 would hold, 16 characters?

#

assuming a char is 2 bytes

rotund token
#

it would hold between 7 and 29

#

depending on the characters you use

unborn totem
#

you are a fountain of knowledge tertle, thanks

rotund token
#

it stores UTF-8 which are 1-4 bytes depending on character

#

for regular characters that'd be 1 byte each

#

and it has 2 bytes for length

#

and 1 byte for null termination

#

hence 29+2+1=32

unborn totem
#

my strings can get pretty long, I guess I could hash them to make unique, smaller strings of more predictable characters

rotund token
#

it goes up to 4096

#

but in general it's just a poor idea to store strings in burst

#

and very rarely unneeded

#

like, it's not exactly performant

unborn totem
#

yeah, in my case i'm keeping a lookup table for "string"->integer, and going to be doing most of my operations in the integer containers

#

unfortunately the lookup table is necessary, but I can do that part outside of burst I guess

muted star
#

I'm currently syncing up my presentation world entities with the simulation world entities by storing the entity id and index in components.
The entity indexes are also updated appropriately to not loose any 'references'.

I imagine that this will fall apart once entities are added or removed in the simulation world, because entity ids are reused as far as I know.

This could probably be better solved by using the EntityRemapping utilities, but I don't understand how they are supposed to work.
I read a bit in this article https://gametorrahod.com/entity-remapping/ but I don't get it 🀨

So my current line of thought is that I could instantiate all entities that could possibly 'exist' at the start of the game and add a component to them which differenciates entities which 'are dead' from those that aren't. This way, entity IDs should always stay the same even if entities are 'destroyed'.

What do you guys think? Could entity remapping utilities help me out here? How do they work? πŸ€”

rustic rain
#

doubt you need it

#

all you care about is simply rendering, right?

muted star
#

no

rustic rain
#

oh

muted star
#

presentation world is for pretty movement of everything + rendering
and the simulation world is for doing all the calculations that actually matter and need to be deterministic

rustic rain
#

ooof

#

that would be hell of a headache to sync that

#

because in fact, it's double simulation

muted star
#

So far it's not so bad but the entity id stuff worries me

rustic rain
#

well sir

#

it's not fast

#

what you are looking for

#

this kind of stuff is meant for save/loading

#

and things like that

#

not for runtime

muted star
rustic rain
#

yeah

muted star
#

Guess I'll go for the IDontExistComponent approach then

rustic rain
#

but it was save/load and I literally remapped through byte array of chunk's component data

#

kek

muted star
rustic rain
#

well

#

it might take about the same time

#

kek

#

probably depends on amount of data

#

in short what you want is simply create dictionary of old entity/new entity pair

#

and when you create new entities you just swap old with new

#

during remapping

#

can be even done manually

muted star
#

IDK, perhaps my current solution will even work. It's just too confusing for me to think about much more πŸ˜…

rustic rain
#

sir

#

what if instead of having 2 worlds

#

you'll your long running jobs in one

#

you'll just have to copy all data for jobs

#

before running them

#

and keep JobHandle outside of Dependency system

#

once they are done you just apply all data back to entities

#

that would probably be faster than copying entities

muted star
rustic rain
#

your current approach is just meant to cause pain

muted star
rustic rain
#

I swear, coding in binary would be easier

rustic rain
#

which is costly

#

and which is way more costly then simply copying data before job

devout prairie
#

It's been a long day and i think i'm missing something obvious - any idea why this collision job isn't running?

rustic rain
#

_buildPhysicsWorld.AddInputDependencyToComplete(Dependency);

elfin spire
elfin spire
rustic rain
elfin spire
devout prairie
#

They don't use that in ECS Physics samples either but those could be out of date

unborn totem
#

is it possible to have a burst compiled static method return a value, or do I have to do that inside of Burst compiled struct jobs only?

muted star
muted star
elfin spire
muted star
muted star
elfin spire
elfin spire
muted star
#

haven't got to that part I'm still very much in the beginning. That's going to be a challenge for sure

muted star
unborn totem
muted star
#

I think ECS / Burst is much simpler than compute shaders and extremely performant if used correctly @elfin spire
but if you already have experience with that kind of thing its of course an interesting option

elfin spire
elfin spire
muted star
muted star
elfin spire
#

besides no animation no nav

#

lol

muted star
#

ECS instead of OOP is the main hurdle for me πŸ€·β€β™‚οΈ

rustic rain
safe lintel
#

imo 51 is mostly behind the scenes changes

elfin spire
muted star
elfin spire
rustic rain
#

here the way it works kek

elfin spire
#

lol

#

graph is truth

muted star
#

xd

safe lintel
#

I agree with that graph

muted star
elfin spire
#

and yolo reaches vertical tangent as soon as you need to fix bugs after release

rustic rain
#

I am currently doing very little project and it's already beating OOP with effort

#

even though it barely requires scale

#

since my average amount of entities is 30-50

#

kek

safe lintel
#

ah its sad to see unity devs on twitter rt critical tweets of the current situation, its like seeing smoke signals from a desert island 😟

rustic rain
#

what's up? Unity is in trouble?

viral sonnet
#

@safe lintel I'd like to see some screens/vids of your shooter. DM me if you don't want to post them public πŸ™‚

viral sonnet
muted star
#

Is anyone here using anything from the Latios framework?

safe lintel
#

@viral sonnet https://gfycat.com/cleanbetterkid this is back when the project was all monobehaviours(ugh 2018). sadly its been a bit of a shambles since I got sidetracked to dots(the animation/lackof being kind of a persistent thorn that I have been reworked one too many times and is getting old)

#

if you go to gfycat.com/@safe lintel you can see chronologically random dev gifs(mostly bugs heh) of how everything has sort of unravelled since lol

viral sonnet
#

cool, i'll check it out

viral sonnet
elfin spire
rustic rain
elfin spire
muted star
#

Is there a way to make custom struct show up in the inspector?
Implementing IFormattable doesn't seem to cut it.

#

Is it System.Serializable or DebuggerTypeProxy which could make this possible?

rustic rain
#

Serializable works

#

it even shows managed types

muted star
#

This now works, even without the Serializable attribute

public struct sfloat : IEquatable<sfloat>, IComparable<sfloat>, IComparable, IFormattable
{
#if UNITY_EDITOR
    public float _value;
#endif
    
    /// <summary>
    /// Raw byte representation of an sfloat number
    /// </summary>
    private readonly uint rawValue;

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    private sfloat(uint raw)
    {
        rawValue = raw;
#if UNITY_EDITOR
        _value = ReinterpretIntToFloat32(raw);
#endif
    }
    ```
safe lintel
#

@elfin spire its basically already remade in ecs, but currently I think my 5th rewrite of the animation/characters for it

viral sonnet
#

i mean you are in too deep now but have you ever thought about just replacing them with sprites?

safe lintel
#

sprites for characters just arent my jam πŸ™‚

#

I really just want the dots animation package to get back to public previews, its really my only need now as far as dots related things

viral sonnet
#

fair enough πŸ™‚ yeah, but even with entities 1.0 it's still far off :/

safe lintel
#

if you ever watched the gdc doom2016 talks on animation for it, they go into some interesting details how animation drives ai and vice versa for correcting behaviours and what not, and dataflowgraph+ecs was shaping into a pretty performant way of doing that. I mean you can do that now but without deep burst ecs integration so I dont think its really super viable for hordes of enemies

mystic mountain
#

When designing systems would you consider optimizing for chunk utilization over random accesses?

elfin spire
safe lintel
#

its back to regular mecanim, not sure of a way to do hitbox/locational/ragdoll damage with gpu animation(also not sure how to blend vertex anims)

viral sonnet
#

maybe in the same way the entity picker works. render with a shader that has the ids as color output. then project the raycast to the correct pixel.

devout prairie
safe lintel
#

thanks, that was the only time it looked so cohesive πŸ₯²

safe lintel
#

@viral sonnet could be a cool idea for location damage but not sure about the ragdolling

viral sonnet
#

all this talk from john riccitiello gave me some new ideas. i should probably pull my open source asset from the store. make it closed source, bundle it with an installer that has ads and some great software included that speeds up your pc and makes it safe and secure. also make it a 1-seat license with no additional support, only with a perpetual annualy license and every new feature that gets requested is DLC content, available as upgrade package. man, if we would all be great business man like john riccitiello, the world would be so much better and i would be swimming in money.

#

the sad state of mobile is that without a budget you have nearly 0 downloads. this talk about monetization is so utterly dumb and ignorant. also, ad money is joke.

#

the moment you cram enough ads into a loop to get somewhere, users will cry about it in the review section with 1 star reviews. if you make it "fair" you won't have enough impressions.

#

it all seems to me like a pyramid scheme, 90%+ will fail horribly

#

and don't get me started on the 30% asset store cut ... meh, enough venting πŸ˜„

robust scaffold
#

Unity has been hemorrhaging money according to their quarterly reports. Some parts due to their questionable acquisitions, other parts due to their stalled development (dots hello?). Unfortunately Unity is not a charity and needs a net positive income stream. I'm thinking that if DOTS doesnt pan out within the next 2 years, unity is gonna implode.

#

They're chucking 750M into RnD and a significant chunk of that is probably going into DOTS development. Remember that talk by the dev about how everyone in the company were required to take workshops on how DOTS function? I think unity has put a lot riding on the success of DOTS.

rustic rain
#

Welp

#

Let's just hope

#

That dots 1.0 will keep Unity alive

robust scaffold
#

Oh, unity will live regardless of the performance of DOTS on the market. As an mobile advertising company if it falls flat though.

#

I hate to say it but the merger with ironsource is possibly their smartest acquisition yet. Smarter than Weta at the minimum. This guarantees their continuation even if the editor stops developmeny

#

Its like the development of Java post Oracle acquisition. Java is now a law firm.

rotund token
#

is it really survival for a company if their continuation is worth 1/4 of their market?

robust scaffold
#

Its still millions of dollars and not complete liquidation. It's like blockbuster. Theres still a store up in alaska.

rotund token
#

there's only 1 blockbuster left and it's in oregon

#

and it's not the original company - it's just a privately owned franchise

#

so that isn't a great example

robust scaffold
#

Oracle and java is probably the best example. In that case, if I remember correctly it actually made the shareholders extremely happy. Oracle is worth a lot more following their purchase of Sun in 2009. Very bad for the development industry though until Microsoft stepped up with c#.

#

The same can possibly happen with Unity. Game editor development is not that profitable. Seeing how unity has lost money every quarter since they started publishing financial data. Haven't checked Unreal but I doubt they're profitable either .

rotund token
#

yeah but that doesn't seem like a good example either? that's like Unity buying iron source and then not selling any advertising anymore ^_^'

#

most of oracles money comes from cloud computing and database licensing

#

i don't disagree with your assessment of engines and lack of profits atm though

#

124m 2018, 97m 2019, 100m 2020 revenue

#

for epic engine

#

the apple vs epic got all this disclosed πŸ˜„

#

unity doing about 1.2B in revenue in last year (4 qtrs being 320m, 315m, 286m, 273m)

robust scaffold
#

No way they're 1/2 to 1/3 of unity.

rotund token
#

400m on the epic store

robust scaffold
#

Is that annual revenue for unreal?

rotund token
#

3b on fortnite

rotund token
robust scaffold
#

Holy shit. They practically give the engine away for free. Well it is a free limit of 1M

rotund token
#

yeah

#

then it's only 5%

#

you make 1 billion you only pay $50m

#

which means people with more than 1mill rev generated a about $2bill in revenue on epic games

#

that doesn't sound too farfetched to me

#

also don't forget unity numbers aren't just the engine licensing

#

it's advertising, services, etc

robust scaffold
#

Yea, given all the AAA titles using it.

#

Iirc, unith makes most of its revenue from mobile game advertisements and taking a cut.

#

Which puts the CEO's comments into context. Mobile developers not imbedding ads and in app purchases into their game directly hurts Unity's bottom line.

rotund token
#

Create Solutions revenue was $99.9 million, an increase of 49%;
Operate Solutions revenue was $194.6 million, an increase of 45%;
Strategic Partnerships and Other revenue was $21.3 million

Operate is their advertising etc

#

so yeah hefty chunk

#

this was final qtr last year

#

it's more than just advertising but it's wear it fits - includes all their services

robust scaffold
#

If unity could take over mobile game development. Sure their reputation will go from the gutter straight to advanced decomposition as they link themselves to shovel ware. But they'll be flush with cash.

#

Rip the bandaid off. Drop PC game engine development. Go all in on being the universal mobile game engine with in app purchases and advertisement solutions. Mobile games apparently dwarf PC and Console markets combined by orders of magnitude.

rotund token
#

If unity could take over mobile game development.
how do they not already own it? seems to be at 50-61%

rustic rain
#

That wouldn't be unity anymore

rotund token
#

"Around 65% of everything developed to operate on devices for VR or AR or any XR-based gadgets are made in Unity. Around 50% of all the games created for Nintendo's devices are developed using Unity. Figures regarding this fall slightly below that for Sony and Microsoft. However, combined, it's more than 50%."```
#

it's not shocking at all they bought an advertising tech company

#

what's shocking is they bought one with a terrible reputation and then paid a huge premium

#

the market did not react well to the news

robust scaffold
#

To be fair, outside of google adsense and facebook, you only have bottom feeders in terms of internet reputation

rotund token
#

i'm kind of hoping they just take the cool AR tech etc that iron source has

#

and then throw out all the BS

#

but what i'm really hoping is their share price tanks a bit more and investors find a new CEO

robust scaffold
#

Its fallen 80% since it's high. 30% down from initial IPO. I dont know how far down the stock needs to go before shareholders revolt.

rotund token
#

seems to be 50.68% since ipo

#

and max to current of 210 to 33.71

#

in 9 months

robust scaffold
#

Oh 30 as in 30 dollars. Read it wrong. Yea that's a disaster.

rotund token
#

now to be fair, all tech stocks have been smashed recently

#

but unity started way before the downturn

#

anyway we took this channel way off-topic

#

hope it works out for them, i've put a lot of effort into learning dots and cbf learning unreal ^_^'

robust scaffold
#

Yea. Dots is great and open source. I've personally transitioned to compute shaders for a large part of my needs. Not as flexible but I was basically number crunching floats in Burst anyways.

rotund token
#

intentionally avoiding compute shaders for anything on my server

#

so i can the server without a gpu

#

saves a lot on hosting costs

robust scaffold
#

Imagine multiplayer, ha.

#

Singleplayer all the way. No need to worry about networking in my life. It's so nice.

rotund token
#

i never play single player games so it feels weird to make one

robust scaffold
#

Mobile hotspot internet here. I can barely play multiplayer and usually just turn based ones

#

And compute shaders are so much faster. 64 lane wide wave fronts. With the new wave intrinsic, theres now even more flexibility (kinda) in parallel computing.

rotund token
#

there's no doubt they're faster

robust scaffold
#

I haven't found a use for them yet though. Instead twisting frag shaders and using vertex culling optimizations for performance boosts.

rotund token
#

the thing i always say to people though, if you have a good looking game on 4k, you are much more likely to have free cpu cores

#

so performance is free

#

even if it's slower it's not costing you anything

#

i feel like this is something that is often overlooked

#

and people then wonder why they're getting stalls on cpu while it waits for gpu

robust scaffold
#

CPU cores are used for things other than your game though. Like internet browsers that gobble up memory by the gigabytes.

rustic rain
#

Not nearly as much

rotund token
#

i'm running 100,000,000 entities over 16 jobs 100% simd, no sync points

#

and i'm only using 60% of my cpu

robust scaffold
#

While, if you disable hardware acceleration on browsers, only the game should be using the GPU.

rotund token
#

these days you have way too much free cpu cores

robust scaffold
#

Just open more tabs in chrome

rotund token
#

mate havent used chrome in half a decand

#

get with the times

robust scaffold
#

Everything is chrome. Unless you're one of those firefox weirdos

rustic rain
#

I usually run video and tons of tabs in chrome while doing pretty much anything and CPU usage is rarely above 10 percent

rotund token
#

firefox is amazing

robust scaffold
#

Or that apple thing

rotund token
#

when i had to leave firefox for chrome 12 years ago because it sucked in comparison i was sad

#

but now they're back and better

rustic rain
#

I personally use 4 browsers xD

#

3 chroms and firefox

#

And none of them eat CPU enough

rotund token
#

(does chrome support plugins on mobile yet? one of the reasons i switched off)

rustic rain
#

So I'd prefer jobs over compute shader

robust scaffold
#

Discord is a chromium wrapper. Edge is a chromium fork. Chrome is chromium with google characteristics.

rotund token
rustic rain
#

Also the reason I prefer jobs over gpu - way easier debugging

rotund token
#

(or for like really large noise because it's just that much faster)

robust scaffold
#

Debugging shader I agree is such a pain. WHY IS THIS PIXEL RED??

rustic rain
#

Just toggle off burst and insert breakpoint

rotund token
#

i swear no one knows this

rustic rain
#

I can?

#

It never works for me

robust scaffold
#

cant step through math functions with Burst on though?

rustic rain
#

Do you need to do anything specific?

rotund token
#

turn on that, and instead of hooking up a managed debugger hook up a native one

rustic rain
#

Huh

robust scaffold
#

Ewww, visual studio

rotund token
#

Rider has a native debugger now

#

But

#

I have not been able to get it to work with burst

#

I can hook it up to native libraries burst is calling

#

but yeah, when i really want to debug things i just have VS hooked up as a native debugger for burst code

#

and rider hooked up managed for non-burst code

#

then i can break wherever i want

robust scaffold
#

Or just... turn off burst?

rotund token
#

i have an algorithm in my project that takes 1 second to run with burst on

#

or 180 seconds (3min) with burst off

#

turning off burst is not a good idea sometimes

#

that and have you tried to use the new Dots Hierarchy with burst off and any decent size number of entities?

#

just locks up the editor for a minute

#

ALSO burst math operations on floats return different values than mono math operations on floats

#

so you're not even debugging the same code

robust scaffold
#

Hrm. True. Debugging and step through is very helpful. Imagine if shaders could do something similar.

rustic rain
#

Do I understand correctly that DestroyEntity is only removing all components except SystemState ones?

rotund token
#

yes

#

system stats will be left

#

the entity will only actually be destroyed once all system states are removed

rustic rain
#

yeah, but on next frame

rotund token
#

could be 100 frames later

rustic rain
#

no destruction anymore?

rotund token
#

depends entire when you clear it up

rustic rain
#

no no no

#

what I am trying to figure out

#

is whether there's anything that gets created

#

that keeps track of that entity after creation

#

I mean, after calling Destroy on it

rotund token
#

no

rustic rain
#

so, it's as simple as removing all components?

rotund token
#

yes

rustic rain
#

and by default if you remove all components manually

#

entity is destroyed by iteslf

#

without Destroy call?

rotund token
#

at least they didn't used to be

rustic rain
#

btw

#

if you call Destroy on frame X

#

and then on next frame Y you add some components

#

will they be affected in any way?

#

or Destroy is only affecting moment it's called?

rotund token
#

ok so if you really want to know what's going on

#

when you call destroy it's moved to an archetype and one of the flags is called
SystemStateCleanupNeeded

#
    internal enum ArchetypeFlags : ushort
    {
        SystemStateCleanupComplete = 1,
        SystemStateCleanupNeeded = 2,```
#

if you have system states it sets that flag instead of destroying entity

#

and once all system states are set the entity is destroyed

#

you can't just add to it after it's considered a destroyed entity

rustic rain
#

yeah, but if you have state comps on it

#

for a while

#

and then you add some components to it

#

I wonder about how it'll work out

#

since I want to use DestroyEntity as a tool to transform entity into smth else

#

like

rotund token
#

why would you do it that way....

rustic rain
#

Entity used to be a character, but after it died it's transformed into memory of character

rotund token
#

you may as well just write to a random memory address ^_^'

#

just set the archetype to something new

rustic rain
#

yeah, but you wouldn't know about all state components

rotund token
#

EntityManager.SetArchetype();

rustic rain
#

and what if some of them will be actually required in order for correct "transformation"?

rotund token
#

then you're using system states wrong

rustic rain
#

well, or maybe that's just another way to use them, kek

rotund token
#

we do this in our game btw, we convert actors from 1 type to another

#

so they can 'grow' up

#

(and it was a terrible idea - probably going to have to rewrite the entire system next week to fix issues with it that are blocking new features)

rustic rain
#

so, do you know what actually happens in that case or I better try and test it?

#
        public void DestroyEntityDuringStructuralChange(UnsafeCachedChunkList cache,
            UnsafeMatchingArchetypePtrList archetypeList, EntityQueryFilter filter,
            in SystemHandleUntyped originSystem = default)
        {
            if (archetypeList.Length == 0)
                return;

#if ENABLE_PROFILER
            using (var scope = StructuralChangesProfiler.BeginDestroyEntity(m_WorldUnmanaged))
#endif
            using (var chunks = ChunkIterationUtility.CreateArchetypeChunkArray(cache, archetypeList, Allocator.TempJob,
                ref filter, DependencyManager))
            {
                var errorEntity = Entity.Null;
                var errorReferencedEntity = Entity.Null;
                if (chunks.Length > 0)
                {
                    EntityComponentStore->AssertWillDestroyAllInLinkedEntityGroup(chunks,
                        GetBufferTypeHandle<LinkedEntityGroup>(false), ref errorEntity, ref errorReferencedEntity);

                    // #todo @macton DestroyEntities should support IJobChunk. But internal writes need to be handled.
                    if (errorEntity == Entity.Null)
                    {
#if (UNITY_EDITOR || DEVELOPMENT_BUILD) && !DISABLE_ENTITIES_JOURNALING
                        EntitiesJournaling.RecordDestroyEntity(in m_WorldUnmanaged, in originSystem, (ArchetypeChunk*) chunks.GetUnsafeReadOnlyPtr(), chunks.Length);
#endif
                        RunDestroyChunks(chunks);
                    }
                    else
                    {
                        EntityComponentStore->ThrowDestroyEntityError(errorEntity, errorReferencedEntity);
                    }
                }
            }
        }
#

in source it's pretty messed

rotund token
#

i have never tried to add components to a destroyed entity

#

but at the very least they will exist in a separate chunk

#

or they will mark not destroyed entities as destroyed

#

would be my guess if it just doesn't error

rustic rain
#

I see, I guess gotta test to figure

#

allthought I don't get why you think it's wrong way of using state comps

rotund token
#

you think calling Destroy and then trying to undestroy something is a good idea?

#

you are basically using undefined behaviour that Unity could change at any point

rotund token
rustic rain
#

is there any other way to call Remove components on literally all, but state?

rustic rain
#

but that would affect state components too, no?

rotund token
#

you just keep the state components in the new archetype

rustic rain
#

but what if I don't know them

#

let's say some modder will add new state component that will be kept on entity

#

it will be excluded

rotund token
#

Archetype.GetComponentTypes()

rustic rain
#

thus making modder unable to add behaviour to such "death" mechanic

rustic rain
rotund token
#

don't really understand what's slow about it when the whole thing is burstable

#

it's really not much different to what Destroy is doing

#

except without a bunch of extra checks

#

you could even convert to your new memory of a character

#

in a single structural change

#

instead of potentially dozens/hundreds

#

as you just add components 1 at a time

rustic rain
#

hmm

#

I keep forgetting that you can burst structural changes

devout prairie
#

this is interesting but i preferred the conversation about unity revenue πŸ˜›

rustic rain
#

allthough I haven't ever managed to make it work

#

hmmm

#

so how would you generally burst code like that?

rotund token
#

well so you can actually pass entity manager into jobs

rustic rain
#

since ForEach loop would require WithStructuralChanges

#

if you call EntityManager here

#

which would make it unbursted

rotund token
#

but it has invalid safety issues

#

you could just pass it to a job struct and Run() it

rustic rain
#

and still have [BurstCompile]?

rotund token
#

i cant remember if this works atm i think it does

#

personally i just have a bunch of wrappers

rustic rain
#

I guess I'll have to check

rotund token
#

for entity component store

#

to avoid these invalid safety issues

#

i.e. my classic SharedComponentDataFromIndex

#

many of these are safe in threads for reading

#

but yeah for any writing still needs to be mainthread

rustic rain
#

it's ok, as long as it's bursted

rotund token
#

alternatively they might have fixed ExclusiveEntityTransaction in 0.51

#

i havent actually tested

#

if they have fixed it then that's what you should be using as that's how you're meant to use entity manager in jobs

#

in works in threads

#

(not parallel)

#
            
            // do work
            
            this.EntityManager.EndExclusiveEntityTransaction();```
#

it's just a wrapper of EntityManager

#

hmm though it doesn't have set archetype πŸ₯²

#

oh wait that doesn't matter as you can just use the EM

#

(they broke this in 0.50 though and i haven't tested it was fixed)

#

do let me know if your Destroy plan works i'm curious

rustic rain
#

all right, will do

rotund token
#

i've been looking at code and tbh

#

i can't see any reason it wouldn't

devout prairie
#

the job is showing in the profiler, but it's not doing the debug print

rotund token
#

you don't have any collisions

devout prairie
#

i do

rotund token
#

and you marked the colliders to raise events?

devout prairie
#

no

rotund token
#

then it won't fire any events!

devout prairie
#

shitsticks

#

gad damnit i totally overlooked that

rustic rain
#

I mentioned it earlier though πŸ™ƒ

devout prairie
#

just relying on conversion from std colliders to physics shape so i hadn't looked at it specifically

devout prairie
rustic rain
rotund token
#

that's very vague

rustic rain
#

well yeah, because it can be either filter options or material

devout prairie
#

to be fair, i should have realised, bit of a silly oversight

rustic rain
#

btw I don't even remember whether kinematic - kinematic raise events

devout prairie
#

i ended up switching to a different approach as i didn't realllllyy want to poll all those potential collisions, but i think i'm going to need it

rotund token
#

well yeah you shouldn't mark everything as raising events

#

but you can crunch quite a few collisions/frame without too much effort

devout prairie
#

basically it's a ragdoll setup, so there's 14 bones per ragdoll

#

i was aiming to obviously have as many ragdolls as possible in theory

rotund token
#

implement first, optimize later!

devout prairie
#

i'm not sure if raising collision events would scale for example say you have a million rigidbodies, but only ten collide, would the impact be negligable, or is there overhead associated with just having them capable of raising events

#

i'm thinking potential cache/memory overhead as it will strap extra data to the internal physics system jobs

#

but yeah you're absolutely right, optimize later

rotund token
#

million rigidbodies
i can tell you that you won't have a million dynamic physics objects

devout prairie
#

haha this is true, but hypothetically

devout prairie
#

anybody looked in detail at the ecs Physics samples implementation of stateful collisions at all?

#

it seems nice, but as with everything in ECS samples they seem to write code in the most abstract way to demonstrate relatively simple concepts

#

classes with static methods and interfaces scattered around that try to handle all of the demo cases, and lots of generics

#

rather than, just put everything for each case in a group of systems and set of components/buffers for that case

#

just makes it a bit of a headache to deconstruct

#

making the transition from mono's with OnCollisionEnter OnCollisionExit etc to DOTS physics i think needs to be simpler

#

obviously the physics engine is stateless, so that's always going to involve getting into the weeds on the mechanics of how to set that up

#

but i think the physics samples could be more approachable, in order to ease that transition

#

as it is one of those really obvious, key parts of many games

rustic rain
#

if you want stateful events

#

you s imply import their implementation system

#

aaaaand that's it

#

then you just call different jobs

#

on stateful events buffer

devout prairie
rustic rain
#

that file

#

with stateful events

#

it's not just sample

#

it's fully working solution

#

just import it into your porject

#

kek

devout prairie
#

well it's several files tbh

#

authoring component with bool for collect details

#

stateful event buffer / collector system

#

buffer component and methods

#

etc

#

really i just want to understand how/what/why the code they've written, and do my own thing

rustic rain
#

if event doesn't exist in hashmap - it's Enter state

#

if it exists and triggers again - it's stay state

#

if it hasn't triggered since last frame - it's exit state

#

system is somewhat simple on concept but complex on implementation

#

so easier just to import Unity one

devout prairie
#

the way they've written it, it's almost as if they've imposed an OOP structure onto the DOD framework, with the generics and struct interfaces etc

#

so while i get it, it's maybe ultimately how you'd end up building that kind of system, it's also a bit of a rats nest to deconstruct

wide fiber
#

Hello guys, can I ask you something in Unity ECS? Why should components have no logic? I am not saying that they should have all the code of the game, but is it a problem if a component has helper functions?

rustic rain
#

so that other systems might use it however they want

frigid badge
#

hello guys, i have a question about the job system. can you pass structs containing blittable types into jobs ?
things like Vector3, float3
or should I pass their components separated into 3 arrays ?

rustic rain
#

you can pass unmanaged types into jobs

#

any sort of structs or native containers

frigid badge
#

good to know, thank you πŸ‘

rustic rain
#
        protected override void OnCreate()
        {
            _spaceCameraSystem = World.GetExistingSystem<SpaceCameraSystem>();
            _curSystem = GetEntityQuery(ComponentType.ReadOnly<StarNormal>(),
                ComponentType.ReadOnly<StarShared>(),
                ComponentType.ReadOnly<DisableRendering>());
            _allSystems = EntityManager.CreateEntityQuery(ComponentType.ReadOnly<StarNormal>(),
                ComponentType.ReadOnly<StarShared>(),
                ComponentType.Exclude<DisableRendering>());

            _starsQuery = GetEntityQuery(ComponentType.ReadOnly<StarTag.Child>(),
                ComponentType.ReadOnly<StarShared>());

            _fixQuery = GetEntityQuery(typeof(FixRendering));
            RequireForUpdate(_fixQuery);
        }

I don't get it.
I set requirment for update and for some reason it requires all queries for update

#

for some reason it doesn't run

#

even though all queries are filled

#

ok nvm, it's running

rustic rain
#

is there a way to ensure that my system's OnCreate is called before some other's system?

rotund token
#

Not that I'm aware

#

Well, you could maybe create it manually in your bootstrap

gusty comet
#

Are these two functionally equivalent? ```cs
Dependency = JobHandle.CombineDependencies(new SomeJob {
// etc
}.Schedule(someQuery), Dependency);

Dependency = new SomeJob {
// etc
}.Schedule(someQuery, Dependency);```

rustic rain
#

no

#

whatever Job returns is ready Dependency

#

you don't need to combine it with previous

#

it's useless work

gusty comet
rustic rain
#

it's pretty confusing, so potentially you'll have to figure out errors anyway, kek

#

but as long as you pass SystemBase's Dependency somewhere in that chain

#

it should be fine

frigid badge
#

one more question about Job system
do stackallocs incur performance penalties ?
and just to confirm, is allocating simple arrays bad for job performance regardless of their size ?

#

just want to use a couple of small int buffers inside a job for convinience

rustic rain
viral sonnet
#

the same performance characteristics as always apply, memory allocation takes time, the more you need, the longer it takes. temp memory is quite fast but there's still some overhead. using pre-exisiting memory is the fastest you can do. nativearray/list can be reused for a job thread and only allocated once which speeds things up quite a bit.

#

when the size is always the same for each thread, allocate an array before the for loop and check for IsCreated. for unknown sizes, allocate a list, set the length via Resize and cast to nativeArray

dreamy glade
#

Rendermesh.mesh.SetTriangles() doesn't support NativeArray<int>()'s. Why would this be? How are you supposed to set the triangles on an entity? Thanks!
yet setvertices and setUVs does (for appropriate floats)

dreamy glade
rotund token
#

SetTriangles is dated

#

just choose MeshTopology.Triangles

#

but SetIndices also lets you do quads etc if you have different mesh formats

dreamy glade
rotund token
#

I wanted to use the BuildConfiguration search window for some of my own UI so I debugged what was wrong with the search in 0.51. If anyone is being annoyed with the build config window in 0.51 and wants to fix it just add m_List.RefreshItems(); to SetCurrentSelectionNode in SearchView.cs

        {
            m_CurrentNode = node;
            m_List.itemsSource = m_CurrentNode.Children;
            m_ReturnButton.text = m_CurrentNode.Value.Name;
            m_List.RefreshItems(); // Add this```
rustic rain
#

Any idea about static components?
If I create entity with fixed archetype that won't change until world is destroyed. For purpose of storing global values like current Tick, or input and etc
Can I somehow get a pointer/reference to it, that will last?

#

goal is to avoid sync points by calling EntityManager

rotund token
#

are you talking about singleton components?

rustic rain
#

yeah

#

I need a way to be able to access them randomly in any system without a sync point

rotund token
#

just pass in the entity to the job

#

and use ComponentFromEntity

rustic rain
#

too much code, kek

#

also annoying part is that I'll have to access it on every iteration

rotund token
#

it's only choice to be safe without a sync point

rotund token
rustic rain
#

yeah, per chunk is also per iteration

rotund token
#

if your data is actually static then you can just use EntityManager.GetComponetData

#

but then why not just store data locally

rotund token
rustic rain
rotund token
#

i mean just OnStartRunning()
myComponentvalue = GetSingleton<MyComponent>()

#

and then just use that value from then out

rustic rain
#

oh, it's like world Time

#

it changes every tick

#

and Input will change every frame

rustic rain
#

Only if this type is part of dependency?

rotund token
#

it will only cause a sync point on the handles that are writing to it

#

it doesn't sync point the entire project

rustic rain
#

Is that how you access input struct?

rotund token
#

pretty sure i just pass entity to job

#

and use componentdatafromentity

#

considering input is only for the player

#

you don't have an iteration issue

#

because there is only 1 iteration of the local player ^_^'

rustic rain
#

Well it depends actually

#

Kek

#

Sometimes you control crowds

viral sonnet
#

what kind of data is it? i'm lazy and have tick as a static uint πŸ˜„

rustic rain
#

I consider it too

#

I'm so done with multisystem references

rotund token
#

no system references = good time

rustic rain
#

Yeah

viral sonnet
#

singleton entities have their place but sometimes they are just overengineering

rustic rain
#

Refactoring whole project currently because of it

#

I decided to work through a route of event entities

#

If I have some action that needs to be done

#

I just create entity with component with settings

#

And whatever system that makes action reacts on it and then clears query

#

Makes code so much more clear

#

But probably at a cost of perfomance

rotund token
#

depends how many you're creating

rustic rain
#

Usually once per hundreds of frames

#

Atm

rotund token
#

event entities are great for architecture, i have all my network etc setup with them

#

just not so good for gameplay performance

viral sonnet
#

bummer we can't add something to unmanaged World. that way we could add data types like time, version etc...

rustic rain
#

Sad times of c#

#

Allthough

#

Maybe you can grab source

#

And just dew it hehehe

#

Would be kind of pog if they could implement some kind of codegen for it

#

So when you declare some strcut with special interface

#

It'll get adsigned as field to world

viral sonnet
#

they would just need to make it partial and we could add all kinds of stuff

rustic rain
#

And as property to systembase

#

It is already partial, no?

viral sonnet
#

world is partial, it's mostly a wrapper to WorldUnmanaged which is sadly not partial

rustic rain
#

Oh

#

How do you add to World then?

#

I couldn't figure that out

viral sonnet
#

like with any other partial class/struct. just make new file and write a new class/struct

rustic rain
#

But it just wouldn't give me the world

viral sonnet
#

on compilation they all get added together.

rustic rain
#

It always assumes I create new class

#

For some reason

viral sonnet
#

nah, not when used with partial.

rustic rain
#

Weird

#

I'll try again

rotund token
#

(are you matching namespaces?)

rustic rain
#

But I got pretty sure it wasn't possible

#

If only I knew it was possible

#

I could avoid so many troubles with global referencrs

viral sonnet
#

i have bundled up a looot of methods for a big job with partials. now i have split it into a nice amount of files

rustic rain
#

So you already dis it?

#

Added fields to World

#

Right?

rotund token
#

(apart from storing state i guess?)

viral sonnet
#

no, not directly to world. i never found a use case yet

#

just for my big job

rustic rain
#

Entity references kek, so you don't have to call getsingleton

viral sonnet
#

i see no downside of partials or upside of extensions. yet extensions are annoying with parameters

rustic rain
#

Oh man, that would be a game changer

viral sonnet
#

i had them in the beginning

#

i mean, it's a job and i have lots of access to different arrays

rotund token
#

totally doable with asmref

#

that said i think this is a terrible idea in general πŸ˜…

viral sonnet
#

that's not what we want to hear!

rotund token
#

i can see some usefulness that wouldn't be too gross (things like time)

rustic rain
#

Asmref? What would you need with ir?

rotund token
viral sonnet
rustic rain
#

Hmm, could you show how it looks?

#

If you have it

viral sonnet
#

easy access and no static to some other class

rotund token
#

there's not much to show

rotund token
#

you can't really 'save' it or manipulate it

rustic rain
#

Well it's still key, cause I wouldn't know it was possible

#

Potentially because I missed it