CCG/Appendix D: New Functions in Trainz Classics

From TrainzOnline
< CCG
Revision as of 20:12, 17 June 2011 by Pev (Talk | contribs)

Jump to: navigation, search

Contents

Appendix D - New Functions in Trainz Classics

Page Incomplete - please do not edit

A number of new functions have been introduced in TC, relevant to content creators. The following list summarises the new features:

· New Freeways feature supporting and including one way and multi-lane roads
· Flashing ditch-lights
· Headlight dimmer system
· Remodelled roadway traffic featuring working head lights
· New sound functions for better representation of electric traction
· Train controlled sounds, lights and boom gates at build-in road crossings
· Automatic Train Protection options
· Computerised in-cab displays
· Improved Heads-Up-Display options
· Flexible Cab Signalling system
· Improved session-design options

Freeways - one way and multi-lane roads

There are two kinds that support the creation of freeway model, Kind Track and Bridge. The Kind track is used to specify a road freeway asset. For example, a two lane road mesh is used for the lanes of the freeway and tags in the config.txt file specify lane configuration.

====This example is for a freeway with 2 lanes

username           "Road_Freeway_01"
grounded           0.4
region             "Britain"
length             5
width              7.9
bendy              1
kind               "track"
type               "Roads"
uncached_alphas    1
carrate            25
asset-filename     "road"
kuid               <kuid:523:100082>
istrack            0
isroad             1
isfreeway          1
numlanes           2


istrack Specifies if this is rail track or not,

1 = traincars to use the asset,
0 = turns off this option.


isroad Specifies that this is a road,

1 = generate traffic,
0 = suppress traffic. See also the carrate tag.


isfreeway

1 = asset will be a freeway model allowing the use of and multi-lane roads


numlanes The number of lanes to be generated.

Default lane spacing is 3.4 metres.
Note that for kind track, traffic will flow in one direction for all lanes.


carrate This is required to actually generate cars.

It defines traffic density on the road (minimum seconds between each car generated).
0 = No traffic. The number must be greater than 3 for traffic to flow.

For a freeway with lanes flowing in both directions, a Kind bridge has to be used. This asset calls up a freeway road model by kuid to be used on the bridge.


The following example uses a Kind bridge to generate a four lane road, calling up the two lane freeway asset in the previous example.

Username           "Road_Freeway_02"
grounded           0.4
region             "Britain"
length             5
width              7.9
bendy              1
kind               "track"
type               "Roads"
uncached_alphas    1
carrate            25
asset-filename     "road"
kuid               <kuid:-22:1003>
trackoffsets       -3.5,3.5
trackdirections    0,1
height             0
rgb                255,200,0
istrack            0
isroad             1
isfreeway          1
numlanes           4
bridgetrack        <kuid:523:100082>


carrate This is required to actually generate cars. It defines traffic density on the road (minimum seconds between each car generated).

0 = No traffic. The number must be greater than 3 for traffic to flow


trackoffsets The offsets either side of the bridge centre line where the attached road will be located. Note for a single road to be attached on the centreline of the bridge, a small offset of 0.01 must be specified.


trackdirections Specifies the direction of traffic for each of the road assets attached to the bridge,

0 = traffic to flow in one direction for the dual lanes attached at -3.5 metres,
1 = traffic to flow in the opposite direction for the dual lanes placed at 3.5 metres.


height This value defines the object use:

0 = the object is double track, a negative value (-) means the object will be a bridge, the value -12 for instance is the height from the deck to the bottom of the bridge foundation, a positive value(+) means the object is a tunnel, the height 8 for instance is the height of the tunnel portal.


istrack Specifies if this is rail track or not,

1 = allows traincars to use the asset,
0 = turns off this option


isroad Specifies that this is a road,

1 = generate traffic,
0 = suppress traffic.


isfreeway The asset will be a freeway model allowing the use of multi lanes in one direction.


numlanes The number of lanes of freeway traffic.


bridgetrack The freeway road kuid that is to be used on the bridge - this is a two lane freeway, placed either side of the bridge centre line at the specified offsets. This attached road to be used on the bridge requires the freeway tags, as in example 1 above, to function as a freeway


Freeway junctions could be made using Kind buildable objects. Attachment points would be specified where necessary for track to be attached to the object.

Additional track attachment points would be specified to define the track path through the object (a junction for instance). The required freeway track type object would be referred in the config.txt file as the track to be generated on the object.


Flashing ditch lights

Operating ditch lights now function for locomotives. The usual attachment point conventions apply for a point placed in the mesh in 3DSMax or GMax.

a.ditch0, a.ditch1 etc

The odd numbered light points flash together, alternating with the even numbered light points.

The flashing rate can be changed in the traincar config.txt file, by adding the following tags:

flash-scale

1 = (default) 1 normal speed,
0.5 = half speed,
2 = double speed

Ditch lights are toggled in Driver using the ; key


Headlights - low and high beam

Locomotives can run with normal or dimmed lights (high or low beam), use the Shift + L key in Driver.


The intensity of the light may be varied by adding the following tag to the traincar config.txt file:

low-beam-value

1 = normal size or intensity
2 = (default) half size or intensity
0.5 = twice size or intensity


Operating lights on roadway traffic

Cars driving on roads can have operating head and tail lights. Use the nightmode tag in the config.txt file for a car and in the mesh table, include the default-night tag and night mesh file that you create for the vehicle.

The following tags show the entries in the config.txt file.

nightmode          "none"
mesh-table 
{
  default
    {
      auto-create  1
      mesh         "hilux_blue.im"
    }
  default-night
    {
      mesh         "night/gondwana_night.im"
      night-mesh-base  "default"
    }
}

nightmode

lamp = the car lights will be displayed when the car is a static scenery object.
none = the car lights will not be displayed when the car is used statically as a scenery object, but will be updated to

"lamp" if the car is included in road traffic by modifying a Kind region.

Note for TS2010 a new value of "car" is supported for traffic nightmode.

Use the Content Creator Plus Module (CCP) to modify a Region Kind to add cars to road traffic.

Refer How to Add Carz Traffic to a Route.



Sound functions for electric locomotives

New functions to better represent electric locomotive sounds have been implemented. The options are set in the config.txt file for the enginesound Kind.

For an electric locomotive, the sound may be considered a speeding up of one wave form, different from diesel or steam locomotives where different sound files are used in "steps".

The sound used is a single .wav file called engine_loop.wav and must be placed in the directory with the config.txt file. TC automatically loads the file of this name.

Normally the .wav file used is the base sound (the sound used at zero km per hour). With electric engines there should be no sound at zero speed, and the use of the isfading tag scales the volume, reducing the sound as the speed reduces to zero.

kind               "enginesound"
kuid               <kuid:523:100052>
username           "MN M7 enginesound"
isspeed            4
isfading           1
isramping          0

To distinguish between usage for diesel or electric the following tag is used.

isspeed This is the speed up factor.

1 = play the sound file at twice speed when the engine speed is at maximum,
2 = (default) play the sound file three times the speed when the engine speed is at maximum,
4 = play the sound file five times the speed when the engine speed is at maximum. From the above, the playing speed is seen to be the original speed plus the factor (eg 1 plus 4 = 5 times speed).

Other values may be used in the above tag.

To fade the engine sound when the locomotive decelerates or stops, the following tag is used.

isfading 1= sound fades to zero when speed is reduced, and plays no sound at zero km per hour.


isramping "0 = using a single .wav file, winds up the sound, or play the sound file faster, based on the traincar speed and tag values, used for electric locomotives,

1 = use different sound files for each "step" throttle notch, for steam and diesel locomotives.


Playing speed for the electric sound file is defined in the following tag, and is linked to the maximum locomotive speed set in the enginespec file, the maxpeed tag.



Traincar interiors

New functions have been added to the interiors to represent digital displays and heads up displays, for example. The following example of part of the config.txt file for the interior for the MN M7 locomotive illustrates the use of the new tags and script.

Note: Not all the container entries necessary for the asset are shown in this example, only parts to illustrate new functions and tags.

script             "SignalInterior"
class              "SignalInterior
kuid               <kuid:523:55585>
soundscript
  {
   warning
    {
     distance      3,100
     attachment    "a.limfront"
     trigger       "arning"
     sound
      {
        0          alarm.wav
      }
    }
  }
mesh-table
  {
    default
      {
        mesh        "m7_interior.im"
       auto-create  1
        effects
         {
         next-station
          {
            kind      "name"
            fontsize  0.01
            fontcolor 230,177,39
            att       "a.station"
            name      "AIDAN"
            value     ""
          }
        }
      }
    speedo_needle
      {
        kind          "needle"
        auto-create   1
        mesh          "speedo_pointer.im"
        att           "a.speedo"
        limits        0,48
      }
    reverser_lever
      {
        kind          "lever"
        mesh          "reverser.im"
        att           "a.reverser"
        limits        0,2
        angles        2.55,1.55
        notches       0,0.5,1
        notchheight   3,3,3
        mousespeed    1
        auto-create   1
        radius        0.05
      }
    bptrainbrakepipe_needle2
      {
        kind          "digital-dial-prs"
        mesh          "brake_needle.im"
        att           "a.trainpipe_needle_0"
        limits        0,55
        font          "arial"
        fontsize      0.01
        fontcolor     196,196,246
        auto-create   1
      }
    bptrainbrakecylinder_needle2
      {
        kind          "digital-dial-prs"
        mesh          "brake_needle.im"
        att           "a.brakecyl_needle_0"
        limits        0,55
        font          "arial"
        fontsize      0.01
        fontcolor     196,196,246
        auto-create   1
      }
    speedo_needle2
      {
        kind          "digital-dial-spd"
        mesh          "brake_needle.im"
        att           "a.digispeedo"
        limits        0,55
        font          "arial"
        fontsize      0.01
        fontcolor     196,196,246
        auto-create   1
      }
    bptrainbrakepipe_needle
      {
        kind          "needle"
        mesh          "speedo_needle.im"
        att           "a.bpressure"
        limits        0,1480
        auto-create   1
      }
    bptrainbrakecylinder_needle
      {
        kind          "needle"
        mesh          "red_needle.im"
        att           "a.bcpressure"
        limits        0,1480
        auto-create   1
      }
    cabsignal_restricted
      {
        auto-create   0
        mesh          "cabsignal_restricted.im"
        att           "a.cabsignal"
      }
    cabsignal_medium
      {
        auto-create   0
        mesh          "cabsignal_medium.im"
        att           "a.cabsignal"
      }
    cabsignal_limited
      {
        auto-create   0
        mesh          "cabsignal_limited.im"
        att           "a.cabsignal"
      }
    cabsignal_normal
      {
        auto-create   0
        mesh          "cabsignal_normal.im"
        att           "a.cabsignal"
      }
    atp_on
      {
        auto-create   0
        mesh          "atp_operational.im"
        att           "a.atp"
      }
    atp_penalty
      {
        auto-create   0
        mesh          "atp.im"
        att           "a.atp"
      }
    horn
      {
        kind          "pulllever"
        mesh          "horn.im"
        att           "a.horn"
        auto-create   1
        angles        0,-0.55
        limits        0,1
        mousespeed    -1
        radius        -0.02
        notches       0,1
        notchheight 0,0
      }
    throttle_brake_lever
      {
        mesh          "power_handle.im"
        auto-create   1
        att           "a.power_handle"
        limits        0,63
        angles        -1,-1.86
        notches       0,0.0303,0.0606,0.0909,0.1212,0.1515,0.1818,0.2121,0.2424,0.2727,0.303,
                      0.3333,0.3636,0.3939,0.4242,0.4545,0.4848,0.5,0.5151,0.5454,0.5757,
                      0.606,0.6363,0.6666,0.6969,0.7272,0.7575,0.7878,0.8181,0.8484,0.8787,0.909,0.9393,1
        notchheight   1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1
        att-parent    "default"
        kind          "lever"
        mousespeed    1
        radius        0.12
        invert        1
      }
    light_switch
      {
        kind          "lever"
        mesh          "lightdial.im"
        att           "a.lights"
        limits        0,1
        angles        0,2
        notches       0,1,2
        notchheight   0,0
        mousespeed    -1
        radius        0
        auto-create 1
      }
  }

Script and Class are references to the new script required for the new interior cab HUD to display the next station names. The script SignalInterior.gs is found included with the new models (MN M7 interior for example).


Additional new scripts for the locomotive also interact with the interior scripts for cab displays, compare scripts provided with the M7, FL9 and P32 locomotives. These scripts are individually tailored to the functions for each of the locomotives (fl9.gs for the MN FL9 locomotive).


The soundscript container refers to the warning sound for the new incab sound functions.

distance The first distance in metres is that which the sound is played at full volume and the second distance where the sound plays at half volume. Outside the second distance the sound is cut off.


attachment The attachment point for the sound, in this case the a.limfront of the traincar.


trigger The trigger name, in this case "Warning".


sound The .wav sound file in this case "alarm.wav".


The effects container within the mesh table refers to the next-station effect which allows the approaching station name to be displayed in the HUD for the interior.

next-station The name of the effect container.

kind The type of effect.

fontsize Fontsize as a factor of the default font size .

fontcolor Font colour.

att Attachment point in the mesh for the effect.

name Name of this effect - use Aidan for this effect.

value A blank value (" ") initially shows no station names in the HUD until a station that has been appropriately named is within range of the traincar. Make sure there is a <space> between the quotation symbols.


For in-cabin levers and digital displays, the speedo_needle and reverser_lever are the usual containers for those levers.

The bptrainbrakepipe_needle2 and the bptrainbrakecylinder_needle2 are for the new digital display containers. A mix of analogue and/or digital displays may be used, the addition of "2" to the name allows for a second display to be separately used and displayed.

kind digital-dial-prs is the new kind for the digital display for pressure.

mesh A mesh must be used for the container to work, for example the "brake_needle.im". This mesh does not display so any mesh provided will be used to satisfy the requirement.

limits For a normal lever these define the lower and upper limits of the display device (dail for example). For the digital display they are non-functional but the tag and some data values still have to be provided to satisfy coding requirements.

font tags The settings for these tags select the font type and size.


The speedo_needle2 container defines the digital values for the speed display, which uses a different kind form the pressure displays. Again, the referenced mesh is necessary but not used for display. The "2" in the name is used when the second display for speed is required (the first might be an analogue needle, or a digital display, and a second display is required).

kind digital-dial-spd is the new kind for the digital display for speed.


For cab signals displayed in the Heads Up Display (HUD) there are a number of containers used to define signal status in the cab. The four state displays (unique container names) are:

cabsignal_restricted,
cabsignal_medium,
cabsignal_limited,
cabsignal_normal.

Note that these are NOT automatically created (auto-create 0 tag) when the traincar is generated in Driver. Normally they display only when required, the locomotive scripts define if these are turned on (displayed or not) for this particular cab interior. While the auto_create 1 tag can be used to display when the mesh is placed in Trainz, the cabsignal functions should be defined as either all on or all off. Do not mix the auto_create tag values. Refer to the fl9.gs script for example, for further information and use.

The cabsignal values are displayed in the cabin in the form defined by the .im file created (lights for instance), displaying the letters R, M, L, N for the in-built models. These refer to the state of the signals passed on the route.


Automatic train protection is provided by the atp_on and atp_penalty containers.

By including and loading the limitspeed rule in the session, the atp_on display indicates that the session speed rule is provided and therefore turned on for use.

The atp_penalty acts in conjunction with the audible warning sound to indicate that speed limits have been exceeded and the limitspeed rule will take control of the traincar speed.

The horn lever has a new function. Using the kind pulllever makes the lever return to the default or start position after in-cab operation - it returns to the original position (the lower value set in the limits tag) as if spring loaded. Tags for this kind are as for normal levers.

throttle_brake_lever is a new container that combines a throttle with a brake lever.


limitssets the limits for the lever, the upper limit is defined as: multiply the number of notches by 2 and add 1, for example, for a throttle with 8 notches: the upper limit is 8 x 2 plus 1 = 17.


Additional tags for interiors (not used in the above example) include a cabin muffle sound tag. Adding the folowing tag sets a reduce sound volume in the cab:

cabin_muffle 0.4 defines the factor by which the sound volume is reduced (40% in this example).


fonts Trainz allows the use of text on name signs, for example a sign used on a station or scenery object, defined by the a.name point convention for points placed in the mesh, in 3DSMax or GMax.

The name function is defined in the config.txt file for the object. Refer to Effects: Name for information on the usage of the Effects Kind Name container and the orientation of the a.name points.

TC has added the ability to define the fonts to be used for the text, alternative to the default font.

The fonts that are available for general use are:

arial console comic_sans courier cordia century_gothic garamond helvetica impact sans_serif swiss tahoma times_new_roman verdana

All these fonts have a base size of 24 points. This size is varied by using the fontsize tag (a multiplying factor of the default font size) in the config.txt file. The following example shows the use of the new font names.

font The name of the font - refer to the list of names above.


  mesh-table
  {
    default
    {
      mesh industry.lm
      auto-create 1
      effects
      {
     0
        {
          kind name
          font garamond
          fontsize 0.15
          fontcolor 30,30,30
          att a.name0
          name name
        }
      1
        {
          kind name
          font swiss
          fontsize 0.3
          fontcolor 30,30,30
          att a.name1
          name name
        }
      }
    }
  }


fontsize The size of the font as a fraction of the original default font size, eg. 0.15 is 15% of the default size of 24 points.

There is an additional larger default font size that has been used in TC which is available for use. This is referenced by the in-game name, mainmenu_titles, not by the more usual "font" name Arial. By using this larger font (80 points) and specifying a font size factor, better quality may be obtained for the name text on the created asset.

mainmenu_titles


Routes or maps

Two previously undefined tags have now been defined for a kind map. While these are automatically generated when you start a map in Surveyor, they can be later altered in CCP.

workingscale defines the scale of the map 0 = Real Scale 1 = G Scale 2 = 1/2 Scale 3 = #1 Scale 4 = O Scale 5 = S Scale 6 = OO Scale 7 = HO Scale 8 = TT Scale 9 = N Scale 10 = Z Scale

workingunits 0 = Metric units of measurement 1 = Imperial units of measurement

In Surveyor you may use the command:

AMMP (Aidan make me a map please).

This command is typed from the keyboard and generates a random map (terrain) on the baseboards.

Other useful information

Additional functions not strictly required for content creation but of interest to creators are:

Surveyor - Height Control

Holding down the LMB while moving the mouse forward will now raise objects that are height adjustable in increments of 1.0 units. Conversely, moving the mouse backwards will lower the object in the same way. Holding the Ctrl key in conjuction with this move will adjust the objects height in increments of 0.1 units and holding the Shift key will change the height by units of 0.05.

Surveyor - Train Controlled Level Crossings

Add a level crossing road/rail junction from the Scenery Objects Tab in Surveyor, e.g. XING 1 US

Use the Edit Properties dialogue in the Scenery panel to uniquely name the crossing, e.g. Hobotown

Add the crossing lights to both sides of the crossing and name those in accordance with the name given to the crossing,e.g. Hobotownsig1 and Hobotownsig2.

Surveyor - Cab Signals

Add the object "MN Trackside Cabsignal" from the Track Panel / Trackside Objects. This signal controls the states that will be shown by the in cab signalling and is only visible in Surveyor.

Surveyor - Computerised In Cab Display

The computerised M7 cab digitally displays various technical and safeworking data. It can also display the next station name. Add a trigger at the point along the track where you would like the next station name to light up in the cab. The naming convention is simple. If the next station is "Hobotown" then name the trigger as:

xxHobotown

The name will be displayed until the train passes another station-name trigger.

To blank the display add another trigger named xx_Driver - Automatic Train Protection


Add the "speed_rule" to a session using Surveyor's "edit session" dialogue. This limits your train's speed to within the limit as imposed by both the trackside speedboards and the cab signalling system.

Driver - Odometer Trip Meter Display

Add the "Display Custom HUD" rule to a session using Surveyor's "edit session" dialogue. A new "Trip Meter" field will be added to the Custom Heads Up Display (HUD) which can be reset at anytime by pressing the T key on the keyboard.

Driver - Headlight Dimmer

Pressing Shift + L will toggle the train headlight from bright to dim.

Driver - Flashing Ditch Lights

Where ditch lights are modelled, pressing the ; key will toggle ditch lights from constant to flashing. Headlights must be on before ditch lights will appear and/or flash.


Scripting

This document does not cover scripting functions and coding in detail, but may refer to necessary scripts for correct functionality. Some of the new scripting functions that have been included in TC include:

setgoodfog, setbadfog To set the density of fog to be used - can use values larger than 1.

setdrawdistance Sets the drawdistance for the ground and scenery items.

worldplaysound This is a looping waveform to play a sound in a map.

World Day, World Night Specifies a function may play during daytime or at night.

playvideo This is a rule to play a video clip.

locomotive and cabin scripts These have been developed for each individual locomotive and associated cab, for the in-built models. Each individual script may not use all the available new tags for cab displays.

Users would need to modify these scripts for other uses. Refer to included scripts for the M7, FL9 and P32 locomotives for information. Useful examples are:

signalinterior.gs acmu.gs fl9.gs p32.gs m7.gs















Station.gs

There is a new station script used in TC to load and unload passengers. The file is Station.gs, found in a number of the MN station assets in TC. This script operates two platforms. A second script, Station3track.gs will operate three platforms on one station. By comparing the script differences, modified scripts may be created to operate more than three platforms.

The script makes the stopping points of trains more predictable and accurate, provided the following is used to set trigger points on the station tracks in 3dsmax or gmax.

Trigger points in 3dsmax/gmax

A track trigger point should be placed at each end of the platform, and another on the track near the centre of the platform length, for example a.trig1a, a.trig1d and a.trigmain. Refer to the diagram above.

Trigger radii are defined in the config.txt file for the station, and 10 metres is suggested for these three trigger points.

Additional trigger points need to be placed in between these three, so the trigger diameters touch along the full length of the track. Place the a.trig1b and a.trig1c points equidistant between the already placed points. Calculate a radius X or Y to suit and enter in the config.txt file for the station.

A maximum value for X or Y should be 75 metres for consistent operation. If larger, place additional intermediate trigger points with reduced radii.

While different names can be used for the triggers, or track attachment points called up in the config.txt file as triggers, it is often more convienient to specify separate trigger points in the 3dsmax/gmax mesh, in order to have the trigger diameters touch - track attachment points, particularly for curved stations are not always in the best locations required for trigger points.

Refer to the above example diagram for suggested placement.


CMP functions

New functions of interest to Creators are included in the Miscellaneous screen of CMP.

Suppress Asset Warning in Trainz This allows you to disable the "Missing Asset Screen" displayed when launching a route.

Suppress Asset Database Update at Startup This allows you to disable the DLS update process every time you start CMP or return to it from Trainz. For creators this should speed up the process of creating content when you do not wish to keep checking with the Download Station updates.

Note this does not suppress the update of the local assets.tdx file when CMP is loaded.

Built in Objects - Colour Display in Surveyor Adding the line -showkuids to the Trainzclassicoptions.txt file will show the kuid number of any object selected in Surveyor, in the bottom right of the Surveyor screen. A built-in object will show the kuid in yellow and a custom objects will be shown in red.

For more information on the Trainzclassicoptions.txt file, see Page 386.

Automatic Committal Modified and imported assets will be committed automatically when launching TC from within CMP.


CCP updates

Note: At the time of writing, CCP has not been updated with the new tags covered in this Appendix.

Creators would need to add new tags and containers manually to the config.txt file.

Personal tools