Tutorial: Setting up an AI battle

Setting up an air battle between AI controlled units is one of many fun things you can do with BDArmory, and there are many ways to go about it. This tutorial, aimed at newcomers, will detail one way this can be done in a few simple steps.

## 1: Designing the planes

The first step is designing the planes which will take part in the battle, meeting a few key requirements. First of all, they will obviously need to be airworthy. If you're having serious issues flying them yourself, the AI might not fare much better, so aim for a good mix of stability and maneuverability. Additionally, they have to be capable of taking off from a slightly bumpy surface, because as we will see, the KSP runway will be unavailable when it's time for take-off.

Second, each craft that will take part in the battle needs to have a Weapon Manager and an AI Pilot Flight Computer attached to it. These are the parts that allow the AI to take control of the airplanes, and must be configured seperately. Especially the AI Pilot Flight Controller need to be tailored to each plane design. See also: Tutorial: Making the AI fly.

With these vital parts in place, your craft should also be outfitted with whatever weapons, ammunition, sensors and countermeasures you want them to use. Cannons are pretty straight-forward – simply put them on the craft along with some ammo, and they will work – but if you're going to use missiles, you should read up on the different targeting methods available.

## 2: Setting up for take-off

Once you have one or more aircraft designs ready, you can move on towards setting up the battle itself. As KSP will not let you put more than one plane at the runway itself, the first thing you need to do is position the participants somewhere off the runway. The grass next to it usually works well, so simply go to launch, and let your plane roll gently down from the runway and onto the field. You can also use a tool like Hyperedit or vesselmover to easily "land" your planes in a good position.

Once positioned in a take-off-friendly spot, turn on the brakes, and right-click the AI Pilot Flight Computer. Make sure Standby Mode is on, activate the pilot, and then turn on the engines if you haven't already done so. The AI is now active and in full control of the airplane; and waiting for the command to launch. Finally, open up Guard Mode from the Weapon Manager menu, and enable it. Binding these functions to toggle on the Stage action group saves much time, menu browsing and clicking.

> *Tip: Using the optional BDA Vessel Switcher can make the process easier, as it will let you toggle AI Pilot and Guard Mode on all nearby vessels, as well as switching between them.*
>
>

Leaving the plane in place, return to the Space Center, and repeat the process – go to launch, put the second plane in a take-off-friendly spot, and engage the AI Pilot and engines while Standby and Guard Mode is on. You can repeat this process as many times as you want planes in the battle; just make sure their take-off paths don't intersect.

## 3: Starting the battle

*Note: Much of this section has been simplified by Bahamuto D's BDA Vessel Switcher and Competition Mode.*

   You should now have several planes ready for launch. To get more than one AI-controlled plane in the air at the same time, you're going to be using the Wing Command module. Simply open up the Wing Command menu and select all units. Make sure you also check the "Command Self" box.

Next, click the Take Off button, and you should see all the planes you have positioned rev up their engines and start off down their various paths.

While the planes are speeding down their respective "runways", you can start cycling through all active ships (default button: "**]**"). This will let you designate which team each plane belongs to. If all planes are on Team A by default, switching half of them to Team B while they're taking off should lead to an interesting battle shortly after.

Alternately, you can wait until all planes are in the air, and use the Wing Command options to separate two groups of planes before (very rapidly) cycling through the members of one group and changing their team. You will only have a few seconds before the other members of the group start shooting at "newfound enemies", though, so you will need to act quickly.

In the settings menu, a Peace mode allows positioning of different teams within Guard range without setting off a battle before you are ready.

## 4: Finishing words

Using these steps you should be able to easily set up your first autonomous air battle. Moving on from here you can make it almost as advanced as you like; from placing enemies in standby mode on the Island Runway to adding SAM-sites, cruise missiles, ground vehicles or even combat ships to the mix. Mods like Hyperedit, VesselMover and Kerbal Konstructs/Kerbinside make this quicker and easier to do.

Note that physics range quickly becomes a limitation when planes begin a significant distance apart. Use the BD settings menu to increase it from the default 5000m, and when launching try not to be focused on an object more than about 6km from any of the planes, as calculating errors can cause it to crash into the terrain on take-off. Once they're in the air, as long as you're within physics range, they should be fine.