用于 Javascript 的 2D 引擎

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10172191/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 00:09:25  来源:igfitidea点击:

2D Engines for Javascript

javascripthtmlcanvas2d

提问by Daniel Sloof

I'm attempting to build a tile-based game in javascript, using HTML5 canvas. There are -many- engines to choose from, such as;

我正在尝试使用 HTML5 画布在 javascript 中构建基于图块的游戏。有许多引擎可供选择,例如;

... and the list goes on and on.

... 这样的例子不胜枚举。

However, there does not seem to be one de facto standard among all these different implementations. Essentially I am looking for the 'jQuery' of javascript game engines. One that is backed by a (larger) community, has excellent documentation and is actively maintained. Most of these just seem like one-man projects to me.

然而,在所有这些不同的实现中似乎没有一个事实上的标准。本质上,我正在寻找 javascript 游戏引擎的“jQuery”。由(更大的)社区支持,拥有出色的文档并得到积极维护。其中大部分对我来说似乎只是一个人的项目。

To phrase this into a real question; what is the de facto standard for 2d game engines in javascript?

把这变成一个真正的问题;javascript 中 2d 游戏引擎的实际标准是什么?

Additionally I would be very interested in experiences with actual implementations (other than demo pong / pacman games).

此外,我对实际实现的经验非常感兴趣(除了演示 pong / pacman 游戏)。

采纳答案by Simon Sarris

There isn't one right now and I would go on to say that there may never be onein the same way that there is jQuery, for the simple fact that most (commercial) games are going to want to be mercilessly performant, which means using as little extra cruft as possible, and many of these libraries add unnecessary things or performance hits where it may not be desired.

现在没有,我会继续说可能永远不会有 jQuery 那样的一个,因为大多数(商业)游戏都想要无情的性能,这意味着尽可能少地使用多余的东西,并且其中许多库在可能不需要的地方添加了不必要的东西或性能下降。

That is not to say they won't be used at all, all of the above libraries are probably good for a great deal of small(er) games.

这并不是说它们根本不会被使用,上述所有库可能都适用于大量小型(呃)游戏。

But I imagine on large projects many studios will find themselves starting with a library until they hit a performance wall, and then writing all the components they used in the library themselves in order to keep only the thin bits that they need.

但我想在大型项目中,许多工作室会发现自己从一个库开始,直到遇到性能瓶颈,然后自己编写库中使用的所有组件,以便只保留他们需要的细小部分。

If there is one that becomes popular it will almost certainly be be modular like MooTools (second most popular JS library), where it tries to be compact and lets you select only the components you want to use. I imagine you'll find a lot of games in the future that have a very small engine justfor handling sound or justfor handling images or a 2D isomorphic board, instead of games that have a (large) library that attempts to handle every possible kind of 2D game.

如果有一个变得流行,它几乎肯定会像 MooTools(第二个最流行的 JS 库)一样模块化,在那里它试图变得紧凑并让你只选择你想使用的组件。我想你将来会发现很多游戏都有一个非常小的引擎,用于处理声音或用于处理图像或 2D 同构板,而不是具有试图处理所有可能的(大型)库的游戏一种2D游戏。

Anyway, if you simply want to find the most popular javascript engine then your best bet over the coming months is to use Google (page rank) to determine most popular. Searching for "2D game engines Javascript/Canvas" will give you a pretty good idea of which is the most linked-to (popular) library at any given time.

无论如何,如果您只是想找到最受欢迎的 javascript 引擎,那么在接下来的几个月里,您最好的选择是使用 Google(页面排名)来确定最受欢迎的引擎。搜索“2D 游戏引擎 Javascript/Canvas”将使您很好地了解在任何给定时间哪个是链接最多(流行)的库。

(After all, try searching Google for "JavaScript Library". You can guess the first result I bet!)

(毕竟,尝试在 Google 上搜索“JavaScript Library”。你可以猜到我打赌的第一个结果!)

回答by pensan

Found this question while searching for an engine of my own. I just want to add this site here because it offers a good overview over a lot of HTML5 game engines:

在寻找我自己的引擎时发现了这个问题。我只想在这里添加这个站点,因为它提供了对许多 HTML5 游戏引擎的很好的概述:

http://html5gameengine.com/

http://html5gameengine.com/

There are also some nice filters like licences/costs, release date and user rating.

还有一些不错的过滤器,如许可/成本、发布日期和用户评级。

(p.s.: I'm not related to this site in any way)

(ps:我与本网站没有任何关系)

回答by gamengineers

I agree with the others, there just isn't a standard, and there might not be for a while. Yet, I'm just starting out myself - and really digging the ThreeJS framework :

我同意其他人的看法,只是没有标准,而且可能暂时没有。然而,我才刚刚开始自己​​ - 并真正挖掘 ThreeJS 框架:

http://learningthreejs.com/https://github.com/mrdoob/three.js/

http://learningthreejs.com/https://github.com/mrdoob/three.js/

Sure, it's a WebGL 3D framework - but I suspect you can strip out the 3D elements to make it 2D? At least that's my hope as I dig into this world of WebGL - which could end up being the standard moving forward?*

当然,这是一个 WebGL 3D 框架 - 但我怀疑你可以去掉 3D 元素使其成为 2D 吗?至少在我深入这个 WebGL 世界时,这是我的希望——这可能最终成为向前发展的标准?*

What helps is relying on Chrome Canary for development! :) https://tools.google.com/dlpage/chromesxs

依靠 Chrome Canary 进行开发是有帮助的!:) https://tools.google.com/dlpage/chromesxs

If you're going this route - don't forget to set about:flags in Chrome, to enable "Override software rendering list" flag.

如果你要走这条路 - 不要忘记在 Chrome 中设置 about:flags,以启用“覆盖软件渲染列表”标志。

回答by Martin Drapeau

Backbone Game Engineis a 2d framework that was written on top of already popular and large community driven Backbone. Objects, inheritance, events, persistence and so forth come defacto with Backbone. The engine borrows from MelonJS with sprites (Backbone Models) that implement update and draw methods. Super Mario Bros Level 1-1 was written as an example. May be worth your time checking.

Backbone Game Engine是一个 2d 框架,它是在已经流行的大型社区驱动的 Backbone 之上编写的。对象、继承、事件、持久性等实际上是 Backbone 的。该引擎从 MelonJS 中借用了实现更新和绘制方法的精灵(主干模型)。以超级马里奥兄弟 1-1 级为例。可能值得您花时间检查。

回答by John Escobedo

"Essentially I am looking for the 'jQuery' of javascript game engines."

“本质上,我正在寻找 JavaScript 游戏引擎的 'jQuery'。”

http://gamequeryjs.com/

http://gamequeryjs.com/