• Welcome to SC4 Devotion Forum Archives.

RUL 0x10000002 - Tutorial to making texture overrides

Started by jplumbley, September 26, 2007, 07:49:10 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

jplumbley

A Guide to Texture Overriding

0. Intro

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.

Requiremetns:

Intermediate Modder
iLive's Reader
SC4Tool

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



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.



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.



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.



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.



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.



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


Rotation 0


Rotation 1


Rotation 2


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.

 

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.


Rotation 0


Rotation 1


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.



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.

 

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

 

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

 

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

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



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:



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

There you have it.  All the information needed to write RULs in RUL 0x10000002.  Please, use this information carefully and if you plan to make any modifications, contact members of the NAM Team for approval and help.
"You learn something new everyday."

http://img517.imageshack.us/img517/169/nhpjplumbleykv3.gif
Bringing the new horizons closer to reality.

Berethor ♦ beskhu3epnm ♦ blade2k5 ♦ dmscopio jplumbley ♦ moganite ♦ M4346 ♦ Dedgren ♦ Ennedi Shadow Assassin ♦  Tarkus ♦ wouanagaine
Street Addon Mod - SAM

Diggis

Pssst, you didn't explain mirroring,

Otherwise nice tutorial.  I'm definetly keen to give it a go.

Serkanner

A very well written tutorial, not to mention the excellent illustrations to visualize the whole process  which I alwats find a great help when learning new things. If time permits I just might try this myself one day. The least I can do is give you a big THANK YOU for composing this document and I am sure more people will start making their own street/road mods from now on.

Excellent work!  :thumbsup:

RippleJet

A very well written and comprehendable tutorial, Jplumbley! &apls

If somebody wants to create their own street textures, I suppose the IID's (0x5xxxxxx) are maintained and distributed by the NAM team?


Quote from: Diggis on September 26, 2007, 11:30:21 PM
Pssst, you didn't explain mirroring,

Actually I think he did:

Quote from: jplumbley on September 26, 2007, 07:49:10 PM
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.

He didn't show it with pictures, but it isn't that difficult to understand how it works. ;)

jplumbley

Quote from: RippleJet on September 27, 2007, 04:50:01 AM
If somebody wants to create their own street textures, I suppose the IID's (0x5xxxxxx) are maintained and distributed by the

Yes, the NAM Team maintains the 0x5xxxxxxx range of IIDs for textures.  SAM uses the 0x5e5xxxxx range and a structure has been given to it to allow for the best possible usage of the range of IIDs.
"You learn something new everyday."

http://img517.imageshack.us/img517/169/nhpjplumbleykv3.gif
Bringing the new horizons closer to reality.

Berethor ♦ beskhu3epnm ♦ blade2k5 ♦ dmscopio jplumbley ♦ moganite ♦ M4346 ♦ Dedgren ♦ Ennedi Shadow Assassin ♦  Tarkus ♦ wouanagaine
Street Addon Mod - SAM


Diggis

OK, sorry one further question...

There are 4 different textures for each piece, depending on wealth.  Do we have to do all 4?  or just the first one (0) like you did here?

jplumbley

Quote from: Diggis on September 28, 2007, 06:07:55 AM
OK, sorry one further question...

There are 4 different textures for each piece, depending on wealth.  Do we have to do all 4?  or just the first one (0) like you did here?

Well, this is a good question and I am not 100% sure.  I have noticed though that if I only had the 0 Wealth Texture it would drag and show properly.  I think in my first test of OWR-5 that it was possible to zone next to it and the 0 Wealth Texture stayed.  But if you have the 0 and the 1 Wealth textures but not the others, the other 2 wealths will be shown as a blank tile.  This is my experience.
"You learn something new everyday."

http://img517.imageshack.us/img517/169/nhpjplumbleykv3.gif
Bringing the new horizons closer to reality.

Berethor ♦ beskhu3epnm ♦ blade2k5 ♦ dmscopio jplumbley ♦ moganite ♦ M4346 ♦ Dedgren ♦ Ennedi Shadow Assassin ♦  Tarkus ♦ wouanagaine
Street Addon Mod - SAM

Diggis

So you have to write it for all 4 wealths?  I figure it's just an situation of find and replace, but still...

jplumbley

Sorry, I misunderstood you question.

The Texture IID always ends in 00 for the RULs.  The RULs do not care about Wealth or Zoom levels because it only deals with the "family" the textures belong to.
"You learn something new everyday."

http://img517.imageshack.us/img517/169/nhpjplumbleykv3.gif
Bringing the new horizons closer to reality.

Berethor ♦ beskhu3epnm ♦ blade2k5 ♦ dmscopio jplumbley ♦ moganite ♦ M4346 ♦ Dedgren ♦ Ennedi Shadow Assassin ♦  Tarkus ♦ wouanagaine
Street Addon Mod - SAM

Diggis

Ahhh, OK, so you have to do textures for all wealth levels, or only 0 wealth, but only have to RUL for the 00 textures.  Excellent.

Jonathan

#11
I guess for models the 0 postion is is what it looks like in the preview in reader?
Or have draggable 3D networks not been done before?

Diggis

I think this if for texture networks.  For the 3D ones, you would probably need to go to T21's/

Jonathan

It is possible to have this with 3D netoworks as long as the base network is 3D
So it is not possible (as far as I know)
To have a 2D network drawing from a starter piece and turning into a 3D network
however it is possible to have a 3D network drawing from a starter piece and turning into a 2D network

jplumbley

I have not worked with the 3D models as of yet.  It seems from your progress on HSR that it is possible to do overrides with 3D models.  I would assume that the 0 position is the model preview in iLives Reader.  It would make sense atleast anyways, then you will be rotating the model clock-wise for each rotation.

You can make 2D textures for a 3D model network, this is what Draggable GLR has done.  Draggable GLR is a starter piece where the base network is the El-Rail (a 3D Network) and had it drag textures out of it.  So, this is possible but the reverse, I dont think is possible, but you never know until you try.  You might be able to fool the game by using T21s but then you would only be able to use one T21 per network piece, the one that has the model you want to use.  The easiest way to find out if this is possible would be Draggable Elevated Road Pieces.  The models already exist.
"You learn something new everyday."

http://img517.imageshack.us/img517/169/nhpjplumbleykv3.gif
Bringing the new horizons closer to reality.

Berethor ♦ beskhu3epnm ♦ blade2k5 ♦ dmscopio jplumbley ♦ moganite ♦ M4346 ♦ Dedgren ♦ Ennedi Shadow Assassin ♦  Tarkus ♦ wouanagaine
Street Addon Mod - SAM

Tarkus

#15
Actually, you can do the reverse as well.  I was successfully able to make an Elevated RHW and a Double-Decker RHW draggable with the ANT network.  The trick is that you need an special exemplar with a Network Specific Group ID (NSGID) with the same IID as the model.  Only one is necessary, the other zoom levels are referenced in the exemplar by using Resource Key Type 3 instead of Type 0 like standard puzzle pieces.  All the standard, non-override 3D networks also operate on this same principle.

Here's the list of known NSGIDs:

Road-0x2821ED93
OWR-0xCBE084CB
Street-0x6534284A
Rail-0xE8347989
El-Highway-0xA8434037
Gr-Highway-0xEBE084D1
Avenue-0xCB730FAC
Light Rail-0x2B79DFFB
Monorail-0xEBE084C2
Dirt Road/ANT (RHW)-0x6BE08658

I haven't figured out the NSGIDs for the Subway network and the pseudo-networks (power poles and water pipes), and those networks operate somewhat differently than the ones listed above.

Hope that was somewhat helpful.

Excellent job on the tutorial, Jason!  :thumbsup: I should get off my rear and put some tutorials up myself. ;)

-Alex (Tarkus)

Shadow Assassin

QuoteTo have a 2D network drawing from a starter piece and turning into a 3D network
however it is possible to have a 3D network drawing from a starter piece and turning into a 2D network

It should be possible to have 2D turning into 3D, because the "2D" network is technically a 3D network, it just uses a flat plane.
New Horizons Productions
Berethor ♦ beskhu3epnm ♦ blade2k5 ♦ dedgren ♦ dmscopio ♦ Ennedi
emilin ♦ Heblem ♦ jplumbley ♦ moganite ♦ M4346 ♦ papab2000
Shadow Assassin ♦ Tarkus ♦ wouanagaine
See my uploads on the LEX!

Jonathan

A 2D network is not a 3D network that is a flat plane only seemingly 2D puzzle pieces are a 3D flat plane.
Tarkus just said it possible to have 2D network draw as a 3D network but not because of you said. Hope that makes sense.

Tropod

#18
If I recall (if my memory serves), the RUL 0x10000002 file handles textures & 3D models. The only difference between the 2, is that when a model is involved the RUL 0x10000002 file makes reference to the Exemplar that handles the model. It's the same for all RUL files (some exceptions; some RULs only handle Models).


Tarkus : the PowerPoles Exemplar GID should be 0x088E1962. Subways has one, but I don't recall what it is. From memory though, it's pointless as the subway network is hardcoded & runs off one of the road-based network Ruls.

Jonathan

QuoteTarkus : the PowerPoles Exemplar GID should be 0x088E1962. Subways has one, but I don't recall what it is. From memory though, it's pointless as the subway network is hardcoded & runs off one of the road-based network Ruls.

Is it possible to make subway puzzle pieces?*
And does that mean it is possible to have starter pieces for power poles?
* If it isn't possible to make subway puzzle pieces is it possible to make water pipe puzzle piece?
The mirrors are also used in diag-orth transtions at least.(for monorail don't know about other networks)