Skip to content

Instantly share code, notes, and snippets.

Created December 20, 2012 14:58
Show Gist options
  • Save anonymous/4345739 to your computer and use it in GitHub Desktop.
Save anonymous/4345739 to your computer and use it in GitHub Desktop.
Match Stick Man Game Network Protocol Defined in Thrift 0.9.0, for syntax: http://thrift.apache.org/
# Match Stick Man Game Network Protocol
# Defined in Thrift 0.9.0, for syntax: http://thrift.apache.org/
#Common
struct CommonResponse{
1: i16 ret, # 0=OK
2: string errmsg # ""=OK
}
struct Position{
1: i16 x,
2: i16 y
}
enum PropType{
NONE = 0,
FIRE = 1,
ICE = 2,
BOMB = 3,
PROTECT = 4
}
enum PlayerStatus{
NONE = 0,
FINISHED = 1,
}
struct PlayerGameInfo{
1: required string uid,
2: required Position position,
3: optional PropType propType,
4: optional string time, # position time
5: optional PlayerStatus status
}
# Join Game
struct JoinGameRequest{
1: string uid,
2: string mapName,
3: string nowTime
}
struct JoinGameResponse{
1: CommonResponse com,
2: i16 roomNumber,
3: string startTime,
4: list<string> players
}
# Game is on
struct SyncGameInfoRequest{
1: required PlayerGameInfo playerInfo,
2: required i16 propCount, # logical timestamp for opponents' props using counts, start from 0
}
struct SyncGameInfoResponse{
1: required CommonResponse com,
2: optional list<PlayerGameInfo> players,
3: optional i16 propCount,
4: optinnal bool isFinish # true=finish received
}
# Game is over
struct GameOverRequest{
1: required string uid,
}
struct GameOverResponse{
1: required bool isOver, # all finished
2: list<PlayerGameInfo> players
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment