Sign in to follow this  
rhumbaflappy

Processing VTP code

Recommended Posts

Hi all,I'm using the neat tool LWMDraw and pushed it to the limit. Ken says in the docs that he tried more than 130 points. That works indeed. I've tried 280 and it gave me a runtime error - all the code was gone - oh well:-)Now, question is, how can I put more than one costline into just one source code? It's not a problem to split the project into more than one line. This way I can continue with LWMDraw. But I don't want to have a separate bgl file for each line.I'm not a programmer, maybe this is an easy task but I don't know, where to put the code between the header and the end of the file.Can somebody give a short example please? Thanks in advance and also thanks once again to Ken Nelson for LWMDraw!Rainer

Share this post


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

Hi Rainer.The way we have accepted, as a convention, is to place all of a single cell's info into a structure bounded by a set of "datamark" labels.All of the first cell's info will be found between datamark_0 and datamark_1. It's a naming convention that has worked well.All polys or lines that exist within the cell, should then be between the appropriate datamarks.Here's an example of 5 polys, with a Layer of 8:datamark_0 label word;-------------------------- VTPDataArea 1, 1, 0, 0 VTPLayer 8, 0 VTPNumTexturesInLayer 1, 0 VTPTextureId 0, 0 VTPPolyCount 5, 0;; VTPPolyMethod2 5, 0, 0 VTPPointXY2 10160, 11154 VTPPointXY2 10221, 11150 VTPPointXY2 10226, 11162 VTPPointXY2 10196, 11163 VTPPointXY2 10160, 11154;; VTPPolyMethod2 5, 0, 0 VTPPointXY2 10221, 11150 VTPPointXY2 10287, 11153 VTPPointXY2 10259, 11163 VTPPointXY2 10226, 11162 VTPPointXY2 10221, 11150;; VTPPolyMethod2 5, 0, 0 VTPPointXY2 10287, 11153 VTPPointXY2 10298, 11161 VTPPointXY2 10265, 11167 VTPPointXY2 10259, 11163 VTPPointXY2 10287, 11153;; VTPPolyMethod2 5, 0, 0 VTPPointXY2 10298, 11161 VTPPointXY2 10296, 11247 VTPPointXY2 10264, 11210 VTPPointXY2 10265, 11167 VTPPointXY2 10298, 11161;; VTPPolyMethod2 5, 0, 0 VTPPointXY2 10296, 11247 VTPPointXY2 10241, 11247 VTPPointXY2 10236, 11210 VTPPointXY2 10264, 11210 VTPPointXY2 10296, 11247;--------------------------datamark_1 label wordNote in the above code, that the VTPPolyCount is 5, to reserve space in the datastream for 5 polys in the structure. The rules for grouping lines are the same as polys. Here's an alternate method of grouping the polys:datamark_0 label word;-------------------------- VTPDataArea 1, 1, 0, 0 VTPLayer 8, 0 VTPNumTexturesInLayer 1, 0 VTPTextureId 0, 0 VTPPolyCount 1, 0; VTPPolyMethod2 5, 0, 0 VTPPointXY2 10160, 11154 VTPPointXY2 10221, 11150 VTPPointXY2 10226, 11162 VTPPointXY2 10196, 11163 VTPPointXY2 10160, 11154;-------------------------- VTPDataArea 1, 1, 0, 0 VTPLayer 8, 0 VTPNumTexturesInLayer 1, 0 VTPTextureId 0, 0 VTPPolyCount 1, 0; VTPPolyMethod2 5, 0, 0 VTPPointXY2 10221, 11150 VTPPointXY2 10287, 11153 VTPPointXY2 10259, 11163 VTPPointXY2 10226, 11162 VTPPointXY2 10221, 11150;-------------------------- VTPDataArea 1, 1, 0, 0 VTPLayer 8, 0 VTPNumTexturesInLayer 1, 0 VTPTextureId 0, 0 VTPPolyCount 1, 0; VTPPolyMethod2 5, 0, 0 VTPPointXY2 10287, 11153 VTPPointXY2 10298, 11161 VTPPointXY2 10265, 11167 VTPPointXY2 10259, 11163 VTPPointXY2 10287, 11153;-------------------------- VTPDataArea 1, 1, 0, 0 VTPLayer 8, 0 VTPNumTexturesInLayer 1, 0 VTPTextureId 0, 0 VTPPolyCount 1, 0; VTPPolyMethod2 5, 0, 0 VTPPointXY2 10298, 11161 VTPPointXY2 10296, 11247 VTPPointXY2 10264, 11210 VTPPointXY2 10265, 11167 VTPPointXY2 10298, 11161;-------------------------- VTPDataArea 1, 1, 0, 0 VTPLayer 8, 0 VTPNumTexturesInLayer 1, 0 VTPTextureId 0, 0 VTPPolyCount 1, 0; VTPPolyMethod2 5, 0, 0 VTPPointXY2 10296, 11247 VTPPointXY2 10241, 11247 VTPPointXY2 10236, 11210 VTPPointXY2 10264, 11210 VTPPointXY2 10296, 11247;--------------------------datamark_1 label wordHere, I used 5 separate data structures, each with a VTPPolyCount of 1. This code produces the same effect as the first example. The structures still must reside between the appropriate datamark labels, so they are assigned correctly into the right cell.Of the 2 methods, the first would be preferred, as it is more code efficient, and follows the SDK's datastream explanation more closely. Note that the first method requires the grouping according to the Layer number.The second example lends itself better to cut'n'paste editing. I also like the greater modularity of the code, as I can add or delete lines without worrying about keeping track of my VTPPolyCount numbers. Since each poly exists as a separate structure, you can change Layer numbers, or texture IDs, easily, with each poly. Your choice.Dick

Share this post


Link to post
Share on other sites

Hi Dick,>The way we have accepted, as a convention, is to place all >of a single cell's info into a structure bounded by a set of >"datamark" labels. I've tried both ways that you suggest. The compiler accepts them but FS2002 doesn't want to load anymore then.What's wrong with the following code putting two roads into one source file:;----> End Header Section <----;----> Start File Data <----VTPStart label worddatamark_v0 label word;----> Begin Data Area Information <----VTPDataArea 1, 1, 0, 0VTPLayer 31, 0VTPNumTexturesInLayer 1, 0VTPTextureId 4, 0VTPPolyCount 1, 0VTPPolyMethod2 18, 1, 0VTPWidePoint 7080, 1, 7895, 0VTPWidePointWidth 1VTPWidePoint 7080, 1, 7895, 0VTPWidePointWidth 20VTPWidePoint 7080, 0, 7895, 0VTPWidePoint 7005, 0, 7868, 0VTPWidePoint 6939, 0, 7787, 0VTPWidePoint 6840, 0, 7702, 0VTPWidePoint 6635, 0, 7670, 0VTPWidePoint 6616, 0, 7625, 0VTPWidePoint 6481, 0, 7615, 0VTPWidePoint 6446, 0, 7574, 0VTPWidePoint 6412, 0, 7567, 0VTPWidePoint 6296, 0, 7575, 0VTPWidePoint 6169, 0, 7597, 0VTPWidePoint 6115, 0, 7633, 0VTPWidePoint 6070, 0, 7725, 0VTPWidePoint 5947, 0, 7677, 0VTPWidePoint 5892, 0, 7636, 0VTPWidePoint 5866, 0, 7618, 0VTPWidePointWidth 0;;VTPDataArea 1, 1, 0, 0VTPLayer 31, 0VTPNumTexturesInLayer 1, 0VTPTextureId 4, 0VTPPolyCount 1, 0VTPPolyMethod2 10, 1, 0VTPWidePoint 5916, 1, 7652, 0VTPWidePointWidth 1VTPWidePoint 5916, 1, 7652, 0VTPWidePointWidth 20VTPWidePoint 5916, 0, 7652, 0VTPWidePoint 5933, 0, 7665, 0VTPWidePoint 5866, 0, 7618, 0VTPWidePoint 5825, 0, 7582, 0VTPWidePoint 5803, 0, 7521, 0VTPWidePoint 5825, 0, 7472, 0VTPWidePoint 5825, 0, 7449, 0VTPWidePoint 5825, 0, 7437, 0VTPWidePointWidth 0datamark_v1 label word;----> End Data Area Information <----;----> Begin Cell__'s defination data information <----Cellv_211_199 EQU VTPCellID 0, 211, 199VTPIndexStart label wordVTPIndexHeader 1, VTPIndexData, VTPStartVTPIndexData label wordVTPIndexEntry Cellv_211_199, VTPStart, datamark_v0, datamark_v1;----> End Cell__'s defination data information <----;----> Begin Texture Information <----TextureStart label wordVTPTextureListHeader 5, TextureIndexStart, TextureDataStart, TextureDataEndTextureIndexStart label word VTPTextureListEntry TextureDataStart, texturemark_0, texturemark_1 VTPTextureListEntry TextureDataStart, texturemark_1, texturemark_2 VTPTextureListEntry TextureDataStart, texturemark_2, texturemark_3 VTPTextureListEntry TextureDataStart, texturemark_3, texturemark_4 VTPTextureListEntry TextureDataStart, texturemark_4, texturemark_5TextureDataStart label wordtexturemark_0 label word VTPTextureName "1158" ;concrete / 1 laneVTPTextureType 2, 0, 0, 4texturemark_1 label word VTPTextureName "1158" ;concrete / 1 laneVTPTextureType 2, 0, 0, 4texturemark_2 label word VTPTextureName "1158" ;concrete / 1 laneVTPTextureType 2, 0, 0, 4texturemark_3 label word VTPTextureName "1158" ;concrete / 1 laneVTPTextureType 2, 0, 0, 4texturemark_4 label word VTPTextureName "1158" ;concrete / 1 laneVTPTextureType 2, 0, 0, 4texturemark_5 label word VTPTextureName "1158" ;concrete / 1 laneVTPTextureType 2, 0, 0, 4TextureDataEnd label word;----> End Texture Information <----;----> The next line below ENDS this file <----VTPEnd label wordThanks in advanceRainer

Share this post


Link to post
Share on other sites

Hi Rainer.I don't think I have enough code from that example to conclude much.You could enclose the originals as a TXT atachment to a post, and maybe I can figure how to 'weld' them together.-------------------------------Oddly, I did find out something disturbing today...LWM code, as we code it, is read by TMFViewer.The default VTPs are read correctly by TMFViewer. Our VTP code is not read correctly by TMFViewer. Christian Stock had noted some 'irregularities' that prevented him from making a VTP line decompiler, that would handle the default lines. He had discovered the default lines apparently use some "reserved" code bits, and as a result, we cannot make sense of MS's line routines, as they deviate quite a bit from the SDK info.I'm going to assume the SDK info we have, actually preceeds the creation of the default FS2002 lines. That would explain why the SDKs do not reflect the state of the final, default lines. Add to that, the fact that the SDKs were not written by programmers experienced with VTP creation, and you can see the mess we have now.It's a wonder we can make lines at all.So, essentially, we still don't know how to make lines correctly with FS2002. This is the actual reason why we sometimes get FS crashes, or VTPs inexplicably not working as designed.9 times out of 10, code doesn't work because we make small mistakes in coding, that BGLC doesn't intercept. We get a compiled BGL, but it is nonsense in the sim. I had thought that the odd 1 in 10 occurance of problems was due to bugs in the terrain engine... now I'm not so sure we simpily did not get the full set of info from Microsoft.Dick

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