aliens

Author Topic: Because we want suffer the 255 tile limits for maps ?  (Read 2836 times)

Offline davide

  • Commander
  • *****
  • Posts: 548
    • View Profile
Because we want suffer the 255 tile limits for maps ?
« on: April 03, 2015, 03:34:02 pm »

I suggest to introduce the support to a second file format for map, such as .MAP2 or .MAPX.

Into the new maps the tile index will be on 2 byte.

The source code involved is very very limited
because both MapView and OpenXcom use data type int to memorize map tile index.

The efforts are to duplicate/parametrize  methods ReadMap and Save in

...\OpenXCOM.Tools-master\OpenXCOM.Tools-master\XCom\GameFiles\Map\XCMapFile.cs

and add an options to choose new file format on saving.

Please TheBigSot what do you think about this request ? Is it difficult ?

remain to change the method that load map into OpenXCom ...
the file extension could drive the method to use (old or new)

Please Warboy figure the result that artists such as Hobbes, Dioxine, Robin, etc etc will get with this simple request.

There are not breaks on previous maps or behaviors.
There are not aggravations on memory or performance because object model use int instead of byte already

Please please please
 :-[

 



Offline volutar

  • Colonel
  • ****
  • Posts: 351
  • Vanilla digger & Quality assistant
    • View Profile
Re: Because we want suffer the 255 tile limits for maps ?
« Reply #1 on: April 03, 2015, 03:59:24 pm »
It's definately a subject to resolve.
But only after TFTD.

Offline robin

  • Commander
  • *****
  • Posts: 1099
  • ULTIMATE ROOKIE
    • View Profile
Re: Because we want suffer the 255 tile limits for maps ?
« Reply #2 on: April 03, 2015, 04:33:39 pm »
255 actually placed into the map, right?
(Does mapview tell you when you reach the limit?)

Offline davide

  • Commander
  • *****
  • Posts: 548
    • View Profile
Re: Because we want suffer the 255 tile limits for maps ?
« Reply #3 on: April 03, 2015, 04:56:51 pm »
It's definately a subject to resolve.
But only after TFTD.

In my opinion, the effort to spend to do it in a very simple away is a 0.1%  respect to complete TFTD
and with it modders could made great things while we wait OpenTFTD

If you do not have time to do it
and
If you and Warboy authorize me,

I could try to made it on OpenXCom
a propose code change.

I conjecture that in OpenXCom there is only a method to change to read 2 byte integer instead that one

I am searching it ....

found:

https://github.com/SupSuper/OpenXcom/blob/master/src/Battlescape/BattlescapeGenerator.cpp

int BattlescapeGenerator::loadMAP(MapBlock *mapblock, int xoff, int yoff, RuleTerrain *terrain, int mapDataSetOffset, bool discovered, bool craft)





« Last Edit: April 03, 2015, 05:10:26 pm by davide »

Offline Hobbes

  • Commander
  • *****
  • Posts: 2055
  • Infiltration subroutine in progress
    • View Profile
Re: Because we want suffer the 255 tile limits for maps ?
« Reply #4 on: April 03, 2015, 06:20:51 pm »
Please Warboy figure the result that artists such as Hobbes, Dioxine, Robin, etc etc will get with this simple request.

davide, I actually had a discussion yesterday on irc with Warboy and I was telling him that the MCD entry limit of the .MAP files isn't an issue for me:
* On the original you had a much lower limit: a map could only have 256 entries (including the BLANKS MCD), and that had to include both the UFO and the XCom craft. You ended up having around 100 or 180 MCD entries available for the terrain, depending on if it was a UFO or Terror site.
* On OpenXCom this limit has been removed: you have 256 entries available for the terrain, plus 256 different entries each for the 'UFO' and the  'craft'. If can design a starting/exit area with 256 entries (the 'craft' map) plus an objective map with 256 different entries (the 'UFO') and 256 other entries for the rest of the maps.
* Furthermore, with some changes to BattlescapeGenerator.cpp you probably could add additional 'UFO' maps to a tactical mission (of any kind, like Base Defense or Assault) and have 1000, 2000, etc. different tiles being used in Battlescape, although each individual .MAP file is still limited to 256 entries.
* The alternative you're proposing is to create a new format into a two byte integer, which would allow for +65000 MCD entries per map, but would require a change not only to OpenXCom but to MapView. But no map designer would even use 1/10 of this capacity - we had the two byte format on UFO2000 where all the .MAP/.MCD files were replaced by .LUA files. But with all this extra capacity, the biggest terrain ever designed by me (or anyone in UFO2000) was Dawn City which used 300 MCD entries.
* The issue why I only used 300 entries is really simple: it takes a huge amount of work to design unique PCK sprites for just 255 or 300 entries. And an even bigger work to design maps that use all those entries. As an example for OpenXcom, I have completed the MCD files for the Area51 terrain and I took months to decide/design its unique 350 sprites (includes both the terrain and the ones used for the 'UFO').
* If you have no limit, then the temptation will be to have all the sprites that you can, even if they don't look as good as the others, or if they are only used in a single map. So the limit actually increases the quality of the terrains due to this factor by forcing the designer to choose the best.
* There are methods that a map designer can already use to gain some additional MCD entries with the current system or reduce the workload, with some clever design of the MCD files. Imagine a terrain is composed of FACTORYA, FACTORYB and FACTORYC .MCD files, with a total of 254 entries used. If you take FACTORYC (the last MCD file loaded into MapView), add additional MCD entries and move the 'Death Tile' entries to those new entries, then you'll go over the 256 limit but designing with MapView will not be an issue since the 'Death Tiles' are usually only used when terrain is destroyed, so you won't use them while designing the map. You can get around ~30 new entries this way, until you reach the 64 Kb file limit on the .PCK file.
* Another method is by creating modular MCD files. Imagine I want to add a special building map that only appears once in the battlefield (the 'UFO'). What I do is to create a new FACTORYD MCD file that contains the different entries for that building and replaces the FACTORYA, while continuing to use the FACTORYB and FACTORYC files so that the building doesn't stand out from the rest. And if the engine allows me to add a 2nd 'UFO' map, then I create FACTORYE & F to replace FACTORYA & B.

(TLDR) In conclusion: changing into a two byte integer and a new .MAP file format would require a lot of work with both OXC and MapView and I personally don't feel the need to move in this direction at this point since the additional capacity it allows will be underused and there are better solutions currently available. A possible future suggestion is to tweak BattlescapeGenerator to increase its ability for adding 'special maps' at the request of the modder.

255 actually placed into the map, right?
(Does mapview tell you when you reach the limit?)

Map View doesn't impose a limit when editing: you can assign 1000 entries to a map. But when saving Map View will save entry 257 as entry 0, 258 as entry 1, etc., since the .MAP file can only have 256 entries per square tile.
To check how many entries the map is currently using select Edit - > Map Info
« Last Edit: April 03, 2015, 06:40:44 pm by Hobbes »

Offline davide

  • Commander
  • *****
  • Posts: 548
    • View Profile
Re: Because we want suffer the 255 tile limits for maps ?
« Reply #5 on: April 03, 2015, 07:35:18 pm »

(TLDR) In conclusion: changing into a two byte integer and a new .MAP file format would require a lot of work with both OXC and MapView and I personally don't feel the need to move in this direction at this point since the additional capacity it allows will be underused and there are better solutions currently available.

I respect your opinion and thank you for the very interesting explanations.

I disagree only on red sentence, I think that the effort required is about an evening ...

Robin what is your opinion  ?


Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Because we want suffer the 255 tile limits for maps ?
« Reply #6 on: April 03, 2015, 09:34:40 pm »
i remember an idea like this
"if height>128 use 2 bytes , height-=128 ; else use 1 byte"
i think i wrote a bit of code in regard to that month ago - it should be somewhere on my harddisk
but it was less than an hour (not sure how much work it would be for mcd edit)
Edit:
my testcase was something like this 4 layer base+3layer ground base
https://openxcom.org/forum/index.php/topic,3036.msg34798.html#msg34798
i could only add the farm mcd on top of the xbase mcd with the 255 limit
so i made a small codechange that used above rule and made python script that combined the 1 byte maps to 2 bytes maps
so i could add polar/city or other stuff on top of the xcombuildings
« Last Edit: April 03, 2015, 09:40:59 pm by Falko »