views:

567

answers:

4

This is a somewhat odd question.

I want to provide a scripting language for modding games that I build for XNA. If I was deplying these games for the PC then I would just be able to use C# files, compiled at runtime (Using reflection.emit) as scripts and that would be fine - a nice simple way to mod the game. However, the .net compact framework (which is what the xbox provides) does not support reflection.emit, so how can I write a scripting language taking this into account?

  1. Are there any projects already doing this
  2. Are there any good resources to start my own project to do this
  3. What would be the best language to choose? This is for games scripting so it can be a fairly small language so long as it's quite efficient and easy to implement an interpreter for
+6  A: 

Lua is often used for game scripting. World of Warcraft for example offers it for all its mod makers.

Also take a look at these sites:

  1. C++
  2. C#
Carra
Yes, but is there a pure C# interpreter for LUA? not as far as I know :(
Martin
http://www.gamedev.net/reference/articles/article2275.asp
Carra
Ooh that looks positive, can you edit it into the answer so I can upvote you?
Martin
+2  A: 

I would like to point to this related SO question, adding Javascript as an option. To some, Javascript will be more familiar than Lua.

Peter Lillevold
That's quite a good point actually, I'd never considered that
Martin
This is the path we're going for. Thanks for your help :D
Martin
That is just great. My pleasure!
Peter Lillevold
A: 

You might want to look into VSTA, it provides C# or VB.Net. I don't know about the runtime compiling.

mmk
VSTA what? Please provide some links or more context. Also, does it work on the Xbox?
Peter Lillevold
mmk prolly means Visual Studio Tools for Applications (http://en.wikipedia.org/wiki/Visual_Studio_Tools_for_Applications)
Zano
+5  A: 

I know this is an old question but I had similar requirements earlier and I found out about Managed Scripting. Looks like it is developed initially to solve the problem of scripting in XNA games so this is even better.

From the website:

Managed Scripting Engine

Managed Scripting provides a quick and easy solution for developers needing to implement a scripting engine into their solutions. Managed Scripting comes with a straight forward script engine that can compile & instance scripts on the fly, generating the assemblies in memory or locally on the hard-drive, and allow for dynamically invoking methods and accessing properties during runtime. ManagedScripting runs on Windows Vista, XP, Linux, XBox 360 and Microsofts Zune Player with scripts wrote using either Visual Basic or C# as the language with plans to add support for Ruby, Python and JScript.

I have not looked into it deeper myself but it sounds like what we want.

Dan7
The javascript approach was looking god, but technical issues with type safety sank it, so this is the new approach I'm going to try :D
Martin
Nice to know. Do you have a blog where you regularly update or something? I'd love to keep a tab on your progress with this library.
Dan7
Well, I have a blog at martindevans.appspot.com/blog but I wouldn't exactly call it regularly updated. It looks really bad at the moment because I generally write blog posts on the train commuting to uni, so christmas holidays have left an even larger gap than usual between entries!
Martin