Java 最快的脚本语言?

发布于 2024-09-26 02:42:49 字数 302 浏览 3 评论 0原文

我正在用 Java 制作落沙游戏。我希望用户能够为游戏编写自己的引擎,并且我认为脚本语言可能适用于此。我用 jython 尝试了一个小脚本,它比 java 版本慢很多倍。

我需要一种具有快速循环和/或快速数组访问的脚本语言,因为这是游戏将要做的很多事情。或者,如果您对让用户为游戏编写自己的引擎的另一种方式有任何建议。

我也不完全确定这可以工作(很好)。如果您认为不行,请告诉我原因以及一些可能的替代方案。

I'm making a falling sand game in Java. I want users to be able to write their own engine for the game and I thought a scripting language might work for that. I've tried out a small script with jython and it's many times slower than that java version.

I need a scripting language that has fast loops and/or fast array access since that's what the game will be doing a lot of. Or if you have any suggestions on another way to let users write their own engine for the game.

I'm also not entirely sure this can work (well). If you don't think it can please let me know why and maybe some possible alternatives.

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

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

发布评论

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

评论(3

清醇 2024-10-03 02:42:50

JavaCC

您可以使用 JavaCC 编写自己的简单游戏语言。这确实为您提供了您可能想要的所有灵活性和本机 Java 速度(实际上这取决于您的实现)。但你需要保持语法简单,否则会花费一些精力...

Java

Java?是的,Java!为什么不让用户通过 Java 代码扩展您的游戏呢?在 Java 6 中,有一个 Java 编译器 API:

Beanshell 与 Rhino

BeanShellRhino (Javascript) 解释器(Rhino 是获胜者):

JavaCC

You could write you're own simple game language with JavaCC. This does give's you all the flexibily you possibly want and native Java speed (well that actualy depends on you're implementation). But you need to keep you're syntax simple or else it will take some efford...

Java

Java? Yes Java! Why not let users extend you're game by Java code? In Java 6 there is a Java compiler API:

Beanshell vs Rhino

Some performace comparison between BeanShell and the Rhino (Javascript) interpreters (Rhino is the winner):

习ぎ惯性依靠 2024-10-03 02:42:50

您可以查看 BeanShell 来了解这一点。在我的使用中,它的速度几乎与本机 Java 一样快(因为它变成了这样),并且很容易访问,因为它是 Java,尽管它锁定在 Java 1.4 左右。

You might look at BeanShell for this. In my use it's been pretty much as fast as native Java (as that is what it becomes) and is pretty accessible as it is Java, albeit locked around Java 1.4.

谢绝鈎搭 2024-10-03 02:42:50

RelProxy 是 Java 动态编译器和自动热类重新加载器,纯 Java 代码可以像脚本语言。

因为 Java 是最快的脚本语言,所以 Java 可能是最快的脚本语言,因此您可以选择使用 .class 文件(例如某种编译缓存)来避免加载时编译。

RelProxy is Java compiler on the fly and an automatic hot class reloader, pure Java code can be executed like a scripting language.

Because Java is faaast Java is then maybe the fastest scripting language, optionally you can use .class files like a sort of compiled cache to avoid compiling on load.

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