(Old) Alpha v0.1 Protocol - LSFN/Design GitHub Wiki

This defines the protocol used in Alpha v0.1. There are separate protocols for each communication direction between programs. All of the protocol elements are defined in lsfn.proto. Tag numbers 1-15 can be used but we will reserve these numbers until later as they take only 1 byte to encode instead of 2. We cannot use tag numbers 16000 - 16999. Nested messages may use the tags 1-15 freely.

=Interface and Ship= Upon connection to the SHIP, the SHIP will give the INT it's ID (unique to the SHIP). The SHIP will also send info concerning it's ENV status through SHIP_ENV_status once connected successfully along with subscription data in Subscriptions_available.

Upon disconnection, the INT sends a message with the Handshake field set to GOODBYE. The SHIP should now close and remove the socket. Similarly the INT should close the socket after it receives a GOODBYE from the ship. In the event of a failed liveness test by the INT, the SHIP will send a GOODBYE and then disconnect the relevant socket in the ClientHandler. If the SHIP fails a liveness test, the INT will send a GOODBYE then disconnect it's Listener. This means that regardless of whether or not the end suspected of "dying" is actually dead, the connection is severed nicely at both ends.

The INT can send messages of the type SHIP_ENV_command. This basically commands the SHIP to connect/disconnect/reconnect to/from the ENV with the information provided by the INT. The SHIP will reply with a SHIP_ENV_status which will tell the INT whether connection succeeded or failed. The reply will also contain the ship's unique ID on the ENV if the connection succeeded.

The SHIP will send Ship_positions messages whenever the ships' positions update.

A rudimentary value subscription system has been implemented. The SHIP will, upon being connected to, send a Subscriptions_available message to the newly connected INT, this will detail all the inputs and outputs available to the INT. The INT may then reply with a Subscribe message detailing the inputs and outputs that it wishes to subscribe to. Subscriptions will then be updated through Subscription_input_updates (from the INT to the SHIP) and Subscription_output_updates (from the SHIP to the INT).

=Ship and Environment= The connection / disconnection protocol is almost identical to that of the INT and SHIP with the exception that the ENV provides no data on subscriptions nor will it provide it's current status about whether it is connected to an ENV or not (an ENV connecting to an ENV would be silly).

The SHIP will send Ship_movement messages to ENV concerning it's acceleration in the world axes.

The ENV will provide, as they change, the positions of all ships via Ship_positions messages.

⚠️ **GitHub.com Fallback** ⚠️