HCoroutines's icon

HCoroutines 2.0.1 Scripts 4.2 Community

Submitted by user BangL; MIT; 2024-04-04

HCoroutines is a library that helps you write game logic in an intuitive way by bringing the concept of hierarchical coroutines to Godot (C#). Its built-in coroutine types are specifically designed for Godot, reducing boilerplate code and increasing readability. At the same time, async methods can also be seamlessly integrated with coroutines.
Coroutines are functions that can be paused during execution and then resumed once some condition is met. This allows you to write game logic in sequential steps, defining what logic should be performed when.
This library extends the idea of normal coroutines by allowing them to spawn child coroutines. When the parent coroutine is killed, the child coroutines are also stopped.
HCoroutines implements this concept in an efficient and optimised way.
- Regardless of how deep the hierarchy of coroutines gets, the engine only updates the currently active ones, and not ones that are waiting.
- The coroutines themselves are implemented as linked lists, allowing for O(1) addition and removal of child coroutines. Because each coroutine is itself a node in the linked list data structure, no additional memory allocations are required.

originally made by Inspiaaa for Godot 3.5:
https://github.com/Inspiaaa/HCoroutines

IMPORTANT:
Add ./addons/HCoroutines/CoroutineManager.tscn to your Project Autoloads!


View files Download Submit an issue Recent Edits