C# Scripting language
Asked Answered
C

4

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
Chipmunk answered 2/12, 2009 at 11:18 Comment(2)
Actually, Reflection.Emit doesn't allow you to compile C# code. Are you talking about CodeDOM?Bohemian
It appears that I do. Is codeDom available on the compact framework?Chipmunk
A
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.

Argolis answered 20/12, 2009 at 16:16 Comment(3)
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 :DChipmunk
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.Argolis
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!Chipmunk
P
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#
Physiotherapy answered 2/12, 2009 at 11:27 Comment(2)
Yes, but is there a pure C# interpreter for LUA? not as far as I know :(Chipmunk
Ooh that looks positive, can you edit it into the answer so I can upvote you?Chipmunk
A
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.

Argolis answered 20/12, 2009 at 16:16 Comment(3)
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 :DChipmunk
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.Argolis
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!Chipmunk
S
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.

Sumo answered 3/12, 2009 at 8:43 Comment(2)
That's quite a good point actually, I'd never considered thatChipmunk
This is the path we're going for. Thanks for your help :DChipmunk
T
0

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

Teston answered 3/12, 2009 at 9:11 Comment(3)
VSTA what? Please provide some links or more context. Also, does it work on the Xbox?Sumo
mmk prolly means Visual Studio Tools for Applications (en.wikipedia.org/wiki/Visual_Studio_Tools_for_Applications)Catacaustic
Come on. Google -> VSTA. Takes 2 secondsFriesian

© 2022 - 2024 — McMap. All rights reserved.