CCG/Kind: Industry

From TrainzOnline
< CCG
Revision as of 23:35, 4 June 2011 by Pev (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

KIND: INDUSTRY

An industry is best described as a scenery asset with product processing functionality. Industry assets interact with compatible rolling stock assets through their script file. See note at bottom of page.

Tags that apply in a scenery asset may also apply in an industry asset. See Kind Scenery Page 80 .

Full config or script files are not included in this section because all TRS released industry config.txt files and script files (.gs) are available for download from: http://www.auran.com/TRS2004/trssp4dl/dfile.php?FileID=10

Overview

All Trainz industries have attached-tracks, attached-triggers, queues and processes to input or output products (or commodities).


Attached-track (required) Attached tracks are setup in an industries config.txt. Auto-generated spline track is generated through attachment points located within the default mesh.

Attached-tracks update automatically to the spline track connected to it. You may over-ride this auto-update feature by adding useadjoiningtracktype 0

Note. Correct track end attachment orientation is essential. The Y axis must point 'out' at the correct angle. the Z axis must point 'up'. Refer to Page 92 .

attached-track
{
  track0
  {
    track <KUID:-3:15>
    useadjoiningtracktype 0
    vertices
    {
      0 a.track0a
      1 a.track0b
    }
  }
}

Attached-trigger (required) A Trigger is a point along an attached track with a specified radius. When a compatible rolling stock item enters this radius it triggers a set of commands, controlled through its script.

A trigger is setup in an industries config.txt


Queues (required) The queues field states which product or products the industry can use. It contains the size of each product, the initial count when placed, and can refer to it's visual load state whether through a load animation or attachment. Any load animations are set-up within the mesh-table.


Processes (required) The input and output settings of the industry. You can specify the amount of input and output for each queue referenced product as well as the duration (or rate) in seconds for that process to take place. All queues and processes are linked through the industry asset's script file.

Industry functionality

Perhaps the simplest examples of industry functionality are the Trainz released Coalmine and the Powerstation assets.

When the coal hopper enters the trigger radius of the coalmine loading bay, it's script interacts with the hoppers own script. Particle effects (pfx) from the coalmine visually display the coal entering the hopper and the hopper animated load rises to show it's full state. The coalmine's own animated load pile reduces as does it's commodity level.

Similarly, when the full hopper enters the Powerstation trigger radius, the hopper's animated load lowers, the side doors open and the pfx effects on the hopper itself initiate. The animated load pile in the Powerstation increases and it's commodity level increases.

The hopper pfx, and the animated doors are both controlled by the hopper.gs script file.

Refer: IN-GAME VISUALISATION OF PRODUCTS Page 30 .

Note: Animation Events Sounds events and generic events can be linked to an animation key-frame to give great control over sound and script timing for industry and scenery assets. Refer to Page 373.


Note: The increasing use of scripts in TRS adds huge flexibility and control to assets and their functionality.

Adding scripts on a per asset basis is a logical progression in the development of Trainz. However, we do understand that most 3D modelers do not know a great deal about scripts we are really dawning on a new era in Trainz custom content creation

Because of this, we recognise there will need to be far more collaboration and group efforts for custom industry asset creation. There are several very good script writers in the Trainz content Creation community. Just ask around the forums.


Note: Preview Window Icons: Auran released Industry assets (and industry compatible assets) have an additional tag in their config:

icon0 <KUID:-3:10164>

The kuid is of a kind texture and the icon texture is a 32x32 pixel - 32 bit tga file and you may have up to 4 (icon0, icon1, icon2, icon3)


Return to CCG Index

Content Creator's Guide



PORTAL

A portal is an industry object used to create and emit trains. It relies on a script to function. An example config.txt file is shown for a basic portal asset.

HTML lines have been omitted under the string-table. The working asset has extensive entries here to make it fully functional. Refer to the example Portal asset available on the Auran Content Creation Art Source CDs.

Portal Config.txt

kuid <KUID2:###:#####:1>
kind industry
light 1
kuid-table {
 }
obsolete-table {
 }
description " "
trainz-build 2.5
username Portal
script PortalTunnel
class PortalTunnel
icon-texture icon_portal.tga
category-region "AU"
category-era "2000s"
category-class BIN
kuid-table
{
 loco <kuid:-1:100861>
 wagon <kuid:-1:100048>
 guardsvan <kuid:-1:100770>
}
mesh-table
 {
   default
   {
     mesh portal.im
     auto-create 1
     effects
     {
       portalentry
       {
         kind attachment
         att a.track0g
         default-mesh <KUID:-3:10239>
         surveyor-only 1
       }
        portalend
       {
         kind attachment
         att a.track0a
         default-mesh <KUID:-3:10238>
         surveyor-only 1
       }
     }
   }
 }
     string-table
     {
     }
     attached-track
     {
       out_track0
       {
         track <KUID:-1:15>
         vertices
         {
           0 a.track0a
           1 a.track0b
           2 a.track0c
           3 a.track0d
           4 a.track0e
           5 a.track0f
           6 a.track0g
         }
       }
     }
     attached-trigger
     {
       trig_end
   {
   att a.track0d
   radius 10.0
   }
   trig_entry
  {
  att a.track0f
   radius 10.0
   }
}
icon0  <KUID:-3:10164>


Breakdown of Portal Config.txt:

Some config.txt tags are explained below. Others are covered in the general config.txt explanation, see Page 23.

region Surveyor region.

type Surveyor type.

light Sets lighting to be used for object to be ambient or directional. 0 sets ambient lighting and object is lit by general light value (uniform coloring), 1 sets directional light which is affected by the position of the sun (shows shadows on the object surfaces).


script Name of Script to be used with this asset.

class Script class; as designated in the script above..

icon-texture The in-game representation of the asset when specifying a drive to command in Driver.

category-class The class code for this asset. Refer to Appendices.

kuid-table KUIDs required for this asset to function correctly, sample only shown (the rolling stock listed in the consists entry).

default Default is the `main' mesh of the asset.

mesh The im mesh name.

auto-create 1 The model is generated automatically when placed, or when you load a map which includes the model. In some instances you don't want the mesh visible (as this may be controlled through script). If auto-create is 0 the mesh will not be visible when placed.


effects

kind attachment Attaching a mesh to the default mesh using the kind attachment effect. Each effect is given a name such as "portalentry".

default-mesh Kuid of the mesh to be attached.

att The mesh is inserted at a mesh attachment point rather than the origin (without this line the mesh is placed relative to the origin of the parent model).

surveyor-only 1 The attached mesh will only be visible in Surveyor.

string-table A listing of HTML options to be called by the script file to display when the properties option of the asset is used in Surveyor. H lines have been omitted in this example. Refer to the example Portal model available on the Auran Content Creation Art Source CDs.

running-number The default number for the vehicle. It is changeable in Surveyor.

attached-track Track to be attached to the model, including a name for the track (out_track0), the track KUID to be used, and attachment points, placed in the 3dsmax/gmax model.

attached-trigger A point on the attached track with a specified radius. When a compatible rolling stock item enters this radius it triggers a set of commands, controlled through script.

icon0 Window preview icon - see information on Page 83 .


Return to CCG Index

Content Creator's Guide



MULTI INDUSTRY NEW

This is an industry object used to set up your own industry, with loading and unloading of products on attached track.


The example model consists of track with attachment points and triggers, allowing you to place your own buildings to suit. It relies on a script to function. An example config.txt file is shown for the asset.

Multi Industry New Config.txt

kuid <KUID2:###:#####:1>
kind industry
light 1
kuid-table
{
}
description "blah blah"
trainz-build 2.7
username       "Multiple_Industry_New"
obsolete-table 
{
 0 <kuid:-19:10152>
}
nightmode      "lamp"
script         "MultipleIndustryNew"
class          "MultipleIndustryNew"
icon-texture "icon_multiple.tga"
preview-mesh-kuid     <kuid:-3:10154>
kuid-table
{
         coal          <kuid:44179:60013>
         diesel        <kuid:-3:10011>
         cont20ft      <kuid:-3:10014>
         cont40ft      <kuid:-3:10041>
         gengoods      <kuid:-3:10013>
         logs          <kuid:-3:10001>
         lumber        <kuid:-3:10003>
         woodchips     <kuid:-3:10002>
         oil           <kuid:-3:10010>
         petrol        <kuid:-3:10012>
         water         <kuid:-3:10004>
         avgas         <kuid:-3:10045>
}
mesh-table
  {
    default
      {
         mesh   "Multiple_Industry.im"
         auto-create 1
         effects
            {
             arrow0
                {
                  att "a.track0a"
                  default-mesh <kuid:-3:10092>
                  surveyor-only 1
                  kind   "attachment"
                }
             arrow1
                {
                  att    "a.track0f"
                  default-mesh <kuid:-3:10092>
                  surveyor-only 1
                  kind   "attachment"
               }
           }
     }
 }
 attached-track 
 {
   out_track0 
    {
       track <kuid:-1:15>
       vertices 
       {
          0      "a.track0a"
          1      "a.track0b"
          2      "a.track0c"
          3      "a.track0d"
          4      "a.track0e"
          5      "a.track0f"
       }
    }
 }
 attached-trigger 
 {
   trig0
    {
          att    "a.track0b"
          radius 10
    }
   trig1
    {
          att    "a.track0c"
          radius 10
    }
   trig2
    {
          att    "a.track0d"
          radius 10
    }
   trig3
    {
          att    "a.track0e"
          radius 10
    }
 }
 queues
 {
   queue1
    {
         size   100
         allowed-products     
         {
         }
    }
   queue2
    {
         size   100
         allowed-products
         {
         }
    }
   queue3
    {
         size   100
         allowed-products
         {
         }
    }
   queue4
    {
         size   100
         allowed-products
         {
         }
    }
   queue5
    {
         size   100
         allowed-products
         {
         }
    }
   queue6
    {
        size   100
        allowed-products
        {
        }
    }
 }
 processes
 {
   multi_consumer_producer
    {
      start-enabled 1
      duration     30
      inputs
        {
        }
      outputs
        {
        }
    }
 }
 icon0         <kuid:-3:10164>


Breakdown of Multi Industry New Config.txt:

Some config.txt tags are explained below. Others are covered in the general config.txt explanation, see Page 23.


script Name of Script to be used with this asset.

class Script class.

icon-texture The in-game representation of the asset when specifying a "Drive To" command in Driver.

preview-mesh-kuid As spline tracks will not render in the Preview window a preview-mesh is needed, as a kind mesh (this example model consists of spline track only).

kuid-table A list of KUIDs required for this asset to function correctly, in this case the products to be supported.

default Default is the 'main' mesh of the asset.

mesh The 'main' mesh name.

auto-create 1 The model is generated automatically when placed, or when you load a map which includes the model. In some instances you don't want the mesh visible (as this may be controlled through script). If auto-create is 0 the mesh will not be visible when placed.

effects The effects to be attached to the model.

arrow0 The name of the effect, in this case a red arrow to be attached to the model to shows the ends of the track.

att The mesh is inserted at a mesh attachment point rather than the origin (without this line the mesh is placed relative to the origin of the parent model).

default-mesh The mesh for the arrow model to be attached.

surveyor-only 1 The attached mesh will only be visible in Surveyor.


kind Kind attachment.

attached-track Details of the track to be attached to the model, defined by the attachment points in the 3dsmax/gmax model using the a.name convention. Note the axis orientation of the end attachment points. Refer to the Fixed Track example Page 92 .

out_track0 Name of the track.

track The track type (kuid) to be used for the attachment, in this case the red invisible track kuid.

vertices List of attachment vertices from the 3dsmax/gmax model, for track attachment.

attached-trigger A point inserted in 3dsmax/gmax, on the attached track, with a specified radius in the config.txt file. When a compatible rolling stock item enters this radius it triggers a set of commands, controlled through script.

trig0 Name of the trigger.

radius The radius of operation in metres.

queues The queues field defines the queue name, the product, the size and the initial count when placed.

size The initial size of the queue (in product units)

allowed-products The allowed products, not specified, therefore allows multiproducts listed in the kuid-table.


processes The input and output settings of the passenger asset. You can specify the amount of input and output for each queue referenced product as well as the duration (or rate) in seconds for that process to take place.

start-enabled 1 Option is set such that this process will be running by default when the session is launched duration Duration time of the process in seconds.

inputs Input quantity (in product units) for the process.

outputs Output quantity (in product units) for the process.

icon0 Window preview icon - see information box Page 83.



Return to CCG Index

Content Creator's Guide




PASSENGER STATION ASSET

A passenger station industry asset has more attributes than normal industry assets. It allows loading and unloading of passengers, and a "spawn" and "delete" process for passengers. It relies on a script to function.

An example config.txt file is shown for the a basic two platform passenger station asset. Some similar multiple attachment point entries in the original asset have been omitted for brevity.

For more information refer to the Passenger Station and Vehicle Assets Tutorial available for download: http://files.auran.com/TRS2004/downloads/contentcreation/SP2-Passenger_Asset_Tutorial.zip


Passenger Station Config.txt

kuid <KUID2:###:#####:1>
username Small_Station Example
kind industry
light 1
trainz-build 2.5
icon-texture icon_small_station.tga
script SmallStation
class SmallStation
passenger-height 1.204
kuid-table {
passenger     <kuid:-3:10060>
}
mesh-table {
     default {
       mesh   small_station.im
       auto-create 1
       effects {
          0{
              kind   name
              fontsize 0.08
              fontcolor 220,220,220
              att    a.name0
              name   name
              }
          1{
             kind   name
            fontsize      0.08
            fontcolor     220,220,220
            att           a.name1
            name          name
            }
         2{
            kind   name
           fontsize      0.08
           fontcolor     220,220,220
           att           a.name2
            name        name
           }
        }
    }
}
attached-track {
       track_one {
              track <kuid:-1:15>
              vertices {
                     0 a.track0a
                     1 a.track0b
                     2 a.track0c
                     3 a.track0d
              }
       }
       track_two {
              track <kuid:-1:15>
              vertices {
                     0 a.track1a
                     1 a.track1b
                     2 a.track1c
                     3 a.track1d
              }
       }
}
attached-trigger {
       trigger_track_one_a {
              att    a.track0a
              radius        2
              track track_one
       }
       trigger_track_one_b {
              att    a.trigmain
              radius        19
              track track_one
       }
       trigger_track_one_c {
              att    a.track0d
              radius       2
              track track_one
       }
       trigger_track_two_a {
              att    a.track1a
              radius        2
              track track_two
       }
       trigger_track_two_b {
              att    a.trigmain
              radius        19
              track track_two
       }
       trigger_track_two_c {
              att    a.track1d
              radius        2
              track track_two
       }
}
queues 
{
  passengers_on_0
    {
       passenger-queue 1
       size   48
       initial-count 0
       product-kuid <kuid:-3:10060>
       attachment-points
         {
           0 a.passon30
           1 a.passsit02
           2 a.passsit03
           3 a.passsit04
           4 a.passon32
           5 etc
         }
    }
  passengers_on_1
    {
       passenger-queue 1
       size   40
       initial-count 0
       product-kuid <kuid:-3:10060>
       attachment-points 
         {
           0 a.passon61
           1 a.passsit67
           2 a.passon43
           3 etc
         }
    }
  passengers_off_0
    {
       passenger-queue 1
       size   26
       initial-count 0
       product-kuid <kuid:-3:10060>
       attachment-points
         {
           0 a.passoff01
           1 a.passoff15
           2 a.passoff03
           3 etc
         }
   }
 passengers_off_1
   {
       passenger-queue 1
       size   26
       initial-count 0
       product-kuid <kuid:-3:10060>
       attachment-points
         {
           0 a.passoff27
           1 a.passoff44
           2 a.passoff29
           3 etc
         }
   }
}
processes
{
  passenger_spawn_0
   {
      start-enabled 1
      duration 20
      outputs
        {
          0
            {
               amount 1
               queue passengers_on_0
            }
        }
   }
  passenger_spawn_1
   {
      start-enabled 1
      duration 20
      outputs
        {
          0
            {
               amount 1
               queue passengers_on_1
            }
        }
   }
  passenger_delete_0
   {
      start-enabled 1
      duration 3
      inputs 
        {
          0
            {
               amount 1
               queue passengers_off_0
            }
        }
    }
  passenger_delete_1
    {
      start-enabled 1
      duration 3
      inputs
        {
          0
            {
               amount 1
               queue passengers_off_1
            }
        }
    }
}
soundscript
{
  dayloop
    {
      repeat-delay 0
      distance 8,130
      sound
        {
          station_amb_2.wav
        }
    }
}
string-table
{
    smallstation_plat1 Platform 1
    smallstation_plat2 Platform 2
}
username-fr          Gare_petite
string-table-fr
{
    smallstation_plat1 Plateforme 1
    smallstation_plat2 Plateforme 2
}
username-it          Small_Station
string-table-it
{
    smallstation_plat1 Platform 1
    smallstation_plat2 Platform 2
}
username-de          Kleiner_Bahnhof
string-table-de
{
    smallstation_plat1 Bahnsteig 1
    smallstation_plat2 Bahnsteig 2
}
username-es          Estación_Pequeña
string-table-es
{
    smallstation_plat1 Platform 1
    smallstation_plat2 Platform 2
}
Icon0 <kuid:-3:10164>


Breakdown of Passenger Station Config.txt:

Some config.txt tags are explained below. Others are covered in the general config.txt explanation, see Page 23.

icon-texture The icon for the asset, used for the "Drive To" command, the file is a 64x64 tga texture with no alpha channel.

passenger-height This value sets the height of the passenger asset in metres, to suit the platform model height.

queues The queues field defines the passenger product, the size and the initial count when placed. Passenger attachment points placed in 3dsmax/gmax are referenced, but only a limited number have been included in this example.

passenger_on_X Queue name for the passenger on platform, and must be of this form, where "X" is the platform number, starting at 0. Passenger off queues must be named similarly.

size The size of the queues must match the number of attachment points. Note the special name for the attachment points, for seated passengers the name ends in "sitNN" where NN is any two characters, usually digits.

processes The input and output settings of the passenger asset. You can specify the amount of input and output for each queue referenced product as well as the duration (or rate) in seconds for that process to take place. This asset spawns or deletes passengers from the model.

passenger_spawn_X The queue name for the passenger spawn process. The name must be of this form, where "X" is the platform number, starting at 0. Passenger off queues must be named similarly.

string_table Defines the name for each platform track.

icon0 Window preview icon - see information on Page 83.


Return to CCG Index

Content Creator's Guide

Personal tools