So.... the last bit to get working on map reversal is how elevation is stored.
I can see it's in this section:
[FPHEIGHT]
HEIGHTDUO 00100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010001000000000000000000000000000000000000000000000000000
HEIGHTDUO 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
I've raised the tile at 0,0, by 1 but I can't figure out what I'm looking at here.
Any help would be appreciated.
Elevation in a BAM File
Moderators: Slitherine Core, BA Moderators
-
pipfromslitherine
- Site Admin

- Posts: 9937
- Joined: Wed Mar 23, 2005 10:35 pm
Re: Elevation in a BAM File
Urgh. That is going to be nasty. That is a binary chunk that we store. It is made up of 2-byte height elements (signed), encoded as chars (2 chars per byte, starting at character value 48 (the zero character). There is one value per vertex on the map (so widthInTiles+1 * heightInTiles+1).
Cheers
Pip
Cheers
Pip
follow me on Twitter here
Re: Elevation in a BAM File
It's certainly going to be the worst section to worth with! My initial reaction was ¿Que?pipfromslitherine wrote:Urgh. That is going to be nasty. That is a binary chunk that we store. It is made up of 2-byte height elements (signed), encoded as chars (2 chars per byte, starting at character value 48 (the zero character). There is one value per vertex on the map (so widthInTiles+1 * heightInTiles+1).
Cheers
Pip
However, now I've played around changing things in the editor and see what's stored as a result, I can see what I need to do.
Thanks for the info.
(this has been more of a challenge than I expected but at least once done I can get back to what I should have been doing in the first place which was AI scripting)
Re: Elevation in a BAM File
Ok - I'm obviously missing something here. I have a test map of 48 x 48 which equates to 2401 vertices ( (48+1) x (48+1) ).
I've presumed 4 characters in the FPHEIGHT section per vertex (2 byte elements 2 characters per byte) which gives me a string length of 9604 (2401 x 4).
However, when I read the data in from the file, concatenate all the HEIGHTDUO elements I end up with a string length of 19208 - precisely double.
??!!??!!! Not sure what's going on.
I've presumed 4 characters in the FPHEIGHT section per vertex (2 byte elements 2 characters per byte) which gives me a string length of 9604 (2401 x 4).
However, when I read the data in from the file, concatenate all the HEIGHTDUO elements I end up with a string length of 19208 - precisely double.
??!!??!!! Not sure what's going on.
-
pipfromslitherine
- Site Admin

- Posts: 9937
- Joined: Wed Mar 23, 2005 10:35 pm
Re: Elevation in a BAM File
Ah - you are correct. There are actually 2 heights - one is the variable height which can change based on objects on the tile, and the other is the base height of the terrain. So yes, 2 2 byte elements per vertex. Sorry - been a while since I looked at it!
Cheers
Pip
Cheers
Pip
follow me on Twitter here
Re: Elevation in a BAM File
Thanks for the reply. I'd got as far as working out I seemed to have a duplicate copy - with no idea why.
Re: Elevation in a BAM File
Pip - thanks for information provided. I now have a working application. Not sure I'd have got there on my own without your help.
-
pipfromslitherine
- Site Admin

- Posts: 9937
- Joined: Wed Mar 23, 2005 10:35 pm
