Author Topic: Adding New Image Files  (Read 15477 times)

Offline kaiser_bill

  • Squaddie
  • *
  • Posts: 7
    • View Profile
Adding New Image Files
« on: July 05, 2013, 08:54:03 pm »
Sorry to bother with yet another question.  This time about new images.

I've been trying to add a new sprite sheet.  I unpacked the XCOM_1 pck file (the Personal Armour one) using Bomb Bloke's pck2gif program.  After making the alterations to the sprites I wanted to, I packed them as a pck file and then unpacked them back to gifs (otherwise I've ended up with palette issues which this seems to solve).

By the end, I have a two hundred orso gifs for the sprites, which I place in a folder in the OpenXcom data folder.  In my ruleset file, I tried using code borrowed from elsewhere and adjusted to fit:

extraSprites:
  - type: XCOM_3.PCK
    width: 32
    height: 40
    files:
      0: Resources/WillsModImages/ShieldedArmour/XCOM_3/

The armour I've added is set to use the XCOM_3.pck spite sheet which (should have been) created in-game.

When doing this, however, upon loading the game I get an error saying that the files are not a compatible type and the game will not load.  I've had the same issue when attempting to load pre-existing mods which use image files.  I tried to use the Combat Armour mod as a test, using the mod exactly as is and removing my own, and the same thing happened.

I also had the same problem with the Combat Knife mod.  However, I was able to manually input the load for each file individually with the Combat Knife mod and this made it work.  So, I tried this with my own sprite sheet, ending up with something like:

extraSprites:
  - type: XCOM_3.PCK
    width: 32
    height: 40
    files:
      0: Resources/WillsModImages/ShieldedArmour/XCOM_3/xcom_03_000_0.gif
      1: Resources/WillsModImages/ShieldedArmour/XCOM_3/xcom_03_001_0.gif
      2: Resources/WillsModImages/ShieldedArmour/XCOM_3/xcom_03_002_0.gif
      ... all the way down to ...
     274: Resources/WillsModImages/ShieldedArmour/XCOM_3/xcom_03_274_0.gif

Doing this has the positive effect of making the game load.  However, when I attempt to load a battle with a soldier equipped in the armour, the game immediately crashes.  I thought this might have been caused by the numbers being marked wrong, but I've checked it at least three times now and they're all correct.

Any thoughts on what the issue might be?  I'm using the most up-to-date build (as of yesterday, anyway!).  I've also been successful in adding other images into the game.  I note, however, that all the others use existing sprite sheets rather than creating a new one.  So, this seems to be the problem, but I don't understand why when other mods (apparently) create new sheets unproblematically.  Any help would be - again - appreciated.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Adding New Image Files
« Reply #1 on: July 05, 2013, 09:20:38 pm »
try converting them to png maybe? sounds like an sdl_image problem

Offline kaiser_bill

  • Squaddie
  • *
  • Posts: 7
    • View Profile
Re: Adding New Image Files
« Reply #2 on: July 05, 2013, 10:50:05 pm »
Works a treat.  Thanks once again!

Offline Star Commander

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Re: Adding New Image Files
« Reply #3 on: July 06, 2013, 05:03:46 pm »
Er, hi!  Another newbie with similar issues.  sorry to jump on your topic Kaiser, but rather than start another one for basically the same thing...

Been tinkering with my Open-X-Com install, currently trying to replace the Interceptor with a trio of 'Real World' fighter planes (okay, two real and one movie plane)  Got the Ufopedia images to work just fine now.  All the ruleset stuff is done.  It's just the remaining icons I'm having trouble with.

Using your 'Sentinel' as a guide Warboy, I've created _base, _dogfight and _minimized icons for all four craft (planning an advanced plane that falls between the starting three and the Firestorm.  Another movie plane).  Images are of the right size, and imported the colour palettes.  Added the 'extrasprite' lines in the Ruleset, and pointed the 'craft' to those new icons (BTW... how does the game know which dogfight/minimized icons to use?)

Game loads, but as soon as I go to the base screen... CTD  With both .gif and .png formats. :'(

Not sure what I'm doing wrong.

Oh, and on a related topic... can't get the Moriarty Power suits to work either :(

Though do need to try the latest build; running the 22/6 build ATM.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Adding New Image Files
« Reply #4 on: July 06, 2013, 11:07:44 pm »
minimized icon = sprite index in INTICON,
dogfight icon = sprite index + 11 in INTICON,
base sprite = sprite index + 33 in BASEBITS.

hence the padding in the sentinel.

if that makes sense.

it would probably make sense to seperate these, or i could just make a mod designing tool with this logic built in.

Offline Star Commander

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Re: Adding New Image Files
« Reply #5 on: July 06, 2013, 11:39:21 pm »
minimized icon = sprite index in INTICON,
dogfight icon = sprite index + 11 in INTICON,
base sprite = sprite index + 33 in BASEBITS.

hence the padding in the sentinel.

if that makes sense.

it would probably make sense to seperate these, or i could just make a mod designing tool with this logic built in.

Okay... so, 'Sprite Index' value would be...?  Sorry but I'm not really up on all the details of how this all works yet.  I get that the 'Sprite Index' is the list of all the sprites in the game files, and that each should be unique (right?)...

Here, this is what I've got right now under 'extrasprites':
Code: [Select]
  - type: BASEBITS.PCK
    files:
      54: Resources/BASEBITS/Sentinel_Base_View.gif
      55: Resources/BASEBITS/Raptor_Base.png
      56: Resources/BASEBITS/Firefox_Base.png
      57: Resources/BASEBITS/Typhoon_Base.png
      58: Resources/BASEBITS/Talon_Base.png
  - type: INTICON.PCK
    files:
      21: Resources/INTICON/Sentinel_Minimized.gif
      22: Resources/INTICON/Raptor_Minimized.png
      24: Resources/INTICON/Firefox_Minimized.png
      25: Resources/INTICON/Typhoon_Minimized.png
      26: Resources/INTICON/Talon_Minimized.png
      32: Resources/INTICON/Sentinel_Dogfight.gif
      33: Resources/INTICON/Raptor_Dogfight.png
      34: Resources/INTICON/Firefox_Dogfight.png
      35: Resources/INTICON/Typhoon_Dogfight.png
      36: Resources/INTICON/Talon_Dogfight.png

What should that be?

Of course, all of this has become null and void now.  I downloaded the latest build just after posting, intending to upgrade the build.  Spent a good while (half hour/hour) pulling all my modded stuff into a ruleset mod file (like you recommended in another thread)... only for the game to stop working :'(

Only the 0.9 stable build works :(  Not even a fresh install of 0.9 and the 22/6 build works.  Throws up the 'unsupported image format' error on start up...

Can still play (my saves were all done with the stable build), but... I wanna play with Firefoxes, combat knifes and grenade launchers!

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Adding New Image Files
« Reply #6 on: July 07, 2013, 12:29:11 am »
  - type: STR_SKYRANGER
    sprite: 0

sprite index = 0

  - type: STR_INTERCEPTOR
    sprite: 3

sprite index = 3
so assuming the sprite index for the raptor is 22, that is correct. the firefox, typhoon and talon are wrong, because you skipped the number 23.

as for the unsupported image format stuff... well, a couple of things.

first, enable debug mode in your config, load the game to the main menu (or as far as you can) and post your openxcom.log

this may be a problem with SDL image not being built properly on the git bot, if you're on windows, try downloading THIS version, that i built myself, i'll pester michal to look at the build bot settings.

Offline 54x

  • Colonel
  • ****
  • Posts: 208
    • View Profile
Re: Adding New Image Files
« Reply #7 on: July 07, 2013, 03:41:36 am »
You're also using some .gif files- last time someone had unsupported image they switched them to PNGs and suddenly the error dropped.

Offline Star Commander

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Re: Adding New Image Files
« Reply #8 on: July 07, 2013, 09:15:55 am »
You're also using some .gif files- last time someone had unsupported image they switched them to PNGs and suddenly the error dropped.

Tried that.  Those .gif's are Warboy's so they should work (must admit, in my save game haven't actually gotten a Firestorm yet, for which I'm using the Sentinel images)

  - type: STR_SKYRANGER
    sprite: 0

sprite index = 0

  - type: STR_INTERCEPTOR
    sprite: 3

sprite index = 3
so assuming the sprite index for the raptor is 22, that is correct. the firefox, typhoon and talon are wrong, because you skipped the number 23.

Sadly, it's the Raptor that's messing up.  Haven't bought of the other two (the Raptor is to replace the standard Interceptor.  The others are add-ons)

But well spotted on that number error.  Whoops! :-[

Quote
as for the unsupported image format stuff... well, a couple of things.

first, enable debug mode in your config, load the game to the main menu (or as far as you can) and post your openxcom.log

this may be a problem with SDL image not being built properly on the git bot, if you're on windows, try downloading THIS version, that i built myself, i'll pester michal to look at the build bot settings.

Tried debug, this is what I got:
Code: [Select]
[07-07-2013 06:47:26] [INFO] Ruleset loaded successfully.
[07-07-2013 06:47:26] [INFO] Loading resources...
[07-07-2013 06:47:26] [ERROR] GEODATA/PALETTES.DAT not found

But then I had a look... that attempt was without all the data folders *facepalm*

So... unpacked the backup I made before I download the 22/6 build...  Copy across the data stuff.  The build you linked above works... as does the 5/7 build!

Now tried with the extra ruleset (question: if something is in the stock ruleset & a Mod ruleset, does the Mod one override the Stock?).  No crash on boot, and error log says loaded:

Code: [Select]
[07-07-2013 07:10:59] [INFO] Adding/Replacing items in surface set: BASEBITS.PCK
[07-07-2013 07:10:59] [INFO] Adding frame: 54, using index: 1054
[07-07-2013 07:10:59] [INFO] Adding frame: 55, using index: 1055
[07-07-2013 07:10:59] [INFO] Adding frame: 56, using index: 1056
[07-07-2013 07:10:59] [INFO] Adding frame: 57, using index: 1057
[07-07-2013 07:10:59] [INFO] Adding frame: 58, using index: 1058

But when I go to a base with a Interceptor/Raptor there... CTD

Still, at least I'm back to where I was when I first posted :)  Progress, of a sort.

Sorry to be such a pain guys.  Really do appreciate all the help.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Adding New Image Files
« Reply #9 on: July 07, 2013, 10:47:28 am »
it'll be a lot easier for me to diagnose if you post the mod/pm it to me

Offline Star Commander

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Re: Adding New Image Files
« Reply #10 on: July 07, 2013, 11:57:10 am »
Attached.  Ruleset and images.

Thanks for having a look at this :D  I suspect it's something really obvious and silly that I've forg0tten or missed...

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Adding New Image Files
« Reply #11 on: July 07, 2013, 12:28:32 pm »
they're all set to use sprite 3...

also: line 127/128: uuuuuh..... whut?

i changed them to use sprite 22, 23 and 24 and suddenly this:


Offline Star Commander

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Re: Adding New Image Files
« Reply #12 on: July 07, 2013, 01:05:47 pm »
they're all set to use sprite 3...

also: line 127/128: uuuuuh..... whut?

i changed them to use sprite 22, 23 and 24 and suddenly this:

Set to sprite 3 to allow the game to work.  The line thing...  :-[ I lump all the mods I use in one ruleset (to avoid duplicates, plus that's how I work, like to have everything in one place)  Missed a line...

I guess my palettes are still wrong... :'(  Well, at lest you've got them in game :D

Offline tyran_nick

  • Captain
  • ***
  • Posts: 59
    • View Profile
Re: Adding New Image Files
« Reply #13 on: August 06, 2013, 12:47:47 pm »
How about new craft weapons? What is the index padding for those?

I got the basebits part right (I think! - at least it loads), but I m having trouble with inticon

In the ruleset I am using sprite 6 (6 in-game weapons + 1)
In basebits I am using sprite 54 (next available, loads in game fine, I can see the new sprite in the craft equip screen)
I am a bit lost on inticon. I already tried a few options there but to no avail. Whenever a dogfight starts the game crashes... I think because it cannot find the appropriate sprite?

I am using only gifs and bmps. If I switch the graphics of the weapon to 5 (plasma beam) everything works fine, so I am confident that the problem is with the graphics.

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Adding New Image Files
« Reply #14 on: August 06, 2013, 08:26:59 pm »
https://www.ufopaedia.org/index.php?title=BASEBITS.PCK
https://www.ufopaedia.org/index.php?title=INTICON.PCK

I am not sure if we actually use the inticon weapons or just reuse the basebits ones.