https://wiki.sc4devotion.com/api.php?action=feedcontributions&user=TomekLecocq&feedformat=atomSC4D Encyclopaedia - User contributions [en]2024-03-28T13:08:35ZUser contributionsMediaWiki 1.33.0https://wiki.sc4devotion.com/index.php?title=File:Sc4traffic.png&diff=50140File:Sc4traffic.png2021-02-22T15:48:21Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=File:Iah.png&diff=50139File:Iah.png2021-02-22T15:48:11Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=File:Zz20.jpg&diff=50138File:Zz20.jpg2021-02-22T15:44:25Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=RUL_File&diff=50137RUL File2021-02-19T10:56:51Z<p>TomekLecocq: /* Multi-Network RUL Files */ Fix links</p>
<hr />
<div>'''RUL Files''' are internal game files which control the placement of [[Transit Network]] items in-game. There are numerous RUL Files used by the game, each of which has its own particular function. There are three different types of RUL Files: [[Individual Network RULs|Network-Specific RUL Files]], Multi-Network RUL Files, and [[Bridge RUL]]s. In addition, the [[Network INI]] file effectively functions like a RUL File. Because the format varies for each type of RUL File, the formats are covered on the individual pages for each RUL File type.<br />
<br />
The function of the RUL File is defined by its [[Instance ID]]. It is not possible to add new RUL Files, though it is possible to define new Bridge RULs for networks that do not already have them.<br />
<br />
==Network-Specific RUL Files==<br />
{{main|Individual Network RULs}}<br />
<br />
Each in-game network has two Network-Specific RUL Files, one Main RUL which defines the basic placement of the network, and one Supplemental RUL, which defines same-network overrides. There are 24 total Network Specific RULs.<br />
<br />
==Multi-Network RUL Files==<br />
There are three Multi-Network RUL Files, known by their IIDs: [[RUL0|RUL 0x10000000]] (RUL0), [[RUL1|RUL 0x10000001]] (RUL1) and [[RUL2|RUL 0x10000002]] (RUL2). These all handle situations that can involve multiple networks. RUL 0x10000000 is a particularly special case, since it deals exclusively with [[Puzzle Piece|ploppable network pieces]], as opposed to draggable network items. It is the only RUL file to do so. These three RUL files are often grouped in with [[INI]] files, for the similarity of their general format, in addition to the [[Network INI]] serving a similar purpose to these three RULs.<br />
<br />
{|width="80%" border="1" cellpadding="1" cellspacing="1"<br />
|-<br />
!Type ID<br />
!Group ID<br />
!Instance ID<br />
!Name<br />
!Description<br />
|-<br />
|0x0a5bcf4b<br />
|0xaa5bcf57<br />
|0x10000000<br />
|[[RUL0|Intersection Ordering]]<br />
|RUL 0x10000000<br />
|-<br />
|0x0a5bcf4b<br />
|0xaa5bcf57<br />
|0x10000001<br />
|[[RUL1|Intersection Solutions]]<br />
|RUL 0x10000001<br />
|-<br />
|0x0a5bcf4b<br />
|0xaa5bcf57<br />
|0x10000002<br />
|[[RUL2|Network Overrides]]<br />
|RUL 0x10000002<br />
|}<br />
<br />
==Bridge RULs==<br />
{{main|Bridge RUL}}<br />
<br />
Bridge RULs contain layout information for complex bridges, and allow for more control over custom bridges. Note that they are not required for all bridges, and not all network types have a corresponding Bridge RUL file.<br />
<br />
==Network INI==<br />
{{main|Network INI}}<br />
<br />
The Network INI file, while technically not a RUL file, combines many functions of the various RUL files. Prior to the release of [[Rush Hour]], this file contained all of the information that would eventually be split into the various RUL files. The extensive expansion of the transit networks with Rush Hour made containing all the network-related data in a single file impractical, and so the data was modularized into separate RUL Files. However, some network related information was left in the Network INI, such as: bridge shadows, Left-Hand Drive path substitution, power lines, and various bug fixes.<br />
<br />
==References==<br />
#[[Network Specs]]<br />
<br />
<br />
{{navbox/FORMAT}}<br />
<br />
[[Category:File Formats/SC4|RUL]]<br />
[[Category:Transit Modding]]</div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=RUL0&diff=50136RUL02021-02-19T10:55:42Z<p>TomekLecocq: /* CheckTypes */ Fix link</p>
<hr />
<div>{{Infobox TGI |<br />
| name = Intersection Ordering RUL<br />
| format = [[RUL File]]<br />
| type = 0x0A5BCF4B<br />
| group = 0xAA5BCF57<br />
| instance = 0x10000000<br />
| comments = ''See also: {{NetSpecs|IntersectionOrdering RUL}}''<br />
}}<br />
<br />
'''RUL 0x10000000''', also known as the '''Intersection Ordering RUL''' and '''RUL0''', is a [[RUL File]] which defines Interchanges and [[Puzzle Piece]]s and their placement into '''TAB Loops''' under a certain menu button. There are two different sections to this file, the first of which defines TAB Loops and Rotation Rings, the second of which defines the Puzzle Pieces and relates them to those Rotation Rings. The [[Network Addon Mod]] (NAM) relies on an extensive series of modifications to this file, crucial to its functionality. It is placed in the NetworkAddonMod_Controller.dat file. The original Maxis file can be found in SimCity_1.dat.<br />
<br />
Only one copy of this file can be loaded by the game at one time, so which ever one is last in alphabetical order in the Plugins will be loaded by the game. The [[Red Arrow Bug]] is caused by having transit mods with menu buttons that are not defined in the loaded version of RUL 0x10000000.<br />
<br />
It is important to note, before one starts editing this file, that it contains many intricately interconnected parts, and any modifications, no matter how simple, may have widespread effects, including crashing the game. It is also entirely possible for a section to be set up correctly, and still not behave effectively or as expected in-game due to conflicts with another, also correctly done, part of the file. This may be due to loading order, conflicting rules, properties that don't work together as expected, and any number of other problems. Sometimes this may work to your benefit, other times it may not.<br />
<br />
==TAB Loop Section==<br />
=== Basic Syntax ===<br />
The TAB Loops section of RUL 0x10000000 has a relatively basic syntax, and it consists of a series of lines of code known as '''Rotation Rings''', which reference Puzzle Pieces and their rotations and mirrors by an internal, RUL-specific series of reference numbers, known as ''IntersectionInfo IDs'' (hex-id's).<br />
<br />
The [[Maxis]] comments from within the file itself are:<br />
<pre><br />
; RotationRing = hex-id [,hex-id...]<br />
;<br />
; Creates a ring of rules that are cycled through via<br />
; Home/End or automatically by the tool as it tries to<br />
; auto-fit rules to the current mouse point.<br />
;<br />
; AddTypes = hex-id [,hex-id...]<br />
;<br />
; Attaches another ring to the last ring, creating type<br />
; rings perpendicular to the rotation ring. Type rings<br />
; can be cycled through via Tab/Shift-Tab. Generally,<br />
; type rings are set up to preserve rotation as you<br />
; cycle through rules of different network types.<br />
;<br />
; A given rule can only belong to ONE rotation ring and<br />
; ONE type ring. Attempting to hook a rule into more than<br />
; one rotation or type ring will result in the rings getting<br />
; trashed.<br />
</pre><br />
<br />
The first line of any TAB Loop will always begin with a "RotationRing =" reference, which defines the start of the loop. Consider the following example taken from the [[Rural Highway Mod|RHW]] Puzzle Piece TAB Loop:<br />
<pre><br />
RotationRing = 5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007 ;RHW-4 Starter Piece<br />
</pre><br />
<br />
Further Rotation Rings are defined by using the "AddTypes =" reference:<br />
<br />
<pre><br />
AddTypes = 5010, 5014, 5011, 5015, 5012, 5016, 5013, 5017 ;RHW-4/MIS-1 Ramp A<br />
AddTypes = 5020, 5024, 5021, 5025, 5022, 5026, 5023, 5027 ;RHW-4/MIS-1 Ramp B<br />
</pre><br />
<br />
Essentially, all of the rotations of a given intersection type (i.e. cloverleaf) for a particular set of intersecting networks are put on a single line, in clockwise order. The different combinations of intersecting network types (i.e. elevated highway/ground highway, elevated highway/avenue, etc.) are placed on successive lines so that you can tab through the network types (moving from one line to the next), or home/end through the rotations (moving along a line). The IntersectionInfo IDs are the last four digits of an [[Instance ID]] for that particular interchange.<br />
<br />
The user experience of this part of the RUL0 File in-game is that when you click on a particular menu button, you are presented with the first item in the ''RotationRing'' line. How you move through the particular TAB Loop depends on what buttons you press next:<br />
*Pressing "Home" will show you the next item on the same line.<br />
*Pressing "Tab" will show you the first item on the next line.<br />
<br />
Once the end of the line is reached, you are returned to the beginning of the line. Once the last line is reached, you are returned to the first line. Of course, pressing "End" moves you backwards through whatever line you are in, and pressing "Shift + Tab" moves you to the previous line in the loop.<br />
<br />
The difference between ''RotationRing'' and ''AddTypes'' lines is that ''RotationRing'' is used to define the start of a section, or button, whereas ''AddTypes'' is used for the successive items attached to that ''RotationRing''. So, having only one ''RotationRing'' and 10 ''AddTypes'' following it below is perfectly normal.<br />
<br />
The length of the RotationRing and AddTypes entries can vary quite dramatically, with some Maxis items only containing 2 entries, while the NAM One-Way Road puzzle pieces contain 32 IntersectionInfo IDs per line. The length of these lines (number of entries per line) must be kept consistent under a single TAB Loop. Otherwise, serious stability issues can result when using the TAB Loop, including missing and duplicate pieces and rotations, and in some cases, [[CTD]]s.<br />
<br />
While TAB Loops were initially only used for highway interchanges, they have been massively expanded by NAM to include the wide array of puzzle pieces made available by that mod. Consequently, while this specification will often refer to parts of the file as applied to highway interchanges, it is far from the only way these are used. The [[NAM Team]] has a set of guidelines for the placement of items within TAB Loops, in which the IntersectionInfo ID should begin with a specific digit depending on the primary network for the puzzle piece.<br />
<br />
IntersectionInfo ID references cannot be duplicated. For instance, once 5001 is used once as part of the RHW-4 Starter Piece Rotation Ring, it cannot be used in any other Rotation Ring. Otherwise, there will be flaws in the Rotation Rings referencing that ID, preventing them from functioning properly.<br />
<br />
===Relationship of Rotation Rings to Menu Icons===<br />
The menu button allowing access to the TAB Loop and its Rotation Rings consists of a [[PNG]] file showing the icon in its four states (as is the case with Lots), and an [[Exemplar]] (GID 0x2A3858E4) referencing the Rotation Ring. Two [[LTEXT]] files, one with a short description (GID 0x123006BB) and a long description (GID 0x123006AA), are also important to have. The IID for all of these files will always begin with "6A47", and the last four digits will correspond to the first IntersectionInfo ID (hex-ID) reference in the first Rotation Ring. For the example shown above, the IID for the RHW Puzzle Piece Menu Button would be 0x6A475000.<br />
<br />
==Intersection Tile Types Section==<br />
This is a very small part of the file, and simply contains a list of ''DefineType'' entries for each of the transit networks. For example,<br />
<br />
<pre><br />
DefineType = 0x00000000,Road<br />
DefineType = 0x00000002,Highway<br />
</pre><br />
<br />
The only two types defined originally were 0 and 2 as shown above, however the list has been expanded by NAM to include the other transit networks. The purpose of this section is not known (?really?), and it appears to be a backup system used by Maxis prior to [[Rush Hour]] that is obsolete at the present for defining intersection types. Modifying the values here has no effect on building intersections in game. It has also been noted that the entire section can be commented out without causing any known effects on the game.<br />
<br />
Another theory holds that this section defines types to be used later on in the CheckType sections of Puzzle Piece layouts (see Layout Section below).<br />
<br />
==Intersection Info Section==<br />
The '''Intersection Info Section''' of RUL 0x10000000 is the section that defines the actual Puzzle Pieces. There are three main sections to an IntersectionInfo ID entry. Please keep in mind that within each of these sections, the lines in that section can come in any order. The general progression is similar, but some things are moved around in different interchange definitions. However, it does not change how they are loaded in memory. Consequently, not every section will exactly follow the format prescribed below, however, all of the necessary parts must still be within the section somewhere. It should also be noted that while Maxis did provide comments on this section in the file, many of them have been found to be obsolete following major revisions to the file format caused by Rush Hour, and consequently are dealt with here only where they add some special information to the specification.<br />
<br />
===Header===<br />
The '''Header''' generally gives a description of the piece in question, info pertaining to the date of creation and the creator of the piece, and references the [[Preview Model]] and [[EFFDIR]] for the item. For example:<br />
<br />
<pre><br />
[HighwayIntersectionInfo_0x00009200]<br />
;Added by Tropod 06.08.04<br />
;avenue orthogonal x groundhighway orthogonal puzzle piece<br />
Piece = -16.0, 0.0, 0, 0, 0x54262400<br />
PreviewEffect = preview_aven_puzzlepiece008<br />
</pre><br />
<br />
The first line contains the Intersection Info reference that is used by the Rotation Rings in the TAB Loop Section. The format of this line is:<br />
<pre><br />
[HighwayIntersectionInfo_InstanceID]<br />
</pre><br />
<br />
The text before the IID must remain as "HighwayIntersectionInfo_" regardless of the network type(s) actually involved, or else the RUL will not be recognized. This is one example of carryover from when these RULs only applied to highway interchanges.<br />
<br />
Each interchange/overpass/junction/etc., must have a unique IID, otherwise conflicts will arise, and some/all of the rules with the same IID will not work. The Instance IDs typically have zeros in the first four digits to allow use in the TAB Loops, which only reference the last four digits of the IID (as the IntersectionInfo ID). While this is not strictly necessary for items not included in the TAB Loops, the same convention is often followed for convenience. An example of an item not in a TAB Loop would be an intersection that is always automatically created and cannot be plopped. Note also that NAM uses its own specific format for these IIDs, which can differ from the Maxis standard.<br />
<br />
The second and third lines of the header show the creator, date of creation, and a general description of the piece to which the entry pertains. These lines are commented out by a semi-colon (;) and are not read by the game (hence, they are technically optional).<br />
<br />
The fourth line, beginning with "Piece =" partially defines the Preview Model, more on this below.<br />
<br />
The fifth line, '''PreviewEffect''', references the alphanumeric name for the Preview Model, which is a string specified in the associated [[EFFDIR]] file. The EFFDIR entry in turn references the [[S3D]] file that is used for the semi-transparent preview of the interchange before you click the mouse button to plop it. Capital letters after the equals sign don’t seem to be valid, so be sure to use only lower case.<br />
<br />
====Piece====<br />
The '''Piece''' lines are real oddballs. They predate Rush Hour, and have been rendered partially useless. Prior to Rush Hour, an intersection preview was made using a single ploppable piece. Since Rush hour, that has been changed so that the effect directory (EFFDIR) makes the preview. However this line is still absolutely necessary for the game to build the intersection, and commenting one out will crash the game.<br />
<br />
An example Piece line is repeated here for reference:<br />
<pre><br />
Piece = -16.0, 0.0, 0, 0, 0x54262400<br />
</pre><br />
<br />
The format of this line is:<br />
<pre><br />
Piece = X-offsest, Y-offset, Rotation, Flip, PreviewIID<br />
</pre><br />
<br />
The first two values of the Piece line control the position of the cursor when placing the intersection, relative to the preview of the intersection. This does not affect the actual plopping position though. The first is how deep to the left (or E/W direction), from the right side of the intersection on cell layout, the cursor should be in the form of a value with one decimal. Positive values are east, and negative values west. The second is where relative to the top or bottom on the cell layout (or N/S direction) the cursor should be from the vertical center. Positive values are north, and negative south.<br />
<br />
The 3rd is a rotation key for the preview, setting it to 0 implies no rotation, setting it to 1 will turn the preview of the intersection by 90 degrees, and so forth for setting it to 2 and 3.<br />
<br />
The 4th is a sort of preview flip (or mirror) key. Setting it to 1 instead of 0 will make it so that if you were to build a T-intersection on one side of a highway, with the face pointing down, hovering the intersection on that side of the highway would now show it as pointing up on the z-axis instead. It has no effect on the actual plop however.<br />
<br />
The 5th value contains the pre-Rush Hour Instance ID for the entire intersection to use as a preview. An actual IID has to actually be referenced here, whether it's the correct IID or not, otherwise the preview model itself may not work properly.<br />
<br />
The CellLayout/ConsLayout lines in the Layout Section containing "< ^" also have a bearing on the point of focus for the cursor and the Preview Model, in conjunction with the Piece line.<br />
<br />
===Layout Section===<br />
The '''Layout''' portion defines where the Puzzle Piece Models are placed, the fundamental layout of the piece according to basic network pieces, any draggable stub handles, and the slope orientation of the puzzle piece. It typically consists of three subsections, the '''CellLayout''', '''CheckType''', and '''ConsLayout''', as well as the '''AutoTileBase''' property, as shown below.<br />
<br />
<pre><br />
CellLayout =........... <br />
CellLayout =....WX....< <br />
CellLayout =....YZ..... <br />
CellLayout =.....^..... <br />
<br />
CheckType = W - groundhighway: 0x02040200 avenue: 0x04020002 <br />
CheckType = X - groundhighway: 0x02000204 avenue: 0x04020002 <br />
CheckType = Y - groundhighway: 0x02040200 avenue: 0x00020402 <br />
CheckType = Z - groundhighway: 0x02000204 avenue: 0x00020402 <br />
<br />
ConsLayout =........... <br />
ConsLayout =....++....< <br />
ConsLayout =....++..... <br />
ConsLayout =.....^..... <br />
<br />
AutoTileBase= 0x54262300<br />
</pre><br />
<br />
The arrows (< and ^) on both the CellLayout and ConsLayout define the "cursor position" when placing the piece (which, in this example, is on the tile marked "X" in CellLayout). It must be the in the same location in both sections, or else there will be unpredictable results. <br />
<br />
====CellLayout and AutoTileBase====<br />
The '''CellLayout''' subsection defines the layout and design of the puzzle piece, telling the game where to look for and place the individual models that make up each puzzle piece. Generally speaking, the "top-left" corner of this layout corresponds to the "lowest" IID used in the puzzle piece, which is defined in the '''AutoTileBase''' line, at the end of the Layout Section. The game automatically generates a grid of IIDs based upon the AutoTileBase value.<br />
<br />
In the example above, the tile in the CellLayout marked "W" is the "top-left" tile, and corresponds to 0x54262300 (the AutoTileBase IID). The game determines horizontal and vertical positioning of the other individual single-tile models forming the puzzle piece based upon the AutoTileBase IID, with pieces to the right having IIDs increasing by 100 per tile (incrementing the 6th digit), and pieces below it increasing by 10 per tile (incrementing the 7th digit). Thus, the piece marked "X" will have an IID of 0x54262400 (1 tile to the right), "Y" will have an IID of 0x54262310 (1 tile below), and "Z" will have an IID of 0x54262410 (1 tile to the right and 1 tile below).<br />
<br />
*'''Note:''' Though the game engine is capable of counting beyond 16 (0x#####FF0) tiles in either down and/or across directions for a single item, it is highly advisable to keep an item within a 16x16 tile size. Anything over this can cause problems.<br />
<br />
This relationship of the IID's is shown below in grid format. The "AutoTileBase" tile is shown in '''bold'''.<br />
<br />
<table><br />
<tr><th>0x54262300</th><td>0x54262400</td></tr><br />
<tr><td>0x54262310</td><td>0x54262410</td></tr><br />
</table><br />
<br />
The IID's referenced here are for [[Exemplar]] and [[SC4Path]] files, which then point towards the [[S3D]] files of the actual model.<br />
<br />
As for that actual grid of letters and punctuation that makes up the CellLayout subsection, what that shows is where different types of tiles are located. Contrary to the included comments from Maxis, there are only four predefined values for the CellLayout:<br />
<br />
*The carrots (^,<) which define what the center tile is and where your mouse will be, so that the preview can be aligned with the intersection when it's plopped.<br />
*Periods (.) which tell the building engine to not look for a tile to plop in that position.<br />
*Plus signs (+) which tell the building engine to look for a tile to place there, but the tile is a non-standard road tile, because it has no tile side rules. This is true for the actual ramps between road/highway and highway/highway. These tiles also do not show up in the CheckTypes section below.<br />
<br />
Everything else in there is completely arbitrary, though convention holds that when the same piece is repeated within the layout, the same character should be used for it in every location, unless there is a specific reason not to do so. Also note that the characters used here are related to the CheckType subsection that follows, and consequently the same character ''cannot'' be used for different types of tiles.<br />
<br />
====CheckTypes====<br />
The '''CheckTypes''' specify an underlying network configuration that lies below the piece. The CheckType has an effect on piece placement, and if set up properly, can allow for "auto-resolving", a useful feature which allows for a user to plop a piece directly over a base draggable network. The letters in the CellLayout ("X" in the format spec below) correspond with the same letters in the CheckType section. It is also possible to define tiles in CellLayout that do not relate to the CheckTypes, by specifying "+".<br />
<br />
CheckType lines have the following format:<br />
<pre><br />
CheckType = X - networkname: RULFlagByte, HexMask check optional<br />
</pre><br />
<br />
Items after the ''RULFlagByte'' are optional, and the items in a CheckType line don't always appear in the order shown above.<br />
<br />
*''RULFlagByte'' follows the same system of two digit South-East-North-West (0xSSEENNWW) [[Network Flags]] as is used in [[RUL1|RUL 0x10000001]] and the [[Individual Network RULs]].<br />
*''check'' makes the game engine check if the specified network tile already exists in this position. If so, it must correspond to the RULFlagByte portion that the HexMask defines. Tile definitions in CheckTypes with "check" tags at the end are not counted in the IID grid, and instead create stubs for connecting the puzzle piece to surrounding draggable networks.<br />
*''optional'' tells the game engine to not look for a S3D file for this tile of the interchange. Rather, it looks for a network tile of the specified network which corresponds to the RULFlagByte, and uses that S3D or FSH. If a tile of this network already exists there, it must correspond to the portion of the RULFlagByte that the HexMask defines. <br />
*''HexMask'' tells the ''check'' and ''optional'' conditions which sides of the tile to check against the RULFlagByte. ''"ff"'' denotes that it must match, ''"00"'' denotes that it does not need to comply. "00" indicates a direction that the stub cannot be connected, while "ff" indicates a direction that a stub can be connected.<br />
<br />
CheckType lines must include a set of values for each network that crosses that particular tile. For example, where only one network crosses the tile (in this case a highway), you can have:<br />
<pre><br />
CheckType = e - highway:0x02040000,0xffff00ff check<br />
</pre><br />
Which shows the use of the HexMask and ''check'' properties.<br />
<br />
Whereas if two networks cross the tile (in this case a highway and an avenue), you can have:<br />
<pre><br />
CheckType = A - highway: 0x02040200 avenue: 0x04020002<br />
</pre><br />
In this case all you have are the networkname and RULFlagByte properties for each network.<br />
<br />
====ConsLayout====<br />
The '''ConsLayout''' section, short for "Construction Layout", controls how the terrain is affected when the piece is placed, in conjunction with either the default Maxis slope properties, or whatever [[Slope Mod]] the user may have installed. Basically, it is there to modify the terrain to make sure the intersection plops properly. In more technical terms, it relates to the [[Network Tuning Exemplars]]. There are several different symbolic flags used here:<br />
<br />
<pre><br />
|, - : Orthogonal<br />
/, \ : Diagonal<br />
# : Intersection (Orthogonal)<br />
X : Intersection (Diagonal)<br />
+ : Special - Matches terrain according to neighboring tiles, loosely "match existing slope."<br />
Can cause "sinkhole-to-China" bugs if used improperly.<br />
. : Similar to CellLayout, tells the game not to check or modify terrain here.<br />
^, < : Same as CellLayout, define the center of the piece. Must match the same location used in CellLayout.<br />
</pre><br />
<br />
While the ConsLayout is fairly flexible in terms of what you put into it, at times, if it is set in certain ways, it can prevent the puzzle piece from being placed in-game, even on perfectly flat terrain. Note that other characters than those listed above may be used, however their use is rare.<br />
<br />
The -,|,/,and \ represent the various angles of the road to correct the terrain for, the #'s are for the center of the intersection or the base, which must all be on the correct terrain to look good, and the X's are for on-ramps, which if not present will have the onramps on wierd angles on hilly terrain.<br />
<br />
===Definition Section===<br />
The '''Definition''' section is the final part of an IntersectionInfo ID entry, and contains various items that provide additional information about the puzzle piece or interchange being defined in the previous two sections of the entry. The properties that may be included in a Definition section are shown below as an example. Note that it is common for only some of these properties to be present. Additionally, some of these are only used on Maxis items, and have essentially been deprecated.<br />
<br />
<pre><br />
AutoPathBase = 0x12345000<br />
AutoTileBase = 0x54262300<br />
ReplacementIntersection = 0, 0<br />
PlaceQueryID = 0xB0009055<br />
Costs = 1000<br />
ConvertQueryID = 0xB000E820<br />
AutoPlace = 1<br />
HandleOffset = 2,0<br />
StepOffsets = -6, 6<br />
OneWayDir = 4<br />
</pre><br />
<br />
As you can see in that example, ''AutoTileBase'' may be considered part of the Definition section. However, since it relates to the layout of the tiles in the interchange, it is described in the Layout section above. Either way, it is always there, and always in the same spot, whether you consider that the end of the Layout section or beginning of the Definition section. If ''AutoPathBase'' is present, it comes before AutoTileBase.<br />
<br />
There are several properties contained in this section, and they are defined below:<br />
*''AutoPathBase'' specifies the path for the "top-left" tile in the layout, generally when the IID of the desired path differs from the AutoTileBase IID. This item is almost exactly the same as the AutoTileBase function, and works in the same manner, a key difference with this function though is that it only references Path file(s), nothing else. This is typically used to "copy" a path or a set of paths from another puzzle piece, as is the case with some of the Pedestrian Mall puzzle pieces. This function is optional. In order to use this function, it should be placed just before the AutoTileBase function, otherwise it may not work properly. Also, the actual existence of path files in the range being called from the AutoTileBase function may void this function. Generally, it isn’t used a great deal, but is quite useful when needed. <br />
*''AutoTileBase'' is defined in the Layout section above.<br />
*''ReplacementIntersection'' is generally not used. The ReplacementIntersection line takes an intersection and rotates and flips it to create another intersection as needed, with the first value being the rotation and the second being the flip. The purpose of this property is not known, and Maxis themselves appear to never use it, always providing the value 0,0.<br />
*''PlaceQueryID'' references the IID of the LTEXT file that will show when the puzzle piece is being hovered. This controls what the query tool shows when you have picked a specific interchange/junction type from the menu, and are trying to place the interchange/junction. Note that these LTEXT files may need to have a specific Group ID in order for them to work properly.<br />
*''Costs'' defines the cost of placing the item in game, in [[Simoleon]]s. It is the cost that appears in the menu, as well as the cost to build the intersection assuming all needed pieces minus the intersection itself are already in place. The price increases substantially for each required piece not already in place or when the intersection piece is not being built on flat land. The bulldoze cost, however, is always set, based upon the costs of the Maxis Highway network, regardless of the network types actually specified in the CheckTypes. Depending on the make-up of the rules for an item, the actual cost displayed and the cost charged to the budget may differ slightly from the Cost figure listed here in the RUL file. This is quite normal.<br />
*''ConvertQueryID'' references the IID of LTEXT files relating to the optional auto-placement of puzzle pieces, as is done with the Elevated Highway-to-Ground Highway transition piece in the NAM. Basically controls what is displayed in the pop-up window that appears, for placing a given network junction/interchange. This only appears though when the Rules are triggered by using the network tools, and not a specific Menu Button for a given interchange/junction. Note that these LTEXT files may need to have a specific Group ID in order for them to work properly.<br />
*''AutoPlace'' basically says to create the interchange/junction automatically when the Rules apply. However, the ConvertQueryID needs to be removed/commented out for the AutoPlace function to work effectively.<br />
<br />
A '''note about AutoPlace and ConvertQueryID functions''': The rules/engine can often be rather picky about some rules, especially if there is more than one item with same/similar rules with either of these functions in place. If either of these two functions for an item don't seem to be working as they should, it is quite possible that the rules in place aren't working as they should, contain errors, and/or another item in the RUL file is conflicting with it, which unfortunately does happen. Subsequently this means that only one of the items/set of rules may be able to call the function properly, in which case it may be better to have the item(s) manually placed or handled in some other way. <br />
<br />
*''HandleOffset'' specifies the place to build the intersection relative to where you're hovering. Both values can be any number that can fit on the map from your position both positive or negative. The first value is the distance straight out from your cursor in a line the intersection will build at, either x or z. The second value is the distance to the side that the intersection will build at, once you have reached the destination specified by the first value. For example, you can have an intersection build 20 tiles out, and 15 to the side of where you are trying to plop. It is not generally used.<br />
*''StepOffsets'' sets parameters for dragging that must be achieved before the intersection can be considered valid. The second value is how far from the intersection you must continue dragging until it is valid, the bigger the number, the further from the intersection you must drag. The first value controls the start offset or where you should be dragging from to make it a legal intersection, however it doesn't seem to work, and changing the value to a high negative, a positive, or a 0 has had no effect on the starting drag point necessary in any testing that has been performed. An effect similar to this can be seen when placing highway interchanges, in that it is generally not possible to place multiple interchanges in the same travel direction adjacent to each other, as well as the condition where the highway needs to continue so many tiles past an intersecting road to place an interchange at the intersection. The mechanics of how these relate to each other is not well known or documented however. Note also that this property is sometimes located at the end of the Header section of the entry, before the Layout section.<br />
*''OneWayDir'' specifies the direction the one way road is going out of the 8 possible radiating directions where a highway is in an intersection with a one way road. Possible values are 0 to 7, with 0 being West, and continuing clockwise to 7 being Southwest. The use of this function is also not well documented.<br />
<br />
===Rotation Section===<br />
The '''Rotation Section''' allows one to take a full Layout and transform by rotating and mirroring it in various ways without requiring a new Layout, and also, to fill out Rotation Rings with Rotation Clones. It fully replaces the Layout and Definition sections of the entry. A typical IntersectionInfo ID entry with a Rotation section may look like:<br />
<br />
<pre><br />
[HighwayIntersectionInfo_0x00009A18]<br />
;comments as desired<br />
CopyFrom = 0x9A10<br />
PlaceQueryID = 0x5CE42101<br />
Transpose = 1<br />
Rotate = 1<br />
</pre><br />
<br />
Note that the first line of the Header section, the ''HighwayIntersectionInfo_IID'' part, is still required when using a Rotation section, since this is essentially a definition of an entirely new interchange. It simply copies all of its properties from some previously defined interchange.<br />
<br />
The following properties are valid in a Rotation section:<br />
*''CopyFrom'' basically specifies another ''IntersectionInfo ID'' to copy the Layout, Preview Model, etc. from. Because of how the RUL file is loaded, the CopyFrom function must specify an IID that is lower than that of the current entry.<br />
*''PlaceQueryID'' works the same as in the Definition section of a normal entry, and simply replaces the LTEXT of the item being copied with a new LTEXT specifically for this interchange. The command must be placed under the ''CopyFrom'' command, but before any transformation commands.<br />
*''Rotate'' rotates the puzzle pieces clockwise in 90 degree segments. The resulting rotation is 90 * (value), valid values are 0 to 3.<br />
*''Transpose'' is essentially a mirror command. It does not work on pieces using [[False Intersection]]s, such as starter pieces for [[Override Network]]s. Possible values are 0 or 1, 0=no flip, 1=flipped.<br />
<br />
'''Note:''' While the Transpose and Rotate functions can be used together, this is not done in practice since any rotations which require both are simply transformed from an interchange which has already been rotated. Using the two together in the same entry has also been known to crash the game upon entering the section in-game through rotating to the section.<br />
<br />
==References==<br />
#[[Network Specs]]<br />
<br />
<br />
[[Category:NAM]]<br />
[[Category:RUL Files]]<br />
[[Category:Transit Modding]]<br />
[[Category:MTS2]]</div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=RUL2&diff=50135RUL22021-02-19T10:53:07Z<p>TomekLecocq: Replace all other missing imageshack images (recovered from archive.org).</p>
<hr />
<div>{{Infobox TGI |<br />
| name = Override RUL<br />
| format = [[RUL File]]<br />
| type = 0x0A5BCF4B<br />
| group = 0xAA5BCF57<br />
| instance = 0x10000002<br />
| comments = ''See also: {{NetSpecs|RuleOverrides RUL}}''<br />
}}<br />
<br />
'''RUL 0x10000002''', also known as the '''Override RUL''' and '''RUL2''' is used to override textures and models for the [[Transit Network|transit networks]]. Basically, it defines what happens when a texture or model is drawn next to another texture or model. It is essential for the [[NAM]] draggable networks such as [[GLR]], [[RHW]], [[SAM]] and [[HSRP]].<br />
<br />
This RUL is used to fix bugs and replace intersections/junctions and/or set-ups for whatever reason. It is also used to enforce, and/or follow on from, a set of rules from another [[RUL File]] to enhance a junction. One such example of this is the Avenue-to-Highway Transition. Note that this RUL can make impossible junctions possible, but doing so may require quite the number of rules. <br />
<br />
==Format==<br />
RUL 0x10000002 is probably the simplest [[RUL File]] in format, but hardest to grasp in practice. This file has one large section, titled '''RuleOverrides'''. It works by saying that if two textures or models are aligned next to each other like this:<br />
<br />
If '''Texture1''' is next to '''Texture2''' is True,<br />
<br />
Then '''Texture3''' replaces '''Texture1''' and '''Texture4''' replaces '''Texture2'''<br />
<br />
The file is further broken into subsections by way of comments that describe the lines, and essentially contains a long series of command lines. The format of the lines in this file is:<br />
<br />
<pre><br />
ID1,Rot1,Flip1,ID2,Rot2,Flip2=ID3,Rot3,Flip3,ID4,Rot4,Flip4<br />
</pre><br />
<br />
Where: <br />
*ID1 = Instance ID of the left tile.<br />
*ID2 = Instance ID of the right tile.<br />
*ID3 = Instance ID which replaces the left tile.<br />
*ID4 = Instance ID which replaces the right tile.<br />
*Rot_ = Rotation of the texture, values are 0, 1, 2, or 3.<br />
*Flip_ = The flip, or mirror, of the texture. Values are either 0=not mirrored or 1=mirrored.<br />
<br />
Graphically,<br />
<br />
[[Image:Ruls1jy6.jpg]]<br />
<br />
The [[Instance ID]]s of the textures can reference either a [[FSH]] or [[Exemplar]] file. Rotation goes clockwise from 0 to 3. If flip=1, then rotation goes counterclockwise. The ''flip'' property is not often used, but it is used with textures like the 90 Degree Turn Transition Piece from Street to Road.<br />
<br />
These particular rules are very powerful, since one line makes them work in all four cardinal orientations. The left/right perspective is not set in stone to a cardinal direction. Rather, the right side of Tile1 has to border the left side of Tile2.<br />
<br />
Also, having zeros in the ID1a and ID2a spots causes a bad draw (red line). This is to keep things from being constructed which don't look right, but still conform to all the other RULs. <br />
<br />
An example line from this file is:<br />
<br />
[[Image:Ruls2gf2.jpg]]<br />
<br />
Textures 1 and 2 are the original side by side textures you want to override, and Textures 3 and 4 are the new textures you want to replace the old ones with. Texture 3 replaces Texture 1, and Texture 4 replaces Texture 2.<br />
<br />
==A Guide to Texture Overrides==<br />
This is an intermediate skill level tutorial that is intended to help those wanting to learn how to edit RUL 0x10000002. In this tutorial you will learn the very basics of transit modding. This includes determining how to make an override of a side by side texture setup, determining what rotations do, how mirroring works, etc. It is recommended that you are understanding of how to use [[SC4Tool]]'s Texture Creator, iLive's [[Reader]] Texture Viewer and the basic functions of iLive's Reader.<br />
<br />
===Finding Textures===<br />
This section will explain how to find textures, their IIDs and their 0 position. You will be using iLive’s Reader and SC4Tool in this section.<br />
<br />
====A. iLive's Reader - Texture Viewer====<br />
Let's start by learning about some of the basic uses of iLive's Reader in Transit Modding. Probably one of the most important skills is learning how to use the Texture Viewer. It is very simple to use. To open go to Tools -> Texture Viewer as shown below:<br />
<br />
[[Image:Textureviewer1km9.jpg]]<br />
<br />
Texture Viewer has two main sections: Transit Textures, and Other Textures. The only limit to the Texture Viewer is that is only shows the textures from the SimCity_#.dat files in your MAXIS\Sim City 4\ folder. You will notice when you select the first section, Street/Road/Rail/Highway, the 5 zoom levels will show up and you will have to choose one of the following zooms to view the textures. It is recommended to choose Zooms 4 or 5 because they are the easiest to see.<br />
<br />
[[Image:Textureviewer2he3.jpg]]<br />
<br />
Once you choose your zoom you will have textures show up in the right area. These will be all the textures for a given network. You will notice on the left under you zoom level that all the Networks have been shown (Street, Road, OWR, etc.). For this tutorial, let's go with the easiest one: Streets. Streets have the fewest number of textures because any major intersections are found under the network that the Street is intersecting with, and that there are no diagonals.<br />
<br />
Now, Texture Viewer shows all the textures in 0 position. We will get to that later. But, the Texture Viewer is good for 2 things, finding a texture and its IID, and finding which position the game considers 0 position. Also, it shows all 4 wealth levels of the texture.<br />
<br />
[[Image:Textureviewer3mu0.jpg]]<br />
<br />
====B. SC4Tool - Texture Creator====<br />
<br />
Now, iLive's Reader is great for finding textures created by [[Maxis]], but what if you are looking for a texture that has been added later in NAM or SAM or RHW? Well, this is where SC4Tool is handy.<br />
<br />
So, lets see how this works. It's a little different, when SC4Tool loads, use the Tool selection screen and choose Texture Creator.<br />
<br />
[[Image:Texturecreator1lm1.jpg]]<br />
<br />
When the Texture Viewer loads you will then have to click the Folder icon which allows you to browse and open the file in which the texture is in.<br />
<br />
[[Image:Texturecreator2ho8.jpg]]<br />
<br />
When the file has been loaded you will see a long list of folders with numbers next to them. These numbers are the IIDs of the texture set. By selecting one of the folders it will show you all 5 zoom levels of the corresponding texture. As shown, it will tell you some information about the texture in the right and it will also preview the texture in 0 position.<br />
<br />
[[Image:Texturecreator3yp9.jpg]]<br />
<br />
===Rotation Determining===<br />
This section will explain how to determine the rotation of a texture. This is a critical part of writing RULs because if you have the rotations wrong the override will either not work or it will show up improperly. Determining the rotation is fairly simple, but sometimes it is hard when trying to figure things out when the textures are side by side.<br />
<br />
====A. Rotation of a single texture====<br />
To start, there are 8 total positions of a texture, the 4 rotations (0, 1, 2, and 3), then there is the mirror of the texture (mirroring will be explained later below). The next four pictures show the T-Intersection for Asphalt Streets made by [[People:Hableurg|Hableurg]] in its four rotations.<br />
<br />
<div><ul> <br />
<li style="display: inline-block;"> [[Image:Tintersection0nx6.jpg|frame|none|Rotation 0]] </li><br />
<li style="display: inline-block;"> [[Image:Tintersection1re2.jpg|frame|none|Rotation 1]] </li><br />
<li style="display: inline-block;"> [[Image:Tintersection2yp9.jpg|frame|none|Rotation 2]] </li><br />
<li style="display: inline-block;"> [[Image:Tintersection3xd8.jpg|frame|none|Rotation 3]] </li><br />
</ul></div><br />
<br />
The rotation of a texture happens in a clockwise progression in 90 degree increments.<br />
<br />
====B. Side by Side Textures====<br />
Now we are going to start getting into the juicy stuff. Side by side textures are how RUL 0x10000002 works. This has to be shown, it is close to impossible to explain. This will involve one example with a few small exercises.<br />
<br />
'''Example:'''<br />
We are dragging a straight street into a street that is perpendicular making a T-Intersection. Now, instead of the original Maxis textures, we are writing an override RUL for a SAM texture set.<br />
<br />
Obviously for this there will be multiple variations, but let's start with the Straight Piece on the left and the T-Intersection on the right.<br />
<br />
[[Image:Straight1ni0.jpg]] [[Image:Tintersection2yp9.jpg]]<br />
<br />
As shown above this is the result we are looking for. But how do we get here? Well, we must look at each texture individually. Let's start with the T-Intersection first. If we look at the previous section we will notice that the 0 position of the T-Intersection is facing the opposite direction. Now, visually in your mind take the 0 position and rotate it in 90 degree increments clockwise until it is in the position you want.<br />
<br />
[[Image:Tintersection0nx6.jpg|frame|none|Rotation 0]]<br />
<br />
[[Image:Tintersection1re2.jpg|frame|none|Rotation 1]]<br />
<br />
[[Image:Tintersection2yp9.jpg|frame|none|Rotation 2]]<br />
<br />
As you can see, to match the resultant we want, we must rotate the texture 180 degrees. This will give us rotation #2. So, this means that the Straight Piece will be next to a T-Intersection in Rotation #2. We are half way there. We now must determine the rotation of the Straight Piece. Use iLive's Reader Texture Viewer and look for the Street Straight Piece to find out what the 0 position is.<br />
<br />
[[Image:Straight0in9.jpg]]<br />
<br />
You will find that the 0 position the Straight Piece runs up and down. As shown above. So, what rotation(s) will the Straight Piece line up with the T-Intersection in Rotation position #2? Rotate the Straight Piece 90 degrees clockwise 3 times and find out.<br />
<br />
You will find that when the texture is rotated 90 and 270 degrees it will fit the result shown in the original example. This means Rotations 1 and 3 both work. Which one do we choose? We choose both and write the code for both to get all variations of the intersection.<br />
<br />
So, your results are:<br />
*Straight Piece, Rotation 1 beside T-Intersection, Rotation 2, and<br />
*Straight Piece, Rotation 3 beside T-Intersection, Rotation 2.<br />
<br />
Now you know how to determine texture rotations. Let's try some small exercises. The answers are hidden, just click on "show answer" to uncover the answer.<br />
<br />
{| role="presentation" class="wikitable"<br />
| [[Image:Straight1ni0.jpg]] [[Image:90turn1ge1.jpg]]<br />
|-<br />
| <div class="mw-collapsible mw-collapsed" data-expandtext="Show answer" data-collapsetext="Hide answer">Straight Piece, Rotation 1 beside 90 Turn, Rotation 1</div><br />
|}<br />
<br />
{| role="presentation" class="wikitable"<br />
| [[Image:90turn3fa6.jpg]] [[Image:Tintersection3xd8.jpg]]<br />
|-<br />
| <div class="mw-collapsible mw-collapsed" data-expandtext="Show answer" data-collapsetext="Hide answer">90 Turn, Rotation 3 beside T-Intersection, Rotation 3</div><br />
|}<br />
<br />
{| role="presentation" class="wikitable"<br />
| [[Image:Tintersection1re2.jpg]] [[Image:90turn2hg4.jpg]]<br />
|-<br />
| <div class="mw-collapsible mw-collapsed" data-expandtext="Show answer" data-collapsetext="Hide answer">T-Intersection, Rotation 1 beside 90 Turn, Rotation 2</div><br />
|}<br />
<br />
<br />
===Mirror Determining===<br />
Determining the orientation of a texture when it is mirrored and rotated is best summed up with a simple chart:<br />
<br />
[[Image:Rotation and flip cheat sheet.png]]<br />
<br />
There are two useful ways to determine the orientation of a flipped texture:<br />
#First apply the rotation, then a horizontal mirror, or<br />
#Mirror the texture horizontally and rotate the result counter-clockwise instead of the usual clockwise.<br />
<br />
Use whichever is more intuitive for you.<br />
<br />
===Coding RUL 0x10000002===<br />
This is how we tell the game to make a certain texture beside another turn into two new side by side textures. The coding uses the format explained at the top of this page. Let's go with something we are already familiar with, turning the Maxis Straight Piece next to the Maxis T-Intersection into the SAM Asphalt textures of the same.<br />
<br />
So, for this example:<br />
<br />
First step, find the IIDs of the textures and their 0 positions:<br />
<br />
MAXIS Straight Street = 0x05004b00<br />
MAXIS T-Intersection Street = 0x05005700<br />
<br />
SAM Asphalt Straight Street = 0x5e54b700<br />
SAM Asphalt T-Intersection Street = 0x5e557700<br />
<br />
Second, find out the Rotations you will need for all 4 pieces:<br />
<br />
MAXIS Straight Street = 1 or 3<br />
MAXIS T-Intersection Street = 2<br />
<br />
SAM Asphalt Straight Street = 1 or 3<br />
SAM Asphalt T-Intersection Street = 2<br />
<br />
Will there be any mirrors? Not for this case.<br />
<br />
Write the code for each texture:<br />
<br />
MAXIS Straight Street = 0x05004b00,1,0 or 0x05004b00,3,0<br />
MAXIS T-Intersection Street = 0x05005700,2,0<br />
<br />
SAM Asphalt Straight Street = 0x5e54b700,1,0 or 0x5e54b700,3,0<br />
SAM Asphalt T-Intersection Street = 0x5e557700,2,0<br />
<br />
Next you have to place these bits of code into the appropriate positions in the line:<br />
*Which texture should be Texture 1? MAXIS Straight Street<br />
*Which texture should be Texture 2? MAXIS T-Intersection Street<br />
*Which texture should be Texture 3? SAM Straight Street<br />
*Which texture should be Texture 4? SAM T-Intersection Street<br />
<br />
So, now you have all the information to write the whole line of code. Now, when you put it together you will have 2 variations of the ways this intersection can be formed:<br />
<br />
#Maxis Straight Street in Rotation #1:<pre>0x05004b00,1,0,0x05005700,2,0=0x5e54b700,1,0,0x5e557700,2,0</pre><br />
#Maxis Straight Street in Rotation #3:<pre>0x05004b00,3,0,0x05005700,2,0=0x5e54b700,3,0,0x5e557700,2,0</pre><br />
<br />
'''Please, use this information carefully and if you plan to make any modifications, contact members of the NAM Team for approval and help.'''<br />
<br />
==Subway Overrides==<br />
Subway overrides are slightly different to the normal texture overrides described above, but hopefully the text below will explain. Compared to other networks, not much is known about the subway network, and there can be some odd glitches/problems.<br />
<br />
===Instance IDs===<br />
====Models====<br />
The first 2 digits of subway model IIDs must always be ''07'', we have no idea why Maxis decided this, but we guess it is fixed in the EXE.<br />
<br />
The IIDs follow the same pattern as road IIDs: The straight road section IID is 0x'''00'''004b00, so the straight subway section IID is 0x'''07'''004b00.<br />
<br />
====Paths====<br />
Crazily, Maxis decided that the subway paths should not have the same IID as the model. All subway paths must always start with ''06''.<br />
<br />
The straight subway section model IID is 0x'''07'''004b00, so the path IID for that tile is 0x'''06'''004b00.<br />
<br />
===RUL 0x10000002 Coding===<br />
The RULs for subway overrides use exactly the same format as normal RULs, as described in the Format section above. However, the IIDs are represented differently than for the other networks. To determine the correct IID format, you must remove the 07 and any 0s following it that are not after another number, also it must not be shorter than 4 characters.<br />
<br />
To turn the IID ''0x07004b00'' into a Subway RUL IID:<br />
#Remove the 07 to get ''004b00''.<br />
#Next, remove the 0s at the beginning to get ''4b00''.<br />
<br />
===Examples===<br />
For a subway piece with an IID of 0x'''0700'''4b00, the resulting RUL2 code would be:<br />
'''0x4b00,0,0,0x4b00,0,0=0x########,0,0,0x########,0,0'''<br />
<br />
For a subway piece with an IID of 0x'''070'''20700, the resulting RUL2 code would be:<br />
'''0x20700,0,0,0x20700,0,0=0x########,0,0,0x########,0,0'''<br />
<br />
For a subway piece with an IID of 0x'''0700'''0300, the resulting RUL2 code would be:<br />
'''0x0300,0,0,0x0300,0,00x#########,0,0,0x########,0,0'''<br />
<br />
==References==<br />
#[[Network Specs]]<br />
<br />
<br />
[[Category:NAM]]<br />
[[Category:RUL Files]]<br />
[[Category:Transit Modding]]<br />
[[Category:MTS2]]</div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=File:Tintersection0nx6.jpg&diff=50134File:Tintersection0nx6.jpg2021-02-19T09:41:19Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=File:Tintersection1re2.jpg&diff=50133File:Tintersection1re2.jpg2021-02-19T09:41:10Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=File:Tintersection2yp9.jpg&diff=50132File:Tintersection2yp9.jpg2021-02-19T09:41:00Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=File:Tintersection3xd8.jpg&diff=50131File:Tintersection3xd8.jpg2021-02-19T09:40:51Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=File:Straight1ni0.jpg&diff=50130File:Straight1ni0.jpg2021-02-19T09:40:40Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=File:Straight0in9.jpg&diff=50129File:Straight0in9.jpg2021-02-19T09:40:29Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=File:90turn1ge1.jpg&diff=50128File:90turn1ge1.jpg2021-02-19T09:40:19Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=File:90turn3fa6.jpg&diff=50127File:90turn3fa6.jpg2021-02-19T09:40:07Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=File:90turn2hg4.jpg&diff=50126File:90turn2hg4.jpg2021-02-19T09:39:53Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=File:Texturecreator3yp9.jpg&diff=50125File:Texturecreator3yp9.jpg2021-02-19T09:33:47Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=File:Texturecreator2ho8.jpg&diff=50124File:Texturecreator2ho8.jpg2021-02-19T09:33:34Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=File:Texturecreator1lm1.jpg&diff=50123File:Texturecreator1lm1.jpg2021-02-19T09:33:21Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=RUL2&diff=50122RUL22021-02-19T09:29:16Z<p>TomekLecocq: /* A. iLive's Reader - Texture Viewer */ Replace missing imageshack images (recovered from archive.org)</p>
<hr />
<div>{{Infobox TGI |<br />
| name = Override RUL<br />
| format = [[RUL File]]<br />
| type = 0x0A5BCF4B<br />
| group = 0xAA5BCF57<br />
| instance = 0x10000002<br />
| comments = ''See also: {{NetSpecs|RuleOverrides RUL}}''<br />
}}<br />
<br />
'''RUL 0x10000002''', also known as the '''Override RUL''' and '''RUL2''' is used to override textures and models for the [[Transit Network|transit networks]]. Basically, it defines what happens when a texture or model is drawn next to another texture or model. It is essential for the [[NAM]] draggable networks such as [[GLR]], [[RHW]], [[SAM]] and [[HSRP]].<br />
<br />
This RUL is used to fix bugs and replace intersections/junctions and/or set-ups for whatever reason. It is also used to enforce, and/or follow on from, a set of rules from another [[RUL File]] to enhance a junction. One such example of this is the Avenue-to-Highway Transition. Note that this RUL can make impossible junctions possible, but doing so may require quite the number of rules. <br />
<br />
==Format==<br />
RUL 0x10000002 is probably the simplest [[RUL File]] in format, but hardest to grasp in practice. This file has one large section, titled '''RuleOverrides'''. It works by saying that if two textures or models are aligned next to each other like this:<br />
<br />
If '''Texture1''' is next to '''Texture2''' is True,<br />
<br />
Then '''Texture3''' replaces '''Texture1''' and '''Texture4''' replaces '''Texture2'''<br />
<br />
The file is further broken into subsections by way of comments that describe the lines, and essentially contains a long series of command lines. The format of the lines in this file is:<br />
<br />
<pre><br />
ID1,Rot1,Flip1,ID2,Rot2,Flip2=ID3,Rot3,Flip3,ID4,Rot4,Flip4<br />
</pre><br />
<br />
Where: <br />
*ID1 = Instance ID of the left tile.<br />
*ID2 = Instance ID of the right tile.<br />
*ID3 = Instance ID which replaces the left tile.<br />
*ID4 = Instance ID which replaces the right tile.<br />
*Rot_ = Rotation of the texture, values are 0, 1, 2, or 3.<br />
*Flip_ = The flip, or mirror, of the texture. Values are either 0=not mirrored or 1=mirrored.<br />
<br />
Graphically,<br />
<br />
[[Image:Ruls1jy6.jpg]]<br />
<br />
The [[Instance ID]]s of the textures can reference either a [[FSH]] or [[Exemplar]] file. Rotation goes clockwise from 0 to 3. If flip=1, then rotation goes counterclockwise. The ''flip'' property is not often used, but it is used with textures like the 90 Degree Turn Transition Piece from Street to Road.<br />
<br />
These particular rules are very powerful, since one line makes them work in all four cardinal orientations. The left/right perspective is not set in stone to a cardinal direction. Rather, the right side of Tile1 has to border the left side of Tile2.<br />
<br />
Also, having zeros in the ID1a and ID2a spots causes a bad draw (red line). This is to keep things from being constructed which don't look right, but still conform to all the other RULs. <br />
<br />
An example line from this file is:<br />
<br />
[[Image:Ruls2gf2.jpg]]<br />
<br />
Textures 1 and 2 are the original side by side textures you want to override, and Textures 3 and 4 are the new textures you want to replace the old ones with. Texture 3 replaces Texture 1, and Texture 4 replaces Texture 2.<br />
<br />
==A Guide to Texture Overrides==<br />
This is an intermediate skill level tutorial that is intended to help those wanting to learn how to edit RUL 0x10000002. In this tutorial you will learn the very basics of transit modding. This includes determining how to make an override of a side by side texture setup, determining what rotations do, how mirroring works, etc. It is recommended that you are understanding of how to use [[SC4Tool]]'s Texture Creator, iLive's [[Reader]] Texture Viewer and the basic functions of iLive's Reader.<br />
<br />
===Finding Textures===<br />
This section will explain how to find textures, their IIDs and their 0 position. You will be using iLive’s Reader and SC4Tool in this section.<br />
<br />
====A. iLive's Reader - Texture Viewer====<br />
Let's start by learning about some of the basic uses of iLive's Reader in Transit Modding. Probably one of the most important skills is learning how to use the Texture Viewer. It is very simple to use. To open go to Tools -> Texture Viewer as shown below:<br />
<br />
[[Image:Textureviewer1km9.jpg]]<br />
<br />
Texture Viewer has two main sections: Transit Textures, and Other Textures. The only limit to the Texture Viewer is that is only shows the textures from the SimCity_#.dat files in your MAXIS\Sim City 4\ folder. You will notice when you select the first section, Street/Road/Rail/Highway, the 5 zoom levels will show up and you will have to choose one of the following zooms to view the textures. It is recommended to choose Zooms 4 or 5 because they are the easiest to see.<br />
<br />
[[Image:Textureviewer2he3.jpg]]<br />
<br />
Once you choose your zoom you will have textures show up in the right area. These will be all the textures for a given network. You will notice on the left under you zoom level that all the Networks have been shown (Street, Road, OWR, etc.). For this tutorial, let's go with the easiest one: Streets. Streets have the fewest number of textures because any major intersections are found under the network that the Street is intersecting with, and that there are no diagonals.<br />
<br />
Now, Texture Viewer shows all the textures in 0 position. We will get to that later. But, the Texture Viewer is good for 2 things, finding a texture and its IID, and finding which position the game considers 0 position. Also, it shows all 4 wealth levels of the texture.<br />
<br />
[[Image:Textureviewer3mu0.jpg]]<br />
<br />
====B. SC4Tool - Texture Creator====<br />
<br />
Now, iLive's Reader is great for finding textures created by [[Maxis]], but what if you are looking for a texture that has been added later in NAM or SAM or RHW? Well, this is where SC4Tool is handy.<br />
<br />
So, lets see how this works. It's a little different, when SC4Tool loads, use the Tool selection screen and choose Texture Creator.<br />
<br />
http://img217.imageshack.us/img217/665/texturecreator1lm1.jpg<br />
<br />
When the Texture Viewer loads you will then have to click the Folder icon which allows you to browse and open the file in which the texture is in.<br />
<br />
http://img217.imageshack.us/img217/9851/texturecreator2ho8.jpg<br />
<br />
When the file has been loaded you will see a long list of folders with numbers next to them. These numbers are the IIDs of the texture set. By selecting one of the folders it will show you all 5 zoom levels of the corresponding texture. As shown, it will tell you some information about the texture in the right and it will also preview the texture in 0 position.<br />
<br />
http://img217.imageshack.us/img217/4968/texturecreator3yp9.jpg<br />
<br />
===Rotation Determining===<br />
This section will explain how to determine the rotation of a texture. This is a critical part of writing RULs because if you have the rotations wrong the override will either not work or it will show up improperly. Determining the rotation is fairly simple, but sometimes it is hard when trying to figure things out when the textures are side by side.<br />
<br />
====A. Rotation of a single texture====<br />
To start, there are 8 total positions of a texture, the 4 rotations (0, 1, 2, and 3), then there is the mirror of the texture (mirroring will be explained later below). The next four pictures show the T-Intersection for Asphalt Streets made by [[People:Hableurg|Hableurg]] in its four rotations.<br />
<br />
http://img217.imageshack.us/img217/5422/tintersection0nx6.jpg<br />
<br />
''Rotation 0''<br />
<br />
http://img217.imageshack.us/img217/4188/tintersection1re2.jpg<br />
<br />
''Rotation 1''<br />
<br />
http://img217.imageshack.us/img217/8594/tintersection2yp9.jpg<br />
<br />
''Rotation 2''<br />
<br />
http://img217.imageshack.us/img217/2850/tintersection3xd8.jpg<br />
<br />
''Rotation 3''<br />
<br />
The rotation of a texture happens in a clockwise progression in 90 degree increments.<br />
<br />
====B. Side by Side Textures====<br />
Now we are going to start getting into the juicy stuff. Side by side textures are how RUL 0x10000002 works. This has to be shown, it is close to impossible to explain. This will involve one example with a few small exercises.<br />
<br />
'''Example:'''<br />
We are dragging a straight street into a street that is perpendicular making a T-Intersection. Now, instead of the original Maxis textures, we are writing an override RUL for a SAM texture set.<br />
<br />
Obviously for this there will be multiple variations, but let's start with the Straight Piece on the left and the T-Intersection on the right.<br />
<br />
http://img217.imageshack.us/img217/9725/straight1ni0.jpg http://img217.imageshack.us/img217/8594/tintersection2yp9.jpg<br />
<br />
As shown above this is the result we are looking for. But how do we get here? Well, we must look at each texture individually. Let's start with the T-Intersection first. If we look at the previous section we will notice that the 0 position of the T-Intersection is facing the opposite direction. Now, visually in your mind take the 0 position and rotate it in 90 degree increments clockwise until it is in the position you want.<br />
<br />
http://img217.imageshack.us/img217/5422/tintersection0nx6.jpg<br />
<br />
''Rotation 0''<br />
<br />
http://img217.imageshack.us/img217/4188/tintersection1re2.jpg<br />
<br />
''Rotation 1''<br />
<br />
http://img217.imageshack.us/img217/8594/tintersection2yp9.jpg<br />
<br />
''Rotation 2''<br />
<br />
As you can see, to match the resultant we want, we must rotate the texture 180 degrees. This will give us rotation #2. So, this means that the Straight Piece will be next to a T-Intersection in Rotation #2. We are half way there. We now must determine the rotation of the Straight Piece. Use iLive's Reader Texture Viewer and look for the Street Straight Piece to find out what the 0 position is.<br />
<br />
http://img217.imageshack.us/img217/691/straight0in9.jpg<br />
<br />
You will find that the 0 position the Straight Piece runs up and down. As shown above. So, what rotation(s) will the Straight Piece line up with the T-Intersection in Rotation position #2? Rotate the Straight Piece 90 degrees clockwise 3 times and find out.<br />
<br />
You will find that when the texture is rotated 90 and 270 degrees it will fit the result shown in the original example. This means Rotations 1 and 3 both work. Which one do we choose? We choose both and write the code for both to get all variations of the intersection.<br />
<br />
So, your results are:<br />
*Straight Piece, Rotation 1 beside T-Intersection, Rotation 2, and<br />
*Straight Piece, Rotation 3 beside T-Intersection, Rotation 2.<br />
<br />
Now you know how to determine texture rotations. Let's try some small exercises. The answers are "whited out", just highlight them to uncover the answer.<br />
<br />
http://img217.imageshack.us/img217/9725/straight1ni0.jpg http://img217.imageshack.us/img217/25/90turn1ge1.jpg<br />
<br />
'''Answer:''' <span style="color:White">Stright Piece, Rotation 1 beside 90 Turn, Rotation 1</span><br />
<br />
http://img217.imageshack.us/img217/4467/90turn3fa6.jpg http://img217.imageshack.us/img217/2850/tintersection3xd8.jpg<br />
<br />
'''Answer:''' <span style="color:White">90 Turn, Rotation 3 beside T-Intersection, Rotation 3</span><br />
<br />
http://img217.imageshack.us/img217/4188/tintersection1re2.jpg http://img217.imageshack.us/img217/594/90turn2hg4.jpg<br />
<br />
'''Answer:''' <span style="color:White">T-Intersection, Rotation 1 beside 90 Turn, Rotation 2</span><br />
<br />
===Mirror Determining===<br />
Determining the orientation of a texture when it is mirrored and rotated is best summed up with a simple chart:<br />
<br />
[[Image:Rotation and flip cheat sheet.png]]<br />
<br />
There are two useful ways to determine the orientation of a flipped texture:<br />
#First apply the rotation, then a horizontal mirror, or<br />
#Mirror the texture horizontally and rotate the result counter-clockwise instead of the usual clockwise.<br />
<br />
Use whichever is more intuitive for you.<br />
<br />
===Coding RUL 0x10000002===<br />
This is how we tell the game to make a certain texture beside another turn into two new side by side textures. The coding uses the format explained at the top of this page. Let's go with something we are already familiar with, turning the Maxis Straight Piece next to the Maxis T-Intersection into the SAM Asphalt textures of the same.<br />
<br />
So, for this example:<br />
<br />
First step, find the IIDs of the textures and their 0 positions:<br />
<br />
MAXIS Straight Street = 0x05004b00<br />
MAXIS T-Intersection Street = 0x05005700<br />
<br />
SAM Asphalt Straight Street = 0x5e54b700<br />
SAM Asphalt T-Intersection Street = 0x5e557700<br />
<br />
Second, find out the Rotations you will need for all 4 pieces:<br />
<br />
MAXIS Straight Street = 1 or 3<br />
MAXIS T-Intersection Street = 2<br />
<br />
SAM Asphalt Straight Street = 1 or 3<br />
SAM Asphalt T-Intersection Street = 2<br />
<br />
Will there be any mirrors? Not for this case.<br />
<br />
Write the code for each texture:<br />
<br />
MAXIS Straight Street = 0x05004b00,1,0 or 0x05004b00,3,0<br />
MAXIS T-Intersection Street = 0x05005700,2,0<br />
<br />
SAM Asphalt Straight Street = 0x5e54b700,1,0 or 0x5e54b700,3,0<br />
SAM Asphalt T-Intersection Street = 0x5e557700,2,0<br />
<br />
Next you have to place these bits of code into the appropriate positions in the line:<br />
*Which texture should be Texture 1? MAXIS Straight Street<br />
*Which texture should be Texture 2? MAXIS T-Intersection Street<br />
*Which texture should be Texture 3? SAM Straight Street<br />
*Which texture should be Texture 4? SAM T-Intersection Street<br />
<br />
So, now you have all the information to write the whole line of code. Now, when you put it together you will have 2 variations of the ways this intersection can be formed:<br />
<br />
#Maxis Straight Street in Rotation #1:<pre>0x05004b00,1,0,0x05005700,2,0=0x5e54b700,1,0,0x5e557700,2,0</pre><br />
#Maxis Straight Street in Rotation #3:<pre>0x05004b00,3,0,0x05005700,2,0=0x5e54b700,3,0,0x5e557700,2,0</pre><br />
<br />
'''Please, use this information carefully and if you plan to make any modifications, contact members of the NAM Team for approval and help.'''<br />
<br />
==Subway Overrides==<br />
Subway overrides are slightly different to the normal texture overrides described above, but hopefully the text below will explain. Compared to other networks, not much is known about the subway network, and there can be some odd glitches/problems.<br />
<br />
===Instance IDs===<br />
====Models====<br />
The first 2 digits of subway model IIDs must always be ''07'', we have no idea why Maxis decided this, but we guess it is fixed in the EXE.<br />
<br />
The IIDs follow the same pattern as road IIDs: The straight road section IID is 0x'''00'''004b00, so the straight subway section IID is 0x'''07'''004b00.<br />
<br />
====Paths====<br />
Crazily, Maxis decided that the subway paths should not have the same IID as the model. All subway paths must always start with ''06''.<br />
<br />
The straight subway section model IID is 0x'''07'''004b00, so the path IID for that tile is 0x'''06'''004b00.<br />
<br />
===RUL 0x10000002 Coding===<br />
The RULs for subway overrides use exactly the same format as normal RULs, as described in the Format section above. However, the IIDs are represented differently than for the other networks. To determine the correct IID format, you must remove the 07 and any 0s following it that are not after another number, also it must not be shorter than 4 characters.<br />
<br />
To turn the IID ''0x07004b00'' into a Subway RUL IID:<br />
#Remove the 07 to get ''004b00''.<br />
#Next, remove the 0s at the beginning to get ''4b00''.<br />
<br />
===Examples===<br />
For a subway piece with an IID of 0x'''0700'''4b00, the resulting RUL2 code would be:<br />
'''0x4b00,0,0,0x4b00,0,0=0x########,0,0,0x########,0,0'''<br />
<br />
For a subway piece with an IID of 0x'''070'''20700, the resulting RUL2 code would be:<br />
'''0x20700,0,0,0x20700,0,0=0x########,0,0,0x########,0,0'''<br />
<br />
For a subway piece with an IID of 0x'''0700'''0300, the resulting RUL2 code would be:<br />
'''0x0300,0,0,0x0300,0,00x#########,0,0,0x########,0,0'''<br />
<br />
==References==<br />
#[[Network Specs]]<br />
<br />
<br />
[[Category:NAM]]<br />
[[Category:RUL Files]]<br />
[[Category:Transit Modding]]<br />
[[Category:MTS2]]</div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=File:Textureviewer3mu0.jpg&diff=50121File:Textureviewer3mu0.jpg2021-02-19T09:27:47Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=File:Textureviewer2he3.jpg&diff=50120File:Textureviewer2he3.jpg2021-02-19T09:26:33Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocqhttps://wiki.sc4devotion.com/index.php?title=File:Textureviewer1km9.jpg&diff=50119File:Textureviewer1km9.jpg2021-02-19T09:25:21Z<p>TomekLecocq: </p>
<hr />
<div></div>TomekLecocq