Difference between revisions of "Bridge RUL"

From SC4D Encyclopaedia
Jump to navigation Jump to search
sc4e>Blue Lightning
(In progress...)
 
m (4 revisions imported)
 
(15 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Infobox TGI |
+
'''Bridge Specialization RULs''' (often shortened to just "Bridge RULs") are special files that contain layout information for complex bridges such as arch bridges. They are not like the other [[RUL]] files, as their syntax is not [[INI]] based. All Bridge RULs have [[Type ID]] ''0x0A5BCF4B'', and [[Group ID]] ''0xAA5BCF57'', while the [[Instance ID]] for each varies as described below.
| name        = Bridge Specialization RUL
 
| format      = [[RUL File]]
 
| type        = 0x0A5BCF4B
 
| group      = 0xAA5BCF57
 
| instance    = Varies. See below
 
}}
 
 
 
Bridge Specialization RULs (often shortened to just "bridge RULs") are special files that contain layout information for complex bridges such as arch bridges. They are not like the other RUL files, as their syntax is not INI based.  
 
  
 
==History==
 
==History==
 +
The game originally only came with five Bridge RUL files, however others were possible and have been added over time. The original five files were for Roads, Rails, Elevated MHW, Avenue, and Ground MHW.
  
 
==Instances==
 
==Instances==
The bridge RULs have one instance per network. They have the general format <code>0x0000100N</code> where N is the network ID. <br/>
+
The Bridge RULs have one Instance ID per network. They have the general format ''0x0000100N'' where ''N'' is the network ID.
0x00001000: Road<br/>
+
 
0x00001001: Rail<br/>
+
List of Instance IDs:
0x00001002: Elevated Maxis Highway<br/>
+
*0x00001000: Road
0x00001003: Street<br/>
+
*0x00001001: Rail
0x00001004: Pipe ''(Unused)''<br/>
+
*0x00001002: Elevated Maxis Highway
0x00001005: PowerLine ''(Unused)''<br/>
+
*0x00001003: Street
0x00001006: Avenue<br/>
+
*0x00001004: Pipe ''(Unused)''
0x00001007: Subway ''(Unused)''<br/>
+
*0x00001005: PowerLine ''(Unused)''
0x00001008: Light Rail<br/>
+
*0x00001006: Avenue
0x00001009: Monorail<br/>
+
*0x00001007: Subway ''(Unused)''
0x0000100A: OneWayRoad<br/>
+
*0x00001008: Light Rail
0x0000100B: Dirt Road/RHW<br/>
+
*0x00001009: Monorail
0x0000100C: Ground Maxis Highway<br/>
+
*0x0000100A: OneWayRoad
 +
*0x0000100B: Dirt Road/[[RHW]]
 +
*0x0000100C: Ground Maxis Highway
  
Note that some networks currently do not have bridge RULs. The game does not require that a bridge RUL exists to draw bridges. Instead, any complex bridge will be drawn using simple rules dictated by the bridge exemplar.  
+
Note that some networks currently do not have Bridge RUL files. The game does not require that a bridge RUL exists to draw bridges. Instead, any complex bridge will be drawn using simple rules dictated by the bridge exemplar.
  
 
==Game Mechanics==
 
==Game Mechanics==
Once the game has decided that a network draw is suitable for bridge placement, the game picks a bridge (the first one that appears in the bridge selection menu) and evaluates it. The game knows the internal ID of the bridge (defined in the [[Network INI]]) and checks to see if a bridge RUL for that network exists. If the file exists, it looks inside of it to see if it has an entry for that bridge ID. If one is found, then it evaluates the RUL. The game looks for a layout line that has the same length as the bridge being drawn and produces the output. If the bridge RUL, entry, or layout line with the proper length does not exist the game evaluates the bridge using the exemplar and internal layout system.
+
Once the game has decided that a network draw is suitable for bridge placement, the game picks a bridge (the first one that appears in the bridge selection menu) and evaluates it. The game knows the internal '''Bridge ID''' of the bridge (defined in the [[Network INI]]) and checks to see if a Bridge RUL for that network type exists. If the file exists, it looks inside of it to see if it has an entry for that Bridge ID. If one is found, then it evaluates the RUL within that file. The game looks for a layout line that has the same length as the bridge being drawn and produces the output. If the Bridge RUL, entry, or layout line with the proper length does not exist, the game evaluates the bridge using the exemplar and internal layout system.
  
 
==Format==
 
==Format==
The format of bridge RULs differ greatly from the other RULs as they are not INI based. Instead, bridge RULs use start declarations and end tags.
+
The format of Bridge RULs differ greatly from the other RULs as they are not INI based. Instead, bridge RULs use start declarations and ''end'' tags. Comment lines begin with the <nowiki>#</nowiki> symbol.
 +
 
 +
Bridge RUL files consist of individual sections for each bridge listed within. Each bridge section then contains a header, repeating section definitions, repeating layout definitions, and finally and ''end'' flag. The general format of the file looks like:
 +
 
 +
<pre>
 +
bridge ID (header)
 +
  section definition 1
 +
  section definition 2
 +
  ...
 +
  section definition n
 +
  layout definition 1
 +
  layout definition 2
 +
  ...
 +
  layout definition n
 +
end
 +
 
 +
(repeat)
 +
</pre>
 +
 
 +
===Header===
 +
Each bridge section begins with a header, which is simply one line containing the Bridge ID for that bridge. The ID is the same one in the Network INI.
 +
 
 +
<pre>
 +
bridge ID
 +
</pre>
 +
 
 +
===Section Definitions===
 +
Section Definitions define a named segment (<code>SECTIONNAME</code>) of the bridge, consisting of one or more piece lines. These sections can then be called by name in other Section Definitions and the Layout Definitions to avoid having to list each tile individually for each line. They may consist of only a single piece line, or several.
 +
 
 +
<pre>
 +
section SECTIONNAME
 +
  piece <IID, ROTATION>
 +
  ...
 +
end
 +
</pre>
 +
 
 +
Piece lines have 4 varieties:
 +
#'''Simple piece''': <pre>piece <IID, rotation></pre>
 +
#'''Sloped piece''': <pre>piece <IID, rotation, deltaHeight, yOffset></pre> ''deltaHeight'' is the change in height across the tile (along the network) and ''yOffset'' is how far the model should be offset vertically.
 +
#'''Column piece''': Consists of either a Simple or Sloped piece followed by a Depth callout: <pre><IID,...>:Depth</pre>''Depth'' defines how far down the support column goes.
 +
#'''Compound piece''': Consists of several other section definitions strung together: <pre>SectionName_1 SectionName_2 ... SectionName_n</pre> This will import all of the pieces defined in each of the sections being called. The same modifiers used on Layout Definitions also work here.
 +
 
 +
When a section contains multiple piece lines, the evaluation depends on the tile width of the network. For single-tile-wide networks, each line simply adds another tile to the length of the section. For dual-tile networks, every two lines adds another tile to the length of the section (every two lines make up the two tiles that make up a two-tile-wide bridge).
 +
 
 +
Many sections are often defined to consolidate sections of a bridge such as having a section for the end piece, the approach, the support, start of the arch, middle of the arch, end of the arch, etc. Sections should be named using a short but descriptive name (although many [[NAM]] and Maxis items use rather cryptic names). Uppercase letters don't seem to be allowed, but numbers are.
 +
 
 +
===Layout Definitions===
 +
The final part of the bridge definition is the Layout Definitions. These are used to define the piece layout for bridges of specific lengths by specifying a string of Bridge Sections. Any bridge length not defined here is handled by the Bridge Exemplar.
 +
 
 +
Note that these sections may have two different formats:
 +
<pre>
 +
length LEN
 +
  piece SectionName_1 SectionName_2 ... SectionName_n
 +
end
 +
</pre>
 +
Or
 +
<pre>
 +
length LEN
 +
  piece SectionName_1
 +
  piece SectionName_2
 +
  ...
 +
  piece SectionName_n
 +
end
 +
</pre>
 +
 
 +
''LEN'' tells the game what length of bridge this section applies to. Note that this counter starts at zero, so acceptable values for ''LEN'' go up to 255. Note also that since bridges cannot cross city boundaries, it is not necessary to define bridges longer than 256 tiles since they cannot be built. However, bridges lengths up to 256 tiles may be, and often are, defined in these files.
 +
 
 +
''SectionName_x'' is the name of various sections defined previously in the file, in the Section Definitions for this bridge type.
  
Comments begin with <nowiki>#</nowiki>.
+
The ''SectionNames'' may be modified in various ways to shorten the necessary definition:
 +
*Prefixing a ''SectionName'' with a number and an asterisk (*) will repeat that section that number of times (i.e., <code>3*endpiece</code> will repeat <code>endpiece</code> 3 times).
 +
*Using <code>rev(SectionName)</code> will reverse the section.
  
<code>
 
    bridge ID
 
</code>
 
<br/> This begins a bridge section. The ID is the same one in the Network INI.
 
  
<code>
+
{{navbox/FORMAT}}
    section SECTION_NAME
 
        piece <IID, ROTATION>
 
        ...
 
    end
 
</code>
 
<br/> This defines a named segment of the bridge, consisting of one or more piece lines. Piece lines have 4 versions:<br/>
 
1. <IID, rotation>: Simple piece<br/>
 
2. <IID, rotation, deltaHeight, yOffset>: Piece that has a slope. ''deltaHheight'' is the change in height across the tile (along the network) and ''yOffset'' is how far the model should be offset vertically.<br/>
 
3. 1 or 2 followed by '':Depth'' : Piece with a support column. ''Depth'' defines how far down the support column goes.<br/>
 
4. SectionName_1 SectionName_2 ... SectionName_n: Import all the piece lines from SectionName. This type of segment can contain one or multiple section references.<br/>
 
  
When a section contains multiple piece lines, the evaluation depends on the tile width of the network. For single tile networks, each line
+
[[Category:File Formats/SC4]]
 +
[[Category:Transit Modding]]
 +
[[Category:MTS2]]

Latest revision as of 18:55, 8 August 2019

Bridge Specialization RULs (often shortened to just "Bridge RULs") are special files that contain layout information for complex bridges such as arch bridges. They are not like the other RUL files, as their syntax is not INI based. All Bridge RULs have Type ID 0x0A5BCF4B, and Group ID 0xAA5BCF57, while the Instance ID for each varies as described below.

History

The game originally only came with five Bridge RUL files, however others were possible and have been added over time. The original five files were for Roads, Rails, Elevated MHW, Avenue, and Ground MHW.

Instances

The Bridge RULs have one Instance ID per network. They have the general format 0x0000100N where N is the network ID.

List of Instance IDs:

  • 0x00001000: Road
  • 0x00001001: Rail
  • 0x00001002: Elevated Maxis Highway
  • 0x00001003: Street
  • 0x00001004: Pipe (Unused)
  • 0x00001005: PowerLine (Unused)
  • 0x00001006: Avenue
  • 0x00001007: Subway (Unused)
  • 0x00001008: Light Rail
  • 0x00001009: Monorail
  • 0x0000100A: OneWayRoad
  • 0x0000100B: Dirt Road/RHW
  • 0x0000100C: Ground Maxis Highway

Note that some networks currently do not have Bridge RUL files. The game does not require that a bridge RUL exists to draw bridges. Instead, any complex bridge will be drawn using simple rules dictated by the bridge exemplar.

Game Mechanics

Once the game has decided that a network draw is suitable for bridge placement, the game picks a bridge (the first one that appears in the bridge selection menu) and evaluates it. The game knows the internal Bridge ID of the bridge (defined in the Network INI) and checks to see if a Bridge RUL for that network type exists. If the file exists, it looks inside of it to see if it has an entry for that Bridge ID. If one is found, then it evaluates the RUL within that file. The game looks for a layout line that has the same length as the bridge being drawn and produces the output. If the Bridge RUL, entry, or layout line with the proper length does not exist, the game evaluates the bridge using the exemplar and internal layout system.

Format

The format of Bridge RULs differ greatly from the other RULs as they are not INI based. Instead, bridge RULs use start declarations and end tags. Comment lines begin with the # symbol.

Bridge RUL files consist of individual sections for each bridge listed within. Each bridge section then contains a header, repeating section definitions, repeating layout definitions, and finally and end flag. The general format of the file looks like:

bridge ID (header)
  section definition 1
  section definition 2
  ...
  section definition n
  layout definition 1
  layout definition 2
  ...
  layout definition n
end

(repeat)

Header

Each bridge section begins with a header, which is simply one line containing the Bridge ID for that bridge. The ID is the same one in the Network INI.

bridge ID

Section Definitions

Section Definitions define a named segment (SECTIONNAME) of the bridge, consisting of one or more piece lines. These sections can then be called by name in other Section Definitions and the Layout Definitions to avoid having to list each tile individually for each line. They may consist of only a single piece line, or several.

section SECTIONNAME
   piece <IID, ROTATION>
   ...
end

Piece lines have 4 varieties:

  1. Simple piece:
    piece <IID, rotation>
  2. Sloped piece:
    piece <IID, rotation, deltaHeight, yOffset>
    deltaHeight is the change in height across the tile (along the network) and yOffset is how far the model should be offset vertically.
  3. Column piece: Consists of either a Simple or Sloped piece followed by a Depth callout:
    <IID,...>:Depth
    Depth defines how far down the support column goes.
  4. Compound piece: Consists of several other section definitions strung together:
    SectionName_1 SectionName_2 ... SectionName_n
    This will import all of the pieces defined in each of the sections being called. The same modifiers used on Layout Definitions also work here.

When a section contains multiple piece lines, the evaluation depends on the tile width of the network. For single-tile-wide networks, each line simply adds another tile to the length of the section. For dual-tile networks, every two lines adds another tile to the length of the section (every two lines make up the two tiles that make up a two-tile-wide bridge).

Many sections are often defined to consolidate sections of a bridge such as having a section for the end piece, the approach, the support, start of the arch, middle of the arch, end of the arch, etc. Sections should be named using a short but descriptive name (although many NAM and Maxis items use rather cryptic names). Uppercase letters don't seem to be allowed, but numbers are.

Layout Definitions

The final part of the bridge definition is the Layout Definitions. These are used to define the piece layout for bridges of specific lengths by specifying a string of Bridge Sections. Any bridge length not defined here is handled by the Bridge Exemplar.

Note that these sections may have two different formats:

length LEN
   piece SectionName_1 SectionName_2 ... SectionName_n
end

Or

length LEN
   piece SectionName_1
   piece SectionName_2
   ...
   piece SectionName_n
end

LEN tells the game what length of bridge this section applies to. Note that this counter starts at zero, so acceptable values for LEN go up to 255. Note also that since bridges cannot cross city boundaries, it is not necessary to define bridges longer than 256 tiles since they cannot be built. However, bridges lengths up to 256 tiles may be, and often are, defined in these files.

SectionName_x is the name of various sections defined previously in the file, in the Section Definitions for this bridge type.

The SectionNames may be modified in various ways to shorten the necessary definition:

  • Prefixing a SectionName with a number and an asterisk (*) will repeat that section that number of times (i.e., 3*endpiece will repeat endpiece 3 times).
  • Using rev(SectionName) will reverse the section.