是否可以在FaceBook中运行基于XMPP的PHP和Javascript多人网络游戏? [英] Is it possible to run XMPP based PHP and Javascript Multiplayer Network Game in FaceBook?

查看:134
本文介绍了是否可以在FaceBook中运行基于XMPP的PHP和Javascript多人网络游戏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先让我先介绍一下我的故事。为了在Facebook中开发一个多人网络游戏,Flash曾经是一个国王,但它消耗了大量的资源给客户,我觉得这不值得一个纸牌游戏。所以我来了一个想法,前端将使用Javascript(当然与jQuery)和后端与PHP。但是对于实时通信,仅仅使用PHP和Javascript是不可能的。记录玩家在MySQL中的每一个动作并显示回其他浏览器是没有意义的。所以我带着XMPP服务的想法。即使没有PHP,XMPP服务甚至可以将浏览器与浏览器进行通信,并使用Strophe和Javascript显示内容。



最后,我有一切我需要的工具,但我有几个问题,我无法回答自己。



1)XMPP服务器在PHP和Javascript之间如何工作?我需要从MySQL获取/发布用户记录,然后计算运动,然后将结果转发给预期用户。也会有一个身份验证系统,因此我没有错误地使用PHP。



2)这个问题是这个帖子的标题..是可以在FaceBook中运行基于XMPP的PHP和Javascript多人网络游戏?



提前感谢您的所有时间和建议!

解决方案

连接将使用PHP套接字工作,您可以轻松地使用Ajax将数据发送到PHP发送到XMPP服务器。还有一个图书馆数量用于使用PHP与XMPP服务器通信。对于Facebook,它不应该对您的脚本有任何影响 - 如果我记得Facebook正在自己的沙箱中运行您的应用程序,所以您不应该做任何特别的事情来绕过Facebook API。


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!

解决方案

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.

这篇关于是否可以在FaceBook中运行基于XMPP的PHP和Javascript多人网络游戏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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