您将在应用程序中嵌入哪个Javascript引擎? [英] Which Javascript engine would you embed in your application?

查看:88
本文介绍了您将在应用程序中嵌入哪个Javascript引擎?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将Javascript嵌入我的爱好游戏引擎。现在我们有第五代Javascript引擎(所有快速)我很好奇你会选择嵌入在C ++框架(包括实际易于嵌入它)的引擎吗?

I want to embed Javascript in a hobby game engine of mine. Now that we have the 5th generation of Javascript engines out (all blazing fast) I'm curious what engine would you choose to embed in a C++ framework (that includes actual ease of embeding it)?

注意:为了清楚起见,我对DOM脚本或在浏览器中编写Javascript不感兴趣。 sup>

这里是到目前为止的链接和一些提示从线程的汇编

Here's a compilation of links so far and some tips from the thread

  • SpiderMonkey
  • tracemonkey (note:backwards compatible with spidermonkey):
  • V8
  • Squirrelfish

为了记录,我喜欢Lua,已经在游戏引擎中嵌入了大约5次。

Just for the record, I love Lua and have already embedded it in game engines about 5 times at work.

但是现在这是一个爱好项目,我认为JavaScript是大多数web开发人员所知道的,因为它的ECMA,Flash和Flex开发人员,使用Javascript和XML脚本的游戏引擎将更加用户化,友好和适应更大的用户基础(和迄今为止没有机会使用他们的技能的游戏)比一个与Lua(周围有很多!)。

However now this is a hobby project, and I think that Javascript being known by most web developers and because its ECMA, Flash and Flex developers, a game engine that uses Javascript and XML for scripting would be more user-friendly and cater to a larger user base (and one that so far has not had a chance to use their skills for games) than one with Lua (and there are plenty of those around!).

此外,对于记录,我将在这一个V8,因为我喜欢它的C ++风格。

Also for the record I'll go with V8 on this one, mostly because I like it's C++ style.

推荐答案

Mozilla的SpiderMonkey 是相当容易和详细记录的。它是一个C API,但它可以直接包装在C ++中。它可以编译为线程安全的,这对游戏很有用,因为你可能希望在一个线程中有你的主逻辑,在第二个线程中有用户界面逻辑。

Mozilla's SpiderMonkey is fairly easy and well-documented. It's a C API, but it's straightforward to wrap it in C++. It can be compiled to be thread-safe, which is useful for games since you'd likely want to have your main logic in one thread and user interface logic in a second thread.

Google的V8 可能是个不错的选择,因为您使用的是C ++,但我没有经验。根据文档(感谢 Daniel James ),V8不是线程安全的

Google's V8 might be a good choice, since you're using C++, but I have no experience with it yet. According to the documentation (thanks to Daniel James), V8 is not thread-safe, although this may change in the future.

还有 WebKit的SquirrelFish ,但是我找不到一个独立的版本,当我看早。

There's also WebKit's SquirrelFish, but I couldn't find a standalone version of that when I was looking earlier.

这篇关于您将在应用程序中嵌入哪个Javascript引擎?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆