Skip to content

API documentation 0.1.0

Jeffrey Jones edited this page Nov 17, 2021 · 2 revisions

Protocol Documentation

Atmosphere

https://wiki.hoggitworld.com/view/DCS_singleton_atmosphere

Method Name Request Type Response Type Description
GetWind GetWindRequest GetWindResponse https://wiki.hoggitworld.com/view/DCS_func_getWind
GetWindWithTurbulence GetWindWithTurbulenceRequest GetWindWithTurbulenceResponse https://wiki.hoggitworld.com/view/DCS_func_getWindWithTurbulence
GetTemperatureAndPressure GetTemperatureAndPressureRequest GetTemperatureAndPressureResponse https://wiki.hoggitworld.com/view/DCS_func_getWindWithTurbulence

Coalitions

https://wiki.hoggitworld.com/view/DCS_singleton_coalition

Method Name Request Type Response Type Description
GetPlayers GetPlayersRequest GetPlayersResponse https://wiki.hoggitworld.com/view/DCS_func_getPlayers
GetGroups GetGroupsRequest GetGroupsResponse https://wiki.hoggitworld.com/view/DCS_func_getGroups

Controllers

Method Name Request Type Response Type Description
SetAlarmState SetAlarmStateRequest EmptyResponse https://wiki.hoggitworld.com/view/DCS_option_alarmState

Custom

The Custom service is for APIs that do not map to the "standard library" of DCS APIs provided by Eagle Dynamics.

Expect to find APIs here that may be useful for mission frameworks etc.

Method Name Request Type Response Type Description
RequestMissionAssignment MissionAssignmentRequest MissionAssignmentResponse DCT Function
JoinMission MissionJoinRequest MissionJoinResponse DCT Function
Eval EvalRequest EvalResponse Evaluate some Lua inside of the mission and return the result as a JSON string. Disabled by default.

Groups

https://wiki.hoggitworld.com/view/DCS_Class_Group

Method Name Request Type Response Type Description
GetUnits group.GetUnitsRequest group.GetUnitsResponse https://wiki.hoggitworld.com/view/DCS_func_getUnits

Hook

APis that are part of the hook environment

Method Name Request Type Response Type Description
GetMissionName hook.GetMissionNameRequest hook.GetMissionNameResponse https://wiki.hoggitworld.com/view/DCS_func_getMissionName
StreamChat hook.StreamChatRequest hook.ChatMessage stream Stream all chat messages.

Mission

Contains the streaming APIs that streaming information out of the DCS server.

Method Name Request Type Response Type Description
StreamEvents StreamEventsRequest Event stream Streams DCS game generated Events. See https://wiki.hoggitworld.com/view/Category:Events
StreamUnits StreamUnitsRequest UnitUpdate stream Streams unit updates Provides similar functionality as Tacview but at a much lower update rate so puts less load on the server. Suitable for things like online maps but not as a Tacview replacement.

Timer

https://wiki.hoggitworld.com/view/DCS_singleton_timer

Method Name Request Type Response Type Description
GetTime GetTimeRequest GetTimeResponse https://wiki.hoggitworld.com/view/DCS_func_getTime
GetAbsoluteTime GetAbsoluteTimeRequest GetAbsoluteTimeResponse https://wiki.hoggitworld.com/view/DCS_func_getAbsTime
GetTimeZero GetTimeZeroRequest GetTimeZeroResponse https://wiki.hoggitworld.com/view/DCS_func_getTime0

Triggers

https://wiki.hoggitworld.com/view/DCS_singleton_trigger

Method Name Request Type Response Type Description
OutText OutTextRequest EmptyResponse https://wiki.hoggitworld.com/view/DCS_func_outText
OutTextForCoalition OutTextForCoalitionRequest EmptyResponse https://wiki.hoggitworld.com/view/DCS_func_outTextForCoalition
OutTextForGroup OutTextForGroupRequest EmptyResponse https://wiki.hoggitworld.com/view/DCS_func_outTextForGroup
GetUserFlag GetUserFlagRequest GetUserFlagResponse https://wiki.hoggitworld.com/view/DCS_func_getUserFlag
SetUserFlag SetUserFlagRequest EmptyResponse https://wiki.hoggitworld.com/view/DCS_func_setUserFlag
MarkToAll MarkToAllRequest MarkToAllResponse https://wiki.hoggitworld.com/view/DCS_func_markToAll
MarkToCoalition MarkToCoalitionRequest MarkToCoalitionResponse https://wiki.hoggitworld.com/view/DCS_func_markToCoalition
MarkToGroup MarkToGroupRequest MarkToGroupResponse https://wiki.hoggitworld.com/view/DCS_func_markToGroup
RemoveMark RemoveMarkRequest EmptyResponse https://wiki.hoggitworld.com/view/DCS_func_removeMark
Explosion ExplosionRequest EmptyResponse https://wiki.hoggitworld.com/view/DCS_func_explosion
Smoke SmokeRequest EmptyResponse https://wiki.hoggitworld.com/view/DCS_func_smoke
IlluminationBomb IlluminationBombRequest EmptyResponse https://wiki.hoggitworld.com/view/DCS_func_illuminationBomb
SignalFlare SignalFlareRequest EmptyResponse https://wiki.hoggitworld.com/view/DCS_func_signalFlare

Units

https://wiki.hoggitworld.com/view/DCS_Class_Unit

Method Name Request Type Response Type Description
GetRadar GetRadarRequest GetRadarResponse https://wiki.hoggitworld.com/view/DCS_func_getRadar
GetPosition GetUnitPositionRequest GetUnitPositionResponse https://wiki.hoggitworld.com/view/DCS_func_getPoint
GetPlayerName GetUnitPlayerNameRequest GetUnitPlayerNameResponse https://wiki.hoggitworld.com/view/DCS_func_getPlayerName
GetUnitDescriptor GetUnitDescriptorRequest GetUnitDescriptorResponse

World

https://wiki.hoggitworld.com/view/DCS_singleton_world

Method Name Request Type Response Type Description
GetAirbases GetAirbasesRequest GetAirbasesResponse https://wiki.hoggitworld.com/view/DCS_func_getAirbases
GetMarkPanels GetMarkPanelsRequest GetMarkPanelsResponse https://wiki.hoggitworld.com/view/DCS_func_getMarkPanels

Top

atmosphere.proto

GetTemperatureAndPressureRequest

Field Type Label Description
position Position The position on the map we want the wind information for. Requires lat/lon/alt fields to be populated, there are no default values

GetTemperatureAndPressureResponse

Field Type Label Description
temperature float The temperature in Kelvin
pressure float The pressure in Pascals

GetWindRequest

Field Type Label Description
position Position The position on the map we want the wind information for. Requires lat/lon/alt fields to be populated, there are no default values

GetWindResponse

Field Type Label Description
heading float The heading the wind is coming from.
strength float The strength of the wind in meters per second

GetWindWithTurbulenceRequest

Field Type Label Description
position Position The position on the map we want the wind information for. Requires lat/lon/alt fields to be populated, there are no default values

GetWindWithTurbulenceResponse

Field Type Label Description
heading float The heading the wind is coming from.
strength float The strength of the wind in meters per second

Top

coalitions.proto

GetGroupsRequest

Field Type Label Description
coalition Coalition
category group.GroupCategory optional

GetGroupsResponse

Field Type Label Description
groups Group repeated

GetPlayersRequest

Field Type Label Description
coalition Coalition

GetPlayersResponse

Field Type Label Description
units Unit repeated

Top

common.proto

Airbase

An instance of a DCS Airfield

Field Type Label Description
id uint32 optional The DCS generated ID. Only used when the airfield is also a unit (e.g. an Aicraft Carrier)
name string TODO: Fill this in
callsign string TODO: Fill this in
coalition Coalition The coalition the unit belongs to. This can change mid-mission if an airfield is captured
position Position The position of the center point of the airfield.
category AirbaseCategory What category the airfield belongs to.
display_name string TODO: Fill this in

Cargo

EmptyResponse

A generic empty response

A generic empty response used in APIs that do not return any values to the client

Group

An instance of a DCS group

Field Type Label Description
id uint32 The DCS generated ID
name string The name of the group as assigned in the mission editor

Initiator

Field Type Label Description
unknown Unknown
unit Unit
weapon Weapon
static Static
scenery Scenery
airbase Airbase
cargo Cargo

MarkPanel

Field Type Label Description
id uint32
time double I have no idea what this time value means
initiator Unit
coalition Coalition optional
group_id uint32 optional
text string optional
position Position

Position

Position of an object in DCS

Latitude and Longitude are in Decimal Degrees format (e.g. 41.33 / 37.21). Negative values are used for West of the meridian and south of the equator

Altitude is given in meters above Mean Sea Level (MSL) and can be a decimal value.

Field Type Label Description
lat double Latitude in Decimal Degrees format
lon double Longitude in Decimal Degrees format
alt double Altitude in Meters above Mean Sea Level (MSL)

Scenery

Static

Target

Field Type Label Description
unknown Unknown
unit Unit
weapon Weapon
static Static
scenery Scenery
airbase Airbase
cargo Cargo

Unit

An instance of a DCS Unit

A unit is an "active" unit in a DCS mission. This means it has an attached AI that moves and shoots. Units include aircraft, ground units, ships, weapons etc.

Field Type Label Description
id uint32 The DCS generated ID
name string The name of the unit as assigned in the mission editor
callsign string The DCS assigned callsign if one exists. e.g. "Enfield 11"
coalition Coalition The coalition the unit belongs to
type string The DCS type-name of the unit. e.g "MiG-29A", "ZSU_57_2" or "Hawk ln"
position Position The position of the unit
player_name string optional The name of the player if one is in control of the unit
group_name string The name of the group that the unit belongs to
number_in_group uint32 The number of this unit in the group. Does not change as units are destroyed
speed double The horizontal speed of the unit. If it is doing mach one straight up then the speed will be 0
heading double The heading of the unit

Unknown

This type is returned if an object category cannot be determined

The base object includes the getName() function so even for an unknown type we should be able to get the name

Field Type Label Description
name string

Weapon

An instance of a DCS weapon

These weapons include everything from autocannon HE shells up to massive ship-killer missiles

Field Type Label Description
id uint32 The DCS generated ID
type string The DCS type-name of the weapon. e.g "Matra_S530D", "HAWK_RAKETA" or "weapons.shells.53-UOR-281U"
position Position The position of the Weapon

AirbaseCategory

The category the object belongs to

Some of these are less than obvious. For example an oilrig counts as a HELIPAD airfield.

Name Number Description
AIRDROME 0
HELIPAD 1
SHIP 2

Coalition

Coalitions in DCS

The coalitions supported by DCS. The NEUTRAL coalition is a relatively new one and may not be as supported as the belligerant ones.

Name Number Description
NEUTRAL 0
RED 1
BLUE 2

ObjectCategory

The category the object belongs to

All DCS objects are one of the following categories. DCS itself does not use the UNKNOWN enum value but we use it in GRPC as a fallback in case of issues determining the category.

See https://wiki.hoggitworld.com/view/DCS_Class_Object for more information

Name Number Description
UNKNOWN 0
UNIT 1
WEAPON 2
STATIC 3
SCENERY 4
BASE 5
CARGO 6

Top

controllers.proto

SetAlarmStateRequest

Field Type Label Description
group_name string
unit_name string
alarm_state SetAlarmStateRequest.AlarmState

SetAlarmStateRequest.AlarmState

Name Number Description
AUTO 0
GREEN 1
RED 2

Top

custom.proto

EvalRequest

Field Type Label Description
lua string

EvalResponse

Field Type Label Description
json string

MissionAssignmentRequest

Field Type Label Description
unit_name string
mission_type string

MissionAssignmentResponse

MissionJoinRequest

Field Type Label Description
unit_name string
mission_code int32

MissionJoinResponse

Top

group.proto

GetUnitsRequest

Field Type Label Description
group_name string
active bool optional Whether the response should include only active units (true), only inactive units (false), or all units (nil).

GetUnitsResponse

Field Type Label Description
units dcs.Unit repeated

GroupCategory

Name Number Description
AIRPLANE 0
HELICOPTER 1
GROUND 2
SHIP 3
TRAIN 4

Top

hook.proto

ChatMessage

Field Type Label Description
player_id uint32 The ID of the player sending the chat messaage.
message string The chat message.
all bool Whether the message was send to all or only to allies.

GetMissionNameRequest

GetMissionNameResponse

Field Type Label Description
name string

StreamChatRequest

Top

mission.proto

Event

The DCS Event information. Contains event information and a timestamp.

Field Type Label Description
time double The event's mission time.
shot Event.ShotEvent
hit Event.HitEvent
takeoff Event.TakeoffEvent
land Event.LandEvent
crash Event.CrashEvent
ejection Event.EjectionEvent
refueling Event.RefuelingEvent
dead Event.DeadEvent
pilot_dead Event.PilotDeadEvent
base_capture Event.BaseCaptureEvent
mission_start Event.MissionStartEvent
mission_end Event.MissionEndEvent
refueling_stop Event.RefuelingStopEvent
birth Event.BirthEvent
human_failure Event.HumanFailureEvent
detailedFailure Event.DetailedFailureEvent
engine_startup Event.EngineStartupEvent
engine_shutdown Event.EngineShutdownEvent
player_enter_unit Event.PlayerEnterUnitEvent
player_leave_unit Event.PlayerLeaveUnitEvent
shooting_start Event.ShootingStartEvent
shooting_end Event.ShootingEndEvent
mark_add Event.MarkAddEvent
mark_change Event.MarkChangeEvent
mark_remove Event.MarkRemoveEvent
kill Event.KillEvent
score Event.ScoreEvent
unit_lost Event.UnitLostEvent
landingAfterEjection Event.LandingAfterEjectionEvent
discardChairAfterEjection Event.DiscardChairAfterEjectionEvent
weapon_add Event.WeaponAddEvent
landing_quality_mark Event.LandingQualityMarkEvent

Event.BaseCaptureEvent

Occurs when a ground unit captures either an airbase or a farp.

Field Type Label Description
initiator Initiator The object that captured the base.
place Airbase The airbase that was captured, can be a FARP or Airbase

Event.BirthEvent

Occurs when any object is spawned into the mission.

Field Type Label Description
initiator Initiator The object that was spawned.
place Airbase optional The airbase, farp or ship the unit took off from.

Event.CrashEvent

Occurs when an aircraft crashes into the ground and is completely destroyed.

Field Type Label Description
initiator Initiator The object that crashed.

Event.DeadEvent

Occurs when an object is completely destroyed.

Field Type Label Description
initiator Initiator The object that has been destroyed.

Event.DetailedFailureEvent

Occurs when a system on an aircraft fails. This can be due to damage or due to random failures set up in the mission editor.

Field Type Label Description
target Target The target the failure occurred for.

Event.DiscardChairAfterEjectionEvent

A pilot detached from their ejection seat.

Field Type Label Description
initiator Initiator The ejection seat.
target Target The pilot.

Event.EjectionEvent

Occurs when a pilot ejects from its aircraft.

Field Type Label Description
initiator Initiator The unit a pilot ejected from.
target Target The ejection seat.

Event.EngineShutdownEvent

Field Type Label Description
initiator Initiator Occurs when any aircraft shuts down its engines.
place Airbase The airbase, farp or ship the unit shut down their engine at.

Event.EngineStartupEvent

Occurs when any aircraft starts its engines.

Field Type Label Description
initiator Initiator The object that starts its engines.
place Airbase The airbase, farp or ship the unit started their engine at.

Event.HitEvent

Occurs when an object is hit by a weapon.

Field Type Label Description
initiator Initiator optional The object that fired the weapon. Not set when for example fyling an aircraft into a building (building will be the target and weapon_name the name of the aircraft).
weapon Weapon The weapon that the target has been hit with.
target Target The object that has been hit.
weapon_name string The weapon the target got hit by.

Event.HumanFailureEvent

Occurs e.g. when a player controlled aircraft blacks out.

Field Type Label Description
initiator Initiator The unit the system failure occurred in.

Event.KillEvent

Occurs when an object is killed by a weapon.

Field Type Label Description
initiator Initiator The object that fired the weapon.
weapon Weapon The weapon that the target has been killed with.
target Target The object that has been killed.
weapon_name string The name of the weapon that killed the target (exists instead of weapon for weapons that trigger the shooting start and end events).

Event.LandEvent

Occurs when an aircraft lands at an airbase, farp or ship.

Field Type Label Description
initiator Initiator The object that landed.
place Airbase The airbase, farp or ship the unit landed at.

Event.LandingAfterEjectionEvent

A pilot detached from their ejection seat.

Field Type Label Description
initiator Initiator The ejected pilot.
place Position The position the pilot landed at.

Event.LandingQualityMarkEvent

Occurs when an aircraft receives an LSO rating after recovering on an aircraft carrier.

Field Type Label Description
initiator Initiator The aircraft that received the rating.
comment string The rating.

Event.MarkAddEvent

Occurs when marks get added to the mission by players or scripting functions.

Field Type Label Description
initiator Initiator The object that added the mark.
group_id uint64 The group the mark's visibility is restricted for.
coalition Coalition The coalition the mark's visibility is restricted for.
id uint32 The mark's id.
pos Position The position the mark has been added at.
text string The mark's label.

Event.MarkChangeEvent

Occurs when marks got changed.

Field Type Label Description
initiator Initiator The object that changed the mark.
group_id uint64 The group the mark's visibility is restricted for.
coalition Coalition The coalition the mark's visibility is restricted for.
id uint32 The mark's id.
pos Position The position of the changed mark.
text string The mark's label.

Event.MarkRemoveEvent

Occurs when marks get removed.

Field Type Label Description
initiator Initiator The object that removed the mark.
group_id uint64 The group the mark's visibility is restricted for.
coalition Coalition The coalition the mark's visibility is restricted for.
id uint32 The mark's id.
pos Position The position the mark has been removed from.
text string The mark's label.

Event.MissionEndEvent

Occurs when the mission stops.

Event.MissionStartEvent

Occurs when the mission starts.

Event.PilotDeadEvent

Occurs when a pilot of an aircraft is killed. Can occur either if the player is alive and crashes (in this case both this and the [CrashEvent] event will be fired) or if a weapon kills the pilot without completely destroying the plane.

Field Type Label Description
initiator Initiator The unit the pilot has died in.

Event.PlayerEnterUnitEvent

Occurs when a player takes direct control of a unit.

Field Type Label Description
initiator Initiator The unit the player took control of.

Event.PlayerLeaveUnitEvent

Occurs when a player relieves direct control of a unit.

Field Type Label Description
initiator Initiator The unit the player relieves control of.

Event.RefuelingEvent

Occurs when an aircraft connects with a tanker and begins taking on fuel.

Field Type Label Description
initiator Initiator The object that is receiving fuel.

Event.RefuelingStopEvent

Occurs when an aircraft is finished taking fuel.

Field Type Label Description
initiator Initiator he unit that was receiving fuel.

Event.ScoreEvent

A score change (doesn't contain any useful information)

Event.ShootingEndEvent

Occurs when a unit stops firing a machine gun- or autocannon-based weapon. Event will always correspond with a [ShootingStartEvent] event.

Field Type Label Description
initiator Initiator The object that was shooting and has no stopped firing.
weapon_name string The name of the shoot weapon.

Event.ShootingStartEvent

Occurs when a unit begins firing a machine gun- or autocannon-based weapon (weapons with a high rate of fire). Other weapons are handled by [ShotEvent].

Field Type Label Description
initiator Initiator The object that started firing.
weapon_name string The name of the shoot weapon.

Event.ShotEvent

Occurs when a unit fires a weapon (but no machine gun- or autocannon-based weapons - those are handled by [ShootingStartEvent]).

Field Type Label Description
initiator Initiator The object that fired the weapon.
weapon Weapon The weapon that has been fired.

Event.TakeoffEvent

Occurs when an aircraft takes off from an airbase, farp, or ship.

Field Type Label Description
initiator Initiator The object that took off.
place Airbase The airbase, farp or ship the unit took off from.

Event.UnitLostEvent

A unit got destroyed.

Field Type Label Description
initiator Initiator The object that got destroyed weapon.

Event.WeaponAddEvent

Fired for each payload of an aircraft spawened midair.

Field Type Label Description
initiator Initiator The object that got spawned.
weapon_name string The name of the payload.

StreamEventsRequest

StreamUnitsRequest

Field Type Label Description
poll_rate uint32 optional The poll rate in seconds at which the gRPC server communicates with the DCS mission to retrieve the latest unit positions. The lower the poll_rate the higher the amount of requests send to to the DCS mission. Default: 5
max_backoff uint32 optional The maximum backoff in seconds which the gRPC postpones polling units that haven't moved recently. This is an optimization to dynamically reduce the poll rate for stationary units. Set it to the same value as poll_rate to disable the backoff. Default: 30

UnitUpdate

Field Type Label Description
unit Unit The unit is either new or its position changed.
gone UnitUpdate.UnitGone The unit does not exist anymore.

UnitUpdate.UnitGone

Field Type Label Description
id uint32
name string

Top

timer.proto

GetAbsoluteTimeRequest

GetAbsoluteTimeResponse

Field Type Label Description
time double

GetTimeRequest

GetTimeResponse

Field Type Label Description
time double

GetTimeZeroRequest

GetTimeZeroResponse

Field Type Label Description
time double

Top

trigger.proto

ExplosionRequest

Field Type Label Description
position Position
power uint32

GetUserFlagRequest

Field Type Label Description
flag string

GetUserFlagResponse

Field Type Label Description
value uint32

IlluminationBombRequest

Field Type Label Description
position Position The altitude of Illumination Bombs is meters above ground. Ground level will be calculated server-side
power uint32

MarkToAllRequest

Field Type Label Description
text string
position Position
read_only bool
message string

MarkToAllResponse

Field Type Label Description
id uint32

MarkToCoalitionRequest

Field Type Label Description
id uint32
text string
position Position
coalition Coalition
readOnly bool
message string

MarkToCoalitionResponse

Field Type Label Description
id uint32

MarkToGroupRequest

Field Type Label Description
id uint32
text string
position Position
group_id uint32
read_only bool
message string

MarkToGroupResponse

Field Type Label Description
id uint32

OutTextForCoalitionRequest

Field Type Label Description
text string
display_time int32
clear_view bool
coalition Coalition

OutTextForGroupRequest

Field Type Label Description
text string
display_time int32
clear_view bool
groupId uint32

OutTextRequest

Field Type Label Description
text string
display_time int32
clear_view bool

RemoveMarkRequest

Field Type Label Description
id uint32

SetUserFlagRequest

Field Type Label Description
flag string
value uint32

SignalFlareRequest

Field Type Label Description
position Position Altitude paramter will be ignored. Signal flares always fire from ground level which will be calculated server-side
color SignalFlareRequest.FlareColor
azimuth uint32

SmokeRequest

Field Type Label Description
position Position Altitude paramter will be ignored. Smoke always eminated from ground level which will be calculated server-side
color SmokeRequest.SmokeColor

SignalFlareRequest.FlareColor

Putting this inside the request because we cannot have the same enum value in the same package.

Name Number Description
GREEN 0
RED 1
WHITE 2
YELLOW 3

SmokeRequest.SmokeColor

Putting this inside the request because we cannot have the same enum value in the same package.

Name Number Description
GREEN 0
RED 1
WHITE 2
ORANGE 3
BLUE 4

Top

unit.proto

GetRadarRequest

Field Type Label Description
name string

GetRadarResponse

Field Type Label Description
active bool
target Target

GetUnitDescriptorRequest

Field Type Label Description
name string

GetUnitDescriptorResponse

TODO fill these in as and when we need em

Field Type Label Description
attributes string repeated

GetUnitPlayerNameRequest

Field Type Label Description
name string

GetUnitPlayerNameResponse

Field Type Label Description
player_name string optional

GetUnitPositionRequest

Field Type Label Description
name string

GetUnitPositionResponse

Field Type Label Description
position Position

Top

world.proto

GetAirbasesRequest

Field Type Label Description
coalition Coalition optional

GetAirbasesResponse

Field Type Label Description
airbases Airbase repeated

GetMarkPanelsRequest

GetMarkPanelsResponse

Field Type Label Description
mark_panels MarkPanel repeated

Scalar Value Types

.proto Type Notes C++ Java Python Go C# PHP Ruby
double double double float float64 double float Float
float float float float float32 float float Float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int32 int int int32 int integer Bignum or Fixnum (as required)
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int64 long int/long int64 long integer/string Bignum
uint32 Uses variable-length encoding. uint32 int int/long uint32 uint integer Bignum or Fixnum (as required)
uint64 Uses variable-length encoding. uint64 long int/long uint64 ulong integer/string Bignum or Fixnum (as required)
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int int32 int integer Bignum or Fixnum (as required)
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long int64 long integer/string Bignum
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. uint32 int int uint32 uint integer Bignum or Fixnum (as required)
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. uint64 long int/long uint64 ulong integer/string Bignum
sfixed32 Always four bytes. int32 int int int32 int integer Bignum or Fixnum (as required)
sfixed64 Always eight bytes. int64 long int/long int64 long integer/string Bignum
bool bool boolean boolean bool bool boolean TrueClass/FalseClass
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode string string string String (UTF-8)
bytes May contain any arbitrary sequence of bytes. string ByteString str []byte ByteString string String (ASCII-8BIT)
Clone this wiki locally