• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

How to create AI-flightplans

Messages
39
Country
norway
Hi! Can anybody be so kind to tell(or link me to a guide/tutorial)how I create my own AI-flightplans for FSX?
 
Here's how I do it: (fast and loose explanation)

Keep in mind that there are several elements you must bring together:
a) the AIRPORTS your AI will fly into
b) the AIRCRAFT that constitute your AI.
c) the FLIGHT PLANS that tell the sim what to do.

1) get all info I can about the airline in question. Schedules, aircraft models used, airports served, etc. It's out on the 'net, you have to scrounge for it sometimes.

1a) get all of the aircraft models and paintjobs you will need. Look for AI Aardvark, EvolveAI, The Fruit Stand, FSPainter for your AI model needs.

2) create a directory to hold all the creation files, such as E:\PROJECTS\AI\AAL

3) read the SDK, the "Traffic Toolbox" part. note the format for WEEKLY flight plans. This is most likely what you will want to use. Keep it in mind.

4) in step #1, hopefully you have some sort of timetable or data on the airline's flights. Now you will open notepad and start formatting flight plan data as it is outlined in the SDK. Create a file named AAL_schedules.dat. (AAL = American Airlines IATA code. I tend to use these codes to help me keep everything straight). Keep this file handy. THIS WILL BE YOUR ACTUAL FLIGHT PLAN TEXT FILE. You will edit it a lot before you are finished.

5) At this point you are probably thinking, why not use ttools. TTools was great in its time, but it does not generate native fsx bgl's. Forget about TTools, this is 2008 not '05 and we need to use native FSX methods and true native fsx bgl traffic files, especially in light of the "one version back" compatibility thing we will all have to deal with right now and in the future with the MSFS series.

6) now you need to copy in some files from the SDK into your working directory. You will need the following files in your working dir:
TrafficDataBaseBuilder.exe
CountriesRegions.csv
aircraft.csv

7) open another notepad window, open the file fs10airports.dat that comes with the SDK. This is a listing of all of the airports in FSX. You will *not* need all of these airports, but keep the notepad window open because you will need to cut and paste some of this airport data into a custom text file you make.

8) In the fs10airports.dat file, find the entries for each of the airports that your airline flies into, and cut and paste them into a NEW notepad text file. Call this file AAL_airports.dat (naturally, if you are doing British Airways, you would call it BA_airports.dat). when you are done, save this file into your working dir. Now we have defined the AIRPORTS that we need. That was easy, wasn't it.

9) Now we move on to defining the AIRCRAFT we need. The aircraft.csv file (or it might be called fs10aircraft.csv, I can't remember and am not at my design rig right now) comes with the SDK install. Copy it into your working directory, then rename it AAL_aircraft.csv. You can edit it with a text editor, or, better, Microsoft Excel if you have it.

10) The format of the aircraft.csv file should be self-explanatory. There is a column for aircraft code, aircraft name, speed (knots true airspeed), range, parking radius, etc. Erase the lines for aircraft that you don't need. Add lines for aircraft that you do need to define. That should be easy enough. Do not erase the column headers or else you won't know what data to put where.

11) Looking at the aircraft.csv file, the first column on the left, is aircraft code. This data, such as C208-1, is referenced in your FLIGHT PLAN file (which you named AAL_schedules.dat above). In the flight plan file, the line C208-1,IFR,ONE_WEEK,1 tells the compiler that you are using a Cessna 208 Caravan, paint job number 1, it is an IFR flight plan,based on a weekly schedule,and appears when you have the traffic slider set to 1 or higher in the sim.

12) keep in mind that the code can be *anything*. You could call it Cess208 in your AAL_aircraft.csv file, and as long as you referenced Cess208 in your flight plans text file, the sim would show it.

13) the second column in the aircraft.csv file is a description of the aircraft. Now here is critical information: THIS DESCRIPTION MUST EXACTLY, EXACTLY MATCH THE SIM= LINE IN THE AIRCRAFT.CFG FILE OR IT WON'T SHOW IN THE SIM.

To be continued....
 
Mace,

While you're at it, would you explain how to use customized airports when creating AI flight plans. According to the SDK, you have to use "dump airport list" command, but I'm not sure how exactly this works.

If I add/remove parking in a customized airport, how do I get that to reflect correctly when bulding flight plans?

Thanks.
 
Sorry about that. My previous post was interrupted by a real-world problem I had to take care of. I will continue that post later.

@Bob

Yes I have made plans with custom airports. It's simply a matter of designating your airport in your NWA_airports.dat file, of course using the format MS used in their fs10airports.dat file.

You can specify the parking in your airports.dat file, and it doesn't have to match what's actually in your scenery...of course if it doesn't match, you might have AI aircraft disappearing after they land.

I do not use the "dump airports" feature at all. I find it confusing.

When I get home (I am still at work) and get time this weekend, I will post an example of each of the three primary text files--the airports one, the aircraft csv file, and the flight plan file. I'll use a small airline so that there isn't too much to tackle at once.

And bob I will post an example of a custom airport I put into my airports file.
 
perfect!

fabulous! just what I was hopeing for! perfect!:) Thank you Mace! can't wait for the "update"!
 
Defining your aircraft

Sorry about the delay here, I have been busy with real world things but I did not forget about this thread.

Let me see, where was I. In this post I will show examples of the aircraft.csv file, the airports text file, and the schedules text file that we run through TrafficDataBaseBuilder.exe (TDBB).

In your working dir, as I said in the earlier post, you must have the following files:
countries_regions.csv (copied directly from the Traffic Toolbox SDK directory)
TrafficDatabaseBulder.exe (copied from Traffic Toolbox SDK dir)

Now, here's where you start custom-making your own files. In the Traffic ToolBox SDK dir, you will see a file named fs10AircraftTypes.csv. This is a comma-separated-value (csv) file, which can be edited with a simple text editor like notepad. However, if you have Excel, it is better to use excel to view and edit it. I strongly suggest you use Excel.

I am going to sort of (in my own disjointed way. :) ) walk you through how I create AI in FSX--using SDK methods--not using any of the non-compliant compilers. We will be working on La Costena, a small airline in Nicaragua. It's IATA airline prefix is "SNE" so we will use that prefix on our data files.

fs10AircraftTypes.csv will contain all sorts of aircraft that you will not be using. La Costena only flies Cessna 208 Caravans, and Shorts 360's. You will need to make a custom aircraft definition file, named, for the purpose of this, SNE_aircraft.csv.

The SDK explains the formatting of this file, but I will briefly go over it:
typekey -- this is any combo of letters and numbers that you use to identify your aircraft in the flight plans. In TTools, this was equivalent to AC#1, AC#2, etc. For our file, we will use C208-1 for the Caravan, and S360-1 for the Shorts 360. The -1 merely denotes a paintjob and isn't really needed since we're only using 1 livery per aircraft. If you had a second livery, like many airlines do, you would have C208-2 and this line in the file would define that aircraft.

Here is a text import of the sne_aircraft.csv file (in Excel, it looks much nicer):

#TypeKey,Title,Cruise,minAlt,maxAlt,minRange,maxRange,minRwyLen,runwayTypes,radius,parkingTypes,IFR%,AutoRoute?,TouchAndGo?
#,,(KTAS),(FL),(FL),(nm),(nm),(ft),,(m),,,,
C208-1,Cessna Grand Caravan La Costena,175,30,200,30,1519,1000,HARD|SOFT,8,GATE,100,yes,no
S360-1,Shorts 360 La Costena,190,30,200,30,670,2000,HARD|SOFT,12,GATE,100,yes,no

The SDK explains the use of these values (such as the range of the aircraft, etc.) so I won't go into too much detail. The VERY IMPORTANT piece of data is the "Title" column, which is the second column of data.

The "Title" column data must EXACTLY match the sim= line of the aircraft in that aircraft's aircraft.cfg file.

Here's how to do it:
Open fs10aircraftTypes.csv in MS Excel.
Delete all of the lines you don't need.
Enter data for the aircraft you will need.
Save As...SNE_aircraft.csv. Make sure you save it as a comma-separated value file.
 
Defining your airports

Now that we've done aircraft, we can move on to airports.

Since we're doing La Costena, we don't have too many destination airports. Managua, Bluefields, Puerto Cabezas, and a few other airstrips in Nicaragua...

1. Open a blank notepad window.
2. Open FS10airports.dat (in the Traffic ToolBox SDK dir) in *another* notepad window. Place these windows side-by-side. You will be copying and pasting airports from the fs10airports.dat file INTO your new file.
3. Use the search function of Notepad to find the first airport (our hub, A.C. Sandino Intl), which is MNMG.
4. Copy and paste the MNMG entry into your text file.
5. Do the same for MNPC. Here's an example:

# Puerto Cabezas

MNPC,14.046208262,-83.387702554,16.2,G,0,0.70,Nicaragua
{
RUNWAY,8136,148,HARD
PARKING,10.0,RAMP
PARKING,14.0,RAMP
PARKING,18.0,RAMP
PARKING,12.1,GATE
PARKING,12.1,GATE
PARKING,8.1,GATE
PARKING,8.1,GATE
}

# Bluefields

MNBL,11.989809573,-83.773982674,15.5,G,0,0.70,Nicaragua
{
RUNWAY,5971,98,HARD
PARKING,8.1,GATE
PARKING,8.1,GATE
PARKING,10.0,RAMP
PARKING,12.1,GATE
PARKING,12.1,GATE
}

Notice the format here. The SDK explains it all. The "# Bluefields" is merely a comment inserted by me, so that I don't get confused looking at my file later.

Notice the parking definitions that are in the curly-bracket areas. These let the TDBB compiler know if there is enough parking at the airports you put in your flight plans. NOTE THAT YOU CAN PUT *ANY* NUMBER OF PARKING SPOTS IN YOUR SNE_AIRPORTS.DAT FILE--BUT ULTIMATELY THE ACTUAL PARKING YOU HAVE IS DETERMINED BY WHAT AIRPORT SCENERY (AFCADs) YOU HAVE INSTALLED.

The problem many people have with TDBB is that it will in fact check to see if you have enough parking for the flight plans you feed it. TDBB won't scan your AFCADs--it does not know what you have installed--but rather TDBB will look at your SNE_airports.dat file and cross-reference that with your flight plans text file (you'll make that later) to determine if there is enough parking at the airport.

If TDBB doesn't find enough parking, it will send you a warning message when you compile, and it will throw out that flight plan. Not good.

So how do we avoid this? We fake TDBB out. Yes, lie to TDBB.

In the above snippet, if we made some flight plans with the Cessna Caravan (needs an 8 meter parking spot), and TDBB was giving us trouble, telling us "NOT ENOUGH PARKING AT MNBL for La Costena C208", we would simply go into our SNE_airports.dat file and insert some parking entries like this:

MNBL,11.989809573,-83.773982674,15.5,G,0,0.70,Nicaragua
{
RUNWAY,5971,98,HARD
PARKING,8.1,GATE
PARKING,8.1,GATE
PARKING,10.0,RAMP
PARKING,12.1,GATE
PARKING,12.1,GATE
PARKING,8.1,GATE <---- I just added this fake entry
PARKING,8.1,GATE <---- another fakie
PARKING,8.1,GATE <---- and yet another
}

What does my AFCAD at MNBL look like? It only has two 8.1 meter radius parking spots at it. But, Shhhhh. Don't tell TDBB. It doesn't need to know that. All it needs to look at is our SNE_airports.dat file. If you add *enough* parking, TDBB will quit giving you error messages about parking.

After you have copied (from fs10airports.dat) and pasted all of the airports that La Costena flies to, save your new file as SNE_airports.dat.

Bob asked earlier in this thread, how to add custom airports, well, this is where you do it. You make a new entry in your SNE_airports.dat file:

# Bob Keeshan's airport

MNBK,12.989809573,-84.773982674,5.6,G,0,0.70,Nicaragua
{
RUNWAY,11200,150,HARD
PARKING,19.1,GATE
PARKING,33.1,GATE
}

That's pretty much it for the airports file.

Next, making the actual flight plans text file...
 
Defining your flight plans

Now to the flight plans text file.

The SDK explains the formatting of the text file. You can arrange your flight plans by day, by week, every four hours, and so forth. Most plans go by the week, which I suggest you use also (to keep your sanity).

Make a new text file, called sne_schedules.dat. I won't beat around the bush any more, I will simply show you an example file and then comment on it.

Here is one weekly flight plan for one single La Costena Cessna Caravan:

C208-1,HP-1408,1,ONE_WEEK,IFR
{
01400,MNBZ,170,0010
01550,MNPC,150,0011
11400,MNBZ,170,0012
11530,MNPC,150,0012
11610,MNBL,170,0012
11720,MNPC,160,0013
11830,MNBZ,120,0013
11910,MNMG,180,0013
21100,MNBL,130,0044
21230,MNMG,160,0045
21400,MNSC,150,0020
21505,MNMG,160,0021
31530,MNWP,190,0036
31710,MNMG,200,0037
41400,MNBZ,170,0012
41530,MNPC,150,0012
41610,MNBL,170,0012
41720,MNPC,160,0013
41830,MNBZ,120,0013
41910,MNMG,180,0013
51530,MNWP,190,0036
51710,MNMG,200,0037
61400,MNBZ,150,0010
61525,MNMG,160,0011
}

Notice the C208-1. Does that look familiar? That is in your sne_aircraft.csv file. It is the code for the first paintjob of the Cessna Caravan. In this way, you can define one special aircraft (such as the Southwest Airlines Shamu 737) for any particular routing you want. This is getting neat, huh?

HP-1408 is just the registration of the aircraft, and is not really that important. It can be displayed in FSX around the AI aircraft, if you turn on that option within FSX.

The "1", is the traffic slider value. The 1 means that the user could have their airline traffic slider set to 1 and this flight plan entry would still appear in their sim. If you set the value to 100, then the user would need to have their airline traffic slider set to 100 (full right) get the AI flight to appear. In this way, you can control how "busy" your traffic bgl file is.

ONE_WEEK defines the time period over which the flight plan runs. The SDK lists all of the values.

IFR is telling TDBB that it is an IFR flight plan. I think this also tells FSX which traffic slider our traffic bgl will be sensitive to. For IFR, the airliners traffic slider controls the granularity of the bgl. For VFR, I'm thinking the GA traffic slider will govern...but then as you can tell, I have not experimented with that. I use all IFR flight plans for my AI, even if it is a light GA aircraft doing circuits around my home field.

The part of the text between the curly brackets is the nitty-gritty. These are the flight plan data entries. And these are confusing as heck at first. The SDK explains them, in its cryptic way...I'll try to do better.

You code this yourself, in your text editor; you will obviously be looking off your real-world schedule data that you obtained. Let's go into each line:

01400,MNBZ,170,0010

^
the zero is the DAY OF THE WEEK of our plan (since our plan is weekly). 0 = Monday, 1 = Tuesday, ...6= Sunday.

1400 is the TIME OF DEPARTURE of the AI aircraft. This is 24 hour GMT time. So for Nicaragua, 14:00 hours is 8:00 a.m. It takes some getting used to to code in GMT but it pays off in the end.

MNBZ is the DESTINATION airport of the plan. You might ask, "Where is the departure airport?", well, it is the previous airport entry in the plan. Next, you ask, "But this is the first entry. There IS no previous entry!" Yes, there is. The plans are "circular" in that the previous entry is the last entry in the flight plan. In this case, the last line in the plan, which is:

61525,MNMG,160,0011

A plan that departed MNBZ (the PREVIOUS entry to the above entry) on Sunday (the "6" day), at 15:25 gmt.

Getting back to the description of the flight plan data, the 160 value in the above, is the ALTITUDE at which you want your AI aircraft to fly. 160 = 16000 feet. 320 = 32000 feet. 90 = 9000 feet. Be sure to put in a value here that your AI aircraft model can actually fly. Don't put 320 for a Piper Cub. It will never make it. Also keep in mind that TDBB checks to see if there is terrain near the intended routing of the AI. If there is, it will warn you when you're compiling your plans...but it will KEEP your flight plan...it will simply adjust the altitude upwards to what it considers min safe altitude.

0011 is the flight number of that particular leg in the flight plan. This value doesn't mean anything, but if you know the value (from real world schedules) then why not use it? This data value will appear in the Traffic Explorer if you have that installed into your FSX.

So...where does this leave us? We enter as many flight plans as we want into our text file, and we save it as sne_schedules.dat.

Now, we get to COMPILE our traffic bgl file!
 
Putting it all together...

Now, we'll put it all together. So far, you have:
1) defined your airports
2) defined your aircraft
3) defined your flight plans

And now you have your three custom text files, and you're ready to actually compile all of this using the SDK tool called TrafficDataBaseBuilder (TDBB).

I will go through (briefly) how to use TDBB, and what its common error messages are. The SDK doesn't really get too detailed on this aspect of it.

Please FOLLOW THROUGH in the Traffic Toolbox SDK docs. I assume you have at least glanced over it...

TDBB is a command-line tool. Open a DOS Box (Command line) in your working directory. You should have the file TrafficDatabaseBuilder.exe in there. If you do not, copy it in there now (from your SDK Traffic Tools dir). **

(** Techie note: I actually have a PATH statement (set an environment variable) to my Traffic Tools dir, so that I don't need to copy the file everywhere.)

In your dos box, type the following command at the prompt:
trafficdatabasebuilder /Output=traffic_sne.bgl /Airports=sne_airports.dat /AircraftTypes=sne_aircraft.csv /Countries=countries_regions.csv /Schedules=sne_schedules.dat /Autoschedule=no /StatsDir=G:\TEMP2

The last switch /StatsDir, tells the compiler where to put log files. This can be any valid path on your rig, but just make sure it exists. TDBB puts some useful files in there which I will briefly mention later in this post.

Now, you may be saying to yourself, (or maybe out loud if you talk to yourself) "That is a lot of junk to type!". Yes, it is. That's why I keep a little text file called notes.txt in my working dir, and in that file I type out that command line, so that I can COPY AND PASTE it into my dos box command line very quickly and easily. I don't like typing big long command lines, either.

After you type the command line above, and hit ENTER, all sorts of things will happen. You might get an error message, and compiling will instantly stop. Or, you might get it to partially compile, and all sorts of numbers and things will whizz by on your screen.

Bottom line, 99% of the time, it will NOT compile successfully on the first run. Don't yell at your dog if this happens...because you will get errors.

Usually they are easily fixed. The error message will give you a LINE NUMBER of where it encountered the error. This is important because it tells you which line number in your sne_schedules.dat file where the problem is. If you have a nice text editor (not notepad) it will display line numbers for you...you will want this feature in your text editor to troubleshoot plan errors.

Most commonly, you'll get a "Not enough parking at MNMG for La Costena C208!" error message.

Resolution: Go to your sne_airports.dat text file, and add some more parking entries ("faking TDBB out" as I mention in the earlier post on the airports file). Even if you have AFCADs with plenty of parking, you may need to do this, because TDBB isn't looking at your AFCADs (see the earlier post on airports).

One side note that I forgot to mention in the airports post, was on PARKING radius sizes. You need to know what size parking in meters your aircraft needs, because TDBB will indeed check these values to make sure they are the right size. Reggie Fields made a nice list of FSX half wing span values that he posted on ProjectAI one time.

Cessna 208 Caravan 8.0m
Shorts 360 14.0m (or is it 13.0m?)
CRJ 15.0m
Boeing 737 18.0m
Airbus A318/A319/A320 18.0m
Boeing 757 23.0m
Boeing 767 24.0m
DC-10/MD-11 26.0m
Boeing 747 33.0m

Thus, if TDBB says, "not enough parking at MNMG for La Costena C208", we would insert some lines

PARKING,8.0,GATE

into our sne_airports.dat text file, under the MNMG entry. Put more in if it still gives you the error.

Another common error message is "Can't find airport MNCI". Here the compiler is telling you that you don't have an airport defined. Again, you go to your sne_airports.dat file and make sure you have MNCI (Corn Island) airport defined in there.

Another error message you may see is "Adjusting altitude from FL12 to FL15!". This means that TDBB has determined that the route flies over high terrain and it has raised the altitude higher than what you specified in your flight plans text file. This message doesn't mean the plan was thrown out...it simply means the compiler adjusted altitude. To avoid this error message, go into your sne_schedules.dat file and adjust the altitude upwards of that particular plan.

After many trials and errors, you will eventually get a working flight plan bgl!
 
I hope that wasn't too long-winded. Three text files and a compiler, and that's all there is to it.

Feel free to ask questions, and we can even switch over the above example (La Costena Airlines) to use STOCK AIRCRAFT so that you can follow it along that way. (I used my own repaint of the stock C208, and my repaint of Henry Tomkiewicz's Shorts 360).
 
This was fantastic!!!!! thank you Mace!!!! you're the best!!!

I get this error message: error: Unable to open country data in countries_regions.csv

what shall I do?
 
Hi Mace,
Thanks a lot for your AI tutorial.
We were waiting for a piece like this...as said before "people will be naming their children after you!":)

Regards
Bert
 
I TRIED THAT AND THIS IS WHAT HAPPENDS I CANT GET AN OUTPUT TRAFFIC.BGL FILE MINE BEING OUTPUT=TRAFFIC_QFA.BGL


Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\USER>trafficdatabasebuilder /Output=traffic_QFA.bgl/ AI
rports=QFA_airports.dat /AircraftTypes=QFA_aircraft.csv /Countries=countries_reg
ions.csv /Schedules=QFA_schedules.dat /Autoschedule=no /StatsDir
'trafficdatabasebuilder' is not recognized as an internal or external command,
operable program or batch file.

C:\Documents and Settings\USER>

REGARDS ADAM
 
Might I suggest that you try "Aisort" it can build flight plans from scratch and it shells to TDDB to compile them.
It's not the easyest prog to use but it works well once you get the hang of it.

Regards Frank
 
hi frankie,
is there surposta be a folder in fsx called fs tools?

im still having trouble getting tools on my menu bar in fsx so i can do airport list dump at the momment i have no traffic tools in menu of fsx but followed a previous thread on this one and still have no luck so at the momment i cant use aisort.
regards adam
 
I TRIED THAT AND THIS IS WHAT HAPPENDS I CANT GET AN OUTPUT TRAFFIC.BGL FILE MINE BEING OUTPUT=TRAFFIC_QFA.BGL

REGARDS ADAM

Hi Adam,
This TRAFFIC_QFA.BGL file is the one you need.
Please put is in the map:
FSX\Scenery\World\scenery and when your inputfiles were okay you will now see traffic at your choosen airport.

Good luck!
bert
 
I hope that wasn't too long-winded. Three text files and a compiler, and that's all there is to it.

Feel free to ask questions, and we can even switch over the above example (La Costena Airlines) to use STOCK AIRCRAFT so that you can follow it along that way. (I used my own repaint of the stock C208, and my repaint of Henry Tomkiewicz's Shorts 360).

Hi Mace,

I have used your long-winded:) tutorial and without to big problems i produced a traffic_x.bgl however no traffic result at the airports involved, and also no error or any logfile in /StatsDir=D:\TEMP2:confused:
Any hint for me? Is there any way to check the plans produced by the database as done during the TTools-days?
Thanks in advance.
Bert
 
Back
Top