[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4752: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4754: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4755: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4756: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
FMS Forum • View topic - Unofficial FMS Landscape programming Manual

Unofficial FMS Landscape programming Manual

Unofficial FMS Landscape programming Manual

Postby KEW » Thu Mar 04, 2010 6:22 pm

FMS Landscape Programming

The Landscape:

The landscape portion of the program consists of three separate pieces:
• The Contour map
• The ground scenery
• The sky

The Contour Map:

The contour map is a 256 grey scale square bitmap.
The lowest elevation is white which is at zero.
The highest elevation is black which is at a height of 64 meters.
Each of level of grey is an increment of 0.25 meters.

Image

The contour map is entered using the statement: 3D_LANDSCAPE Filename
“Filename” is the name of the contour bitmap file and must not contain any spaces.

The Ground map:

The ground map is square. Its size is specified using the command:
SCENE xxx yyy zz
xxx is the distance in meters from the center of the field to any side.
yyy is the size of each square of ground scenery in the map.
zz is the length of the slope of the ground between contours on the contour map. The minimum value is related to the size of the scenery squares. This minimum can vary between different types of computer. Fairly safe values for the minimum are:

50 .Min 5
100 Min 10
200 Min 20

The scenery squares are placed on the contour map using the command:
QUADRANT xx yz filename
xx refers to the grid location on the contour map, 00 is the South West corner square. 01 is the next square East of 00

Image

yz refers to the number of successive sequential squares that use the specified bitmap.
e.g. “QUADRANT 00 13 Grass” would place the Grass bitmap in grid locations 00, 10 and 20
“filename” is the name of the scenery bitmap file for that map square. The size of the scenery bitmap files must be a power of 2, e.g. 256 x 256 or 512 x 512. The practical maximum limit is 2048 x 2048. The minimum size is governed by the minimum resolution required in your scenery. The filename must not contain any spaces.

The Sky:

The sky is specified using the command:
SKY xxx yyyy filename
xxx is the height in meters of the sky bitmap
yyyy is the length in meters of each side of the sky bitmap
“filename” is the name of the sky bitmap.

The sky is a square bitmap picture. Its size is a power of 2 (usually 256 x 256 x 256 colours)

The Plane and Pilot:

Once the scene has been defined, the position of the plane and pilot must be specified using the commands:
AIRCRAFT_POSITION xxx yyy zz
PILOT_POSITION xxx yyy zz
xxx is the distance North (positive) or South (negative) of the center of the field.
yyy is the distance West (positive) or East (negative) of the center of the field.
zz is the distance in meters above the ground level. Typically the plane would be at 0 and the pilot’s level of vision would be at 1.7
On startup, the plane always faces West (270 Degrees)

AIRCRAFT_POSITION xxx yyy zz FIXED disables the numeric view keys. This is useful in panoramic scenes to keep the pilot’s point of view in one place.

Changing Mode:

Once the scene has been established the following two commands are used to change the programming mode to enable three dimensional objects to be placed on the scenery.

DIM3
QUADS

An example program:

SKY 300 5000 Mysky
3D_LANDSCAPE Mycontour
SCENE 500 200 20

QUADRANT 00 15 Rocks
QUADRANT 10 15 Grass
QUADRANT 20 12 Grass
QUADRANT 22 11 Runway
QUADRANT 23 12 Grass
QUADRANT 30 15 Grass
QUADRANT 40 15 Rocks

AIRCRAFT POSITION 0 0 0
PILOT_POSITION 5 0 1.7
DIM3
QUADS
END

Image

This program would produce a 1000 meter square scene with a 5000 meter square sky picture 300 meters above it. The aircraft would be in the middle of the scene with the pilot 5 meters to the North of it. The aircraft always faces West on startup. It would look like the following:

Image

Adding two and three dimensional objects to a scene

LIGHTNING ON (default) turns on natural lighting from high in the East.
LIGHTNING OFF turns off the natural lighting illuminating objects uniformly.

CULL ON Causes two dimensional objects to be visible from one side only. When viewed from the side on which the corner co-ordinates of the object are listed counter clockwise the object will be visible.

CULL OFF: Causes two dimensional objects to be visible from both sides.

POSITION xx yy zz Defines the position of the next object, in meters, relative to the center of the scene. It can contain decimal values for xx, yy and zz.
xxx is the North/South co-ordinate (North is positive, South is negative)
yyy is the West/East co-ordinate (West is positive, East is negative)
zz is the height above the ground level (below ground is negative)

TEXTURE Filename: Defines which bitmap picture will be used to construct the object.

TEXTURE Filename TRANSPARENT Will cause any black pixels in the bitmap to be transparent when plotted on an object. This is useful for placing irregularly shaped objects in the scene without showing the background of the picture.

The “TEXTURE” command is followed by the rectangular co-ordinates of the required portion of the picture and the location where it is to appear in the scene. e.g.:


POSITION 10 6 0
TEXTURE Mypicture TRANSPARENT
0 255 -1 0 0
255 255 1 0 0
255 0 1 0 3.5
0 0 -1 0 3.5

Image

The first two numbers of each five digit coordinate are the horizontal and vertical location of the corner pixel of a quadrilateral in a bitmap picture. These must be positive integers.

The last three numbers are the x (North/South), y (East/West) and z (Height) coordinates of the location of the corresponding corner of the quadrilateral being drawn in the scene. These can be either positive or negative decimal numbers and are in meters.

Three dimensional objects can be made using a combination of two dimensional objects. Triangles can be made by making the first and last coordinates of a quadrilateral equal to the same value.

COLOR
Two dimensional objects can be constructed by using the COLOR statement instead of the TEXTURE statement. This is good for adding single-colour details to 3D objects. This will only work correctly after the command LIGHTNING ON. Because of this, COLOR objects are only visible from one side.

The first statement for the COLOR object must be TEXTURE OFF. (TEXTURE ON must be used after a COLOR object if it is to be followed by a TEXTURE object).
This is followed with:
POSITION xx yy zz
COLOR r g b x y
r: is the red value
g: is the green value
b: is the blue value
These are positive decimal values between 0 and 1

The values for x and y do not appear to do anything. They are probably leftovers from a previous version of FMS but they must be present or an error will occur.

The coordinates for the desired quadrilateral are listed counter clockwise, in the same way as objects using TEXRURE. E.g.:

TEXTURE OFF
POSITION 6 -5 1
COLOR 0.5 0.5 0.5 0 0
0 -3.1 0
0 -3.1 4.3
0 2 4.3
0 2 0

This will create a grey rectangle facing South., 5.1 meters wide, 4.3 meters high and one meter above the ground. It will be located 6 meters North and 5 meters East of the center of the scene. Three dimensional objects can be made using a number of these quadrilaterals.

ALPHA
Objects made using the COLOR command can be made translucent by following with the ALPHA command e.g.

COLOR 0 0 1 0 0
ALPHA 0.5
This will create a translucent blue object. A value of ALPHA closer to 0 will make it more transparent while a value closer to 1 will make it more opaque.

END
All programs must be terminated with an END statement.

____________________________

This is NOT an official FMS Manual. These instructions have been established using trial and error. There may be errors. If you find any, please let me know so that they can be corrected. This manual was documented by KEW with much technical help from TreeHugger.

_______________________________
Last edited by KEW on Fri Mar 12, 2010 11:10 pm, edited 4 times in total.
User avatar
KEW
 
Posts: 161
Joined: Sat Aug 08, 2009 3:53 pm
Location: Ontario, Canada

Re: Unofficial FMS Landscape programming Manual

Postby KEW » Tue Mar 09, 2010 11:19 pm

Flight Model Simulator Landscape Programming Guide
For Version 2 Alpha 8.5

Memory Limits

The area of video memory that is allocated by FMS is limited. It contains 36 squares.
These squares of space are used by ground tile bitmaps and object bitmaps. These squares are not used by the contour map (“Heightdist.bmp”), the sky (“Sky.bmp”) or objects constructed using the COLOR command.

It makes no difference to the available video space whether the ground tile and object bitmaps are 256 x 256 pixels x 256 colours or 4096 x 4096 pixels x 24 bit colours – the limit is still 36 squares. This limit appears to be independent of the size of the map tiles and the size of objects projected in the scene. If the higher resolution bitmaps are used with older video interface cards, there is a possibility that the available video RAM may be exceeded but this has not been experienced yet. Using higher resolution bitmaps can also slow down the operation of the flight simulator program, especially when flying very large, detailed planes.

Making the best use of available memory:

Use bitmaps larger than 256x256 for better resolution of detail on the ground bitmaps and object bitmaps. The only effect this will have on the program is to increase the time taken to load the field.

On the ground map, each time a bitmap is called, one of the available memory squares is used up. E.g.:

SKY 400 4500 SKY5
3D_LANDSCAPE CONTOUR

SCENE 150 100 20

QUADRANT 0 0 1 1 GRASS
QUADRANT 0 1 1 1 GRASS
QUADRANT 0 2 1 1 GRASS

QUADRANT 1 0 1 1 GRASS
QUADRANT 1 1 1 1 GRASS
QUADRANT 1 2 1 1 GRASS

QUADRANT 2 0 1 1 GRASS
QUADRANT 2 1 1 1 GRASS
QUADRANT 2 2 1 1 GRASS

AIRCRAFT_POSITION -0 0 0
PILOT_POSITION -3 0 1

DIM3
QUADS

END

This program would use up nine squares of memory because “Grass.bmp” was called up nine times. To optimize this part of the program it could be re-written:


SKY 400 4500 SKY5
3D_LANDSCAPE CONTOUR

SCENE 150 100 20

QUADRANT 0 0 3 3 GRASS

AIRCRAFT_POSITION -0 0 0
PILOT_POSITION -3 0 1

DIM3
QUADS

This would only use up one memory square because “Grass.bmp” was only called up once. If a different bitmap is needed to show the runway or other detail, the effective way to do this would be:

SKY 400 4500 SKY5
3D_LANDSCAPE CONTOUR

SCENE 150 100 20

QUADRANT 0 0 3 1 GRASS

QUADRANT 1 0 1 1 GRASS
QUADRANT 1 1 1 1 RUNWAY
QUADRANT 1 2 1 1 GRASS

QUADRANT 2 0 3 1 GRASS

AIRCRAFT_POSITION -0 0 0
PILOT_POSITION -3 0 1

DIM3
QUADS

END

This will use up five memory squares – four calls for “Grass.bmp” and one for “Runway.bmp”.


Programming Objects:

If an object bitmap is used it will use up one video memory square each time it is called up. E.g. :

CULL OFF
//Tree 1
POSITION 100 0 0
TEXTURE ASPEN1 TRANSPARENT

255 0 -5 0 12.8
0 0 5 0 12.8
0 255 5 0 0
255 255 -5 0 0

255 0 0 -5 12.8
0 0 0 5 12.8
0 255 0 5 0
255 255 0 -5 0

//Tree 2
POSITION 100 10 0
TEXTURE ASPEN1 TRANSPARENT

255 0 -5 0 12.8
0 0 5 0 12.8
0 255 5 0 0
255 255 -5 0 0

255 0 0 -5 12.8
0 0 0 5 12.8
0 255 0 5 0
255 255 0 -5 0

//Tree 3
POSITION 100 20 0
TEXTURE ASPEN1 TRANSPARENT

255 0 -5 0 12.8
0 0 5 0 12.8
0 255 5 0 0
255 255 -5 0 0

255 0 0 -5 12.8
0 0 0 5 12.8
0 255 0 5 0
255 255 0 -5 0

END

This part of the program will use up three video memory squares – one for each time the “Aspen1.bmp” was called. A better way to do this is:

CULL OFF
//Tree 1
POSITION 100 0 0
TEXTURE ASPEN1 TRANSPARENT

255 0 -5 0 12.8
0 0 5 0 12.8
0 255 5 0 0
255 255 -5 0 0

255 0 0 -5 12.8
0 0 0 5 12.8
0 255 0 5 0
255 255 0 -5 0

//Tree 2
POSITION 100 10 0

255 0 -5 0 12.8
0 0 5 0 12.8
0 255 5 0 0
255 255 -5 0 0

255 0 0 -5 12.8
0 0 0 5 12.8
0 255 0 5 0
255 255 0 -5 0

//Tree 3
POSITION 100 20 0

255 0 -5 0 12.8
0 0 5 0 12.8
0 255 5 0 0
255 255 -5 0 0

255 0 0 -5 12.8
0 0 0 5 12.8
0 255 0 5 0
255 255 0 -5 0

END

This only calls the “Aspen.bmp” once, so it only uses one video memory square.

If a number of small objects are to be placed in the scene, it is best if their pictures are included on the same bitmap. Then they can all be defined in sequence after calling the bitmap only once.

High Definition Objects:

When objects are mapped into the scene ,the program will only accept a bitmap maximum pixel location of 255, 255 without causing graphic errors. If the bitmap is 1024 x 1024, then pixel 255, 255 will correspond to the sixteen pixels at position 1020,1020 in the bitmap picture.

Placing objects on a slope:

When a slope between contours on the ground map is defined, the slope starts at the edge of the highest contour area and extends down, away from the contour for the distance defined in the "SCENE" statement. When an object is placed in the scene, the zero height of the "POSITION" statement is on the level defined by the grey-scale contour bitmap. The result is that an object placed on a slope becomes partly submerged in the ground. The way to establish the actual zero height of the slope at that point is either by trial and error or to measure it. To do the latter, make a bitmap containing a vertical scale in fractions of a meter. Use a different colour for each ten centimeters of height. When it is placed vertically on a slope, the actual zero height at that point can be read off from the visible portion of the scale.
_______________________________________________________________________________

These limits were established by trial and error. Care was taken to account for as many variables as possible during testing but there may be exceptions that were not accounted for. If you find any exceptions, please inform me and they will be included in this manual.

KEW
User avatar
KEW
 
Posts: 161
Joined: Sat Aug 08, 2009 3:53 pm
Location: Ontario, Canada

Re: Unofficial FMS Landscape programming Manual

Postby phildc » Wed Mar 24, 2010 7:49 am

Good job, Kew !

Did not check every detail, but this document gathers a lot of information that is difficult to find. Thanks for sharing with the community!

Long time ago, I designed a landscape with objects you could fly thru. Could be useful as example.
It is called 'Tour de la mort' = 'Death tower'. You find it in directory JDM-PUBLIC -> LANDSCAPE of



Other items in the zip are related to an FMS challenge organized during 'open doors' at our club in Belgium. Points were also won by passing the shadow of the aircraft on ground targets. Good pilots could also get points by flying 'THRU' the arcade and through the tower (the tower also allows vertical flying !).

Phil.



design fms flight model simulator sim tool objects draw create how to howto tutorial ground manual user lesson
simulateur simu vol avion comment guide tutoriel terrain paysage dessiner creer guide manuel utilisateur cours
phildc
 
Posts: 352
Joined: Fri May 14, 2004 8:57 am
Location: Brussels Belgium - Club: JDM-Nivelles

Re: Unofficial FMS Landscape programming Manual

Postby phildc » Wed Mar 24, 2010 7:59 am

Sorry for the sponsoring of the landscape, they offered the prizes for the challenge. Use the file as an example, and change the bmp's.
Last edited by phildc on Thu Mar 25, 2010 6:10 pm, edited 1 time in total.
phildc
 
Posts: 352
Joined: Fri May 14, 2004 8:57 am
Location: Brussels Belgium - Club: JDM-Nivelles

Re: Unofficial FMS Landscape programming Manual

Postby phildc » Wed Mar 24, 2010 8:11 am

I just tried my 'Death Tower' landscape under Vista. Long time that I did not try it. No objects are visible! Except the general elevation of the ground and hills, but I can fly. Should do some reading in this forum, I think ! ;)

Phil.
phildc
 
Posts: 352
Joined: Fri May 14, 2004 8:57 am
Location: Brussels Belgium - Club: JDM-Nivelles

Re: Unofficial FMS Landscape programming Manual

Postby KEW » Thu Mar 25, 2010 2:16 pm

Hi phildc,

Thanks for your comments. I am surprised no one did this a long time ago!

I tried your "Death Tower" and it ran OK in XP Pro. The invisibility is probably a graphic interface problem.

I managed to fly the Sukhoi SU26 through both ports on the tower an through th 2D bridge - but only by using the Chase Camera. I could not do it from the ground because of the lack of depth perception on the screen.

I will be interested in seeing what you come up with if you try another landscape. I am working on setting up my own home-page so then you will be able to see what I have been playing around with too.

Let me know if you run into any programming problems and I will try to help you solve them.

Regards,

KEW
User avatar
KEW
 
Posts: 161
Joined: Sat Aug 08, 2009 3:53 pm
Location: Ontario, Canada


Return to Landscapes

Who is online

Users browsing this forum: No registered users and 2 guests