Sign in to follow this  
rhumbaflappy

FS2002 Shorelines

Recommended Posts

Hi all.I've made some progress with FS2002-style shorelines. There's still some I need to discover, but the good news is: there are waves!By themselves, there are no waves for shorelines, but when I laid down a decal... waves magically appear. So as in real life, you need land to make a wave. :-lol

Share this post


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

Here's the BGLC code I used:

[b]include TMFmacros.incinclude CFS2TMFmacros.incinclude TMFLinemacros.inc; FS2002 ShorelineTest; ===================================================================; DATA_BASEdata_base	label	word	dw	1			; world set number	dd	LAT32_N17:00:00.00	; North Bound	dd	LAT32_N15:00:00.00	; South Bound	dd	LON32_W168:00:00.00	; East Bound	dd	LON32_W170:00:00.00	; West Bound	dd	0			; VOR data	dw	0			; lowest VOR freq	dw	0			; highest VOR freq	dd	0			; seeds level 8 data	dd	0			; seeds level 9 data	dd	0			; seeds level 10 data	dd	0			; seeds level 11 data	dd	0			; seeds level 12 data	dd	0			; traffic data	dd	0			; minimum safe altitude data	dd	terrain_data - data_base; terrain mesh data	dd	0			; object data	dd	0			; library data	dd	0			; facilities data	dd	0			; anchor point data	dd	0			; ATIS data	dd	0			; NDB data	dd	0			; dynamic object paths data	dd	0h,0h			; minimum library id	dd	0h,0h			; maximum library id	dd	0			; miscellaneous data	dd	0			; title and description data	dd	0			; magnetic variation data	dd	0			; exception and exclusion data	dd	87654321h		; magic number	dd	0			; compression switch	dw	0			; spare	dd	0h,0h,0h,0h		; GUID	dd	0			; product id	dd	0			; product build number	dd	0			; new facility data pointers	dd	0			; new facility name list data	dd	0			; new facility band list data	dd	0			; new facility data; ===================================================================; TERRAIN_DATAterrain_data	label	word	dd	terrain_header_end - terrain_data; end of terrain header	dd	514				; version	dd	0				; unknown entry	dd	0				; unknown entry	dd	0				; elevation header	dd	0				; land class header	dd	0				; unknown header	dd	0				; class lookup header	dd	0				; season header	dd	0				; class lookup list	dd	0				; water class header	dd	0				; elevation index	dd	0				; land cover index	dd	0				; unknown index	dd	0				; flatten polygon header	dd	decal_header - terrain_data	; decal header	dd	0				; reserved	dd	0				; reserved	dd	0				; main terrain data	dd	0				; reserved	dd	0				; reserved	dd	0				; reserved	dd	0				; regions header	dd	0				; reserved	dd	0				; reservedterrain_header_end	label	word; ===================================================================; DECAL_HEADERdecal_header	label	word	DECAL_HEADER 256, decal_list, decal_textures, decal_end; DECAL_DATAdecal_data	label	word; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	data_start_0	label	word		DECAL_DATA 1, 5, 2, 10, 1, 0, 0		DECAL_GEOMETRY 1, 9, 1, 0; 1st line ---------------------------------------------------		LINE_PCOUNT	5; 020h + 5 points		ANCHOR_POINT	2946, 1562		LINE_POINT	35 + 00000h, 253		LINE_WIDTH	45		LINE_POINT	4065 + 00000h, 253		LINE_WIDTH	45		LINE_POINT	4065 + 00000h, 3		LINE_WIDTH	45		LINE_POINT	35 + 00000h, 3		LINE_WIDTH	1	data_end_0	label	word; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -; ===================================================================; DECAL_ LIST	decal_list		label	word		DECAL_LIST 1, decal_groups, decal_data	decal_groups	label	word		DECAL_GROUP 208, 23, decal_data, data_start_0, data_end_0; ===================================================================; TERRAIN DECALS TEXTURESdecal_textures	label	word	TEXTURE_HEADER 1, texture_groups, texture_data, texture_endtexture_groups	label	word	TEXTURE_GROUP texture_data, texture_start_0, texture_end_0texture_data	label	wordtexture_start_0	label	word	TEXTURE_DATA "1044", 0, 2, 4texture_end_0	label	wordtexture_end	label	word; ===================================================================; DECAL_ENDdecal_end	label	word; ===================================================================[/b]

And here's the macro ( subject to change! ):

[b]; TMFLinemacros.incLINE_PCOUNT	MACRO	count	DB	count + 020h	ENDMANCHOR_POINT	MACRO	x, y	DW	x + 4080	DW	y + 34808	ENDMLINE_POINT	MACRO	x, y	DW	x	DB	y	ENDMLINE_WIDTH	MACRO	width	DB	width	ENDM

[/b]Note in "DECAL_GEOMETRY 1, 9, 1, 0", I increased the shoreline priority to 9... because I increased the decal priority to 8 ( so it would lie over the water ).

Share this post


Link to post
Share on other sites

my only problem is that looking at BGLC code baffles me.Could you create a beginning of a lesson on BGLC code? Like to start, outline the purpose of each section of code, and syntax for commands, labels, how conditional code is idicated?or just point me to something like that if it exists?Bob B

Share this post


Link to post
Share on other sites

This looks great!Hopefully I have some time to look at it today.Cheers, Christian

Share this post


Link to post
Share on other sites

Hi Bob.I'll have a tutorial for download here at AVSIM in a week. It will give enough info to create water, flattens, and decals. A part 2 should cover making hills and valleys, creating islands, and a some examples of priority tricks. ( One of my problems with this, is that we're still discovering the rules! )Shorelines and roads will have to wait until we get some better understanding of FS2002 lines, although there's enough info here in the forums for someone skilled in the basics to create CFS2-style shores and roads.BGLC is just the medium. I can't program in it very well. But I do understand the use of macros. Most of the code is headers that can essentially be cut'n'pasted, with a couple of values plugged in. I haven't used any looping or conditionals in any of my code. We have been using labels as placemarkers for the terrain engine. We're not really creating the code, just discovering it, and using new combinations of code.Christian and I are mostly "faking it" and substituting byte values until we get lucky and discover a TMF rule. Then we can write a macro to help the user interface.My goal is to completely divulge all TMF info I come across. I want everyone to be programming this stuff before FS2004 comes along. I really want Airport, or FSSC, or Groundmaker, or someone to create an easy to use GUI for this stuff.

Share this post


Link to post
Share on other sites

You three, Dick, Christian, and Bob are at the forefront of this new technology for FS. I admire your devotion and timely (not sure if timely is the right word) efforts to unselfishly help bring us all to where we are at today and tomorrow and next year as well. I certainly appreciate all you've done for the FS community and myself. You have my deep respects, Thank You Gentlemen!!!Although it's probably still fairly far off, I'd love to see a single scenery design program with all the features, and bells and whistles. Photoreal, Terrain, and Effects including shorelines with waves. Umm, I wonder if Gmax will do this in the future FS2004 maybe? It would sure be nice if the FS2002 Scenery and Terrain SDK's would be accurate, complete, and here tomorrow as well but we know that isn't going to happen. (strike me with lightning if it does):)After reading MASM.zip by Christian, I'm very interested to learn more about include .inc files. Could a water include be created and used to compile a hand drawn lake poly like we would draw with Airport, GroundMaker, or FSSC? That is of course if those programs used the BGLCompiler?Thanks bunches Guys!!!!!!!:-beerchugKen

Share this post


Link to post
Share on other sites

Do your efforts (APPRECIATED!) hold any promise on making the shorelines more accurate and not the approximation MS gave us???Thanks,Dick

Share this post


Link to post
Share on other sites

Hi Dick.We can already place a CFS2-style shoreline, stream, road, or custom line, anywhere we want. Soon, we should have all the info we need for FS2002 lines.The remaining problem is how to exclude the current shorelines, without having to delete or deactivate MS defaults. One solution, is that higher priority decals can cover lines, and then higher yet priority lines can be made... The only problem with this is waves... they show through the new covering decal! Waves on dry land is not as real as it gets. :7

Share this post


Link to post
Share on other sites

Hey Bob,I think what your looking for is not really applicable to BGLC. BGLC is a macro-assembler, nothing more. Now while there are some basic commands for conditional code, it's pretty limited. Basically what is being done here is nothing more then breaking down record stuctures in a set of data files. The FS Scenery Engine then takes those records and converts them into commands or data depending on the op-code of the record.The BGLC commands of DW, DB, and such are nothing more then "Define Word" or "Define Byte" commands. Basically BGLC allows you to think of data in terms of records like "Decal_Data" or "Decal_Geometry" and converts the macro to pure data in the form of bytes or words. In a sense, your going back to the days of assembler programming without the CPU commands! In place of them are BGL commands instead.If you want true progammability in your scenery, then the BGL is where you need to look. There are many commands like "BGL_CASE" and "BGL_IFINF1" that are true programming constructs that can be used to create scenery. So your probably asking, why hasn't anyone really mastered the true BGL command set and used BGLC to make scenery? In my opinion, it's because no one really had to. There are really great BGL compilers out there (SCASM being one of them) that assist in make scenery. But the one thing they lack are the terrain record formats. Thanks to Christain and Rumba, these formats are being discovered, but to use them, we need an assembler that can convert people code to bytes and words. BGLC is all we have right now to do this.Enough of the rant ;) Christain made up a document called MASM.ZIP that explains how to get started with MASM (and BGLC). If you really want to know the in's and out's of the BGLC, you need to know how to use the basics of MASM from Microsoft. His document will help you in obtaining the information you need. I found my copy in the AVSIM files.Lee.

Share this post


Link to post
Share on other sites

Ok, thanks to a little bit of your help, rhumba, and lots of poking myself, I think I have completely cracked the decal polys now.It didn't make sense to me that 04 are polygons, 08, 16, etc lines. And in fact, it isn't how this works. As you pointed out in your shoreline macro, if you add 20h to the number of points, the following points are line points, otherwise they are polygon points. This leaves us with a max point count of 31. However, if the point count is 31, FS will read the next 2 bytes and add them to the point count! This gives us plenty of points.I'm completely stuck with the lines once again :-fume. I believe you that your above macro works. However, it is more complicated still. Even if we have a fixed number of points (say 5) the number of bytes to follow varies. So far, I can't make any sense of it. It looks to me like this:START_POINT x, y dw x dw yCONTINUE_POINT x, y db x db yLINE_WIDTH w db wNow, the syntax can be:start_point x, ycontinue_point x,yline_width wcontinue_point x,yline_width wcontinue_point x,yline_width wThat's what you did. But this is also possible:start_point x, ycontinue_point x,ycontinue_point x,yline_width wcontinue_point x,ycontinue_point x,yline_width wHow the hell does FS know that some points don't have a width?!?And is START_POINT really 2x dw or maybe: db x db y db w??? :-hmmmAnother thought. Maybe it's always x,y,w, but the size of x and y can vary between bb and dw? At the moment this is my favourite theory...Cheers, Christian :-zhelp

Share this post


Link to post
Share on other sites

Quick note:I don't differentiate between CFS2 and FS2K2 decal textures anymore. M$ forgot to delete some 'old' style nph in Madagaskar, they are named nphyp. nph = non-perenial water...The 'old' style texures allow this as an argument:"dirtroadhw.bmp;dirtroadhw.bmp;dirtroadsu.bmp;dirtroadsu.bmp;dirtroadsu.bmp;dirtroadsu_lm.bmp"Now, if you have a look right at the top of the terraintextures.cfg, you'll find that this means you can have seasonal textures even with old-style textures... No effects though...Cheers, Christian

Share this post


Link to post
Share on other sites

And more...I just had a look at the CFS2 lines. They are so easy :-lolBut, do they have any widths on them? They just seem to be points like the polygon points...Cheers, Christian

Share this post


Link to post
Share on other sites

Hey, this is fun talking to myself :-rollYou said that you thought that the 0 in texture entry has an impact on the layer. I think it's something else. CFS2 doesn't seem to have the size and type byte. The 0 is just the string delimiter '0'. This way FS2002 can read both CFS2 and FS2002 decal files. If there is a 0, the name string is over and a size and type byte follow...Christian

Share this post


Link to post
Share on other sites

Please, ignore the last comment. I just read your old CFS2 line post and all becomes clear. Now I know why M$ changed the lines, they would be a pain to do CFS2 style...Christian

Share this post


Link to post
Share on other sites

Well I'm listening intently... been following the thread dealing with the decals for a week now. You efforts are truly appreciated.

Share this post


Link to post
Share on other sites

Hi Christian.Sorry I left you talking to yourself. I been busy with personal commitments the past couple of days.The macro I made for FS2002 lines is very crude, and is incomplete. M$ used bits of some of the numbers as flags of some type. I think we're looking at bits added to the x,y values... so there is still more to discover. You'll note a codeline:LINE_POINT 35 + 00000h, 253The 00000h was included as a clue, here. That value can be 08000h, 0a0000h, 0c0000h, 0f0000h ( 9,b,d won't work )... so this is a flag or switch of some kind. Other values may be possible.I'm not sure the start-point ( or anchor-point ) is the actual start... but perhaps a ref-point... but the start/anchor/ref point never has a width, and starts a new section. The end of a section of points usually has a width of 0. That helps ID the end/start of line segments.If you play with the other points, you'll see they are hard to predict the effect of change.... I just thought the example was a 'stable' place from which to start altering values, or adding more points. The width points are good 'locators' when playing with the values of the lines... their effects are recognizable immediately.... and the width of 0 usually marks the end of a line segment ( not '1' as I used in the example... substitute '0' there and see the effect ).Also, why do we have to add '34808' to the y value of the anchor point? That doesn't seem right at all! There's a lot to learn here, yet.The CFS2-style lines are easy, once they were cracked! But what a pain for the designers! No wonder the CFS2 world was only partially done. It would have taken months for them to place shores and streams all over the world! The design team learned their lesson, and redesigned the lines structures for FS2002, so vector data could be used to locate shores, streams, and roads, and the process could be then be automated, using mapping data.

Share this post


Link to post
Share on other sites

Hi LeeThanks for that very interesting post. For a moment or two I actually thought I understood what your saying. Although I

Share this post


Link to post
Share on other sites

Hi Ken.Very good comments in your post. I've noted that the designers of Airport for Windows are now making a commitment to BGLC code. I don't know if they are abandoning SCASM completely. That, of course would make no difference to those of us using their program... a BGL is still the end result.The good news is this. By concentrating on BGLC, they will be able to use the info we are uncovering about TMF files, and incorporate that in their program, if they so choose. That would give us a sophisticated graphical interface for creating water, flattens, lines, and decals. Other GUI scenery programs will have to follow suit, as Microsoft is going to abandon the FS98 style scenery commands, possibly by CFS3. I haven't contacted the creators of Airport about this, but possibly someone could get their take on incorporating flattens, decals and lines. Although FS2002-style lines are not yet fully understood, the other types of TMF polys are pretty well documented.

Share this post


Link to post
Share on other sites

Waves can be excluded by using exclude areas, the only thing is that the exclude areas have to be larger then ususal, maybe one have to hit the anchor point of the waves.

Share this post


Link to post
Share on other sites

Thanks DickI've been eagerly watching the Airport for Windows site for the BGLC upgrade. Frankly though I don't see this happening real soon at this point or until we finally see the new 2K2 SDK's. Wow, wouldn't it be great if MS would release the SDK's about 6 months before it's version upgrade? Even better still if they would release a decompiler within the SDK's. To one step farther though, how about they release a full scenery design program package. One that really works!!!Thanks rhumba "You Da Man"Ken

Share this post


Link to post
Share on other sites

Hi falko.I wasn't able to exclude the wave effects. Do you have a code example of that?Dick

Share this post


Link to post
Share on other sites

Hi, I made the comment about writing to myself and the rolling eyes because I wrote the messages within a few hours as I discovered stuff, so that really was meant to show how weird I am, I wasn't expecting any answers :-lolBack to the lines, I had an idea last night, I thought that the width byte also carries some info on how many points follow. I was really sure it would be the case, however that turned out to be fluke once again.I'll have to do some more experimenting...Cheers, Christian

Share this post


Link to post
Share on other sites

Hi Christian and all.My current thinking on the macro structure is going this way:

; TMFLineMacrosV1.incLINE_PCOUNT	MACRO	count	DB	count + 020h	ENDMANCHOR_POINT	MACRO	x, y;		x or y may be 1 to 8160 ( 32 * 255 )	DW	x + 4080;		y values might be 2x scale of x numbers	DW	y + 2040 + 8000h	ENDMLINE_POINT	MACRO	x, y;		x may be + or - 1 to 255	DW	( x + 4080 ) MOD 4080;		y may be + or - 1 to 127;		y values might be 2x scale of x numbers	DB	 y + 128 	ENDMLINE_WIDTH	MACRO	width	DB	width	ENDM

This way allows + or - numbers to control the direction of x and y points, from the reference/anchor point. That allows the line coding to look like this:

; 1st line ----------------------------------------------		LINE_PCOUNT	5		ANCHOR_POINT	2946, 1562		LINE_POINT	35, 125		LINE_WIDTH	45		LINE_POINT	-15, 125		LINE_WIDTH	45		LINE_POINT	-15, -125		LINE_WIDTH	45		LINE_POINT	35, -125		LINE_WIDTH	1

A little more user-friendly.

Share this post


Link to post
Share on other sites

Thanks for helping me to see where your coming from Ken. I agree with you that there is a distinction between programmers and scenery developers. You nailed it on the head when you discussed your sceneries that you have developed. I too have Airport, AS&D, etc. But what I don't have is the patience to learn the skills to effectively create high quality sceneries such as yours. Could I create high quality scenery, yes, I probably could. By I like to tinker with the dirty dark secrets and work out the usable solutions. Christain and Richard have a better knack of digging out the nasty details of the BGL. Me, I'm an applications developer. I do this for a living. But I'm also an old school programmer from the late seventies. So I know about some of the older technologies like the BGL (remember, Bruce came up with this back in the late seventies).On that note, I have the ability to understand what Richard and Christian discover, thank god for them! So I'm taking their discoveries plus what I know from the SDK and I am working on some sort of GUI interface so that the designers like you have a better tool to work with. Will it ever compete with Airport for Windows? I'm not sure and I really don't care, but if they aren't incorporating terrain mesh technology into their application, mine will hopefully be able to fill the gaps.The way I see it we have three groups of folks here...The Red-eyed hackers (not to be confused with Crackers) working out the Structures.The Application Developer taking the discoveries and creating usable tools.The Scenery Developers taking the tools and making FS magic.I hope that the Airport For Windows folks do incorporate FS2002 terrain mesh technology into their product, or that Microsoft really does release a SDK. But I'm not holding my breath.Lee.

Share this post


Link to post
Share on other sites

Very interesting! I've got a buch of questions here.Does the anchor point define a point within a LOD 8 block?Does the width value pertain to distances between LOD 13 points? There is no scale value? BGL lives on scale values, I'm surprised nothing is here for that. Maybe this isn't required since the actual distance between LOD 13 points is rather small.Also, using your example.. LINE_POINT 35, 125LINE_WIDTH 45Is the width of 45 the segment width from the previous segment or next segement defined by the point? Is the actual line segment defining the left side, middle or right side of the rendered line?I've cut some line segments out of some BGL files and created tiny sceneries to use as test data. I'm going to run your line macro against it to see if I can find any inconsistencies. This is really getting to be exciting!Lee.

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