#archived-dots
1 messages ยท Page 279 of 1
500 stats? teh fuck ๐
stats are more than you think
str, int, dex etc
increased damage
but its more than that
this is a completely project wide generic system
stat could be ability to talk to actor
you'll love this
ah cool, so pretty much every variable to track something
{
public float Value;
}
public struct StatEffect : IComponentData
{
/// <summary> The stat type this affects. It matches the index in the stat schemas. </summary>
public ushort Type;
public ShortHalfUnion Value;
public StatModifyType ModifyType;
}
public unsafe struct StatValueBuffer : IBufferElementData
{
[NativeDisableUnsafePtrRestriction]
internal StatEffect* Effect;
}
public unsafe struct StatValue : IComponentData
{
[NativeDisableUnsafePtrRestriction]
internal StatEffect* Effect;
}```
stats are part of my effect system
all my effects are tiny standalone entities
{
public ushort Type;
}
public struct ConditionActive : IComponentData
{
public BitArray8 Active;
}
public struct EffectActive : IComponentData
{
public bool Active;
}```
so StatValue exists on the effect entity
but the owning actor has the same ptr in a buffer (all stat effects of an entity have a pointer into this buffer)
so stats can write their state directly to their owning entity without needing to do BufferFromEntity(Entity)
basically 5 types of effects atm that control everything
- modify stats (above)
- capabilities (put things on cooldown etc)
- add tags (stunned, invisible, etc)
- remove modifiers (poison etc)
- create new effects
Are your dependencies handled with the normal job dependency system?
ah that's pretty good, I utilize pointer caching too. do you set the ptr all the time or how do you handle chunk changes when the ptr would change too?
yeah they are actually
everything is ISystem atm
i use some query tricks to ensure safety
its not pointing to the entity
the entity change it doesn't matter
it's pointing to a large chunk of 'stat' memory
basically i sat down and was like, how would i do this if i was using c++
Something I was wondering, if I have an IComponentData with an UnsafeCollection inside, it should be safe to write to that unsafe collection inside a scheduled job as long as I'm declaring that dependency properly, right? (e.g. ref inside an Entities.ForEach). I assume it just won't detect me modifying it if I don't pass the correct dependency
ah cool, how do you manage the big block of memory?
btw. the picture you've just scribbled down is why I think ecs is not *that * great
traditionally i'd do this all on the actor entity
but by separating it, it's a lot more dynamic and easier to develop
i can conditions a lot easier
and also checking condition changes on effects is just much faster in tiny archetypes
i can actually smash 10,000,000 effect entity checks
in a fraction of a ms
i think it was 0.24ms if the chunks had nothing else
going up to 0.74ms if i add 32 bytes of random data in the archetype
so the block in the middle is still an ecs chunk?
nope
the middle block is my own managed memory (managed bad term, i mean i'm managing it)
cant use ecs chunks, it'd move
yeah, thought so ๐
a lot of design ended up in such blocks or I'm planning to. shame that unity hasn't thought of it. maybe because they are not actually developing games ๐
I doubt very many games need the performance required by such a system, and if they do, I think you are at the point where you either decide to work around the kinks or write your own engine
can you detail the middle block somewhat? I'm mostly using a data type similar to NativeList. linear memory, able to grow
UnsafeUtility.Malloc
except i have custom native memory allocators
i havent decided which i'll use it
i have a bunch of slaballoctors etc
need to determine what works best in actual realistic conditions
Is there a list of stuff that they plan to add in with 1.0 besides the "journey to 1.0" or whatever the post was?
just malloc? is this a frame buffer then? how do handle resizes?
yeah there's a whole roadmap
you have surely seen t
https://unity.com/roadmap/unity-platform/dots not that exciting, official hybrid support, better tooling
Ah I haven't actually seen that one
Haven't had a lot of time to check up on DOTS stuff since I've had to learn inferior languages like python and JS :[
what do you mean? the value only a single float
and it's persistent while the effect entity exists
ah ok, I thought it's a global buffer for all stat values. so the block is per actor?
it is a global buffer of all stats
each player has a buffer of the stats that are on them
python is great, had to use it for tensorflow. python > c# for ML
Yeah for ML the community around it is pretty great
Only had a short course in university on it and while it was interesting it's not really my thing
too much math @_@
Any idea if there is any guarantee of the order of an EntityQuery
ie say you have a bunch of components called MyTag, that are created in a specific order, one after the other
and they are never destroyed
would an EntityQuery for those always return an array in the order they were created
yeah i'm wondering, maybe layout/order could change maybe if archetypes/chunks change
pretty much every system i'm optimizing and happy with then is a process of moving lots of data into specialized containers. putting all data into a chunk is such a trap. I still have not really found a good feel of which data should end up there and which shouldn't. that's really hard and often unintuitive to find out.
basically wondering if i can avoid doing that tbh
What do you need their order for?
so that buffer has to grow somehow with the actors. or am i missing something?
Just do this: UnsafeUtility.Malloc(SystemInfo.systemMemorySize * 1000000, UnsafeUtility.AlignOf<float>(), Allocator.Persistent);
Computers hate this one simple trick
ah not worth explaining tbh, i'll give it a whack as is and if i have problems later will index them
Relying on the order of the entities just seems like it could produce some nasty bugs down the line
if the chunks doesn't change and only grow the order stays the same
i just wonder how you'd never delete something but if you don't, you're good. also, entity indexing is quite fast which wouldn't rely on being completely deterministic
is blob data actually put on the stack? or how can we force to put the whole blob there? i think ref reading values one by one slows down a lot. maybe I'm wrong though
I think only the reference is put on the stack
But since the entire blob is layed out linearly in memory it should be in the cache after you access it and be very fast
my blob would exceed a cacheline
That doesn't change if you were to somehow copy it
You'll still need to actually read it
when a new effect is created yes, the effect has to add itself (and the ptr) to the buffer
effects aren't super frequently created
on piece of gear [un]equipped
on point put in talent tree etc
etc
on bite taken out of croissant? if it's a poison croissant?
the more frequent ones would be via combat, poisoning etc
probably handled by ecb.AppendToBuffer but undecided
depends how i implement that side of it
Are "old" effects deleted? Otherwise I feel you would have a lot very quickly
For example if someone eats a lot of poisoned croissants in a short timeframe
yeah that'd be a bunch of effects
i'm testing with 10,000,000
and processing state changes in under 1ms
so atm i can handle a lot of effects on a basic level
obviously that number will never be that high and there's a lot of other parts that won't be nearly as fast
That's a lot of croissants
Marketing โ
anybody know if there is a method to get a euler from a math.quaternion
i'm not aware of any math.euler, have to roll your own I guess https://stackoverflow.com/questions/12088610/conversion-between-euler-quaternion-like-in-unity3d-engine?answertab=trending#tab-top has some answers
yeah bit of a pain
i wouldn't recommend it though. do you really need the euler angles?
i think the physics package has some
generally i feel like the main good case of euler angles is (first person) character controllers
thanks yeah i'm deconstructing and reconstructing some bone rotations with per-axis adjustments
be aware of inaccuracies, angles could start to drift
yeah, thankfully i realized i actually only need to do it one way for now, so i can use quaternion.Euler(float3) to construct a rotation from a euler
i might need to actually get the euler value from a quaternion at some point though
is this an actual downside of profilemarkers? i measure every part of the code yet there are these huge gaps in between
my job without profile markers, 0.6ms, my job with profile markers, 2.4ms
profile markers don't profile themselves!
hm, i'd at least expect the gaps to be the same size, yet the last one is much wider
and yeah, profiler markers should profile themself and show it. as they are now they are pretty trash
at least, i'm not figuring anything out other than, a quite involved method that does a lot takes double the time as acquiring GetBufferAccessor that's only called once. that can't be right ...
if i comment out the method the job is so much faster that the method takes at least 80% of the time. I don't get why that's not showing up with the markers
burst must remove a lot when i comment it out. otherwise i can't explain it
Okay so i have an interesting quaternion math problem:
Normally to get the world/global position from a local position you would do:
Vector3 childGlobalPosition = (Quaternion)parentGlobalRotation * (Vector3)childLocalPos + (Vector3)parentGlobalPosition
However in Unity.Mathematics it's not possible to do the equivalent quaternion * float3 like this:
float3 childGlobalPosition = (quaternion)parentGlobalRotation * (float3)childLocalPos + (float3)parentGlobalPosition
I have no idea of the math to make this work
using math.mul((quaternion)parentGlobalRotation, (float3)childLocalPos) doesnt work either
you mean it doesn't recognize multiplication syntax?
nah it just doesn't allow quat*float3
ahem, weird it won't mul quat and f3
i think in standard unity it's setup to allow Quaternion * Vector3
but not with the Mathematics library
this type of math really isn't my strong point ๐
yeah no it doesn't
ah wait
i'm an idiot
it does
jeez, was forgetting to replace the * with a , in math.mul
not enough sleep, is my officialยฎ excuse
classic
well, TIL that to get world position of child you just multiply rotation by local position
sorry what du mean?
I didn't know how to do that one
but now I know
kek
You came for help, but you actually gave me one xD
Ahh hehe.. yeah I really need to learn the math behind this stuff properly, I basically just pick up what I need to get the thing done
Having stuff like transform.InverseTransformPoint etc is mega convenient but you can get away with years of not knowing the math behind it
In the same token, you dont need to know the circuit diagram of a CPU to be able to operate a PC
Knowing math helps as you will be able to create complex algorithms
just to note - remember to also add parent position to that, so: childGlobalPos = parentGlobalRot * childLocalPos + parentGlobalPos
I personally enjoy creating world space animations through async code a lot
That's actually part of what i'm doing
I've created a code driven procedural walk animation
Then i've used it to drive a custom IK system
Which then drives the joints of an active ragdoll setup
So it's, kinda complex, but i built and prototyped each part in gameobject world with standard unity mono's and joints etc, then unified the code into one single mono/update, and now i'm transferring the whole thing to pure dots
mm well prototyping i think is definitely 10x faster with standard unity
not thinking about data layouts and ordering etc etc
uugh, I rarely think about data layouts in dots at all xD
just throw some code together, build some gameobject prefabs, tweak joints and values easily in the editor etc
fair enough yeah, i do find it easier to prototype in the editor though
i think, for pure logic situations, ie not dealing with joints and hierarchies so much, dots is arguably just as quick and maybe actually simpler/easier
this is the procedural walk cycle, the gameobject version, before i added in the active ragdoll setup:
https://gyazo.com/351c57d47a1cddd9e37ebbcd047d28ff
really looking forward to seeing how it performs once i've finished the dots version
life would be a bit easier if they hadn't removed the Animation package ๐
that's basically why i decided to prototype a procedural anim system
i tested unity's Animation Rigging for IK, it's really nice and runs on Jobs, but it relies on having an Animator component so can't be used for a pure dots solution, would need to be hybrid setup
imo it's ill-advised to use vs code for dots at this stage
i would definitely stick with vs studio or rider
but to answer your question, not really sure sorry
so v-rising is interesting - first game i've seen make use of subscenes, 1744 of them to be precise!
first time seeing it. looks great
oh the game? super popular
35k reviews on steam in 1 month
they have some really giant jobs
is there a talk about it?
๐
well i probably won't go that deep because il2cpp and i cbf
just looking at signatures atm
can tell you a lot
HandleGameplayEventsSystem for example has 25 BufferFromEntity
maybe just 25 diffrent eventqueues?
they aren't all events*
oh well, time to actually play it ๐
public BufferFromEntity<AggroDamageHistoryBufferElement> getAggroDamageHistoryBuffer; // 0x16B0
stuff like this
you know how big their team was?
ah the bloodline champion guys
any idea if it uses dots Animation?
i had a follow up question to your effects implementation.
How do you handle update order of affected stats and when and how do you update the stats on a unit?
Do you recalculate all stats whenever a new effect is added to a unit?
How do you deal with stuff like agility attribute changes speed. (all agility must be calculated before speed then)
after you can calculate the speed from items + attributes etc
How do you handle update order of affected stats and when and how do you update the stats on a unit?
first pass i literally update them every frame
that was what i was testing this morning when i had weird performance
ah ok
can update 10k units with 512 stats in 0.70ms
but yeah my next objective is to filter this down a lot since its really not needed
well with such a performance you dont really care if you recalculate all stats on one unit if 1 effect changes
my system is supposed to be reactive. but i still have to check every effect every frame for what i believe you called conditions
but you can do it with dots either. Make component with settings, make system that reacts on this component and you can even edit it in runtime
every time you change component data in subscene
it'll regenerate that entity
thus you can tweak everything in editor
yeah, subscenes for me are buggy and fickle tho, not worth the hassle
i'll move things in to a subscene at a later point if it makes sense to, but at this point, it causes more problems than anything
But you can create subscene just for this testing purpose
literally drop 1 entity here
do not close it upon clicking Run
and here you go
fully debuggable entity, ability to edit authoring component
it's actually that easy
yeahhh that easy if you're doing something simple maybe.. i eventually decided to just stop fighting it and not use them
problems with conversion scripts running or not, problems with scripts updating after changes, etc etc etc
hmm
Can I use Unsafe Container in component?
or do I just use buffer?
hmm
all right, generate attribute
still doesn't support it
how so?
I thought unsafe containers are just normal native ones with pointer instead of actual memory
how much performance improvement did you guys see when switching to ISystem for a System that is basically just scheduling one job and doing nothing else on mainthread? is it worth the hassle right now?
personally my relatively complex systems tend not to be that complex and also use things that cant be used with ISystem yet so its hard to tell
what's up with ISystem?
Never heard of it or it's use
also not a single word in manual
unmanaged burstable systems
wait what, where is burst compile settings are now?
same as they were before?
It always was in Jobs menu
does anyone else randomly have spikes in systems execution on mainthread? i have some frames where certain systems just need 100x more time than usual. and all the system does on mainthread is scheduling... so how does it take nearly 1ms to schedule 2 jobs???
usually its around 0.01-0.02 ms
it has something to do with DisposeSentinel.Create
Then it won't be a problem at runtime :)
allthough, it might be jobs debugging
ah i didnt know. but u mean build right?
Yep, in a build
and why do i have those red bars there telling me i allocate garbage when the profiler says i generate 0 garbage?
I don't remember if it's one of the safeties you can disable or Always on
Can't answer that one, maybe the safeties do allocate some garbage
Yeah should be this safety. To warn you when you forget to dispose
Hence the name
(dispose sentinel)
still i find it weird that it just spikes sometimes.
but i can confirm it is the leak detection. no more spikes without it
does anyone use or know of some ecs frameworks ?
I had started making my own sort of "framework", because ecs is kinda barebone, and I don't like some features, like the default bootstrap, which is simple, yet not very practical solution
well DreamingImLatios has a framework with some nice tooling inside. havent tried it though
the problem is that writing my own framework takes time (so I don't really contribute to my projects) and is incremental, you could say, because I add features and solutions only when I encounter the problem
yes, that's the one I just found
are there any more options ?
there are some nice packages that help with events and polymorphism in components but not so much frameworks
not that I know everything it does, it's that I have a solution for addressables that I've incorporated into my code
Latios even said he shouldnt have named it framework.
what would he call it ?
i think he said its actually a collection of tools atm. but im not sure. its somewhere buried to an answer to me on the forums i think
but thats the most complete "framework" you will find
it has some nice features, like physics, audio and stuff
I just try to analyze what it can do, whether it's worth porting my projects to it, but his demo kinda discouraged me with his rap god style description of certain use cases, instead of describing general stuff, workflows, and how things relate to each other
I've had a similar problem with svelto ecs, as all the necessary information was encrypted and turned into lengthy articles, and I ended up making a whole diagram to visualize individual stuff and how they relate to each other (not to mention different naming)
well ecs just isnt easy to make userfriendly yet. so there is much to explain i guess
why unity ECS is not an option?
by framework I mean something built atop of unity ecs, of course
yeah, sort of
also, hybrid solutions are necessities even today, and I'm afraid vanilla unity ecs is not handling it well
on new update you might just end up with not updated framework
because ECS might change a lot
depends
that's why they say it's not production ready ...
there are certainly no ready solutions for a lot of problems
but nothing stops you from recreating them yourself
yes, there are things that do
like time
I tend to regret not putting my time and energy into the final product
and I assure you, I've wasted a lot of time on such things
already made tools and solution, even if it would mean sticking to the same ecs version for the entire life of a project, might just be the best, I just need to know which are made the most suitable way for my case, as I use addressables, the new input and ui packages, and I do things procedurally, so there's like no gameobject to entity conversion (most of the stuff isn't even supported by ecs, such as animations, audio, lighting, etc.)
yep, but just not in this alpha state of ECS
why is building subscenes SO much slower... pre converting my project to subscenes i had buildtimes of around 20-30 min. now it takes close to 60
...
and then the build doesnt even start... without giving me an error i comprehend T_T
no idea atm. i dont even know anything specific about the building process... cant find how build cache works etc.
also i dont understand why it wouldnt use the incremental build pipeline in my case...
i build into the same folder without any changes. it still takes 50 min
Asset Pipeline Refresh: Total: 0.306 seconds - Initiated by RefreshV2(AllowForceSynchronousImport)
Summary:
Imports: total=0 (actual=0, local cache=0, cache server=0)
Asset DB Process Time: managed=0 ms, native=304 ms
Asset DB Callback time: managed=0 ms, native=1 ms
Scripting: domain reloads=0, domain reload time=0 ms, compile time=0 ms, other=0 ms
Project Asset Count: scripts=11699, non-scripts=5231
Asset File Changes: new=0, changed=0, moved=0, deleted=0
Scan Filter Count: 1
InvokeBeforeRefreshCallbacks: 1.591ms
ApplyChangesToAssetFolders: 0.273ms
Scan: 272.346ms
GatherAllCurrentPrimaryArtifactRevisions: 1.366ms
UnloadStreamsBegin: 3.169ms
UnloadStreamsEnd: 0.048ms
Untracked: 27.532ms
this is from the editor log. its scanning the files and sees 0 changes (takes 272.346ms. -> ca. 5 min)
then it does this multiple times over...
the next scan takes 800k ms
why is this so slow and why is it done multiple times
hmm, is it possible to edit gravity factor in physics body?
IIRC yes
I need to be able to toggle body from being kinematic and dynamic
Can't find on which component
it is written
ah i meant its in PhysicsBodyAuthoring
no idea in which IComponentData it is written in conversion
@rustic rain if (body.GravityFactor != 1) { DstEntityManager.AddOrSetComponent(entity, new PhysicsGravityFactor { Value = body.GravityFactor }); }
from the conversionsystem (PhysicsBodyConversionSystem)
yeah, but it's required in runtime
?
switching body from kinematic
to dynamic
I think
it's inverse mass after all
but it's so weird
why you think its inverse mass? the snippet i posted shows u that it should be in a PhysicsGravityFactor component
at runtime
wha
I don't even have that component
xD
maybe it's added
upon
modifying gravity factor from default
look into the conversionsystem i got it from
yes. and -1 seems to mean that the body is kinematic
where did you get -1?
i see it is added if it is not 1
since a factor of 1 would do nothing
{
get => m_MotionType == BodyMotionType.Dynamic ? m_GravityFactor : 0f;
set => m_GravityFactor = value;
}
thats from PhysicsBodyAuthoring
I have no clue how to use a subscene
And the fact that the DOTS hierarchy doesnt highlight the currently selected entity is so fucking dumb
How did that manage to make it past QA?
[Worker2] 1 entities in the scene 'TestSubscene' had no SceneSection and as a result were not serialized at all.
Anyone know what this is?
im sure subscenes will be amazing at some point. RN using them has alot of hidden implications im not totally aware of yet. i am still converting stuff to be compatible with subscenes... took me quite a while already. I expected performance speedups but really it feels slower working with them in my current workflow
is that a gameobject you spawned or is it in the scenehierarchy already?
Ehhhh, i'm gonna stick with the tried and true just manually convert it using OnStart
do you mean the converttoentity component?
No. Make my own monobehavior that has a section of code in OnStart() or OnAwake() that gets World.DefaultGameObjectInjectionWorld And just creates the entity with relevant components.
Never go anywhere near the conversion workflow
ah so no conversion but basically spawning in first frame
pretty much yea
and destroying the GO after first frame
unless it needs to be rendered of course
i havent gotten to the point of creating my own rendering system for sprite so I use the built in one
well conversion will be the standard and optimized workflow at some point. if you have a project that will go on for a while i think its better to use subscenes sooner rather than later
well, it seems intended for the HybridRenderer ecosystem but I dont have HR so it breaks sprite rendering
ah wait was it you who just used 1 or 2 systems and the rest was still gameobject code?
Yea
yeah makes sense then.
Do we still need the convert to entity component if its being converted by subscene?
how i handle sprite renderer (with pure ecs gamelogic) is instantiating a gameobject for each entity that needs a spriterenderer and sync the gameobjects transform
no
Do you have to add the "SceneSection" component to all entities being converted
if they are converted by a subscene they should have it
maybe if you instantiate extra entities aside from the ones created by conversion you need to add it?
but it should work with CreateAdditionalEntitiy()
umm not sure but you probably need to use the right LiveConversion setting
where do you have this Entity Conversion preview? havent seen it yet
huh, recreated the GO again and it works
sometimes the scenecache is somehow broken.
you can use this to clear it and force it to rebuild:
hrm, if I add my PointLight conversion script, it breaks again
when I remove it, it works
your script got deleted. but i didnt see anything wrong at first glance
hrm
Adding a generateAuthoringComponent makes it work but not my own IConvertGameObject
I wish I could set default values but this is fine
bbeemmsa
So how would you keep something like a SpriteRenderer?
i use hybrid renderer for sprites that dont have animation
so i just let the spriterenderer be converted
Thats annoying, im gonna have to do it myself
for everything with animation i spawn a gameobject after conversion which is only the representation and sync it with the entity pos
that way i can still use all the old systems which have no ECS implementation yet but can do all the costly stuff like AI in ecs
Because I can not convert physics 2d colliders and movement must be through the physics system
through the old physics?
yea
not DOTS physics, just regular 2D physics
i had issues with instability and vibration when moving against DOTS physics surfaces even with the Z level of objects clamped
Anyone know how to remove that message?
what the fuck is wrong with the entity debugger anyways? It has HIGHLIGHTED ENTITIES
Guess which entity i clicked
Guess which entity I clicked
BLUE HIGHLIGHTS. REVOLUTIONARY
well in theory it is replaced by those debuggers :
oh wait you dont know about the dots hierarchy?
nope
The first image is the debugger, second is the hierarchy
what do i need to toggle on to allow selected entities be highlighted
because in its current state, it's unusable
ah i see now what you mean. i guess the highligthing broke in 2021 or sth. it worked before.
if you have the SubScene in edit mode you see which one you selected atleast
(the one with the cube symbol)
Yea, barely
so dumb
I want to remove that message, it takes up nearly a fourth of the window
well that will be fixed. for now its totally fine to use the entitydebugger. it has features the other debuggers dont really have yet
the debugger works so well. Old reliable. Unity should stop trying to reinvent the wheel with so many useless windows and empty space
there are some nice new concepts too. i like the relationships stuff.
The inspector I admit is the one place they actually improved
Hierarchy, system, and archetypes need to be scrapped
idk. i like it actually. i just miss the possibility to filter for a set of components in the hierarchy
Yeah hierarchy just needs proper filtering
I barely find myself using entity debugger anymore now
Maybe because I'm doing my own hybrid things, I still need the GO list up and inspector. I dont have the room for 3 more windows
I just have dots hierarchy and normal hierarchy in same group
And just switch between the tabs
I agree I can't have them all on the screen at once
But entities debugger is so big can't have it on the screen at all!
Yea, conversion is a neat concept but I need GOs mirrored in ECS world, not the other way around. Physics2D doesnt work well with entity conversion.
Hrm, i might just create my own conversion system with that priority in mind
@rotund token you got any idea why incremental builds could be broken? i need 50+ min per build even without changes
That seems very long
Only takes me 15min for a full build at work...
Unless I'm doing like super optimised ps4 which needs like 128gh memory and 4 hours...
Total: 687.795292 ms (FindLiveObjects: 67.524917 ms CreateObjectMapping: 22.962209 ms MarkObjects: 595.840083 ms DeleteObjects: 1.467167 ms)
Memory consumption went from 4.56 GB to 4.55 GB.
Well that's 1.2 seconds
My personal project build time halved in 2021 over 2020
Only 3 min on il2cpp
ups wait i thought that was a summary
oh lol sry that was not the build. that was an asset pipeline refresh in editor
But yeah work still 2020 so have no major project to compare
well i wouldnt call my project major.. thats the thing
What level is your c++ compiler on
where do i see that? :S
Project settings
Debug, release or master from memory
Release should be default, master on some platforms could take a long time
u mean this ?
No
hmm you know which sub menu it is located at? cant seem to find it
ah :
in build settings i did build with mono. cause IL2CPP wouldnt build at all
i also read somewhere that mono is supposed to be building faster
im trying another il2cpp build now
UnityEditor.Build.Pipeline.ContentPipeline:BuildAssetBundles (UnityEditor.Build.Pipeline.Interfaces.IBundleBuildParameters,UnityEditor.Build.Pipeline.Interfaces.IBundleBuildContent,UnityEditor.Build.Pipeline.Interfaces.IBundleBuildResults&,System.Collections.Generic.IList`1<UnityEditor.Build.Pipeline.Interfaces.IBuildTask>,UnityEditor.Build.Pipeline.Interfaces.IContextObject[])
Unity.Scenes.Editor.EntitySceneBuildUtility:PrepareAdditionalFiles (Unity.Entities.Hash128[],UnityEditor.Experimental.ArtifactKey[],UnityEditor.BuildTarget,System.Action`2<string, string>,string) (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Scenes.Editor/EntitySceneBuildUtility.cs:219)```
no idea what causes this ๐ฆ
omfg :
IL2CPP requires the use of generic sharing to work when using Unity 2021 LTS. This can be enabled via Project Settings > Player > Configuration Section > IL2CPP Code Generation > Faster (smaller) builds. Depending on how generic types are used by your game, there will be an additional runtime cost in IL2CPP builds with generic sharing enabled. We are actively looking into this issue; please share any feedback you have to help guide our efforts towards addressing this.```
and this Faster (smaller) builds Option is only available in alpha builds...?
oh man. in the post i posted above it was supposed to be in Project Settings > Player > Configuration Section > IL2CPP Code Generation > Faster (smaller) builds.
mind you this is the actual current post explaining knows issues for Entities 0.51...
Huh - so this is all I did to get my build working in 2021 and entities 0.51 ๐ค
https://forum.unity.com/threads/executionengineexception-attempting-to-call-method-unity-entities-fastequality-compareimpl-1.1296462/#post-8213826 this was the post I followed just for the configuration since it wasn't in the Player Settings
I am messing with 2d on ecs rn btw
Managed to make it work by adjusting colliders
And applying 0 velocity to certain constraints every tick
So far seems to fullfill my needs
Which is collisions, triggers and a bit of gravity
thank you! i hope ill get it to run now
My project is also centered nearly entirely around a tilemap and it's collider. Have you had any luck converting a tilemap collider composite to dots physics?
just 2d gameplay with a tilemap
top down or side?
top down
So what's up with tilemap?
so do you actually need a collider or is everything on y = 0 anyways?
i do top down 2,5D and i just use a navmesh on my tilemap
I haven't used classic unity much so I don't really have much idea xD
converting a composite collider2d into a 3d physics collider mesh is painful and even then, moving along its surface causes vibrations
i got a lot of projectiles as well that bounce off the collider as well
but has your tilemap height?
no, just flat 2d
then why not have a huge plane as a collider. and some kind of navmesh where your agents actually move that is baked from the tilemap
What's even the point of tilemap collider
Why not just have many box colliders?
Or plane
i got a lot of colliders, moving a bunch of box colliders will massacre performance
honestly im not sure it would. if you make them static it might work anyways
not for static objects
From current state of components on entities
what manarz said
physics is broken into 2 groups, static/dynamics. statics only rebuild if something has changed.
hrm, i'll see if anything changed with physics since the last time I checked
well obviously it leads to 1 recalculation of the static world
which was about back during 0.15 days
Doesn't sound too bad
Considering dynamic world suffers worse fate most of the time
on a tangent, i would not have made a 2d game in entities - you guys love pain ๐ฌ
It's fine
well i couldnt do it without dots performance
dots != entities
true but back then i didnt know lol
Everything else is same as 3d
and i fucking love ecs architecture
Triggers collisions and etc
Same
I cringe every time I have to work in classic unity world xD
Hopefully dots will make it to 1.0 and someone might hire me xD
but tertle is right. 2D was a lot of PITA. just today i finally managed to get rid of all the unnecassary 2D Tools overhead unity has... Like sprite Resolver at runtime. IK manager at runtime, Sprite Sorting Groups
i went from 40fps to 80 fps in editor...
not sure about that
batchInChunk.DidChange(LocalToWorldType, m_LastSystemVersion) ||
batchInChunk.DidChange(PositionType, m_LastSystemVersion) ||
batchInChunk.DidChange(RotationType, m_LastSystemVersion) ||
batchInChunk.DidChange(PhysicsColliderType, m_LastSystemVersion) ||
batchInChunk.DidOrderChange(m_LastSystemVersion);
if (didBatchChange)
{
Result[0] = 1;
}```
```if (world.NumStaticBodies != previousStaticBodyCount)
{
haveStaticBodiesChanged[0] = 1;```
```if (buildStaticTree)
{
m_StaticTree.Reset(staticBodies.Length);
BuildStaticTree(staticBodies, aabbMargin);
}```
any change to any static causes the entire static tree to rebuild
And removed unnecessary packages?
thats what i meant. again im bad with words i guess? ๐
oh i get you, 1 recalculation
i thought you meant, only 1 entity is recalculated
not 1 physics world is recalculated
well incremental rebuilding would be nice to have
but honestly the static scene should be static
well unity physics is specifically designed around being stateless
ah true. that would also be considered state
What about those 2d tools you mentioned?
whenever i think i understand how to get sth deterministic and stateless i always am surprised at the actual implications
I want fos improvement too xD
no i didnt remove the unnecassary packages. i disabled the components responsible for that stuff at runtime. my artists still wants that stuff for editor workflow
but to be able to do that we had to change a lot about how we built our prefabs
no i just disabled the IKManager2D for example. so unitys
but that again meant i had to write a tool that converted Animations with Ik to Animations without IK
Smth I don't use at all, it seems
its the 2DAnimation package
Havok has this option called Contact Point Welding which might solve this, not sure
If I execute animator manually
Was reading up on Havok earlier, just wondered if it related to the problem you were having
Tbh not sure if I should try and write my own 2d renderer and animator xD
but didnt u make that spacesim game?^^
Smth tells me focusing on game would be better
i didnt think it would turn out 2D
It's different project
It was almost finished on classic unity
So I decided to finish it
But on ECS
xD
"finished" ^^
Basically rewrite from scratch
It was literally almost finished
I only needed to finish UI, fix minor bugs and build it for android
And that would be released project kek
Yea, that sounds like the issue i had. Havoc will be a problem when I attempt to implement multiplayer though
but wait u wanted normal physX unity physics right? wouldnt u have the same problems?
Yeahh.. i think if UnityPhysics implemented sleeping the way Havok does it and a couple of other things it'd be golden tbh
well sleeping isnt stateless i guess?
Not sure but i'm assuming he doesn't have his issue when sliding in physx
๐คทโโ๏ธ
yes but physx is not stateless either. so also a problem for multiplayer as far as i understood
Physics 2D uses geometric shapes for contact resolution, no issue with sliding
but i never implemented a physics multiplayer so dont quote me here
oh sry. physics2D again is sth diffrent. but still stateful
yea... i guess no unrolling. What I want is no vibrations when moving along a surface
Anybody know how i'd recreate Quaternion.FromToRotation with Unity.Mathematics
im pretty sure thats possible with unity physics package too. its just about the settings you chose. you could check out the car controller demo
Why are there vibrations in the first place? Is surface flat?
IIRC it did feel smooth
yea, it was just a box and a circle
i mean its one of the most basic usecases of every physics package right? move along terrain
Rotation of x point looking at y point?
And how objects are moved?
moving the circle against a fixed position box, pushing against it diagonally, resulted in the circle continuously repulsed.
Through force?
WASD setting the XY plane velocity
did you use continuous collision setting?
Holding down the movement key against the box (moving the circle), resulted in the sphere "vibrating" against the surface of the box.
IIRC, this was about a year or two ago, yes
WASD sets the velocity parameter of the circle rigidbody
What changes to what components
Just that, very simple. I have a copy here but for physics 2D. Use it everywhere
Oh, it's classic 2d
Except the velocity was a float3 because 3D, but the Z was 0.
yea, nothing fancy at all, very simple
My project is top down 2D, so there will be a lot of pushing against wall tiles when moving. If the collider vibrates against just a single box, it's not usable.
well i guess.. basically what's the math behind Quaternion.FromToRotation.. it just takes two rotations and returns the 'difference' or the rotation required to go from rot A to rot B
I have no idea the math behind it tho ๐
yeahh
takes two vectors ( 'directions' )
Then it's probably just
Euler(To - From)
yeah this is what i'm not sure, is it that simple ๐
i guess i could test and compare the results
yeah i mean if you minus one position from another, it'll give the direction
but in the case of working out the rotation between two direction vectors, not sure
if the math is as simple
this type of math is the black hole at the center of the galaxy for me ๐
It's not directions but positions
yeahh
Hmm
They should open up the code behind the old unity maths methods for the benefit of people transitioning to dots
I guess logic behind is creating quats for both
And doing matrix division
Not sure though
Yeh see that's the edge of the black hole for me
ideally yeah
So you know Z - result rotation
And you might get it by division, but I'm not sure if that's a thing tbh
actually i was getting this error with upper case, which i wasn't getting in my managed version
T_T :
so i figured screw it i need to bite the bullet and figure out how to do this without the helper method
btw. my artist tried to build and it took 1,82 hrs... there is definitely sth broken or i use some very wrong pattern...
im done for today
hey trying to learn how to build with dots, and im following the manual's guide, but im having a hard time installing the windows build package, it just gives me errors, are there any dependencies?
you do not use windows build package anymore
oh ok, guessing the manual is slightly outdated then?
all the packages except the default build package are no longer used
and that is included in the dependencies for entities
what part of the manual tells you to get windows build package?
brb with a link to it
wait im stupid ,this is outdated
yup.... only realised now...
thank you so much, sorry that im a bit of an idiot
is there anywhere in the manual that says how to set up the build configuration thing? As i cant seem to find anything about it and i have a bad feeling im missing something obvious....
hmm from more research i see that in 2021 the component menu is a pick a path situation, and you just guess and until you have what you want, but still what is needed for it i cannot find, im really missing something lol
ok found some samples on the github, gonna mess arround with them and see if i can get them working
ok i think i got it working, although new challenge, i need to work out how to add scenes to the build thingy, or somehow find the option that lets me build whatever scene i have open
ok it appears there is no information online about this, so ill have to trial and error until i find some weird way of making it work, although personally i am mildly annoyed that the manual had no info on how to build a dots project
what's this?!
there is a page on it now
you add a scene list
very little information from what i could tell, but still useful i suppose lol
how?
add component
its just htat in 2021 the menu is broken
and you can't browse it
that's probably the problem you're having
yup, but the buttons still work atleast
imo just load up a 2020 project and set it up
or simply import the one from the samples project
once components are added works fine
oh i did import from one of the sample projects, tried many, none of them are working, cause none of them have any scenes in them
pretty sure it should have the scenelist on the build config though?
you just add your own scene
let me go check again brb
like the manual image
Oh god, broken build asset
oh mine has no scene list, which tab is the scene list under so i can add it?
Still not fixed?
it works, ish, just you are not allowed to see
guess and check
but there is a simpler way
just use the search feature
which is basically not broken
say you want to add a scene list in the broken thing, as i figured out, you search "scene" and then click the top result, usually you get what you want
so the component thing, while it may look broken, it still works fine basically
Huh, that's a nice catch
lol
welp atleast you know now that you could have used search
tbh i used to do the same though lol
this is what i use
lol
anyway, now that ive built it, where on earth in my file system would it have gone, as for some reason i couldnt find the location settings, so i just hope the default was good
if you don't specify a path
i believe it's in project/Builds
at least that's where mine end up
that is what i thought, but that is an empty folder on my end
not sure =S
yup that is how mine looks
maybe last place previously built
mines built though?
lol
hmm, ill hunt around then
there is a component you can use to specify build output folder
just builds where i want it it to by default though
sure it built successfully?
not sure, let me go check brb
i dont know, it didnt give me any errors like it used to, so i suppose it did good?
whats in your log
what log?
lol
nothing currently, other than unity complaining about some random fir tree not having the correct shader apparrently (i dont even have it in the scene)
if it hasn't logged success or errored it hasn't built
what components are you using
these ones
yeah thats not enough
pretty sure you need general settings
ok, ill grab that then
and classic build profile, scene list - which you have
ok ive got it now, and ill rebuild and report back
ok it is giving me an error finally!!
appears to be something to do with dots compiler messing something up, gonna restart the editor and rebuild, and then ill report back!
Turns out leaving it float, int even with the nice data struct burst can not vectorize it. Requires the float4/int4
From my experience this is very common
If you want to vectorize it, got to give it the right data
judging by how the build has taken over 12 minutes as of now, im guessing it is working, so yay thank you all so much!
what's with everyones build taking so long =S
my computer is a tad ancient lol
yikes, i hope mine doesnt take that long
i wonder why building dots takes so much longer than non-dots?
i don't know
Build Win-ClientServer succeeded after 1.30m.
my dots project only takes 1min 30
woah lucky
as someone who isnt famillier with that stuff, what is the difference between the llpc2 or whatever it is called and the other build options?
as the name suggests il2cpp is basically converting il 2 cpp ๐
aha, that means nothing to me, other than cpp which is c++ id assume?
note, il2cpp: Intermediate Language to C++
oh thank you lol, dont know what exactly that means, but atleast it is clear that it is something
are you familiar with how c# traditionally works under mono or .net ?
if you want more info, https://docs.unity3d.com/Manual/IL2CPP.html
its very interesting ๐
not really, but someday ill probably go learn
ooh nice, ill check that out some time
woah from reading that, that sounds cool!
.net includes the CLR (common language runtime) which is the execution engine.
programs written for .net (e.g. using c#) don't compile into machine code, instead they compile into CIL (common intermediate language code) and execute JIT (just in time) converting CIL to machine code depending on architecture.
ooh fascinating!
thanks all for teaching me such intriguing stuffs!
that sentence did not have good grammar, but i couldn't figure out a better way to structure it lol
think of mono as an alternative
and it's what powers the editor
and why you can recompile quickly in editor and just jump into game
oh ok cool!
il2cpp on the other hand converts the intermediate language to c++ then compiles it natively
just reading that should make you understand why it takes longer
but il2cpp can produce much faster code than the old mono found in unity
the other important reason it exists is certain platforms don't support JIT only AOT (ahead of time) compiling
e.g. IOS
anyway i'm no expert on this but it should give you a basic idea of it
wow, that is fascinating, thank you so much for teaching me this stuff lol
Il2cpp is nearly impossible to mod sadly
not really true
there's good injectors on it now
people modded our game within a week
even unlocked our dev console (whoops, forgot to disable that)
lol
it's hard to read source, sure, but you can get all contracts easy enough
this is my dump of v-rising contracts which uses il2cpp
for example
that said
it comes a lot down the developer - it's obviously going to be a lot easier if you provide info
{
// Fields
private Dictionary<ComponentSystemBase, PerformanceRecorderSystem.RecordingKey> _Recording; // 0x18
private Stopwatch _Stopwatch; // 0x20
private bool _IsThisSystemRecording; // 0x28
public static bool StaticRecordingEnabled; // 0x0
private static int _JobWorkerCount; // 0x4```
like you can see all fields in systems
decompiling il2cpp has got pretty good
They're making the necessary steps to update internally, it'll just be a while
I'm not sure what would be a good pattern for making game that is meant to be modded. Make it il2cpp but leak source?
What would be downside for leaking source though?
a good moddable entities game shouldn't even need source
you just need to know the contracts
now will we see this case anytime soon? probably not
build in a file perhaps that just interprets each line as a line for a dev console which can spawn and do whatever
could make it easy to mod then for people
I assume that's because of SRP pattern on systems?
if you design it so systems are only controlled by data with no coupling
then you can really do anything just by manipulating data
now doing that is very very hard
but it's a dream!
Yeah, that's what I am aming for at this point
Previously I would use some inter system methods
But I soon realized how bad it is
State entities really help with that
RequireSingleton makes things so much easier and fluent
why is coupling systems a problem for mods? for modding in systems by providing data?
it just complicates it
ah harder for the modder to understand the contract?
if you're only looking at contracts (say, system names and data structs)
how can i know what weird setup i need to do to override your system
i can't just go in and turn off your calculate stat system etc
and replace it with my own
i see. so youd say chains of systems running on data would already be coupling systems?
say your stat system is actually a ssystemgroup
it depends - like it makes sense to pass data between systems
maybe you only want to override 1 part of a pipeline of systems
that is a great way of modding
but if i can't do this without calling some impossible to find method on a second system
or worse - the second system depends on a native container from the first system
how can i easily modify this behaviour
hmm i didndt do this for moddability but for my own quick refactoring needs but i dont pass any containers between systems ever atm. all is passed through the ECS structure
thats why i wondered what you mean by coupling. cause i thought not coupling things was the easy not so performant way
modability doesn't necessarily go hand in hand with performance
skyrim T_T
i mean when you and enzi talk performance its probably like 100x faster than how i do things but dots is still sick in even my case.
i'm very heavy about the data driven and moddability atm
yeah out of intuition id say the effectssystem you showed would be easy to mod and is fully datadriven. even though you have this EffectsDataMemoryBlock
effectssystem ๐
yeah so i'm designing my systems very cleaning with write filters
haha i think everybody needs one right now ^^
ok i swear to god its random
why was this bot added...
write groups setup
very specific behaviour per system
but honestly, these systems would probably not need to be modded
better off just modding in custom effects/conditions
which imo is the best way to mod!
just data
unity has a good color example these days imo
the tldr is someone can create a component that my system doesn't know about that my system will now use in the WithNone part of the query
so if they add that component to an entity, my system will no longer run
and instead they can have a system to implement alternate behaviour
and how do they declare that their component is part of another write group?
woah that's pretty cool
[WriteGroup(NotMyControlledComponent)]
MyComponent
a simple example, your game has no stealth mechanic but someone wants to come in and mod your game and add one
lets say you have a footstep system that shows footsteps on the ground, plays audio etc. well if it was a writegroup, they could make a stealth component and make it target say FootStepComponent and stop your footstep system running while the entity is stealthed
they've added a stealth override with 1 attribute to your systems even though you never built it into the game
i think write groups are the ultimate modding tool
i see. so i should declare writegroups for the components my system writes to
they only work on things in a query with readwrite
so thats automatic you just need to mark your query as that
the entire unity transform system has write groups enable
but to make that more understandable id probably only want to have 1 systemoutputcomponent?
so you can override how transforms are built
thats not really a requirement
im only using small systems atm because they're ISystem
and i'm experimenting on this effect/attribute system with ISystem and seeing how pure i can make my ecs code
So all i need to do is add the Filter and unity figures out which components are written to and thus the writegroup applies to?
pretty much
did you ever find a usecase for yourself to use writegroups to like split entity processing to two diffrent systems?
i mean is it an architecture tool outside of modding purposes? sounds like it might reduce some needs for WithNone and WithAll
i've used them a couple of times
1 specific collection of systems at work
for determining how entities spawn in world
1 default spawn rules, then separate overring behaviour with write groups
yeah i could see that used as some kind of factory pattern maybe
and does it have any performance implications to add the filter to just any query?
ive never measured it
but as far as i'm aware the cost is in typemanager initialization
as well as when the query is created
which is 99.9999% done in OnCreate
i don't believe there should be any per frame cost
though again, never measured it
makes sense though
basically once query is setup it should be no different
i wonder why unity skipped adding the filter for alot of their systems
companiontransfomupdate comes to mind...
That's interesting.. so people writing burstable code are missing out on the benefits of vectorization/simd completely if they dont pack the data themselves first
actually i just managed to make it generate the same code
but it requires some attributes
hmm just yesterday i watched the low level development with burst talk. there should be autovectorization for it
This session addresses how we are expanding the scope of the Burst Compiler to enable even the most demanding, hand-coded engine and gameplay problems to be expressed in HPC# via direct CPU intrinsics. Andreas shares the reasoning and use cases; as well as discussing implementation challenges, debugging, and performance along with comparisons to...
with timestamp for autovec
it's interesting though, even though it generated exact same burst code for the loop it still runs a little slowly
thats 2019 though
0.21 vs 0.24ms
huh
i think there's a bit more overhead setting up the loop
but yeah i could get both cases to generate this
exact same burst code
(looks beautiful doesn't it!)
but yeah again it's very fickle
so i'll stick with float/int 4 version
it's just as readable
so did i understand correctly that you can just take a nativearray of float and reinterpret it as an array of float4?
yes
so 1 catch of vectorization, you can only do it in a single loop
if your arrays are a multiple of 4
for obvious reasons if you think about it
otherwise it takes a second loop of 0-3 elements
well in autovectorizers it handles the rest too right
this i mean
i've seen it handled but a lot of the time it just doesn't vectorize
i basically got this working by simply telling burst that the length was always a multiple of 4
hence the attributes u mentioned?
i just used Hint.Assume for that
but i needed some [NoAlias] attributes
and a few other things (cant remember)
Yeah I was thinking maybe just force the array to be x4 and then discard the unused data
So I guess it still works out faster
the one thing that is bothering me is
Unity.Burst.CompilerServices.Loop.ExpectVectorized();
i just can't get this to work
my loop is clearly vectorized
i think this is not working because it's already vectorized - llvm doesn't actually have to do anything
at least that's my best guess
but i can pretty much never get this to work except in the most basic of loops
I was reading UninitializedMemory yesterday i take it that's also quicker when creating arrays inside a job as opposed to during oncreate
i really wish i had a reliable check to make sure something/someone doesn't break my nice loops
just avoids a MemClear
i'm going to populate the entire thing after allocating it, why bother doing a clear