
ProtoBuf
lin_0205
这个作者很懒,什么都没留下…
展开
-
ET中的ProtoBuf
基于大神的范例https://github.com/Maomao110/StarForceGF做客户端,ET做服务端通信流程1、服务端启动,创建TCPService://Program.cs 添加外网消息组件Game.Scene.AddComponent<NetOuterComponent, string>(outerConfig.Address);//Net...原创 2020-02-07 17:31:36 · 614 阅读 · 0 评论 -
ProtoBuf之Varint编码
Varint编码tag与FieldNumber、WireType转换:(field_number << 3) | wire_type当tag在1-15,tag只需要1个字节表示,最高位第1个bit表示msb且为0,后7个bit:前4个bit表示FieldNumber,后3个bit表示WireType当tag大于等于16,tag需要多于1个字节表示,低位第1个字节的第1个bi...原创 2020-02-07 17:31:26 · 574 阅读 · 0 评论 -
Proto2与Proto3区别
使用 syntax = "proto3" 指定proto3,否则编译器会假定为proto2 proto3字段默认为singular,不需要显式添加 proto3移除required,proto2也不推荐使用required proto3 repeated默认设置[packed = true],proto2需要显式设置 proto2可以使用default指定字段默认值,proto3移除def...原创 2020-02-07 17:30:54 · 1588 阅读 · 0 评论 -
ProtoBuf笔记
Filed Number:范围 1- 2^29 - 1(536,870,911)排除19000 - 19999(供ProtoBuf内部使用) 用于数据保存时,同一个message中某些字段被删除,如果新增字段使用相同的Filed Number,会和已被删除的字段的Filed Number重复,使用reserved避免此问题 message Foo { reserved 2,...原创 2020-02-07 17:30:18 · 309 阅读 · 0 评论