Giter Club home page Giter Club logo

node-pinus / pinus Goto Github PK

View Code? Open in Web Editor NEW
1.8K 1.8K 367.0 10.76 MB

A fast,scalable,distributed game server framework for Node.js, Powered by TypeScript. 一个TypeScript写的node.js分布式游戏/应用服务器框架(原型基于pomelo)。

Home Page: https://pinus.io

License: MIT License

JavaScript 68.51% TypeScript 21.31% Batchfile 0.01% Shell 0.04% Makefile 0.03% CSS 3.76% HTML 0.58% Ruby 0.09% SCSS 5.68%
game-server nodejs typescript

pinus's People

Contributors

billyplus avatar bruce48x avatar chaseray1989 avatar cisen avatar cqszhuangyang avatar daqiuqu avatar dependabot[bot] avatar dunadain avatar gajin2 avatar guozihong avatar jimmyrice avatar mybios avatar qinfanheaven avatar renovate-bot avatar s8642795130 avatar seeluck avatar whtiehack avatar wjt382063576 avatar yhchen avatar zdstu avatar zengmax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pinus's Issues

启动时报错Cannot read property 'id' of undefined

Caught exception: TypeError: Cannot read property 'id' of undefined
    at processArgs (/Users/husong/WebstormProjects/work/PinusTest/game-server/node_modules/pinus/lib/util/appUtil.ts:201:46)
    at Object.defaultConfiguration (/Users/husong/WebstormProjects/work/PinusTest/game-server/node_modules/pinus/lib/util/appUtil.ts:25:5)
    at Application.init (/Users/husong/WebstormProjects/work/PinusTest/game-server/node_modules/pinus/lib/application.ts:186:17)
    at Pinus.createApp (/Users/husong/WebstormProjects/work/PinusTest/game-server/node_modules/pinus/lib/pinus.ts:139:13)
    at Object.<anonymous> (/Users/husong/WebstormProjects/work/PinusTest/game-server/app.ts:14:17)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
    at startup (internal/bootstrap/node.js:201:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)

貌似是app.getMaster()是undefined

运行事例报错gate-server-1Caught exception: TypeError: ParserIncomingMessage is not a constructor

[2018-10-26T13:40:41.282] [WARN] pinus - [master-server-1 watchdog.js] all servers startup in 405 ms

[2018-10-26T13:40:41.287] [INFO] logger - [master-server-1 console] Started Robot Master Http server on : http://localhost:8776

[2018-10-26T13:40:41.285] [WARN] logger - [connector-server-1 console] after start all server, use route dictionary :
chat.chatHandler.send
connector.entryHandler.enter
connector.entryHandler.onUserLeave
gate.gateHandler.queryEntry

[2018-10-26 13:41:41] INFO: Nodes: 0, WebClients: 0

[2018-10-26T13:42:21.274] [ERROR] logger - [gate-server-1 console] gate-server-1Caught exception: TypeError: ParserIncomingMessage is not a constructor
at HTTPParser.parserOnHeadersComplete (_http_common.js:81:21)
at socketOnData (_http_server.js:470:20)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at WSProcessor.add (/Users/disunits/Downloads/pinus-master/examples/websocket-chat/game-server/node_modules/pinus/lib/connectors/hybrid/wsprocessor.ts:44:20)
at HybridSwitcher.processHttp (/Users/disunits/Downloads/pinus-master/examples/websocket-chat/game-server/node_modules/pinus/lib/connectors/hybrid/switcher.ts:120:19)
at Socket.socket.once (/Users/disunits/Downloads/pinus-master/examples/websocket-chat/game-server/node_modules/pinus/lib/connectors/hybrid/switcher.ts:99:22)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:601:20)Error
at Object.pLogger.(anonymous function) [as error] (/Users/disunits/Downloads/pinus-master/examples/websocket-chat/game-server/node_modules/pinus-logger/lib/logger.ts:59:34)
at process. (/Users/disunits/Downloads/pinus-master/examples/websocket-chat/game-server/preload.ts:33:17)
at emitOne (events.js:116:13)
at process.emit (events.js:211:7)
at process._fatalException (bootstrap_node.js:391:26)

TypeError: utils.promisify is not a function

Caught exception: TypeError: utils.promisify is not a function
at new Application (D:\Workspaces\Code\pinus\HelloWorld\game-server\node_modules\pinus\lib\application.ts:1132:20)
at Pinus.createApp (D:\Workspaces\Code\pinus\HelloWorld\game-server\node_modules\pinus\lib\pinus.ts:138:19)
at Object. (D:\Workspaces\Code\pinus\HelloWorld\game-server\app.ts:14:17)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:383:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:496:3

新建的HelloWorld报错,不知为何

安装pinus出错

#:npn i -d -g pinus

npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm http fetch GET 304 https://registry.npm.taobao.org/pinus 217ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/@types%2fmocha 85ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/node-bignumber 62ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/mkdirp 187ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/cliff 189ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/@types%2fsocket.io 191ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/commander 195ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/eyes 202ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/mqtt-connection 201ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/crc 206ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/pinus-admin 71ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/pinus-loader 68ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/pinus-logger 71ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/pinus-protocol 66ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/pinus-protobuf 73ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/pinus-rpc 69ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/async 277ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/pinus-scheduler 73ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/seq-queue 76ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/socket.io 71ms (from cache)
npm http fetch GET 304 https://registry.npm.taobao.org/ws 58ms (from cache)
npm ERR! code 128
npm ERR! Command failed: /usr/bin/git clone -q https://github.com/node-pinus/types-mqtt-connection.git /root/.npm/_cacache/tmp/git-clone-dd44d631
npm ERR! fatal:不能为'/root/.npm/_cacache/tmp/git-clone-dd44d631' :创建先导目录:权限不够
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-03-28T11_36_25_568Z-debug.log

关于pinus的几点疑问

本人是非常想学习了解新的服务器端的框架的,不过看到这个框架,有好多Pomelo的影子,所以忍不住想问几句:

  1. 开发者说是基于Pomelo的TS版本,还修改了一些bug和优化的地方, 请问能否详细列出来,否则我们不敢用(毕竟修改bug的过程中,也会有几率制造出新的bug)
  2. 说实话,看着pinus说是pinus, 里面还有pomelo的用法,感觉有些许的别扭,就像是没有断了奶的孩子,还在使用父母的东西。让人感觉 这就是个TS语言改过来的Pomelo. 好感没有太多
  3. 不知其他人是否有其他意见

其他语言插件?

有规划其他语言如C++,Lua之类的客户端插件或是demo吗?或者是如UE4,CE5等其他引擎的插件?

服务端提示这个错误,这是什么原因

[2018-08-06T11:01:34.237] [ERROR] pinus-admin - [gate-server-1 mqttClient.js] mqtt rpc client checkKeepAlive error timeout for 120000Error
at Object.pLogger.(anonymous function) [as error] (D:\gameServer\pinus\wolong-0804\wolong\game-server\node_modules\pinus-logger\lib\logger.ts:59:34)
at MqttClient.checkKeepAlive(D:\gameServer\pinus\wolong0804\wolong\gameserver\node_modules
\pinus-admin\lib\protocol\mqtt\mqttClient.ts:221:28)
at Timeout._onTimeout (D:\gameServer\pinus\wolong0804\wolong\gameserver\node_modules\pinus-admin\lib\protocol\mqtt\mqttClient.ts:207:18)
at ontimeout (timers.js:498:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:290:5)

HandlerCallback问题

HandlerCallback里的err定义是不是有问题啊 原来 pomelo 里 next('err', { code: 500002 }); 这种写法 现在怎么写

初看和Pomelo很相似

初看和Pomelo很相似,不知道比Pomelo好在哪 ? 消息通讯这一块是否有改进 ? RPC还是用的Pomelo那一套吗 ?

egret pinus

请问有人用pinus做后端,egret做前端的游戏demo吗?现在不知道怎么在egret里面连接pinus来返回数据

Handler继承后不能自动加入Route Dictionary

基类 BaseHandler

export default BaseHandler {
protected app: Application;
constructor(app: Application) {
this.app = app;
}
async who(msg, session) {
return {myname:this.constructor.name};
}
}

子类 MyHandler

export default function(app) {return new MyHandler(app);}
export class MyHandler extends BaseHandler {
constructor(app: Application) {
super(app);
}
async myMethod(msg,session) {
return {msg:'this is my method'};
}
}

结果

启动时只过滤出了myMethod,who的方法没过滤出来

期望

myMethod和who都能过滤出来

单独启动的游戏服务,可以自动加入到集群,但是尝试进入游戏报错fail to forward message:TypeError: Cannot read property 'msgRemote' of undefined

用pomelo start -e production -d . 命令启动了一个gate,两个connector,2个游戏。 之后用NODE_ENV=production node app.js host="127.0.0.1" port=6950 frontend=false serverType="game3" id="game3-server-1" 命令启动了另一个游戏。
master发现了这个游戏“master watchdog notify to monitor success, id: game3-server-1 ........”。
game3也收到相关信息“game3-server-1 receive replaceServer signal: {"action":"replaceServer","servers":{"scheduleJ.............”。
但是无法从大厅进入游戏,报错“fail to forward message:TypeError: Cannot read property 'msgRemote' of undefined”
请问:是哪里配置不对吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.