Bridge Command Network Documentation

Introduction

This document contains the technical details of the communication protocol used between Bridge Command and the Map Controller. In normal use, there is no need to understand this protocol, and this document is intended as a reference for programmers.

Bridge Command and associated programs communicate using text strings passed over UDP/IP. The main programs that use these network strings are Bridge Command and the Map Controller.

Each string is sent as a 32 bit integer indicating the length of the string, followed by the string characters.

Each string send by Bridge Command or the Map Controller starts with a constant text string to indicate the purpose of the message. These are “BC”, “SC”, “MC” and “WeatherBC”. These are case sensitive.

Within the text string, the '#' character is used to separate top level records. The '|' character is used to separate records for different vessels, and ',' is used to separate individual record values.

Strings sent by Bridge Command

The “BC”, “SC” and “WeatherBC” strings are sent by Bridge Command.

BC String

The BC string is the key message string, and sends information about the current scenario status, including the position and bearing of all vessels and buoys.

This string is sent by Bridge Command in networked mode, and is used by the Map Controller and Bridge Command secondary displays.

Example BC string:

BC1289069959,7.2,1289069952#687.095,3390.89,130.165,-3.92772,0.421224,9.801,128.32#3,0,68,0#1221.66,3894.9,470.0,0|1230.15,3267.36,380.0,0|678.695,3354.38,405.0,0|##1879.72,3947.37|1799.72,3625.0|1759.66,3369.22|1689.69,3124.47|1684.64,2957.77|1679.67,2824.16|1669.65,2657.46|1639.67,2479.73|1600.36,2313.03|1600.36,2157.35|1614.67,1990.23|1625.37,1834.56|1634.63,1645.8|1654.66,1545.69|1729.68,1501.16|1834.68,1467.65|1939.74,1401.05|2069.74,1356.51|2209.76,1345.48|2324.84,1289.92|2414.85,1223.32|2544.85,1211.87|2514.87,1134.24|2379.83,1189.81|2304.81,1256.41|2204.79,1300.94|2054.75,1323.43|1914.74,1356.51|1814.71,1401.05|1714.69,1445.59|1609.63,1467.65|1575.36,1690.34|1489.64,1834.56|1240.27,1567.75|1470.36,1245.38|1550.35,1556.72|990.21,4013.97|990.21,3647.06|1020.26,3380.25|1080.22,3124.47|1060.25,2913.23|1040.22,2668.48|1070.27,2401.68|1090.23,2145.9|1070.27,1946.11|1070.27,1767.96|1070.27,1590.23|1060.25,1456.62|1030.21,1334.45|1450.33,3458.3|1550.35,3313.65|1600.36,3124.47|1600.36,2957.77|1589.66,2835.61|1579.65,2668.48|1539.65,2490.76|1360.32,3313.65|1270.31,3124.47|1230.25,2913.23|1210.29,2690.97|1250.28,2435.19|1410.33,2001.68|1300.29,1879.1|1240.27,1745.9|1210.29,1401.05|1210.29,1178.78|1130.23,978.572|1500.34,4403.36|#0,0#33#2.0,5.0,0,2.0,31.7666#0,0,0#1#0#

The BC string starts with the characters “BC”, which are discarded for further processing.

The end of each top level record is indicated with the '#' character.

Timestamp

The first top level record (in this example “1289069959,7.2,1289069952”) contains timestamp information. The individual values are separated by commas. The first value is the current simulation time in integer seconds (Time since 1st January 1970). The second two records give the simulation time more accurately, with the next record being a floating point time in seconds, which is added to the third record, the offset time in integer seconds, to give the current simulation time in decimal seconds. Therefore value 1 ~ value 2 + value 3. Approximately every hour, the offset time is reset to maintain the precision of the floating point time value.

Own ship location data

The second top level record (in this case “687.095,3390.89,130.165,-3.92772,0.421224,9.801,128.32”) contains information about the own ship's position, bearing, pitch, roll, speed over ground and course over ground. The first value is the position in metres East/West relative to the South West corner of the world area, with an easterly position being positive. The second value is the position in metres North/South relative to the South West corner of the world area, with a northerly position being positive. The third value is the own ship's heading in degrees, the fourth value is its pitch in degrees, and the fifth value is its roll in degrees. The sixth value is the speed over the ground in knots, and the seventh value is the course over the ground in degrees. If the speed over the ground is very low, the ship's heading is used instead of the course over the ground.

Number of other contact records

The third top level record (in this case “3,0,68,0”) contains information about the number of other contacts defined in the string. The first value is the number of 'Other Ship' contacts. The second value is the number of 'Controlled Ship' contacts. The third value is the number of Buoys, and the fourth value is the number of 'Man Overboard' contacts (currently just 0 or 1).

Other Ships record

The fourth top level record contains information about each 'Other Ship', in this case “1221.66,3894.9,470.0,0|1230.15,3267.36,380.0,0|678.695,3354.38,405.0,0|”. Within this record, the specific record for each ship is separated by the '|' character. Therefore in this case the data for Other Ship 1 is “1221.66,3894.9,470.0,0”. For each own ship, the first value is the position in metres East/West relative to the South West corner of the world area, with an easterly position being positive. The second value is the position in metres North/South relative to the South West corner of the world area, with a northerly position being positive. The third value is the other ship's heading in degrees. The fourth value indicates if the other ship has its SART (Search and Rescue Transponder) activated, with 1 for activated, and 0 for normal.

Controlled Ships record

The fifth top level record contains information about each 'Controlled ship'. In the case shown there are no controlled ships, so this is an empty record. Within this record, the specific record for each ship is separated by the '|' character. For each controlled ship, the first value is the position in metres East/West relative to the South West corner of the world area, with an easterly position being positive. The second value is the position in metres North/South relative to the South West corner of the world area, with a northerly position being positive. The third value is the controlled ship's heading in degrees. The fourth value indicates if the controlled ship is hidden (inactive in the simulation and invisible), with 1 for hidden and 0 for normal. The fifth value indicates if the controlled ship has its SART (Search and Rescue Transponder) activated, with 1 for activated, and 0 for normal.

Buoys record

The sixth top level record contains information about each Buoy. Within this record, the specific record for each buoy is separated by the '|' character. For each buoy, the first value is the position in metres East/West relative to the South West corner of the world area, with an easterly position being positive. The second value is the position in metres North/South relative to the South West corner of the world area, with a northerly position being positive.

Man overboard record

The seventh top level record contains information about 'Man Overboard' location, in this case “0,0”. The first value is the position in metres East/West relative to the South West corner of the world area, with an easterly position being positive. The second value is the position in metres North/South relative to the South West corner of the world area, with a northerly position being positive. If no 'Man Overboard' is active, then both are set to a default value of 0.

Message ID record

The eighth top level record is a unique integer, in this case “33”, which increases by 1 each time a message is sent. As the network communication is over UDP, there is no guarantee that the messages will be received in order (or at all). Therefore this record is used to ensure that an older message will not be used when a newer one is available.

Weather record

The ninth top level record contains information about the weather, in this case “2.0,5.0,0,2.0,31.7666”. The first value is the basic weather, which sets swell and wind speed (floating point value between 0 and 12). The second value is the visibility range (floating point value in nautical miles). The third value is the direction the wind blows from (in integer degrees). The fourth value is the rain intensity (floating point value between 0 and 10). The fifth value is the light intensity level, i.e. brightness (floating point value between 0 and 255).

Bearing marker information

The tenth top level record contains information about the on-screen bearing marker (for taking bearings of objects in view), in this case “0,0,0”. The first value is the bearing of the bearing marker in degrees. The second value is the angular height above the horizon of the bearing marker in degrees. The third value indicates if the bearing marker is active, 1 for active, and 0 for inactive.

View information

The eleventh top level record is a single value, indicating which viewpoint on the Own Ship is active, in this case “1”.

Multiplayer request

The twelfth top level record is a single value, which is used in multiplayer mode, to request which 'own ship' to join the scenario with. In this case, the value is “0”, indicating no multiplayer mode is active.

SC String

The SC string provides the information about basic scenario setup, including the vessels included.

This string is sent by Bridge Command in networked mode, and is used by the Map Controller and Bridge Command secondary displays.

Example SC String

“SCb) Buoyage by night|SimpleEstuary|Atlantic85|3,0|Yacht,Timbercarrier,Yacht_Sinking,||”

The SC string starts with the characters “SC”, which are discarded for further processing.

The '|' character is used to separate records, and ',' is used to separate individual record values.

Scenario name

The first record is the scenario name, as a text string, in this case “b) Buoyage by night”

World model used

The second record is the name of the world model used as a text string, in this case “SimpleEstuary”

Own ship model used

The third record is the name of the 'Own Ship' model used as a text string, in this case “Atlantic85”

Number of contacts

The fourth record contains information on the number of other contacts in the scenario, in this case “3,0”. The first value is the number of 'Other Ships', and the second value is the number of 'Controlled ships'

Other ships

The fifth record contains the names of all 'Other Ships' used in the scenarios as text strings, separated by the ',' character. In this case, “Yacht,Timbercarrier,Yacht_Sinking,”.

Controlled ships

The sixth record contains the names of all 'Controlled Ships' used in the scenarios as text strings, separated by the ',' character. In this case, there are no Controlled Ships, so this record is empty.

WeatherBC

The WeatherBC string provides information about the initial weather defined in the scenario (not the current weather).

This string is sent by Bridge Command in networked mode, and is used by the Map Controller and Bridge Command secondary displays.

Example WeatherBC String

“WeatherBC1.0#5.0#0#2.0#”

The WeatherBC string starts with the characters “WeatherBC”, which are discarded for further processing.

The '#' character is used to separate records.

Initial weather

The first record is the initial weather, which sets swell and wind speed (floating point value between 0 and 12), in this case “1.0”

Initial visibility

The second record is the initial visibility range (floating point value in nautical miles), in this case “5.0”

Initial wind direction

The third record is the initial direction the wind blows from (in integer degrees), in this case “0”

Initial rain intensity

The fourth record is the initial rain intensity (floating point value between 0 and 10), in this case “2.0”

String sent by the Map Controller

The “MC” string is sent by the Map Controller.

MC String

This string is sent by the Map Controller, and is used by Bridge Command in networked mode, providing information about the movement of controlled ships, and setting the weather, and controlling other aspects of the scenario, such as machinery failure.

Example MC string:

“MC714#10,302,0|12,218,0|#0.0,10.0,315,0.0#,,#0##1289069959,7.2,1289069952#”

The MC string starts with the characters “MC”, which are discarded for further processing.

The end of each top level record is indicated with the '#' character.

Message ID record

The first top level record is a unique integer, in this case “714”, which increases by 1 each time a message is sent. As the network communication is over UDP, there is no guarantee that the messages will be received in order (or at all). Therefore this record is used to ensure that an older message will not be used when a newer one is available.

Controlled ships record

The second top level record contains information about the speed and bearing of each controlled ship, in this case “10,302,0|12,218,0|”. Within this record, the specific record for each ship is separated by the '|' character. Therefore in this case the data for Controlled Ship 1 is “10,302,0”. For each controlled ship, the first value is the speed over the ground in knots, the second value is the course over the ground in degrees. The third value is used to show or hide the ship. It is -1 to hide, 0 to leave unchanged, and 1 to show.

Two additional variables may be used, and if present are used to relocate the controlled ship. These values are optional, but both must be used together. The optional fourth value is the position to relocate to in metres East/West relative to the South West corner of the world area, with an easterly position being positive. The optional fifth value is the position to relocate to in metres North/South relative to the South West corner of the world area, with a northerly position being positive. In this case, if the vessel were being relocated, the record for this controlled ship would be “10,302,0,45267,92432”.

Weather record

The third top level record contains information about the scenario weather, set by the Map Controller. In this case, the record is “0.0,10.0,315,0.0”. The first value is the basic weather, which sets swell and wind speed (floating point value between 0 and 12). The second value is the visibility range (floating point value in nautical miles). The third value is the direction the wind blows from (in integer degrees). The fourth value is the rain intensity (floating point value between 0 and 10).

Engine and rudder failure record

The fourth top level record contains information about engine and rudder failure, set by the Map Controller. In this case, the record is “,,”, i.e. three empty values. The first value is the port engine failure value. This should be empty, or “A” if the engine is functioning normally, “0” if the engine is not working, or a floating point value between -1.0 for full astern and 1.0 for full ahead, if the engine is working but cannot be controlled. The second value is for the starboard engine. The third value is for the rudder, and should be blank or “A” if working normally, and an angle in degrees if the rudder is jammed (e.g. -30 for port 30, or 10 for starboard 10).

For example, if the port engine is working normally, the starboard engine is out of use, and the rudder is jammed at port 10, this record would be “,0.0,-10”.

Man overboard record

The fifth top level record is a single value, in this case “0”. This controlls the man overboard status. If this value is 1, a new man overboard is set (currently there can only be one man overboard). If this value is 0, there is no change, and if it is -1, the man overboard is retrieved.

Own ship relocation record

The sixth top level record is used by the Map Controller send a location to reposition the own ship to. In this case, the record is empty, indicating no re-positioning.

If used, there are two variables. The first value is the position to relocate to in metres East/West relative to the South West corner of the world area, with an easterly position being positive. The second value is the position to relocate to in metres North/South relative to the South West corner of the world area, with a northerly position being positive. In this case, if the own ship were being relocated, record would be “45267,92432”.

Timestamp

The seventh top level record (in this example “1289069959,7.2,1289069952”) contains timestamp information. This is only used by Bridge Command in 'Multiplayer' mode, where the clients running with ship 2 and above use this to synchronise their simulation time. The individual values are separated by commas. The first value is the current simulation time in integer seconds (Time since 1st January 1970). The second two records give the simulation time more accurately, with the next record being a floating point time in seconds, which is added to the third record, the offset time in integer seconds, to give the current simulation time in decimal seconds. Therefore value 1 ~ value 2 + value 3. Approximately every hour, the offset time is reset to maintain the precision of the floating point time value.

The process of setting the initial weather conditions

The Map Controller sets the weather in Bridge Command using the “MC” message. The default weather settings are weather=1.01, visibility range = 10.01, wind direction = 1.

When Bridge Command loads a scenario, it stores the weather conditions specified in the scenario. This information is sent to the Map Controller in the “WeatherBC” message. This is only sent if the weather matches the Map Controller initial defaults. (weather=1.01 and visibility range=10.01 and wind direction=1). When the Map Controller receives the WeatherBC message, it uses the values to set the weather to match the weather specified in the scenario.

Example:

Scenario defines weather=2.0

Bridge Command stores initial weather = 2.0

Map Controller sets weather = 1.01, and sends in MC message

Bridge Command receives MC message, and sets weather = 1.01

Bridge Command sends WeatherBC message containing initial weather = 2.0

Map Controller receives WeatherBC message and sets weather = 2.0 and sends in MC message

Bridge Command receives MC message and sets weather = 2.0.