2020-06-12 22:51:18 +01:00
|
|
|
syntax = "proto3";
|
|
|
|
|
2020-06-13 13:38:12 +01:00
|
|
|
// Rove
|
|
|
|
//
|
2020-07-10 00:26:49 +01:00
|
|
|
// Rove is an asychronous nomadic game about exploring a planet as part of a
|
|
|
|
// loose community
|
2020-07-10 18:01:35 +01:00
|
|
|
package roveapi;
|
2020-07-10 19:00:31 +01:00
|
|
|
option go_package = "github.com/mdiluz/rove/proto/roveapi";
|
2020-06-13 00:23:21 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// The Rove server hosts a single game session and world with multiple players
|
2020-06-13 10:43:35 +01:00
|
|
|
service Rove {
|
2020-07-10 00:26:49 +01:00
|
|
|
// Server status
|
|
|
|
// Responds with various details about the current server status
|
|
|
|
rpc ServerStatus(ServerStatusRequest) returns (ServerStatusResponse) {}
|
|
|
|
|
|
|
|
// Register an account
|
|
|
|
// Tries to register an account with the given name
|
|
|
|
rpc Register(RegisterRequest) returns (RegisterResponse) {}
|
|
|
|
|
|
|
|
// Send commands to rover
|
|
|
|
// Sending commands to this endpoint will queue them to be executed during the
|
|
|
|
// following ticks, in the order sent. Commands sent within the same tick will
|
|
|
|
// overwrite until the tick has finished and the commands are queued
|
|
|
|
rpc Command(CommandRequest) returns (CommandResponse) {}
|
|
|
|
|
|
|
|
// Get radar information
|
|
|
|
// Gets the radar output for the given rover
|
|
|
|
rpc Radar(RadarRequest) returns (RadarResponse) {}
|
|
|
|
|
|
|
|
// Get rover information
|
|
|
|
// Gets information for the account's rover
|
|
|
|
rpc Status(StatusRequest) returns (StatusResponse) {}
|
2020-07-10 00:12:54 +01:00
|
|
|
}
|
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
//
|
|
|
|
// ServerStatus
|
|
|
|
//
|
2020-06-12 22:51:18 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// ServerStatusRequest is an empty placeholder
|
|
|
|
message ServerStatusRequest {}
|
2020-06-12 22:51:18 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// ServerStatusResponse is a response with useful server information
|
|
|
|
message ServerStatusResponse {
|
|
|
|
// The version of the server in v{major}.{minor}-{delta}-{sha} form
|
|
|
|
string version = 1;
|
2020-06-13 11:57:27 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// Whether the server is ready to accept requests
|
|
|
|
bool ready = 2;
|
2020-06-12 22:51:18 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// The tick rate of the server in minutes (how many minutes per tick)
|
|
|
|
int32 tickRate = 3;
|
|
|
|
|
|
|
|
// The current tick of the server
|
|
|
|
int32 currentTick = 4;
|
2020-06-13 11:57:27 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// The time the next tick will occur
|
|
|
|
string next_tick = 5;
|
2020-06-12 22:51:18 +01:00
|
|
|
}
|
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
//
|
|
|
|
// Register
|
|
|
|
//
|
|
|
|
|
|
|
|
// RegisterRequest contains data to register an account
|
|
|
|
message RegisterRequest {
|
|
|
|
// The desired account name
|
|
|
|
string name = 1;
|
2020-06-12 22:51:18 +01:00
|
|
|
}
|
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// Account describes a registered account
|
|
|
|
message Account {
|
|
|
|
// The account name
|
|
|
|
string name = 1;
|
2020-06-12 22:51:18 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// The account secret value, given when creating the account
|
|
|
|
string secret = 2;
|
|
|
|
}
|
2020-07-03 17:00:04 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// RegisterResponse is the response given to registering an account
|
|
|
|
message RegisterResponse {
|
|
|
|
// The registered account information
|
|
|
|
Account account = 1;
|
2020-06-12 22:51:18 +01:00
|
|
|
}
|
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
//
|
|
|
|
// Command
|
|
|
|
//
|
|
|
|
|
|
|
|
// CommandType defines the type of a command to give to the rover
|
|
|
|
enum CommandType {
|
|
|
|
none = 0;
|
2020-07-21 22:48:16 +01:00
|
|
|
// Toggles the sails, either catching the wind, or charging from the sun
|
|
|
|
toggle = 1;
|
2020-07-21 23:12:50 +01:00
|
|
|
// Turns the rover in the specified bearing, requires data
|
|
|
|
turn = 2;
|
2020-07-10 00:26:49 +01:00
|
|
|
// Stashes item at current location in rover inventory
|
2020-07-21 23:12:50 +01:00
|
|
|
stash = 3;
|
2020-07-10 00:26:49 +01:00
|
|
|
// Repairs the rover using an inventory object
|
2020-07-21 23:12:50 +01:00
|
|
|
repair = 4;
|
|
|
|
// Broadcasts a message to nearby rovers, requires data
|
|
|
|
broadcast = 5;
|
2020-06-12 22:51:18 +01:00
|
|
|
}
|
|
|
|
|
2020-07-21 22:58:59 +01:00
|
|
|
// Bearing represents a compass direction
|
2020-07-19 12:54:41 +01:00
|
|
|
enum Bearing {
|
|
|
|
// BearingUnknown an unknown invalid bearing
|
|
|
|
BearingUnknown = 0;
|
|
|
|
North = 1;
|
2020-07-21 22:58:59 +01:00
|
|
|
NorthEast = 2;
|
|
|
|
East = 3;
|
|
|
|
SouthEast = 4;
|
|
|
|
South = 5;
|
|
|
|
SouthWest = 6;
|
|
|
|
West = 7;
|
|
|
|
NorthWest = 8;
|
2020-07-19 12:54:41 +01:00
|
|
|
}
|
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// Command is a single command for a rover
|
|
|
|
message Command {
|
|
|
|
// The command type
|
|
|
|
CommandType command = 1;
|
|
|
|
|
2020-07-21 23:52:14 +01:00
|
|
|
// A simple message, must be composed of printable ASCII glyphs (32-126)
|
|
|
|
// maximum of three characters
|
|
|
|
bytes broadcast = 2;
|
|
|
|
|
|
|
|
// The bearing for the rover to turn to
|
|
|
|
Bearing turn = 3;
|
2020-07-07 22:20:23 +01:00
|
|
|
}
|
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// CommandRequest describes a set of commands to be requested for the rover
|
|
|
|
message CommandRequest {
|
|
|
|
// The account to execute these commands
|
|
|
|
Account account = 1;
|
|
|
|
|
|
|
|
// The set of desired commands
|
|
|
|
repeated Command commands = 2;
|
2020-06-12 22:51:18 +01:00
|
|
|
}
|
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// CommandResponse is an empty placeholder
|
|
|
|
message CommandResponse {}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Radar
|
|
|
|
//
|
2020-07-09 19:01:09 +01:00
|
|
|
|
2020-07-19 12:26:57 +01:00
|
|
|
// Types of objects
|
|
|
|
enum Object {
|
2020-07-19 12:37:36 +01:00
|
|
|
// ObjectUnknown represents no object at all
|
|
|
|
ObjectUnknown = 0;
|
2020-07-19 12:26:57 +01:00
|
|
|
|
2020-07-19 12:37:36 +01:00
|
|
|
// RoverLive represents a live rover
|
|
|
|
RoverLive = 1;
|
2020-07-19 12:26:57 +01:00
|
|
|
|
2020-07-19 13:27:38 +01:00
|
|
|
// RoverDormant describes a dormant rover
|
2020-07-19 13:27:59 +01:00
|
|
|
RoverDormant = 2;
|
2020-07-19 13:27:38 +01:00
|
|
|
|
2020-07-19 12:37:36 +01:00
|
|
|
// RockSmall is a small stashable rock
|
2020-07-19 13:27:59 +01:00
|
|
|
RockSmall = 3;
|
2020-07-19 12:26:57 +01:00
|
|
|
|
2020-07-19 12:37:36 +01:00
|
|
|
// RockLarge is a large blocking rock
|
2020-07-19 13:27:59 +01:00
|
|
|
RockLarge = 4;
|
2020-07-19 12:26:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
enum Tile {
|
2020-07-19 12:37:36 +01:00
|
|
|
// TileUnknown is a keyword for nothing
|
|
|
|
TileUnknown = 0;
|
2020-07-19 12:26:57 +01:00
|
|
|
|
2020-07-19 12:37:36 +01:00
|
|
|
// Rock is solid rock ground
|
|
|
|
Rock = 1;
|
2020-07-19 12:26:57 +01:00
|
|
|
|
2020-07-19 12:37:36 +01:00
|
|
|
// Gravel is loose rocks
|
|
|
|
Gravel = 2;
|
2020-07-19 12:26:57 +01:00
|
|
|
|
2020-07-19 12:37:36 +01:00
|
|
|
// Sand is sand
|
|
|
|
Sand = 3;
|
2020-07-19 12:26:57 +01:00
|
|
|
}
|
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// RadarRequest is the data needed to request the radar for a rover
|
|
|
|
message RadarRequest {
|
|
|
|
// The account for this request
|
|
|
|
Account account = 1;
|
2020-07-09 19:01:09 +01:00
|
|
|
}
|
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// RadarResponse describes radar information
|
|
|
|
message RadarResponse {
|
|
|
|
// The range in tiles from the rover of the radar data
|
|
|
|
int32 range = 1;
|
2020-06-12 22:51:18 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// A 1D array representing range*2 + 1 squared set of tiles, origin bottom
|
|
|
|
// left and in row->column order
|
2020-07-19 12:26:57 +01:00
|
|
|
repeated Tile tiles = 2;
|
2020-06-12 22:51:18 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// A similar array to the tile array, but containing objects
|
2020-07-19 12:26:57 +01:00
|
|
|
repeated Object objects = 3;
|
2020-07-10 00:26:49 +01:00
|
|
|
}
|
2020-06-26 23:44:52 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
//
|
|
|
|
// Status
|
|
|
|
//
|
2020-06-27 01:14:17 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// StatusRequest is information needed to request rover status
|
|
|
|
message StatusRequest {
|
|
|
|
// The account for this request
|
|
|
|
Account account = 1;
|
|
|
|
}
|
2020-07-04 12:01:35 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// Log is a single log item
|
|
|
|
message Log {
|
|
|
|
// The unix timestamp of the log
|
|
|
|
string time = 1;
|
2020-07-04 12:19:51 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// The text of the log
|
|
|
|
string text = 2;
|
|
|
|
}
|
2020-07-04 12:25:15 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// Vector describes a point or vector in 2D space
|
|
|
|
message Vector {
|
|
|
|
int32 x = 1;
|
|
|
|
int32 y = 2;
|
|
|
|
}
|
2020-07-04 12:25:15 +01:00
|
|
|
|
2020-07-21 23:12:50 +01:00
|
|
|
// SailPosition represents the position of the sola sail
|
|
|
|
enum SailPosition {
|
|
|
|
UnknownSailPosition = 0;
|
|
|
|
|
|
|
|
// CatchingWind means the sail is catching the wind and moving the rover
|
|
|
|
CatchingWind = 1;
|
|
|
|
|
|
|
|
// SolarCharging means the sail is facing the sun and charging
|
|
|
|
SolarCharging = 2;
|
|
|
|
}
|
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// StatusResponse is the response given to a status request
|
|
|
|
message StatusResponse {
|
|
|
|
// The name of the rover
|
|
|
|
string name = 1;
|
2020-07-05 13:16:08 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// Position of the rover in world coordinates
|
|
|
|
Vector position = 2;
|
2020-07-05 13:16:08 +01:00
|
|
|
|
2020-07-21 23:12:50 +01:00
|
|
|
// The current direction of the rover
|
|
|
|
Bearing bearing = 3;
|
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// The range of this rover's radar and broadcasting
|
2020-07-21 23:12:50 +01:00
|
|
|
int32 range = 4;
|
2020-07-09 19:01:09 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// The items in the rover inventory
|
2020-07-21 23:12:50 +01:00
|
|
|
bytes inventory = 5;
|
2020-06-12 22:51:18 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// The capacity of the inventory
|
2020-07-21 23:12:50 +01:00
|
|
|
int32 capacity = 6;
|
2020-06-13 11:57:27 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// The current health of the rover
|
2020-07-21 23:12:50 +01:00
|
|
|
int32 integrity = 7;
|
2020-06-12 22:51:18 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// The maximum health of the rover
|
2020-07-21 23:12:50 +01:00
|
|
|
int32 maximumIntegrity = 8;
|
2020-06-12 22:51:18 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// The energy stored in the rover
|
2020-07-21 23:12:50 +01:00
|
|
|
int32 charge = 9;
|
2020-06-12 22:51:18 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// The max energy the rover can store
|
2020-07-21 23:12:50 +01:00
|
|
|
int32 maximumCharge = 10;
|
|
|
|
|
|
|
|
// The current position of the sails
|
|
|
|
SailPosition sailPosition = 11;
|
2020-07-07 18:40:38 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// The set of currently queued commands
|
2020-07-23 00:13:28 +01:00
|
|
|
repeated Command queuedCommands = 12;
|
2020-07-07 22:20:23 +01:00
|
|
|
|
2020-07-10 00:26:49 +01:00
|
|
|
// The most recent logs
|
2020-07-23 00:13:28 +01:00
|
|
|
repeated Log logs = 13;
|
2020-07-22 23:36:13 +01:00
|
|
|
|
|
|
|
// The current wind direction
|
2020-07-23 00:13:28 +01:00
|
|
|
Bearing wind = 14;
|
2020-06-12 22:51:18 +01:00
|
|
|
}
|