C# 脚本语言

发布于 2024-08-13 08:24:06 字数 412 浏览 7 评论 0原文

这是一个有点奇怪的问题。

我想为我为 XNA 构建的模组游戏提供一种脚本语言。如果我在 PC 上部署这些游戏,那么我将只能使用在运行时编译的 C# 文件(使用 reflection.emit)作为脚本就可以了 - 一种修改游戏的简单好方法。但是,.net紧凑框架(xbox提供的)不支持reflection.emit,那么我如何编写考虑到这一点的脚本语言呢?

  1. 是否有任何项目已经在这样做?
  2. 是否有任何好的资源来启动我自己的项目来做到这一点
  3. 选择什么是最好的语言?这是用于游戏脚本的,因此它可以是一种相当小的语言,只要它非常高效且易于实现解释器即可

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

水染的天色ゝ 2024-08-20 08:24:06

Lua 通常用于游戏脚本编写。例如,《魔兽世界》为其所有模组制造商提供了它。

另请查看这些网站:

  1. C++
  2. C#

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#
在梵高的星空下 2024-08-20 08:24:06

我知道这是一个老问题,但我之前有类似的要求,并且我发现了托管脚本。看起来它最初是为了解决 XNA 游戏中的脚本问题而开发的,所以这更好。

来自网站:

托管脚本引擎

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

我自己没有更深入地研究过它,但这听起来像是我们想要的。

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.

故事还在继续 2024-08-20 08:24:06

我想指出这个相关的SO问题,添加JavaScript 作为一个选项。对于某些人来说,Javascript 会比 Lua 更熟悉。

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

夜深人未静 2024-08-20 08:24:06

您可能想研究一下 VSTA,它提供 C# 或 VB.Net。我不知道运行时编译。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文