Updated for version 4.20
Drones are autonomous vehicles based on stations or (some) M, L and XL ships. These drones perform specific functions for their commanders.
Buying and Building Drones
Drones are constructed from Drone components and from Smart chips using Energy Cells. When you dock a ship that can stock drones at a wharf or shipyard, you can order drones and the wharf or shipyard will instantly produce and then deliver them to your ship. These drones can then be used on the ship or transferred to player-owned stations. However, to supply player-owned stations, it is much more convenient to let the station manufacture its own drones. Right-click your station and select "Logical overview". There, you can set how many Cargo drones, Defence drones and Repair drones the station should keep in stock. The station will then order Drone components,Smart chips and Energy Cells and once the station is supplied with these wares, it will produce drones on its own and maintain their number in the case of losses. However, experience shows that it may take a very long time for stations to get supplied with these wares by NPCs, so send one of your own freighters if you want this to happen more quickly.
There are a number of drone types in X4 Foundations, and we will discuss them in turn:
Cargo drones are used by stations with piers and by L and XL ships to transfer wares. If an L or XL ship is docked to a station's pier, for example, you can watch the Cargo drones fly back and forth between the drone bay at the front of the ship and the pier. The time needed to transfer the wares is governed by the amount of drones the station and the ship own between them, and the drones will return to their original owners after all wares have been transferred.
Consequently, your L mining ships shouldn't be equipped solely with Gas collectors or Ore collectors - include at least one Cargo drone to be certain you're able to exchange resources with any station you encounter.
Building drones are used by XL Builder-type ships to construct stations. Construction speed of stations depends on the number of Construction drones the Builder ship has, so choose NPC builder ships carefully with this in mind, and pick one carrying the maximum number of Construction drones usable at the same time when building a station module (30).
Defense drones are auto-launched by stations and ships which come under attack (or launch an attack themselves) and can be set to attack or defend their bases. They are essentially small ships with a laser attached which they use to fight. After release it usually takes some time for them to return to docking storage on recall, therefore it can be prudent to disable their launch in the ship settings or via a configurable hotkey until you really need them in ships manned by yourself.
Gas collectors are used on L gas mining ships to collect gases (Helium, Hydrogen and Methane).
Ore collectors are used on L mineral mining ships to collect minerals (Ice, Ore, Silicon and Nividium).
Repair drones are auto-launched by stations and ships which suffer damage. They fly to the damaged part of the ship and initiate repairs. They are essentially small ships with a repair laser attached, which they use to repair affected hull areas and surface fixtures such as drives, turrets, etc.
(see also Terraforming)
Terraforming drones are special because unlike regular drones they are built with a S/M Fabrication module. Additionally and most critically, they do not require any resources to be built and will be created out of nothing when terraforming resources are provided. In addition, terraforming drones come in two varieties medium and small drop drones respectively, this also makes the medium drop drone the only medium sized drone.