aliens

Author Topic: Giude for PCK frames  (Read 5497 times)

Offline fireburn256

  • Squaddie
  • *
  • Posts: 9
    • View Profile
Giude for PCK frames
« on: January 22, 2020, 09:03:30 pm »
So I was modding the TFTD just for my purposes, making some little changes here and there, and I thought that logic dictates that most of aquatic races should be able to swim underwater. Makes sense for me, at least.
So I went to armor ruleset, added essential changes, and I thought I would be good. Well, turned out I was wrong. Upon testing, the game crashes with the message I have attached below. Several debug sessions later, I can surely tell that this is caused by trying to look at floating alien.

The point is, I am afraid I couldn't find info related to these frames. I converted the xcom ion magnetic armor files to compare it with the one I got for gillman race, but, well, guess I am not so clever as I thought for this kind of stuff. Is there any guide for what frames are for what and a safe editor for these frames?
« Last Edit: January 22, 2020, 09:05:23 pm by fireburn256 »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9092
    • View Profile
Re: Giude for PCK frames
« Reply #1 on: January 22, 2020, 10:10:01 pm »
OpenXcom has different "drawing routines" for different types of units (actually their armors): look at attribute 'drawingRoutine' here: https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Armor

These drawing routines dictate how is the sprite sheet used for animation and also what should the sprite sheet contain on which position/frame.
These drawing routines are NOT compatible in general.
Sometimes it's just a small difference, like swapped body parts... but sometimes the number of frames in the sprite sheet is just different for different routines...

Therefore you cannot just copy a sprite sheet designed for one drawing routine for a unit/armor using a different drawing routine.
For example, copying an Ion Magnetic Armor sprite sheet (=drawing routine 13) to be used as Gillman armor (=drawing routine 14) likely won't work. You need to either:
a/ change the gillman armor to use also drawing routine 13
b/ or retrofit the ion magnetic armor frames to fit the structure of the gillman sprite sheet

Option a/ looks a lot easier, if you don't have any other special requirements.

Offline fireburn256

  • Squaddie
  • *
  • Posts: 9
    • View Profile
Re: Giude for PCK frames
« Reply #2 on: January 22, 2020, 10:49:12 pm »
Thanks for help! Am I right that I will have to redraw the Gillman armor tileset, or the engine just work around and switch to the defaults if it encounters some kind of error like "trying to read the image from a file at certain position, but this coordinates are out of file"?
And is there an editor for this, or am I stuck with Paint?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9092
    • View Profile
Re: Giude for PCK frames
« Reply #3 on: January 22, 2020, 10:59:50 pm »
Thanks for help! Am I right that I will have to redraw the Gillman armor tileset

Hard to say, I don't know what is your ultimate goal.
What you need to do is to provide a correctly formatted sprite sheet for the drawing routine you decide to use.

or the engine just work around and switch to the defaults if it encounters some kind of error like "trying to read the image from a file at certain position, but this coordinates are out of file"?

No, the engine doesn't work around.
It simply crashes when it doesn't find what it expects... exactly that happened in the crash you posted above.

And is there an editor for this, or am I stuck with Paint?

I am not sure, I'm just a developer :)
I haven't actually created any such graphics myself.
Better ask modders like Solarius, robin, bulletdesigner, etc.

Oh, and you need an OpenXcom-compatible image editor (=capable of saving 8-bit paletted PNGs without palette optimization)... Paint won't do.
Photoshop and Asesprite stood the test of time... others (like for example GIMP) work too if you use them carefully.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11722
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Giude for PCK frames
« Reply #4 on: January 23, 2020, 07:58:31 pm »
I don't really have anything to add. But if you have any specific questions, feel free to ask - I'm sure we'll be able to help.

Offline fireburn256

  • Squaddie
  • *
  • Posts: 9
    • View Profile
Re: Giude for PCK frames
« Reply #5 on: January 28, 2020, 10:47:34 pm »
I don't really have anything to add. But if you have any specific questions, feel free to ask - I'm sure we'll be able to help.

Thanks! I do have one right now...

I kinda managed to do the floating thing, and I am pretty happy with it. I used Luke83's template to add the spreadshit, but I am kinda curious: I looked through the FMP mod folder, and it doesn't kinda contain this UNITS folder with the .PCK and .TAB files, and instead it goes to the Resource folder all the way down with the .png spreadshits at the end (but yeah, you already know that). What is the general rule of thumb here? Can I just drop the .png version and be done with it?
« Last Edit: January 28, 2020, 10:52:46 pm by fireburn256 »

Offline luke83

  • Commander
  • *****
  • Posts: 1559
    • View Profile
    • openxcommods
Re: Giude for PCK frames
« Reply #6 on: January 28, 2020, 11:02:35 pm »
Yes png is fine these days, you no longer need yo ise the old formats

Offline fireburn256

  • Squaddie
  • *
  • Posts: 9
    • View Profile
Re: Giude for PCK frames
« Reply #7 on: January 29, 2020, 12:28:29 am »
Yes png is fine these days, you no longer need yo ise the old formats

Uhm... Still seems not to work. How do I do this? I have created a Resource folder in the mod folder, then in the Resource folder I put the Units folder, and there is where I dropped the .PNG file. Did I miss anything?

Offline luke83

  • Commander
  • *****
  • Posts: 1559
    • View Profile
    • openxcommods
Re: Giude for PCK frames
« Reply #8 on: January 29, 2020, 01:57:40 am »
Upload what you have so we can see what your doing.

Offline fireburn256

  • Squaddie
  • *
  • Posts: 9
    • View Profile
Re: Giude for PCK frames
« Reply #9 on: January 29, 2020, 05:22:50 pm »
Well, here it goes. The PCK files in UNITS folder worked great, .png sprites not so much.


Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: Giude for PCK frames
« Reply #10 on: January 29, 2020, 05:39:15 pm »
PNG files need to have a reference to them in an extraSprites ruleset in order to be used. Check in FMP's armors ruleset file (I think it's armors_FMP.rul) to see what the name of the sprite you want to replace is, then check how that sprite is defined in extraSprites_FMP.rul. You'll need to use a similar format to reference your file, something like:

Code: [Select]
extraSprites:
  - type: WHATEVERTHESPRITENAMEIS.PCK
    width: 256
    height: 1520
    subX: 32
    subY: 40
    files:
      0: Resources/Units/GILLMAN.png