Jump to content


Photo

PCK Format


  • Please log in to reply
22 replies to this topic

#1 Jenny

Jenny

    Artwork Department

  • Xenocide Artwork Department
  • 428 posts

Posted 16 August 2009 - 11:29 AM

I'm interested in reading PCK(image) files directly into my editor. However, I've been struggling with the PCK format. There's some info on http://www.ufopaedia...age_Formats#PCK, but it seems it just added to my confusion. :)

I tried DaiShiva's PckView, but apparently it's not too fond of Vista, or the other way around. It crashes as soon as I try to open a file.
Posted Image

#2 localhosed

localhosed

    Sergeant

  • Forum Members
  • PipPipPip
  • 41 posts

Posted 16 August 2009 - 03:08 PM

I'm interested in reading PCK(image) files directly into my editor. However, I've been struggling with the PCK format. There's some info on http://www.ufopaedia...age_Formats#PCK, but it seems it just added to my confusion. :)

I tried DaiShiva's PckView, but apparently it's not too fond of Vista, or the other way around. It crashes as soon as I try to open a file.



I don't have answers for you but want to say I couldn't make complete sense of one small pck from the information on that wiki page alone, though having it is helpful. I looked at BIGOB_55.PCK, the smallest pck i could find. It has no TAB so i guess that means there's only one image. Some single image pck's do have TAB files though for some reason. I don't understand why there is this at the end of BIGOB_55.pck - FE FF FE FF FE FF FE FF FF , if FF is supposed to mean the end of sprite data.

I'm sort of not surprised, PCK view can't open that file and i think daishiva was working on being able to load some of those bigobs files.

I'm looking now though at BIGOB_04 which is small and easy to compare to hex data. Its of a pistol clip. The 05 seems to mean 5 rows of transparent pixels, then the image starts. The colors line up when i look at the image that i'll include here. but at the end there is FE FA FE FA FE FA FE FA FE 2E FF I guess that has something to do with filling in the rest of the image in some way. I don't know about that. the EOF FF is at least at the end here though.

This is just what PCK view exports. I am pretty sure it doesnt really contain all that empty space. Or does it? It would be odd to me.
Edit :Are you using the pck view from strategy core? I dont have vista but i wonder if PCK-Tool would work in dosbox? I don't even know where i got PCK Tool, which is named PCK_View.exe - 25,936 bytes, no icon

http://img188.images.../6024/clipc.png

Edited by localhosed, 16 August 2009 - 03:15 PM.


#3 localhosed

localhosed

    Sergeant

  • Forum Members
  • PipPipPip
  • 41 posts

Posted 16 August 2009 - 11:41 PM

Bomb bloke's toolkit has a PCK to GIF convertor with some java source code. Maybe that can help you. I ran it on the sectoid PCK but the GIFs came out looking as though they used the TFTD Battlescape palette when i compared them to that mode in PCKView.

#4 Jenny

Jenny

    Artwork Department

  • Xenocide Artwork Department
  • 428 posts

Posted 17 August 2009 - 01:14 AM

Right I managed to read the first sprite in a PCK file and display it.. problem is I am pretty much guessing width and height so it's a bit deformed. I have no idea how to figure out the dimensions!

Edited by Jenny, 17 August 2009 - 02:33 AM.

Posted Image

#5 localhosed

localhosed

    Sergeant

  • Forum Members
  • PipPipPip
  • 41 posts

Posted 17 August 2009 - 04:37 AM

Right I managed to read the first sprite in a PCK file and display it.. problem is I am pretty much guessing width and height so it's a bit deformed. I have no idea how to figure out the dimensions!



Someplace said most images are 32x40. The BIGOB04 seems to be working when i use those dimensions and draw it out in GIMP pixel by pixel using hex data. Not quite done yet. Ill post when i get to the other data at the end of the file.

Edit 5:37am : Ok, that clip pck fits in a 32x40 image. The rest of the pixels are filled by 4 times FA plus 2E or 1046 pixels of transparency. The first byte is the number of rows before the image starts, filled with transparency. After that you will be drawing at X=0, y=(value of first byte) .For this sized image that gives me the correct sized image. I guess the color bytes are some value stored in one of the four? palette files. I didn't try looking up each byte to draw in GIMP to see it colored.

I heard about non 32x40 images. Havent looked for them yet.

Edited by localhosed, 17 August 2009 - 05:11 AM.


#6 NKF

NKF

    Commander

  • [Global Moderators]
  • PipPipPipPipPipPip
  • 4,798 posts

Posted 17 August 2009 - 05:35 AM

Since his editor set manipulates pck files, perhaps getting in touch with Bomb Bloke would be the best way to work out how they work. There are various rules to them. Some files take tab files while some don't. Working out which palette to use with them is also important when rendering them to screen.

I've not tried it, but I think the key here is to understand the RLE format. When that's worked out, the pck files are then loaded as one big bitmap. You use the offset provided in the .tab file to get the starting position of each 32x40 image.

By the way, having had a few misadventures with the bigobs files, I thought I'd mention this:

units\bigobs.pck is a composite file with multiple 32x40 images. Make use of its tab file to get the starting offset for each image.

ufograph\bigobs_??.pck are individual 32x40 images. These are duplicates of those in units\bigobs.pck, but do not have tab files. I'm assuming that ?? would correspond to the indexes for each tab in the previous file.

The reason we have a duplicate is that one set is used in the inventory screen while one is used in the battlescape screen (i.e. the hand slots). A bit of double handling there, but hey.

- NKF
Lord High Generalissimo Ruler Supreme of Norm's Anti Pedant Society (NAPS).

Number of members: 1

#7 Jenny

Jenny

    Artwork Department

  • Xenocide Artwork Department
  • 428 posts

Posted 17 August 2009 - 10:01 AM

Thanks for the help, guys, but I've figured it out. And yeah, most of them seem to be 32x40.

I plan to incorporate X-com art into the next iteration of my editor, so stay tuned.

Edited by Jenny, 17 August 2009 - 11:37 AM.

Posted Image

#8 localhosed

localhosed

    Sergeant

  • Forum Members
  • PipPipPip
  • 41 posts

Posted 17 August 2009 - 06:56 PM

For years I thought there was a skull in that explosion. My brother told me I was crazy. Its easier to see with the slowed down animation. Congratulations on the editor.

#9 Jenny

Jenny

    Artwork Department

  • Xenocide Artwork Department
  • 428 posts

Posted 18 August 2009 - 01:59 PM

To bring up another point, does anyone know how exactly TFTD handles its palette data? There are only three entries in palettes.dat (as opposed to 5 in x-com), but I read that TFTD changes the palettes on the fly as is needed. Anyone know how exactly this works?

Primary reason for asking is quite simple. I've read in BIGOBS.PCK and none of the default 3 palettes make it look as it should, so either I'm missing something or some kind of of palette swap is needed.
Posted Image

#10 Zombie

Zombie

    Colonel

  • Xenocide Creative-Text Departmen
  • 2,947 posts

Posted 18 August 2009 - 05:36 PM

This may sound like a broken record, but try contacting Bomb Bloke. He knows more about image formats than anyone I know. And he created a mod which adds TFTD items into Enemy Unknown which required a palette swap. ;)

- Zombie
The Mr. Grognard of X-COM

Zombie: Empirical data's your only man, when formulating a research plan.
A soldier's death is never in vain if it makes the formula more plain.
A few dozen make a better case for refining that third decimal place.
They call me Zombie because I don't sleep, as I slowly struggle to climb this heap,
of corpses, data points, and trials, but from the top - I'll see for miles!


#11 localhosed

localhosed

    Sergeant

  • Forum Members
  • PipPipPip
  • 41 posts

Posted 18 August 2009 - 08:23 PM

To bring up another point, does anyone know how exactly TFTD handles its palette data? There are only three entries in palettes.dat (as opposed to 5 in x-com), but I read that TFTD changes the palettes on the fly as is needed. Anyone know how exactly this works?

Primary reason for asking is quite simple. I've read in BIGOBS.PCK and none of the default 3 palettes make it look as it should, so either I'm missing something or some kind of of palette swap is needed.



I'm at the point trying to understand how to use the 64 possible intensities for the rgb colors in the palettes like the ufopaedia.org page says. I guess the hidden TFTD palettes are the four ones bomb bloke wrote about on this page under "TFTD Tactical Palettes" : http://www.ufopaedia...le=PALETTES.DAT

If i understand it right, that #1 of these hidden ones would be used for bigobs.

Edit: Nope, I don't understand whats going on with value (aka what BB calls intensity i think) yet like i thought i did. Bummer. So i can't help like i thought i could yet.

Maybe Seb76 or one of those programming wizards would know. Yes, especially bomb bloke since i found today that he wrote that page.

Tripled Edit : Wait yes. Ill rewrite what i suggested but that you probably already tried. If you take the color from bb's PNG's on the '4 hidden' TFTD palettes, you can then reduce the color's value to "25%" in GIMP or whatever the correct equivalent is using the 64 shade system (i guess it'll be "0" the lowest possible). Then you could search for those rgb bytes in the executable. But if tftd doesn't store them in the normal way and instead uses some method to modify other palettes, then searching for them might not work. I wouldn't have an idea of how to find them. Maybe a code wizard like Seb76 would know though.

Edited by localhosed, 18 August 2009 - 09:28 PM.


#12 NKF

NKF

    Commander

  • [Global Moderators]
  • PipPipPipPipPipPip
  • 4,798 posts

Posted 19 August 2009 - 02:04 AM

The four special Tactical palettes are probably just one (the land palette). See how the game adjusts the blue element of each colour index for their corresponding depths. It probably multiplies the depth by a certain value and adds it to the blue element for each palette entry (in increasing intensity for each colour set). See the black bar between cyan and orange and how everything has blue added to them.

- NKF

Edited by NKF, 19 August 2009 - 02:16 AM.

Lord High Generalissimo Ruler Supreme of Norm's Anti Pedant Society (NAPS).

Number of members: 1

#13 localhosed

localhosed

    Sergeant

  • Forum Members
  • PipPipPip
  • 41 posts

Posted 19 August 2009 - 07:24 PM

The four special Tactical palettes are probably just one (the land palette). See how the game adjusts the blue element of each colour index for their corresponding depths. It probably multiplies the depth by a certain value and adds it to the blue element for each palette entry (in increasing intensity for each colour set). See the black bar between cyan and orange and how everything has blue added to them.

- NKF



Well for the first of the four he has it labelled "1. Land & Inventory Displays." . I interpret that as meaning for what i think bigobs are used for in inventory. I guess. I like the underwater colors and light levels, weirder than UFO in my opinion.

#14 hatfarm

hatfarm

    Sound Department

  • Xenocide Sound Department
  • 133 posts

Posted 14 October 2009 - 08:38 AM

Jenny, can I ask you how you create those colors exactly? I've been using color.fromARGB() to create my colors, but when I'm loading the aliens from the UFOPaedia, I'm getting some very dark images. I'm wondering if maybe I'm using 32 bit colors incorrectly, I understand it's only 8 bit colors, but to get the correct color, I've only been able to use the 32 bit setting. It might be completely different in openGL, but hopefully you can shed some light on what might be weird about this. Thanks.

#15 Jenny

Jenny

    Artwork Department

  • Xenocide Artwork Department
  • 428 posts

Posted 15 October 2009 - 04:01 AM

Jenny, can I ask you how you create those colors exactly? I've been using color.fromARGB() to create my colors, but when I'm loading the aliens from the UFOPaedia, I'm getting some very dark images. I'm wondering if maybe I'm using 32 bit colors incorrectly, I understand it's only 8 bit colors, but to get the correct color, I've only been able to use the 32 bit setting. It might be completely different in openGL, but hopefully you can shed some light on what might be weird about this. Thanks.


The textures were that dark for me as well, so I just amplified them (by about 140% if I recall correctly).

Hope this helps.
Posted Image

#16 hatfarm

hatfarm

    Sound Department

  • Xenocide Sound Department
  • 133 posts

Posted 15 October 2009 - 07:12 AM

The textures were that dark for me as well, so I just amplified them (by about 140% if I recall correctly).

Hope this helps.


Yeah, that helps a lot. I just wanted to make sure it wasn't me doing something stupid. So, I guess I'll just have to do the same. Thanks a lot.

#17 Yuri Torban

Yuri Torban

    Squaddie

  • Forum Members
  • PipPip
  • 2 posts

Posted 21 June 2011 - 06:38 AM

Hello. Im trying to recover my old ufo creations.
I got a nice Green Ethereal Pck years ago, and modded it with, adding eyes. The eyes flashing when the alien walks:


Posted Image

Still ethereal and walking ethereal.

The problem is:
I dont know why, but in my old pc with Ufo dos version it worked fine. But now, the alien is garbled in teh tactical game.
I edited it years ago and convert the PCK file with the old Win PCK v0.5, but the newest Pck visors (PckView, CnView, XcWiev...) dont works with this file. They dont open the archive.
I want to open the file for further work in it.

¿Any tips?

Edited by Yuri Torban, 21 June 2011 - 06:57 AM.

UFO: The best game ever

#18 NKF

NKF

    Commander

  • [Global Moderators]
  • PipPipPipPipPipPip
  • 4,798 posts

Posted 22 June 2011 - 01:22 AM

From what I remember back when I was fiddling with changing sprites and inventory images, pckview is a little broken when it imports images and saves them as PCK files. Every time I used the modified PCK files, the images would get garbled and make the game very unstable.

I don't think pckview is saving them correctly. If the other image converters you're using are causing the same problems, then it may be the same problem.

The best tool I can probably recommend for importing images and making new pck files is included in Bomb Bloke's tool kit:

http://www.strategyc...ex.php?dlid=683

All of the modified images I've done with it so far have worked properly.

- NKF

Edited by NKF, 22 June 2011 - 01:23 AM.

Lord High Generalissimo Ruler Supreme of Norm's Anti Pedant Society (NAPS).

Number of members: 1

#19 Yuri Torban

Yuri Torban

    Squaddie

  • Forum Members
  • PipPip
  • 2 posts

Posted 22 June 2011 - 03:40 AM

Thanks

I got the BB tool, made a .bat file and extracted a unmodded file. It works. A nice folder with a bunch of gifs suddenly apeared.
The problem was my bugged ethereal file. The folder created by the tool is empty. My file is corrupted.

I must make the entire process again... for the begining.

---

I downloaded the fenix green ethereal from this site:
http://freelancer.ag...index_eng.shtml
but the images are bmps

The problem is: I dont have the original green ethereal .pak, but a copule of .bmp images.

-Anybody has a healhty green ethereal .pak?

-Must I convert all the 75 bmp files to 75 .gifs?

-Can I change the orange for the green in the .tab file instead?

-Can anybody handdle my green "ethereal with eyes" atached file?

Attached Files


Edited by Yuri Torban, 22 June 2011 - 03:45 AM.

UFO: The best game ever

#20 Yuri Torban

Yuri Torban

    Squaddie

  • Forum Members
  • PipPip
  • 2 posts

Posted 22 June 2011 - 01:45 PM

Meanwhile I modded the default orange (I hate the orange ethereal coat) with the BBtool Pck converter.
Some colours are fine. The yellow eyes moving are ok, but the red is bugged. Apears as grey. Tried other tones with photoshop but dont work. All red tones are grey in game. View image:

Posted Image
Still ethereal and walking ethereal, with the eyes lighting...nice.

I converted other pcks and seems the red colour is converted as grey.

Any solutions for the red colour?

Edited by Yuri Torban, 22 June 2011 - 01:48 PM.

UFO: The best game ever

#21 Yuri Torban

Yuri Torban

    Squaddie

  • Forum Members
  • PipPip
  • 2 posts

Posted 24 June 2011 - 01:04 PM

Unable to repair the bugged red eyes, I tried with PCKview114. The file handle bmps and with this formate I got the eye red. But the picture is garbled at battlescape.

Partial solution: the inmobile ethereal hasn´t visible eyes. Only at move its flashing.

The file is atached. Replace ethereal.pck and ethereal.tab in UNITS folder. And of course, make a backup of the original files.

Posted Image

Download it and enjoy the nice feature!

Attached Files


Edited by Yuri Torban, 24 June 2011 - 05:55 PM.

UFO: The best game ever

#22 Yuri Torban

Yuri Torban

    Squaddie

  • Forum Members
  • PipPip
  • 2 posts

Posted 24 June 2011 - 03:19 PM

At last!

I recovered my old ethereal from an ancient CD.
I putted it in UNITS folder and the game recognices it at once.

Posted Image
The green coat ethereal (Thanks Fenix) with with red eyes that light up when walking.


Make a backup of the original files. Download the zip, and put the etehreal.pck and ethereal.tab in the UNITS folder.

Attached Files


Edited by Yuri Torban, 24 June 2011 - 06:04 PM.

UFO: The best game ever

#23 Yuri Torban

Yuri Torban

    Squaddie

  • Forum Members
  • PipPip
  • 2 posts

Posted 24 June 2011 - 03:54 PM

Another PCK one: The Xcom2 biodrone.
The original one is bugged. Without the apropiate animation and a still green patch moving atached.

Posted Image


I remade it, cleaning the rays and restoring the spinning and "under radiate" animation:

Posted Image

Download, unzip and replace the biodron.pck and biodron.tab in the units folder. Make a bakup.

Enjoy it.

Attached Files


Edited by Yuri Torban, 24 June 2011 - 03:54 PM.

UFO: The best game ever