I dont intend on writing all the code in c# this time around. Having to recompile every time i make changes to my code is a pain. So, this is where scripting comes in. I can just modify scripts at runtime instead of recompiling each time i want to tweak a freaking variable.
I found a ton of libraries that would allow me to embed an array of scripting languages. Here are the few that caught my attention:
- LuaInterface http://code.google.com/p/luainterface/
- Jint http://jint.codeplex.com/
- Jurassic http://jurassic.codeplex.com/
- IronJS https://github.com/fholm/IronJS
- RemObjects http://www.remobjects.com/script.aspx
- SpiderMonkeyDotNet http://spidermonkeydotnet.codeplex.com/releases/view/72907
- KSharp http://ksharp.codeplex.com/
Some of the libraries appears to be managed as well. I want to release my game for the xbox36, hence the reason for ruling out LuaInterface, so its best to choose a library that supports it. Dont want to dig myself in a hole.
This link states that Jurassic uses Reflection.Emit as well (should have known :/) so that’s out of the picture. This leaves me down to 2 libraries: Jint and KSharp.
Lets make a comparison of the 2 here:
This isnt a wrapper, it’s a js interpreter written(with the lexer and parser generated by ANTLR) entirely in c#. This means it will run on the XBox 360. It’s very easy to use, well documented ad is fairly up to date. It is however not as fast as i’d like it to be. No typesafety, easier to code but languages like these tend to run slower(pro and con).
I’ve done some googling and the issue of speed is a problem users have where jint is concerned. Precompilation would be a very nice feature to help decrease load time. I should probably suggest that to the project managers. There’s no class support, so i gotta come up with some way to create classes in my scripts.
Its description hits the nail on the head regarding what i want from an embedded scripting library. It targets both windows and the xbox 360. It compiles code at runtime so it should be fast.
Type safety. This should be a pro, but I really didnt want to see this when scripting. I dont have time for bothersome typecasting.
It’s last update was in 2009 and there are no bug trackers or documentation or anything for that matter!
I wont pick, I’m going to use them both. I’ll use KSharp for those scripts where get performance is necessary, and Jint when i want to relax and quickly hack up new game objects. Also, i’ve never used multiple scripting languages in a project so this should be fun :D. I’ll tell you guys how things work out next week.