• Welcome to SC4 Devotion Forum Archives.

[Tutorial] How to create Puzzle Pieces?

Started by MandelSoft, June 04, 2010, 07:44:50 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MandelSoft

How to create Puzzle Pieces?
A basic tutorial about making Puzzle Pieces in SimCity 4




Original written by Joris (jmvl), NAM member
Edited and translated by Maarten (mrtnrln), NAM member

1st edition (Dutch): August 2009
1st edition (English): August 2010



Contents

   1. Introduction
   2. What's a Puzzle Piece?
   3. Requirements
    - 3.1. What does SimCity 4 need?
    - 3.2. What do I need?
    - 3.3. Reserving ID's
   4. Creating textures
    - 4.1. Creating PNG files for your textures
      - 4.1.1. Transparency
      - 4.1.2. Cut you texture down to size

    - 4.2. Convert PNG to FSH
   5. Fill up the DAT-files
    - 5.1. General
    - 5.2. Empty tiles
   6. Creating paths
    - 6.1. Where are paths saved
    - 6.2. The structure of a SimCity 4 Path File.
      - 6.2.1. General
      - 6.2.2. Header
      - 6.2.3. Paths
      - 6.2.4. Stoppoints
      - 6.2.5. Other important notices

    - 6.3. Pieces without paths
    - 6.4. The SC4 Path Creator
      - 6.4.1. Introduction
      - 6.4.2. Single Frame View & Multi Frame View
      - 6.4.3. The "Path View"
      - 6.4.4. Saving path files

   7. The RUL 0x10000000 file
    - 7.1. What is the RUL 0x10000000 file
    - 7.2. Where can I find the RUL 0x10000000 file
    - 7.3. Editing the RUL 0x10000000 file
      - 7.3.1. Important notice before editing the RUL0x10000000 file
    - 7.4. The structure of the RUL 0x10000000 file
      - 7.4.1. Introduction
      - 7.4.2. The TAB-Ring section
      - 7.4.3. The "IntersectionInfo" section
           - 7.4.3.1. The Header
           - 7.4.3.2. The Layout section
           - 7.4.3.3. The Defenitions section
           - 7.4.3.4. Rotating/Mirroring your Puzzle Piece

    - 7.5 Defining rotated/mirrored versions of your Puzzle Piece
      - 7.5.1. The Basics
      - 7.5.2. Be creative!

   8. Mirroring Puzzle Pieces Horizontally
   9. Creating New Menu Buttons
   10. Q&A
    - Pathing problems
    - RUL 0x10000000 problems
    - Other problems
   11. Further details
Lurk mode: ACTIVE

MandelSoft

#1
1. Introduction

This tutorial mainly handles the technical aspect of "flat" puzzle pieces. "Flat" pieces are two-dimenstional objects, for example the RHW ramp interfaces, the NWM transistion pieces and the Smooth Curves. "Non-flat" pieces are for example the elevated networks and the Maxis Highways. The only difference between the two is creating models for the pieces. "Flat" pieces are far more easier to create than "non-flat" pieces.

Why did we write this tutorial? Joris (jmvl): "When I was learning how to make puzzle pieces in SimCity 4 back in March 2009, I discovered that the available information about this subject was scatterd and not clear enough at some places. Therefore, I wrote some notes about creating puzzle pieces back then. However, I learned more about puzzle pieces and applied my knowledge immediatly, I had no time and motivation to keep up my notes. Therefore I decided to write a document for myself (and maybe for others too) in May 2009. However, I didn't write a thing until june 2009, when Maarten (mrtnrln) asked me by PM at SC4 Devotion what technical aspects there where for creating puzzle pieces. I said to myself: 'It's now or never!' Then I wrote this document about how to create puzzle pieces for Maarten, for others and for myself. Thanks to this manual we shall never forget the procedures for creating puzzle pieces."

Maarten (mrtnrln): "This tutorial was really helpful to me at the time. Back then I made a few puzzle pieces for the RHW v4.0, like the B-style RHW Splitters and the Cosmetic Pieces, that are now used a lot by people. In June 2010 people ask how to create puzzle pieces. I have this tutorial around on my harddisk for months, but it's in Dutch, so the majority of the community isn't able to read it. Therefore, I translated the whole document and posted the translation at SC4 Devotion, so anyone can read it. We'll never have enough tutorials, and never enough custom content creators either."

I hope you find this tutorial usefull. If the document contains any mistakes, unclear or missing information, please send me an PM. I will correct these issues as soon as possible. You can also contact me for any questions or suggestions.

Notice about the Y and Z co-ordinates
In this tutorial, the Y-axis or Y-co-ordinates are always used as the height-axis of an object. This is because in the Reader, the Y-axis is also the height-axis. However, in gMax and the SC4 Model Tweaker, the Z-axis is the height axis. See table below:
[tabular type=4]
[row] [head]Reader axis:[/head][head]gMax axis:[/head][/row]
[row] [data]X[/data][data]X[/data][/row]
[row] [data]Y[/data][data]Z[/data][/row]
[row] [data]Z[/data][data]Y[/data][/row]
[/tabular]
Lurk mode: ACTIVE

MandelSoft

#2
2. What's a Puzzle Piece?

A puzzle piece is a ploppalbe (placed manually) transit object. It's fully fuctional for traffic and UDI vehicles. Because puzzle pieces have their own paths, you can determine how traffic is going to move over these pieces. Sometimes, a more technical term for puzzle pieces is used: "Interchange-base Related Item" (IRI). Puzzle pieces often used for objects you can't just simply drag some sort network to create it. Puzzle pieces can be placed in TAB-rings, which contain rotation rings. Thanks to TAB-rings, more than one puzzle piece can be accessed by one menu button. Technical speaking, all puzzle pieces are 3D-models; each section of a puzzle piece is one S3D model. The puzzle pieces and their location in TAB-rings can be determined by codes in the RUL 0x10000000 file.

Puzzle pieces should not be confused with Transit Enabled LOTs (TE-LOTs). Both have their own paths, and both pieces can be accessed by traffic. However, there's a big difference between a TE-LOT and a puzzle piece. Puzzle pieces are ploppable sections of transport networks, whereas TE-LOTs are LOT-based. TE-LOTs are ment to look like transport networks, but in fact they aren't transport networks at all. TE-LOTs are often used for toll boths and "Transit Switches" (like stations). In the Zones View, TE-LOTs are invisible, whereas the puzzle pieces are completely visible.
Lurk mode: ACTIVE

MandelSoft

#3
3. Requirements

3.1. What does SimCity 4 need?
In order to make a puzzle piece working in SimCity 4, the following is required:
- New codes in the RUL 0x10000000 file.
- One S3D model for every tile of the puzzle piece.
- One S3D model for the preview model of the puzzle piece, containing all models from every tile.
- One path file for every tile of the puzzle piece.
- One EffDir file for the preview of the puzzle piece.
- One LTEXT file for the description (shown in-game) of the puzzle piece.
- FSH-files for textures. (Without textures, you would barely notice the puzzle piece. That would be a waste  ;) )

3.2. What do I need?
In this section, you can find software and web applications you can use to create your SimCity 4 puzzle pieces. Some programs (marked in bold text) are essential, others are mere tools that make creation of puzzle pieces easier. All of the following applications are used in this tutorial. There's a difference between software and web applications. Software requires to be installed on your computer, whereas webapplications can be used by a webbrowser (Internet Explorer, Google Chrome, Mozilla Firefox, etc.)

Software:
- SimCity 4 + Rush Hour or SimCity 4 Deluxe. Without this program, creating puzzle piece has no use.
- iLive's Reader 0.93 (or higher)
- SC4 Path Creator 1.60 (or higher)
- Batch PNG to FSH Tool
NOTE: After installing the PNG to FSH tool, open the directory where you installed the tool and open groupid.txt. Replace the entire content of the file by 1ABE787D and save the file.
- A text editor, like Notebook.

Web applications:
- JMVL SimCity 4 Online Transit Modding Tools

3.3. Reserving ID's
To prevent any conflict with other pieces and NAM plugins, you require to reserve unique ID's for each puzzle piece you make. We always reserved our ID's for the RHW Mod by contacting Alex (Tarkus). In fact, it's quite unclear in the NAM Team who can be contacted for reserving unique ID's. The best place you can request for free ID's is at the corresponing topic in the NAM Creations section. The ID's you have the reserve are Instance IDs (IIDs) and HighwayIntersectionInfoID (HIIID or H3ID).

IIDs are used for identifying the files packed in DAT files. IIDs have to be unique, because otherwise they overwrite eachother. You'll need a whole range of IID's, because your puzzle piece contains more than one model or texure. It's important that you reserve a start-IID and a end-IID. Every puzzle piece has a AutoTileBase IID. This is the first IID from the tile in the upper left corner of your puzzle piece. The size of the IID range depends on the size of your puzzle piece. You can easily dertermine your IID by using the IID Grid Table Maker. You simply fill in the AutoTileBase IID, the width and the heigth of your puzzle piece and after clicking "Show IID Grid Table", a table appears on the screen.

H3IDs are used in the RUL 0x1000000 file. These IDs are required for linking the technical layout of the puzzle piece to the models, paths, etc. and for placing puzzle piece in different rotations (and mirrored versions). Usually 4 H3ID's are required (one for each rotation), but when puzzle pieces can be mirrored, you require 8 H3IDS, and ever 16 H3ID's when one way traffic is involved. Please check first how much H3ID's you actually require before reserving them.

Most of the times, the IDs are assigned projectwise. All NAM features and related mods have an IID that start with a 5, since this whole IID range isn't used by Maxis plugins. Each project has their own IID range. The RHW Project for instance has an IID of 5C###### to 5E######. The H3IDs are also assigned projectwise in a simillar way. Also, before reserving IDs, it's wise to say what you're creating. Maybe someone else is making something simmilar and we can try to fit the piece into the existing IID scheme.

A third thing that has to be unique is the name of the Effect Dir (EffDir). This links the correct preview model to the RUL 0x1000000 code. In theory, this name ought to be reserved, but in reality this is not the case. There's a huge combinations of names that can be used, and the chance that someone uses your EffDir name is very small. One syntax you can use for your EffDir name is:
preview[puzzle piece name or filename without extension][left or right]
Some examples:
[tabular type=4]
[row] [head]EffDir Name:[/head][head]Puzzle Piece Name:[/head][/row]
[row] [data]preview_rhw4misrampsstyleaxdl[/data][data]RHW-4 to RHW-6C with 2 MIS sections left[/data][/row]
[row] [data]preview_rhw4misrampsstyleaxdr[/data][data]RHW-4 to RHW-6C with 2 MIS sections right[/data][/row]
[row] [data]preview_rhw2_to_2mis[/data][data]RHW-2 to 2 MIS sections [/data][/row]
[/tabular]
As you can see, there's a logical connection between the EffDir and the puzzle piece name
Lurk mode: ACTIVE

MandelSoft

#4
4. Creating Textures

4.1. Creating PNG files for your textures
A puzzle piece is nothing without textures. It's quite important to create the textures before starting to make the rest of your puzzle pieces.

After you have reserved IDs you can start making textures. You can use any advanced image editing program (not MS Paint, but PhotoShop or the GIMP) to create textures. It's also wise to make a dedicated directory where you can save your textures. Then you can easily find them. All textures should be eventually saved in PNG-format (you may want to keep an multi-layered PSD-file or something similar for later texture editing). Depending on the quality of the texture, one tile has the following size in pixels:

[tabular type=4]
[row] [head]Quality:[/head][head]Size (in pixels):[/head][/row]
[row] [data]SD[/data][data]128 x 128[/data][/row]
[row] [data]HD[/data][data]256 x 256[/data][/row]
[/tabular]

Usually, SD textures are used, due to smaller filesize. Also, the difference between end results of HD and SD textures is not that big.

4.1.1. Transparency
FSH-files are the texture files of SimCity 4. FSH-files contain two layers: the colored texture layer and the black-and-white transparency layer. White parts of the transparency layer show the color image of the texture in SimCity 4, while the black parts are invisible. Technically speaking, you need two images of your puzzle piece for your textures. However, PNG-files can contain transparent pixels. If you want to have transparent parts in your PNG-image, do the following:
   1. Open your texture with an Image editing program.
   2. Fill in the transparent surface with a color that's unique in the image (only the transparent surface has this color). Try to make it similar to the puzzle piece, so any errors later are less visible.
   3. Check the RGB value of the background color and note it somewhere. If you can find a hexadecimal code (a numbering system that goes from 0-9-A-F), skip the following two steps.
   4. Open the Windows Calculator and enable the Scientific Mode (View/Scientific),
   5. Fill in every value separately in decimal mode (Dec) and convert it into a hexadecimal value by selecting "Hex". Note the values down.
   6. Open the Alpha/Color Blender from your web browser.
   7. Click on "Browse" button next to "Alpha/Color Blended image file" and select your puzzle piece PNG file.
   8. Open the "Advanced settings" tab and change both hexadecimal values to the Hex values you noted down.
   9. Click on "Get Color PNG" and overwrite the puzzle piece PNG file you just edited.
   10. Presto! You now have a PNG file with an transparent background.

4.1.2. Cut you texture down to size
Puzzle pieces can be no bigger than 16 x 16 tiles due to the limitations of SimCity 4. Also, a puzzle piece texture must be 1 x 1 tile big. Fortunately, the Image Cutter can do the job for you:
   1. Click on "Browse" button next to "Image" and select your puzzle piece PNG file
   2. Fill in the AutoTileBase IID
   3. Fill in the resultion in "Maximum height per image" "Maximum width per image" (default settings: 128 x 128)
   4. Click on "Get Cut Images" and save the ZIP-file.
   5. Unpack the ZIP-file, and there you have it: Your puzzle piece cut into pieces with a size of one SC4-tile.

4.2. Convert PNG to FSH
PNG files can't be used for textures in SimCity 4. Therefore, these files should be converted into FSH files. The
Batch PNG to FSH Tool converts PNGs to FSH textures and saves them into DAT-files. The Batch PNG to FSH Tool recognises transparancy in PNG images and uses them to build the transparency layer of the FSH file. Let's create some textures:
   1. Open the Batch PNG to FSH Tool
   2. Click on "Add" and select the textures you want to convert:
         
   3. Check if your PNGs are really transparent. If you see this, your image is really transparent:
         
   4. Fill in the corresponding Instance IDs and set the End format to A-E. This prevents the "Sidewalk Bug" to occur.
   5. When you are finished, select "Save dat" to save your DAT-file. IMPORTANT NOTE: create a dummy DAT-file where you save your new textures (give it a name like "Textures_Add.dat" or something simmilar). Otherwise the Batch PNG to FSH Tool overrides the complete contents of the file.
   6. Copy your textures into the DAT-file where you save your final puzzle pieces somewhere in the NAM folder.
   7. Save the file and you're done!
Lurk mode: ACTIVE

MandelSoft

#5
5. Fill up the DAT-Files

5.1. General
Now our DAT-file only contains FSH-files. But there are more things required to make a puzzle piece working in-game. We are going to generate some S3D, EffDir, Exemplar, LTEXT and some dummy-SC4Path files (we are going to define the paths in the SC4Path-files in the next chapter).

The Puzzle Piece Maker generates all the files you need for "flat" puzzle pieces. The Puzzle Piece Maker currently has no support for "non-flat" puzzle pieces. The only thing you can do when creating these pieces, is copy the models from another file, re-index it and edit it manually in the Reader, but this method is not recommended for beginners. We simply start with creating a "flat" puzzle piece with the Puzzle Piece Maker:
   1. Fill in the AutoTileBase IID in the "AutoTileBase IID"-field
   2. When the textures have another AutoTileBase IID (which is often the case for mirrored pieces), fill in the AutoTileBase IID from textures in the "AutoTileBase IID textures "-field.
   3. Fill in the width and the height (in tiles) of your puzzle piece in the "Width"- and "Height"-field.'
   4. In case you make a mirrored version of your puzzle piece, check the "Mirrored version"-checkbox
   5. Select "A-E" at "End Format IID"
   6. Choose 0 or 3 at "Resource Key Type". RKT 0 uses one model for all zoom levels, while RKT 0 uses a different model for each zoom level.
   7. Fill in the text that's shown in-game (when placing the puzzle piece) in the "Description (LTEXT)"-field.
   8. Fill in the EffDir name in the "Effect Dir name"-field. This must be an unique name. You'll need this name later when creating the RUL 0x10000000 code for your puzzle piece. If you forgot the name of your EffDir, you can find it in the EffDir file under Section 13.
   9. Fill in the Exemplar name (the name each exemplar of your puzzle piece gets) in the "Exemplar Name"-field. You can use the EffDir name for this (without "preview_")
   10. Make sure that "Use 'default' SC4Paths" is selected in the "SC4Paths"-section.
   11. Make sure every file type is selected.
   12. Fill in the download location in the "Download Location"-field. This is the location where your ZIP-file is saved.
   13. Click on "Build DAT Entries". A ZIP-file is now generated.
   14. Extract the ZIP-file. Make sure it's extracted in a directory with the same name as the ZIP-file.
   15. Open the Reader and open the DAT-file where you saved your textures.
   16. Select "Edit/Insert (Batch Method)". A new screen appears
   17. Click on "Browse" and go to the location where you extracted your ZIP-file and select "batch.txt"
   18. Click on "Insert." You get a message all files where succesfully imported.
   19. Don't forget to save the DAT-file!

5.2. Empty tiles?
Often you don't want a square puzzle pieces. Some tiles of your puzzle piece may be empty. If they are, please follow these steps:
   1. Find the S3D files you don't want to use and note down their IIDs
   2. Now also select the SC4Path and Exemplar files.
   3. Right-click on the selection and select "Delete Entries."
Lurk mode: ACTIVE

MandelSoft

#6
6. Creating paths

Finally we have our DAT-file filled with the required files. But it's not finished yet; The SC4Path-files should be defined, as said before in chapter 5. Since we've selected "Use 'default' SC4Paths" in the Puzzle Piece Maker, all path-files have dummy paths. In this chapter we're going to change that.

6.1. Where are paths saved?
Paths are defined per tile, just like the S3D-models of the puzzle piece. Paths are saved in ASCII text in SC4Path-files. The IID of these files correspond with the S3D-model with the same IID (these two are linked together). With the IID Grid Table Maker you can make a table with all the IID's of your puzzle piece, which may help you to find the right IID for your SC4Path files.

6.2. The structure of a SimCity 4 Path File

6.2.1. General
A SC4Path-file has in general the following structure:
   - Header
   - Path 1, path 2, path 3, etc.
   - Stoppoint 1, stoppoint 2, stoppoint 3, etc.
SimCity 4 always reads the SC4Path-file one line at the time. Commentaries always start with "--". This line will be skipped by Simcity 4.

6.2.2. Header
The header defines properties that will have effect for the whole SC4Path-file. The header is the only section in the SC4Path-file that should not contain commentaries. Only in this tutorial, I'll ignore this rule just to explain what everything does. The structure of the header of a SC4Path-file looks like this:
Code (SC4Path-file Header) Select
SC4Paths             -- Introduction line. All SC4Path-files start with this line.
1.2                  -- Version number of the SC4Path-file (1.0, 1.1 or 1.2)
1                    -- Number of paths in this SC4Path-file.
0                    -- Number of stoppoints this SC4Path-file contains.
1                    -- The "3D-Key" (0 or 1)


Notes:
- SC4Path version 1.0 and 1.1 don't give as much support as version 1.2 does. Also, the structure of version 1.0 and 1.1 is different compared to version 1.2. It's recommended to use version 1.2 for your path files to prevent any confusion.
- The "3D-Key""defines if you can choose your own path in the U-Drive-It mode. "0" enables this option, while "1" disables this option. It's advised to use "1". Technically speaking, "1" stands for 3D network pieces and "0" for draggable network pieces.

6.2.3. Paths
Depending on the number of paths, the SC4Path-file has a seperate section for each path. The paths define how people and vehicles move on a puzzle piece. The structure of one path section looks like this:
Code (SC4Path-file Path Section) Select
-- car_1_2_a         -- This comment is used for the name of the path by several modding programs
1                    -- "Transportation Type Identifier"
1                    -- Path ID. This must be unique!
1                    -- Entering wind direction
3                    -- Leaving wind direction
0                    -- "Junction key (0 or 1)
2                    -- Number of path co-ordinates.
2.5,8,0              -- Path co-ordinates no.1 (x,z,y)
4,-8,0               -- Path co-ordinates no.2 (x,z,y)


Notes:
- The path name has the following structure: -- [vehicle name]_[entering wind direction]_[leaving wind direction]_[identification letter (this should be unique)]. You can leave the path name out of your path-files, but it's advised to use them anyway, because you can easily have an overview of your path files.
- The "Transportation Type Identifier" tells SimCity 4 which vehicle will be using this path. There are six known "Transportation Type Identifiers":
   - 1. "car" (all road-based traffic, except for pedestrians and GLR)
   - 2. "sim" (pedestrians)
   - 3. "rail" (heavy rail vehicles)
   - 4. "subway"
   - 6. "el-rail" (elevated rail and GLR)
   - 7. "mono" (monorail and (G)HSR)
- The Entering and Leaving Wind Direction tells SimCity which direction a vehicle enters the tile and which direction it leaves. The wind directions are:
   - 0. West
   - 1. North
   - 2. East
   - 3. South
   - 255. Special (Neighbour connections, dead ends, etc.)
Fortunately, the SimCity 4 Path Creator has these wind direction IDs on the sides of the screen, so you can easily what the Entering and Leaving Wind Direction of a path is. For instance, the red path in the image below enters the tile at the south (3) and leaves the tile at the north (1).

- The "Junction Key" determines if a switch appears for this path in the UDI mode (1) or not (0). Although this feature is only used for rail networks, it should always be present in the SC4Path-file!
- Every path should start and end at the edge of the tile, except if the Entering and/or Leaving Wind Direction is 255. Otherwise, this path will not appear in SimCity 4.

6.2.4. Stop points
Depending on the number of stop points, the SC4Path-file has a seperate section for each stop points. The paths define where vehicles stop to prevent colisions. It's very important that the stop points are defined after all paths. Otherwise SimCity will crash. The structure of one stop section looks like this:
Code (SC4Path-file Path Section) Select
-- stop_car_1_2_a    -- This comment is used to recognise the stop points for users.
1                    -- Left Hand Drive (2) or Right Hand Drive (1)
1                    -- "Transportation Type Identifier"
1                    -- Stop point ID. This must be unique!
1                    -- Entering wind direction
255                  -- Leaving wind direction
3,6,0              -- Stop point co-ordinates (x,z,y). There's always one stop point co-ordinate!


Notes:
- The path name has the following structure: -- stop_["UK_" in case of left hand drive paths][vehicle name]_[entering wind direction]_[leaving wind direction]_[identification letter (this should be unique)]. You can leave this note out of your path-files, but it's advised to use them anyway, because you can easily have an overview of your path files.
- Stop points also determine which vehicles give way to other vehicles and controls which traffic flows may go at stoplight intersections.

6.2.5. Other important notices
- Paths that contain errors don't show up or are red flashing when using the "ShowPaths"-cheat from ExtraCheats.dll.
- The Path and Stop Point IDs are 1 or higher.
- The Path IDs and Stop Points IDs don't depend on each other. That means you can use an ID twice: one for a path and one for a stop point. They both will have an unique ID.

6.3. Unpathed pieces/Dummy Paths

Sometimes there's no need for a puzzle piece tile to have paths. Unfortunatly, when a tile has no SC4Path-file, SimCity4 will be laggy during the construction of the puzzle piece. To prevent this from happening, you can make a Pathfile only containing a header and a dummy path. Fortunately, the Puzzle Piece Maker makes these dummy path files, so you don't have to edit the SC4Path-files for the tiles you don't want to contain paths.

6.4. SC4Path Creator

6.4.1. Introduction
In the early days of SimCity 4 Transit Modding, we didn't have any visual application for editing path files. Fortunately, one of our members, Daeley, has created a Java-application for this job, the SC4Path Creator. This tool significantly simplifies the creation of paths. The program also contains some very useful functions, such as flipping and mirroring paths, the ability to see multiple SC4Path-files at once and using a texture as background, which makes the creation of paths even easier.

6.4.2. The Single Frame View and  the Multi Frame View
The Single Frame View contists out of a Path Editor, which I'll explain in detail in the next section. The Multi Path View is ment for puzzle pieces that contain more than one tile. When your piece only constists out of only one tile, you can skip the next paragraph.

In the Multi Frame View, you can see all the path files at once. You first have to define the size of the grid to the size of your puzzle piece. It's advised to use '128' as rect size instead of the standard value '150', so you have the right scale. Every tile opens a new Single Frame View window when you click on it, so you can edit the paths.
NOTE: When you open a Single Frame View window of a tile and then return to the Multi Frame View, you can add or delete pathing co-ordinates by simply clicking on the tile.

6.4.3. The Path Editor

With the Path Editor you can edit any path in any desired tile. Each path has it's own color, so they can easily be recognised. In the menu "Path Options\Select Texture", you can select a texture image as background, to simplify the path creation. Most other functions are speaking for themselves. Still I want to bring some other things to notice:
   - When you have more than 6 paths at one tile, some paths will appear in the same color.
   - When you flip or mirror a path, the Entering and Leaving Wind Direction aren't changed automaticly. You need to edit those manually.
   - When you create a new path, the Path ID is set to 0 of that path. You need to set this ID manually to an unique number.
   - When you add some pathing code into the Code Editor, check the header if it's set to the right number of paths. If not, the path you just added will be deleted when clicking on the "update"-button.
   - When you've added some code and clicked on "update"-button and you see no change, then there is a bug in your code.
   - Although SC4Path files can contain notes, the SC4Path Creator only allows it at the first line of a new path. When you make notes at any other place, you'll see no change when you hit the "update"-button.
   - The SC4Path Creator 1.60 doesn't support stoppoints. Any stoppoints made will be deleted. It's advised to make the stoppoints at the end.
   - The SC4Path Creator 1.60 unfortunatly has no save function. When you shut down the SC4Path Creator and didn't save the code anywhere else, you can start all over agian.

6.4.4. Saving path files
Of course, you'll need to save your paths somewhere! When you finished creating paths with the SC4Path Creator, you can save them with the Reader in a DAT-file by following these steps:
   - Select the text from the Code Editor in the SC4Path Creator. You can use CTRL+A (Select All) to be sure everything is selected.
   - Copy the code (CTRL+C).
   - Select the corresponding SC4Path-file in the Reader.
   - Click on "Edit".
   - Select the code that's already in the SC4Path-file to override it (NOTE: CTRL+A doesn't work in the Reader).
   - Paste the new code (CTRL+V).
   - Hit "Apply"
   - Save the DAT-file when you're done.
Lurk mode: ACTIVE

MandelSoft

#7
7. The RUL 0x10000000 file

Now the SC4Path-files are all saved you are finally finished editing your DAT-file of your puzzle piece. Close the DAT-file, but don't close the Reader yet. We will uncover the magic file of SimCity 4 Transit Modding: the RUL 0x10000000 file

7.1. What is the RUL 0x10000000 file?
The RUL 0x10000000 file, also known as the "Intersection Ordering RUL", defines the puzzle pieces and places them in so-called Rotation Rings, which are part of TAB-Rings. This file was originally meant for Maxis Highway interchanges, since Maxis didn't make puzzle pieces for other transport networks. That's why the demolition costs of puzzle pieces are the same as the demolition costs for Maxis Highway sections.

7.2. Where can I find the RUL 0x10000000 file?
The original RUL 0x10000000 file, as Maxis created it originally, can be found in "SimCity_1.dat". But since "SimCity_1.dat" is way to big to update and for download, the NAM Team has created a separate DAT-file, containing the RUL 0x10000000, RUL 0x10000001 and the RUL 0x10000002 files: The NAM Controller. This file can be found in the NAM Folder. The filename of this file is "NetworkAddonMod_Controller_RIGHT_HAND_VERSION.dat" of "NetworkAddonMod_Controller_LEFT_HAND_VERSION.dat", depending on your driving side.

7.3. Editing the RUL 0x10000000 file?

7.3.1. Important notice before editing the RUL 0x10000000 file
The RUL 0x10000000 file is a quite delicate file and may cause CTDs on error. It's strongly recommended to let a NAM member know that you're editing the RUL 0x10000000 file. Not only can the NAM Team prevent errors, but they can also help you with editing the RUL 0x10000000 file and give you tips. Also, there is one Golden Rule:

DON'T RELEASE YOUR OWN VERSION OF THE NAM CONTROLLER IN PUBLIC! EVER!
ONLY THE NAM TEAM SHOULD RELEASE A PUBLIC VERSION OF THE NAM CONTROLLER.


We like to keep things central to make sure the files contain as less bugs as possible and that everything is compatible with each other. We don't like to have a dozen NAM Controllers hanging around with minor changes, but with no compatibility with each other. Following this Golden Rule will prevent much trouble and people asking why their mods don't work. An advised way is to post the RUL 0x10000000 code on the corresponding topics, so the NAM Team can incorporate it in the Controller and debug the code. Also, as said in Chapter 3, you should reserve IDs.

7.3.2. Importing/Exporting the RUL 0x10000000 file
The RUL 0x10000000 file is quite big (over 2MB uncompressed). The Reader contains a RUL editor, but it's advised to use an external text editor. This requires the RUL 0x10000000 file to be exported (this only needs to be done once):
   - Right-click on the RUL 0x10000000 file.
   - Select "Save decoded file"
   - The NAM-folder now contains file_dec00000000.rul (or any other number) and file_dec00000000.rul.TGI. You can edit file_dec00000000.rul by simply dragging it into Notebook.
   - You can edit the RUL 0x10000000 now. Don't forget to save when you're done.
If you're finished with editing the RUL 0x10000000 file, you have to import it into the Reader again:
   - Open the NAM Controller.
   - Delete the old RUL 0x10000000 file.
   - Go to "Sub Files/Insert File"
   - Select the external RUL-file you just edited.
   - Now the new RUL 0x10000000 file is added to the NAM Controller. Don't forget to save!

7.4. The structure of the RUL 0x10000000 file?

7.4.1. Introduction
In general, the RUL 0x10000000 file contains two sections: the TAB-Ring Section and the Definition Section. SimCity 4 interpretates all RUL-files one line at the time. Lines or parts of lines starting with ";" are comments and will be skipped by SimCity 4. In theory, you can use all characters you want in these files, but uncommon characters may have a weird effect in SimCity 4. One example is the Sinkhole-to-China-bug, where a deep hole appears when you placed a puzzle piece. Therefore, it's advised only to use numbers, capital and normal characters without any accent in notes. (even an quite innocent comma could cause problems.)

7.4.2. The TAB-Ring Section
The TAB-Ring Section contains definitions of the location of puzzle pieces. It defines in which Rotation Ring in which TAB-Ring a puzzle piece can be found. It also contains definitions which puzzle pieces are at which location and order in a Rotation Ring in which rotation (or mirrored varieties of the puzzle piece). In SimCity 4 a menu button gives access to a TAB-ring, containing one or more Rotation Rings. With the TAB-key on your keyboard you can navigate through TAB-Rings and with the Home and End-key you can navigate through Rotation Rings. Each Rotation Ring contains one or more items, which will refer to puzzle pieces in the Definition Section.

In the TAB-Ring Section each line defines one Rotation Ring. Every line contains a series of hexadecimal numbers, which refer to certain HighwayIntersectionInfoIDs (H3IDs). These refer to puzzle pieces in the Definition Section. The first line of a Rotation Ring starts with "RotationRing = " and looks like this:

RotationRing = 5100, 15100, 25100, 35100, 45100, 55100, 65100, 75100, 85100, 95100, A5100, B5100, C5100, D5100, E5100, F5100 ;RHW-4/MIS Ramp A

Rotation Ring can be enlarged by adding one or more Rotation Rings. To do this, you can add one or more lines starts with "AddTypes = ", like this:

AddTypes = 5101, 15101, 25101, 35101, 45101, 55101, 65101, 75101, 85101, 95101, A5101, B5101, C5101, D5101, E5101, F5101 ;RHW-4/MIS Ramp A-Diagonal
AddTypes = 5102, 15102, 25102, 35102, 45102, 55102, 65102, 75102, 85102, 95102, A5102, B5102, C5102, D5102, E5102, F5102 ;RHW-4/MIS Ramp A-Inside
AddTypes = 5103, 15103, 25103, 35103, 45103, 55103, 65103, 75103, 85103, 95103, A5103, B5103, C5103, D5103, E5103, F5103 ;RHW-4/MIS Ramp A-Wide


One TAB-Ring should contain one Rotation Ring at minimum, but the maximum number of Rotation Rings is practically unlimited.

NOTES:
   - It's common to add a comment containing the (code)name of the puzzle piece at the end of a Rotation Ring. This is not necessary, but it makes this section easy to overview.
   - The minimum number of items in a Rotation Ring is 1. The maximum is quite unlimited, but the NAM Team holds a maximum of 16. Usually the number of items in a Rotation Ring is a power of 2: (2, 4, 8 or 16)
   - It's important that every Rotation Ring in a TAB-Ring has the same number of items. When this is not the case, the TAB-Ring becomes unstable, resulting in duplicates or missing rotations or mirrored versions, or worse: it could cause a CTD (Crash To Desktop).
   - The first H3ID of a TAB-Ring should be four characters long. Otherwise you can't assign a menu button for that rotation ring. The other H3IDs may be up to 8 characters long, but usually a Length of 5 characters is enough.
   - Every H3ID can be used only once! Otherwise you'll get CTDs.

7.4.3. The Definition Section
The Definition Section defines puzzle pieces for each H3ID. Every H3ID where a new puzzle piece is defined has the following structure in theory: header, layout, properties, rotations. In reality it seems that rotation is a separate section that applies rotation and mirroring to puzzle pieces. So we have two sections: one to define the new puzzle piece and one for rotation and mirroring.

7.4.3.1. The Header
The Header usually gives a description of the puzzle piece, gives information about the author and date of creation and also defines the preview of the puzzle piece by referring to the S3D and EffDir of the preview model. Here's an example:


[HighwayIntersectionInfo_0x00005100]
;Added by Tarkus 8/13/2007.
;RHW-4/MIS-1 Exit Ramp-Style A--Orthogonal
Piece = -16.0, 0.0, 0, 0, 0x5ceb0005
PreviewEffect = preview_draggable_mis___001


Now let's examine this piece of code line by line.
The first line defines the H3ID of this puzzle piece. This must be 8 characters long. This H3ID, "0x00005100", refers to the H3ID "5100" in the TAB-Ring section.
The second line gives information of the author and the date of creation (format MM/DD/YYYY).
The third line is the (code)name of the puzzle piece.
The fourth line contains five values, divided by commas:
   1. The X-offset of the preview model
   2. The Y-offset of the preview model
   3. The rotation of the preview model
   4. Mirrored version ("1") or unmirrored version ("0") of the preview model
   5. IID of the preview model. This is usually the AutoTileBase IID + 5.
The fifth line refers to the EffDir name of the puzzle piece. This makes your preview model to appear in game.

7.4.3.2. The Layout section
The Layout section defines how your puzzle piece is constructed. Here you can add starters and draggable stubs if you want to. Here's an example:
CellLayout =.......
CellLayout =...a...
CellLayout =..+b<..
CellLayout =..cd...
CellLayout =..be...
CellLayout =..f....
CellLayout =...^...

CheckType = a - dirtroad: 0x02000200 Road: 0x01000001, 0xffffffff optional
CheckType = b - dirtroad: 0x02000200
CheckType = c - dirtroad: 0x02000202
CheckType = d - dirtroad: 0x02020000
CheckType = e - dirtroad: 0x02000200 Road: 0x01000001, 0xffffffff optional
CheckType = f - dirtroad: 0x02000200 OneWayRoad: 0x00010100, 0xffffffff optional

ConsLayout =.......
ConsLayout =.......
ConsLayout =../|<..
ConsLayout =../|...
ConsLayout =..|....
ConsLayout =.......
ConsLayout =...^...


As you can see, this section contains three types of lines, which should always be in the same order: first the "CellLayout"-lines, then the "CheckType"-lines and finally the "ConsLayout"-lines.

Every character after the "=" in the CellLayout, as well as the ConsLayout, represents one tile of the puzzle piece or the surrounding tiles. The "<" and "^" point out the position of the cursor when you place the puzzle piece. As you can see, in the CellLayout these characters point to "b" and in the ConsLayout these point to the topmost "|". Often this is also the position of the AutoTileBase IID. In this case however, the AutoTileBase IID is positioned one tile to the left. The game recognizes where the AutoTileBase IID is located and constructs the piece around it. But by placing the cursor not on the AutoTileBase IID, the preview will appear offset. To correct this issue, you change the value of the X-offset and/or the Y-offset of the preview model in the Header section to a multiply of 16 (since a tile is 16x16 meters large)

NOTES:
   - The "<" and "^" should point out the same tile in the CellLayout, as well as in the ConsLayout. Otherwise you get some unexpected results.
   - The "<" and "^" can only be used once in the CellLayout, as well as the ConsLayout.
   - The "<" and "^" may never point to a "." . You should move them to the first tile that doesn't contain a "." . You should also need to change the offset of the preview model.
   - The CellLayout, as well as the ConsLayout, have a minimum of two characters after the "=". The maximum is unlimited, but you'll never need more than 20, and usually a number of characters lower than 10 is enough.
   - Every line in the CellLayout, as well as in the ConsLayout, should contain the same number of characters. Otherwise you get some unexpected results.
   - The CellLayout, as well as the ConsLayout, should start with an introduction line, which only contains dots after the "=".
   - The last line of the CellLayout, as well as the ConsLayout, always contains a "^", but there can be other characters placed on that line than dots.

The CellLayout defines the layout and design of the puzzle piece. They describe which tiles are occupied and with what. In the CellLayout you can use any character defined in the CheckType-lines. One character from the CellLayout refers to one character in the Checktype-lines. Beside these characters, you can also use these two characters:
   - "." Unoccupied tile.
   - "+" Occupied tile with no reference in the CheckType-lines. (an "empty" occupied tile)

The CheckType define which networks are located "under" your puzzle piece. You can also define starters and/or draggable stubs of various networks. The CheckType-lines effects the way how and where you can place a puzzle piece in SimCity 4. When the CheckType-lines defined right, this can lead to "autoresolving": a neat feature that makes it possible to place a puzzle piece over an existing network without demolition.
Every character after "CheckType = " may only be used once in one H3ID, where a puzzle piece is defined. The characters used for the CheckType lines are any of the letters of the alphabet without accents. Capital letters are however allowed. Each character refers to the same character in the CellLayout of the corresponding H3ID.
As I said before, the CheckType can define which networks are located "under" your puzzle piece, as well as starters and/or draggable stubs. But how do you know which CheckType line you should use? The answer is quite simple.
   - Search for the H3ID of a puzzle piece which already contains the starter(s) and/or draggable stub(s) you want for your puzzle piece.
   - Examine the CellLayout and search for characters from which you think they refer to the desired starter(s) and/or draggable stub(s).
   - Copy the corresponding CheckType-lines of these starter(s) and/or draggable stub(s).
   - Paste them in your own CheckType-lines of your puzzle piece.
   - You may have to change the characters, since they can only be used once in one H3ID.
   - Now you can use these starters for your CellLayout.
You can also use this method to define the transport networks "under" your puzzle piece.
Of course, the CheckType-lines have their own structure, which I'll not explain in detail here. If you still are interested in the details, I'd reccomend you to read chapter 11 of this tutorial.

The ConsLayout-lines define how the puzzle piece handles unequalized landscapes. The way SimCity 4 will equalize the terrain of the puzzle piece, correspond to the ConsLayout. Slope Mods also have effect on this. The following characters can be used in the ConsLayout:
   - "." Unoccupied tile.
   - "+" Resolve slope between neighboring tiles, which effectively means conform to terrain. The Sinkhole-to-China-bug is related to this, having a + next to a + with certain neighboring patterns will cause that. # is intersection, it will flatten the area.
   - "|" "-" Orthagonal sections
   - "/" "\" Diagonal sections
   - "#" Intersection
NOTE: Although the ConsLayout is quite flexible with their input, in some cases they prevent that the puzzle piece can be placed, even on the best equalized terrain.

7.4.3.3. The Properties section
The Properties section defines the AutoTileBase IID, the possibility the automatically add a puzzle piece in an already realized transport network (rarely used), the IID of the Placement Query LText file and the costs of the puzzle piece. A common definitions section looks like this:

AutoTileBase = 0x5ceb0000
ReplacementIntersection = 0, 0
PlaceQueryID = 0x5ceb0000
Costs       = 400

Every line defines one property. All properties have the same structure: [name] = [value]. The following properties can be used:
[tabular type=4]
[head]Name[/head][head]Value, Max length[/head][head]Description[/head]
[row] [data]AutoPathBase[/data][data]"0x" + 8 hex[/data][data]Defines the AutoTileBase IID of the pathing files only. When this property is not used, SimCity 4 uses the standard AutoTileBase IID of the puzzle piece. When you use this property, it should be defined before the AutoTileBae IID, otherwise this property will not function properly. This property is often unused.[/data][/row]
[row] [data]AutoTileBase[/data][data]"0x" + 8 hex[/data][data]Defines the AutoTileBase IID of all files of the puzzle piece[/data][/row]
[row] [data]ReplacementIntersection[/data][data]"0, 0"[/data][data]This is an depreciated part of code.[/data][/row]
[row] [data]PlaceQueryID[/data][data]"0x" + 8 hex[/data][data]Defines the IID of the LText file used for the query when placing a puzzle piece. Usually this is equal to the AutoTileBase IID[/data][/row]
[row] [data]AutoPlace[/data][data]"0" or "1"[/data][data]Defines wether a puzzle piece is automatically placed ("1") or not ("0"). This property is used to construct a road over an Maxis Ground Highway. It automatically places a bridge. This property is optional, but be carefull: if you already used AutoPlace, you may not use ConvertQueryID for that puzzle piece, and vice versa. One of the two should be deleted or disabled (by placing a ";" at the start of the line)[/data][/row]
[row] [data]ConvertQueryID[/data][data]"0x" + 8 hex[/data][data]Refers to a LText-IID to be shown in a window when certain transport networks are placed in such way that you can place a puzzle piece here. This window only appear when you used transport network tools nearby the section. This property is optional, and is used for Maxis Highway On/Offramps:
[/data][/row]
[row] [data]Handle Offset[/data][data]Two values, divided by a comma[/data][data]Only Maxis uses this property. Offsets the cursor position from the defined position in the ConsLayout and CellLayout arrays. Syntax: X shift, Y shift. Can be + or -. For example: Say you have a 3x3 piece, all tiles occupied:
###.
###<
###.
.^.
The handle is at the very center. But if I use HandleOffset = 1,0 then the handle will be located 1 tile to the right. -1,0 goes to the left 1 tile, 0,1 goes up 1 tile, and so on. You can have handles outside of the piece boundary by doing this.
[/data][/row]
[row] [data]Costs[/data][data]8 hex[/data][data]Defines how much a puzzle piece costs when you place it in Simeleons. Not included are:
- Terrain equalisation costs.
- The costs for construction of starters and draggable stubs.[/data][/row]
[row] [data]OneWayDir[/data][data]1 character (see description)[/data][data]This option is only used for puzzle pieces containing One Way Roads and tells SimCity 4 in which direction the One Way Road goes. Use one of the following values:
- 0: West
- 1: Northwest
- 2: North
- 3: Northeast
- 4: East
- 5: Southeast
- 6: South
- 7: Southwest[/data][/row]
[/tabular]

NOTE:
The AutoPlace and ConvertQueryID are quite hard to handle and may do thing you don't want to. If there are one of more AutoPlace/ConvertQueryID properties in conflict with each other, only one of them is used and the rest is ignored. Also AutoPlace/ConvertQueryID can convert CTDs at TE Lots, because the game tries to place a puzzle piece into a TE Lot, which causes the crash. This is happened before and is known as the Car-Ferry-bug. So be very careful with AutoPlace and ConvertQueryID.

7.4.3.4. The Rotation Section
The Rotation Section makes it possible to rotate and mirror a whole item and copy it to another H3ID without changing the other sections. A example of a Rotation section:


Rotate = 1
Transpose = 1

Again, one line defines one property and both functions are optional. "Rotate" rotates the puzzle piece and can have the following values: "0" = 0°, "1" = 90°, "2" = 180°, "3" = 270°. "Transpose" mirrors the puzzle piece horizontally ("1") or not ("0"). Unfortunately, the "Transpose"-function doesn't work for starters and puzzle pieces with vertically asymmetrical paths, such as the RHW networks (with exception of the RHW-2). Again, all properties have the same structure: [name] = [value].

7.5. Defining rotated/mirrored versions of your Puzzle Piece

7.5.1. The basics
After you've defined your puzzle piece in the Definition Section, you only have one variation of your puzzle piece. Of course you want to use multiple versions of you puzzle piece, namely all rotations and mirrored versions. As you read in the above section, you can easily rotate and mirror your puzzle piece. The question is: How do you use the previous code to define the different rotations and mirrored versions of your rotations? The answer is simple: the whole code of the H3ID needs to be copied. Fortunately, Maxis provided a command that does this particular thing: the CopyFrom-command. This command functions quite similar to the "include"-command in various programming languages. The structure of the CopyFrom-command is simple "CopyFrom = 0x[H3ID that needs to be copied]".

NOTES:
   - Only one CopyFrom-command per line is allowed.
   - You can use an infinite number of CopyFrom-commands
   - The length of the H3ID that needs to be copied can be 1 to 8 characters long. To simplify the process, you can use the H3ID from the TAB-Ring section.

The CopyFrom-command, which can be seen as a Header, a Layout and a Properties section at once, is always placed at the start. Then you add the rotation code. An example:


[HighwayIntersectionInfo_0x00015100]
CopyFrom = 0x5100
Rotate = 1


This part of code can be read as the following code; the result is the same:


[HighwayIntersectionInfo_0x00015100]
;Added by Tarkus 8/13/2007.
;RHW-4/MIS-1 Exit Ramp-Style A--Orthogonal
Piece = -16.0, 0.0, 0, 0, 0x5ceb0005
PreviewEffect = preview_draggable_mis___001

CellLayout =.......
CellLayout =...a...
CellLayout =..+b<..
CellLayout =..cd...
CellLayout =..be...
CellLayout =..f....
CellLayout =...^...

CheckType = a - dirtroad: 0x02000200 Road: 0x01000001, 0xffffffff optional
CheckType = b - dirtroad: 0x02000200
CheckType = c - dirtroad: 0x02000202
CheckType = d - dirtroad: 0x02020000
CheckType = e - dirtroad: 0x02000200 Road: 0x01000001, 0xffffffff optional
CheckType = f - dirtroad: 0x02000200 OneWayRoad: 0x00010100, 0xffffffff optional

ConsLayout =.......
ConsLayout =.......
ConsLayout =../|<..
ConsLayout =../|...
ConsLayout =..|....
ConsLayout =.......
ConsLayout =...^...

AutoTileBase = 0x5ceb0000
ReplacementIntersection = 0, 0
PlaceQueryID = 0x5ceb0000
Costs = 400
Rotate = 1


7.5.2. Be creative!
You can also apply these rules in a creative way. For instance, what if we want to copy the code from H3ID 5100, rotate the puzzle piece 90°, change the preview model to 0x5ceb0205 and we want to use the EffDir "preview_draggable_mis___002", we can apply the following code:


[HighwayIntersectionInfo_0x00015100]
CopyFrom = 0x5100
Piece = 0.0, 0.0, 0, 0, 0x5ceb0205
PreviewEffect = preview_draggable_mis___002
Rotate = 1


Now we actually have two lines of "Piece" and "PreviewEffect". Since SimCity 4 has an unwritten law that what's loaded last will be used in-game. So the EffDir "preview_draggable_mis___002" is loaded instead of "preview_draggable_mis___001". The same goes for the "Piece"-line.
Reading the above text, you might guess why the following code copies the code from H3ID 5100, rotates the puzzle piece 90°, but doesn't change the preview model to 0x5ceb0205 and uses the EffDir "preview_draggable_mis___002".


[HighwayIntersectionInfo_0x00015100]
Piece = 0.0, 0.0, 0, 0, 0x5ceb0205
PreviewEffect = preview_draggable_mis___002
CopyFrom = 0x5100
Rotate = 1

This is because the code is in the wrong order. First the right "Piece"-line and "PreviewEffect" will be loaded, but then it gets overridden by the CopyFrom-command, which results in no change.
There is no further information about how this applies to other code, like the CellLayout and the ConsLayout. The only way to find out is experimenting. So be creative!
Lurk mode: ACTIVE

MandelSoft

8. Mirroring Puzzle Pieces Horizontally

Some puzzle pieces need to have a whole new horizontal mirrored version. This is required for pieces where the "Transpose"-function can't handle the piece, such as most RHW and NWM networks. To make a mirrored version of your puzzle piece, you'll need create the same files as for a new puzzle piece, except you can still use the same FSH-files. Also, the mirrored version has a different AutoTileBase IID as it's non-mirrored counterpart. These IIDs need to be reserved too (see chapter 3). To mirror your puzzle piece, follow these steps:
   1. Open the DAT-file with the non-mirrored version of your puzzle piece.
   2. Export all files to a random empty folder by using "File/Export All Files".
   3. Pack that same into a ZIP-file. All files should be in the root directory of the ZIP-file.
   4. Open the Puzzle Piece Maker.
   5. Fill in the AutoTileBase IID of the mirrored puzzle piece in the "AutoTileBase IID"-field.
   6. Fill in the AutoTileBase IID of the non-mirrored puzzle piece in the "AutoTileBase IID textures "-field (skip this step if you want other textures for you mirrored version).
   7. Fill in the width and the height (in tiles) of your puzzle piece in the "Width"- and "Height"-field.'
   8. Check the "Mirrored version"-checkbox
   9. Select "A-E" at "End Format IID"
   10. Choose 0 or 3 at "Resource Key Type". It's advised to use the same RKT as the non-mirrored version.
   11. Fill in the text that's shown in-game (when placing the puzzle piece) in the "Description (LTEXT)"-field. This should be very simmilar to the non-mirrored version.
   12. Fill in the EffDir name in the "Effect Dir name"-field. This must be an unique name. So you have to use a slightly different name as for the non-mirrored version.
   13. Fill in the Exemplar name (the name each exemplar of your puzzle piece gets) in the "Exemplar Name"-field. You can use the EffDir name for this (without "preview_")
   13. Make sure that "Use my own uploaded SC4Path files" is selected in the "SC4Paths"-section.
   14. Select "Mirror-X" and "Reverse" in the "SC4 Path files options" section.
   15. Upload the ZIP-file you just created
   16. Make sure every file type is selected.
   17. Fill in the download location in the "Download Location"-field. This is the location where your ZIP-file is saved.
   18. Click on "Build DAT Entries". A ZIP-file is now generated.
   19. Extract the ZIP-file. Make sure it's extracted in a directory with the same name as the ZIP-file.
   20. Open the Reader and open the DAT-file where you saved the nom-mirrored version of your puzzle piece.
   21. Select "Edit/Insert (Batch Method)". A new screen appears.
   22. Click on "Browse" and go to the location where you extracted your ZIP-file and select "batch.txt"
   23. Click on "Insert." You get a message all files where succesfully imported.
   24. Don't forget to save the DAT-file!
   25. Add the code for the mirrored version of the puzzle piece to the RUL 0x10000000 file. Don't forget to update the NAM Controller DAT-file.
   26. Start SimCity 4 and check if everything works as desired.
Lurk mode: ACTIVE

MandelSoft

#9
9. Creating New Menu Buttons

You can always add your puzzle piece to an existing TAB-Ring. Howerver, you can create a new TAB-Ring when required. A new TAB-Ring requires a new menu button, which gives access to the given TAB-Ring. A menu button requires four files to work properly.
- A PNG-image for the menu icon in four states (unavailable, normal, selected and hover state)
- An Exemplar file.
- Two LTEXT-files: One for the Item Name (shown in bold text in SimCity 4) and one for the Item Description.

These files always have the following Type and Group IDs:
[tabular type=4]
[row] [head]File[/head][head]TID[/head][head]GID[/head][/row]
[row] [data]PNG-image[/data][data]866DDBAC[/data][data]6A386D26[/data][/row]
[row] [data]Exemplar File[/data][data]6534284A[/data][data]2A3858E4[/data][/row]
[row] [data]LTEXT Item Name[/data][data]2026960B[/data][data]123006BB[/data][/row]
[row] [data]LTEXT Item Description[/data][data]2026960B[/data][data]123006AA[/data][/row]
[/tabular]

De IIDs of these files always starts with "6A47". The last 4 digits are the same as the first H3ID of the TAB-Ring in the TAB-Ring Section of the RUL0x10000000-file. For instance, the RHW Ramp Interface button uses the IID "6A475100", since the first H3ID is "5100".

The PNG image of the menu icon contains four states of the button. This section also applies for LOT menu icons. The image always has a resolution of 176x44 pixels. The image is divided in sections of 44x44 pixels. You see four images, each in a different state. The order of the states is the following:
   1. The menu button is unavailable. You have to gain access to this function. Mostly used for LOTs, but rarely for transit items.
   2. The 'normal' menu icon.
   3. The selected menu icon.
   4. The menu icon shown when your cursor hovers on top of it.

The Exemplar file makes the menu button functional. It defines the PNG image, as well as the two LTEXT-files for the menu button. The menu location is also defined here. You may want to copy an existing Exemplar file of another menu icon (for instance, the Exemplar for the RHW Ramp Interfaces) and edit the file. The first thing you need to change is the IID, so it corresponds with the IID-format as explained above. You can do this by clicking on Tools/TGI Editor. A new screen appears. Select the file you want to change its IID and fill in the IID in the text box under "Instance" and hit "Apply".


Here's an example of an Exemplar file of a menu button. The following values need the be changed:
   1. Replace the Exemplar Name (marked dark blue) with another name. This is for reference purposes. It's not neccesary, but it's wise to do so.
   2. Replace the item marked in green by the name of the sub-menu you want the button to appear in. You can choose a wide variaty of variables, but you may only use four:
      - SubmenuKey: Networks: Highway Ramps Menu
      - SubmenuKey: Networks: Miscellaneous Transport Menu
      - SubmenuKey: Networks: Rail Depots Menu
      - SubmenuKey: Networks: Road Menu
   3. Replace the red marked items ID with the IID of your menu button.
   4. Normally the menu buttons are sorted based on their IID. The lowest IID is located at the top of the menu, the highest IID at the bottom. When you're not satisfied with the location of your menu button, you can change the item marked in light blue. The higher the value, the lower the button will appear in the sub-menu. You may want to change this value for other menu buttons too.
Lurk mode: ACTIVE

MandelSoft

#10
10. Q&A

10.1. Pathing problems
Q: When I use the "DrawPaths"-cheat, one or more paths are showing up red and blinks. What does that mean?
A: it means that these paths have an incorrect entering and leaving wind direction and therefore can't be used. Change the entering and leaving wind direction of the corresponding SC4Path-file to solve this issue.

Q: When I use the "DrawPaths"-cheat, I discover that some of the tiles of my puzzle piece has no paths. What's causing this?
A: There could be two things that cause this problem:
   1. The SC4Path-file has a wrong GID (GroupID). Check if the GID is "a966883f". If not, change it to that ID.
   2. Two or more paths with the same entering and leaving wind direction have the same Path ID. Make these IDs unique to solve this problem.

Q: When I use the "DrawPaths"-cheat, I discover that some of my paths are missing, although I defined them. How is that possible?
A: In the header of the SC4Path file, you've entered a too low value for the number of paths. Change it to the correct value.

10.2. RUL 0x10000000 problems
Q: Why can't I place my puzzle piece, even on a perfectly flat surface?
A: There could be multiple things that cause this problem:
   1. The ConsLayout is defined in such way that the puzzle piece can't be placed. Change the ConsLayout.
   2. The "<" and "^" characters point to a "." in the ConsLayout, as well as the CellLayout. Replace the "." by another character or move the "<" and "^" characters so they point to another character.
   3. In the CheckType-lines, the combination is not defined in the RUL 0x10000001 file. Change these CheckType-lines, or add new lines to the RUL 0x10000001 (not reccomended for new users). For more information read chapter 11.
   4. The Definition section contains some comments with uncommon characters. Try to delete these comments one at a time until the piece can be placed.

Q: Why doesn't SimCity 4 show all tiles of my puzzle piece?
A: Check the CellLayout-lines if there is a "+" or a character reference to the CheckType-lines at the position of the missing tiles. If not, change them to a "+" or a character referring to a CheckType-line.

Q: When I place my puzzle piece, it has a different layout then I defined it and terraforms the landscape in a unwanted way. How to solve this problem?
A: The Definition section contains some comments with uncommon characters. These can cause unexpected effects on the layout of your puzzle piece Try to delete these comments one at a time until the piece can be placed properly.

Q: When I try to place my puzzle piece, why can't I see the preview model?
A: There could be two things causing this problem:
   1. The Header in the Definition Section contains a incorrect IID of the preview model.
   2. The Header in the Definition Section contains a incorrect EffDir name of the preview model.

10.3. Other problems
Q: When I place my puzzle piece, one or more tiles are gone. How can this be?
A: You might miss an exemplar file for that tile. Create an exemplar file for this tile to solve this issue. This problem shouldn't occur with the Puzzle Piece Maker.

Q: Some tiles dissapear at one or more zoom levels. What's wrong?
A: There could be two things causing this problem:
   1. There are some S3D missing. Check if there are one (RTK 0) or five (RTK 3) S3D-files for every tile of the puzzle piece. If not, create new S3D files for the missing pieces. This problem shouldn't occur with the Puzzle Piece Maker.
   2. You might have forgotten to add some textures. Check if you have five FSH-textures for every tile of your puzzle piece. If not, add the missing textures
Lurk mode: ACTIVE

MandelSoft

Lurk mode: ACTIVE

Blue Lightning

#12
First of all, looking great Maarten! Gave it a read through, its pretty clear and accurate. &apls

Mind if I point a few things out though...

Quote
The ConsLayout-lines define how the puzzle piece handles unequalized landscapes. The way SimCity 4 will equalize the terrain of the puzzle piece, correspond to the ConsLayout. Slope Mods also have effect on this. The following caracters can be used in the ConsLayout:
   - "." Unoccupied tile.
   - "+" Intersection
   - "|" "-" Orthagonal sections
   - "/" "\" Diagonal sections
   - "#" No effect on the slopes
+ is resolve slope between neighboring tiles, which effectively means conform to terrain. The hole to china bug is related to this, having a + next to a + with certain neighboring patterns will cause that. # is intersection, it will flatten the area.

HandleOffset: Offsets the cursor position from the defined position in the ConsLayout and CellLayout arrays. Syntax: X shift, Y shift. Can be + or -. EXAMPLE:

Say you have a 3x3 piece, all tiles occupied.

###.
###<
###.
.^.

The handle is at the very center. But if I use HandleOffset = 1,0 then the handle will be located 1 tile to the right. -1,0 goes to the left 1 tile, 0,1 goes up 1 tile, and so on. You can have handles outside of the piece boundary by doing this.

ReplacementIntersection, if I recall correctly, was used in pre-Rush Hour for rotation and flip clones. SYNTAX: Rotation, Flip. Its been depreciated, and you don't need to include it in your RULs, and I usually don't.


And a last note, the US and (I think) UK spelling is "character."
Also known as Wahrheit

Occasionally lurks.

RHW Project

MandelSoft

Thanks Vince. I corrected the spelling mistakes and added your comments.
Lurk mode: ACTIVE

daeley

good stuff! although your Path Editor Screenshot is a bit outdated ;)
1. Install SC4+RH
2. Install LEX (CD&DVD helps) and latest NAM + updates
3. Play the game
4. ? ? ? ?
5. Profit!

swamp_ig

Awesome work! I wish I'd had that when I was doing it the first time.

It's worth noting that when you have a puzzle piece that has start pieces in it you can still use the Transpose function without having to copy all of the textures / models.

The only thing that will need to be duplicated are any textures or preview models *IF* they have directional arrows on it since the arrows will point the wrong way when the paths get reversed.



You can override the check types when using CopyFrom, so that you get the correct one.

For example, if you have a RHW4 start piece in the untransposed section:

[HighwayIntersectionInfo_0x00005322]
....
CheckType = h - dirtroad: 0x00020002 onewayroad: 0x01010000, 0xffffffff optional
...

Then in the transposed version you can do:

[HighwayIntersectionInfo_0x00015320]
CopyFrom    = 0x5322
Transpose   = 1
Rotate      = 1
...
CheckType = h - dirtroad: 0x00020002 onewayroad: 0x00000101, 0xffffffff optional



(ie: a start piece in the oposite direction)

Ciuu96

#16
At last available to the public! Thank you really, really much! This will make my experiementing so much better, at the moment I have just played around with few textures, now I can use really use them for something! Tomorrow I will read this whole guide and try to make something, maybe it will turn even useful.

Thank you (both) once again, this will take my playing to next level!  :)

EDIT 8. december 2010: Well, I have now created my first puzzle piece, this tutorial was very helpful! Won't show it until I have made few others, to make the network more functional.
Has it really been almost 2 years?
Must return. :)

ivo_su

Maarten I saw and read your lesson, perhaps over 30 times and is constantly trying to figure it out but to my great regret there are many things that I do not understand. You know I guess I really want to learn to make puzzle pieces and help full of NAM but for now I attached.
What is done from your lesson and that of the Blue Lightning is that there are more explanations than pictures to show how things happen step by step

Ivo

MandelSoft

#18
Although a picture often says more than a thousand words, sometimes it's easier to explain in words than in pictures. This is one of those cases. The problem is that the whole proces is kind of abstract. That's why it's so difficult to explain it in pictures and I have no idea how to explain it better. If someone else does, please share ;)
Lurk mode: ACTIVE

j-dub

While I sure can not explain it, especially since my last fatal video system failure, I would of suggested someone film how to do this when a picture nor words is enough.