Files

36 lines
2.0 KiB
Protocol Buffer

syntax = "proto3";
package city;
message Rect { sint32 min_x = 1; sint32 min_y = 2; sint32 max_x = 3; sint32 max_y = 4; }
message Join { string room = 1; uint32 client_version = 2; string nickname = 3; }
message Subscribe { Rect rect = 1; uint32 lod = 2; }
message Ping { uint32 nonce = 1; }
message Propose { uint32 speed = 1; }
message Vote { bool yes = 1; }
message CreateCity { repeated double bbox = 1; string name = 2; uint32 seed = 3; }
message CityJob { string id = 1; string city_id = 2; string status = 3; string room_id = 4; string error = 5; string stage = 6; }
message ClientMessage {
reserved 6;
oneof body { Join join = 1; Subscribe subscribe = 2; Ping ping = 3; Propose propose = 4; Vote vote = 5; }
}
message Agent { uint32 id = 1; sint32 x = 2; sint32 y = 3; uint32 kind = 4; }
message Welcome { string room = 1; uint64 tick = 2; string city_manifest_url = 3; string session = 4; uint32 protocol_version = 5; }
message Snapshot { uint64 tick = 1; repeated Agent entities = 2; }
message Delta { uint64 tick = 1; repeated Agent spawned = 2; repeated Agent changed = 3; repeated uint32 despawned = 4; }
message Error { string code = 1; string message = 2; }
message VoteState { bool active = 1; uint32 speed = 2; uint32 yes = 3; uint32 players = 4; uint32 remaining_seconds = 5; }
message Clock { uint64 tick = 1; double game_seconds = 2; uint32 speed = 3; }
message ServerMessage {
reserved 8;
oneof body { Welcome welcome = 1; Snapshot snapshot = 2; Delta delta = 3; Error error = 4; Ping pong = 5; VoteState vote_state = 6; Clock clock = 7; }
}
message SavedAgent { uint32 id = 1; uint32 route = 2; double distance = 3; }
message Route { repeated sint32 xy = 1; string home_id = 2; string workplace_id = 3; }
message RoomSave {
uint32 version = 1; string id = 2; string city_id = 3; uint32 city_version = 4;
uint64 tick = 5; uint64 seed = 6; double game_seconds = 7; uint32 speed = 8;
repeated SavedAgent agents = 9; repeated Route routes = 10;
string city_revision = 11;
reserved 12; // Retired city-wide economy in snapshot v2.
}