-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Component Lifecycle Terms #18
Comments
Also wanted to give you a heads up that I posted a MR benchmarking this lib Doraku/Ecs.CSharp.Benchmark#29 Showed really great results |
On my list! |
Hmm, yeah adding variations for ref vs non ref would make the query gen way too large. I wonder if you could introduce wrapper component types like public ref struct ChangeTracked<T> where T : struct
{
public ChangeTracked(Ref<T> value)
{
_value = value;
}
private Ref<T> _value;
public bool Changed = false;
public T Value
{
get => _value.Value;
set
{
_value.Value = value;
Changed = true;
}
}
} that would be automatically handled by the query system to resolve down to T ComponentInfo and update the cell watermark when changed |
I'm not sure about that. |
I've started working on a POC where that's stored alongside the component array for chunks Add tracking is easy, but I'm not sure how to do the Change notifications either. I think your only options are
|
Though you likely want some way for a query to denote what components it reads vs writes, that way you can start tracking the dependencies of systems for parallelization. So IMO if theres a path to 3, thats the best option. I believe flecs does it with a NotifyChange and supports parallelization via manually annotating queries |
More a proof of concept than anything, not sure if it will work with the full functionalities set like bevy: |
Nice! How does that Removed flag work? If it gets flagged on the old archetype then the old arch row is marked as invalid and won't track anything |
Pushed more commits. Good catch about the removed component. I didn't realize until now that you just posted the solution with your first post! Basically bevy uses the events under the hood |
Hey I really like the direction you're taking this library! I've been bouncing between different ECS libs and this seems like a great option.
It would be very helpful if queries had support for defining filters based on the lifecycle of components.
Mainly:
Changed<T> - Evaluates to true when component T was accessed mutably or set for the entity since the last execution of the query
Added<T> - Evaluates to true when component T was added to an entity since the last execution of the query
The text was updated successfully, but these errors were encountered: