Tuesday, December 06, 2005

Scripting to use?

There are a few roads that one can go down to integrate scripting into a .net application.

  • VSA - Visual Studio for Applications
    • No SDK that I can find
    • This was discontinued in 2003 and will probably be replaced by Visual Studio Tools for Applications
    • Reports of memory leaks which are probably due to the inability to unload assemblies, hopefully this would not affect my application. A possible solution would be to load the assembly into its own AppDomain and unload that.
    • Requires about 300 lines of code for the class to manage the VSA scripting engine.
    • Couldn't add a textbox for the script engine to use. Classes seemed to pass along fine though.
  • LUA - http://www.lua.org/ and Lua Interface for .NET - http://luaforge.net/projects/luainterface/

  • Microsoft Script Control
    • Widely supported
    • Uses an ActiveX control. So this would need to be installed - overhead
    • Very little code require to use
  • WebService
    • Can be slow unless asynchronous
  • Python - Perhaps overkill for such a small application.
  • CSharpCodeProvider - The DX 9c SDK has a sample that demonstrates scripting to move an object. The scripts are normal cs files. The example also sets Permissions so "bad" scripts can't be run. The codeProvider is certainly something that need looking deeper into.

From what little research I've done, it looks like the MS Script control would be the best way to go, especially if I'll be adding the ability to add plug-ins (i.e. dynamically load assemblies) at a later date.

Scripts Purpose

I did see a mention on the exDream blog that he used Lua and c# to create the effets. So it is possible to achieve some good results with Lua.
Scripts could be used for debugging and cheating. It would be simple to change or modify game values such as health or weapons damage. It could also be used to decide how the particle effects are generated.
The cinematics could be created and layed out with the scripts. So in essence the scripts choreograph the cinematics dictating what to draw, what sound files to play and what lighting to use, as well as the animations and movement of objects.

0 Comments:

Post a Comment

<< Home


___