Managed and sandboxed scripting engine for .Net

Started by
7 comments, last by earlz 11 years, 10 months ago
Hello there. I'm crossing my fingers this doesn't come across as spam...

Anyway, I was recently scouting for a managed and sandboxed scripting engine for .Net and came across a post here of a engine that didn't quite deliver what most people want. Hopefully I'm different.

I've built a scripting engine in C#. It is completely managed and is a true interpreter. I know that scripting engines are used extensively in games to allow for user modding(such as Gary's Mod and many others) as well as for other purposes.

I'm currently looking for beta testers and feedback on this scripting engine I've made(named Scripter2).

The scripting language used is similar to Lua, Javascript, and PHP.

Here is an example script:

var table=["foo" => "bar","baz" => 10];
return table.foo+(table.baz as string); //returns "bar10"

It's also very easy to use in your game/application and easy to extend. Here is a quick example of implementing a `print` function and executing a script using it:

public void RunScript(string script)
{
Engine=new ScriptingEngine(script);
//Now add our print function
var args=new VariableList();
args.Add(new VariableContainer("message"));
Engine.Global.Add(new VariableContainer("print", new FunctionVariable(new ExternalScriptFunction(PrintFunction), args)));
Engine.Execute();
}

BaseVariable PrintFunction(VariableList args, ScriptingEngine s){
string msg=args.Get<string>("message");
System.Console.WriteLine(msg);
}

And here is an example Hello World script for it:

print("Hello World!");
return;


Anyway, if this sounds interesting to you, I'd love to hear some feedback. In the next few days I should hopefully have a simple demo web application so that you can try out it's syntax more as well.

Also, for full disclosure, I plan to sell this scripting engine whenever it reaches 1.0. Beta testers of course will get a commercial license for free though.

If you want more information about it or want to contact me by email, you can check out the beta-testing post I put on my blog at http://lastyearswish...aa5d825b303f18b

Thanks
Advertisement
Tbh, I'm fine with lua interface.

Tbh, I'm fine with lua interface.


I'm sure a lot of people are. What I bring to the table though is support for a Scripting Engine where P/Invoke isn't an option and neither are the many dynamic .Net languages out there(due to missing Reflection.Emit).

Though I haven't tested it just yet, I know my Scripting Engine at least compiles(and should work) on xbox 360, Windows 7 phones, and on Android phones via Mono For Android.

Also, for full disclosure, I plan to sell this scripting engine whenever it reaches 1.0. Beta testers of course will get a commercial license for free though.

A .net only, commercial vm blink.png , good luck.

What about advanced features like multithreaded, lockless inter VM communication, that is something I really miss in lua.
Well, if you plan to use it on the XBox 360 and WinPhones you should really think about the GC first as thats the number one problem with scripting on the XBox it seems [?]

Just what I've picked up lurking @ AppHub forums.

Well, if you plan to use it on the XBox 360 and WinPhones you should really think about the GC first as thats the number one problem with scripting on the XBox it seems [?]

Just what I've picked up lurking @ AppHub forums.


Yes, I have a lot of work to do in that area I assume. But, even though my scripting engine might waste a lot of memory right now, it will actually work at least. Reflection.Emit is flat out not supported on those platforms, but is what most of the scripting languages I've seen rely on.

I plan on trying to make my scripting engine as lean as possible and making sure that it works in such memory restricted environments. That's part of the reaosn why I need beta testers :)
Have you given a name for the scripting language or have you implemented an existing one?

Have you given a name for the scripting language or have you implemented an existing one?


I've made my own. I don't yet have a name for it though. It resembles javascript so closely though that if you have any experience with it, it should be very easy to learn.

I almost have a demo site done so that you can mess around with the language some. Hopefully that should be done sometime tomorrow
I now have a demo web app online so you can play with the language some: http://scripter2.lastyearswishes.com/

This topic is closed to new replies.

Advertisement