Can Ironpython be used to run multiple Python Virtual Machine Instances in parallel?

The answer to your subject question is yes you can run multiple interpreters in parallel. Generally each script will run in its own ScriptScope but you can also use isolated ScriptEngine s if necessary.

Up vote 2 down vote favorite share g+ share fb share tw.

Inspired from the game GunTactyx, where you write programs controlling fighting robots. Guntactyx used the Small language, that later is called Pawn. I am looking into using Python as the scripting language.

My concerns are: Interfacing to C# The scripts should interface into C# through simple functions, doing stuff like scanning for enemies, rotating and firing. I guess each function should be delayed, so they would take x ms to return. Bad programs.

The system should be tolerant to infinite loops or crashes. I would like each virtual machine to be given X ticks to execute at a time. Limited memory usage Scripts should not be allowed to use unlimited usage.

I would like some sort of cap. Probably alot of other problems I would like to end up with something in this "pseudo" style. Robots = a list of robots while(1) foreach robot in robots robot.tick() gameworld.update() python game-development ironpython link|improve this question edited Jul 13 '10 at 14:03Matt Joiner16.2k33597 asked Jul 13 '10 at 14:01user115162132.

The answer to your subject question is yes, you can run multiple interpreters in parallel. Generally each script will run in its own ScriptScope, but you can also use isolated ScriptEngines if necessary. You can inject variables/functions into a script's scope before running it using scope.SetVariable.

Your best bet is to run the Python code on a separate thread and watch it; if it takes too long to return, interrupt the thread. (this is tricky to get right, but that's a different question) I'm not sure that can enforced easily. It may be possible if you run the scripts in a different AppDomain or process, but that's a lot of extra work for minimal gain.

Just ask!

It is critical that each Virtual Machine has same amount of computing cycles. Do you think there is a way to let it run in a controlled fashion? – user115162 Jul 13 '10 at 18:29 The same number of processes, probably not, at least not on .NET.

The best you could do is given them a fixed time window. – Jeff Hardy Jul 13 '10 at 22:08.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions