11

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
2
  • 2
    Actually, Reflection.Emit doesn't allow you to compile C# code. Are you talking about CodeDOM? Commented Dec 2, 2009 at 11:27
  • It appears that I do. Is codeDom available on the compact framework? Commented Dec 2, 2009 at 11:30

4 Answers 4

6

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#
Sign up to request clarification or add additional context in comments.

2 Comments

Yes, but is there a pure C# interpreter for LUA? not as far as I know :(
Ooh that looks positive, can you edit it into the answer so I can upvote you?
5

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.

3 Comments

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
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.
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!
2

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

2 Comments

That's quite a good point actually, I'd never considered that
This is the path we're going for. Thanks for your help :D
0

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

3 Comments

VSTA what? Please provide some links or more context. Also, does it work on the Xbox?
mmk prolly means Visual Studio Tools for Applications (en.wikipedia.org/wiki/Visual_Studio_Tools_for_Applications)
Come on. Google -> VSTA. Takes 2 seconds

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.