Woo, I'm back. It's been a while since I've been here.
I've done a lot of research while I was away. The complete source code to Danmakufu is still in the shadow, and I think it'llalways stay that way, but I found something that may interest some devs.
Danmakufu's scripts take an already existing concepts of
coroutines. Most notably, the tasks that run in parallel in each script entities, and even the entities themselves.
Danmakufu's ScriptEngine uses a FSM to get the job done by emulating threads. The tasks explicitly yield to the other threads. Well, in this case, it's better to call them something like
fibers, because tasks yield themselves in the script rather than have a scheduler to yield them for you.
Danmakufu's implementation of it (at least, compared to hardcoded C OS-specific fibers) are actually quite heavy. Unfortunately C/C++ programming languages are sequential languages that assume the program runs on only one thread and thus is designed as such, but operating systems take advantage of ASM to save/restore the call stack and CPU registers to implement it anyway. In fact, there's a whole article about it I came across for Windows
here. Anyway, I think these will be my last words on the subject, seeing as I went a bit off-topic. But hopefully this will help other devs with whatever game it is they're making. I know how irritating task-scheduling for entities to run parallel processes can be, and this has definitely become a popular paradigm for AI programming in games.