Author Topic: PCK View issues  (Read 22126 times)

Offline davide

  • Commander
  • *****
  • Posts: 565
    • View Profile
Re: PCK View issues
« Reply #15 on: June 28, 2014, 03:34:15 pm »
I apologize for the delay  :-[

I think that the problem is an overflow in .TAB files

It contains position in PCK  in which begin the tiles.

The index was momorized by 2 byte (unsigned short).
The max value allowed is 65536.

When the size of pck file grow over that dimesion,
or better when a new tile begin after that position,
the TAB file is corrupted because the index of the new tiled was saved with an overflow
therefore them point on previous tile image at strange, but constant, position.

There is not a solution because it is connect to file format
 (same problem than maps ...sigh  :'()

 I will add a block in PCKView  to limit max number of tiles to  avoid the someone  loose
time about it.

You, correctly just ipotized that problem was connected with max tile numbers.

TAB file for TFTD Unit have 4 byte slot index.
This option was asked by PCKView before saving: the second  option enable it.

I could will correct PCKView/Mapview to recognize the format  2/4 byte index by compare file size with first entry (the tiles count).

But
The MCDEdit sorce code are not public
and
I do not know if OX engine is ables to read them without  a fix.

We need a new file formats at list to break the size limits imposed by pc performance of 1994

backward compatibility is mandatory and
all tools and engine could be aligned to support both file formats: (map, pck, tab, mcd) versus (map2, pck2, tab2, mcd2)

An analisy of requirements it is desirable.
« Last Edit: June 28, 2014, 04:16:44 pm by davide »

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: PCK View issues
« Reply #16 on: June 28, 2014, 08:40:25 pm »
OK, thanks for all the work, it's nice to know exactly what is happening rather than personal conjecture.

Quite honestly, I don't think that this is a big deal since this only happened because I'm pushing the limits of the MCD/PCK/TAB files with a terrain I am redesigning and I was expecting that something like this might appear.

The best way to avoid this issue is to do what already happens with all terrains: split the tiles between different tilesets so that each individual TAB file does not go over the limit.

However the reason why the TAB file went over the limit is related to the MapView editor, since it has a limit of 256 tiles that can be used to design maps. If you use more than 256 tiles, then the reference numbers are reset from 0 and the map gets wrong when saved since it will contain the indication of using tile #10 on location x,y,z instead of using tile #266, which was what I wanted.

The reason why my TAB file got so big was that I realized that some tiles are never used when designing maps, namely the tile replacements for walls, objects, etc., when they get hit by gunfire. And so, I design the last tileset so that those tile replacements have numbers above #256 they'll never be needed to use on MapView, and I can use more than 256 tiles on OpenXcom, although I'll only use the first 256 tiles while designing maps with MapView. So I started to move those tile replacements to the end of the file and add new tiles instead but those but when I reached the 64kb limit that's when the graphic problems started.

Like I said, this isn't a big issue, since there aren't much more tile replacements that I can move. I had already moved 30 out of 40 to the end of the files before the graphic issues started, so the possible gains from changing MapView/PCKVIew/MCDEdit are not worth the effort for this case.

But thanks a lot for the assistance, it gets a lot easier (and less frustrating) when you realize that it is an actual limit derived from the file format rather than you're doing something wrong. :)

Offline TheBigSot

  • Sergeant
  • **
  • Posts: 44
  • Fight, Die, Repeat.
    • View Profile
Re: PCK View issues
« Reply #17 on: July 17, 2014, 06:08:21 am »
Ok question:

1- The maximun limit Tiles allowed for UFO is 65536, and MapView has a bug that limits it to 256?

Offline davide

  • Commander
  • *****
  • Posts: 565
    • View Profile
Re: PCK View issues
« Reply #18 on: July 17, 2014, 07:34:29 am »
The limit was into file format

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: PCK View issues
« Reply #19 on: July 17, 2014, 02:41:36 pm »
Ok question:

1- The maximun limit Tiles allowed for UFO is 65536, and MapView has a bug that limits it to 256?

The terrain limits for the original game are as follows:
* There's a maximum of 10000 squares (e.g. 50x50x4) on its total size when generating the battlescape. On OpenXCom this limit has been removed.
* Each terrain can have 256 tiles (the individual ground/walls/objects used on the squares) assigned. On OpenXCom this limit has been increased, but the .MAP file format still has the 256 tile limit. 

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Re: PCK View issues
« Reply #20 on: July 17, 2014, 03:01:18 pm »
the .MAP file format still has the 256 tile limit.
Does that mean the sum of all the tiles from all the terrains associated to the map, or only the tiles actually *placed* on the map (so you can have a map with 256 terrains, using only 1 tile from each of them)?

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: PCK View issues
« Reply #21 on: July 17, 2014, 03:29:16 pm »
Does that mean the sum of all the tiles from all the terrains associated to the map, or only the tiles actually *placed* on the map (so you can have a map with 256 terrains, using only 1 tile from each of them)?

First a little clarification of my terminology, otherwise things get confusing :)
* A terrain is used to create a battlescape and is composed by both tilesets and maps (or map blocks)
* Tilesets are composed each of a MCD, PCK and TAB file. They contain 'tiles' or the components (ground, walls, objects) used on each map square. Usually there is more than 1 tileset associated with a terrain since the PCK files have a limit of 64 Kb.

So, regarding your question, the 256 limit applies to the sum of all tiles present on the tilesets associated with a terrain.

Offline davide

  • Commander
  • *****
  • Posts: 565
    • View Profile
Re: PCK View issues
« Reply #22 on: July 17, 2014, 03:44:06 pm »
A Terrain is based on a "Data Sets"
A Data Set  is composed by concatenate a group of .PCK that contain the tile set

the map contain for each cell,  4  tile index of the current data Set.
Each index is memorized by a single byte and it is the limit.

as example the terrain URBAN used by TERROR_MISSION is defined by a data set composed by 5 file .PCK
The maps of this terrain contain index of the sum of tiles contained into the referred PCKs.
If you change order of PCK, or add one tile into a PCK of the current Data set,
 the index change too and your maps result corrupted.
therefor If two maps are designed with different Data Set , them are incompatible.

Code: [Select]

terrain:
- name: URBAN
    mapDataSets:
      - BLANKS
      - ROADS
      - URBITS
      - URBAN
      - FRNITURE


« Last Edit: July 17, 2014, 03:47:17 pm by davide »

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Re: PCK View issues
« Reply #23 on: July 17, 2014, 04:06:20 pm »
I knew about the "strict order" thing. Anyway thank you both for the clarifications (and sorry for the derailment, since the topic was about PCKView).

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: PCK View issues
« Reply #24 on: July 17, 2014, 04:10:12 pm »
kind of off-topic, but does any of you have an idea why opening INTICON.PCK only shows me the first five icons? same with BASEBITS.PCK, for that matter. I'd really like to extract the craft weapon icons from both files, but I'm stuck.

Offline davide

  • Commander
  • *****
  • Posts: 565
    • View Profile
Re: PCK View issues
« Reply #25 on: July 17, 2014, 04:21:27 pm »
Do you hane try with MCDEdit or BBTools ?

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: PCK View issues
« Reply #26 on: July 17, 2014, 04:25:49 pm »
No... I guess I should. Do the BBTools extract any pck image?

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: PCK View issues
« Reply #27 on: July 17, 2014, 04:33:39 pm »
here

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: PCK View issues
« Reply #28 on: July 17, 2014, 05:14:28 pm »
thank you!

Offline TheBigSot

  • Sergeant
  • **
  • Posts: 44
  • Fight, Die, Repeat.
    • View Profile
Re: PCK View issues
« Reply #29 on: August 03, 2014, 08:26:14 pm »
The terrain limits for the original game are as follows:
* There's a maximum of 10000 squares (e.g. 50x50x4) on its total size when generating the battlescape. On OpenXCom this limit has been removed.
* Each terrain can have 256 tiles (the individual ground/walls/objects used on the squares) assigned. On OpenXCom this limit has been increased, but the .MAP file format still has the 256 tile limit.

Thanks for the info, I will review if possible