Menu

LEX File Exchange
EA Support Files
SC4 Wikipedia
Network Addon Mod
Dependencies
Chat
Welcome, Guest. Please login or register.
Did you miss your activation email?

July 27, 2021, 07:03:20 PM

Login with username, password and session length

Author Topic: Some Advanced Modding  (Read 6643 times)

0 Members and 1 Guest are viewing this topic.

Offline choco

  • NAM Team
  • Forums Senator
  • *
  • Posts: 783
  • Total likes: 19
  • Reputation: 10
  • "bridge" engineer...
  • CL: SC4 Bridgemeister
Some Advanced Modding
« on: April 16, 2009, 11:57:54 AM »
Advanced Bridge Modding
             
A Discussion and Supplement to jeronij’s Sim_City_4_Bridges_V1 tutorial
          [attached at the bottom of this post]

Foreword
The intent of this tutorial is to further explain some of the properties described by jeronij in his all-inclusive tutorial illustrating the relationships between the bridge files.  Some understanding of how the bridge exemplar controls bridge construction, and thus the limitations, is relatively important to how the bridge must be BATed…..saving countless hours of experimentation to get the right effect.  I strongly urge anyone trying to learn this craft to first consult jeronij’s bridge tutorials, as they are the basis of learning how to properly construct a bridge.  I will be working from those principles to more accurately define what is possible and how, so I am assuming some knowledge of the basic constraints for bridge modeling. 


Using ilive's Reader.....



Above is an example showing the bridge file for the NAM Undertruss Elevated Rail Bridge, with similar files grouped together for helpful organization.  Every file above is required for the bridge to function correctly with exception to the T21 exemplars (0x6534284A 0x89ac5643 0xNNNNNNNN)….which are used to add props (lights, wake, fences, etc.) to the models. 


Bridge Exemplar File (0x6534284A 0xA82CA30F 0xNNNNNNNN)

The heart and soul of any bridge, and the main container for the properties which govern how the models are assembled.  The rules which govern how the bridge exemplar is used cannot be changed, so I found it very helpful to understand how the exemplar works prior to BATing a bridge.  The final IID should be requested and reserved through the NAM team, as to prevent any conflicts with other bridges.

1-Tile Wide Bridges

Here’s another example of a bridge exemplar for comparison to that illustrated in jeronij’s tutorial.  For a simple 3 piece bridge, there is not much to consider beyond getting the proper rotation for each piece; when considering 4 or more pieces, there are hidden “shortcuts” built into the exemplar itself. 



Section 1 in the pic above shows the 3 properties to control the start/end piece.  The important thing here is simply to ensure the number of Reps in the EndPieceExemplars and EndPieceRotations properties match the number of pieces defined by NumEndPieces property.  Otherwise, there will be missing models. 

Section 2 shows the repeat piece properties.  It appears to be hard coded for all bridges that only 1 repeat piece can be defined on any bridge; as I’ll show later, this is also true for 2-tile wide bridges.

Section 3 is where it gets tricky.  It is not necessary to match the number of exemplar or rotation Reps to the number of pieces like in section 1 above; in most cases, they will be different.  Furthermore, even the NumSupportPieces property is misleading.  What this property actually defines is the number of tiles from (and including) the center piece of the support to the last piece of the support. It is not the actual length (number of tiles) the support piece will be in the game.  Numerically, this would be:

x = (n*2)-1
x = total length (number of tiles) of the support piece in game
n = value for NumSupportPieces property.

The property SupportPieceExemplars thus defines the order in which the support models are constructed, beginning from the center piece of the support and moving outward.  Effectively, you only define half the support piece, and the exemplar rotates all but the first defined exemplar (the center piece) to the other side according to the next property, SupportPieceRotations.  To add even more confusion, the property SupportPieceRotations defines the rotation of every piece, but you must account for the pieces that the are rotated automatically (those not define in SupportPieceExemplars ).  This is the reason there are 3 rotations defined for only 2 exemplars.

Another important property to note is EndPieceSpanLocations.  This seems to be a very problematic property, as even an incorrect setting can completely disable all bridge functionality.  The most import aspect is to match the number of Reps to the number of pieces defined in NumEndPieces

So, what does this mean?  The most annoying result of this automatic rotation is that support pieces with an even number cannot be created without writing a RUL for the bridge.  However, with some careful consideration to the BAT model, this is a very efficient way to reduce the number of ID’s required for any given bridge.  As shown above, the intermediate piece IID 0x38060000 is used as the second start/end piece, as well as the outer 2 support pieces, due to the symmetry of the bridge.

2-Tile Wide Bridges

So what about 2-tile wide bridges?

This is where it gets a bit more difficult, because now we must define the additional pieces for the second tile, using the same set of properties as single tile bridges. 



Here’s one of very few non RULed bridges with more than one start piece.  As defined, this bridge has a start/end piece 3 tiles long.  However, since this is a 2-tile wide network, there are 6 (3x2) 16x16 tiles here that need defined.  Although it is cut off in the pic, you can see that there are 6 Reps for EndPieceExemplars and EndPieceRotation properties, corresponding to every other defined exemplar.  This can be very convoluted to explain, so below is a quick illustration showing how the exemplar assembles the pieces.



For the above exemplar, this figure shows the numerical placement of the models with respect to the roadway of the start/end piece.  Thus, odd number Reps of the EndPiece[Properties] are one side of the bridge, the even are the other side.  Note the number of Reps in EndPieceSpanLocations property… 

Regarding the repeat piece, one major problem with 2-tile wide bridges is that we cannot define a second repeat piece (again, without writing a RUL).  It is, once again, coded to simply rotate the model 180 degrees for the other repeat tile.  While this is fine for any network that has traffic flowing in opposite directions, this creates a small problem if creating a bridge for one-way networks…..i.e., any wide RHW bridges, possibly NWM.  While creative pathing can be used to ensure functionality, the network texture gets rotated and the wrong color lines end up on the wrong side of the bridge.

The support piece follows the same rules as the one tile bridges.  Perhaps a pic is appropriate here to tie this all together. 



Shown here is the Warren Under Truss Avenue bridge where I changed the NumSupportPieces property from 1 to 2.  This shows the actual in-game length one can expect, and should be kept in mind when planning a bridge.  Also shown above is a side effect of changing NumSupportPieces (also NumEndPieces).  However, in order to fix this, we must look at a couple other properties in the bridge exemplar. 



Section 4 is the control for the default maxis pylons.  There must be a depth defined for each additional end/support piece; otherwise, a default of 0 is used….resulting in issues such as the above.  A general rule of thumb would be to match the # of Reps of ColumnTopPosFor[X]Pieces to the # of Reps of the respective Num[X]Pieces to avoid having the Maxis pillars engulf your BATs.  Alternatively, you can set all Reps of the SupportColumnCorners property to 0 in order to remove the Maxis pillars altogether. 

So, that's the nuts and bolts of how the bridge exemplar works.  A large variety of bridge designs are possible using nothing more than the properties discussed above.  Like many aspects of modding in SC4, there are a couple modeling techniques we can use to exploit the rules of the exemplar; i will discuss these at some length a bit later.  The other option of writing a bridge RUL is there for more complex bridges, where the possibilities are literally endless.  Since the structure and syntax was discussed a bit by jeronij, I will not duplicate that here. 

Now, if you remember the first picture shown in this tutorial, there were several other files the make up a bridge.   

The Remaining Files

The other supplementary files are fairly common to anyone familiar with transit modding.  Back to where we started…..



Of note above are 3 file types:
-   Exemplar File 0x6534284a 0x2b79dffb 0x38030000 - model exemplar
-   SC4Path File 0x296678f7 0xa966883f 0x38030000 -transit path
-   Exemplar File 0x6534284a 0x89ac5643  0x38030000 - T21
There is great documentation already available on path files and T21’s, which leaves the model exemplar. 

   The model exemplar is important in the fact that it ties the supplementary files to the bridge exemplar.  The TGI of the model exemplar will dictate the type of network and model ID for each piece of a bridge.  It should be noted that the instance ID (IID) used for all exemplars and paths must have the same IID as each respective BAT model (which should be modeled according to the modeling tutorial (link)).  This lends some importance to the group ID (GID) of the model exemplar. 

Each network has a Group ID (GID) as follows:
[RoadBridgeExemplars]
; 0x2821ED93
[OneWayRoadBridgeExemplars]
; 0xCBE084CB
[DirtRoadBridgeExemplars]
; 0x6BE08658
[StreetBridgeExemplars]
; 0xA92A02EA
[RailBridgeExemplars]
; 0xE8347989
[HighwayBridgeExemplars]
; 0xA8434037
[AvenueBridgeExemplars]
; 0xCB730FAC
[GroundHighwayBridgeExemplars]
; 0xEBE084D1
[lightRailBridgeExemplars]
; 0x2B79DFFB
[MonoRailBridgeExemplars]
; 0xEBE084C2

Our example above shows a model exemplar TGI 0x6534284a 0x2b79dffb 0x38030000, which is indeed the GID (2b79dffb) for an Elevated rail bridge.  Lets have a look at the model exemplar properties….     



Section 5 is the Resource Key Type 1 property that defines the TGI of the BAT model.  Depending on the bridge type, there is some flexibility here.  For bridges based on 3d networks, we can also make use of RKT0 and RKT3 to use existing files already present in the game, as well as many mods available for the NAM.  Maxis El-Rail, monorail, and highways are networks that could make use of this, as well as HSRP.

Section 6 is of note only to say that it is necessary that these properties be present, and the same for each model exemplar.  Otherwise, the height at which the models are displayed can be different for bridge pieces larger than 1 tile. 

Keeping the above in mind when BATing a bridge will allow one to avoid many technical as well as visual problems that may arise.  Coming soon will be some further information about some BAT tricks to exploit these somewhat restricting rules for using the bridge exemplar.
« Last Edit: April 21, 2009, 09:16:32 PM by choco »

Offline jeronij

  • Moderator
  • Forums Guru
  • *
  • Posts: 3496
  • Total likes: 25
  • Reputation: 55
    • Sim City 4 Devotion
  • CL:
    SC4 Sculptor
Re: Some Advanced Modding
« Reply #1 on: April 16, 2009, 04:41:02 PM »
Choco, this is a great advance on bridge modelling  :thumbsup:

I will admit that I didnt went so deep into understandign how everything works. For complex bridges, like TsingMa or Garabit, I tried to make the pieces to be overhanging props, and used invisible exemplars wherever it was possible.This saves alot of time when cutting and joining the pieces, and you dont have to worry about rotations and those ugly words...  ::)  $%Grinno$%  ;) ... just a "dirty" suggestion in case you get into too much trouble with the RHW bridges  :thumbsup:
I am currently not active - Please, contact Tarkus for any site related matter. Thanks for enjoying SC4D :D


Autism Awareness;  A Father Shares
Mallorca My Mayor Diary


Offline choco

  • NAM Team
  • Forums Senator
  • *
  • Posts: 783
  • Total likes: 19
  • Reputation: 10
  • "bridge" engineer...
  • CL: SC4 Bridgemeister
Re: Some Advanced Modding
« Reply #2 on: April 16, 2009, 05:21:01 PM »
thanks jeronij!  definitely needs some better flow, but i wanted to get a start while i have the stuff fresh in my mind.

TsingMa was the bridge i studied when attempting the beta RHW10 bridge.....took a bit to wrap my head around what you were doing there, with a nudge from smoncrie.  i used the idea in a couple bridges i released already.....the first try at the RHW10, and the Monorail Suspension Bridge come to mind.   its actually a nice way of conserving ID's...not that we really need to, but it makes the overall file size a bit smaller and less pieces to BAT.   :thumbsup:

i had definitely intend to talk about ways we can circumvent the exemplar system, but i would like to lay out the rules and limitations first.  This is one trick i'd like to discuss, as well as the 2 different ways to make an arch bridge correctly (RULed and non-RULed).  I've been using overhanging "props" extensively lately, as it eliminates the seam and helps with texturing.....and i need all the help i can get there :P

please feel free to critique though...always appreciate another set of eyes, and this is my first try at a tutorial. 

Offline threestooges

  • Administrator
  • Forums Legend
  • *
  • Posts: 4367
  • Total likes: 9
  • Reputation: 27
  • CL: Bridging the Gap
Re: Some Advanced Modding
« Reply #3 on: April 16, 2009, 07:00:07 PM »
Excellent start here Ryan. It's good to see things start to be described in more detail. I'd love to help now, but time is not something I have as much of as I'd like. As for making a simpler arch bridge (and this may be what you were just talking about with the Tsing Ma... I still haven't run through all the modelled parts for that) would it make sense just to make a skin in essence to center on the support piece as a t21. Though it still might require a rul, it would just need to dictate span length... or perhaps you just make a long enough start/end piece to force a certain length... if any of that makes sense. Anyway, back to the stuff above, it looks great, and I'll try to help as I can here as finals approach.
-Matt

Offline jeronij

  • Moderator
  • Forums Guru
  • *
  • Posts: 3496
  • Total likes: 25
  • Reputation: 55
    • Sim City 4 Devotion
  • CL:
    SC4 Sculptor
Re: Some Advanced Modding
« Reply #4 on: April 17, 2009, 09:37:05 AM »
T21's is also a good possibility to model the bridge, however at the time I modelled and cutted the model I wasnt very familiar with T21s (It was before the street side mod) and I decided to work it my way  ;)

Using only T21s would not be very useful for more complex parts of a bridge, like the start/end, specially for longer than 1x pieces, and it wouldn't save as many ID's as using overhanging props, but for a repeat or a support piece they'd work fine for sure  ()stsfd()

choco, I think making an intensive and extensive advanced tutorial for bridge modelling is a very good idea and the way to go. As you surely have noticed while studying the TS bridge, I am not very strict or methodic when modding...  ::) ... I always look for the easiest way  $%Grinno$%  :D :D
I am currently not active - Please, contact Tarkus for any site related matter. Thanks for enjoying SC4D :D


Autism Awareness;  A Father Shares
Mallorca My Mayor Diary


Offline choco

  • NAM Team
  • Forums Senator
  • *
  • Posts: 783
  • Total likes: 19
  • Reputation: 10
  • "bridge" engineer...
  • CL: SC4 Bridgemeister
Re: Some Advanced Modding
« Reply #5 on: April 17, 2009, 10:23:04 AM »
thanks Matt!  you just worry about your school work man.....RL always takes precedence.

Quote
Using only T21s would not be very useful for more complex parts of a bridge

here, is almost have to disagree.....but only in a specific circumstance. 

if you haven't looked at the Saltash Bridge, build it once in the game (greater than 38 tiles  ;D) and notice the truss'.  entirely made by T21'd props......mainly because the LOD would have become so complex on that bridge that it would have made it almost unusable.  a simple LOD would completely hide any automata and the paths, which i feared would make it undesired in the community.  T21's were the only solution i could come p with...... &mmm  the trick is to not center the bridge props on the grid, but rather leave the offset and simply render them where they should be relative to the piece to attached them.....doesn't require any changes to the LotConfigLotPropertyObject other than the 13th Rep (IID).

just another little tidbit i'll add eventually.   :thumbsup:

Offline choco

  • NAM Team
  • Forums Senator
  • *
  • Posts: 783
  • Total likes: 19
  • Reputation: 10
  • "bridge" engineer...
  • CL: SC4 Bridgemeister
Re: Some Advanced Modding
« Reply #6 on: April 21, 2009, 09:18:58 PM »
should i repost this into the public domain, or should it be moved?


 :)

Offline jeronij

  • Moderator
  • Forums Guru
  • *
  • Posts: 3496
  • Total likes: 25
  • Reputation: 55
    • Sim City 4 Devotion
  • CL:
    SC4 Sculptor
Re: Some Advanced Modding
« Reply #7 on: April 22, 2009, 11:02:46 AM »
Hello Choco, I think it is perfect this way.

About publishing it, I'd say move it, because except the two (three including this one) last posts, the discussion between us is related to the main thread, and it may be useful for the potential SC4D Bridge Engineers  :thumbsup:
I am currently not active - Please, contact Tarkus for any site related matter. Thanks for enjoying SC4D :D


Autism Awareness;  A Father Shares
Mallorca My Mayor Diary


Offline choco

  • NAM Team
  • Forums Senator
  • *
  • Posts: 783
  • Total likes: 19
  • Reputation: 10
  • "bridge" engineer...
  • CL: SC4 Bridgemeister
Re: Some Advanced Modding
« Reply #8 on: April 22, 2009, 03:09:45 PM »
sounds good......

if someone could move this to the appropriate location, it'd be greatly appreciated.  :thumbsup:

Offline threestooges

  • Administrator
  • Forums Legend
  • *
  • Posts: 4367
  • Total likes: 9
  • Reputation: 27
  • CL: Bridging the Gap
Re: Some Advanced Modding
« Reply #9 on: April 22, 2009, 04:40:07 PM »
That should do it.
-Matt