Code Monkey home page Code Monkey logo

cellmesh's People

Contributors

davyxu avatar egamesir 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

cellmesh's Issues

你好我是新手学习中碰到些问题

按照搭建的教程里 运行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一般作用用在哪里?

关于cellmesh里集成gogopb消息的建议

之前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文件的路由规则写遍消息,目前感觉容易出错。

或者将路由规则和消息定义分库也好

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.