我可以使用Lance制作多人相位游戏吗? [英] Can I make a multiplayer Phaser game using Lance?

查看:109
本文介绍了我可以使用Lance制作多人相位游戏吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将现有的 Phaser 游戏制作为多人游戏?

How do I take an existing Phaser game and make it multiplayer?

我可以为此目的使用 Lance 库吗?这两个库都控制着自己的游戏对象,所以我不知道如何在同一个游戏中一起使用这两个框架.

Can I use the Lance library for this purpose? Both libraries control their own game objects so I don't know how to use the two frameworks together in the same game.

推荐答案

免责声明:我是兰斯

不幸的是,Phaser的2. *体系结构使得很难与Lance配对来制作实时Javascript多人游戏.

Unfortunately, Phaser's 2.* architecture makes it hard to pair with Lance to make Realtime Javascript Multiplayer games.

问题在于,Phaser做出了许多假设,这些假设不适用于多人游戏设置.例如,渲染和游戏循环捆绑在一起.服务器显然不需要渲染任何东西.

The issue is that Phaser makes a lot of assumptions that don't hold for a multiplayer setting. For example, the rendering and game loop are tied together. The server, obviously doesn't need to render anything.

Phaser还假定服务器上不存在DOM和window对象.另外,保存世界游戏状态对象,子画面等的所有数据结构都保存在扩展实例PIXI对象上,而这些实例在Server上下文中是没有意义的.这些限制和紧密耦合与Lance的模块化方法不兼容.

Phaser also assumes the existence of the DOM and the window object which also don't exist on the server. In addition, all of the data structures that hold the world game state objects, sprites, etc' are saved on an extended instances PIXI objects which don't make sense in a Server context. These limitations and tight-coupling aren't compatible with Lance's modular approach.

使用 JSDOM 节点画布,但这确实意味着通过在服务器上运行PIXI会大大降低性能,并且您还存在同步PIXI数据结构以应对的问题.

It is entirely possible to run Phaser on the server using libraries that emulate DOM and Canvas like JSDOM and Node Canvas however it does mean that there's a significant performance degradation by running PIXI on the server, and you also still have the problem of syncing PIXI data structures to contend with.

好消息是, Phaser 3.0是一个正在进行的,完整的重写希望采用更具模块化方式的Phaser 2.0可以使与Lance的集成变得更加容易.我们计划在不久的将来使这种集成变得更加容易.

The good news is that Phaser 3.0 is an ongoing, complete rewrite of Phaser 2.0 in a much more modular approach will hopefully make it much easier to integrate with Lance. We have plans to make this integration easier ourselves in the near future.

这篇关于我可以使用Lance制作多人相位游戏吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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