Update protocol buffers with tick synchronization
This commit is contained in:
parent
f91f72c05d
commit
8290131998
@ -131,28 +131,29 @@ func (x *Action) GetPlayerId() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
type ServerMessage struct {
|
||||
type ActionBatch struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
PlayerId int32 `protobuf:"varint,1,opt,name=player_id,json=playerId,proto3" json:"player_id,omitempty"` // Only used when initially assigning player ID
|
||||
Players []*PlayerState `protobuf:"bytes,2,rep,name=players,proto3" json:"players,omitempty"` // Player state updates
|
||||
PlayerId int32 `protobuf:"varint,1,opt,name=player_id,json=playerId,proto3" json:"player_id,omitempty"`
|
||||
Actions []*Action `protobuf:"bytes,2,rep,name=actions,proto3" json:"actions,omitempty"`
|
||||
Tick int64 `protobuf:"varint,3,opt,name=tick,proto3" json:"tick,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ServerMessage) Reset() {
|
||||
*x = ServerMessage{}
|
||||
func (x *ActionBatch) Reset() {
|
||||
*x = ActionBatch{}
|
||||
mi := &file_actions_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ServerMessage) String() string {
|
||||
func (x *ActionBatch) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ServerMessage) ProtoMessage() {}
|
||||
func (*ActionBatch) ProtoMessage() {}
|
||||
|
||||
func (x *ServerMessage) ProtoReflect() protoreflect.Message {
|
||||
func (x *ActionBatch) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_actions_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@ -164,25 +165,32 @@ func (x *ServerMessage) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ServerMessage.ProtoReflect.Descriptor instead.
|
||||
func (*ServerMessage) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use ActionBatch.ProtoReflect.Descriptor instead.
|
||||
func (*ActionBatch) Descriptor() ([]byte, []int) {
|
||||
return file_actions_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *ServerMessage) GetPlayerId() int32 {
|
||||
func (x *ActionBatch) GetPlayerId() int32 {
|
||||
if x != nil {
|
||||
return x.PlayerId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ServerMessage) GetPlayers() []*PlayerState {
|
||||
func (x *ActionBatch) GetActions() []*Action {
|
||||
if x != nil {
|
||||
return x.Players
|
||||
return x.Actions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ActionBatch) GetTick() int64 {
|
||||
if x != nil {
|
||||
return x.Tick
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type PlayerState struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
PlayerId int32 `protobuf:"varint,1,opt,name=player_id,json=playerId,proto3" json:"player_id,omitempty"`
|
||||
@ -243,6 +251,66 @@ func (x *PlayerState) GetY() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
type ServerMessage struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
PlayerId int32 `protobuf:"varint,1,opt,name=player_id,json=playerId,proto3" json:"player_id,omitempty"`
|
||||
Players []*PlayerState `protobuf:"bytes,2,rep,name=players,proto3" json:"players,omitempty"`
|
||||
CurrentTick int64 `protobuf:"varint,3,opt,name=current_tick,json=currentTick,proto3" json:"current_tick,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ServerMessage) Reset() {
|
||||
*x = ServerMessage{}
|
||||
mi := &file_actions_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ServerMessage) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ServerMessage) ProtoMessage() {}
|
||||
|
||||
func (x *ServerMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_actions_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ServerMessage.ProtoReflect.Descriptor instead.
|
||||
func (*ServerMessage) Descriptor() ([]byte, []int) {
|
||||
return file_actions_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *ServerMessage) GetPlayerId() int32 {
|
||||
if x != nil {
|
||||
return x.PlayerId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ServerMessage) GetPlayers() []*PlayerState {
|
||||
if x != nil {
|
||||
return x.Players
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ServerMessage) GetCurrentTick() int64 {
|
||||
if x != nil {
|
||||
return x.CurrentTick
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_actions_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_actions_proto_rawDesc = []byte{
|
||||
@ -256,20 +324,29 @@ var file_actions_proto_rawDesc = []byte{
|
||||
0x1b, 0x0a, 0x09, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x22, 0x16, 0x0a, 0x0a,
|
||||
0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x4d, 0x4f,
|
||||
0x56, 0x45, 0x10, 0x00, 0x22, 0x5c, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f,
|
||||
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72,
|
||||
0x49, 0x64, 0x12, 0x2e, 0x0a, 0x07, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20,
|
||||
0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x50, 0x6c,
|
||||
0x61, 0x79, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x07, 0x70, 0x6c, 0x61, 0x79, 0x65,
|
||||
0x72, 0x73, 0x22, 0x46, 0x0a, 0x0b, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74,
|
||||
0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x12, 0x0c,
|
||||
0x0a, 0x01, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01,
|
||||
0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69,
|
||||
0x74, 0x65, 0x61, 0x2e, 0x62, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x62, 0x65, 0x2f, 0x62, 0x64, 0x6e,
|
||||
0x75, 0x67, 0x67, 0x65, 0x74, 0x2f, 0x67, 0x6f, 0x6f, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||
0x2f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x56, 0x45, 0x10, 0x00, 0x22, 0x69, 0x0a, 0x0b, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x61,
|
||||
0x74, 0x63, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x69, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64,
|
||||
0x12, 0x29, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28,
|
||||
0x0b, 0x32, 0x0f, 0x2e, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x41, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x52, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x74,
|
||||
0x69, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x74, 0x69, 0x63, 0x6b, 0x22,
|
||||
0x46, 0x0a, 0x0b, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1b,
|
||||
0x0a, 0x09, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x49, 0x64, 0x12, 0x0c, 0x0a, 0x01, 0x78,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x01, 0x79, 0x22, 0x7f, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x65,
|
||||
0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x6c, 0x61, 0x79,
|
||||
0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x6c, 0x61,
|
||||
0x79, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x07, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73,
|
||||
0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73,
|
||||
0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x07, 0x70, 0x6c,
|
||||
0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74,
|
||||
0x5f, 0x74, 0x69, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x75, 0x72,
|
||||
0x72, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x63, 0x6b, 0x42, 0x2c, 0x5a, 0x2a, 0x67, 0x69, 0x74, 0x65,
|
||||
0x61, 0x2e, 0x62, 0x6f, 0x6e, 0x65, 0x72, 0x2e, 0x62, 0x65, 0x2f, 0x62, 0x64, 0x6e, 0x75, 0x67,
|
||||
0x67, 0x65, 0x74, 0x2f, 0x67, 0x6f, 0x6f, 0x6e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x61,
|
||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -285,21 +362,23 @@ func file_actions_proto_rawDescGZIP() []byte {
|
||||
}
|
||||
|
||||
var file_actions_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_actions_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_actions_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_actions_proto_goTypes = []any{
|
||||
(Action_ActionType)(0), // 0: actions.Action.ActionType
|
||||
(*Action)(nil), // 1: actions.Action
|
||||
(*ServerMessage)(nil), // 2: actions.ServerMessage
|
||||
(*ActionBatch)(nil), // 2: actions.ActionBatch
|
||||
(*PlayerState)(nil), // 3: actions.PlayerState
|
||||
(*ServerMessage)(nil), // 4: actions.ServerMessage
|
||||
}
|
||||
var file_actions_proto_depIdxs = []int32{
|
||||
0, // 0: actions.Action.type:type_name -> actions.Action.ActionType
|
||||
3, // 1: actions.ServerMessage.players:type_name -> actions.PlayerState
|
||||
2, // [2:2] is the sub-list for method output_type
|
||||
2, // [2:2] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
1, // 1: actions.ActionBatch.actions:type_name -> actions.Action
|
||||
3, // 2: actions.ServerMessage.players:type_name -> actions.PlayerState
|
||||
3, // [3:3] is the sub-list for method output_type
|
||||
3, // [3:3] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_actions_proto_init() }
|
||||
@ -313,7 +392,7 @@ func file_actions_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_actions_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 3,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
@ -15,9 +15,10 @@ message Action {
|
||||
int32 player_id = 4;
|
||||
}
|
||||
|
||||
message ServerMessage {
|
||||
int32 player_id = 1; // Only used when initially assigning player ID
|
||||
repeated PlayerState players = 2; // Player state updates
|
||||
message ActionBatch {
|
||||
int32 player_id = 1;
|
||||
repeated Action actions = 2;
|
||||
int64 tick = 3;
|
||||
}
|
||||
|
||||
message PlayerState {
|
||||
@ -25,3 +26,9 @@ message PlayerState {
|
||||
int32 x = 2;
|
||||
int32 y = 3;
|
||||
}
|
||||
|
||||
message ServerMessage {
|
||||
int32 player_id = 1;
|
||||
repeated PlayerState players = 2;
|
||||
int64 current_tick = 3;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user