Night Light Effects For FS 2000



By Marco Rensen.
Version 1.2.



Contents:


1. Introduction.
2. Requirements.
3. Step 1, making an aircraft
4. Step 2, converting the aircraft to Scasm source code.
5. Step 3, editing the Scasm source file.
6. Step 4, converting the Scasm source file to an mdl file.
7. Step 5, making textures for the aircraft.
8. Step 6, first flight.

Addendum 1 ,FS Colour table.
Addendum 2 ,how does the Scasm code work?
Addendum 3 ,a quick example.

Credits.


1. Introduction


As you have probably noticed, the engine of FS 2000 works quite different form previous flight simulator versions. And every think new has its advantages and disadvantages and so has the new Z-buffering in FS 2000.
Two to greatest advantages are the elimination of bleed through, and the use of bmp for texturing. This is immediately followed by one of the disadvantages, the disappearance of all night illuminate colour on FS Flight Shop or Aircraft Factory 99 aircraft.
To Bring back this feature, a new set of scenery instructions are introduced, which makes use of all new advantages in the FS 2000 engine. This tutorial is a guide trough the new features and how to (easily) use these feature on aircraft.

Before we start, some boring stuff:


Microsoft Flight Simulator
FS Flight Shop
Aircraft Factory 99
Aircraft Animator
M98toBgl
SCASM
Source2Bgl
Camsim and the Camsim ProMaxLT
Original Fokker 70 model

"Zaat" and the "Zaat Anno 1870" Logo
"Erkende Verhuizers" and the "Erkende Verhuizers" Logo
© Microsoft Corporation
© BAO
© Abacus
© Abacus
© Trevor de Stigter
© Manfred Moldenhauer
© Marco Rensen
© Camil Valiquette
© Project Freeware

© V.O.F. Verhuisonderneming Zaat
© SAVAM


It is forbidden to:

-Sell / publish or print this documentation, without written permission.
-Upload this documentation aircraft to other internet sites, networks and BBS's without my permission
-(I will give permission if you ask).
-Upload this documentation aircraft to other internet sites, networks and BBS's with access costs or
-(other) download costs.
-Use this documentation for commercial purposes without written permission.
-Redistribute this documentation on CD, diskette or any other media.
-Change the contents of the documentation.

I will not accept any responsibility for any damage caused by the use of these files.

2. Requirements.


Here is a list of programs that are necessary to add night light effects to the aircraft:

Required:
-FS 2000
-Aircraft Factory 99 or FS Flight Shop
-M98toBgl v3.40 or higher
-Scasm v3.39 or higher.
-Source2Bgl

Strongly recommend:
-Aircraft Animator v1.2
-An advanced graphical editor like Paint Shop Pro or Photoshop.
-A good mood and lots of patience.

3. Step 1, making an aircraft.


Ok, let's start. Before you start making or editing an aircraft, realise which parts / textures you want to be illuminate at night. The most common parts are the fuselage and the tail.
For we are going to edit the source code of the aircraft you want to make, it is advisable you can easily identify the parts / textures you want to be illuminate. There are to ways to identify them, one by checking the corresponding ?af file, or to mark the parts with a unique colour, let's say yellow (I will use the yellow colour form this point). If you already have used this colour, take another unique colour. Addendum 1 contains the FS colour codes.
Now the aircraft is finished, let's produce it and (if necessary), convert it to FS 2000.

4. Step 2, converting the aircraft to Scasm Source code.


Now we are going to convert the aircraft to Scasm source code, so we can edit the aircraft and add the new features. The converting is done by M98toBgl. This is how to proceed:

The first time you use the program, a screen appear asking for some directories. Enter:

-Aircraft Directory
-Airport API Files Directory
-Abacus ASD Scasm Macros Directory
-Scasm Source Files Directory
-Scasm Directory
-Default Scenery Directory
= ..\Fs2000\Aircraft directory
= Don't care, we don't use it, enter anything you like.
= Don't care, we don't use it, enter anything you like.
=..\Scasm239 directory
=..\Scasm239 directory
=..\Fs2000\Scenery directory


Now, a new field appears. Press MDL and select an Aircraft. Make sure the mdl is an mdl without moving parts. M98toBgl can read a moving part mdl, but can't save it the way we want.



Now we have arrived to this screen. There are several ways to save the source file, but we choose scx (unedited Scasm source file). The other options lead to lose of data and that is the last thing we want.
Press scx and on the right side a new field appear.



Save the file as .wri and not .scx. This makes editing easier.
Now exit M98toBgl.

5. Step 3, editing the Scasm source file.


Now the real thing is starting. At this point we are going to edit the Source file. Let's start searching for the marked parts. This can be done by either search for:

...... Bitmap( Name.ext 0 0 0 0 )

Where Name.ext is the name of the ?af file corresponding to the part you want to be illuminate, or search for:

...... 09 F0

This is the colour code for yellow.
If everything is ok, you should find these two lines:


...... ShadedColor( 09 F0 )
...... Bitmap( Name.ext 0 0 0 0 )

Delete those two lines and replace it with:

...... LoadBitmap( 0 L1 EF 255 255 255 Bitmap_name.bmp )

This is new command that makes illuminate texture possible.
The Bitmap_name is the name of the daytime (normal) bitmap, e.g. Fuse1.bmp.
The Bitmap_name_LM is the name of the corresponding night (illuminate) bitmap, e.g. Fuse1_LM.bmp.
This command does the following:
At daytime the Bitmap_name.bmp is loaded, at night the Bitmap_name_LM.bmp is loaded.

Ok this is nice for tails and windows, but what about landing lights, lights that only appear between certain speeds or combinations of these display conditions?
Also for this part, there is a solution.
We are going to add landing lights to this aircraft. Go to the part(s) you want to equip with this feature and delete the Surface and Bitmap command. Paste in the empty space:

...... IfVarAnd(:Else_x 76 1 )
............ LoadBitmap( 0 L1 EF 255 255 255 Bitmap_name_LL.bmp )
............ Jump(:End_x )
...... :Else_x
............ LoadBitmap( 0 L1 EF 255 255 255 Bitmap_name.bmp )
...... :End_x

For this is the first part, replace the x with 1 ( the second part 2 etc.).

For daytime:
The Bitmap_name.bmp is the name of the daytime bitmap when the lights are off.
The Bitmap_name_LL.bmp is the name of the daytime bitmap when the lights are on. (In most cases the same as the Bitmap_name.bmp).

At night:
The Bitmap_name_LM.bmp the night bitmap for lights off.
The Bitmap_name_LL_LM.bmp the nighttime bitmap for lights on.

Note: _LL can be changed in anything you like.

Very nice, isn't it? But can we make more complex display conditions?
Yes we can, as a matter of fact, we can a linear combination of any display condition. How it works?
Very simple, let me explain it with this example. We want the landing light to be visible only between 0 and 250 knots. The code we are going to paste is as follow:

...... IfVarRange(:Else_x 7A 0 250 )............;<-Speed between 0-250 knots
...... IfVarAnd(:Else_x 76 1 )..................;<-Lights on
............ LoadBitmap( 0 L1 EF 255 255 255 Bitmap_name_LL.bmp )
............ Jump(:End_x )
...... :Else_x
............ LoadBitmap( 0 L1 EF 255 255 255 Bitmap_name.bmp )
...... :End_x

So now we can make every linear combination of display conditions we like.
Here a list of some important ones:

IfVarAnd..(:Else_x 76 1).................Light on (L-key)
IfVarAnd..(:Else_x 72 1).................Light on (Ctrl+L)
IfVarAnd..(:Else_x 78 1).................Strobes on
IfVarRange(:Else_x 7A min max)...........Speed between min and max knots
IfVarRange(:Else_x 74 min max)...........RPM between min/164.45 and max/164.45 RPM
IfVarRange(:Else_x 6E -12288 0 ).........Gear down
IfVarRange(:Else_x 6C 0 16384 )..........Flaps extended
IfVarRange(:Else_x 7C 0 16384 )..........Spoilers extended

Now repeat this for all the parts you have marked. You can use different display conditions (or none at all) for every part.
Save the file, when you are ready.

If want to know you the code works this way, please read the Addendum 2. It is not necessary to understand it.

Note: DO NOT FORGET TO CHANGE THE :ELSE_X AND :END_X FOR EVERY PART. IF YOU FORGET IT, OR USE DUPLICATE LABELS, SCASM WILL GENERATE ERRORS.


To visualise what I just wrote, there is a quick example. This shows how the source file was altered to get light effects on the ProMaxLT Boeing 777-200.
If you want to edit a source code by yourself, it is advisable to follow the lesson "My first night textures Fokker 70"). This will guide you through the process of adding light effects on a Fokker 70.

6. Step 4, converting the Scasm source file to an mdl file.


Now the time has come to generate the mdl file. Basically you have to copy some parts of the by Scasm generated bgl file to the mdl file. Because many people have difficulties with using a hex editor, I have made a program that does the converting for you.
Start Source2Bgl. Make sure that the following files are in the same directory:
-Data.dat
-Bgl2Mdl.exe
-Scasm.exe
-The Scasm source file

Enter on the first line the name of the Scasm source file (the file you have edit), usually .wri. Enter on the second line the name of the output mdl file, usually .mdl.
If you press on convert, the mdl file is created. If everything has gone the right way, Scasm will report that the compilation is ok. If not, it will generate an error. Look in the Scaerror.log to figure out what has gone wrong. Most errors are due to spelling error and are easily to correct. Look also in the troubleshoot section for solutions to some of these errors.



7. Step 5, making textures for the aircraft.


This section will discuss how to make textures for the aircraft. I can't go very deeply into the subject because there are a large number of paint programs, and I can't discuss them all. Here some general tip's. For Paint Shop Pro and Photoshop users, there are some tips in the tips and tricks section.

All textures you have include with the LoadBitmap command should be in bmp format. For all other texture you can still use the old ?af format.
There should be no problem making the textures for daytime. The real problem starts with the night textures (_LM). In spite of the ?af, these bitmaps aren't darkened at night. This is not the way we want it to be. Only specific parts of the bitmap should be darkened.
This is how to proceed:
-Open the selected bmp in your graphics editor.
-Paste the Night_layer.bmp (included in this package) as a new layer. This layer is used
-by FS 2000 to darken the ?af files at night.
-Set the layer properties to multiply, the bitmap should be darkened now.
-Merge the to bitmaps.
-Make the parts that light up (windows) the colour you want (yellow or so).
-Decrease the colour depth to 256 colours. Use Optimised Octree (Nearest Colour) for best
-results.
Save the texture.

Note: Landing light have a slight different approach, see tips and tricks.

Two things you should always remember:

1. ALWAYS MAKE TEXTURES IN 24-BIT COLOUR MODE, CONVERT IT BACK TO 256 COLOUR ONLY WHEN YOU ARE FINISHED. THIS TO MAKE OPTIMAL USE OF THE COLOUR PALETTE.

2. NEVER USE MS PAINT TO CONVERT THE TEXTURES BACK TO 256 COLOUR MODE.

8. Step 6, first flight.


When all textures are ready, it is time to look at the result. Copy all the textures to the \texture directory, and copy the generated mdl to the \model directory. It is wise to make a backup of the original mdl file.
Start FS 2000 and load the aircraft. Set time and season to dusk or night to see the night effects.

If everything is ok, you can add moving parts to the plane, if you like. It is recommended to use Aircraft Animator 1.2 (free registered users), because this version can handle the new Scasm commands.
Start FS 2000 and look if everything is working. If it does, the plane is ready.


Addendum 1 ,FS Colour table.


00 F0 = Black
01 F0 = Dark Grey
02 F0 = Grey
03 F0 = Light Grey
04 F0 = White
05 F0 = Red
06 F0 = Green
07 F0 = Blue
08 F0 = Orange
09 F0 = Yellow
0A F0 = Brown
0B F0 = Tan
0C F0 = Rust
0D F0 = Olive
0E F0 = Water
0F F0 = [L]Red
10 F0 = [L]Green
11 F0 = [L]Blue
12 F0 = [L]Aqua
13 F0 = [L]Orange
14 F0 = [L]Yellow
15 F0 = [L]White
17 F0 = Dark Red*
18 F0 = Dark Green
19 F0 = Dark Blue
1A F0 = Dark Orange
1B F0 = Dark Yellow
1C F0 = Dark Brown
1D F0 = Dark Tan
1E F0 = Dark Rust
1F F0 = Dark Olive
20 F0 = Medium Red
21 F0 = Medium Green
22 F0 = Medium Blue
23 F0 = Medium Orange
24 F0 = Medium Yellow
25 F0 = Medium Brown
26 F0 = Medium Tan
27 F0 = Medium Rust
28 F0 = Medium Olive
29 F0 = Light Red
2A F0 = Light Green
2B F0 = Light Blue
2C F0 = Light Orange
2D F0 = Light Yellow
2E F0 = Light Brown
2F F0 = Light Tan
30 F0 = Light Rust
31 F0 = Light Olive
32 F0 = [L]Dark Grey
33 F0 = [L]Grey
34 F0 = [L]Light Grey

*For some reason, FSFS skips 16 (22 decimal). If you try it, you will find that it's [L]White, like number 15. Remember that the [L] in front of a number means that the colour is bright at night.
You may also experiment with other numbers from 35 to FF (53 to 255 decimal). The numbers 74 - 7F (116 to 127 decimal) are all bright at night.

Form the documentation of MDLVUE, © Chuck Dome 1999.

Addendum 2, how does the Scasm code work?


Note: This is explanation only, it is not necessary to understand this...

Let's say we want this:
-No light textures at day.
-Light textures at night, but only when lights are on.
-Light textures at night, but only when the speed is between 0 and 250 knots.

To fully understand this, we look at a new Scasm command, LoadBitmap. This command loads a bitmap, depending on the parameter set. The used L1 indicate night/day switch. So at day the .bmp is loaded, at night the _LM.bmp.

Ok look at this piece of code:

...... IfVarAnd(:Else_1 76 1 )
...... IfVarRange(:Else_1 7A 0 250 )
............ LoadBitmap( 0 L1 EF 255 255 255 Fuse1_LL.bmp )
............ Jump(:End_1)
...... :Else_1
............ LoadBitmap( 0 L1 EF 255 255 255 Fuse1.bmp )
...... :End_1

It starts with an IfVarAnd command, which means in this case, if lights (76) are on (1) go to the next line, otherwise go to Else_1.

Let's assume the lights are on, the code will proceed to the next line and finds the IfVarRange command.
This means that if speed (7A) is between 0 and 250 knots go to the next line, otherwise go to Else_1.

Again let's assume we are taxing on this moment. FS 2000 jumps to the next line and find the LoadBitmap This command loads the Fuse1_LL.bmp at day, the Fuse1_LL_LM.bmp at night. This command is followed but the Jump, which jumps to the end of the code.

So if the lights are on at day, and the speed is between 0 and 250 knots the Fuse1_LL.bmp is loaded. No night effects.
If the lights are on at night, and the speed is between 0 and 250 knots the Fuse1_LL_LM.bmp is loaded and we get night effects.

In this case FS 2000 follows the blue path:

...... IfVarAnd(:Else_1 76 1 )
...... IfVarRange(:Else_1 7A 0 250 )
............ LoadBitmap( 0 L1 EF 255 255 255 Fuse1_LL.bmp )
............ Jump(:End_1)
...... :Else_1
............ LoadBitmap( 0 L1 EF 255 255 255 Fuse1.bmp )
...... :End_1

Now let's see the code is also correct when the lights are off, or when the speed is over 250 knots.
The code will jump to the :Else_1, which is followed by the LoadBitmap command.

Now the Fuse1.bmp is loaded at day, the Fuse1_LM.bmp at night

The code follows the following path (lights off, no matter which speed):

...... IfVarAnd(:Else_1 76 1 )
...... IfVarRange(:Else_1 7A 0 250 )
............ LoadBitmap( 0 L1 EF 255 255 255 Fuse1_LL.bmp )
............ Jump(:End_1)
...... :Else_1
............ LoadBitmap( 0 L1 EF 255 255 255 Fuse1.bmp )
...... :End_1

Or (lights on, speed over 250 knots):

...... IfVarAnd(:Else_1 76 1 )
...... IfVarRange(:Else_1 7A 0 250 )
............ LoadBitmap( 0 L1 EF 255 255 255 Fuse1_LL.bmp )
............ Jump(:End_1)
...... :Else_1
............ LoadBitmap( 0 L1 EF 255 255 255 Fuse1.bmp )
...... :End_1


Addendum 3, a quick example.


Ok, I must admit that at first sight, all this Scasm code looks very complex. So with this example I try to make things easier.

Open the 772ProMaxLT.wri (Select open from current location).
Search for "Old Code". You will find the code that was in the original source file. Under the "New Code" you will find the new code that generate the night light effects.
While you are reading the code, please pay attention to the label numbers (Else_x,End_x).

Other parts of the code that might be interesting:
-Fuselage 1 and 2 (search for fuse1.bmp, fuse2.bmp)
-Engine 1 and 2 (search for eng1.bmp, eng2.bmp)


Credits.


Here I want to thank everybody who helped me the last couple of moths, searching for a way to get the night effects back to FS 2000.
I want to thank Camil Valiquette in special for letting me use one of his aircraft to test some theories about light textures. Also thanks for the suggestions and beta testing the tutorial and Source2Bgl.

Other persons I want to thank:
-The Freeware Works

-Chuck Dome
-Thomas Diderich
-Everybody else I forgot to mention
For all questions and errors they encountered went using the
(beta) tutorial.
For using a part of his documentation.
For all his help in the past.



This documentation was made by Marco Rensen.
For questions and suggestions, please mail me:
M.J.M.Rensen@student.tn.tudelft.nl or
mrensen@dds.nl or
mrensen@xs4all.nl

© 2000 Marco Rensen
The Hague
The Netherlands