I'm looking for a way to allow players to write code in a high level language, but I need to be able to keep all script instances synchronized in terms of script execution time per game tick so that no player gets an advantage.
The purpose for this is a simulation in which there are many bots scripted by several people, and the bots are in competition. The idea is to have a level playing field by advancing the execution in a controlled way so that no bot can gain an advantage.
This also has to be synchronized in a meaningful way with the rest of the simulation/physics. Having control over granular execution steps seems like one way to do this, although I'd be open to other potential solutions. In other words, if i made up my own assembly language and associated interpreter, I could control execution granularly, but besides being a significant undertaking, assembly languages are far more difficult to work with then high level ones.
Here are some ideas I've come up with :
If there is a way for each bot to run a simple OS/VM, that could work, provided the OSes can be instantiated, controlled/execution time metered, and interfaced with programmatically from .NET code, but I don't know of anything like that.
A scripting engine like Google's V8 seemed like it would be awesome, but there's no way to ensure program A and program B can each be allowed equal execution time; line by line stepping doesn't work here, as a line from program A could read:
q=(((x+y)/z)-(a*b))/c;
while a line from program B could read:
q=3;
meaning running each line's program results in one (probably) executing for a longer time than the other.