I want to use IronPython in a game of mine, but not as the primary programming language (that's written in an amalgamation of C++, C++/CLI, and C#), instead as programmable behavior to allow users to program units and the AI.
In order to accomplish this I need to be able to suspend a script without suspending the thread it resides in. For Example, say there is a function move that orders an object to move forward a certain amount of meters at default speed. There is also a turn function that orders the object to turn a certain amount to the left. I then get the following script from the user: def main(self): self.move(5) self.turn(90) if self.direction == Direction.East: self.turn(180) self.move(2) Now, the script is going to need to be suspended while it's moving 5 meters (it's not going to teleport) forward, then again while it's turning 90 degrees to the right, possibly again when it turns around, and finally once again while moving forward 2 meters. I can't block the script without suspending the thread/fiber, right? But with a large number of scriptable units, the system will not be able to cope with a thread/fiber per script. In addition, I need to be able to save the stack, any dynamic memory being used, and the instruction pointer, as well as the generated code. From what I can tell, IronPython and Cpython both provide "black boxes" that cannot be saved--IronPython providing dynamically generated managed code. I do not know of any way that I can save the code and all data from such an environment. What options would I really have to accomplish this? Is there any way to save/set the instruction pointer/stack frame through MSIL? Is there anything in IronPython's engine that might let me do this? Or perhaps I should just pull in IronPython's Parser and make my own compiler? Any other ideas? Thanks for any help, Erzengel des Lichtes Hikari no Daitenshi Archangel of Light _______________________________________________ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com