aliens

Author Topic: OpenXcom supports only 8bit images.  (Read 3121 times)

Offline Zeta Reticulan

  • Captain
  • ***
  • Posts: 65
    • View Profile
OpenXcom supports only 8bit images.
« on: February 15, 2023, 10:41:35 pm »
Hi everybody,
I created a resprite mod for the heavy cannon. When I start the game, I get this error message: "OpenXcom supports only 8bit images". All I did was download some sprites I found on this forum, and edited them with Paint. What can I do to make it work? I attached my mod to this message incase someone wants to take a look at it. Thank you all in advance.
« Last Edit: February 16, 2023, 02:09:35 am by Zeta Reticulan »

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: OpenXcom supports only 8bit images.
« Reply #1 on: February 16, 2023, 06:46:23 am »
The images were not in the correct palette.

I put them in the UFO Battlescape palette but unfortunately there was some quality loss. A few pixels on the BigOb and one on the FloorOb shifted their gray a bit.

All I did was download some sprites I found on this forum, and edited them with Paint. What can I do to make it work?
Some image editors can cause problems with the X-Com palette as they try to be helpful and alter the palette when you create your image file.

Here is a list of image editors that have been found to work correctly:
https://openxcom.org/forum/index.php/topic,2676.0.html

You can get the X-Com palette files from this post:
https://openxcom.org/forum/index.php/topic,1557.0.html

And this site can be handy for automatically convert images to the correct palette:
https://buscher.eu.pythonanywhere.com/spritepalette


Although GIMP is grouped the amongst the programs that mess up the palette I've been using it to edit X-Com images successfully.

The important thing to do with GIMP is to select "Image -> Mode -> RGB" Then "Image -> Mode -> Indexed -> Use Custom Palette -> Select X-Com palette" right before exporting. (Just swap the mode back and forth right before export. Strange but it works... most of the time.)

Make sure that "Remove unused and duplicate colors from colormap" is left unchecked in the 'Indexed' menu.

When choosing your file type .png is the best choice as .gif has problems with some Macs.
« Last Edit: February 16, 2023, 07:28:14 am by The Martian »

Offline Zeta Reticulan

  • Captain
  • ***
  • Posts: 65
    • View Profile
Re: OpenXcom supports only 8bit images.
« Reply #2 on: February 16, 2023, 08:23:46 pm »
Thanks, Martian, you've been a great help to my modding journey. Those sprites look great even though you said some quality was lost. I ran into another problem though. I can equip my soldiers and start the mission with no problems, but as soon as I move a soldier, the game will crash with this error message:

"OpenXcom has crashed: Frame(s) missing in 'HANDOB.PCK' for item 'STR_HEAVY_CANNON'

What could be causing the problem? We both know the HANDOB sprite is included in the mod. Do you think it'll help if I separated the images into 8 separate sprites?


Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11408
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: OpenXcom supports only 8bit images.
« Reply #3 on: February 16, 2023, 11:13:58 pm »
What is your handob definition? I mean, what ID did have you used for your new item's handob?

Shooting in the dark, you overwrote some vanilla numbers with your modded content.

Offline Zeta Reticulan

  • Captain
  • ***
  • Posts: 65
    • View Profile
Re: OpenXcom supports only 8bit images.
« Reply #4 on: February 16, 2023, 11:34:54 pm »
Hi Solarius,
I originally gave my handob the ID of 128. I did suspect I might have overwritten some vanilla sprites, so I changed it to 228, but it still gave the same error.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11408
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: OpenXcom supports only 8bit images.
« Reply #5 on: February 17, 2023, 12:09:39 am »
228 certainly isn't correct. Like you noted, each handob consists of 8 separate graphics (facings), so the first handob is 0...7, second is 8...15, third is 16...23, etc. And number 228 does not fit here. Try 224 instead?

Nevertheless, I don't know if this is the core of your problem. Give it a try!

Offline Zeta Reticulan

  • Captain
  • ***
  • Posts: 65
    • View Profile
Re: OpenXcom supports only 8bit images.
« Reply #6 on: February 17, 2023, 12:43:38 am »
I never thought the count started at 0! I will give it a try tomorrow and report back.

---- posts merged - Solarius Scorch ----

By the way. Does coloring the background of my sprites that green color make the game automatically interpret that as transparent?
« Last Edit: February 17, 2023, 12:50:25 am by Solarius Scorch »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11408
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: OpenXcom supports only 8bit images.
« Reply #7 on: February 17, 2023, 12:50:11 am »
The first colour in the palette is always transparent. It doesn't matter how it looks outside of the game (in a graphic editor).

I personally use an actually transparent colour for this, because this green background (or pink, or whatever) makes my eyes bleed and I can't see the actual sprite well. But it's up to you.

Offline Zeta Reticulan

  • Captain
  • ***
  • Posts: 65
    • View Profile
Re: OpenXcom supports only 8bit images.
« Reply #8 on: February 17, 2023, 05:13:22 pm »
Changing the number did not work. However, I was able to get it to work by separating my HANDOB sprites into 8 separate sprites, and listing them all in my ruleset, like this:

items:
  - type: STR_HEAVY_CANNON
    bigSprite: 57
    floorSprite: 73
    handSprite: 129
    handSprite: 130
    handSprite: 131
    handSprite: 132
    handSprite: 133
    handSprite: 134
    handSprite: 135
    handSprite: 136
    invWidth: 2
    invHeight: 3

extraSprites:
  - type: BIGOBS.PCK
    files:
      57: Resources/RT-20_bigob.png
 
  - type: FLOOROB.PCK
    files:
      73: Resources/RT-20_floorob.png   
 
  - type: HANDOB.PCK
    files:
      129: Resources/RT-20_handob_129.png
      130: Resources/RT-20_handob_130.png
      131: Resources/RT-20_handob_131.png
      132: Resources/RT-20_handob_132.png
      133: Resources/RT-20_handob_133.png
      134: Resources/RT-20_handob_134.png
      135: Resources/RT-20_handob_135.png
      136: Resources/RT-20_handob_136.png
 
Edit: What I did was, instead of having 1 long 256x40 strip with all 8 sprites, I separated each of the 8 sprites into its own 32x40 image.
 
     
« Last Edit: February 18, 2023, 12:30:20 am by Zeta Reticulan »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8598
    • View Profile
Re: OpenXcom supports only 8bit images.
« Reply #9 on: February 17, 2023, 05:36:23 pm »
That definitely doesn't work.
You cannot define handSprite multiple times... or any other item attribute for that matter.
The game will load only one of them, RANDOMLY.

Offline Zeta Reticulan

  • Captain
  • ***
  • Posts: 65
    • View Profile
Re: OpenXcom supports only 8bit images.
« Reply #10 on: February 17, 2023, 05:50:34 pm »
I have no idea why it worked on my game. I tested it out and everything was good. I even made some screenshots.
« Last Edit: February 17, 2023, 06:05:51 pm by Zeta Reticulan »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8598
    • View Profile
Re: OpenXcom supports only 8bit images.
« Reply #11 on: February 17, 2023, 07:42:49 pm »
It worked by accident.
Figure out which 7 are unnecessary and delete them, otherwise it may not work later or for other people.

Offline Zeta Reticulan

  • Captain
  • ***
  • Posts: 65
    • View Profile
Re: OpenXcom supports only 8bit images.
« Reply #12 on: February 17, 2023, 08:25:18 pm »
What I did was, instead of having 1 long 256x40 strip with all 8 sprites, I separated each of the 8 sprites into its own 32x40 image. I tested it out at least 5 times. If you don't mind, Meridian, I've attached my finished mod to this message, will you install it and see if you run into any problems?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8598
    • View Profile
Re: OpenXcom supports only 8bit images.
« Reply #13 on: February 17, 2023, 09:42:41 pm »
Splitting sprites into 8 separate images is not a problem.

Problem is the handSprite duplication.

I mean no disrespect, but I don't need to download and try. I know for sure it doesn't work.

Offline Zeta Reticulan

  • Captain
  • ***
  • Posts: 65
    • View Profile
Re: OpenXcom supports only 8bit images.
« Reply #14 on: February 17, 2023, 10:18:12 pm »
Splitting sprites into 8 separate images is not a problem.

Yes, that's exactly what I did. I split them into 8 separate images. I made sure I didn't duplicate any sprites.