Sign in to follow this  
Taildragger

Library bridge problem

Recommended Posts

I'm trying to create a bridge using multiple GUID objects from the library. Problem is of course piecing them together to properly align and form a seamless bridge. Even with an FS9-linked scenery placer like Runway 12 this is a tedious trial-and-error process.I realize it would be easier to make a VTP line bridge, but the style selection is limited and simplistic. The real bridge is a truss design, very similar to the library gen_bridge01.In the thread below Arno posted a clever API macro that automates stitching together a desired number of GUID segments.http://forums.avsim.net/dcboard.php?az=sho...13851&mode=fullBut that thread is nearly two years old, and I keep reading in the forums that we should be getting away from using APIs. So does anyone know of a similar method for building a multi-segment GUID bridge in xml?John

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hi John,That FreeSC API was indeed an experiment I did a long time ago.In the XML code you could try to use the Bias option to move the brdige a certain amount of meters. In that case you only need to know the length of one library segment. You don't have to set the lat/lon of each object in that case.

Share this post


Link to post
Share on other sites

Arno, I'd think that would make creating bridges easy if they are aligned horizontally or vertically but what if they're not? Seems like aligning multiple segments would be a huge problem there. Do you or anyone else know a good source of basic GMAX bridge objects that are available that one could easily alter the dimensions of? What objects does FS use for their bridges? Do they include generic bridges or are they all individually defined?Art Martin

Share this post


Link to post
Share on other sites

Hi Art,I would have to check it, but I think it would be logical that all objects that you place inside the SceneryObject with the Bias commands take the heading of the SceneryObject they are in. But as I said, I have not tested it :). So then the heading should not be a problem.Apart from specific bridges, like the Golden Gate bridge, most default bridges are placed as VTP line. In the terrain.cfg file you can find the library objects that are used to form these bridges. There is one object for a normal segment (with a certain length) and another object that has the ramp for the ends of the bridge. The scenery engine combines these objects to get a bridge of the required length.

Share this post


Link to post
Share on other sites

Hi Arno,Thanks -- that's a good idea. Now how do you find the length of a library segment? I don't see anything in the SDK documentation. Is it possibly buried in the GUID numbers?Also, once the segments have been pieced together, can the whole bridge be converted into a single custom object that could then be moved and aligned to the right heading as a unit?John

Share this post


Link to post
Share on other sites

Hi John,I am afraid you will still have to find the length by trial and error (that is also how I did it with that API I worked on some time ago). I don't think it is listed anywhere.I think if you collect all the Bias/LibraryObject commands in one SceneryObject command, you should be able to move and rotate it by changing the properties of the SceneryObject command. But that is something that I have not yet tested. To place it in another location you would need to copy the XML copy.

Share this post


Link to post
Share on other sites

I did take another look into this issue and it is not as hard as I wrote before :).If you look in the terrain.cfg file, you will see that the length of the different segments is also listed there. So that makes our life easier.Here is a little example of XML code to place three segments next to each other:[tt][/tt]Unfortunately rotating does not really work :(. You would have to calculate the correct BiasXYZ with the rotation, as setting the heading does not rotate the BiasXYZ command with it.Maybe it is time for another little tool to do the calcuations for you :).

Share this post


Link to post
Share on other sites

Ah, fantastic! That greatly simplifies things. Much obliged for the help, Arno.Rotation then is the only problem. Sure would be nice if the whole collection could be compiled into a single object.John

Share this post


Link to post
Share on other sites

Oops -- I'm getting compilation errors.-----------------------------------------------------Parsing document: BridgeTestArno1.xmlERROR C2033: XML Parse Error (line, column, error)ERROR: 21, 13, Element content is invalid according to the DTD/Schema.Expecting: LibraryObject, Effect, Trigger, Windsock, AttachedObject, GenericBuilding.ERROR: Schema errors detected, compilation failed!------------------------------------------------------The FS2004BGLCompSDK.doc has this on page 9:"Note: unlike previous versions of BGL there is only one object allowed per placement."Does this mean both a BiasXYZ and a LibraryObject cannot be included in the same SceneryObject?Sure enough, when I remove the BiasXYZ code, the compilation works.John

Share this post


Link to post
Share on other sites

Hi John,Yes, each combination of BiasXYZ and LibraryObject must be in its own SceneryObject command (like I did in my example code).When you try to put more in one SceneryObject command you get an error.

Share this post


Link to post
Share on other sites

I'd did exactly this by using sbuilder. Luis' program allows you to define a "footprint" for the object at a given scale. This gives you WYSIWYG GUI functionality, allowing you to cut and paste iterations of the bridge segments until you've made the bridge you like...you can then make curves and such as you'd like. Of course, it's still manual, but it works very well.Here's the 7 mile bridge I created for our upcoming FREEflow Ultimate Florida scenery:The project in SBuilder aligned to a satellite photo (the little yellow squares are actually unresolved in this screen shot - they match the size of each segment of the bridge exactly, allowing a tiny bit of overlap with each segment):http://cobweb.dartmouth.edu/~gridlock/NewSevenMile-SB.jpgAnd the bridge in the sim (gotta get a daylight shot, sorry!):http://cobweb.dartmouth.edu/~gridlock/NewSevenMile-FS9.jpgHope that helps...sg

Share this post


Link to post
Share on other sites

Man that seems like a ton of work. Sure seems easier to create a basic bridge object, stretch it to the desired length in GMAX, and export it back out. Then you're working with a single object which can be rotated, raised up and down, scaled, etc. Of course my GMAX experience consists of opening the program, loading in one of the sample objects, rotating it a bit, and closing the program so I may be way over my head here. FS does have some really cool bridge segments and I've built one bridge by hand with them but it was EW aligned and if I overlapped a tiny bit it didn't matter. It all flowed into one long shape. However, I found that in real life the bridge was slightly off of pure EW and trying to angle and offset all the objects was a royal pain. Your solution above is truly doable but I'm the eternal lazy programmer. If I can do something once and reuse it over and over I go for that every time.Art Martin

Share this post


Link to post
Share on other sites

That was just the end point of that saga, too! ;)You know - learn as you go...I first decompiled bridges.bgl to xml using NewBglAnalyze, then used SceneGenX to search the xml for the GUID of the default FS9.1 object for the seven mile bridge, then move it. But, in the end, it turned out that the object had it's bends in the wrong places, and I just wasn't satisfied with the aligment with the very accurate land.Once I found the footprint thing in SBuilder, and found that you could select a couple of objects, and cut and paste them, it took me an hour or two to build the two bridges above. Figuring out GMAX would have taken MUCH longer!Best,sg

Share this post


Link to post
Share on other sites

Hi Arno,Sorry, I did not explain that well. The compiler (bglcomp.exe from the 2004SDK) gives the error I reported above unless the BiasXYZ statements are removed from EACH of your three SceneryObjects.The complete (uncompilable) xml is attached. I pasted your sample code directly into the headers. Removing the three Bias lines allows it to compile.The explanation in the SDK.doc seems a bit confusing:----------------"The object types (and sub-elements) allowed within a SceneryObject are as follows:BiasXYZEffectGenericBuildingLibraryObjectModelDataTriggerWindsockNote: unlike previous versions of BGL there is only one object allowed per placement."-------------------So is a "placement" the same as a single SceneryObject element? If so, it would indicate that each SceneryObject can have either a BiasXYZ or a LibraryObject, but not both.Am I interpreting it wrong?John

Share this post


Link to post
Share on other sites

Hi John,The code I posted here compiles fine on my PC. So could it be that we are using different versions of BGLComp or so? I am using the one from the latest BGLComp SDK from MS.

Share this post


Link to post
Share on other sites

Hi Scott,Well, that sounds like an improvement over what I was doing. Thanks -- will check it out.John

Share this post


Link to post
Share on other sites

Aha -- that's it. MS has a version 2 of the SDK on their website.Many thanks, Arno. And if you ever feel the urge to create the tool you mention in #5 above, I'm sure it would find a number of grateful users.John

Share this post


Link to post
Share on other sites

Appears that many users are using an afterthought feature I added into my Autogen Creation program I've had out in Beta testing that has the potential for doing exactly what we're looking for. I originally only had the ability to put in single GUI class objects as the Annotator program allowed. FS would then put in one of the objects in that class on the scenery as autogen at the chosen location. Emails came in then telling me that one could create a custom GUI class in the Default.xml file with a single object in them and thus be in much more control over object placement. Since I had a multiple house generation tool in the program they suggested I do a similar tool for those custom GUI class objects. The tool I created took advantage of the code I'd written for freehand defining of a curving line on the image, letting go of the mouse, and going back and clicking the mouse a desired distance away from the initial point of the defined line to set the spacing between the objects. It seems to work rather well as long as one doesn't need exact placement of the objects and doesn't care about the direction the object is facing. To simplify the coding I just made all the objects align vertically/horizontally. Now the requests are coming in for the user to be able to input exactly the distance between those objects and to be able to control the angle alignment. Seems a reasonable request. Will be tough with the freehand tool though since the user could create quite a complex shape. I think I'll add the functionality instead on a straight line tool for the first step. The user would define a line by setting a point and stretching out the line. After releasing the mouse button, they'd press the button once more on one side of the line or the other to define which direction off of the line the objects should extrude to. An input box would allow them to decide the spacing between the multiple objects. I don't know if the units for that spacing should be lat/long degrees, pixels across the image, or some other distance measurement like meters or feet. This is where the calculations get dicey for a program like mine. I don't truly calculate any lat/long coordinates or actual distances when placing objects but instead only use the grid reference the .agn file dictates - a 1 X 1 grid from -.5 to +.5. Those relative coordinates can change greatly in how they're represented in FS from a northern latitude scenery tile location to one at the equator. So let's say a user wants to put in a bridge using the preexisting bridge segments included with FS. They'd have to know the basic length of the segment they wanted to use and create a custom GUI class of that segment. Scaling isn't a parameter in the autogen files so you'd have to be satisfied with size of the object as created. In my program you'd input the distance apart you want the segments to be. You'd then draw a line where you wanted the bridge and mouse click on the side of the line you wanted the boxes representing the objects to be drawn out to. The program would create the objects along that line angled at the same amount as the line, spaced apart by the user-desired amount. Now here's another question. Do we assume we want the front face of the object to be where the line was drawn? What if we're putting in a string of telephone poles instead? Maybe they need to be rotated 90 degrees then. Guess I'd need to give the user a box to input amount of rotation from the original angle. The plot thickens.The real bummer to all this though is that you can't see what you just created without going through the lengthy startup of FS each time you make a change. Anyway, it's an intriguing challenge and autogen might not even be the best place to try to do this. By the way, I've given up using Avsim to host my new program and have been graciously been given my own forums on both Scenerydesign.org at:http://www.scenerydesign.org/forum/forumdisplay.php?f=56">and at the VFR Autogen site at:http://www.vfrautogen.co.uk/forums/index.php?c=4&sid=214a8eefb4b46c349338102b2a78b100">The latest version of beta program itself can be be found at the following link:http://www.vfrautogen.co.uk/artseditor_view.php">Please don't download this program unless you understand the risks and responsibilities of using a beta program and in no way should you ever contact Avsim or any of the hosts of the forums for program support. Thanks again to Avsim for helping me get this ball rolling.Art Martin

Share this post


Link to post
Share on other sites

Hi Art,That sounds very interesting. To be able to precisely control placement, separation, and angle of multiple library objects is exactly what is missing today.In the case of bridges, the desired separation between objects would be zero.Rotation would be important. The end segments with ramps of course need to differ by 180 deg.The WYSIWYG problem may not be critical. With today's techniques, we still have to start the sim to see the final results.As far as whether autogen is the best method, I'm not knowledgable enough on the pros and cons to comment.Good luck! I will check in from time to time on your progress at the other site.John

Share this post


Link to post
Share on other sites

The attached file is a spreadsheet that will create an FS2004 XML library bridge of any desired style, location, length, and orientation.User selects a style from the available library objects, specifies the desired end-point coordinates, and the scale factor. From that, a VBA macro "writes" the xml code to piece together the required number of individual bridge segments. This is based on the offset method suggested by Arno in reply #6 above.It seemed possible only to post this as a text file, so it will be gibberish. Just name and save it as *.xls and any version of Excel, 2000 or later should open it. From there, see the ReadMe worksheet for help.I have visually verified that the bridges come out right in all four earth hemispheres, so hopefully the math is OK. Still, this is a work in progress, so comments, bug reports and suggestions are most welcome -- here, or by E-mail in my user profile.John

Share this post


Link to post
Share on other sites

That's a fabulous utility, John - THANKS! Can't wait to try it out.I need someone who has a good working knowledge of VBscripting for Excel to help with a little AFCAD and object placement project- if you're interested, drop me a line please.Thanks again!sg

Share this post


Link to post
Share on other sites

Scott, my knowledge of VBA is very amateurish -- mostly learned during this project.But will contact you to see what you have in mind. If I feel qualified to tackle the job, I would be most happy to help out.John

Share this post


Link to post
Share on other sites

Great tool. Thanks for your contribution. I've been trying to do something similar in VB code but with a graphical and FS-interactive user interface although a concerted effort learning GMAX has taken away my development time lately. As I learn GMAX and see how really quickly one could create a custom bridge, I'm beginning to wonder the wisdom of using these built-in generic bridge segments. I've done some experimenting and, even though the bridges do get created where I want them, I find them less than satisfying. So many of the segments have lightpoles on every segment and when you string 15 or 20 of them together to form a long span, you get way too many lights for realism. It's really hard to not see the join point between the segments especially if you have to rotate off of NS/EW. The ramps on the ends end up too steep or too shallow to match the contour of the land. Often the width of the segment doesn't match the number of lanes of the road going over the bridge. If the bridge turns in the middle of the span, it's extremely hard to line the segments up right.Bottom line is that I think I'm going to get away from using the generic bridge segments, bite the bullet, and simply create my own GMAX bridges. Once I have a few models made I can simply alter their length, width, height, and textures and have a much more finished product. Now of course you have to realize that bridges here in the SW rarely are suspension or RR type where one has to model cables and girders. Most of the bridges I'm going to build are simply elevated roadways so I think you can see where my head's at.Thanks again,Art Martin

Share this post


Link to post
Share on other sites

Hi Art,Your points are well taken. Many of the flat library bridges are not realistic.My problem is I have need for more complex structures -- trusses especially, and even a few covered wooden styles. For these I find GMax frustrating (too impatient I guess).As far as resizing to fit the road, that can usually be done by adjusting the scale factor, as long as it's not so extreme as to mess up the overall bridge proportion.Will be interested to see what you come up with. GMax designs that could be easily scaled to fit the need would be extremely useful.John

Share this post


Link to post
Share on other sites

One gotcha I forgot to mention in the readme.This method works only for bridges spanning flat terrain. If you try to cross a canyon, the end ramps will be OK on the rim, but the center segments will be collapsed into the abyss (see attached shot).The problem is that each segment has the same altitude above the underlying ground or water. Thus the bridge follows the terrain contour -- not very satisfying.To fix this would require knowing the digital elevation profile of the surface directly below the intended bridge, and making that data available to the macro during the xml file creation. Each span segment could then be given the correct altitude adjustment to keep the deck level.At this point I am clueless how to proceed. Perhaps some of the mesh gurus out there have ideas?John

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this