是否可以在 Facebook 上运行基于 XMPP 的 PHP 和 Javascript 多人网络游戏?

发布于 2024-09-02 10:08:46 字数 517 浏览 0 评论 0原文

我先介绍一下我的故事。在facebook上开发一款多人网络游戏,flash曾经是王者,但它对客户端的资源消耗很大,我觉得对于一个卡牌游戏来说不值得。所以我想到前端将使用 Javascript(当然使用 jQuery)而后端使用 PHP。但对于实时通信,仅仅使用 PHP 和 Javascript 是不可能的。在MySQL中记录玩家的每一个动作并显示回另一个浏览器是没有意义的。因此我想到了 XMPP 服务。 XMPP 服务甚至可以在浏览器之间进行通信,并使用 Strope 和 Javascript 显示内容,甚至无需使用 PHP。

最后,我已经拥有了所需的所有工具,但我有一些自己无法回答的问题。

1)XMPP服务器如何在PHP和Javascript之间工作?我需要从 MySQL 获取/发布用户记录并计算移动,然后将结果转发给目标用户。还会有一个身份验证系统,因此将由 PHP 负责,因为我没有错。

2)这个问题是这篇文章的标题。是否可以在FaceBook中运行基于XMPP的PHP和Javascript多人网络游戏?

预先感谢您的所有时间和建议!

let me introduce my story first. To develop a multiplayer network game in facebook, flash used to be a king but it consumes a lot of resources for client and I feel like it isn't worth for a card game. So I come with an idea that front-end will use Javascript (of course with jQuery) and backend with PHP. But for real-time communication, it isn't possible just with PHP and Javascript. It doesn't make sense to record every movement of players in MySQL and display back to another browsers. So I come with an idea with XMPP Services. XMPP services can even communicate browser to browser and display contents with Strophe and Javascript even without with PHP.

Finally, I've got every tools I need but I have few questions that I can't answer myself.

1) How XMPP server work between PHP and Javascript? I need to get/post user records from MySQL and calculate movements then forward results to intended user. There will be an Authentication system too so that's gonna be taken care by PHP as I'm not wrong.

2) This question is the title of this post.. Is it possible to run XMPP based PHP and Javascript Multiplayer Network Game in FaceBook?

Thanks in advance for all of your time and advices!

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

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

发布评论

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

评论(1

冬天旳寂寞 2024-09-09 10:08:46

该连接可以使用 PHP 套接字进行工作,并且您可以轻松地使用 Ajax 将数据发送到 PHP,然后再发送到 XMPP 服务器。还有一些库用于使用 PHP 与 XMPP 服务器进行通信。至于 Facebook,它不应该对你的脚本产生任何影响 - 如果我没记错的话 Facebook 在它自己的沙箱中运行你的应用程序,所以你不需要做任何特殊的事情来绕过 Facebook API。

The connection would work using PHP sockets, and you could easily use Ajax to send data to PHP to send on to the XMPP server. There are also a number of libraries for communicating with XMPP servers using PHP. As for Facebook, it shouldn't have any effect on your script - if I remember correctly Facebook runs your app in its own sandbox so you shouldn't have to do anything special to get around the Facebook API.

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