Jump to content
Sign in to follow this  
Guest christian

TMF-BGLC Design Tutorial V1

Recommended Posts

Guest

Thanks Dick,Though I have just downloaded it and have not read it, I am sure it will be an education.cheers,George B.

Share this post


Link to post
Share on other sites
Guest

Thanks a MILLION! Well written, and a first sense of insight for me into BGLC. I never realized how much of the code is "rote" and how to tell a macro from a label. Now it makes better sense ... some of the comments folks have made about this being a macro language....course next we'll be learning how to write macros!Question, when you see a label, such as data_end_2 label wordI always see label and word seperated by spaces.. is this important? is blank space ignored as in scasm? You seem to maintain a common spacing...is that due to cut and paste or intentional? Do you know why the word "word" is there? (so many questions, so little time).I see few references to the labels, once in the first example, but header labels weren't "called"...so that's different from scasm. There is built in expectation for those labels in the compiler?Thanks again, you may have unleashed a pandora!BTW, the decals...with transparency, this may be more useful than tiles, although you allude to hassles covering large area and I'm only on my second reading of your paper.. Even thou I hate to pressure you for Chapter 2 (decals), I'd love an example.Bob Bernstein

Share this post


Link to post
Share on other sites
Guest christian

>I always see label and word seperated by spaces.. is this >important? is blank space ignored as in scasm? You seem to >maintain a common spacing...is that due to cut and paste or >intentional? Do you know why the word "word" is there? (so >many questions, so little time). Yes, you need 'whitespaces' in between (spaces or tabs).DW means word, and this means 2 bytes basically. I dunno why this is needed for the labels because some labels are actually DD (dword, 4 bytes). Maybe this is a mistake, maybe it really should be:xxxx label dwordI got this from the object sections where labels mostly are indeed just DW, but in the TMF section they are DD, so maybe this needs to be fixed! This will only be relevant for really large files though...Hmm, thinking about it it probably should be dword!!!Cheers, Christian

Share this post


Link to post
Share on other sites

Excellent work! I've been reading it this afternoon, and after only about an hour of absorbing it, I was able to make a lake with no problem in the scenery file I'm working on. The only problem now is that I've got a thirst for TMF decals! I'm digging through some of your recent posts on things like Decals, CFS2-style roads, etc. Armed with my new knowledge of the BGLC structure, I feel I might better be able to figure this stuff out!thanks a million!Bill Womack


Bill Womack

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

Visit my FS Blog or follow me on Twitter (username: bwomack).

Intel i7-950 OC to 4GHz | 6GB DDR3 RAM | Nvidia GTX460 1gb | 2x 120GB SSDs | Windows 7 Ultimate 64Bit

Share this post


Link to post
Share on other sites

Hi Bob.I hope Christian answered your question about the labels... I don't think word or dword matters as it is just a place marker for the code immediately following the label.There are 2 approaches to making TMF decal polys. Both are mesh-clinging. First, there is the FS2002 decal poly. This decal actually replaces ground textures... sort of a landclass replacement... but you define the shape. Autogen works with this method... and is specific to this poly's area!Second, there is a CFS2-style line segment. I found I could import CFS2 lines into FS2002. Then I found the structure of these lines was much different than FS2002's lines. Then I discovered CFS2's lines are actually tiny polygons, that usually use a texture with a transparent background. Then I discovered I could make this polygon as large as an entire LOD13 area. I have not tested Autogen or seasons, but I believe a seasonal texture set will work... not so sure about Autogen.Here's the post: "TMF Decal polys in CFS2 and FS2002"]There are some things to note:dd 0 ; flatten polygon headerdd decal_header - terrain_data ; decal headerDECAL_HEADER 256, decal_list, decal_textures, decal_endCFS2LINE_RIB 0, 0, 0, 0CFS2LINE_RIB 255, 0, 255, 0CFS2LINE_RIB 0, 255, 0, 255CFS2LINE_RIB 255, 255, 255, 255The first 2 numbers of the CFS2LINE_RIB structure define the x,y start point of a rib, and these are paired with the first 2 points of the next line, that define the endpoint of that rib.The other points of the line, are the x,y points of the texture stretched onto those rib points. You can stretch all or part of the texture onto the rib. Shorelines, for example, use only a segment of the bitmap, for each line segment. The mapping of the ribpoints is 1,1 in the northwest to 255, 255 in the southeast. ( a zero is treated as a 1 in the sim, as far as I can tell ). The mapping of the texture is different... 0,0 in the southwest to 255,255 in the northeast ( I think ). This seems familiar, and may also be that way for traditional ground poly textures. It seems awkward but that's how M$ did it. In truth, they never intended CFS2-style line segments to be used this way, or to be used in FS2002, at all!I don't know if these polys can be excluded, but there is a way to increase the visual 'priority' of the poly, by increasing the 'type' number:DECAL_GEOMETRY 1, 7[/b, 1, 0The example in the post is on Oahu.The other part of code to watch is:CFS2TEXTURE_DATA "Smiley.bmp", 0This is a way to use CFS2-style texture calling with the decal. Obviously, the custom texture used needs to be in a scenery's "Texture" twin sub-folder, or in 'C:Program FilesMicrosoft GamesFS2002SCENEDBWORLDTexture' or in the main 'C:Program FilesMicrosoft GamesFS2002TEXTURE' folder.I honestly have forgotten how the poly behaves on water in FS2002... I think it's properties become land ( not sure ). You'd have to place one on water and see how it works... also the priority will need to be 8 or greater ( I think ).Dick

Share this post


Link to post
Share on other sites
Guest cwright

Dick, thank you very much! I'm just starting to digest it, but it's already made some things much clearer. I'm particularly interested in the last example, as it shows how to combine multiple LOD13 areas. I think very soon I'll have a proper coastline for my scenery, something I've been waiting for since CFS2 came out.... Once I understand it properly I'll probably write a Visual Basic program to automate the process. Great stuff! Best regards, Chris

Share this post


Link to post
Share on other sites

Hi Chris. A VB program would be great, whether it takes in visual data ( like a bitmap ) or a set of Lat-Long points ( my preference ).A clue as to the future...We all need to get accustomed to the idea of calling macros, and we need to understand the macros we use now will change over the next few months, as better ways of doing things emerge, and new knowledge is acquired.Christian Stock is still quite active investigating the decal structures. His original macro will be altered significantly within a few weeks, as he nears a more complete understanding of the default MS file structures. ( That's why I labeled the tutorial 'v1'... I'm going to have to update it ).My approach has been different than Christian's. I don't care so much what MS has done, as I want to push this knowledge to see what it will be able to do. That's why I am mixing CFS2 code with FS2002. Microsoft has never placed a transparent mesh-clinging polygon in FS2002. MS has never seriously manipulated visual priorities of the TMFs. MS has never used a FS2002 TMF polygon for anything other than an airport background, even though it can alter the default landclass ( and Autogen ) to detail the world incredibly. Or use FS2002 flatten code to shape small hills and valleys.So make your VB code flexible enough to alter as new macros arrive. And be sure to label the versions! ( You'll probably need to include copies of the macros with your program to insure compatability for each version ). And be sure to contact Christian for his OK to use his macro code in published programs ( he'll just want a personal copy of the program ). If you can't find Christian, contact me and I'll help find him.Dick

Share this post


Link to post
Share on other sites
Guest GerrishGray

Congratulations, Dick, on your excellent tutorial. Now we can reap some exciting fruit from the wonderful research work you, Christian and other colleagues have done, and are continuing to do, on this topic. And thank you to Christian too for the TMF macros etc.Let's hope it's not too long before someone writes a GUI tool based on this knowledge, so that the files can be created relatively quickly and easily.SCASM versionPlease bear with me too if I observe that it really would be quite easy for Manfred to update SCASM to provide higher-level facilities for creating this type of data. It seems to me that the only aspect of SCASM that prevents it being done at the moment with some suitable SCASM macros is the restricted facilities for writing the BGL header, with no provision for 'section 8', terrain mesh. But better still if Manfred can be persuaded not only to update SCASM to encompass 'section 8' terrain mesh data blocks but also to provide new commands for the various terrain header blocks and data structures ...But maybe this isn't really too important, because very few people seem to code directly in SCASM these days anyway. Even most creators of API's seem to use a GUI tool such as FSDS, EOD, Nova etc.BGLC label syntaxTo answer Bob's question about labels, 'xxxx label word' indicates that the label is of type 'word' and is therefore aligned on a word (16-bit) boundary - it is not directly related to the use of 16-bit (near) or 32-bit (far) addresses.BGLC macrosTo get into writing BGLC macros of our own, the first step is to learn a little about the MASM/BGLC language - but this really isn't too difficult. There are only a limited number of aspects of MASM programming that one needs to understand, and studying the various .inc include files associated with BGLC will help ...CheersGerrish

Share this post


Link to post
Share on other sites
Guest

It's a word document, and I don't have the graphic converters.HTML or PDF please! Thanks!

Share this post


Link to post
Share on other sites

Hi Gerrish.I wish Manfred would update SCASM for TMF design. I don't see any reason why he couldn't... and he has some subroutines that would make header bounds and locations easier to program.I've resisted writing my own macro versions, for TMF types Christian has already defined, in order to avoid total chaos, where 20 people have 20 different macros! By yielding to Christian, some order is maintained, and we'll all be using the same terms in forums.I'm hoping Christian will release a new 'certified' TMFMacros.inc ( perhaps with a version # ), because he, Leland Steffensen, and I have all discovered new things since the original macros were written. Also, I'd like him to incorporate the CFS2 macros, as they can be used to our advantage in FS2002.Airport for Windows is undergoing changes towards a BGLC format ( I presume to eliminate their dependance on SCASM ). This may be a good place for a TMF GUI to find a home. Lee Steffensen has also been working on an interface that will create the BGL without needing to use BGLC coding. I don't know if he'll have a frontend for BGLC.exe or if he'll bypass it, and produce the BGL directly.Christian is still toying with a BGL2ASM decompiler, part of which deals with TMF BGLs. That would be tremendous, as we'd be able to study BGLC assembly coding.Arno Gerretsen has said the Netherlands 2000 team is working on a tool to place TMF decals/lines.And I'll start grinding away at Part2 of the tutorial, where I'll really make a mess of things. I'll probably start ranting about localized textures and Autogen, again. :-eek Hopefully I won't mislead anyone.:)Dick

Share this post


Link to post
Share on other sites
Guest cwright

Dick, I think the new SDK's will make your tutorials even more important, as many folks don't speak C++ and it should be quite easy to convert the C++ structures to ASM. Hopefully quite soon an ASM example to create an island with beaches and waves etc should be fairly easy. Based on your first tutorial, I wouldn't be surprised if your SDK's are considerably more useful (and certainly more understandable for a lot of people!) than the Microsoft SDK's! Yesterday I wrote a VB routine that converts lat/long coords to the required LOD8/LOD13 box numbers and the coordinates within the LOD13 box. It appears to work and I can place the lake anywhere I please without any tedious manual calculations. My target is to automatically create an ASM file from a list of lat/long coords. It will need a bit of thought, as the program must analyse the coords and assign the box numbers as needed etc When that works the next step will be the ability to read coastline data from a hand-drawn .raw image. This is essential for my scenery, as I haven't been able to find any coastline data for the Karakam peninsula (!) I would also look at having the program add extra points, using either random or fractal techniques. This would be particularly useful when the input data is low-resolution, as it would create a far more natural effect while remaining faithful to the input data. In FS2002 coastlines often look unnatural, not necessarily because the data is wrong but because the resolution is too low, for obvious reasons. I'm certainly not a professional programmer and I'm sure that in time there'll be far more professional tools available. I'm doing this because it's fun. But if I do manage to come up with a working program I'll be more than happy to share the source code with anyone who's interested (I can't distribute the .exe as I don't have a compiler with VB5). Best regards, Chris

Share this post


Link to post
Share on other sites
Guest christian

Hi Chris,Lee, George, and myself are programming away. Although I haven't heard from Lee or George in a while. I left my code alone for a while because I have some computer problems, and I got sidetracked with placing gmax objects on a large scale using geographical information. My tools will work with ArcGIS 8.1, I started doing VTP polygons, but then went to gmax objects, since that's easier.I think we really should share source code. I think calulation the LOD13 / LOD8 points must have been programmed at least 4 times (George, Lee, me and now you) without sharing source code which is stupid really. I want to program something to split the polygons soon, but will have to sort my computer problems and the gmax placing out first... BTW I'm coding in C++, not VB, but the algorithms will be the same...Let's stay in contact.Cheers, Christian

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...