aliens

Author Topic: [OXCE] MAP2 format (16bits dimensions and tiles IDs in map files)  (Read 232 times)

Offline Flaubert

  • Captain
  • ***
  • Posts: 50
    • View Profile
Hello,
  I've coded an OXCE fork to add a new file format (MAP2) for mapfiles. Current MAP files uses 8bits to code all information inside a mapfile definition (dimensions, and 4 tileID for any map position). Though it can be more than enough for most terrains and maps, there are certain scenarios (e.g. Xcom bases and UFO bases), which would benefit from providing a greater variety of tiles -  when I was working on a Garage MOD for XBase in Xcom Files, I realized that I couldn't have the tiles I wanted, as XBase was already near the 253 different tiles limit -
For sure, there are tricks to overcome this restriction, as using deadtiles, or playing with "addvertical" blocks, but the proposed change would be more straightforward: just add more MCDs to terrain definitions, and use them.

You can find it here (from OXCE 7.15) https://github.com/FlaubertNHR/OpenXcomPruebas/tree/oxce-plus_MAP-MAP2 (Windows binaries are provided in "WindowsBinaries" folder).

This fork works with both MAP and MAP2 files (so is compatible with MODs already done), with just some little adjusts: If you want to use a "myMap.MAP2" file, you must remove (or store in another place) MAP files with the same name (MyMap.MAP) which could be under /MAPS folder explored by the engine (<mod>/MAPS and UFO/MAPS). If you don't, MAP file will take precedence over MAP2 - that is due to  terrain definitions ruleset  include only name with no extension given- Also, modders should be careful if they mix MAP and MAP2 files in a terrain, as MCDs used by MAP should go first and no go over 255.

As there are a lot of work done in original MAP format, and MAP is the only format allowed in most popular editors (kevL's Mapview2 or Ohartenstein23's Battlescape Editor), I've forked both editor tools and added some functionality to manage both MAP and MAP2 files.

You can find a fork of MapView2 here: https://github.com/FlaubertNHR/OpenXCOM.ToolsMAP2 (binaries at the "Release" section). There is a new option to export current map to MAP2/RPM; and also to create a new map in MAP2 format (just choose radiobutton MAP or MAP2 at the creation dialog). It allows also loading MAP2 files -with the same precedence rules with MAP files as described before-

And I have a fork of Battlescape Editor here: https://github.com/FlaubertNHR/OpenXcomPruebas/tree/battlescape-editor_MAP-MAP2 (binaries at "WindowsBinaries" folder). This fork have an option to "batch-convert" all loaded MAP files to their respective MAP2 files, so you could use this as starting point if you want to add more different tiles to any existing MAP -remember to add MCDs to the terrain ruleset definition-

As a final warning, I've tested all these forks, but not exhaustively. If you find any bug, tell me and I will try to fix it.

(you can also explore, at my Github place,  other forks I've coded as "Morethan8Bases" or "Hangar-Reworked")