Skip to content

Instantly share code, notes, and snippets.

@nulldatamap
Created June 20, 2014 13:51
Show Gist options
  • Select an option

  • Save nulldatamap/10e8a920783b6a69fb99 to your computer and use it in GitHub Desktop.

Select an option

Save nulldatamap/10e8a920783b6a69fb99 to your computer and use it in GitHub Desktop.
// control.proto
package protocols;
option java_package = "io.nulldata.protocols";
option java_outer_classname = "ControlProtos";
message Handshake {
optional int32 magic = 1; [default = D0961]
optional int32 version = 2; [default = 0]
optional string token = 3;
}
enum Id {
// Control Id's
ERROR = 0;
OKAY = 1;
PING = 2;
KILL = 3;
// Game Id's
PLAYER_JOIN = 0x10;
PLAYER_MESSAGE = 0x11;
PLAYER_DISCONNECT = 0x12;
}
// Id: 0
message Error {
required ErrorId error_id = 1;
optional string error_msg = 2;
}
// Id: 1
message Okay {
}
// Id: 2
message Ping {
required int32 data = 1;
}
// Id: 3
message Kill {
optional string reason = 1;
}
message Header {
required Id id = 1;
required int32 length = 2;
}
// event.proto
package protocols;
option java_package = "io.nulldata.protocols";
option java_outer_classname = "EventProtos";
// Id: 0x10
message PlayerJoin {
required string name = 1;
required int32 id = 2;
}
// Id: 0x11
message PlayerMessage {
required int32 id = 1;
required string msg = 2;
}
// Id: 0x12
message PlayerDisconnect {
required int32 id = 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment