简体   繁体   English

C#脚本语言

[英]C# Scripting language

This is a somewhat odd question. 这是一个有点奇怪的问题。

I want to provide a scripting language for modding games that I build for XNA. 我想提供一种脚本语言来修改我为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. 如果我将这些游戏用于PC,那么我就可以使用C#文件,在运行时编译(使用reflection.emit )作为脚本,这很好 - 这是一个很好的简单方法来修改游戏。 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? 但是,.net紧凑框架(这是xbox提供的)不支持reflection.emit,那么如何编写一个考虑到这一点的脚本语言呢?

  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 这是用于游戏脚本,所以它可以是一个相当小的语言,只要它非常有效并且易于实现解释器

Lua is often used for game scripting. Lua经常用于游戏脚本。 World of Warcraft for example offers it for all its mod makers. 例如,“魔兽世界”为其所有模组制作者提供了它。

Also take a look at these sites: 另外看看这些网站:

  1. C++ C ++
  2. C# C#

I know this is an old question but I had similar requirements earlier and I found out about Managed Scripting . 我知道这是一个老问题,但我之前有类似的要求,我发现了Managed Scripting Looks like it is developed initially to solve the problem of scripting in XNA games so this is even better. 看起来它最初是为解决XNA游戏中的脚本问题而开发的,所以这更好。

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为需要在其解决方案中实现脚本引擎的开发人员提供了一种快速简便的解决方案。 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. Managed Scripting附带了一个直接的脚本引擎,可以动态编译和实例脚本,在内存中生成程序集或在硬盘驱动器上本地生成程序集,并允许在运行时动态调用方法和访问属性。 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. ManagedScripting在Windows Vista,XP,Linux,XBox 360和Microsofts Zune Player上运行,脚本使用Visual Basic或C#作为语言编写,计划添加对Ruby,Python和JScript的支持。

I have not looked into it deeper myself but it sounds like what we want. 我自己并没有深入研究它,但它听起来像我们想要的。

I would like to point to this related SO question , adding Javascript as an option. 我想指出这个相关的SO问题 ,添加Javascript作为选项。 To some, Javascript will be more familiar than Lua. 对某些人来说,Javascript会比Lua更熟悉。

You might want to look into VSTA, it provides C# or VB.Net. 您可能想要查看VSTA,它提供C#或VB.Net。 I don't know about the runtime compiling. 我不知道运行时编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM