Take the 2-minute tour ×  I've been struggling with how to
implement scripting in my game engine. I only have a few
requirements: It should be intuitive, I don't want to write a
custom language, parser and interpreter, and I don't want to use
threading. (I'm certain there's a simpler solution; I don't need
the hassle of multiple game logic threads.) Here's an example
script, in Python (aka pseudocode):  def dramatic_scene(actors):
alice = actors["alice"]     bob = actors["bob"]      if
bob.can_see(alice):         bob.say("Hello again!")
alice.say("Excuse me, Bob?")  That epic piece of storytelling
poses implementation problems. I can't just evaluate the whole
method at once, because walk_to takes game time. If it returns
right away, Alice would start walking up to Bob, and (in the
same frame) say hello (or be greeted). But if walk_to is a
blocking call that returns when she reaches Bob, then my game
gets stuck, because it's blocking the same thread of execution
that would make Alice walk.  I consi