So my attempts at writing the scripting system for this engine are going well. Very well in fact. The bytecode compiler hasn't been as hard to implement as I'd thought, but that's off-topic.
A little vital info:
I'm using a co-operative multi-tasker. Anything that needs some processing time each frame must implement the Process interface, the only pure virtual of which is onUpdate( const int deltaMs ).
Each frame, the task manager's update function calls the onUpdate() function of each Process it's managing.
Now, my P_ScriptExecutor process. At the moment I've got it executing a single script instruction per update. Since I can't actually test it right now, I'm not sure if this would be a problem when scripts start getting pretty big.
Another way I could do it would be to execute as many instructions as possible every 250 ms or something, in a similar way sprite animation / GUI animation's work.
Any thoughts / comments? Would larger scripts lag behind the gameplay?
Experimentation is the simplest (and best) solution, implement time slicing as well and see what kind of performance you get from each in different situations. I assume you aren't trying to implement a general purpose vm so there should be plenty of context optimization available.
I would think that letting a script run for x amount of time would be better than x number of lines. Maybe even some scripts flag themselves as "let me continue running until I'm done" just in case?
Ah that flag idea is good. Thanks for everything else too guys.