#archived-dots
1 messages ยท Page 170 of 1
it was supposed to arrive 2 years ago
yeah i dont think they are going to do it
and now they've hidden all dots packages except burst ๐
haha, I think I heard in a talk from 2 years that it was a "priority" or something ^^
I think they could do it but I wouldn't hold my breath
i think one of the burst devs said it's not a priority for this year anymore
it's one of those "new ui" timelines
so wouldn't expect it any time soon
yeah
joachim said "its still planned" a month ago or so
which means few years from now, if ever
years, definitely
or year+ at least
even if they say it's on the table next, it doesn't mean it'll happen
(but atm it's postponed)
for quantum and in your libraries james, how is data object to visual object/state coupling handled?
or is that all up to the user in quantum?
sorry if I ask some things twice here, but that's such a good opportunity, it feels like I can't let that pass
btw, most of the physics engines out there are deterministic on same platform
@minor sluice Backroll has no notion of rendering.
@minor sluice we have a framework to hook to prefabs in unity if yo want, but it snot required, you can do w/e u want
but main reason why Unity Physics (package) would be interesting here is because no states
That's up to the developer to handle.
when you do rollback on cached physics engine, you can say goodbye to determinism
ah okay, thanks!
for quantum, I guess no out of the box solution for non-persistent objects then?
you simply can't make deterministic rollback and resim with stock physx for example
@minor sluice what fdo u mean? non persistent obj?
like projectiles
I think they have pooling for that
yeah we have an built in solutions that handles eveyrthing
because it could be that a projectile spawn was detected but it was a false input positive
including that case
and all that shit
we even have full integration with unitys scene system, you can drop prefabs and shit in the scenem with colliders and everything and just play and its deterministic
even when you read transform (and also when you set transform) to physx bodies it goes through floating point math, which can always be lossy, you can't guarantee physx sets same values internally as they were when you read them initially
@minor sluice for the test that I've been doing with ECS, it saves the entire world state
that on top of the caching stuff
we have a default hookup for dynamic objects, etc. and all that ofc
so that includes projectiles and the like.
but you CAN make your own if u want
oh nice!
yeah pooling is certainly something I do too.
I think fighting game engine for example handles that with sync events, for destroying and spawning,
here's how I handled it, think I probably keep that
https://discordapp.com/channels/489222168727519232/497874303463850004/744974559568068608
we have a similar system, slightly more sophisticated but you're not that far off
we have ability to do 'cancellations' of invalid visual predictions to remove it gracefully
awesome!
hmmhh, the ecs thing,
since the rending also just depends on component data with ecs, could that mean you don't have a lot of special code to handle render state separately?
like if you incorrectly spawn a frost blizzard magic effect, you can have it 'fizzle out' instead of just pop vanish, etc.
we have all of those things built in proper hooks for cancellecing incorrect predictions, etc.
If you have coupled GameObjects to render it, obviously you'll need to handle the removal there.
@minor sluice i mean, i have built systems that poll entire world state every frame and draw the world using draw instanced calsl
and i have systems which coupled with game objects
it all depends on the game, but the default system in quantum uses gameobjects and pooling, because that allows easy hooking for prefabs, etc.
that people are used to using
its not always about what is the most insane efficient, but also what people are used to working with
makes sense
espc for products sold to customers
https://apps.apple.com/us/app/hellfire-multiplayer-arena/id1500403761 here is an mobile fps built in quantum btw
Also james, did you experiment with hooking up animators to the ecs state yet or do you handle it separately?
in my game, there are no state transitions for animations, so I pretty much just apply the animation state hash and the normalized time from the world data to the visuals,
but I was also wondering if one could allow some transitions, just to make it look smoother visually - even if the visuals don't line up with the hitbox animation data for short times. (maybe a bad idea?)
depends on the game if that is valid or not
for a fighting game i would never do visual transitions that dont match game state
espc if its like a 2D or 2.5D game
https://www.youtube.com/watch?v=6jZH53Wr5QM gameplay video
yeah, true,
it's not commonly done, but for example, I was thinking about things like: IK on slopes that are purely visual etc. the state transitions might be a bit too much after all
1 view
wow we're the first
how many players does hellfire support in one match? footage looks super smooth
lol random video i found
@minor sluice i have no idea never played it ๐
8 i think?
its an arena shooter
so not like a BR
haha,
but always good to see your product(s) being used in decent projects.
it's really cool for a mobile game
@violet cosmos in this vid the guy simply manually ticks the systems which is pretty cool.
yeah its pretty nice for a mobile game
Seems nice and easy
Yah, that's what I was doing for my "prefab world" tests
speaking of player count how much does player count matter in deterministic rollback
since you're just syncing inputs doesn't that mean 10 players -> 50 players would scale pretty well since you're not really simulating much more and bandwidth should be pretty low too
@hollow sorrel only for bandwidth really
quantum supports up to 64 players atm
(ulong, 64 bits...)
thats being raised to 128
oo
we have a few 32 player mobile games
but want to raise this limit.. for other reasons
deterministic rollback mmo when
whistle
you mean my mega threaded mmo backend thing?
ye
ahh
it allows for full threading of entire world, "for free"
but a lot of trade-offs
for free here refers to no mental overhead, mostly
was this also rollback or not
ahyea
anyone done tests on how much performance there is to be gained from manual ordering of your systems vs just letting unity figure it out?
@hollow sorrel not like im gonna predict/rollback 20k players with half a million npcs lol
it's like a few 100 mb of memory
๐
lmao fair
@safe lintel systems ordering only happens at the start so i doubt it matters much
unless you're talking about job dependencies
@minor sluice mine doesn't have transitions too
we have our own state graph + animations
fighting game players are a special breed which dont like visual fluff ๐
If anything, we add transition states
Instead of Idle -> Jump
we have Idle -> JumpStart -> Jump
yeah but no automatically 'blended' transitions i think is what fm talked about right?
where it blends between two states
good to know!
separate animations and deterministic transitions if possible are certainly a better solution. (usually it is just like you said - a simple animation for the specific transition)
yeah, so what was interesting for me to see - also in the netherrealm talk - the users preferred fast snapping to the "real" state, which can introduce those teleportation effects, instead of having visual interpolation that might take just a few frames to catch up.
I think I'd be the same too, as fast as possible to the real state is preferred
for a fighting game i think i would err on the side of snapping as much as possible, and build the game around that, and then add visual flair if needed later on
for other types of games... other rules apply
I was thinking about
- just visual IK for feet positioning on slopes for example. hitbox data would still be as if standing on flat ground
- visual animation transitions between certain kinds of states, but with the hitbox data not having those transitions, to make the visual experience just a bit smoother (this is probably a bad idea)
if its like a 1 or 2 frame interp like james said i think is fine for 2.
but i would still start without any of that and add it as visual polish later
certainly a good idea ๐
i wouldn't fuck with fighting game players
they're the kind that will memorize exactly how many frames your animations take and throw a fit if your hitbox slightly doesn't match the view
hell there's even this one site where they record input delay for each fighting game and if it's more than 2 frames your game is bad
https://www.youtube.com/watch?v=g66PyNF88fs&feature=emb_logo this is quantum also
HeroVersus Beta is now available on iOs and Android.
Please join our discord to download and join the battle!
on the topic of fighting games
@hollow sorrel yeah fighting game players are crazy ๐
they're even worse than fps players
this game reminds me of fantasy strike, from the vfx touches.
the thing with fighting games- they are often a niche market (if you are not a multi million dollar IP) and for competitive games, the players can be very demanding.
Wide character variety - big amount of characters and matchups - excellent netcode - excellent animations/visuals.
yeah very demanding audience
One interesting game was slap city,
it did super well, was priced pretty low, had alright-ish models and animations. you could see that it was on the rather low budget side.
and has a competitive scene too. So I think for wider appeal, having the casual player base as target is a very good idea
I wanted to ask one more important (for me) question:
FixedMath.net handles overflows and underflows on fixed point operations.
Is that necessary? or can I rely that across different compilers/architectures, integer overflow is handled the same way?
because if not, that would be a massive issue. haha
@minor sluice fixedmath.net is not good
don't use that, it's really not good for games at least
im sure its technically correct fixed point math
but it's slow as fuck
and not viable for games
I used fixedmath as base for my type, or rather changed things (like the 60+ lines for multiplication down to 1 line)
like, with fixed point calculations for division and multiplication - if you don't have BigInts for holding intermediate results, you can encounter overflows.
you dont need to care about that
if you re using the one-line mul/div
just stay inside usable range
which is -16k to +16k
and I just wanted to know if a simple approach like
AxB = A*B >> fractionBits;
is fine.
oh, that's awesome, thanks!
assuming 64 bit integer
yep
yes, that's fine
I think I have.. Q39.24 , but my areas in the game are also rather small.
maybe I'll change to Q.47.16. I think that is what quantum uses right?
also, thanks a lot!
Q48.16 is the way to go
I don't think there would be issues with small distances yeah,
should probably try that then ๐
Aloha, I was told there is an interesting networking discussion going on haha
๐
@minor sluice about things like cos/sin/tan/acos/atan/asin/sqrt/pwr/exp etc.
look up table is easiest, but it's not perfect
was surprised on the discussion too ^^
and .. I kinda have the assumption that fholm is right about the unity roadmap, but it would be a nice surprise if they can deliver this time. haha.
foor those operations, (at least for the trigonometry methods), I think I have still the lookup tables,
for sqrt/exp, it is iteration based still. Pretty much I didn't make a lot of changes to fixedMath, other than reducing code in existing methods (like the simplest ways to do the base calculations, getting rid of bigInts etc.) and changing the fraction bits.
another thing I remember, apparently some people told me that a lot of the performance overhead they encounter comes from just allocating the fixed point structs that are only wrappers around int64.
but the problem is that if you operated directly on int64 all the time, one really has to be careful and readability suffers a lot - and it would take more (complex) code
I wonder how games with higher performance requirements handle this, or maybe I'm missing something
and yes its a HUGE overhead otherwise
are there any tricks you had to keep it more readable, or to make the separation easier (what is actually an int and what is a variable for a fixed point?)
public static Boolean TriangleContainsPoint(FPVector3 pt, FPVector3 t0, FPVector3 t1, FPVector3 t2)
{
//return TriangleContainsPoint(pt.XZ, t0.XZ, t1.XZ, t2.XZ);
Boolean b1, b2, b3;
b1 = (((pt.X.RawValue - t1.X.RawValue) * (t0.Z.RawValue - t1.Z.RawValue)) >> FPLut.PRECISION) - (((t0.X.RawValue - t1.X.RawValue) * (pt.Z.RawValue - t1.Z.RawValue)) >> FPLut.PRECISION) < FP.RAW_ZERO;
b2 = (((pt.X.RawValue - t2.X.RawValue) * (t1.Z.RawValue - t2.Z.RawValue)) >> FPLut.PRECISION) - (((t1.X.RawValue - t2.X.RawValue) * (pt.Z.RawValue - t2.Z.RawValue)) >> FPLut.PRECISION) < FP.RAW_ZERO;
b3 = (((pt.X.RawValue - t0.X.RawValue) * (t2.Z.RawValue - t0.Z.RawValue)) >> FPLut.PRECISION) - (((t2.X.RawValue - t0.X.RawValue) * (pt.Z.RawValue - t0.Z.RawValue)) >> FPLut.PRECISION) < FP.RAW_ZERO;
return (b1 == b2) && (b2 == b3);
}
this is how it looks
@minor sluice https://github.com/RomanZhu/FixedPoint-Sharp
Fixed point math with 48.16 precision (based on lib by https://github.com/fholm) - RomanZhu/FixedPoint-Sharp
@dusky wind thats based on my (very old) library ๐
But is your library open source?
ahhh,
so you inline / raw value access it within the methods, but you can still use the methods with the regular structs. good idea!
@ james, that is the fixed point lib that you use?
@dusky wind huh?
@trail burrow are you networking the FPVector using varints?
@stiff skiff we dont need to send many ๐
@minor sluice Not yet, but soon.
I wish we didn't have to send many haha
oh, great ๐
@trail burrow is said library open source? Can I clone it down and use it in my game with a FOSS license?
no? what im very confused
Part of the reason we're using this library is because it's FOSS.
i just said that library linked, is based on my code, which i sent to the guy who made it... that's all
๐
OK great. Glad they made it public for other devs to use.
idk the % so not gonna say anything
that's kinda weird that it shows up on github then
that's interesting, so that library is under MIT
does that mean that's alright or.. not? since it is so heavily "based" on the other code base
๐ oh, well.
i mean strictly speaking if someone sends you code it's still copyrighted, kinda weird to see it pop up on github if he didn't ask to make it public
I mean, unless @trail burrow provides proof that he wrote the majority of it before this was published, there's no legal quandry here.
@dusky wind i, mean i do.. very much have proof lol
but its not like it matters
i know he put it on github
and its fine
and i even helped him with some stuff
I doubt someone would pursue others for using it but.. would still be nice to have safety on it ^^
all i said was "oh cool this is my old lib"
Then great. Wished more stuff like this was FOSS.
ah he left this discord, no matter
hes a nice guy, talk to him almost every day on a private server ๐
nowhere did i say anything about the license, i share a lot of code in that private discord relating to determinism
you guys started talking about licenseing ๐
i suppose, the library is solid tho
it is missing a 4x4 matrix implementation though.
I once got to talk with a dev from TrueSync, about the usage of the physics engine part,
they said it's fine for me to still use it,
but admittedly, it is a lot different to reuse something in an FOSS library than just in a finished product (like what my intention for it is)
@minor sluice thats erick (or jeff possibly), my colleague/friend
true syncs physics is a ported version of some xisting library right?
i dont remember it
can't recall his name but I think it was from the server of Dragon Slayers that we got to talk, and I think he is on the dev team there too.
ported, yes. I think it was.. actually let me look it up - Farseer physics for the 2d part
and Jitter for 3d,
but even with the far more performant fixed point, the 3d implementation was still far too slow for me (luckily my game only plays on a 2d plane too, so not sure why I even tried the 2d physics in the first place ^^ - I think the penetration and collision results looked more stable or something)
so quantum has its physics written completely from the ground up?
yes both 2d and 3d
https://www.youtube.com/watch?v=he_qd2nDPBQ here's a (now fairly old) version of our car physics in the 3d engine
Testing Quantum's predict/rollback fully deterministic simulation to implement 3D car physics.
Two game clients connected to same server, input being exchanged between them (via server).
No input-delay used (full rollback netcode mode), 100% WYSIWYG physics.
this is like 6 month sold so its improved a lot even since then
this is still in the old 1.x version of quantum even
that video
but i dont have a recent vid on this computer ๐
interesting. Where there one of a few specific libraries you borrowed concepts or approaches from mainly?
or was it like an internal design decision for all major aspects of the engine?
@minor sluice everything is custom, even core things like the broadphases for the physics engines were invented by us
vehicle physics is kinda endless rabbit hole if you really dig into it but basic principles are somewhat the same when you build things (unless you go for pure arcade vehicles - then you can fake a ton of things)
oh wow
several of the math algorithms we use are custom invented due to precision problems with fixed point
sounds like a big challenge
yes, well two guys with PhDs in maths invented those algos ๐
i did invent the broadphase for the physics engines tho
@dull copper Yeah waht you see above is pretty old, we have some fairly new stuff which is much more realistic
and much tighter in terms of control over parameters, etc.
ah I wasn't judging that video, just making a point that any vehicle physics implementation that's aimed at simulating individual wheels will have somewhat similar base implementation (vehicle dynamics wise anyway)
yeh its a fairly complex system
with wheels, suspensions, gear box, engine, etc.
all properly simulated
and yes its a fkn rabithole
it is
I've done this particular thing for years, I know people who have done it for decade+ and still struggle with it ๐
any proper vehicle sim out there is a result of years long iteration cycles (usually decade+, not even kidding)
๐
i have no idea the speed the above sample runs at
never looked into it, that is old stuff on an old branch now
if you don't do broadphase/collisions every step, you can afford to have crazy high physics frequencies for the physics bodies
@hollow sorrel i cant even say if that time is for the entire sim or a sub-part, they might have hijacked that to showsome other sub-part thing
i have no clue, legit
had no involvement in it
my old naive 3d physics solver ran double precision float vehicle physics at 10kHz
i doubt its for entire sim as 0.001 is insane fast
without any ridiculous optimizations, MT, SIMD etc
I could have never done collisions at that rate
ah
I've never tried this with Burst, should do a lot better, those figures were from c++
for most mp games, the important part about determinism
is that you dont need to network anything
that is really the key thing, for most customers we find
in that they don't need a network engineer or multiplayer coder, etc. to do anything
or need to account for any of the usual crap you need to deal with
as the game basically network itself
it makes everything so easy to reason about and think about
yes you have to handle prediction errors, visually, but that's a small price to pay
that is the killer feature, yes predict rollback itself is great for some gametypes also
but thats an added bonus
not the main sellingpoint
for deterministic rollback vs. non determinism,
I think it might be alright - for most server authoritative games - to not be deterministic on the clients end if the world state is small enough so that it can be send via updates within a frame or so.
if there was a reported state divergence, the server could just resent the information about what ran out of sync, even if that might be more or less continuously
So for my use case of a fighting game
determinism is set via identical starting conditoins
But for a FPS
or a game where users can join/leave whenever.
@trail burrow what did you choose for broadphase?
How do you handle those cases deterministically?
for somes system i helped create for pubg, we went with a extremelly dumbass hash grid. Its what worked best with simplest code
@dusky wind we have full join/leave/re-join/drop in existing match, etc.
Yeah I'm asking how, not if it is supported.
If I set a job struct member to be [ReadOnly] but still modifies it, will it affect the original copy?
including joining with new data, etc.
I thought that for rollback netcode fighting games, it might be possible to join the game whenever too, if you have a way to send a serialized world state snapshot to the new user,
for some reason (maybe because a lot of games have too much data), deterministic multiplayer games don't allow joining during already running matches
@vagrant surge we used a non-persistent SAP that uses radix sort to detect collisions
which is multi-threaded ofc
@minor sluice that makes sense for a small game state, yeah
does the readonly attribute even work to prevent a field from a regular struct to be changed? I don't think that's how it works?
dont use readonly
at all
it causes perf issues in all kinds of weird places
in .net runtime/mono
For bursted job?
I think he's talking about the Unity C# jobs ReadOnly attribute
maybe I misunderstood the question and it was meant the member of the job struct, not the component data struct probably
Yeah
if you modify it, why do you set it readonly in the first place?
Also, I tend to still use readonly modifiers in non critical path locations as well
In my case I need to temporarily reorder the array for the job itself, obviously I could just make a copy.
wait,
fholm, so you suggest that it is better to just not use it, whether in Entity forEach queries nor in job structs, and it actually isn't that beneficial for performance even if you only read from a collection?
or is it still beneficial but has some specific weird behaviours?
Entity.ForEach do use it
the scheduling is dependent on knowledge of read/write vs readonly
yeah definitely use [ReadOnly] lol
It has a negative performance impact in the editor for thread safety checks
i know fk all about unity ecs/dots/etc.
but that's conditionally compiled away in release builds
I think if you want to have a second array with modified order, you need to make a copy ๐ค
ah okay. Never saw that in structs, I think for a good reason.
readonly in structs sounds odd, I guess this would be a forced way to make the struct really immutable?
I'm not exactly sure how things work, either:
- Job always copies input to a new location, and with
[ReadOnly]it won't copy back when the job is done. In that case I can just modify it without repercussion. [ReadyOnly]will just pass the pointer and assume its pointed memory won't be modified. In that case I would just need to make a temporary copy.
@minor sluice there are readonly structs
i think in is the new way to do it instead of [readonly] though right?
which are meant for immutable value types
@trail burrow nifty stuff
Yeah, but I'm just using plain job system without ECS.
for example, native arrays are just pointers to unmanaged memory afaik,
so if you pass a native array, you still operate on the same data as before.
built more for web server use cases than games though
@mint iron it is if you need to read it
if you just want to add it to the query, you'll need to use the fluent API to add it
@minor sluice correction: pointer, type, and length ๐
What's the easiest way to make a copy of NativeArray?
my first thought is that I think what burrito wants do to doesn't work, I can't say for sure though,
I think a copy of the array sounds like the logical solution though
Yeah I'm just going to do that instead.
worst case, make a new one and use CopyTo
you need the copy afaik; i don't think ReadOnly does anything other than prevent scheduling mishaps wrt read/write
I recall reading that jobs make a local copy of the input so I just thought if [ReadOnly] works by not copying it back then it would basically serve as a temporary copy itself.
no, that'd be too expensive for large arrays
and odd semantics for other non-linear structures like NativeHashMaps, etc.
passing large arrays by content copy 
thats how it worked in first version of dots tho
where they copied all memory
from the chunks
wasnt it?
they gave up on that quick af tho
Not to my knowledge.
haha, no idea how it worked ^^
yeah if that was true, it was before my time
And I was using C# Jobs since it came out in the 2018.2 beta
Yeah I don't think copying a large memory is a good idea for my case
i dont mean for the general case, but for the case when in interacted with ecs components, etc.
I'm just going to make an array of indexes and sort that.
afaik they copied the chunk memory into linear blocks and then back again in some case
i can dig it up, but i know it worked like that, not anymore tho
ye before they started to use struct ref
ooh i see what you mean, yeah, i forgot about being happy about that feature ^
needed to hear "ref" lol
@dusky wind @minor sluice @hollow sorrel thanks for the great conversation today, take care!
same, have a good day 
is there a way to "pause" a World loop ?
@zinc plinth remove it from the PlayerLoop
or set all of it's systems to Enabled = false
could you clarify what you mean by that?
I wanted to wait on an async operation before continuing through the loop (Addressables)
I'd disable the entire loop mid execution then
but that 's going to be difficult to resume at the right spot
unless you intend on freezing the game
while things load
I guess I don't mind if I start over at start of loop
I'd just loop through the systems in the world and disable all of them in a system
then when Addressables is loaded, reenable them
yea that's prob simplest way
you don't have to loop everything, just the toplevel groups like simulationgroup and everything underneath will be disabled too
wouldn't just using Remove/AddWorldToCurrentPlayerLoop be better ?
ho but I need to stop the current frame too
so yea need to stop the systems
this system will only run (fully) once at the start of the game anyway
fiddling with playerloop should work too but dunno if that's really better, don't see why not tho
but pausing mid world sounds kinda weird
why does it have to pause loop to wait on an addressable?
not saying you shouldn't, just curious
I think my code might explode if I the init logic gets split into multiple frames, didn't test it tho
so yea, the bad reason
need to try to put some kind of wait before I set the loaded bool to true and see if anything explodes
Isn't there a [RequireSingletonForUpdate] or something you can put on a system?
You could configure the necessary systems to be suppressed until your Addressables are done loading as flagged by a singleton component
imo ejecting mid-update is too out of band
IS UI builder / UI toolkit ECS based
no, I don't think
You can use it along side ECS but you have to connect them yourself, like pulling data from a system and setting label.text = mysystem.GetEntityCount()
Gotcha @toxic mural Thanks
I finally made my init workflow work with addressables loading time 
Is UI toolkit used to create in game Screens?
ui toolkit is the replacement for all gui stuff, its not complete but its intended to be better than all the past ui systems(i cant even remember all of their names).
so yes, ingame too, i think #๐ปโcode-beginner or #๐ฒโui-ux could better answer your questions though
@safe lintel Can i use it as a replacement of canvas
@wheat stump this thing can be used in replacement of Canvas, here's a vid on it. UI builder.
๐
When I am importing the UIERuntime packages I am getting lot of errors
that many functions doesn't exist
Can anyone tell the solution for that
What ECS library would you recommend, considering I'm looking more for architectural benefits and any performance improvements are an addon.
I was thinking Entitas
Entitas is fine
but.. just give the different libs for a spin
and compare them for your needs
@solid flume check Svelto.ECS out as well
What is that?
reference repo of an abandoned project, it's written in DOTS.
hopefully people will be able to find this useful
https://github.com/DOTS-Discord/Example-Bullet-Hell-game
Interesting! Thanks, I will definitely take a look later in Unity:)
is there a way to check if a entity has a buffer ?
Get buffer returns a exception :/
i think u can use has component and if so get the buffer and check the length. whats the exception
@mint iron Thanks, im gonna try that... it just tells me that theres not such a buffer attached
mmm im not 100% sure it would work, because i guess the element is an IBufferElementData rather than IComonentData
and im guessing HasComponent<DynamicBuffer<Element>> wouldnt work either
to check for a buffer you just do HasComponent<Element>
In Hybrid, are transforms synced between entities and GameObjects bidirectionally?
If I move a converted but not destroyed GameObject
Say via Animation
Does the entity get moved?
i think only if you used AddHybridComponent
On the transform?
in conversion. eg
public class EpicCameraAuthoring : MonoBehaviour, IConvertGameObjectToEntity
{
public Camera theCamera;
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
conversionSystem.AddHybridComponent(theCamera);
}
}
then you're declaring that you want an entity sync'd with a game object. and ECS will spawn a gameObject for it when it gets created as part of the subscene
So Transforms don't get special treatment?
Oh ok
I have been mostly dealing with pure ECS and am not too familiar with the Hybrid mechanisms yet
@dusky wind I'm going to ditch Hybrid, I think
this one is fairly recently added, and there's been a few attempts in the past but they were shall we say, sub optimal
There's too many problems with the tooling and workflow
everything is suboptimal
Until DOTS fully supports skinned meshes, animation, and cloth physics
I don't have a choice
So, I'm going to go pure ECS and Unity Physics (for specific isolated systems). But, I have thought about writing a sync Monobehavior
But, my latest line of thinking is to make mostly headless systems in ECS... Ones that have very little input/output to GOs
And fully ditch Hybrid and all its associated problems
anyone tried using pure playables/mixers etc for animation in Unity ECS?
@dusky wind what are you trying to accomplish?
GO.Update runs before ECS simulation. LateUpdate runs after. Just saying ;)
I'm manually ticking everything
I have a master GO manager that individually enables and calls Update on the relevant systems
Already needed to do this to get rollback working
What's the downside? It is mixing and making some code annoying to grokk... But, what's the issue?
I need to learn too :)
I haven't had any 100% blockers yet
Right now it's reading the player state and ID out of ECS and into Playables
Evaluating a Playable graph
Then reading the transform information back into ECS
If it isn't being handled automatically, I'll have to manually do it.
Yeah, that's my current line of thinking too. Then I can have things like FinalIK/Timeline, and other things that aren't ECS.... But ECS handles specific systems that I can break down into mostly homogeneous structures
Like, my weapons system, which is a raycasting nightmare
My use case is very structured and homegrown already
LateUpdate is where any changes would be in my mind
My main concern is that Mecanim isn't compiled with FloatMode.Strict
Which will throw a wrench in my determinism requirements
so with AddHybridComponent the transform data is strictly driven by entities
So if I converted the hierarchy while it's A or T posed
It'd overwrite the animation?
Yep
It's a 1 way road pretty much. I remember trying to manipulate it, but it's the CompanionGameObjectUpdateTransformSystem will copy the LTW -> GO Transform
Yeah TransformAccessArray is still available
Interesting
So I need this to be done in SimulationSystemGroup
If I evaluate the graph in Simulation
Read out the data into Entities
Then it will be written back during ConversionGameObject... System, which is in PresentationSystemGroup
It's highly roundabout
And performance wise highly questionable
But it could work
Well, I think if you have thousands of things, yeah... But a hundred or so?
That updating the Transform happens one place or another
@ james,
in my game I basically bake hitbox data from animations.
So the animations play once in the editor and hitbox transforms are recorded with a certain framerate, in the game, time is stepped in the manual loop, transform positions/rotations interpolated based on the recorded animation data if required
I have 8 characters with a bone hierarchy of maybe 90 or so bones
This shouldn't be a huge blocker
@minor sluice I'm handling hitboxes separately
It's just dependent on bone positions
so all that's then left is to just apply the animation state and normalized time to the animator, driven by the logic.
animator/playables have no influence on actual game simulation.
hmmhh, but are there specific requirements for your bone positions?
I just write the bone positions from animations that have hitboxes into data stores with fixed points
or the fixed point raw value
I guess that can be sampled ahead of time
But I do have some oddities due to some unique game factors
yeah,
hmmhh, I basically had an editor script that goes over all my animator states and writes the results of the recorded bone transforms of all animations in a file
Like slowing/stopping time
And scaling characters
Doing hard bakes will need to factor those in mind
hmmhh, I could see that scaling might be an issue as it would require going up and down the transforms in hierarchical manner which might be quite expensive,
don't see the time as an issue,
but for the scaling, tbh, my game doesn't account for that
for the sub time steps, I basically just do linear interpolation between the recorded positions (I think initially I just applied the last full valid frame if there was a subtime step)
although,
if the game is fully 2d in logic, and say the pivot point were the feet,
positions are stored locally to their feet position, wouldn't it be as simple as doing:
globalPosition = globalFeetPosition + recordedLocalBonePosition * scaling; ?
I'm mostly concerned with editor workflow for my designers, haha
The bakes seem like they would take a while and doing it before every Playmode launch seems, expensive
oh right,
how many people are usually contributing with models and animations? totally forgot about that part ^^
I see that it can take quite a while to do, before every playmode launch seems unreasonable, but maybe..
well not sure how you handle adding or changing animations for existing characters from designers (never used playables yet).
but maybe something like a button that triggers the baking process for a selected character?
or a process that detects if animations on a character were adjusted? and then triggers it?
like a dirty flag
Several, I think we have 4-5 people on it right now
ah nice
you can probably stick w/ ConvertAndInject although idk when they'll remove that ๐ค
What does that allow?
Entity -> GameObject, but if you add a tag you can copy from GameObject -> Entity
I forgot the tag's name but it's like CopyFromGameObjectToEntity or something like that
so you can still get that gameobject-esque workflow without the companion link
I'm not planning on moving to 202x.y until DOTS animations are supported 100% so this should work in the interim.
That's part of Hybrid, the Convert process
It takes a long time too
Oh, sorry I misread
I can't remember exactly, but ConvertAndInject most likely doesn't convert children so you may need to store that/link that manually if you need children gameObjects as entities
I need to not chat until the first coffee is fully consumed ๐
@coarse turtle unfortunate
it also take a huge perf hit.
I tried it with Sprite renderer and just moving it around
hoo boy debugging the problem was a roller coaster
@violet cosmos I thought you were abandoning dots?
like james said above, I wouldn't consider going full ecs for a fighting game either until there are proper skinned mesh render, animation etc. solutions
but since in many deterministic sim games, the logic is completely separated from the visuals for good reason, I think it's reasonable to try either a full ecs animation or at least something that doesn't depend on internal unity event flow, and just sync the visuals up in a separate step
I'm also wondering if someone has or tries to reimplement or do a deterministic physics engine with dots supports, and how that performance would be.
@deft stump no, I'm abandoning the shit show that is Hybrid
I'm going to make my ability system in GO, but convert a current system into pure ECS later. I also have two other systems that would benefit from pure ECS
My problems all stemmed from trying to make Hybrid into a tenable workflow for what I need. But, at it's current state, Hybrid only works for specific use cases
Basically... Level by level, or megacity
I don't even know what exactly hybrid means.
Is that just anything that uses the conversion systems from GO's?
it seems that you can reference GO components into ECS (which is normally illegal)
Yeah, I do it constantly in my shit box code ๐
I thought the hybrid approach as just to use Convert To Entity component and the Authored ICD's, I didn't know it had this feature! XD
I was using it before with the sprite renderer (didn't know at the time), but the perf hit was massive
so I said, I'm gonna author everything from now on! and you know 
Yeah, I'm mostly on ECS because I know I'm going to have some main systems that are computationally expensive (10,000 AI zombies or something that I want to do fun AI experiments on, namely), but my main systems, just to get the project moving quicker reference GO's ALL the time.
Hybrid ECS is a set of tooling for converting GOs and Prefabs into something you can use for ECS. It also has a serialization and deserialization tool chain that's called SubScene
There's also the Hybrid Renderer which is responsible for getting entities into the render stream
Those things are all teh suck right now
In all honesty, I dont need ECS for my game.
at any 1 time, there's going to be a max of... 12 sprites all mucking around
I just do it because I just hate OOP XD
๐ก๏ธ
It is, actually. The current GO workflow is far far more robust to make things quickly. And it's not just because I'm used to it, it's because there's a lot of tooling and a well refined workflow in the editor
In the conversation of ECS, and especially Hybrid.... It seems very few people talk about what a real world workflow looks like
Right now in Pure ECS it's "roll your own"
Or... Maybe that's all we talk about, really.... Because there isn't an established workflow ๐ค
we have
In unity atm the OOP workflow is vastly superior to the ECS 'workflow'
@dire crown you mean the "lets build something cool people get excited about and then drop it like a hot potato" code dumps on github? yeah ๐
yeah ๐ฆ
i was excited at first, started to think of the bottlenecks in my previous games and how DOTS will unlock all of that
@trail burrow in the current state of ECS, when do you think unity will get their shit together?
but it is not even close to being ready. i would have better luck rolling my own engine
@deft stump 3-4 years from now, if they don't backtrack and go all on improving GO/MB system, deprecate the ECS but keep jobs+burst around./
my bet is still on that, last
my bet is on full backtrack
yeah
jobs+burst is pretty good, not THE best, but it's generally pretty fast and usable
but the ecs is just... ughhhhh
im absolutely seeing them fully backtracing from ECS for "gameplay", and leave it mostly for tryhard optimization stuff, hidden as "expert mode"
i don't see anything wrong with that. in most cases ECS is overkill
I hope they dont...
or pray for the impossible and make ECS open source
if they backtrack... hoo boy, i'mma learn game engine development.
well i hope they make the core of the engine operate in ECS
its pretty nice as an architectural pattern. The change from having logic in comps vs centralized in systems is pretty huge
but if they add 99999 workflow barriers....
but keeping a more understandable OO approach around isn't a bad thing. ECS is another tool in the belt
@deft stump OurMachinery is on beta atm, they have full ECS
tho its pure C
and they havent cared much about higher level logic stuff
so its very barebones
awesome blog btw
I still think ECS, by itself is still useful, with caveats...
- You have (or can) setup a bunch of homogeneous entities
- You need to structure your code to run in an organized manner
If you look at ECS as just a data container and an organized Jobs/Task system with those caveats, it's not so bad
@vagrant surge i mean it looks cool and all, but another engine, built by a small team... hard pass for now
afaik they even live close-ish to where i live
@trail burrow i have the beta and ive tinkered a bit. Big issue is that stuff is very much nontrivial and there is about 0 docs
couse beta and all that
but i think they have an amazing solid base there
the engine is 25 megabytes
I'll look into it
the entire thing is also as modular as they advertise
not a C guy but hey, learning is doing XD
they have samples where they ignore the entire engine and just grab the "render api" module + the "windowing" module to create an standalone app
and a sample where they implement a terrain system (basic one) as a plugin
literally everything is plugins, its nuts
they use more or less the same ecs approach as unity
with the archetype stuff
not sure if they do chunks tho
one idea they have in the ECS (that unity doesnt have) which i find very interesting is the concept of "phantom" components, components which dont exist
instead of registering a component type as a struct (the usual)
you can register just a "added to entity" and "removed to entity" callbacks
and then store the actual data yourself
and it all still works with all of the matching and similar ECS logic
OurMachinery is cool but yeah... it's a nothingburger so far since small team, new engine, etc. give it like 5-6 years then it might be something
its very niche too
too advanced for noobs
might be useful for people who want more of a framework to build an engine on top, of people who want to create a 3d app or visualization type stuff
As I'm not sure who's reading this - I for one don't agree with everything being said here. 'shit-show' etc is pretty strong. I personally think it's some nice ui, tools and bugfixes away from being a nice workflow, let alone useable. It's clearly going to take a longer time than any of us would want but I think the fundamental concept that Unity arrived at (that you want a different editor/authoring representation of your data to what the computer wants at runtime) is fairly sound. I dunno, just trying to add a bit of balance. ยฏ_(ใ)_/ยฏ
Agreed with timboc, got everything working in my dots fps, whats blocking me is needing more dots packages like sound, anim and pathfinding to transition to pure ecs but hybrid is fairly easy. Id just rather not use any UnityEngine.Component for anything ๐
whats blocking me is my entities arent being rendered in mobile build ๐ญ
ECS 0.13 not running when built to VR was my blocker, but I haven't tried 0.14 yet. ๐ค
Someone should make a minimum working example of "iterating" over a certain number of entities over a frame for the wiki! โค๏ธ
I take it you need to do grab an entityQuery and get a count of their indexes or something, just not sure what the easiest way is. I'm hoping you don't literally have to like make a nativeHashMap to hold an indice per each entity's actual index location. There must be a "quicker" approach to something this common/simple?
I noticed in IJobChunk or whatever that system is that it had a "first" parameter or something similar which I'm guessing is specifically used for this kind of thing?
Right now for DOTS, only Pure ECS and Jobs work for me. I'm super curious about transitioning to Unity Physics package BUT... If it's anything like Hybrid I might have to bow out of that and keep things Pure ECS and roll my own entity injection/reading
@tardy spoke didn't really follow what you're trying to do... it sounds like Entities.ForEach but I'm guessing not?
the first index is the first entity's index in the particular archetype chunk ๐ค
If I was a researcher/scientists I would do a thesis on ECS systems and processing entities over frame counts, and I would make global variables to "slow" the systems down until there is a noticeable change in behaviour "IE the enemies now seem stupid because they don't change direction to face you quick enough", I bet you could get MASSIVE performance boosts.
@coarse turtle hmm, well if you can also get the last that would work?
@amber flicker yeah
@amber flicker entities forEach but say I have 100 entities and I want to only process 10 per frame (assume what i'm doing is mad computationally expensive and unnecessary per frame).
ah I see
(I think) easiest is something like a nativeQueue that you push and pop - probably the more sophisticated version is a NativeStream
imo for now i'll put a pause on ECS on my game.
the goal right now is to make a shippable game.
i'll just update everything to ECS once the game is out for 2 months (force the users to dowload a new version of the game)
XD
yo guys! can't play the new event coz you need to redownload the game! XD
@amber flicker there's no built in helpers for any of that stuff? That seems really surprising to me. Maybe the OH of scheduling the systems in general offsets the performance savings of the idea in a lot of cases.
Cause out of my 15 systems, I have very few that actually need to update the entities 72 times a second, haha.
You're right that it's a common concept and something a lot of people think about. That said, I struggle to envisage what a 'general solution' looks like for something like that. Especially something more simple than push/popping a queue
I think setting a local flag and then returning
Also, in the OnUpdate you can return before declaring the ForEach... Say, by waiting some time
Yeah, I'll have to see what using the queue looks like, I just assume they could include it as a hidden somewhere in the SystemBase or something where you're like
.IterationPercentage(10).Schedule() and that would run it on 10% chunks of all the entities it gets in the query per frame. I dunno if that's possible, but that'd be a dream hahah
yeah the last index is first + chunk.Count @tardy spoke
That's something better for Jobs IMHO
@coarse turtle awesome. Does SystemBase get access to "first" in any way or is that just IJobChunk and the job classes?
@violet cosmos SystemBase just is a job though? With the boilerplate abstracted out?
Or do you mean "deal with it in a different manner using jobs"
No, it's forced to complete
Oh, right
uhh idk about SystemBase Entities.ForEach. Maybe if you can grab the ArchetypeChunks (you can probably try to wrap that in an IJobParallelFor)
Deal with it in a different manner with Jobs, then you can control when it's run in the frame lifecycle
You can schedule with ECS if needed, but... Then you're locked into that scope
well.. keep in mind you have to worry about your queue growing too fast and other issues no matter what you do. A dumb (because it wouldn't be guaranteed to hit all entities at the same rate - or worse - so you'd only want to use it with entities that don't change archetype at all) technique could be to use an IJobChunk and early out on every chunk index that isn't the index(s) you want to process that frame.
Whats the difference between different ECS plugins like entitas and svelto.ecs
@amber flicker I have a lot of systems where that wouldn't be a concern. Some even where the number wouldn't even ever change.
in that case, it could be a good candidate for a SCD (Shared Component Data) - very easy to batch process a set of entities at once that way
Hmm interesting
Yeah I'm trying to come up with a "generalized" solution that is easy to implement, not necessarily the optimal solution
since it takes me so long to optimize things I'm really a fan of the "see the actual performance and only optimize what's necessary" approach haha
Whats the difference between different ECS plugins like entitas and svelto.ecs
@solid flume likely API design/workflow - you can probably look at Svelto's blogs to see a peek of how the intended workflow is
I'm favouring entitas just because it looks better documented with more tutorials
you just add an SCD with say batchIndex = 0 for the first 100 entities, batchIndex = 1 for the next 100. Then in your job you do e.g. (pseudo code) SetSharedComponentDataFilter( batchIndex = 0)
And also a solution that would be nice for the wiki
That gets the "concept" across and someone can get started with it, and a good programmer would be able to take it a lot further
yeah svelto's ecs doesn't have many docs, he does have a few sample repos you can look at to deconstruct
@amber flicker that approach is interesting. ๐
What if it had a system that dynamically set ALL the SCD batches?
The system "counts" the entity queries and then sets them to the desired "percent" or number?
The only trick is if you have two systems that want to batch at different rates, there's only the one "state" component hmm
sure - not the fastest operation but you presumably wouldn't need to do it frequently
Yeah exactly, run it once a second
you want to be a bit careful with SCDs as they can lower your chunk utilisation (and hence slow things down) - if you're using them for in the order of 100 you're probably fine, if it's ~10 you may start to lose more than you gain at some point
for different update rates you can e.g. do for( int i = start; i < start + numBatchesToProcessThisFrame; i++) job.SetFilter(i); job.Run() or whatever
but to get started and keep things easy, a method on a SystemBase class that gets the count (which you could do "OnStart") and caches it for iteration would be cool.
Then could run on the SystemBase method on a timer something that updates that entityCount number every 1 seconds for a naive approach. A lot of boiler plate, but could work, no?
The SCD approach is cool, especially if a System was updating the SCD's and applying them to new entities it found so you could batch in percentages or something
That almost sounds like an asset that could be sold on the store if it was robust enough haha
I don't think you need to extend SystemBase or anything. Also fwiw I would think about entities or chunks processed per frame rather than time. Just my opinion. And likely no less than one chunk a frame generally. Depends on what you're doing ofc. Premature optimisation and all that when you're not even using burst right? ๐
Haha, it's kind of just research because I know I'll likely need it for the 10,000 zombies when it comes to their AI / decision making
but maybe not since the server will have some serious power, and it's the one calculating those behaviours
Need to get my first two assets finished before thinking of a third but honestly once written out I wouldn't expect this to be more than 100 loc.
btw, are you gonna author your own AI in ECS alex?
or use a pre-existing solution and have it interface with ecs stuff (if at all possible?)?
@deft stump yeah, it'll be System rule based reactive AI I imagine. That's the easiest way I can think of to do it.
I would love to experiment with some ML stuff though - like to me it would be far more interesting to have an MMORPG that incorporates the enemies actually learning, but that ramps the complexity way, way up. And also makes the gameplay experience very unpredictable haha. I bet the zombies would gather in clumps and run into the cities and just camp spawns, hahaha.
@amber flicker For me it'll be 1000 lines of code. Which people buying it from the asset store will LOVE since it's like getting more "value". ๐
$10 for a measly 100 lines of code!? Please.
I'll just compile it into a dll ๐คฃ
Also my bro has his masters in ML so maybe I can entice him to just make some sweet AI for it.
Zombie simulations are probably like catnip to ML people
or just model a swarm mechanic ๐
@tardy spoke ive done similar things of the staggered execution
but one thing i found is that naive approaches wont work
just iterating system unti say N = 100 and then stopping wont work, because when you add and remove entities, shit can get fuckd
really what worked the best were 2 approaches. One approach where i had a "counter", and when the counter reaches 0, the stuff does the full logic. Else it does nothing
and another where it split by archetype
when objects were being created, they would be added a tag component either A or B
and each frame, you executed the system on entities with A, or entities with B
the A + B approached quite well. You need ot make sure that its well distributed (similar number of entities)
and even then stuff can artifact a bit
another thing that does work is that there are just systems that execute less time.. total
for example 10 times a second, not 60
but you need to be careful as it can hitch
Interesting, what do you mean by "hitch"?
The timer approach I have implemented already across some Systems, but I'm just looking for a solution when I start getting into the AI systems as you know they're going to be pretty expensive, and realistically do not need to be updated each frame
but also may just be TOO much processing for a single frame
So the A/B split could do it in short order probably for just the one system.
I wouldn't be surprised if you want a priority system (agents closest) and e.g. a pathing solution that can take variable time.
Yeah, of course. Those will be interesting/fun optimizations to make.
You could for example on execute the AI once per every 2 seconds on every AI that isn't seen by a player.
The system of even figuring out which zombies the players can see could get computationally complex though, etc.
Because it's the server that would be calculating that, and say you have 1000 players and 10k zombies, granted it would just be straight math distance checks, but I could still see that causing a hiccup if the computation isn't spread out over some frames
I have zero clue how I'm going to do a pathing system since I haven't fiddled with them before, and because the map is 20km squared (but at least now it's broken up into much smaller subscenes). I tried to bake lighting on the 20km map and Unity blew up, so I expected the same from navMeshes... but maybe now with the smaller subScenes I can use them.
lmao please no
As I said, I know nothing of how AI's navigate / move around so I don't even know the correct approach. Literally know nothing about it yet. ๐คทโโ๏ธ
navigating is one thing, 20km^2 is whole another ๐
i think those kind of things are 'faked' like you make everything slow including camera movement, so it would fake that distance between units are a lot
(i think)
Interesting. I took the much easier solution of moving the entire world around the player ๐คฆโโ๏ธ
To keep them at the origin lol (otherwise floating point errors get visually crazy, especially on VR)
Then the server does a reverse translation of their "actual" world position.. you know, the easy way! ๐
And the map is actually 20km in size haha
but broken up into like 250m subscenes
that stream based on player proximity
what about dividing your map into scenes or even subscenes(not sure if they can hold lightdata)
thats how mega thingie done right ?
@opaque ledge yeah it is/will be? https://www.loom.com/share/e6c07f0586c74eb79e9cf4de23038eb4
That video shows it in a test scene, I just haven't brought it all back into the "real world" yet, haha.
I haven't tried baking light into a subscene either. Would be interesting to try.
I'm hesitant to even bother with lighting at all, even baked, as I think I want to maximize poly counts as much as possible and do interesting detail with polygons and vertex colors to give the game a unique look. Get a bunch of artists in there to "paint" the world via vertex colors. They could theoretically even paint the shadows in.
I wonder if I need to add the scene dependency cache into git lfs?
I excluded it for the time being ๐ค
@deft stump do you have experience with using git. Because its been giving me a headache for a long time
Also it's going to be painful to make 300 subscenes or whatever and put each tile into one hahaha
painting shadows for a huge streaming world sounds like hell ๐
Haha, totally. I'm talking about literally trying to get like 100 "painters" to do it. Make a video tutorial to teach them how to paint in the editor and assign them specific subscenes and let them rip
I probably won't actually do that, but it would give the game a neat look.
100 people gonna have their own unique approach and different rates of learning, id look into ways to automating rather than trying to wrangle 100 people to do something consistently
... what makes you think I want it to be consistent?
lol
I want it to be interesting
Consistency is boring!
art by committee is always "interesting" ๐คช
You'll notice I always spec in the easiest approach. ๐
@deft stump do you have experience with using git. Because its been giving me a headache for a long time
@solid flume i say im experienced. What you want to do?
I committed a 256 mb file from a package, now it won't push
to github?
I have 45 commits locally waiting to get pushed
Git, yea
I have git lfs
The github plugin for unity knows it
I tried using git lfs push origin master
github doesn't accept 100mb files if the files aren't lfs'ed
How do I make it lfsed or just remove it from the commit
lemme get this straight so far.
-> you have an existing repo.
-> your latest, or at least one of those 45 commits, has a 256mb file in it.
-> you tried pushing but github gives you the middle finger.
-> you have git lfs, but you haven't migrated the big files to git lfs right?
Yea
I just leave the git stuff to the plugin usually
Just press the commit/push buttons
do you have a team working with you?
alright. lemme pull up my cheat sheet, I dont want to give wrong commands here.
Do you know how to use powershell, gitbash, or cmd, for git?
okay, can you open one up
oh nice, that skips alot of steps. lol.
git lfs install
git lfs migrate import --include="*.(whatever file type)"
OPTIONAL if you want multiple file-types:
git lfs migrate import --include="*.(whatever file type),*.(whatever file type)"
git push -f //essentially you rewrote your entire history needs to forced pushed.
just to be clear this is all in one branch right?
Yep
alright
if it's ANY file with the file type, yes.
but you can be specific if you want
argh, I forgot quotes!
I don't remember the file type so I pushed and am waiting for an error to pop up
I didn't put in any commands apart from git lfs install, which took like 0.5s to run so no harm done
@tardy spoke stuff can hitch because lets say you have systems A B C, all of them expensive
A runs every 2 frames, B every 3 frames, C every 4 frames
every 12 frames all 3 systems will run, and if they are heavy, you can easily get a frame that is significantly slower than the other ones
so you need to make sure that some frames A executes, other frames B executes, but never both at once
@solid flume easy way to check is to git lfs migrate info shows the types that are very big in your repo (although they're consolidated) + how many are they.
Oh
I'll try that thanks
It only needs to be above 100mb for github to cry about it right? Anything under is fine?
Do you know where I can learn this stuff from?
I want to shift off of relying on the plugin, because often it feels like the scripts it runs in the background slows down the editor
And it doesn't always detect changes instantly
It pushed without errors
Thanks a lot
one thing about migration, is that it's dangerous if you don't have exclude, include.
every damn file will be lfs'ed. and lfs won't warn you because of it
took me painful 3 days to fix my repo
There are downsides to just lfsing everything? Because I've wondered for a while why that isn't a thing
I'm putting my code into a separate repo that excludes binary assets. Those get backed up to Backblaze B2. I check in Unity code via Visual Studio
In house packages are in a separate folder that I use GitKraken to manage
don't quote me on this,
the downside of lfs'ing everything is if you have a 50 mb psd file, and you made a 1byte change, lfs won't commit that specific change, it would actually make a new version of the lfs object, ergo another 50mb psd file.
so if you lfs everything your whatever gb of unity project will actually grow in size per commit!
@deft stump No, SVN/CVS store the deltas. Git stores the whole thing
Neither is... bad per se
then... what the hell does git lfs do dammit!? I know it replaces the files to be pointer to a thing but... if it stores the whole thing, then it's essentially just git XD
Just different ways of doing it. I do kind of miss SVN though
I think Git LFS just stores that the binary file was changed. It doesn't actually store the file
Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.
"...with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise."
It just delegates the actual file storage somewhere else
But, lets you see what files changed as part of a commit. It's... kind of wonky, there's gotchas IIRC
Yeah, that's the pointer file I talked about.
So if I have a 50mb file, committed it, changed 1 byte of it, committed it again.
then it essentially has 2 versions of that 50mb file, ergo 100 mb!
or is git lfs made jsut for easier checkouts? and smaller repo size?
On the LFS server, possibly. I don't know if there's good tools for cleaning that up
I really just go with dumping the files and saving MyFile01.psd MyFile01.1.psd MyFile01.2.psd etc in a "Sources" folder. Game specific assets are organized in a similar, yet separate tree, like GameNameAssets
I just do it for simplicity sake, and really do want to improve it... but that's later when I'm getting in "pipeline" mode
So using git just increases my project size continually?
Is this still our favourite way of running a System only once?
AFAIK, just means "runs it now"
So, would be useful if say.... That was your first ForEach and you were initializing some data in a local variable that you use in subsequent ForEach below
Yeah, just seeing if there's a way for a system that just initializes something to just "disable" the system afterwards, but there doesn't seem to be. I think this approach is actually what you're supposed to do? Haha
Just kinda leave the system living forever even though it was just used for init?
does entities.foreach work in onstartrunning? if so that might be simpler but not sure if codegen accepts that
@hollow sorrel I could check, but I imagine what you'll run into in that case is some entities may not have been initialized yet etc
but maybe not, I don't know much about the order of the ECS systems
sorry meant onstartrunning instead of oncreate, which just runs the first time the system updates
Oh, and another thing is the Update() method has to be implemented anyway since it's an interface so I'm not sure what the savings are besides just that bool if check lol
Why not just run OnCreate?
Then it's never run again
Maybe Entities are empty, not sure about that particular lifecycle
yea you'd leave onupdate empty. wouldn't be a performance save at all, but i think reading the code flow would be simpler from someone who didn't write it
since you can assume that code is only meant to run once
without reading an extra bool that may or may not be set elsewhere during its lifetime
Yup, that's much clearer to it's intent
Yeah way better
on start running may be called more than once
imo i would add like a Spawn tag to that entity/archetype, then have that system query those components + spawn tag, remove spawntag and then it wouldnt run anymore on that particular entity.
Under what conditions?
Yeah, I had that before except I have two systems that affect that entity in an initialization way... could put them into one system, but that's kinda weird since they're not really related
onstart running starts any time a query match is found
lets say you temporarily disable an entity fitting PhysicsMass and Rotation via Disabled, its removed from the query and then later remove Disabled, OnStartRunning will process it again as the entity has been reenabled.
unless you want it to work like that
if a system doesnt have entities to process, theres no(or close to zero) overhead, you shouldnt worry about a system with onupdate logic with zero entities to process
just use a tag component
I can't in this case because I have two discrete systems, unless I wanted to use two tags
shouldnt really keep state in the systems, but the entities' components
but then what if I have 3 or 4, haha
could use a singleton component and require that query if you don't want to set tags
basically same thing tho
I just don't see the large benefit over the bool approach? Tags also require an ECB etc
well keeping a bool in the system is kinda like reverting to monobehaviour practises, where your systems are intermingled with data, you can do it but its a bit against the grain. not that it doesnt work, monobehaviours still work just fine in that way too ๐
Hmmm
it's kinda weird case because i can't think of a scenario where you use an entities.foreach that only runs once in the entire lifetime of your game and then never again
closest thing i can think of is that the precondition is "game start" in which case you'd still use a query in case you want to restart your game from main menu right
look at my systems. One locks physics inverse intertia on start. Where would you put that logic ideally? It's from a converted game object
oh i thought that was just some placeholder code
wouldn't that only work for entities that happen to exist from the start
is it that weird? every conversion system is this workflow
anyway what i meant was the precondition is hardly ever "only run once forever", "initialize" is still a precondition that's worth being "data" instead of part of a system (imo)
yeah, where SHOULD that data live in an ECS system? Or does it live outside of it? Haha
I have a few initialization systems that will have to pull data from a server, IE PlayerLastSpawn point etc
Is this still our favourite way of running a System only once?
@tardy spoke I prefer to do:
protected override void OnUpdate()
{
// do stuff
Enabled = false;
}
I'll check it out!
this enables the system to run again by enabling it again when needed
seems like it was most intended for debugging, but doesn't seem to be an editor-only stuff
Hmmm interesting
can i put a monobehaviour to a gameobject and put that to a subscene ๐ค
Pretty sure they get stripped when I tried it
no - Unity starts throwing warnings in the console if you tried that
ah alright, thanks
I bet you could hold a class component that holds a reference to a monobehaviour @opaque ledge
@opaque ledge I have one in a subscene holding a reference to an SO, so... you should be able to do it?
does the subscene serialize and generate a binary data of all the struct's blittable data?
I haven't tried the managed class in subscene approach yet ๐ค
F***ed if I know. But it seems to work. ๐คทโโ๏ธ
i also wondered how they were able to serialize RenderMesh with the managed references ๐ค
i think managed components in subscenes get properly serialized too, even if they reference meshes
not sure how they do it
yea that
I also have a monobehaviour ON the subscene GO itself, but for some reason I think I needed another entity not under the subscene referencing it for it to work. Or something.
they just added asset deduplication in 0.14 too
so if you have same asset across multiple scenes it should only serialize once instead of per scene
haven't tested that yet tho
Just ran into the "Entity not yet created" issue with the OnStartRunning() method
Using "IConvertGameObjectToEntity"
@rancid geode Update loop Enabled = false; worked though
@tardy spoke my use case is, i am making a 2 nativehashmap
1 nativehash map is, ID to EntityPrefab, 2 nativehashmap is ID to ShipData, to make that i am using serialized dictionary with Odin serializer and put Ship Scriptable objects as keys and Gameobject prefabs as value, then i create those 2 nativehashmap in Convert Method and stash them to Shared Static
would that work if i put that script to subscene ?
No idea? All I know is managed ICD seems to work fine referring to an SO and survives loading/unloading of the subscene
No clue how Odin's stuff works
well i guess i will try, i mean its an authoring component
you know actually nvm, i dont want to see Unity's error and get sad
hahaha
Sometimes ECS will surprise ya and actually work. She's a fickle mistress.
However, what @hollow sorrel has said has made me question my architecture...
If all the data is supposed to already be initialized before the ECS system starts running, and I have to load it off of a server (I don't yet, but that's the plan)... but I'm storing it in NativeHashMaps that are maintained by a System that I inject into other Systems that need the game state ๐ค
Does Burst Inspector lag for you guys as well?
I thought one of the updates fixed it, it's still basically unusable.
@tardy spoke write out the whole timeline... What happens when
You might also benefit from injecting the system and then having it clean up
The current paradigm is to load all the data into a staging world, initialize it there, then move the whole world (you have to plan to move everything due to API restrictions)
That's why the editor has "Conversion World" and SubScene has 4 worlds it makes to stream data in (one per frame)
Good to know, I still haven't looked into the additional world stuff yet
It's pretty easy. Make a world, assign systems that are marked up in specific groups and have to do not auto inject flag (forgot what that was). Have a MonoBehaviour tick it
Any good vids or documentation on it?
๐
{
public SubScene SceneToLoad;
private World PrefabWorld;
private SceneSystem PrefabSceneSystem;
private SceneSystem WorldSceneSystem;
public bool MoveEntity = false;
private void Awake()
{
PrefabWorld = new World("PrefabWorld");
PrefabSceneSystem = PrefabWorld.AddSystem(new SceneSystem());
WorldSceneSystem = World.DefaultGameObjectInjectionWorld.GetExistingSystem<SceneSystem>();
}
public void Start()
{
if (SceneToLoad != null)
LoadScene();
}
private void Update()
{
PrefabWorld.GetExistingSystem<SceneSystem>().Update();
}
public void LoadScene()
{
PrefabSceneSystem.LoadSceneAsync(SceneToLoad.SceneGUID); //, new SceneSystem.LoadParameters { Flags = SceneLoadFlags. });
}
}```
Something along those lines
And somehow you can move stuff from there to the regular world
Yah, there's a Move. You have to call some sync stuff for the job... but it should just handle it
https://docs.unity3d.com/Packages/com.unity.entities@0.14/api/Unity.Entities.EntityManager.html#Unity_Entities_EntityManager_MoveEntitiesFrom_Unity_Entities_EntityManager_
It's all or nothing if you want the complete tree
There's other Move commands, but at least for Hybrid components they leave lots of hanging bullshit that it conveniently forgets to copy. Might work better in a pure ECS system though
lol that blue dot is the player on one world tile
If you're using Hybrid's SubScene loader, you can also inject systems into that world, you know
The orange box lol
@violet cosmos yeah I'll look into creating some kind of staging world stuff, I'm thinking I'll need a bunch of that sort of thing down the road to keep the project clean.
that's a big map
20km squared son
Yah, I tried with a PrefabWorld, but really got frustrated at copying Hybrid entities. In theory worked great though, just Hybrid effed it up
It's SpatialOS's problem. ๐คทโโ๏ธ We'll put 'em to the test.
@hollow sorrel hence why earlier I was asking how to defer systems to certain numbers of entities per frame, hahaha.
ah i see
Yeah, most MMORPGs apparently tick at 10 times a second probably for exactly that reason
Server death.
It's going to be painful though. 20km squared with the player at the origin, loading subscenes on the fly while the server figures out the inverse of the locations of enemies (ideally I'd like a zillion zombies just for fun) for all the player's current world positions... 10 times a second... the end result will probably be a server on fire.
Something is causing my dots scene to stop about a second after start, and then spin in application.updatescene for about 5 seconds. I can't find this in my personal profiling- any recommendations?
dunno but maybe try deep profiling
in other news wow i never realized how difficult it is to have unity run at a fixed tickrate
my fixed tick runs at 60fps but if you do the same for application.targetframerate the actual result is more like 59 fps so on average one tick will simulate twice per second causing microstutters
Haha that's crazy
they upped it
i believe its 10 ticks a second now
but even better
battlefield 4
was 10 ticks a second on launch
for a shooter
straight up hilarious
it was bad enough that everyone realized that the server ran super slow
as that latency (100 ms) would get added on top of the lag, so the total delay was insane on everything
Lol, the world map is going to be pretty massive. This test just shows loading the next tile
Woah, 10 ticks on a shooter... that's wild
Might be more fun for noobs because your skill would definitely matter less hahaha
@proven minnow no suggestions but I noticed a bit of the same thing with the latest packages
The subscenes are having some interesting issues with complicated nested prefabs, but maybe it's just the particular Synty model I'm using
Gonna update to newest hybrid renderer and stuff and try.
Satellite hieghtmaps of the earth which I combined in photoshop, imported into unity as terrain heightmap, exported back out to obj, blender to make it low poly and cut into sections.
The colors are just temp vertex colors for my orientation and stuff, but they also do reflect the "climate" of the land for that area of the map. Wintery, desert, etc.
@hollow sorrel
I just took the most interesting areas of the Earth I could find and blended them together. It's a good enough base for what I need, haha.
The white section on the color map is the lower left section there.
I think this is it loading a subscene, takes the player loop up from 7 ms to 17. Hmm.
Was going to do a test build to see if entities works on Oculus Quest again but it's not liking some UnityEditor stuff I have in there... is there some way to access a scriptable objects GUID in a way that doesn't use the asset editor?
I guess I could just generate them but think that would "destabilize" them quite a bit to using their actual internal GUID.
Yikes whatโs that code doing? ๐
It was my attempt at accessing an SO's GUID haha. It worked. I was so happy.
But why do you need it?
I assumed down the line to sync the quest GUID's to the server to avoid resetting everyone's progress every new version lol
Also fyi you could probably do similar using AssetDatabase.GetGUIDFromAsset(this); (something like that from memory
Looks like
Anyway, it only needed to run that once in the editor when the new SO was created so I wasn't too concerned, but anyway... now I'm not sure what to do. ๐ค Almost like I need the SO to call something that hands it's GUID back to it... but that seems a bit cray.
Anyway, yea you want to be avoiding all this editor only code for runtime. In addition you need to be careful that you don't serialize something extra in the editor namespace - it won't like that.
I think the normal way to do this is to serialize the id - and there's not much point in reusing the file's guid - probably just create a new hash. Basically what I do at any rate.
Riiiiight.
I think I just understood the point of serializing shit for the first time. ๐ค
The issue being that the "onEnable" can be called more than once though, resetting the GUID
It gets called upon creation, and upon clicking it in the project or something weird
so.. I think DOTS timeline does something like this: cs [SerializeField, HideInInspector] Unity.Entities.Hash128 _Hash = GenerateDefaultGuid(); public Unity.Entities.Hash128 Hash => _Hash; static unsafe Unity.Entities.Hash128 GenerateDefaultGuid() { var guid = System.Guid.NewGuid(); var hash = new Unity.Entities.Hash128(); hash = *(Unity.Entities.Hash128*)&guid; return hash; } - there may be better solutions but I took a leaf from Unity
it requires unsafe so doesn't look pretty
I like to live dangerously
What's the reason for hashing it exactly? Something to do with serialization?
speedier lookup
it's basically synonymous with guid in this context - just a unique uint4
Interesting
honestly that's really not very intuitive code but will result in a unique id that's serialized per ScriptableObject that you can easily use at runtime via mySO.Hash
It doesn't need to live in OnEnable if it's just called by a class field, does it?
correct - which is important so the hash doesn't get regenerated
I've written so much unsafe code while using ECS
Nothing like an editor crash to spice up your development
*seasoned with a sprinkling of unsafe โจ
Well it seems to work, I think!
Thanks @amber flicker . Unless that's not what it's supposed to look like. In that case, I am angry.
True programmers go unsafe
Don't even know what safe is anymore
Hmm Entities appears to still not be working on Oculus Quest builds. Not a big surprise as not many changes in the 0.14 update.... ooh wait, there's a new android platform... thing.
๐ค
Apparently you have to add the subscenes to the build as well possibly... trying that now.
you need to use the new buildconfiguration tools
so its a scriptable object that has build config options, otherwise subscenes wont work, sec loading unity
Assets>Create>Build one of the options here
there is an example of it somewhere in the official entities samples repo
Yeah, I've been trying both
@safe lintel see anything out of place or missing?
... lol what?
try adding the "classic scripting settings"
its changed a bit since then(its buildconfiguration not buildsettings) so not sure about that little bit
@safe lintel good news is ECS is at least working now, but oddly the game doesn't quite seem to be haha. My test ECS cube rotates and it doesn't crash though.
what part isnt working?
Also @tardy spoke you need to be using an SRP to use Hybrid Renderer V2
@violet cosmos yeah I'm on URP
ugh got my own build issues, test project not building on ci but works fine from unity ๐ฉ
Does anyone have Use Incremental GC checked off? It sounds like a nice feature
This may be the one that finally works! Fingers crossed ๐ค
I can't believe I'm going to have to load my APK from Sidequest all the time to make sure it works on the Quest lolol
I use it but it has never made a difference for me for building
@safe lintel thanks man, it all works.
Man the Quest has no balls. It did admirable on loading the subscene but on 180k vertex colored tris with no lighting it bogged down to like 40 FPS, haha... doesn't that seem a bit unreasonably low, even for a "phone"? @violet cosmos
Yes, that's a lot of tris, but there's no texture data or anything on them at all. or lighting.
