JTraffic Screensaver

Composition of a vehicle from phase pictures

\
To depict the moving parts of a vehicle (spoked wheels, valve gear motion, drive rods, etc.) multiple pictures are required, each of which shows a piece or "phase" of the entire motion.  These individual pictures are then combined and shown in rapid sequence so that when the vehicle appears on the screen, the moving parts appear to move realistically relative to the vehicle's progress down the track.  A mathematical formula determines the timing by which the phase pictures are changed so that the changes occur at the appropriate times in keeping with the vehicle's speed on the screen.\
\
The Syntax is:\

<Vehicle> == <BasePicture> || <AnimatedPicture> || <AnimatedPicture>  <StepLength> || <Vehicle>  <Modifier>

<BasePicture> == <OverlayedPicture> ||

<OverlayedPicture>  <  <PictureName> ||

<OverlayedPicture>  >  <PictureName> ||

<BasePicture>  <Modifier>

<OverlayedPicture> == <PictureName> ||

<PictureName>  :  <PictureName> ||

<PictureName>  :  <PictureName>  :  <Simple> ||

<PictureName>  :  <PictureName>  :  <Simple>  :  <Simple> 

<AnimatedPicture> == <BasePicture> || <AnimatedPicture>  <Connection>  <PhasePicture>

<Connection> == + > || + < || + || + * || + <Simple> : || +  <Simple>  :  <Simple>  :

<PhasePicture> == <PictureName> || <PhasePicture> <Modifier>

<StepLength> == +.<StepPixel> || +/<Diameter> || +

<StepPixel> == <Simple>

<Diameter> == <Simple>

The first picture <BasePicture> always must show the complete vehicle.  When one uses the MM&MM  screensaver this first phase picture always ends with the suffix _0 !  The base picture can also possess an overlay which is shown (or not) based on the direction of travel.  The subsequent pictures which make up the movement are added to the base picture with the + sign.  The + sign, however, can be used with several modifiers which affect how the phase pictures are joined to one another:

+> The phase picture is aligned to the right of the <BasePicture>.
+< The phase picture is aligned to the left of the   <BasePicture>.
+ The phase picture is aligned to the centre of the <BasePicture>.
+* The centre of the phase picture is aligned to the centre of the <BasePicture>.
+ <Simple> : The phase picture appear + <Simple> pixel offset from the left of the <BasePicture>

+<Simple> : <Simple> :  The phase picture appear the first <Simple> pixel offset from the left and at the second   <Simple> pixel height of the <BasePicture>

Phase pictures appear aligned to the bottom of the <BasePicture> - the only exception is the last form with explicit 2 coordinates.  The phase pictures only should contain the square area that shows the part that changes.  In no direction should be a phase picture be greater, as the base picture - if it is so (for example, the smoke of a steam engine goes higher in the 3. phase, as in the base picture), then, please, extend the base picture's square by a transparent area.  If the phase pictures are transparent, the transparent areas will be copied to the overall vehicle.  The transparent areas of the vehicle can change based on its motion, and copying the transparency allows one to see through to background objects or not as is appropriate to the motion depicted.

Pictures in a TVL picture library can be difference mode pictures - it means, there are two different kind of transparent pixels in such a picture. A pixel can be "No change" - than using it as a phase picture the value of the base picture's pixel remains unchanged - or a pixel can be "Transparent" - the resulting phase picture will be transparent on that place, the background will be visible through the picture.

To make the succession of phase pictures realistic, the phase pictures are changed based on the distance the vehicle has travelled along the right of way.  The distance that the vehicle travels before the picture is changed is referred to as a "step."  One can specify the step distance in pixel like so:

+.<StepPixel>  

There is yet another way to input a <StepLength> value:

+/<Diameter>

where the number is the diameter of the wheel.  The default for all vehicles is the geometrically correct value, but one can alter this default by use of the $PHSTEP command.  The value set by $PHSTEP multiplied by the pixel diameter of the wheel determines the distance at which the wheel should have completed its rotation.  From this value, the periods at which the sequence of phase pictures should be changed are computed.  While some screensavers only permit a maximum of four phases, in Traffic it is possible to make a phase picture composed of more (or less) than four phases.

If the $PHSTEP parameter is not specified, the default is p ( 3.14).  If you desire a faster phase transition, you can input a lower value for the $PHSTEP.  The parameter +/<Diameter> it equivalent to the parameter +.<StepPixel> in the following way:

<StepPixel> = <Diameter>*<PhStep>/<Number_of_phase_pictures>.

If the phase pictures do not depict a full rotation of the wheels (such as in bogies, where the majority of the motion is hidden behind the sideframes,) the use of +/<Diameter> is the less suitable choice.

The base picture, each phase pictures and the whole animated picture can have modifiers.

A modifier belonging to the base picture will be obeyed immediately after loading the base picture, and these, eventually modified base picture will be used as the base for the phases.

The modifiers belonging to the phase pictures act only on that phase picture they follow. Traffic copies the base picture (eventually already modified by the base picture's modifiers) to the phase picture's area, overlays it with the given phase picture, and obeys the modifiers belonging to this phase picture.

At the end, after the <StepLength> parameter stay the modifiers for the whole vehicle. They will be obeyed for the base picture and for each phase picture individually. If you do not specify a <StepLength> parameter, you should use a single plus sign ( + ) in order to delimit the modifiers for the whole picture from the last phase picture - if you forget this, all the modifiers at the end will belong to the last phase picture, and not to the whole vehicle.

Animating the pantographs: the constructs

<Base picture name> < <SAR image name>

creates a pantograph animation ( see the description of the [E: ] modifier for the pantograph description ).

The SAR image ( the name comes from the MM&MM screensaver, it is a german abbreviation StromAbnehmer Rechts meaning that the right pantograph is in the upper, and the left pantograph is in the lower position ) shows usually the whole upper part of the vehicle - a roof segment and both pantographs in different position as the base picture. Traffic creates two pantograph animations from the SAR picture and the base picture: for both the left and right pantograph Traffic creates different animations. As Traffic does not have further information about the pantograph sizes, the animations will be created for the half of the size of the SAR image: the left part for the left pantograph, and the right part for the right pantograph. The resulting effects will be correct only, if the base picture and the SAR image contained a fully identical picture of the vehicle roof, with the only difference of the pantograph states.

Remember: the MM&MM screensaver replaces the whole upper part of the base picture with the _SAR image, if the vehicle travels to left:it shows either the left pantograph up and the right down, or the left down and the right one up, and never changes the state on the screen. Traffic can show all the 4 states, additionally the both pantographs down and both pantographs up states too, and one can instruct the animations in the waiting times - when the vehicles stay on the screen - to change the pantograph states, so you have higher quality requirements for the pantograph drawings in Traffic, as in the MM&MM screensaver. Using the MM&MM _SAR images in traffic gives a nice result only if the _SAR images were narrowly drawn.

Overview
The Configuration Window
Program Window
Stock List
Description Editor
Graphic Testpad
Timetable Editor
Timetable Syntax and Semanics
The timetable header
Sections, Groups, Lines, Scenes
Actions
Stock List File