Update to the Roslyn Scripting API

Coordinator
Mar 7, 2012 at 1:10 AM

One of the ideas that I have been kicking around is to update the console's script "engine" (ha!) to use the Roslyn Scripting API.  

This would expose much of the power of C# to the console itself, allowing interactive execution of C#/VB.NET code.  Since it would support POCOs right off the bat, it would make it easier to share data between the script/console and the game without having to use the types-wrapped-as-a-string cvar types that are used now.

It would also make it easier to debug complex scripts/functions, because changes could be made quickly without having to rebuild assemblies.

A possible downside is that raw text is easier to mess with than a compiled assembly, so there would need to be some way to protect "stock" scripts from tampering, but this may be a job for the game developer (compression, encryption, etc.).

I was thinking of having a base context object that would expose a standard set of shared data between the console and the game.  Developers could derive from this context object and add additional members (properties) to it that would then be visible to the scripts.  

I need to investigate as to how I can manipulate the state of the script engine so that it is possible to remove created items (e.g. remove a created function so that it can be replaced without restarting the application), or limit how much it can be manipulated (e.g. to prevent tampering with a released game).

More info to follow.  Hopefully.

-=- James.