Session Name: | Multitasking with Coroutines |
Speaker(s): | Snorri Sturluson |
Company Name(s): | CCP Games |
Track / Format: | Programming |
Overview: | Tasklets, as a form of cooperative multitasking, are used in EVE Online to drastically simplify program flow in scripts that need to run over multiple frames. Multithreaded programming works well for many things, but sometimes, especially in scripting, cooperative multitasking still has its place. This presentation describes how tasklets are used in EVE, both in the client as well as on the server, showing examples of what tasklets are used for, with Python code samples. The program flow using tasklets is compared to some alternatives, such as using state machines or multiple OS threads. The implementation of tasklets in Stackless Python as used in EVE Online is discussed, as well as some alternatives, such as using regular CPython with greenlets, or Lua using coroutines. |