网易开源游戏服务器框架-Pomelo实践

来源:互联网 发布:面纱3.0口感数据 编辑:程序博客网 时间:2024/05/16 15:29

http://blog.csdn.net/puncha/article/details/12871289


Pomelo是网易开发的一款开源游戏服务器框架,出了做游戏的服务器端,他也可以作为一个高效的网站后台。网址是:http://pomelo.netease.com

其实,他官方的文档是中文的,照理说,我不用再写博客记录下详细的操作步骤了,但是发现里面还是有一些错误的,所以。。。还是要记录点东西。


1. 安装:参考https://github.com/NetEase/pomelo/wiki/%E5%AE%89%E8%A3%85pomelo

>npm install pemolo -g

他宣传是支持windows平台的,但是我在windows下没有安装成功,试了几次,放弃了!转而使用在线的Linux平台:Nitrous.IO(https://www.nitrous.io/join/9MeRMIpjv-w),安装成功。

2. 新建项目:参考https://github.com/NetEase/pomelo/wiki/pomelo%E7%9A%84HelloWorld

>pemelo init ./HelloWorld

>cd HelloWorld

>sh npm-install.sh

3. 启动:参考https://github.com/NetEase/pomelo/wiki/pomelo%E7%9A%84HelloWorld

>cd game-server

>pemelo start

>cd ../web-server

>node app

注意,这里官方文档有错误!把两个目录名都写成了game-server!

4. 测试:参考https://github.com/NetEase/pomelo/wiki/pomelo%E7%9A%84HelloWorld

启动服务之后,应该就能访问网址了:http://gamestarter-42725.apne1.actionbox.io:3001/

他网站服务器监听的是3001端口,而game服务器监听的应该是3010端口。

点击“Test Game Server”按钮照理应该会出现Game Server OK,但是实际情况是不会!为什么,因为他的网页里面写死了localhost,而我是托管在NItrous.IO上的,所以需要该一下,打开"./web-server/index.html", 把host = "gamestarter-42725.apne1.actionbox.io";改到就OK了。


阅读全文
0 0
原创粉丝点击