Trio is an asynchronous I/O framework. Unlike other async frameworks in Python, Trio offers structured concurrency: the structure of a program's concurrency tasks are reflected in its code.
The advantage of structured concurrency is that concurrent programs become easier to reason about, particularly if operations are cancelled.
I reimplemented Trio-like structured concurrency in a game engine, Wasabi2D, and wrote some games with it. I found it to be an excellent fit that simplifies many game logic tasks.
In this talk I'll talk about concurrency in video games, present structured concurrency with examples found in game logic, and draw parallels between I/O based concurrency tasks and those found in video games.
The examples will also serve as a tutorial for writing games in Wasabi2D.
Finally I will explore the differences between Wasabi2D and Trio's implementation of the structured concurrency concepts. By comparing the solutions we will see which elements of Trio are foundational to structured concurrency and which are specific choices for Trio's problem space.