This is my second guide to bridge making.
It will not make any sense to you unless you have already worked through my previous Guide to making a simple 10M bridge available here
A ZIP file is provided in the additional information below that comprises an annotated Microsoft Word document and a template .patch file of an existing 6 piece highway bridge in the game.
The Guide Covers the following:
SECTIONS:
A: LEARNING FROM AN EXISTING COMPLEX BRIDGE ALREADY IN THE GAME
B: A BRIDGE CLASS & LAYOUT FILE EXPLAINED
C: SUGGESTED WORKFLOW FOR DESIGNING A MORE COMPLEX BRIDGE
D: CREATING YOUR CUSTOM BRIDGE BASED UPON THE GOLDEN GATE TEMPLATE
DOWNLOAD THE GUIDE 9MB here
I hope you find it useful in creating more complex bridges.
PJC
How to create a complex (6 piece) Highway Bridge in CitiesXL
Guide by PaulJChris
AUGUST 2013
Required Resources:
Autodesk 3dsmax 2012
Artist Tool Suite
Paint.net (Required to read/write .dds files)
PakUnPak V1.3
Zip File Contents : template .patch file for 45M Highway Golden Gate Bridge (Golden_Gate_45M_Highway_Bridge_template.patch)
Unpack Zip file and uncompress .patch file using PakunPack V1.3 to a local data file before you start.
Skill Level : Advanced
Time Required: Approx 30mins to edit the game files in Notepad
A further several hours to create 6 bridge section models in
3dsmax depending upon your skill/experience level.
It is assumed that you have a reasonable working knowledge of 3dsmax to create your own bridge section models. It is further assumed you have already worked through my earlier tutorial available here: http://xlnation.net/content/how-create-simple-10m-bridge-citiesxl which steps through in detail how to use PakUnPack , how to create your bridge pieces, how to create your interface icon and how to edit the .class and . layout files for your custom bridge. This guide will assume you are familiar with the steps in that tutorial. It is highly recommended that you create a simple arched bridge and successfully import it into the game before you attempt a more complex bridge.
For this guide we are going to use a template based upon the largest bridge in the default game which is the 45M Golden Gate Highway Bridge. I am sure most of you reading this are all too familiar with this model. This guide will give you some reference material to enable you to create a custom bridge of similar proportions. I hope it will also give you enough understanding of the interplay between the various class & layout files to create a custom bridge of any size and complexity.
SECTIONS:
A: LEARNING FROM AN EXISTING COMPLEX BRIDGE ALREADY IN THE GAME
B: A BRIDGE CLASS & LAYOUT FILE EXPLAINED
C: SUGGESTED WORKFLOW FOR DESIGNING A MORE COMPLEX BRIDGE
D: CREATING YOUR CUSTOM BRIDGE BASED UPON THE GOLDEN GATE TEMPLATE
A: LEARNING FROM AN EXISTING COMPLEX BRIDGE ALREADY IN THE GAME
Model Specification:
This bridge uses six 40m long (in 3dsmax) bridge section .sgbin files which are named:
r_br_startgolden_45x40
r_br_deckgolden_45x40
r_br_bigpilegolden01_45x40
r_br_bigpilegolden02_45x40
r_br_bigpilegolden03_45x40
r_br_bigpilegolden04_45x40
Here they are in pictures:
The bridge when placed in the game showing all the models at 1-1 scale displays 13 sections at 40M each in length making a total bridge length for the model of 520M (13x40). If you wish to create a custom bridge that replaces this model exactly and you are building the entire complete bridge in 3dsmax before “chopping” it up in to sections of 40M , then it would make sense to make the model 520M long in 3dsmax. All pieces can be made asymmetrical apart from section 7 (which in the Golden Gate model is r_br bigpilegolden01 shown above) which must be symmetrical as it will straddle the mid point of the bridge . The deck model r_br_deckgolden_45x40 is also symmetrical.
Before going into the details of the files , it is important for any bridge designer to consider how the game engine chooses to deploy these models in the game to create the bridge when the player tries to build bridges of various lengths. The game also employs a scaling factor on the horizontal axis of approximately plus or minus 33% depending the size of bridge demanded by the player. This will have implications for the design of your textures; basically it means you need to check you are happy with how your textures are displayed if they are stretched or compressed horizontally by up to 33%. The vertical scaling is not impacted by the game engine.
Below is a screenshot showing the significantly different ways the game engine displays the bridge dependent upon the length demanded by the player:
1: minimum bridge length 60M not 80M as you might expect with 3dsmax sections of 40M length. This is due to the scaling effect. The game is displaying 2 copies of (r_br_startgolden_45x40) , the 2nd one has been mirrored.
2: At 140M , the game is displaying 4 sections still just using just one 3dsmax model , 2 lots of (1) above repeated end to end.
3: At 180M , the first deck section (r_br_deckgolden_45x40)
is displayed, sandwiched between a copy of (2) above.
4: At 260M, this is the same as above with 3 deck pieces inserted (which is the maximum the class file has specified for this model) displaying at the highest horizontal compression.
5: At 420M, exactly as (4) above with the maximum horizontal stretching . 7 pieces are being displayed. At 1-1 scale the bridge would be 7x40 = 280M in length.
6: At 421M, the model rescales itself to the maximum compression, but now displaying all the pier pieces but no deck pieces. There are 7 pier pieces being displayed , plus 4 at the start and end of the bridge.
7: At 500M , finally all 6 3dsmax models are being used. From top to bottom: 2 start pieces, 1 deck, 7 pier pieces, 1 deck , 2 end pieces. This is at maximum compression.
8: At 520M , the complete bridge model as you would see it in 3dsmax if you modelled the entirety at 1-1 scale. Same number of pieces as (7) above.
B: A BRIDGE CLASS & LAYOUT FILE EXPLAINED
Now lets have a look at the bridge foundation .class file in more detail to understand how the display behaviour noted in the slide above is controlled.
All bridges in CXL are defined in the class file as having a certain number of elements . Each element can be thought of as a 40M section (when the model is displayed in game at 1:1 scale) and is represented by 1 sgbin file. The .layout files tell the game which .sgbin bridge model to display and which orientation to display it with.
Elements are grouped under 5 headings which are : begin, deck, pier, mainpier, end.
All bridges must have a begin , deck , pier and end. Mainpier is discretionary and is mainly used for even larger multispan bridges where the central span is required to be different from the repeating spans either side of it.
The simple arched bridge in the last tutorial was really a bit of a cheat , as we effectively told the game to use the same .sgbin model for all 4 sections .
The most simple bridge should really have 3 .sgbin models for each of the groupings (begin, deck, pier , end). NB “begin” and “end” models are usually (but do not have to be) the same 3dsmax section model but with the orientation reversed. The game always displays the elements in the following strict order:
Begin
Deck
Pier
Deck
End
This means the smallest bridge if you are designing in 3dsmax would be 5 x 40 = 200M.
If there is a mainpier element defined ( for a much larger bridge) the display order would be:
Begin
Deck
Pier
Deck
Mainpier
Deck
Pier
Deck
End.
Each grouping however can have more than one piece assigned to it. Each assigned piece (or sub element if you prefer) in turn can specify which .sgbin should be displayed. In true programming style ,the 1st one is designated 0, then 1 , 2 , 3 etc
Examples begin0, begin1, begin2 etc
Pier0, pier1, pier2, pier3, etc
Mainpier0, mainpier1 etc
End0,end1, end2 etc
Deck is best left as a single element. It should be a model that can be repeated multiple times in a linear fashion and is used primarily to extend the length of bridges and as a “filler” between pier sections.
The game treats all the elements defined under the same grouping as 1 piece and displays them all in numerical order as defined in their name. Begin0 is always displayed first then begin1 followed by begin2 etc
Lets open the foundation class file (rf_goldengate_40x45) Local Path is data/design/buildings/road/foundation :
NB I have deleted some of the less interesting sections in the following shot to better show the 2 most relevant closer together. Please do not do the same to your .class file!
If you open some of the layout files defined in the above section, you will see some of them have a "revert" tag inserted.
This is the code to insert if you want the piece to be mirrored (facing the opposite direction). This is an important timesaver in development and also improves game performance by halving the number of sgbins and textures required. In the line above revert , you can see the line which tells the game which .sgbin file to display for this element.
So following the logic of the display order explained above, the Golden Gate bridge will be displayed by the game engine from left to right:
Begin0, begin1,deck,pier0, pier1,pier2,pier3,pier4,pier5,pier6,deck,end0,end1
Have a another look at the model slide below, this time with the top heading showing which model is associated with which element of the bridge:
That’s should be enough info for you to be able to create the models you desire for your custom bridge.
However I guess more ambitious of you reading this don’t really just want to overwrite the Golden Bridge Model with 6 replacement .sgbins . If this is all you wish to do then you can skip the next section and move straight onto to section D: Creating your custom Bridge based upon the Golden gate template at the end of the document.
C: SUGGESTED WORKFLOW FOR CREATING A MORE COMPLEX BRIDGE:
1/ Obtain the dimensions (total length and width of the deck) of the real world bridge that you wish to model in metres.
2/ In an absolutely perfect world , this would be an odd number multiple of 40M. You would be very lucky if your real world bridge complied with this. Consider adapting the length of your proposed model to the nearest odd number multiple of 40 in metres. The reason for this is that if your bridge has a central arch as most do, the sgbin model that represents the middle section will straddle the midpoint and must be made as a symmetrical piece exactly like the 10M model used in the first tutorial. This will only happen if your bridge is made with an odd number of 40M sections. All the other sections can be made asymmetrically with the exception of the model used for the deck.
3/Once you have decided how many 40M sections will be in your bridge , you next need to think about which type of grouping (begin, deck, pier, mainpier, end) to allocate for each section to using sub elements (begin0, begin1, begin2) if necessary.
EDIT: I have noticed an unfortunate typo in the above slide - the pier pieces should be named pier0, pier1, pier2, pier3, pier4 . The Mid point section8 should be pier2 . Sorry for any confusion.
Once you have finalized the design, create a foundation .class file for your bridge. It’s a useful reminder of your design blueprint. Remember to count up the total number of elements you have specified in your <elements> section and make sure there are exactly the same number of layout files references created in the <layouts> section of your .class file. You obviously need to create the actual layout files for any extra elements, remember in the .class file you are basically telling the engine where to look for the layout files, you still need to create the actual layout files yourself if your custom bridge has more elements than the template you are using. Equally if you decide to make a much smaller bridge that has say 7 elements (the golden gate template has 12 elements remember), then you will need to delete 5 of the layout file references and their corresponding layout files from your data folder before compiling your .patch file.
4/ Work out the smallest number of 3d sgbin files you need to create to make your bridge a reality. Hint the answer is not 15.
Take maximum advantage of the revert facility to minimise the number of models you need to create.
The answer of course is 5 (this assumes begin0, begin1, end0 and end1 will use the same model). If you want the 2 start pieces to be distinct from each other (not mirrored like the Golden Gate example) then the answer would be 6 sgbins to create this layout.
5/With a clear design blueprint now having been established, only now open 3dsmax for the first time and start work on creating the pieces that your design has specified.
D: CREATING YOUR CUSTOM BRIDGE BASED UPON THE GOLDEN GATE TEMPLATE
I have isolated all the Golden Gate Bridge 45M Highway bridge files and put them in a .patch file for you to unpack and use as a template for your custom bridge.
To create your custom bridge based upon this template you must do the following:
1/Create 6 new section models in 3dsmax for your custom bridge to the spec shown in the first tutorial. Save them over the originals in the first instance, then rename them consistently with your other files.
2/Create a new menu icon as per the 1st tutorial. Save it over the original then rename it consistently with your other files.
3/Rename and edit all the class/layout files to make them unique from the originals as shown in the first tutorial. They will all be in the same places as the first tutorial , just with the original filenames. Decide on a naming convention and stick to it consistently throughout the editing/renaming process. The filenames can really be anything that makes sense to you, provided they do not duplicate any existing game filenames or clash with custom bridges made by others. Be creative and use the Notepad Find/Replace tool for optimum speed and accuracy.
4/Don’t forget to amend the tags file of your local installation of the game [STEP 17 in the 1st tutorial] to include your custom tag. If you forget this step the game will crash on start-up reporting a missing tag error.
5/Use PakUnPak to create a .patch file for testing in the game.
Happy Bridge Building!
To those of you who made it this far, well done! I hope you find this document a useful reference to creating your own custom complex bridge.
PJC
-
If you are going to register on XLNation, please make sure you do not use a proxy server.Dismiss Notice
If you use a proxy server your registration will most likely get blocked due to spammers and hackers using proxy servers to hide their real IP address.
If your using your home or work IP address and have not received your registration email, check your spam folder.
PLEASE DO NOT ASK TO HAVE YOUR ACCOUNT DELETED IF YOU HAVE POSTED IN THE FORUM! If so we do not delete accounts due to the mess it can make on the forum.Please see the following thread for more information
XLN's future is looking kind of grimTutorial How to Create a Complex (6piece) Bridge in CitiesXL
A Guide to creating a complex bridge with multiple pieces
Recent Reviews