davyxu / cellmesh Goto Github PK
View Code? Open in Web Editor NEWGame server framework based on cellnet
License: MIT License
Game server framework based on cellnet
License: MIT License
求继续维护呀
memsd 我的理解是个单点啊. 如果挂了. 整个集群不是都不可用了吗
按照搭建的教程里 运行client的时候碰到些问题 能帮忙看看吗 找不到agent
anic: AgentNotFound
goroutine 1 [running]:
main.login.func1(0xc000314030)
/Users/zhoumo/go/src/github.com/davyxu/cellmesh/demo/svc/client/main.go:52 +0x19d
reflect.Value.call(0x1465620, 0xc0001670a0, 0x13, 0x1518249, 0x4, 0xc0001abd80, 0x1, 0x1, 0x10a77fb, 0x3b9aca00, ...)
/usr/local/Cellar/go/1.11.2/libexec/src/reflect/value.go:447 +0x449
reflect.Value.Call(0x1465620, 0xc0001670a0, 0x13, 0xc0001abd80, 0x1, 0x1, 0xc0001ae120, 0x203000, 0x203000)
/usr/local/Cellar/go/1.11.2/libexec/src/reflect/value.go:308 +0xa4
main.RemoteCall(0x14fdbc0, 0xc00016c900, 0x14f6ee0, 0xc000169f80, 0x1465620, 0xc0001670a0, 0x0, 0x0)
/Users/zhoumo/go/src/github.com/davyxu/cellmesh/demo/svc/client/clientconn.go:202 +0x4f3
main.login(0xc0001abf48, 0x6, 0x0, 0x0, 0x1)
/Users/zhoumo/go/src/github.com/davyxu/cellmesh/demo/svc/client/main.go:42 +0x1fb
main.main()
/Users/zhoumo/go/src/github.com/davyxu/cellmesh/demo/svc/client/main.go:111 +0x119
游戏逻辑服务. 每个请求后, 玩家数据有缓存在本地吗? 如果有, 你用的是那个组件
请问有文档吗
有个小疑问,这个hub好像已经可以作为服务发现,然后consul或memsd一般作用用在哪里?
之前cellnet样例里是有protobuf消息的集成的,能否在cellmesh里也集成下。
我目前没有能力将消息定义文件*pp生成protobuf定义文件,采用的protobuf消息和json、binary消息分包的形式,然后改写了toos\protogen\gengo下
模板文件text.go
import (
"fmt"
"reflect"
"github.com/davyxu/cellnet"
"github.com/davyxu/cellnet/codec"
"github.com/davyxu/cellmesh/service"
{{if HasJsonCodec $}}_ "github.com/davyxu/cellnet/codec/json"{{end}}
{{if HasGogopbCodec $}}"github.com/davyxu/cellmesh/demo/proto/pb"{{end}}
)
...
{{range .Structs}}
{{ if StructCodecNotPb . }}
{{ObjectLeadingComment .}}
type {{.Name}} struct{ {{range .Fields}}
{{GoFieldName .}} {{GoTypeName .}} {{GoStructTag .}}{{FieldTrailingComment .}} {{end}}
}
{{end}}
{{end}}
{{range .Structs}}{{ if StructCodecNotPb . }}
func (self *{{.Name}}) String() string { return fmt.Sprintf("%+v",*self) } {{end}} {{end}}
...
{{ if StructCodecNotPb . }}
case *{{.Name}}:
Handle_{{ExportSymbolName $svcName}}_{{.Name}}(ev)
{{else}}
case *pb.{{.Name}}:
Handle_{{ExportSymbolName $svcName}}_{{.Name}}(ev)
{{end}}
...
func init() {
{{range $index, $ele := .Structs}} {{ if IsMessage $ele }}{{ if StructCodecNotPb $ele }}
cellnet.RegisterMessageMeta(&cellnet.MessageMeta{
Codec: codec.MustGetCodec("{{StructCodec $ele}}"),
Type: reflect.TypeOf((*{{$ele.Name}})(nil)).Elem(),
ID: {{StructMsgID $ele}},
})
{{end}} {{end}} {{end}}
}
func.go增加
FuncMap["StructCodecNotPb"] = func(d *model.Descriptor) bool {
if d.TagValueString("Codec") == "gogopb" {
return false
}else {
return true
}
}
FuncMap["HasGogopbCodec"] = func(ctx *gen.Context) bool {
for _, d := range ctx.Structs() {
if d.TagValueString("Codec") == "gogopb" {
return true
}
}
return true
}
主要是过滤掉编码为gogopb的消息,然后protobuf消息包写死成pb。 protobuf消息定义后,再在按*pp文件的路由规则写遍消息,目前感觉容易出错。
或者将路由规则和消息定义分库也好
示例中的注册路由
sh ./Gen.sh 压根就没这文件?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.