Page 1 of 1

BAM File Format....

Posted: Wed Jan 14, 2015 7:15 pm
by parmenio
Is there any documentation available on the structure of this file?
Or alternatively does anyone have any knowledge they can share?

I'm in the process of writing an app for Pike & Shot that reverses campaign scenarios so that they can be played SP from the other side.
I've already got code working that switches the units - what I'm looking to do is reverse the map.

For two reasons, one: it's annoying having it start-up with the initial map view being in the "wrong" place; two: some of the AI scripting functions assume the Player is going from left to right. I could produce my own versions but I'd rather not.

The [TILES] section I've pretty much figured out - the [OBJECTS] section I haven't, as yet, got a clue what's going on.

Thanks In Anticipation

(I'm posting here as I figure you guys have been modding longer)

Re: BAM File Format....

Posted: Wed Jan 14, 2015 8:07 pm
by pipfromslitherine
Unfortunately it is not documented (mainly because the format isn't fixed, we could change it if required). I can try and answer any specific questions.

Cheers

Pip

Re: BAM File Format....

Posted: Wed Jan 14, 2015 8:29 pm
by parmenio
Hi Pip - thanks for the reply. As I said I think I've got a handle on the [TILES] section:

T0_0 0 0
T1_0 0 0
T2_0 0 0
T3_0 0 0
T4_0 0 0
T5_0 0 0
T6_0 0 0
T7_0 0 0
T8_0 0 0
T9_0 0 0

The int after the "T" is the tile number T0 being 0,0 and T1 being either 1,0 or 0,1 depending on whether we go along the X or Y axis.
So reversing those shouldn't be too difficult.

However, what I can't work out is the [OBJECTS] section - specifically how it specifies for an object what tile position/rotation it has:

O 0
OP 784 0 -752
OD 1 0 0
O 1
OP 816 0 -720
OD 1 3.141593 0
O 1
OP 752 0 -752
OD 1 3.141593 0
O 1
OP 848 0 -720
OD 1 3.141593 0

Looking at the above, for example, I haven't managed to guess much, other than there's a lot of what looks like the value of PI. I thought maybe the first number after OP might be the Tile No but can't figure out the negative number at all....

....any help would be appreciated.

Re: BAM File Format....

Posted: Thu Jan 15, 2015 4:28 pm
by Richcat
Hi parmenio
I'm in the process of writing an app for Pike & Shot that reverses campaign scenarios so that they can be played SP from the other side.
I've already got code working that switches the units - what I'm looking to do is reverse the map.
This is something we have been looking at over on the BA2,viewtopic.php?f=312&t=55350 and have been even referred your post on the Pike and Shot forum.

Re: BAM File Format....

Posted: Thu Jan 15, 2015 4:33 pm
by pipfromslitherine
OP is the 3D position of the object. z is negative across the map, increasingly negative as the Y coordinate increases. OD is indeed a tricky one :) It is a vector storing the scale, rotation, and damage state [0,1] respectively.

Cheers

Pip

Re: BAM File Format....

Posted: Thu Jan 15, 2015 8:12 pm
by parmenio
pipfromslitherine wrote:OP is the 3D position of the object. z is negative across the map, increasingly negative as the Y coordinate increases. OD is indeed a tricky one :) It is a vector storing the scale, rotation, and damage state [0,1] respectively.

Cheers

Pip
Thanks for the information. I hadn't considered a 3D co-ordinate system - although it's now quite obvious.

Re: BAM File Format....

Posted: Thu Jan 15, 2015 8:16 pm
by parmenio
Richcat wrote:This is something we have been looking at over on the BA2,viewtopic.php?f=312&t=55350 and have been even referred your post on the Pike and Shot forum.
Yes - switching the units sides round was quite easy but as you can see I'm also looking to reverse the map as well.

Re: BAM File Format....

Posted: Sun Jan 18, 2015 7:01 pm
by parmenio
So I'm slightly stalled on the [TILES] section as I'd forgotten about....
..... overlays and rotation!

0 DE Tile64:NorthernEurope_Base:0:0
1 DE Tile2:NorthernEurope_Base:0:0
2 DE Tile1:NorthernEurope_Base:0:0
3 DE Tile1:NorthernEurope_Overlay:0:0
4 DE Tile3:NorthernEurope_Base:0:0
5 DE Tile4:NorthernEurope_Base:0:0
6 DE Tile5:NorthernEurope_Overlay:0:0
7 DE Tile2:NorthernEurope_Overlay:0:0

T3_0 2 1
T3_2 3 1
T51_0 5 2
T51_2 6 1

T144_0 1 0
T144_2 7 2
T145_0 4 3
T145_2 6 0

The two entries highlighted in red are road tiles - the first goes left to right, the second up (map-wise)
Looking at the numbers T3_2 3 1 and T144_2 7 2, I can guess that _2 is the "layer" it relates to on T3 and T144 and I know the 3 and 7 refer back to DE Tile1:NorthernEurope_Overlay:0:0 and DE Tile2:NorthernEurope_Overlay:0:0 respectively - I can see in TILES.TXT they both point to the same tile in the tileset TEX1.tga for "Northern Europe Overlay". What I'm missing is understanding the rotation of the overlay tile which surely can only be "1" and "2"? Obviously for straight road tiles swapping makes no difference but it does for roads with bends (it goes without saying for other tiles as well)

Yours hopefully....

EDIT: Yep - quite stuck on this. T51_2 6 1 and T145_2 6 0 are road edge tiles and having just run my swap code on a test scenario they are now the wrong way round when loaded into the editor.

EDIT2: Actually not so stuck after all :D . Data didn't seem to be consistent with what I'd done in the editor but I just went for the assumption that possible values are 0-3 and to rotate by 180 I just need to add 2 (and constrain the values to 0-3). My test scenario looks fine (it has no objects only units and tiles) and checking ECW Stratton now only needs the objects re-positioned.