Skip to main content

PixiJS 不是什么


虽然 PixiJS 可以做很多事情,但有些事情它不能做,或者需要额外的工具才能完成。 PixiJS 的新手常常很难确定 PixiJS 可以解决哪些任务,以及哪些需要外部解决方案。 如果你即将开始一个项目,了解 PixiJS 是否适合你的需求会很有帮助。 下面的列表显然是不完整的 - 例如,PixiJS 也不是动态 - 但它包括许多你可能期望我们支持的常见任务或功能。

英:While PixiJS can do many things, there are things it can't do, or that require additional tools to accomplish. Newcomers to PixiJS often struggle to identify which tasks PixiJS can solve, and which require outside solutions. If you're about to start a project, it can be helpful to know if PixiJS is a good fit for your needs. The following list is obviously incomplete - PixiJS is also not, for example, a duck - but it includes many common tasks or features that you might expect us to support.

PixiJS 不是框架

PixiJS 是一个渲染引擎,它支持使用渲染引擎时通常需要的附加功能,例如交互管理。 但它不是像 Unity 或 Phaser 这样的框架。 框架旨在完成构建游戏时需要做的所有事情 - 用户设置管理、音乐播放、对象脚本、艺术管道管理...... 这样的例子不胜枚举。 PixiJS 旨在真正做好一件事 - 渲染图形内容。 这让我们能够专注于跟上新技术,并使 PixiJS 的下载速度变得非常快。

英:PixiJS is a rendering engine, and it supports additional features such as interaction management that are commonly needed when using a render engine. But it is not a framework like Unity or Phaser. Frameworks are designed to do all the things you'd need to do when building a game - user settings management, music playback, object scripting, art pipeline management... the list goes on. PixiJS is designed to do one thing really well - render graphical content. This lets us focus on keeping up with new technology, and makes downloading PixiJS blazingly fast.

3D 渲染器

PixiJS 是为 2D 构建的。 平台游戏、冒险游戏、互动广告、自定义数据可视化...... 都好。 但如果你想渲染 3D 模型,你可能需要查看 babylon.jsthree.js

英:PixiJS is built for 2D. Platformers, adventure games, interactive ads, custom data visualization... all good. But if you want to render 3D models, you might want to check out babylon.js or three.js.

移动应用

如果你想构建手机游戏,可以使用 PixiJS 来完成,但如果你想访问原生绑定,则需要使用像 Apache 科尔多瓦 这样的部署系统。 我们不提供对相机、定位服务、通知等的访问。

英:If you're looking to build mobile games, you can do it with PixiJS, but you'll need to use a deployment system like Apache Cordova if you want access to native bindings. We don't provide access to the camera, location services, notifications, etc.

UI 库

构建真正通用的 UI 系统是一项巨大的挑战,任何使用过 Unity UI 工具的人都可以证明这一点。 我们选择避免复杂性,以忠于我们对速度的核心关注。 虽然你当然可以使用 PixiJS 的场景图和交互管理器构建自己的 UI,但我们并未附带现成的 UI 库。

英:Building a truly generic UI system is a huge challenge, as anyone who has worked with Unity's UI tools can attest. We've chosen to avoid the complexity to stay true to our core focus on speed. While you can certainly build your own UI using PixiJS's scene graph and interaction manager, we don't ship with a UI library out of the box.

数据存储

你可以使用许多技巧和技术来存储设置、分数和其他数据。 Cookie、Web 存储、基于服务器的存储... 有许多解决方案,每种方案都有优点和缺点。 你可以将它们中的任何一个与 PixiJS 一起使用,但我们不提供这样做的工具。

英:There are many techniques and technologies that you can use to store settings, scores, and other data. Cookies, Web Storage, server-based storage... there are many solutions, each with advantages and disadvantages. You can use any of them with PixiJS, but we don't provide tools to do so.

音频库

至少,不是开箱即用的。 同样,网络音频技术是一个不断发展的挑战,许多浏览器的规则和要求不断变化。 有许多专用的网络音频库(例如 Howler.js 可以与 PixiJS 一起使用来播放音效和音乐。或者,PixiJS 声音插件 被设计为与 PixiJS 很好地配合使用。

英:At least, not out of the box. Again, web audio technology is a constantly evolving challenge, with constantly changing rules and requirements across many browsers. There are a number of dedicated web audio libraries (such as Howler.js that can be used with PixiJS to play sound effects and music. Alternatively, the PixiJS Sound plugin is designed to work well with PixiJS.

开发环境

有许多工具可用于构建 2D 艺术和游戏,你可能希望它们成为 PixiJS 的一部分,但我们是渲染引擎,而不是开发环境。 打包精灵表、处理图片、构建 mipmap 或 Retina-ready 精灵 - 对于此类工具有很棒的独立工具。 在整个指南中,我们将在适当的情况下向你指出可能有用的工具。

英:There are a number of tools that are useful for building 2D art and games that you might expect to be a part of PixiJS, but we're a rendering engine, not a development environment. Packing sprite sheets, processing images, building mipmaps or Retina-ready sprites - there are great standalone tools for this type of tooling. Where appropriate throughout the guides, we'll point you to tools that may be useful.

PixiJS 适合我吗?

只有你知道! 如果你正在为你的下一个基于 Web 的项目寻找一个高度专注、快速且高效的渲染引擎,那么 PixiJS 可能是你的最佳选择。

英:Only you know! If you're looking for a tightly focused, fast and efficient rendering engine for your next web-based project, PixiJS is likely a great fit.

如果你需要一个完整的游戏开发框架,具有原生绑定和丰富的 UI 库,你可能需要探索其他选项。

英:If you need a full game development framework, with native bindings and a rich UI library, you may want to explore other options.

或者你可能不会。 构建项目所需的完整框架的子集比消化带有不需要的花哨功能的整体 API 更快、更容易。 有数百个复杂、丰富的游戏和视觉项目使用 PixiJS 进行渲染,并使用插件或自定义代码来添加 UI 和声音效果。 两种方法都有好处。 无论如何,我们希望你能够更好地了解 PixiJS 可以(和不能!)为你的项目提供什么。

英:Or you may not. It can be faster and easier to build just the subset of a full framework that your project needs than it can be to digest a monolithic API with bells and whistles you don't need. There are hundreds of complex, rich games and visual projects that use PixiJS for rendering, with plugins or custom code to add the UI and sound effects. There are benefits to both approaches. Regardless, we hope you have a better feel for what PixiJS can (and cannot!) offer your project.