This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#代码组织 | |
---------- | |
主要包括: 后端服务器代码game-server和web-server. game-server是游戏socket服务端, 包括所有的游戏逻辑代码. web-server是游戏web服务器, 负责用户注册,第三方平台接入等相关逻辑. | |
除了这两部分之外, 还有一个公用的shared目录, 用来存放两者共用的代码和配置. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 运行环境 | |
* [nodejs](http://nodejs.org/) | |
* Windows、Linux 或 MacOS 操作系统 | |
* MySql 数据库 | |
# 部署服务端 | |
## 下载源码 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
服务器的启动流程采用了Pomelo中的启动模式. 在阅读下面内容前, 请先阅读[pomelo启动流程](https://github.com/NetEase/pomelo/wiki/pomelo%E5%90%AF%E5%8A%A8%E6%B5%81%E7%A8%8B). | |
app.js是服务器的入口, 主要负责所有服务器的配置, 以及组件的加载和启动. 服务器的启动主要分为两步:启动master服务器, 再由master服务器分别启动其他服务器. | |
服务器启动时还会加载hall的配置文件, 用来建立游戏大厅和服务器之间的映射: | |
``` javascript | |
// 载入大厅的配置 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 相关依赖包 | |
* [mocha](https://github.com/mochajs/mocha) | |
* [should](https://github.com/tj/should.js) | |
* [rewire](https://github.com/jhnns/rewire) | |
* [blanket](https://github.com/alex-seville/blanket) | |
# 第一步 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TESTS = $(shell find test -type f -name "*.test.js") | |
REPORTER = spec | |
TIMEOUT = 80000 | |
MOCHA_OPTS = | |
test: | |
@NODE_ENV=test /usr/local/bin/mocha \ | |
--reporter $(REPORTER) \ | |
--timeout $(TIMEOUT) \ | |
$(MOCHA_OPTS) \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 运行环境 | |
* [nodejs](http://nodejs.org/) | |
* Linux 或 MacOS 操作系统 | |
# 部署 | |
### 下载源码 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: 我的任务 | |
date: 2015-11-16 16:07:43 | |
categories: [avhievement, task,游戏开发] | |
tags: [avhievement, task,游戏开发] | |
--- | |
# 任务/成就系统 | |
游戏中任务/成就系统是必不可少的,如何实现一个成就系统? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#如何使用visual stdio code编写TypeScript | |
---- | |
## 运行环境 | |
* [nodejs](http://nodejs.org/) | |
* Windows、Linux 或 MacOS 操作系统 | |
* [visual studio code](https://code.visualstudio.com/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#在tornado中使用异步mysql操作 | |
>在使用tornado框架进行开发的过程中,发现tornado的mysql数据库操作并不是一步的,造成了所有用户行为的堵塞.tornado本身是一个异步的框架,要求所有的操作都应该是异步的,但是数据库这一层就把整个服务器都拖住了. | |
##查找到的解决办法: | |
1. 使用异步的mysql操作库. 查找了一下,有两个比较完善的异步操作库 | |
一个是[AsyncTorndb](https://github.com/mayflaver/AsyncTorndb),国人自己写的异步操作,看了一下,好像不错的样子,但是没有响应的测试用例,不敢用. | |
一个是[Tornado-MySQL](https://github.com/PyMySQL/Tornado-MySQL)是对PyMySQL的异步化的一个库,测试用例,文档,都比较齐全,可以尝试使用. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##leanCloud介绍 | |
官网:[leancloud](https://leancloud.cn/) | |
LeanCloud 是国内的移动应用一站式云服务。 | |
LeanCloud提供了数据存储、实时消息、统计分析以及多种扩展组件,全面涵盖移动应用开发的需求,支持 iOS、Android、Web 等多平台。 | |
它帮助开发者摆脱后端开发负担以专注于产品创新,同时缩短开发周期、节省开发投入、快速进入市场。 | |
---- | |
很久之前看到baas的相关介绍,感觉自己要失业了,知道现在才有机会试用一下leancloud |
OlderNewer