Skip to content
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

Async Tasks support #119

Open
picolino opened this issue Jul 2, 2021 · 1 comment
Open

Async Tasks support #119

picolino opened this issue Jul 2, 2021 · 1 comment

Comments

@picolino
Copy link

picolino commented Jul 2, 2021

Hello, I'm very impressed with this ECS implementation, it's so flexible, really nice work.

I have an idea to try to use ECS with business applications creation.
To do so, I need asynchronous flow in systems in your library that uses Task and ValueTask as return values to be able to mark them async.

What I can do is to make a new interface like IAsyncSystem<T>, add a new method Task Run(T state) into it, and call it manually. Also, I need to write my own "base systems" like ActionAsyncSystem, SequentialAsyncSystem etc...

But I definitely won't be able to use Publish/Subscriber model that supports only by World.

I could write a separate library that will be able to extend DefaultEcs with async flows, but I can't see any extension points to extend Publish/Subscribe model behavior, because it defined only inside a World and can't be overridden outside.

@Doraku what do you think about it? I assume it would be nice to add an extension point here.

@Doraku
Copy link
Owner

Doraku commented Jul 2, 2021

hey! you mean like being able to provide your own IPublisher implementation to be used in a World? This is actually something I wanted to do at first (hence the IPublisher interface) but never went the extra miles. There is so many static tricks used that I am not even sure it is still doable.
On the async part, from the start I didn't take that into account when designing DefaultEcs as async/await can allocate which is a big nono in games. There is no thread safe lock as you are expected to know what you are doing, relying on EntityCommandRecorder when needed, this might be difficult to handle with async/await too :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants