How to Create a Region Asset

From TrainzOnline
(Difference between revisions)
Jump to: navigation, search
m (Kuid Table Tag=)
m (How to Create a Region Asset)
Line 18: Line 18:
  
 
<table cellpadding="4" bgcolor=#ffffff> <!-- BEGIN Step table -->
 
<table cellpadding="4" bgcolor=#ffffff> <!-- BEGIN Step table -->
<tr>
 
<td colspan="2">
 
----</td>
 
</tr>
 
 
<tr valign="top">
 
<tr valign="top">
 
<td>[[file:Steps.PNG|link=]]<br><br>
 
<td>[[file:Steps.PNG|link=]]<br><br>

Revision as of 21:32, 3 April 2020

The information in this Wiki Page applies to TANE, TRS19 and Trainz Plus.

Contents

What is a Region?

DotPoint.JPG A Region defines the characteristics of a geograpic location (e.g. a country or a province) and/or a time period (e.g. 1950s, 2020s) that is being modelled in a route and session
DotPoint.JPG A Region Asset is a config.txt file that contains the region data

How to Create a Region Asset

Steps.PNG

Steps
DotPoint1.JPG Create the Asset:
NewAsset.PNG

NewAssetCreated.PNG
From the Trainz Launcher
  1. select Manage Content
  2. in Content Manager open the Developer menu
  3. select New Content

This will create a new asset and open it for editing.

A message window will appear that will (hopefully) report on the successful creation of a new asset.

  • Close the message window

  DotPoint2.JPG Find the New Asset:
NewAssetSelectOpen.PNG
  • Set the CM Search Filter to Open for Editing

This will display only those assets that have been opened for editing (hopefully only your new and as yet unnamed asset will be shown)


  DotPoint3.JPG Open the Asset in Windows File Explorer:
NewAssetShowExplorer.PNG
  1. Right mouse click on the entry New Asset
  2. Select Open
  3. Select Show in Explorer

  DotPoint4.JPG Open Config.txt File in Notepad:
NewAssetOpenExplorer.PNG There will only be a single item in the asset, its config.txt file
  • Double click on the file to open it in Notepad

  DotPoint5.JPG Edit the Config.txt File:
NewAssetOpenNotepad.PNG You will need to edit the contents of this file.
  • The next section, PageLink.PNG The Config.txt File, identifies the changes you will need to make.
  • The new name you give to the asset will not take effect until after it has been committed.
  • After editing, save the changes and exit Notepad.


Warning:
Stop.PNG Unless you know exactly what you are doing* DO NOT ALTER THE KUID NUMBER  that has been added to the file
* but even if you do, think twice before you change it !

  DotPoint6.JPG Add a Thumbnail:

You will need to add a thumbnail image as described in the section PageLink.PNG The Thumbnail Image. The thumbnail and the config.txt files are the only two items required in this asset.

The thumbnail does not have to be added immediately but must it be present before the new asset can be used. You can reopen the asset for editing later to add the thumbnail before it is committed.

  DotPoint7.JPG Finish Up:
NewAssetSubmit.PNG
  • Close the Asset window
  • Commit the asset in Content manager
    • Right mouse click on the asset
    • Select Submit Edits

Hopefully there will be no errors.

NotePad.PNG Notes:
Because you still have the Filter Open for Editing in operation, the now closed and committed asset will vanish from the window display. To check that your asset has been correctly created and renamed, set the CM Search Filter to "Today".
Bug.png Some of the most common errors that can occur when creating and committing a new asset are:-
  • no thumbnail image in the asset
  • typing errors in the config.txt file
  • poorly formatted tags in the config.txt file
  • incorrect file types added to the asset folder
  • files missing from the asset folder
  • incorrect kuid value (despite the warning you changed it in Step 5)
Top

The Config.txt File

This file should follow the same (or a similar) format as the example below.

  • entries in  blue  are examples only and may/will be different for each asset
  • the indenting of the lines and the spacing ("tabbing") between the "tags" on the left and their contents on the right are purely to make it easier for humans to read
  • the use of the {} braces is to group tags into common "containers". These containers must not be broken up and the number of { characters must match the number of } characters
  • the order of the "tags" is not important
kuid                              <kuid: this is an auto-generated number >
kind                              "region"
username                          "Tasmania 1950s/1960s Region"
category-class                    "YX"
category-era	                     "1950s;1960s"
category-region                   "AU"
ontheright                        0
water-color                       75,128,255
defaultjunction                   <kuid:61119:24120>
longitude                         147.0,26.0,1.0
latitude                          41,50,-1
altitude                          212
car0                              <kuid:61119:24120>
trainz-build                      4.3
thumbnails
{
  Default
  {
    width                               240
    height                              180
    image                               "Tasmania-Region.jpg"
  }
}
description                             "Vehicle, road, water and geographic data for Tasmania (Australia) in the 1950s and 1960s"
kuid-table
{
  0                                     kuid value
  1                                     kuid value
  2                                     kuid value
}


Gears.PNG Settings:

For the above example:

  • The  kuid  is unique to every asset so it is  not a good idea to choose your own . This will be automatically generated by the Content Manager program when a new asset is created
  • The  kind  identifies the type of asset and the types of files that Trainz will expect to find in the asset. It also tells Trainz how to render and error check the asset. A list of asset kinds can be found at WikiLink.PNG KIND Hierarchy

"icon_gradeXing.texture.txt") but the filename ending ".txt" is not added to the name in the texture tag so it would appear as "icon_gradeXing.texture"

  • The  username  is your name for the asset and the name that other users will see. It is a good idea to make it short and meaningful.
  • The  category-class  identifies the intent of the asset and is important in classifying it for filtering and searching. For region assets, the category class is "YX". A list of category classes can be found at WikiLink.PNG Category-class
  • The  category-era  identifies the decade or decades in which the region is based (e.g. "1950s"). See the section PageLink.PNG Category Era Tag below for more details.
  • The  category-region  identifies the country or countries in which layout is based. See the section PageLink.PNG Category Region Tag below for more details.
  • The  ontheright  identifies which side of the road is used by road traffic. See the section PageLink.PNG On the Right Tag below for more details.
  • The  water-color  identifies the the colour used by water surfaces in this region. See the section PageLink.PNG Water Color Tag below for more details.
  • The  defaultjunction  identifies the junction lever or switch that Trainz will use as its default lever asset whenever a lever is added to a track junction in this region. See the section PageLink.PNG Default Junction Tag below for more details.
  • The  longitude  identifies the geographic longitude of a point in the region. See the section PageLink.PNG Longitude Tag below for more details.
  • The  latitude  identifies the geographic latitude of a point in the region. See the section PageLink.PNG Latitude Tag below for more details.
  • The  altitude  identifies the altitude of the point in the region whose longitude and latitude has been given. See the section PageLink.PNG Altitude Tag below for more details.
  • The  car0  identifies the first moving car that will appear on roads in the region. Upto 15 different cars can be specified. See the section PageLink.PNG Car Tags below for more details.
  • The  trainz-build  identifies the minimum Trainz version needed for this asset. A list of asset trainz-build numbers and their corresponding Trainz versions can be found at WikiLink.PNG Trainz build numbers
  • The  thumbnails  container holds the preview images of the asset shown by the Content Manager program, the Web version of the DLS and, for some assets, the Surveyor main menu image(s). Information on thumbnails can be found at WikiLink.PNG Thumbnails
    • The label  Default  is the container ID or placeholder for the thumbnail used by CM and the Web based DLS. While its exact label (or number - eg. "Default", "00", "01", etc) is not important, it must be different from any other labels that might be present in the thumbnail. Default and 0 are commonly used placeholder labels for the 240 x 180 thumbnail image
      • The image is the name of the thumbnail image - it must be a JPG format image
      • The width of the image must be 240 pixels
      • The height of the image must be 180 pixels
  • The  description  provides more details for users than the username
  • The  kuid-table  contains the kuid values of the defaultjunction asset (if used) and all the carN assets. See the section PageLink.PNG Kuid Table Tag below for more details.

PencilTips.PNG Language Options:
All Trainz assets have a language facility built into their config.txt files that allows other language translations to be added for certain tags, such as the username and description tags. A full description of the process can be found on the Trainz Wiki at Localize an Asset and a list of all the supported languages with their two character codes at WikiLink.PNG Localization (country) Codes.
At the very basic level any creator can easily provide other language translations for the username and description tags in the assets they create. Examples are shown below for this sample asset.
username                    "Tasmania 1950s/1960s region"
username-c2                 ""
username-es                 ""
username-fr                 ""
username-gr                 ""
username-nl                 ""
username-ru                 ""
Translations to Chinese (simplified), Spanish, French, German, Dutch and Russian, perfect or not, were provided by Google Translate.
Top

Category Era Tag

This identifies the decade or decades in which the region is based. Each decade ends with an "s" (e.g. "1950s") and multiple consecutive decades can be specified by using a semi-colon (;) as a separator (e.g. "1950s;1960s"). A list of category-eras can be found at WikiLink.PNG Category-era tag.

Category Region Tag

This identifies the country or countries in which the region is based. Each country has a two letter code (e.g. "AU" for Australia) and multiple countries can be specified by using a semi-colon (;) as a separator (e.g. "AU;UK;US"). If no country is to be specified then the two character code "00" (double zero) is used. A list of category-eras can be found at WikiLink.PNG Category-region tag.

On the Right Tag

This identifies which side of the road is used by road traffic in this region. 0 = left side, 1 = right side.

Water Color Tag

This identifies the the colour used by water surfaces in this region. Three integers specify the RGB (Red, Green, Blue) colour values to be used. Each value is from 0 to 255 and are separated by commas (e.g. 75,128,255).

Default Junction Tag

This identifies the junction lever or switch that Trainz will use as its default lever asset whenever a lever is added to a track junction in this region. The lever asset must be identified by its kuid (e.g. <kuid:61119:24120>).

The kuid value of the switch lever must be added to the kuid-table container of the config.txt file.

Longitude Tag

This identifies the geographic longitude of a point in the region. Three values separated by commas must be supplied. The first is the longitude degrees;, the second is the longitude minutes and the third is the East/West value (1.0 = East, -1.0 = West). For example: 147.0,26.0,1.0 would represent longitude 147 degrees 26 minutes East.

Latitude Tag

This identifies the geographic latitude of a point in the region. Three values separated by commas must be supplied. The first is the latitude degrees;, the second is the latitude minutes and the third is the North/South value (1.0 = North, -1.0 = South). For example: 41,50,-1 would represent latitude 41 degrees 50 minutes South.

Altitude Tag

This identifies the altitude of the point in the region whose longitude and latitude has been given. The height is a single value in metres and is used in the display of snow effects for those assets that support snow.

Car Tags

This identifies the moving cars that will appear on roads in the region.

  • Upto 15 different cars, each as a separate tag from car0 to car14 identifying their kuid values, can be specified in a region. The car numbers must be consecutive with no missing or duplicated entries
  • The cars must be specifically created as moving vehicles and not as static vehicles - static car assets cannot be used
  • Not all roads can carry moving vehicles
  • The Environment Tool has a control that will enable and disable all road traffic
  • The kuids of the cars must be added to the kuid-table container of the config.txt file

For example, the following entries will specify just 4 moving vehicles for the region.

car0                                    <kuid:329364:1568>
car1                                    <kuid:309161:100599>
car2                                    <kuid2:329364:1689:1>
car3                                    <kuid2:329364:1707:1>

Kuid Table Tag

This must contain the kuid values of the Default Junction asset (if used) and all the cars specifed in the car tags. Using the examples shown above, the kuid-table would be (the kuid order is not important):-

kuid-table
{
  0                                     <kuid:329364:1568>
  1                                     <kuid:309161:100599>
  2                                     <kuid2:329364:1689:1>
  3                                     <kuid2:329364:1707:1>
  4                                     <kuid:61119:24120>
}

The Thumbnail Image

DotPoint.JPG A thumbnail image MUST be present in the asset


NotePad.PNG Notes:

The thumbnail image:-

  • must be in JPG format.
  • must be 240 pixels wide by 180 pixels tall.
  • does not have to be named thumbnail.jpg as long as the name used is in the Thumbnails container in the config.txt file.

Using the Asset

Once the new asset has been committed it will be available for use as a Region.

The region is specified when a new route is created and it can be altered by selecting Edit Route from the main menu in TANE or the edit menu in TRS19.

Top


Trainz Wiki

TrainzWiki.png

More Tutorials and Guides to Using Trainz


This page was created by Trainz user pware in April 2020 and was last updated as shown below.


Personal tools