Terrain format specification

Terrain / Theater editing

Moderators: Lone Wolf, Snake Man

std
Newbie
Posts: 1
Joined: 2002-08-20 22:01:01

Terrain format specification

Post by std » 2002-08-21 19:01:00

Hi,
Where can I find .L0-2 files format specification?
Thanks in advance

Snake Man
Commander-In-Chief
Posts: 9357
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC

Post by Snake Man » 2007-07-06 23:33:45

Just curious, have anyone documented the L2 format?

Yeah we have Terrainview and CATE sources so its not like we dont actually can find out, but if there is some documented struct available, it would be great to have it.

5 Year bump :o
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

Zaggy
Colonel
Posts: 380
Joined: 2001-07-09 22:01:01
Location: AU

Post by Zaggy » 2007-07-07 12:35:39

Best Person to ask is most probably Blueprint... If he hasnt written something down, you maybe able to persuade him to...


Zaggs
Daniel "Zaggy" Bell
Old-School, Grumpy and Anti-Social
Also to be found lurking round FighterOps

User avatar
Sherlock
Lt. General
Posts: 1167
Joined: 2006-05-24 22:01:01
Gaming Interests: Falcon 4.0
Editing Interests: All, I (try) to edit everything.
Location: Arizona, USA

Post by Sherlock » 2007-07-12 16:30:32

I think this may answer your question:

File formats are as follows:

O2 file: 4Bytes per Record
DWORD(LONG) - L2 byte Location

(This file essentially, represents the SEGEMENTS of the theater, starting a 0,0 in the LOWER LEFT corner, to 63,63 in the UPPER RIGHT. Each of the DWORD(LONG) Records points to the location in the L2 file (in BYTES), that the 16x16 Tiles that make up each segment, begins. Like the O2 files, the order of the 16x16 segement records in the L2 is, starting at Lower Left, going to Upper Right)

L2 File: 9Bytes per Record
DWORD(LONG) - Texture Offset Number
WORD(INTEGER) - Elevation
BYTE - Palette
BYTE - X1
BYTE - X2

(Bytes 1-4 hold the Texture info, this what you want! 5-6 hold the elevation (in ft), 7, palette, 8 and 9 have something to do with the Normals, and you dont need to worry about them either!)

and

L2 Record
2-byte
===============================
WORD Texture;
WORD Elevation;
BYTE Palette;
BYTE X1;
BYTE X2;

4-byte
===============================
DWORD Offset;
WORD Elevation;
BYTE Palette;
BYTE X1;
BYTE X2;

WORD = 2 bytes
DWORD = 4 bytes
BYTE = 1 byte

O2 Record
2-byte & 4-byte
===============================
long (4 bytes) Pointer to each Section in L2.

Section = 16 x 16 x size of L2 record

And looking at that structure then, the only thing a 4byte structure does, is allow a larger number of textures to be used? Not that I want to mess with that area of it... Just the elevation stuff... And that shouldnt require messing with the O2, should it?


The L2 Offset points into fartiles.raw. With the more diversified tiled theaters, like the Balkans, the 16-bit offset was limited to 64,767 fartiles (Blkans has ~102,000 fartiles). Making the Offset a 32-bit integer extended the number of fartiles to 4+ gig tiles.

The O2 offsets (pointers) change due to the size (bytes) of a L2 section.
--------------------------------------------------------------------------------

Note these were originally posted at the FreeFalcon forums (the old site) and the links I have are no longer working. So I am reposting this information for use here. I think the original posters were Zaggy and Dr. Fred "BaldEagle" Balding....
Sherlock
Victurous te Saluto

Snake Man
Commander-In-Chief
Posts: 9357
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC

Post by Snake Man » 2007-07-12 21:11:32

Thank you for that.
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

Zaggy
Colonel
Posts: 380
Joined: 2001-07-09 22:01:01
Location: AU

Post by Zaggy » 2007-07-13 12:14:20

Sounds about right...

Back in days when FreeFalcon didnt instantly BAN me the moment i reered my head! hahahaha

OK, just going to ADD some data to that...

The L2:

Records (DWORD, WORD, BYTE, BYTE, BYTE - or in VS Language, Int32, Int16, Byte, Byte, Byte, all UNSIGNED!!!) are arranged into segments... so one segment is 16 x 16 records, from Bottom to Top, Left to Right.

Typically the FIRST segment will ALWAYS be an ocean segement

The O2:

Records (DWORD - or in VS langauge, Int32 unsigned) correspond on the Where the Segement is placed on the 'Matrix', from Bottom to Top, Left to Right.

SO, this means, the FIRST Record, will correspond to Segment 0,0 (lower left corner). The SECOND Record will correspond to 1,0, the segment immediatly to the RIGHT of the first segement...

The OFFSET stored in the record is essentially a POINTER that points to the FIRST BYTE of the SEGEMENT in the L2... SO, if the current Record requires that the SECOND Segment in the L2 is to be placed here, then the pointer value will be (9bytes (length of the Lx Record) x 16 x 16 (number of records in the segment)) x 1 (as 0 is actually the first value, 1 must be the second)... The Record will carry the value 2304 (binary) or 900 (hex)...

As a nice little error check, ALL the values in the O2 will be a multiple of 2304b/900h

So by now you may have realised that the order of the Segments in the L2 is IRRELEVANT, as the L2 just stores the sub-matricies, and the O2 ORDERS and REFERENCES theses sub-matricies into the full terrain matrix...

OK, Im Adding a pic to help!
Image


Bluey, do you have anything to add?? you did more work WRITING Lx/Ox than I did... I cant remember EXACTLY what F4 uses as its 'out of bounds' terrain... Its either the BOTTOM LEFT Tile/Segment or the FIRST Tile/Segment in the L2...
Daniel "Zaggy" Bell
Old-School, Grumpy and Anti-Social
Also to be found lurking round FighterOps

User avatar
Sherlock
Lt. General
Posts: 1167
Joined: 2006-05-24 22:01:01
Gaming Interests: Falcon 4.0
Editing Interests: All, I (try) to edit everything.
Location: Arizona, USA

Post by Sherlock » 2007-07-13 22:05:15

Zaggy, et al,

I noticed in your handy-dandy table above the "Palette" value. I've asked previously (no real answer forthcoming) and I have tried to track down an answer in the SP3 source code but I've been unable to get a solid answer about how it is calculated / what variables in the code determine how it "looks" in sim. Got any information on that part of it that would shed some light on how it is calculated?
Sherlock
Victurous te Saluto

Return to “Terrain / Theater”

Who is online

Users browsing this forum: ClaudeBot [Bot] and 0 guests