Jump to content
Sign In to follow this  
Karybdis

DISCOVERY: File Formats, The Positioning formats (RUL, and Sc4path)

176 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

This thread is for the position formats of Simcity 4. Namely Rules files and Simcity4 Paths files.

Rules files are used for positioning and placement, while Sc4paths determine automata paths on a given piece of network tile.

They are both text formats so decoding them lies in finding the meanings in the blocks of text

Rules files I unfortunately have no specification for, although they do have an instance ID that points to an exemplar and an Sc4pathing file. Presumably so that they can choose automata movement on the placed tile.

Sc4pathing files have the following format

---------

Header:

SC4PATHS

val

val

val

Repeating chunk:

--Type_val1_val2

val

val

val1

val2

coordinate block

--------

Type is any transportation type. IE subway, car, train. etc

The coordinate block appears to be consecutive X,Y,Z coordinates for the placement of an automata model as it makes its way across a network tile. Specifically its a connect the dot path that all things travel across on the specific tiletype

All network pieces seem to be generally governed by an INI file located at number 24065 in the simcity_1.dat file. It is assumed that this is where the other numbers in the rules and sc4paths files come from. More connections are needed 1.gif

Any and all help on these format types is much appreciated.

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    (((This is a copy of Teirusu's pathing formats post from the Sc4path thread. It was copied here do to the great amount of work and thought he/she has put into these formats 1.gif )))

    I would suggest to start out small. After looking through the most of the highway examplars myself things look... well... complex. Quite complex.

    I think a good place to start is with the country roads in the exchange and make them functional. They would work much like streets, (No diagonals and such...) and as far as I can tell, would be the easiest to work with.

    In fact, with what I know already, I think *COULD* add my own type of transportation already, however, I'm missing a few key points. And if I did know all the key points it would be a very simple form of transportation mind you.

    So, in an effort to see if anyone knows more then I do at the moment (Which I'm sure there is.) I'm going to outline just what I do know at the moment.

    First, the FSH files.

    As most of you already know many (If not all) of the road FSH files are in Simcity_5.dat file. In fact at very beginning of it, starting with Instance 00000100

    00000100 is the single road/street piece at the farthest zoom level. The other four instances 101, 102, 103, and 104 are for it's closer zoom levels. Now look at 110 - 114. They are the samething except with an alpha around the road, and so are 121 - 124 and 131 - 134.

    Now go down to 00000200. It's a diagonal road end piece and everything up to 234 in Simcity_5.dat is also the same piece. The only difference is zoom level and how green the grass is... Ah-ha! Wealth levels!

    So to recap, there are four types of the same piece. Default/concrete sidewalk, $ wealth, $$ wealth, and $$$ wealth. Furthermore, for each type there are 5 FSH files for each zoom level. That's 20 FSH files total for each piece of roadway!

    So the format goes:

    Default/concrete sidewalk
    XXXXXX00 - farthest zoom
    XXXXXX01 - 4 zoom
    XXXXXX02 - 3 zoom
    XXXXXX03 - 2 zoom
    XXXXXX04 - closest zoom

    $ wealth
    XXXXXX10 - farthest zoom
    XXXXXX11 - 4 zoom
    XXXXXX12 - 3 zoom
    XXXXXX13 - 2 zoom
    XXXXXX14 - closest zoom

    $$ wealth
    XXXXXX20 - farthest zoom
    XXXXXX21 - 4 zoom
    XXXXXX22 - 3 zoom
    XXXXXX23 - 2 zoom
    XXXXXX24 - closest zoom

    $$$ wealth
    XXXXXX30 - farthest zoom
    XXXXXX31 - 4 zoom
    XXXXXX32 - 3 zoom
    XXXXXX33 - 2 zoom
    XXXXXX34 - closest zoom


    Now for the RUL files. Precisely Number 113, it's the main road rules file.

    Lets start at the top of the file:
    1,00,00,00,00
    3,0,0x00000100,0,0

    What does it mean? Well I see the Instance ID I first talked about, that's a start

    Now lets look at the 90-degree turn piece... 0,0x00000F00
    Looking at the RUL file there are 4 mentions of it.

    1,00,00,02,02
    3,0,0x00000F00,0,0

    1,00,02,02,00
    3,0,0x00000F00,3,0

    1,02,00,00,02
    3,0,0x00000F00,1,0

    1,02,02,00,00
    3,0,0x00000F00,2,0

    See a pattern yet? Here, let me help you...

    1,00 (left),00 (top),02 (right),02 (bottom)
    3,0,0x00000F00,0,0

    Now rotate it 90 degrees clockwise.
    1,02 (left),00 (top),00 (right),02 (bottom)
    3,0,0x00000F00,*1*,0

    Rotate it again.
    1,02,02,00,00
    3,0,0x00000F00,*2*,0

    And a third time!
    1,00,02,02,00
    3,0,0x00000F00,*3*,0


    And here's the straight road:
    1,00,02,00,02
    3,0,0x00004B00,0,0

    1,02,00,02,00
    3,0,0x00004B00,3,0

    So that number after the instance ID is for rotating the FSH file. What about the one after it? Later...
    First the 02, what does it mean?
    My theory is roads/streets/rails/etc... are treated as puzzle pieces. 02 "ends" attach to other "02" ends. 01 ends attach to other 01 ends etc... etc... etc...

    So... What about that one number the rotational key? ...Okay I'll tell you now It's a mirror key.

    Check these out and draw your own conclusions:

    1,11,11,11,11
    3,0,0x00040D00,0,0

    1,13,13,13,13
    3,0,0x00040D00,0,1

    And...

    1,00,00,01,01
    3,0,0x00000800,0,0

    1,00,00,03,03
    3,0,0x00000800,1,1

    1,00,01,01,00
    3,0,0x00000800,3,0

    1,00,03,03,00
    3,0,0x00000800,2,1

    1,01,00,00,01
    3,0,0x00000800,1,0

    1,01,01,00,00
    3,0,0x00000800,2,0

    1,03,00,00,03
    3,0,0x00000800,0,1

    1,03,03,00,00
    3,0,0x00000800,3,1


    So what now? Sleep... lots of sleep... too much typing... maybe more later.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    UI file 24065... Hmmm.

    It looks like another RUL type file. Seems (for the most part) to describe interactions between two different network pieces AND how to set up highway intersections!!!



    [RoadRailIntersectionSolutions]
    ; format:
    ; name=roadMajorTypesFlag,railMajorTypesFlag,textureId,rotation,flip
    ;
    ; name is really not used and is just for our reference.
    ;
    ; straight road, straight rail
    rot0=0x02000200,0x00020002,0x03010100,0,0
    rot1=0x00020002,0x02000200,0x03010100,1,0



    Here's the straight road piece again.

    1,02,00,02,00
    3,0,0x00004B00,3,0

    1,00,02,00,02
    3,0,0x00004B00,0,0

    Remember from the post above = 1, (left), (top), (right), (bottom)

    Looks similar doesn't it? Minus the 1, 3, and all the commas.

    So, basically, rot0 line states that if a straight road running left to right intersects with a rail running top to bottom use FSH file family 0x03010100 - 0x03010104 with no rotation or mirror.

    The rest of the file pretty much stems off that main idea. Though, I'm not sure at all what the override section means and does...

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Very interesting teirusu. Your data seems to keep being confirmed the more work we do on it 1.gif

    My apologies to everyone the spec above I had for sc4paths in the first post was rendered invisible because I had it in greaterthan lessthan brackets. It has been corrected

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online: A long, long time ago... 
     
    a couple basic points I noted earlier in sc4path files
     
    SC4PATHS
    1.0 <--always 1.0, or 1.1, version? it was said that the turning for a tile was updated in one patch.
    5 <-- number of path sets in this file
    1
    -- car_a_1_3
    1
    1
    1
    3
    6 <-- number of path points below
    -0.566288,8.0,15.6995
    -0.566288,5.26864,15.6995
    -0.566288,1.40557,15.6995
    -0.566288,-3.42325,15.6995
    -0.566288,-6.18258,15.6995
    -0.566288,-8.0,15.6995
     
    in the above, I have a hunch that 1, 1, 1, 3 are more or less related to the external connections, aka, connect the dots with other tiles, there are a lot of these sets that repeat those numbers, but with always differing numbers of path points. in MOST of the files, the last coord (of xyz) is usually 0.0, but in this case, it isnt, anyone have any idea why that might be?
     
    1,02,00,02,00
    3,0,0x00004B00,3,0
     
    in the second line, it always starts with 3 for the texture line, I can find no exceptions
    also, there are times when ther is a 2 beginning in the first line, I saw these mostly on interesections, there would be a 1, then a 2, or a 1, then a 2, then a 2... I'm going for more research, updates later

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online: A long, long time ago... 
     
    last coord is height for highways and such, this looks like an onramp....
     
    -- car_e_3_1
    1
    5
    3
    1
    17
    34.5533,-55.9998,0.0500002
    34.4353,-51.0973,0.0424185
    33.6303,-44.7928,0.17947
    32.4236,-39.6752,0.17947
    28.7852,-33.7599,0.17947
    24.9325,-31.3081,0.377468
    20.9046,-27.8056,2.28054
    15.1255,-22.9021,7.91385
    11.761,-19.9476,11.4749
    8.84956,-16.8741,14.1883
    7.09831,-14.4223,15.4227
    5.55745,-11.3949,15.8993
    3.91744,-7.66618,15.8958
    2.66576,-3.59903,15.9332
    1.65253,-0.142101,15.7394
    1.13902,3.53553,15.7242
    1.0,8.0,15.7
     
    as a note, the height overall is unsteady, it fluctuates up and down, the fluctuation can probably be considered to be normal. it's never more than .05, might even be less
     
    and the '-' is a comment, anything behind it is irrelevant to the engine, there are a lot of paths that are commented out or incomplete, perhaps in an attempt to fix them, also, as I surmised, the 'version' at the top is just what I thought it to be, anything with a newer version overwrites the old, a lot of these are invalid, and possibly the version was implemented so as to not have to edit the source save files. Since I brought that up, I might also surmise out loud that they probably didnt make these paths by hand putting in numbers... so! tropod! is there any thing in the house tools that might allow them to plop path points?

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    I'm going to try to make a viewer to plot these points and lines in 3D space, so we can visualize the paths and all. I don't know how builderman is, but he was working on a 3D viewer for a while. I'm hoping he is close to finishing it.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online: A long, long time ago... 
     
    SC4PATHS
    1.1 <--version
    24 <--transportation paths in this file (car/train)
    32 <--sim paths in this file
    0 <-- 0 is road paths, 1 is highway paths / on/offramp paths

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    Good work guys! 9.gif I'm glad people your so interested in this. I've been mulling over the possabilities of custom roads for a while now. I can't wait till we have it all cracked.
     
    It seems that version 1.0 paths can't have both transportation paths and sim paths. All the 1.0 paths I've seen only have three lines at the top:
     
    1.0
    5
    1
     
    Where as 1.1 paths can have 4 lines.
     
    Also, in RUL files, is the #NameHere# simply a comment, or is it critical to determining what the rules apply to? There are rules for highway, road, rail, pipe, and subway.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online: A long, long time ago... 
     
    in the 1.0 paths files, the total number displays everything, where has the 1.1 spec breaks things down a bit.
    here is what is confusing me, I loaded up all of the sc4paths files into a special text editor and searched for the string such as this..
    1
    1
    1
    0
     
    now, this string appears multiple times, along with it's distinct header (--car_a_1_0) in multiple files, whether they be 1.1 or 1.0
    so question is, how are these distinguised?! for that question, we might have to look at the rules again, here is an instance I am puzzling, but the ruls for the highways gives little insight.....
     
    -- car_a_1_0
    1
    1
    1
    0
    17
    91.6553,87.9784,15.6997
    87.5981,83.9369,15.6995
    77.8174,74.4877,15.6995
    67.6121,63.6345,15.6995
    56.2522,52.2338,15.6995
    47.2002,44.005,15.6995
    35.5972,32.5437,15.6997
    23.3867,20.4115,15.6995
    9.96142,6.93793,15.6995
    -7.83789,-10.742,15.6995
    -21.2023,-24.46,15.6995
    -34.7495,-37.4447,15.6995
    -54.8567,-58.2965,15.6995
    -65.6912,-68.7108,15.6995
    -73.9318,-77.0735,15.6995
    -83.7727,-87.3166,15.6997
    -87.9996,-91.7517,15.6995
     
    my first thought was to check if their is a highway rule anywhere with the only number that could be different.. 17! but alas, no
    my next insight isnt terribly deep however, but it is enlightening, road rules and paths are handled differently than highway rules and paths. highways are 3d objects, roads are textures. the rules for highways point directly to sc4path files, which contain only rules, and I believe, only the rules for that tile, still figuring out roads. how the highway rules are pointed to is a mystery, but perhaps it's handled by whatever exempler controls the highways
    how it decides which to use might be simpler however...
    1,2,4,1,0
    2,5,1,4,2,0
    3,0,0x02001500,2,0
    3,5,0x02001500,2,0
    3,3,0x02001500,0,0
    3,4,0x02001500,0,0
     
    a highway rule, the digit between the 3 and the address to the sc4path file might tell it which data set to use in the sc4 path file.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online: A long, long time ago... 
     
    the sc4path file instance ID is located in the last value slot in the Resource Key Type value for highways
     
    for road and train, it's property 0xC9A5A1BE, currently an unknown

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    I dub thee, 0xC9A5A1BE, be officially named "Path Reference".

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Actually... 0xC9A5A1BE isn't a path reference.

    It's a reference to the Instance ID of the base FSH file for network pieces.

    If you look in all road exemplars and cross-reference 0xC9A5A1BE against the FSH files in 5.dat and 3.dat (for the street pieces) you'll see what I mean. The simulator bases everything around the FSH files.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    Of course, now that I look at it. The SC4path files share the same Instance ID as the FSH files they mark out paths for!

    Man, I feel stupid. 3.gif

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    I beleive it referrs to the SC4PATH file, which then referrs to the FSH. The simulator doesn't base much around FSH files (FSH files are just images, so you can't simulate much with them, but exemplars, scripts, paths, etc. are logical, rule-based info that you CAN simulate with), but rather other files with similar instance ID's that later reference the FSH files. Remember, instance ID's must be unique for a given Type/Group combo. If the type is different, the group and instance can be the same for different files. The property 0xC9A5A1BE references the SC4PATH file, and the FSH files will be referenced either directly through the SC4PATH, or inderectly simply by their instance ID. The FSH files are usually on the bottom of the chain, always referenced by a something else. 2.gif

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online: A long, long time ago... 
     
    that logic doesnt quite fit DM, the sc4paths have no references, so therefore the game is just sharing the property, unless the exempler references the fsh, and the rule file is based on the fsh, then the sc4path is referenced by the rule

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    C'mon, c'mon...get back to work Teirusu. Your our official path guru...you gotta work now! 3.gif22.gif

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online: A long, long time ago... 
     
    sounds fine, anyone that need to change it will know what it does anyway 22.gif21.gif

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    I think I mentioned that FSH files are often simply loaded because of their similar instance ID. FSH files don't guide everything, they are just pulled along with everything else. Sometimes they are referenced in other files (ATC files for animations, 3DM files for textures, etc.) The RUL file, in this case, is the top of the chain, and it looks like the FSH is referenced by that (not the SC4PATH file). The SC4PATH is referenced from the 0xC9A5A1BE property in the exemplar. I have been looking, and it doesn't seem like the FSH files always have the same ID as the SC4PATH files. Sometimes SC4PATH files exist with instance ID's that don't have a corrosponding FSH file.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    Has anyone actually tried changing 0xC9A5A1BE though?? And/or has anyone actually gone through and looked at every single exemplars that contain this property and searched the Index of its value? I've actually changed the value associated to this property, and the only noticeable (visual) difference I can tell, is that of the props on the network pieces themselves. Changing this value does not actually seem to change the network piece itself, but rather the items/props/etc that appears on them. Though I must say, there's something I don't quite get, because the inhouse tools that I've been able to bring up in the game, seem to go by the 0xC9A5A1BE property for each of the different network pieces (there's other properties in other exemplars though that it also seems to go by, for exemple: 0x27812823. With the last five values of this property, seems to be a different piece each at a different altitude/level/zoom of the highway piece).

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    From what I can tell your right.

    But look at RUL file 131, it is for the street rules...

    As you tell its largely a copy and paste of the roads one... and so is the subway one, and the pipes one. In fact the pipes one is the same SIZE as the road one!

    But getting back to the point, the RUL files make references to lot of things that don't exist. Therefore it's also my guess that maybe SC4paths files are the same way. Some of them might just sit there and do nothing.

    So, some SC4paths might exist without FSH files... but that doesn't matter if none of the exemplars have a value for that SC4path file. What does matter is what 0xC9A5A1BE is referencing to, and as far as I can tell, all those values of 0xC9A5A1BE that I looked up are existing FSH files.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online: A long, long time ago... 
     
    there is still a very complicated, very intertwined puzzle to solve *goes back to deciphering*

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    Teirusu, looks like your right about the 0xC9A5A1BE property. Maybe some SC4PATHs arn't used. Something else I thought of was does 0xC9A5A1BE reference an exemplar, which then collects SC4PATH, RUL, and FSH files together? I havn't checked this yet, but maybe thats why changing it changes the props that appear on the tile.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    ----------------

    On 8/10/2003 9:56:23 PM Teirusu wrote:From what I can tell your right.


    But look at RUL file 131, it is for the street rules...


    As you tell its largely a copy and paste of the roads one... and so is the subway one, and the pipes one.  In fact the pipes one is the same SIZE as the road one!


    But getting back to the point, the RUL files make references to lot of things that don't exist.  Therefore it's also my guess that maybe SC4paths files are the same way.  Some of them might just sit there and do nothing.


    So, some SC4paths might exist without FSH files... but that doesn't matter if none of the exemplars have a value for that SC4path file.  What does matter is what 0xC9A5A1BE is referencing to, and as far as I can tell, all those values of 0xC9A5A1BE that I looked up are existing FSH files.


    ----------------


    Well this is one of the reasons I think/believe that the SC4Path files is what (determines the network pieces and) points to the exemplars, not the other way round.

    I know for a fact that the Unknown property 0x00000021 (which with most files points to itself) is actually the ID of the network pieces for exemplar types 0x00000021. This same Unknown property 0x00000021 in all the exemplar itself (that it is in), I believe it to also be the file ID for itself (it is actually an internal ID for all the exemplars that contain this property I believe, changes made to it for most of the exemplars are mostly unnoticeable, least at the moment it seems anyhow).

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    SC4PATH files don't have any instance id's in them though, so how could they point to exemplars?

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    GouRou, what do you think of those Type 8 'support' files?

    It seems to me they also share the same Instance ID as the SC4path/FSH files...

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online: A long, long time ago... 
     
    they are strange, they dont seem to point to anything, perhaps their sole job is to hold more unknown properties for us to unravel 22.gif

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Here's a copy of the current SC4path and Rules specs. I've made a couple of editions while I've been working 1.gif

    ((Rules))

    #(transittype)RULES# : Header

    ;
    ; Stuff
    ;
    (description of the block)

    Block types begin with either a 1, 2, or 3, Here are the three types and their structure below.

    1,(leftvar),(topvar),(rightvar),(bottomvar) : Vars may be specific numbers such as 3,11,13 etc which may signify the type of connection allowed but remains unknown.

    2,Unknownval,Unknownval,Unknownval,Unknownval,Unknownval

    3,Unknownval,(Fsh Texture set to use),direction angle (0-3),(flipkey or mirror key (vertical and horizontal mirror image, possibly to allow for other connection types))


    ((SC4path))

    SC4PATHS
    #.# : Version - 1.0 or 1.1 (formats will be covered following)
    (1.0 versions may not contain stopped automata detail)
    (1.1 versions have stop automata detail and an extra starting property)
    ## : Transportation paths in the file (sims and transport)
    ## : (1.1 only) Stop detail sections in file (for stopped automata)
    # : file transportation type (0 = 2d paths (textured transport like subway. No 3d model), 1 = 3d transport (highways etc)) (( I believe this. not tested))


    (Sections for a moving transportation type - road, sim, subway)

    -- Type_elevatedornot(not present if not elevated, may be a or b if elevated)_val1_val2 : Transport section internal name

    # : Transportation type (1=road,2=sims,3=train,4=subway)
    # : Elevation type? (0 if not, number for the corresponding alphabet letter in title)
    # : Val1 from the name (unknown value)
    # : Val2 from the name (unknown value)
    ## : Number of repeating coordinates for this block
    #.#,#.#,#.# : repeating z,x,y coordinate

    (Sections for Stop Data - version 1.1 only)

    -- Stop(UK if UK stop)_Transittype_class(not present if not set)_val1_val2

    # : Type of Stop (1=normal,2=UK Stop. Dunno what this means)
    # : Type of Transit (1=road,2=sim,3=train)
    # : class (corresponding letter to alphabet, a=1,h=8 etc)
    # : val1 (unknown value)
    # : val2 (unknown value)
    #.#,#.#,#.# : Coordinate for Stop

    Share this post


    Link to post
    Share on other sites

    Sign In or register to comment...

    To comment in reply, you must be a community member

    Sign In  

    Already have an account? Sign in here.

    Sign In Now

    Create an Account  

    Sign up to join our friendly community. It's easy!  

    Register a New Account

    Sign In to follow this  

    • Recently Browsing   0 members

      No registered users viewing this page.

    ×

    Thank You for the Continued Support!

    Simtropolis depends on donations to fund site maintenance costs.
    Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

    But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

    Make a Donation, Get a Gift!

    Expand your city with the best from the Simtropolis Exchange.
    Make a Donation and get one or all three discs today!

    STEX Collections

    By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

    Each donation helps keep Simtropolis online, open and free!

    Thank you for reading and enjoy the site!

    More About STEX Collections