Difference between revisions of "RUL 0x10000002"

From SC4D Encyclopaedia
Jump to navigation Jump to search
sc4e>Jondor
(Added clear and concise mirroring information)
sc4e>Jdenm8
(Fixed link to NetworkSpecs page)
Line 6: Line 6:
 
| group      = 0xAA5BCF57
 
| group      = 0xAA5BCF57
 
| instance    = 0x10000002
 
| instance    = 0x10000002
| comments    = ''See also: {{NetSpecs|Overrides RUL}}''
+
| comments    = ''See also: {{NetSpecs|RuleOverrides RUL}}''
 
}}
 
}}
 
'''RUL 0x10000002''', also known as the '''Override RUL''' 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]].
 
'''RUL 0x10000002''', also known as the '''Override RUL''' 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]].

Revision as of 16:09, 9 November 2011

Template:Check

TGI Info
Name Override RUL
Format RUL File
Type

Group

Instance

0x0A5BCF4B

0xAA5BCF57

0x10000002

Comments
See also: RuleOverrides RUL

RUL 0x10000002, also known as the Override RUL is used to override textures and models for the 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.

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

Mirror Determining

Determining the orientation of a texture when it is mirrored and rotated is best summed up with a simple chart:

Rotation and flip cheat sheet.png

There are two useful ways to determine the orientation of a flipped texture:

  1. First apply the rotation, then a horizontal mirror, or:
  2. Mirror the texture horizontally and rotate the result counter-clockwise instead of the usual clockwise.

Use whichever is more intuitive for you.

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. (figure this out by following section 3)

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 texture overrides 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.

IIDs

Models

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.

The IIDs follow the same pattern as road IIDs.
The straight road section IID is 0x00004b00
So the straight subway section IID is 0x07004b00

Paths

Crazily Maxis decided that the subway paths should not have the same IID as the model.
All subway pathsn must always start with 06.

The straight subway section model IID is 0x07004b00,
So the path IID for that tile is 0x06004b00.

RULs

The RULs for subway overrides are use exactly the same format as normal RULs. Texture1,Rot1,Flip1,Texture2,Rot2,Flip2=Texture3,Rot3,Flip3,Texture4,Rot4,Flip4,

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.

To turn this IID 0x07004b00 into Subway RUL IID:

1) remove the 07
> 004b00

2) Next remove the 0s at the beggining
> 4b00

Examples

For a subway piece with an IID of 0x07004b00
It would be 
0x4b00,0,0,0x4b00,0,0=0x########,0,0,0x########,0,0
For a subway piece with and IID of 0x07020700 
It would be 
0x20700,0,0,0x20700,0,0=0x########,0,0,0x########,0,0
For a subway piece with an IID of 0x07000300
It would be
0x0300,0,0,0x0300,0,00x#########,0,0,0x########,0,0