3. Simple Construction - A Diesel Loco - Part six


Version 1.1 - 23.Juli 2002

Pivot points

To let all the parts of the loco appear at their right places and let them animate correctly, we have to adjust some pivot points first.

The pivot points of the wheelsets and the coupling rod are on their right places. They must not be moved in any case.

To give the pivot points their right position, we select the Hierarchy toolbox and activate the button Affect Pivot Only. With the Move tool and the Transform Type-In dialog, we move all pivot points to zero (all three coordinates: X, Y and Z), except the pivot points of the wheelsets and the coupling rod. Then we deselect Affect Pivot Only.

Caution!

Should one ore more of the wheels' or coupling rods' pivot points been moved to zero accidently, this can be undone by clicking Center to Object.


The Hierarchy of objects

The MSTS to work properly, must receive the model objects with the correct hierarchy setting and proper part names. On the highest Hierarchy level, the socalled root level, only one object (node) named Main is allowed, otherwise MSTS will crash when loading the object. All other objects, which are called nodes in the terms of the MSTS hierarchy, are to be linked to the Main object.

We select the coupling rod first, activate the Select and Link symbol and press the H key. The Select Parent dialog, which is similar to the select dialog, opens. We select the Wheels2 object and click the Link button. Then, we select all other parts of the loco, except Main, and link them to the Main object the same way.


Now, we press the Select symbol and then the H key. When we activate the Display Subtree checkbox, the Hierarchy should be shown like this:


Now we add some movement

After closing the Select window, we have to do the animation settings. We open the Time Configuration dialog. In the Animation section, we type in the following values:

  • Start Time: 0
  • End Time: 8
  • Length: 8
  • Frame Count: 9

The wheels animation is done in steps called Frames. The animation must be done with nine frames of 45 degrees rotation each. The first and the last position of the wheels are identical. The in-betwees positions are calculated by MSTS itself.

Caution!

It is possible to animate the wheels with any other number of frame count and other degrees of rotation.

I would like to discourage anyone to do that!

With the proper frame count and 45 degree rotations, MSTS needs the wheels radius set in the .eng-file. With another frame count, this value would be due to be changed. This is possible but could seriously affect the behaviour of the loco.


Wheels first...

In the Left viewport, we select the Animation button. The viewports frame turns red. The first animation step (frame 0) is unaltered. We pull the slider on the bottom of the viewport from the position 0/8 to the position 1/8, which means step 1 from 8 (Remember? this is the second frame as we are counting from zero to 8). Then, we select all three wheelsets with CTRL click.

After activating the grid snap tool and the Rotate symbol, we slowly draw the mouse downwards from the center of the wheelset wheels2. All three wheelsets should rotate now. We draw until the Z value reads 45 degrees.

Caution!

The coupling rot is linked to the center wheelset, and therefore it will follow the rotation. That's allright. We will correct it later.


Then, we draw the animation slider to the 2/8 position and rotate the wheels another 45 degrees.


We repeat this step with all the slider positions...


...until we reach to the starting position again.


Now, we draw the animation slider back to the 1/8 position and select the coupling rod. It will be rotated by -45 degree at each of the steps. So the rod leaves its horizontal attitude.


When finished, we deactivate the animation button. With the animation slider, we can watch the whole animation.


Preparing the export to MSTS

For our loco, we use the files of MSTS' GP38 diesel loco. To do this, we create a new folder named gtd1 in the C:\Program files\Microsoft Games\ Train Simulator\TRAINS\TRAINSET\ folder. From the TRAINSET\GP38 folder we copy the SOUND and CABVIEW folder and the files gp38.eng and gp38.sd to our new gtd1 folder. Make shure not to move the files accidentally.


Now, we rename the file gp38.eng into gtd1.eng and the file gp38.sd into gtd1.sd. With a unicode editor (Notepad in W2k or otherwise WordPad) we open the file gtd1.sd and change the entries in the third and seventh row as follows:

  • shape ( gtd1.s
  • ESD_Bounding_Box ( -1.5 0.3 -5.5 1.5 4.8 5.5 )

The shape entry gives the name of the shape file. This is the file containing the 3D-data. We know this file by its .s extension. The ESD_Bounding_Box entry descibes a square araund the loco with contains among others the collision detection data. The values from left to right are:

  • -1.5 left side
  • 0.3 lowest part. This value has to be above the rail level.
  • -5.5 rear end, useful to tweak the distance towards other wagons.
  • 1.5 right side
  • 4.8 height
  • 5.5 front

Then we save the file.


In the physics file gtd1.eng, we change the following entries as shown:

  • WagonShape ( gtd1.s )
  • Engine ( gtd1
  • Wagon ( gtd1 )
  • Name ("gtd1")
  • Description (
    "gtd1 - Diesellok from Volker M. Bollig's GmaxTutorial"
    )

The lines are spread all over the file. Be careful. Die Zeilen sind in der gtd1.eng-Datei weit verstreut.

Caution!

The brackets have to be set as shown above. Then we save the file and copy the gtd1.ace file into the C:\Program files\Microsoft Games\ Train Simulator\TRAINS\TRAINSET\gtd1 folder


Making the loco visible.

To make the loco visible, MSTS has to know which polygones are to be loaded into the graphics memory. At greater distances, not all polygones of a loco can be seen at all. Therefore it ist not necessary to load and calculate them. That would lead to the MSTS' HD loading hangup for a few seconds in the worst case. We load big parts in the distance of 1000 meter and the other parts step by step when the loco gets nearer:

  • main, body and chassis at 1000m
  • roof at 500m
  • wheels at 200m
  • coupling rods and bumpers at 50m

This is done with the Level of Distance manager Trainsim 1 LOD Tool which can be found in the Train-Simulator menu:


First, we select the whole loco and click the Plus sign in the LOD tool. In the LOD-Distance field, we type the value 50.


Then we repeat these steps with the values 200, 500 and 1000. The LOD tool's status bar should read Level 4 from 4.


Now, we have to show MSTS which planes (faces and polygones) are to be loaded at which distance level. In most cases, the loco will be loaded while outside of our visible range. Then, getting nearer, more and more polygones are to be loaded and displayed. Driving away from us, more and more polygones have to be hidden. This is out point of view for the LOD manager.

Though we take the case of the nearest approximation first. That is 50 meters. In this case all polygones are to be calculated and displayed. Therefore, we need not change the 50 meter LOD settings.

We select the 200 meter level with the arrows


Here we hide all polygones not to be visible in a distance of more than 200 meters. In our case, these are the polygones of the coupling rods and the bumpers. One by one, we select the objects and delete the polygones in Polygone selection mode.

Caution!

In no case delete any object! Delete polygones only!

In the next image, we don't see the bumpers and coupling rod anymore. But in the Hierarchy field, we can still see the cylinder (bumper) and coupling rod objects.


Switching back to the 50 meter level, we can still see the bumpers and rod.


Now, we select the 500 meter LOD level and with the same method, we hide not only the rod and bumpers but the wheels in addition. That means, the wheels will be visible when they are nearer than 500 meter.


At the 1000 meter level, we hide the roof and the bumper support polygones also.


In the status row we can see, how much polygones are drawn at which level. At 1000 meter, 68 polys are drawn...


...at 500 meters, they are 160 polygones...


...at 200 meter the polygones numbers 592...


...and at 50 meter all 1640 polygones are displayed.


Putting together all non animated objects.

To increase the framerate of MSTS, we can put together all non animated objects. They are still independent objects but they build a matrix in the shape file which can be loaded and animated more quickly by MSTS.

To do this, we select in any LOD-level the objects Chassis, Body Roof and the bumpers one by one and check the Collapse Node checkbox in theSelected Node field.


With File - Export to .S we export the model into our C:\Program files\Microsoft Games\Train Simulator\TRAINS\TRAINSET\gtd1 folder and name it gtd1.s

Don't forget to save the work.


The maiden voyage

To have a ride on our newly built loco, we must create a consist which can be downloaded here. We copy the consist file gtd1_solo.con to the C:\Program files\Microsoft Games\Train Simulator\TRAINS\CONSISTS folder.

In MSTS, we select the gtd1 loco and have a ride.


Congratulation!

Our first loco is running!

Uuuups....

...we forgot the lights. ;-)
But that shouldn't be a problem at all.

The Capter 3, A Simple Diesel Loco is finished. More chapters containing smoothing, transparencies, animated doors and other things are planned for late august 2002.

Questions concerning this tutorial or MSTS object or loco building can be posted to the trainsim.com or uktrainsim forums or sent to me

Have fun


back to table of content