Skip to content

DCS‐BIOS in a nutshell

Jerker Dahlblom edited this page Sep 19, 2023 · 15 revisions

Terminology

  • DCS-BIOS Control, a physical cockpit control defined within DCS-BIOS. E.g. Gear Lever GEAR_LEVER.
  • DCS-BIOS Module, all controls pertaining to a DCS aircraft and all defined inside a lua file. E.g. P-51D.lua

Sending

DCS-BIOS exports (sends) cockpit data from Digital Combat Simulator (DCS) over a UDP socket.

  • uint data, stating the position for a switch, dial, knob
  • string data, can be frequencies 127.000 or other information from a cockpit display e.g. Waypoint : 1

Receiving

DCS-BIOS listens for commands from the user on a TCP socket. Depending on command type the syntax differs.

  • FLAPS_SWITCH INC\n This is a command to increase the position of FLAPS_SWITCH
  • COMPASS_BRIGHTNESS 30000\n Set the position of COMPASS_BRIGHTNESS to 30000.
  • COMPASS_BRIGHTNESS -3000\n Decrease COMPASS_BRIGHTNESS by 3000.
  • and so on, an aircraft has many different controls.

Encoding

uint data

Data is encoded so that as many controls as possible are included in the same byte.

Therefore each control has :

  • address
  • shift value
  • mask value

so that it can be read from the byte stream in the receiving end.

string data

String data starts with an address and for each character in the address increases. The data must be converted into a string in the receiving end. It is send in little endian mode.

DCS-BIOS Control

This is a cockpit control defined within DCS-BIOS. All controls have some general information but they differ depending on what type of physical control they represent. It can also be a string that is displayed in a cockpit control. The control's unique identifier e.g. FLAPS_SWITCH is used when working with the lua and JSON files but it is not broadcast over the socket. Instead the client must listen for the control's address.

Aircraft Lua Files

Each aircraft (airframe) has a lua file containing definitions of all the DCS-BIOS controls. These have been made by someone digging through the DCS aircraft and finding out all the proper arguments for manipulating the cockpit controls. It takes some time making mapping all these controls.

p51_lua_definitions

Aircraft JSON Files

These are auto-generated from the lua files each time a mission starts. They are for communicating with DCS-BIOS.

  • input interfaces, which differs depending of whether it is e.g. a dial or a button
  • output information

This JSON snippet corresponds to the "GEN" (Generator) definition in the above lua image. p51_gen_json_control