Migrating from SK : how to migrate coroutines?

Hi guys,
Most of our SK code can be rewritten in C++ or BP.

However I’m struggling with the idea on how to deal with replacing coroutines.
My best bet would be to dig deeper into UE async framework, but there’s a lot of ground to cover.
Possibly some variant of nested AsyncTask on gamethread with lambdas.
However to have a proper ‘race’ or ‘sync’ substitute we would have to have an ability to cancel the async task. Not sure how to do it, or which async UE class has ability to abort.
Any ideas ?

I don’t really know how to port it to C++ but C# has some libraries that can do similar tasks:

Similar to Sync:

Similar to Race:

Maybe there’s a C++ library using the same terms out there that you can use.

Moving to Unity or homebrew C# wasn’t on my mind :smiley:.

There’s a lot of async support in UE and it’s not as consistent as async/await in dotnet. I was wondering what could we use that we already have in UE to kind of replace coroutines. I’m digging through UE code and docs looking for a best approach but maybe someone has a good idea how to accomplish this.

For some, for AI at least, it would be enough to move to behaviour trees, but they have a really narrow and limited approach compared to proper programming.

Sorry i was just trying to point out some terms that may be also used by other libraries in C++. I actually found this one: https://github.com/Amanieu/asyncplusplus

Although i think this UE4 implementation can be used as well: https://forums.unrealengine.com/development-discussion/engine-source-github/27216-new-core-feature-async-framework-master-branch-and-4-8

1 Like

Thanks, much appreciated.
However the part I’m worried about is properly and safely cancelling tasks/threads. This might be a bit trickier here.
But the asyncplusplus looks promising.