Difference between pages "FSH Format" and "RUL 0x10000002"

From SC4D Encyclopaedia
(Difference between pages)
Jump to navigation Jump to search
sc4e>Jondor
(→‎Bitmap or palette data: Added info about embedded mipmaps)
 
sc4e>Warrior
(Added a subway override section)
 
Line 1: Line 1:
EA PC SHAPE FORMAT - By Darkmatter and Karybdis
+
{{Infobox TGI |
 +
| name        = Override RUL
 +
| format      = [[RUL File]]
 +
| type        = 0x0A5BCF4B
 +
| group      = 0xAA5BCF57
 +
| instance    = 0x10000002
 +
}}
 +
'''RUL 0x10000002''', also known as the '''Override RUL''' is used to override textures and models for the [[Transit_Network|transit networks]]. {{check}}
  
 +
== A Guide to Texture Overrides ==
 +
This is a tutorial that is intended to help those wanting to learn the 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.
  
 +
  '''Requirements:'''
 +
  Intermediate Modder
 +
  iLive’s Reader
 +
  SC4Tool
  
== FSH SHPI Header ==
+
===Finding Textures===
  
SHPI (4 bytes)
 
  
INT32 - File Size
+
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.
  
INT32 - Number of Entries
+
'''A. iLive’s Reader -.Texture Viewer'''
  
Directory ID (4 bytes)
+
Lets 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 goto Tools -> Texture Viewer as shown below:
  
 +
http://img217.imageshack.us/img217/2759/textureviewer1km9.jpg
  
'''Directory ID legal entries''':
+
Texture Viewer has 2 main sections Transit Textures and Other Textures.  The only limit to the Texture Viewer is that is only show the textures from the SimCity_#.dat files in you 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.  I tend to always choose Zooms 4 or 5 because they are the easiest to see.
  
G354 - Building Textures
+
http://img217.imageshack.us/img217/7696/textureviewer2he3.jpg
 
G264 - Network Textures, Sim Textures, Sim heads, Sim animations, Trees, props, Base textures, Misc colours
 
  
G266 - 3d Animation textures (e.g. the green rotating diamond in loteditor.dat)
+
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.). Since I have been working on SAM a lot lately lets go with the easiest one, Streets.  Streets have the fewest number of textures.  This is because any major intersections are found under the Network that the Street is intersecting with, and that there are no diagonals.
  
G290 - Dispatch marker textures  
+
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.
  
G315 - Small Sim texture, Network Transport Model Textures (trains etc)
+
http://img217.imageshack.us/img217/9157/textureviewer3mu0.jpg
  
GIMX - UI Editor textures
+
'''B. SC4Tool -> Texture Creator'''
  
G344 - BAT gen texture maps
+
Now, iLive’s Reader is great for finding texture 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.  It is not as great as iLive’s Reader but it is still good for its use.
  
 +
So, lets see how this works.  It’s a little different, when SC4Tool loads use the Tool selection screen and choose Texture Creator.
  
== FSH Directory ==
+
http://img217.imageshack.us/img217/665/texturecreator1lm1.jpg
  
Entry Name (4 bytes)
+
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.
  
INT32 - Offset of the entry in the file
+
http://img217.imageshack.us/img217/9851/texturecreator2ho8.jpg
  
 +
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.
  
'''Entry names''':
+
http://img217.imageshack.us/img217/4968/texturecreator3yp9.jpg
  
!pal - Global palette for 8-bit Indexed Bitmaps.
+
===Rotation Determining===
  
0000 - Buildings, props, network intersections,and terrain textures.
+
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.
  
rail - Always used for a rail texture, whereas for street road intersections its always by instance.
+
A. Rotation of a single texture.
 
TB2  - First sprite animation entry in a directory.
 
  
TB3 - Any sprite animation entries in a directory after TB2.
+
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 (I will explain mirroring later when we get to the RUL code). The next four pictures show the T-Intersection for Asphalt Streets made by Hableurg in its four rotations.
  
 +
http://img217.imageshack.us/img217/5422/tintersection0nx6.jpg
  
== FSH Entry Header ==
+
''Rotation 0''
  
BYTE - Record ID (logically anded by 0x7f for bitmap code or 0x80 to check if the entry is QFS compressed (unused by SC4))
+
http://img217.imageshack.us/img217/4188/tintersection1re2.jpg
  
INT24 - Size of the block including this header.  For single images this is simply: width x length + 10h(hex).  For images with embedded mipmaps, this is the total size of the original image, plus all mipmaps, plus the header.
+
''Rotation 1''
  
UINT16 - Width
+
http://img217.imageshack.us/img217/8594/tintersection2yp9.jpg
  
UINT16 - Height
+
''Rotation 2''
  
UINT16 - X axis coordinate for center of image or for image to spin around. 65535 Max.
+
http://img217.imageshack.us/img217/2850/tintersection3xd8.jpg
  
UINT16 - Y axis coordinate for center of image or for image to spin around. 65535 Max.
+
''Rotation 3''
  
UINT16 - X axis position to display the image from the left. Larger values offset image to the right. 4095 Max. (12 bits, 4 MSB (most significant bits) are always 0)
+
The rotation of a texture happens in a clockwise progression in 90 degree increments.
  
UINT16 - Y axis position to display the image from the top. Larger values offset image down the screen. 4095 Max. (12 bits, 4 MSB specify number of embedded mipmaps)
+
B. Side by Side Textures
  
== Bitmap or palette data ==
+
Now we are going to start getting into the juicy stuff.  Side by side textures are how RUL 0x10000002.  This has to be shown, its close to impossible to explain.  I will do one example with a few small exercises.
  
After the entry header is the bitmap or palette pixel or color information. Palettes are generally arrays of 1 byte each, 256 entries long. Bitmaps may store their pixel data in one of many ways. FSH images can store their pixel data raw, or they can make use of Microsoft DXTC compressed formats.
+
Example:
 +
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.
  
 +
Obviously for this there will be multiple variations, but lets start with the Straight Piece on the left and the T-Intersection on the right.
  
'''Bitmap codes''':
+
http://img217.imageshack.us/img217/9725/straight1ni0.jpg  http://img217.imageshack.us/img217/8594/tintersection2yp9.jpg
  
0x7B - 8-bit indexed Palette: directly follows bitmap or uses global palette Compression: none
+
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.  Lets 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.
  
0x7D- 32-bit A8R8G8B8 Palette: none Compression: none
+
http://img217.imageshack.us/img217/5422/tintersection0nx6.jpg
  
0x7F - 24-bit A0R8G8B8 Palette: none Compression: none
+
''Rotation 0''
  
0x7E - 16-bit A1R5G5B5 Palette: none Compression: none
+
http://img217.imageshack.us/img217/4188/tintersection1re2.jpg
  
0x78 - 16-bit A0R5G6B5 Palette: none Compression: none
+
''Rotation 1''
  
0x6D - 16-bit A4R4G4B4 Palette: none Compression: none
+
http://img217.imageshack.us/img217/8594/tintersection2yp9.jpg
  
0x61 - DXT3 4x4 packed, alpha premultiplied, Palette: none Compression: 4x4 grid compressed, half-byte per pixel
+
''Rotation 2''
 
0x60 - DXT1 4x4 packed, 1-bit alpha, Palette: none Compression: 4x4 grid compressed, half-byte per pixel
 
  
 +
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 the 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.
  
'''Palette codes''':  
+
http://img217.imageshack.us/img217/691/straight0in9.jpg
  
0x22 - 24-bit DOS
+
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.
  
0x24 - 24-bit
+
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.
  
0x29 - 16-bit NFS5
+
So, your results are:
 +
Straight Piece, Rotation 1 beside T-Intersection, Rotation 2
  
0x2A - 32-bit
+
and
  
0x2D - 16-bit
+
Straight Piece, Rotation 3 beside T-Intersection, Rotation 2
  
 +
Now you know how to determine texture rotations.  Lets try some small exercises.  The answers are "whited out", just highlight them to uncover the answer.
  
'''Text codes''':
+
http://img217.imageshack.us/img217/9725/straight1ni0.jpg  http://img217.imageshack.us/img217/25/90turn1ge1.jpg
  
0x6F - Standard Text file
+
'''Answer:''' <span style="color:White">Stright Piece, Rotation 1 beside 90 Turn, Rotation 1</span>
  
0x69 - ETXT of arbitrary length with full entry header
+
http://img217.imageshack.us/img217/4467/90turn3fa6.jpg  http://img217.imageshack.us/img217/2850/tintersection3xd8.jpg
  
0x70 - ETXT of 16 bytes or less including the header
+
'''Answer:''' <span style="color:White">90 Turn, Rotation 3 beside T-Intersection, Rotation 3</span>
  
0x7C - defined Pixel region Hotspot data for image.
+
http://img217.imageshack.us/img217/4188/tintersection1re2.jpg  http://img217.imageshack.us/img217/594/90turn2hg4.jpg
  
 +
'''Answer:''' <span style="color:White">T-Intersection, Rotation 1 beside 90 Turn, Rotation 2</span>
  
This entry can also contain Binary data, however the identifier byte for different binary types anything that isn't already defined with a type so make sure to try and get all codes down correctly. Examples of binary data consist of Palette animations, binary links to outside files, or plain binary data.
+
===RUL Coding for RUL 0x10000002===
  
Bitmaps can contain embedded mipmaps (pregenerated reduced size images).  Each successive mipmap is assumed to be exactly 1/4 the size of the last (1/2 width and 1/2 height).  The dimensions of the original bitmap must be a multiple of 2 raised to the power of the number of mipmaps (eg: 2 ^ 1 for one mipmap, 2 ^ 4 or 16 for four mipmaps).
 
  
Each mipmap is encoded using the same scheme as the original image and it's data block is appended directly following the previous mipmap or original image in descending order. (Exception: DXT encoded bitmaps must be at least 4x4 pixels, but a 2x2 pixel mipmap is supported under this schemeIt's format is unknown.)
+
Well now we get to the least interesting part for most, but the most interesting for myself.  This is how we tell the game to make a certain texture beside another turn into two new side by side texturesLets 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.
  
== Overview of DXT compression ==
+
I will start by explaining the parts to the RUL Code for RUL 0x10000002:
  
 +
Basically there are three parts of importance to a line of code:
  
Microsofts DirectX Texture Compression uses what they call a 4x4 encoding. Basically, an image must be a multiple of 4 in width and height, because 4x4 blocks of pixels are compressed at a time, similar to encoding used in AVI/MPEG files. Each 4x4 block contains 16 pixels, each pixel using either 24bits or 32bits before compression. All 16 pixels use 512 bits of storage before compression. After compression, that block of 16 pixels is reduced to 64 bits, for an 8:1 compression ratio. The nice thing about DXT compression is its hardware accelerated by nVidia and ATI GPU's all the way back to the GeForce2 and Raedon 8000 series, leaving the CPU free to simulate.  
+
http://img217.imageshack.us/img217/2994/ruls1jy6.jpg
  
The compression itself works in the following way. First, all 16 pixels in the 4x4 block are checked, and unique colors stored in a vector (usually just an array of 16 unsigned ints). Once all the pixels in a block are checked, the two color extremes are found among all the unique colors. (This is something I had a hard time with in my own version, so I'm currently just using the method from FSHTool.) These two color extremes make up color1 and color2.
+
Texture IID = this is the Instance ID of the texture (figure this out by finding the texture in iLive's Reader -> Texture Veiwer)
  
Once color1 and color2 are found, they are reduced from 32bit color to 16bit color (RGB 5:6:5), and stored in the first 32bits of the compressed 64bit chunk of data. The rest of the colors in the 4x4 block are interpolated between thse two colors. Each pixel is only represented by two bits of information, as follows:
+
Rotation = this is the rotation of the texture, this value is 0, 1, 2 or 3 (figure this out by following section 2)
  
bits    color used for pixel
+
Mirror = this is something I havent talked about yet.  The way mirroring works is when the texture is in 0 Position it is mirrored (if need be) and then rotated.  This is not used often, but it is used with textures like the 90 Turn Transition Piece from Street to Road.  This value is 0 or 1 where 0 = not mirrored and 1 = mirrored.
---------------------------------
 
00      color1
 
01      color2
 
10      2/3 color1 + 1/3 color2
 
11      1/3 color1 + 2/3 color2
 
  
Here is the layout of a 64bit compressed block:
+
This is a line of code that could be created:
  
|----------------------------|
+
http://img217.imageshack.us/img217/9465/ruls2gf2.jpg
| 16bit RGB (5:6:5) color1  | <- 2 bytes
 
|----------------------------|
 
| 16bit RGB (5:6:5) color2  | <- 2 bytes
 
|----------------------------|
 
|  00  |  01  |  01  | 11  | <- 1 byte, first 4 pixels
 
|----------------------------|
 
|  01  |  11  |  00  | 11  | <- 1 byte, second 4 pixels
 
|----------------------------|
 
|  00  |  01  |  01  | 01  | <- 1 byte, third 4 pixels
 
|----------------------------|
 
|  11  |  11  |  00  | 00  | <- 1 byte, fourth 4 pixels
 
|----------------------------|
 
  
You can see the second part of the block is very basic. Its a simple bitmap of 2 bits each representing 1 of four possible color values. A 00 means use color1, 01 means use color2, 10 means use two-thirds of color1 mixed with one-third of color2, and 11 means use one-third of color1 mixed with two-thirds of color2. This is DXT1 compression, as no alpha information is saved. DXT3 compression uses the same technique, but also stores another 64bits of information for the alpha component of each pixel, in a similar block. So DXT3 compression achieves a 4:1 compression ratio with alpha information included, rather than the 8:1 compression ratio without.
+
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.
 +
 
 +
So for our example MAXIS Straight Street next to MAXIS T-Intersection Street being converted to SAM Asphalt Straight Street next to SAM Asphalt T-Intersection Street.
 +
 
 +
  First step, find the IIDs and the 0 Position:
 +
  MAXIS Straight Street = 0x05004b00
 +
  MAXIS T-Intersection Street = 0x05005700
 +
 
 +
  SAM Asphalt Straight Street = 0x5e54b700
 +
  SAM Asphalt T-Intersection Street = 0x5e557700
 +
 
 +
  Second, find out the Rotations you will need for all 4 pieces:
 +
  MAXIS Straight Street = 1 or 3
 +
  MAXIS T-Intersection Street = 2
 +
 
 +
  SAM Asphalt Straight Street = 1 or 3
 +
  SAM Asphalt T-Intersection Street = 2
 +
 
 +
Will there be any mirrors?  Not for this case.
 +
 
 +
  Write the code for each texture:
 +
  MAXIS Straight Street = 0x05004b00,1,0    or    0x05004b00,3,0
 +
  MAXIS T-Intersection Street = 0x05005700,2,0
 +
 
 +
  SAM Asphalt Straight Street = 0x5e54b700,1,0    or    0x5e54b700,3,0
 +
  SAM Asphalt T-Intersection Street = 0x5e557700,2,0
 +
 
 +
  Which texture should be Texture 1?  MAXIS Straight Street
 +
  Which texture should be Texture 2?  MAXIS T-Intersection Street
 +
  Which texture should be Texture 3?  SAM Straight Street
 +
  Which texture should be Texture 4?  SAM T-Intersection Street
 +
 
 +
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 was this intersection can be formed.
 +
 
 +
MAXIS Straight Street in Rotation #1:
 +
0x05004b00,1,0,0x05005700,2,0=0x5e54b700,1,0,0x5e557700,2,0
 +
 
 +
and
 +
 
 +
MAXIS Straight Street in Rotation #3:
 +
0x05004b00,3,0,0x05005700,2,0=0x5e54b700,3,0,0x5e557700,2,0
 +
 
 +
'''Please, use this information carefully and if you plan to make any modifications, contact members of the NAM Team for approval and help.'''
 +
 
 +
==Subway Overrides==
 +
Subway overrides are slightly different to normal overrides. See [[User:Warrior/subwaystuff|here]]
 +
 
 +
 
 +
[[Category:NAM]]
 +
[[Category:RUL Files]]

Revision as of 06:25, 27 August 2008

TGI Info
Name Override RUL
Format RUL File
Type

Group

Instance

0x0A5BCF4B

0xAA5BCF57

0x10000002

RUL 0x10000002, also known as the Override RUL is used to override textures and models for the transit networks. Template:Check

A Guide to Texture Overrides

This is a tutorial that is intended to help those wanting to learn the 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.

 Requirements:
 Intermediate Modder
 iLive’s Reader
 SC4Tool

Finding Textures

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.

A. iLive’s Reader -.Texture Viewer

Lets 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 goto Tools -> Texture Viewer as shown below:

http://img217.imageshack.us/img217/2759/textureviewer1km9.jpg

Texture Viewer has 2 main sections Transit Textures and Other Textures. The only limit to the Texture Viewer is that is only show the textures from the SimCity_#.dat files in you 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. I tend to always choose Zooms 4 or 5 because they are the easiest to see.

http://img217.imageshack.us/img217/7696/textureviewer2he3.jpg

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.). Since I have been working on SAM a lot lately lets go with the easiest one, Streets. Streets have the fewest number of textures. This is because any major intersections are found under the Network that the Street is intersecting with, and that there are no diagonals.

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.

http://img217.imageshack.us/img217/9157/textureviewer3mu0.jpg

B. SC4Tool -> Texture Creator

Now, iLive’s Reader is great for finding texture 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. It is not as great as iLive’s Reader but it is still good for its use.

So, lets see how this works. It’s a little different, when SC4Tool loads use the Tool selection screen and choose Texture Creator.

http://img217.imageshack.us/img217/665/texturecreator1lm1.jpg

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.

http://img217.imageshack.us/img217/9851/texturecreator2ho8.jpg

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.

http://img217.imageshack.us/img217/4968/texturecreator3yp9.jpg

Rotation Determining

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.

A. Rotation of a single texture.

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 (I will explain mirroring later when we get to the RUL code). The next four pictures show the T-Intersection for Asphalt Streets made by Hableurg in its four rotations.

http://img217.imageshack.us/img217/5422/tintersection0nx6.jpg

Rotation 0

http://img217.imageshack.us/img217/4188/tintersection1re2.jpg

Rotation 1

http://img217.imageshack.us/img217/8594/tintersection2yp9.jpg

Rotation 2

http://img217.imageshack.us/img217/2850/tintersection3xd8.jpg

Rotation 3

The rotation of a texture happens in a clockwise progression in 90 degree increments.

B. Side by Side Textures

Now we are going to start getting into the juicy stuff. Side by side textures are how RUL 0x10000002. This has to be shown, its close to impossible to explain. I will do one example with a few small exercises.

Example: 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.

Obviously for this there will be multiple variations, but lets start with the Straight Piece on the left and the T-Intersection on the right.

http://img217.imageshack.us/img217/9725/straight1ni0.jpg http://img217.imageshack.us/img217/8594/tintersection2yp9.jpg

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. Lets 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.

http://img217.imageshack.us/img217/5422/tintersection0nx6.jpg

Rotation 0

http://img217.imageshack.us/img217/4188/tintersection1re2.jpg

Rotation 1

http://img217.imageshack.us/img217/8594/tintersection2yp9.jpg

Rotation 2

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 the 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.

http://img217.imageshack.us/img217/691/straight0in9.jpg

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.

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.

So, your results are: Straight Piece, Rotation 1 beside T-Intersection, Rotation 2

and

Straight Piece, Rotation 3 beside T-Intersection, Rotation 2

Now you know how to determine texture rotations. Lets try some small exercises. The answers are "whited out", just highlight them to uncover the answer.

http://img217.imageshack.us/img217/9725/straight1ni0.jpg http://img217.imageshack.us/img217/25/90turn1ge1.jpg

Answer: Stright Piece, Rotation 1 beside 90 Turn, Rotation 1

http://img217.imageshack.us/img217/4467/90turn3fa6.jpg http://img217.imageshack.us/img217/2850/tintersection3xd8.jpg

Answer: 90 Turn, Rotation 3 beside T-Intersection, Rotation 3

http://img217.imageshack.us/img217/4188/tintersection1re2.jpg http://img217.imageshack.us/img217/594/90turn2hg4.jpg

Answer: T-Intersection, Rotation 1 beside 90 Turn, Rotation 2

RUL Coding for RUL 0x10000002

Well now we get to the least interesting part for most, but the most interesting for myself. This is how we tell the game to make a certain texture beside another turn into two new side by side textures. Lets 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.

I will start by explaining the parts to the RUL Code for RUL 0x10000002:

Basically there are three parts of importance to a line of code:

http://img217.imageshack.us/img217/2994/ruls1jy6.jpg

Texture IID = this is the Instance ID of the texture (figure this out by finding the texture in iLive's Reader -> Texture Veiwer)

Rotation = this is the rotation of the texture, this value is 0, 1, 2 or 3 (figure this out by following section 2)

Mirror = this is something I havent talked about yet. The way mirroring works is when the texture is in 0 Position it is mirrored (if need be) and then rotated. This is not used often, but it is used with textures like the 90 Turn Transition Piece from Street to Road. This value is 0 or 1 where 0 = not mirrored and 1 = mirrored.

This is a line of code that could be created:

http://img217.imageshack.us/img217/9465/ruls2gf2.jpg

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.

So for our example MAXIS Straight Street next to MAXIS T-Intersection Street being converted to SAM Asphalt Straight Street next to SAM Asphalt T-Intersection Street.

 First step, find the IIDs and the 0 Position:
 MAXIS Straight Street = 0x05004b00
 MAXIS T-Intersection Street = 0x05005700
 
 SAM Asphalt Straight Street = 0x5e54b700
 SAM Asphalt T-Intersection Street = 0x5e557700
 Second, find out the Rotations you will need for all 4 pieces:
 MAXIS Straight Street = 1 or 3
 MAXIS T-Intersection Street = 2
 
 SAM Asphalt Straight Street = 1 or 3
 SAM Asphalt T-Intersection Street = 2

Will there be any mirrors? Not for this case.

 Write the code for each texture:
 MAXIS Straight Street = 0x05004b00,1,0     or     0x05004b00,3,0
 MAXIS T-Intersection Street = 0x05005700,2,0
 
 SAM Asphalt Straight Street = 0x5e54b700,1,0     or     0x5e54b700,3,0
 SAM Asphalt T-Intersection Street = 0x5e557700,2,0
 Which texture should be Texture 1?  MAXIS Straight Street
 Which texture should be Texture 2?  MAXIS T-Intersection Street
 Which texture should be Texture 3?  SAM Straight Street
 Which texture should be Texture 4?  SAM T-Intersection Street

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 was this intersection can be formed.

MAXIS Straight Street in Rotation #1: 0x05004b00,1,0,0x05005700,2,0=0x5e54b700,1,0,0x5e557700,2,0

and

MAXIS Straight Street in Rotation #3: 0x05004b00,3,0,0x05005700,2,0=0x5e54b700,3,0,0x5e557700,2,0

Please, use this information carefully and if you plan to make any modifications, contact members of the NAM Team for approval and help.

Subway Overrides

Subway overrides are slightly different to normal overrides. See here