Author Topic: .map File format questions  (Read 5039 times)

Offline 0warfighter0

  • Newbie
  • *
  • Posts: 3
.map File format questions
« on: January 08, 2016, 10:11:32 AM »
Hello there, I've figured out the uncompressed VOL and tileset BMP formats (thanks to all you folks' prior research) but now I'm a bit stuck on the .map format.

Does anyone have an idea how the mapdata references the tiletypes? And what is the point of the Tilegroups in the .map file, are they used? (Seems more of an editor only thing to me)

This is what I have:

Size (bytes)Description
4?
4?
4Value to calculate mapWidth (Math.Pow(2, value))
4Map height
4?
-------------------------------------------- For each tile{
4Tiledata. TerrainType seems to be 0x0000000F(Fast1, Fast2, Impassable1, etc.) No idea how it references the tilesets or types, maybe it references some sort of palette?
--------------------------------------------}
4?
4?
4?
4?
-------------------------------------------- For each tileset{
4Length of tilesetName
TilesetNameLengthTileset name
4Tileset tile count
--------------------------------------------}
?? space
10TILE SET 1a 00
?Is this maybe some sort of palette referencing the tilesets?
-------------------------------------------- For each tilegroup{
4Length of tilegroupName
TilegroupNameLengthTilegroup name
?Tilegroup data
--------------------------------------------}

Offline dave_erald

  • Sr. Member
  • ****
  • Posts: 262
Re: .map File format questions
« Reply #1 on: January 08, 2016, 12:38:07 PM »
Tile groups make placing large items quicker, volcano's, cliffs, ice cliffs at the top and bottom of world maps, and there are large brush blocks for making sand, rock, volcano terrain easier and more random (albeit those stamp pads, if you want to call them that, could be much larger in my opinion)  Open the mapper and open a OP2 current map and you should see that.

I am hoping you're asking because you want to make the mapper more productive (in that case some suggestions could be made on that part)

Hooman would be able to tell you the ins and outs of the code I'm sure, and Leeor has experience with mappers as well. And most people are on the same page in believing that this mapper could use a healthy update.
-David R.V.

-GMT400 fan
-OPU Influencer

Offline 0warfighter0

  • Newbie
  • *
  • Posts: 3
Re: .map File format questions
« Reply #2 on: January 08, 2016, 01:18:50 PM »
Yeah, it's very buggy. I need to write a game tool for ToolDev with WPF so I thought a more user friendly editor would be handy. I'm open for suggestions.

I know that tilegroups are handy, I just wonder why they are stored in the map files themselves, it seems pretty illogical.
It would make more sense if the map files contained just the map info, tiles and keep the tilegroups in the editor only. (unless the tilegroups are referenced in the tiledata, I don't know)

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Re: .map File format questions
« Reply #3 on: January 08, 2016, 03:07:30 PM »
I know that tilegroups are handy, I just wonder why they are stored in the map files themselves, it seems pretty illogical.

You're confused because OP2's devs did something dumb?  You must be new here.  :P

Anyways, this post contains most of what we know about OP2's internals, including the map format.  It should help you out.
« Last Edit: February 28, 2019, 05:55:23 PM by leeor_net »
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline 0warfighter0

  • Newbie
  • *
  • Posts: 3
Re: .map File format questions
« Reply #4 on: January 08, 2016, 05:21:00 PM »
I found the other Format topics but I missed this invaluable one! Thanks for the heads up, this is just what I need.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Re: .map File format questions
« Reply #5 on: January 09, 2016, 11:26:10 AM »
Thank you Sirbomber. That reminds me the data in that archive should go in the SVN somewhere. There is a post on the Saved Game and Map File Format which is basically a copy of the text file found in the archive.

The TileGroup data at the end of .map files is not used by the game. It's not even loaded into memory. I think I almost missed it because of that. The data was extracted for use in the map editor, where it is useful.

The map data is actually an array of bit fields. Each 32-bit tile contains an 11-bit tile index. This is indeed an index into a palette. With 11 bits, there is a max of 2048 tiles that can be referenced. Outpost 2 uses most of these with the built in maps and tile sets. Each map specifies which tiles set files to load, and how many tiles to load from each. The index from the map data is used to lookup into the palette data, which translates to a tile set index, and an index within that tileset for the graphic to display.
« Last Edit: February 28, 2019, 05:55:35 PM by leeor_net »