C++20 coroutines have lovely syntax, but they're a terrible fit for games.
In this article, we'll build a macro-base alternative that's more suitable for game development in ~200 lines of C++.
Stackless coroutines for gamedev in ~200 lines of C++
by Vittorio Romeo
From the article:
For a game I want a coroutine that is part of an object’s data. When the object dies, the coroutine dies with it. When I serialize the object to a save buffer, the coroutine’s state goes with it. When the optimizer is off, there is no extra cost compared to the equivalent state machine. C++20 coroutines do not provide any of these guarantees out of the box.
Let’s build something that does.

Add a Comment
Comments are closed.