Authorship NoteEdit

This tutorial guide was originally posted by Skipper on his blog at on December 12, 2013. This was copied with his permission.


YSFlight uses a file called a .fld file, or field file, for its maps. These files are made up of sub-components, such as objects and terrains (There are more, but I would be here all day). Now, most of YSFlight is a pretty simple code, the planes use polygons and vectors that if you feel like it, you can modify with notepad…

The field files are the same. One of the components of the field file is a terrain (.ter)  file. Your field file can have many of these .ter files inside it, and these are the bits I’m trying to modify.

So, the terrain file is pretty simple structure wise:

The top of the code looks like this:

NBL 401 401

TMS 50 50

TerrMesh just says what it is. NBL 401 401 gives the number of rows and columns, so 401 rows and 401 columns. (It can be any number really, and usually they’re much smaller)

TMS gives the sizes of the squares, so 50/50 (Not sure if the units are ft or m, I think m) – So they’re 50x50m square, each cell.

Then comes the data, it begins with “BLO” then the elevation, then… some other details that I dont understand.. Colour is one of the tags following.. For this project though, all I need is the elevation.

Here is one bit:

“BLO 65 R 1 46 112 10 1 46 112 10”

This says that the vertex is 65m up.

So, now comes the good bit… I use a program called ArcMap, its an industry standard piece of GIS software. One of the functions of ArcMap is the ability to export a Raster Digital Elevation Model (Which is basically a picture where darker places mean lower height, lighter places mean higher height) into an ASCII file. The beginning of the ASCII file looks like this: ncols 401   //Number of Columns

nrows 401           //Number of Rows

xllcenter 460000    //The location of the square

yllcenter 520000    //Also location

cellsize 50         //Size of the cells

Now, with the comments I added, you can see the data contained is very similar to the beginning of the terrain file, contains number of columns, rows and the cell size. The rest of the data is also quite helpful. The rest contains heights separated by a space, for example:

20.0 21.0 21.0 20.0 21.0 21.0 21.0 22.0 22.0 23.0 23.0 23.0 24.0 24.0 24.0

  (Thats a pretty flat bit of land) Each new line is a new row in the grid, and each space is a new column.

My coding ability is a bit rubbish… I could’ve probably written a script that simply converted this.. but I’ve no idea where I’d even start, so instead I used notepad++ and excel.

Firstly I opened the ascii file into Excel, it thinks its a CSV file, so I tell it the data is separated by a space, and it makes a nice table where each value is in a different cell, then each row is the length of the number of columns it should be (In my case, 401 columns long, 401 rows high) I then ran an equation below this selecting the first cell that had the height data in (Cell A6):  ="BLO "&A6 &" R 1 46 112 10 1 46 112 10" This formula takes the value of A6, and adds “BLO “ before, and “ R…etc etc” after the height, so you get a full load of cells with the whole data that the .ter file wants!

I copied this all into notepad++. At the end of each BLO section in the .ter file, after every 401 columns, comes a line which just says “BLO 0.00”, so I did a find and replace, finding the new line marker and replacing it with “BLO 0.00” on a new line. I also did a find and replace as each cell, when copied over, is separated by a tab, so I replaced the tab space with a new line. This gives the whole middle section of the .ter file, all that remains is to copy it into the .ter, below the TMS 50 50 section, and above the long list of “BLO 0.00” (401 in fact) that ends the file (before the final END).==Testing== I ran this for a small section of coastline in the UK, Ordinance Survey Grid Square NZ62, around Saltburn. The data came from the OS’ Panorama DTM.

So, I did all this and created a new .ter file. This i imported into Scenery Editor (From The file is huge, 5mb in total, and not really practical for an everyday map being used to fly around in, but it is a technical achievement! Here is the result being flown in YSFLIGHT:

Image thumb-2-

Not hugely impressive I know! 

The only real problem, apart from the big file size, is that the image is back to front, North is South…This could quite easily be modified though if it is a common problem that it flips it around.The data is here:

If you want it. The OS data is crown copyright , details in that link<

Anyways! Fly safe


Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.