aliens

Author Topic: [DONE] [Suggestion] Multi-Layered Paperdolls  (Read 16038 times)

Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: [DONE] [Suggestion] Multi-Layered Paperdolls
« Reply #15 on: October 03, 2018, 09:58:07 pm »
Thanks for the details, Meridian.

Can't think of a better way to do this given modders' wishes off the top fo my head, this needs time.

Anyway, it seems like I'm late to this party.

't'll bite someone in the ass later, but as it was once said


Whatever happens, we have got
The Maxim gun/usr/bin/python, and they have not.


Offline Nord

  • Commander
  • *****
  • Posts: 1736
  • The Gate is open.
    • View Profile
Re: [DONE] [Suggestion] Multi-Layered Paperdolls
« Reply #16 on: November 12, 2018, 07:39:45 pm »
A question: is there always 16 layers? Because i can not find a reason to use more than 2.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8974
    • View Profile
Re: [DONE] [Suggestion] Multi-Layered Paperdolls
« Reply #17 on: November 12, 2018, 08:15:04 pm »
A question: is there always 16 layers? Because i can not find a reason to use more than 2.

The first sentence in the description says you can define any number you want :)
https://openxcom.org/forum/index.php/topic,6290.msg104464.html#msg104464

2 is fine as well.

If you want a reason for using 16 layers, attached is a thought example from piratez what they could be.

Offline Nord

  • Commander
  • *****
  • Posts: 1736
  • The Gate is open.
    • View Profile
Re: [DONE] [Suggestion] Multi-Layered Paperdolls
« Reply #18 on: November 13, 2018, 09:25:09 am »
The first sentence in the description says you can define any number you want :)
https://openxcom.org/forum/index.php/topic,6290.msg104464.html#msg104464

2 is fine as well.


Ok, great. But instructions is unclear. How to do it?
Code: [Select]
M0: ["M0_NAKED", "JUMPSUIT"]Just like that?

Also:
If we have >30 face types for each gender (as Xpiratez), we will have >60 strings in each armor definition?
Maybe it is possible to use some numeric postfix for those faces (or nude paperdolls from The X-com files)?
Thanks.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8974
    • View Profile
Re: [DONE] [Suggestion] Multi-Layered Paperdolls
« Reply #19 on: November 13, 2018, 11:23:42 am »
1/ The idea was to hardcode as little as possible, so
- face is not any specific index
- there is no fixed naming required/possible
- and so on...

The time saving is that you don't have to merge those faces into any paperdolls manually now... but you just define it in the ruleset (for 30 faces that's approx. 1 minute instead of a few hours).

2/ As for instructions, I don't know how to write the instructions any better, so I just made a mod for you with just 3 layers.
See attachment.

Offline Nord

  • Commander
  • *****
  • Posts: 1736
  • The Gate is open.
    • View Profile
Re: [DONE] [Suggestion] Multi-Layered Paperdolls
« Reply #20 on: November 13, 2018, 12:20:15 pm »
1/ The idea was to hardcode as little as possible, so
- face is not any specific index
- there is no fixed naming required/possible
- and so on...

The time saving is that you don't have to merge those faces into any paperdolls manually now... but you just define it in the ruleset (for 30 faces that's approx. 1 minute instead of a few hours).

2/ As for instructions, I don't know how to write the instructions any better, so I just made a mod for you with just 3 layers.
See attachment.
All right, now i undersood all things. Thank you again.

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 683
    • View Profile
Re: [DONE] [Suggestion] Multi-Layered Paperdolls
« Reply #21 on: November 23, 2018, 01:51:28 am »
big props! works like a charm and is handy! small question can i randomize some layers by reapeting M0 or M1?

ex:
      M0: ["CAPEB", "AHSCOUTM", "M0_FACE"]
      M0: ["CAPEC", "AHSCOUTM", "M0_FACE"]
      M1: ["CAPEB", "AHSCOUTM", "M1_FACE"]
      M1: ["CAPEE", "AHSCOUTM", "M1_FACE"]
 to randomize CAPE

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8974
    • View Profile
Re: [DONE] [Suggestion] Multi-Layered Paperdolls
« Reply #22 on: November 23, 2018, 02:21:45 pm »
No.
But you can do M2, M3, ... , M63

Offline Nord

  • Commander
  • *****
  • Posts: 1736
  • The Gate is open.
    • View Profile
Re: [DONE] [Suggestion] Multi-Layered Paperdolls
« Reply #23 on: December 08, 2018, 05:26:26 pm »
One more question:
What meaning is in
Code: [Select]
    layersSpecificPrefix:
      8: JUMPSUIT
?
Is it for separating one sprites from another? Or can i somehow define one sprite for layer with that strings only?
Thanks.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8974
    • View Profile
Re: [DONE] [Suggestion] Multi-Layered Paperdolls
« Reply #24 on: December 08, 2018, 09:00:45 pm »
Each layer can have a different prefix... so that you can reuse layers from other armors... e.g. you can combine 5 different armors into one, by using different layer from each armor.

To save you time, I allowed to write:
Code: [Select]
default: DDD
specific:
  0: AAAAAA
  8: XXXXXX
instead of
Code: [Select]
specific:
  0: AAAAAA
  1: DDD
  2: DDD
  3: DDD
  4: DDD
  5: DDD
  6: DDD
  7: DDD
  8: XXXXXX
  9: DDD
  10: DDD
  11: DDD
  12: DDD
  13: DDD
  13: DDD
  15: DDD

Attached is illustration what maps where... how you use it is up to you.

Offline Nord

  • Commander
  • *****
  • Posts: 1736
  • The Gate is open.
    • View Profile
Re: [DONE] [Suggestion] Multi-Layered Paperdolls
« Reply #25 on: December 09, 2018, 02:17:32 am »
Ok, got it. Thanks.

Offline zee_ra

  • Colonel
  • ****
  • Posts: 213
    • View Profile
Re: [DONE] [Suggestion] Multi-Layered Paperdolls
« Reply #26 on: March 31, 2023, 08:28:46 am »
Feature implemented in OXCE 5.1

You can now define any number of layers you want to use in your mod.
It's the same number of layers for each paperdoll, so give it a little thought at the beginning, or you'll have to rework your ruleset if you decide to add a new layer somewhere in the middle later.

Furthermore, each layer can not only use its own sprites, but also sprites from other paperdolls.
(only one sprite "set" per layer)

I admit the description is not very simple/easy to understand... maybe some ruleset examples will help:

Code: [Select]
armors:
  - type: STR_NONE_UC
    layersDefaultPrefix: HUMAN
    layersSpecificPrefix:
      8: JUMPSUIT
    layersDefinition:
      M0: ["", "", "M0_NAKED", "", "", "", "", "", "M_JUMPSUIT", "", "M0_FACE", "", "", "", "", ""]
      M1: ["", "", "M1_NAKED", "", "", "", "", "", "M_JUMPSUIT", "", "M1_FACE", "", "", "", "", ""]
      M2: ["", "", "M2_NAKED", "", "", "", "", "", "M_JUMPSUIT", "", "M2_FACE", "", "", "", "", ""]
      M3: ["", "", "M3_NAKED", "", "", "", "", "", "M_JUMPSUIT", "", "M3_FACE", "", "", "", "", ""]
      F0: ["", "", "F0_NAKED", "", "", "", "", "", "F_JUMPSUIT", "", "F0_FACE", "", "", "", "", ""]
      F1: ["", "", "F1_NAKED", "", "", "", "", "", "F_JUMPSUIT", "", "F1_FACE", "", "", "", "", ""]
      F2: ["", "", "F2_NAKED", "", "", "", "", "", "F_JUMPSUIT", "", "F2_FACE", "", "", "", "", ""]
      F3: ["", "", "F3_NAKED", "", "", "", "", "", "F_JUMPSUIT", "", "F3_FACE", "", "", "", "", ""]
#
#
  - type: STR_PERSONAL_ARMOR_UC
    layersDefaultPrefix: HUMAN
    layersSpecificPrefix:
      8: PERSONAL_ARMOR
    layersDefinition:
      M0: ["", "", "M0_NAKED", "", "", "", "", "", "M_PERS_ARMOR", "", "M0_FACE"]  #trailing ""s are not needed
      M1: ["", "", "M1_NAKED", "", "", "", "", "", "M_PERS_ARMOR", "", "M1_FACE"]
      M2: ["", "", "M2_NAKED", "", "", "", "", "", "M_PERS_ARMOR", "", "M2_FACE"]
      M3: ["", "", "M3_NAKED", "", "", "", "", "", "M_PERS_ARMOR", "", "M3_FACE"]
      F0: ["", "", "F0_NAKED", "", "", "", "", "", "F_PERS_ARMOR", "", "F0_FACE"]
      F1: ["", "", "F1_NAKED", "", "", "", "", "", "F_PERS_ARMOR", "", "F1_FACE"]
      F2: ["", "", "F2_NAKED", "", "", "", "", "", "F_PERS_ARMOR", "", "F2_FACE"]
      F3: ["", "", "F3_NAKED", "", "", "", "", "", "F_PERS_ARMOR", "", "F3_FACE"]

Based on this, sprites with composite name will need to be defined.
First part is the "prefix" (e.g. HUMAN), then layer number (e.g. 8) and last sprite name (e.g. M0_FACE); they are separated by two underscores.
Example:

Code: [Select]
extraSprites:
  - typeSingle: JUMPSUIT__8__M_JUMPSUIT
    fileSingle: Resources/LayeredJumpsuit/08-outer_clothes_armor_and_boots/male.png
  - typeSingle: JUMPSUIT__8__F_JUMPSUIT
    fileSingle: Resources/LayeredJumpsuit/08-outer_clothes_armor_and_boots/female.png
#
#
  - typeSingle: PERSONAL_ARMOR__8__M_PERS_ARMOR
    fileSingle: Resources/LayeredPersonalArmor/08-outer_clothes_armor_and_boots/male.png
  - typeSingle: PERSONAL_ARMOR__8__F_PERS_ARMOR
    fileSingle: Resources/LayeredPersonalArmor/08-outer_clothes_armor_and_boots/female.png
#
#
  - typeSingle: HUMAN__2__M0_NAKED
    fileSingle: Resources/LayeredHuman/02-body/M0_male_blond.png
  - typeSingle: HUMAN__2__M1_NAKED
    fileSingle: Resources/LayeredHuman/02-body/M1_male_brown.png
  - typeSingle: HUMAN__2__M2_NAKED
    fileSingle: Resources/LayeredHuman/02-body/M2_male_asian.png
  - typeSingle: HUMAN__2__M3_NAKED
    fileSingle: Resources/LayeredHuman/02-body/M3_male_african.png
  - typeSingle: HUMAN__2__F0_NAKED
    fileSingle: Resources/LayeredHuman/02-body/F0_female_blond.png
  - typeSingle: HUMAN__2__F1_NAKED
    fileSingle: Resources/LayeredHuman/02-body/F1_female_brown.png
  - typeSingle: HUMAN__2__F2_NAKED
    fileSingle: Resources/LayeredHuman/02-body/F2_female_asian.png
  - typeSingle: HUMAN__2__F3_NAKED
    fileSingle: Resources/LayeredHuman/02-body/F3_female_african.png
#
#
  - typeSingle: HUMAN__10__M0_FACE
    fileSingle: Resources/LayeredHuman/10-face/M0_male_blond.png
  - typeSingle: HUMAN__10__M1_FACE
    fileSingle: Resources/LayeredHuman/10-face/M1_male_brown.png
  - typeSingle: HUMAN__10__M2_FACE
    fileSingle: Resources/LayeredHuman/10-face/M2_male_asian.png
  - typeSingle: HUMAN__10__M3_FACE
    fileSingle: Resources/LayeredHuman/10-face/M3_male_african.png
  - typeSingle: HUMAN__10__F0_FACE
    fileSingle: Resources/LayeredHuman/10-face/F0_female_blond.png
  - typeSingle: HUMAN__10__F1_FACE
    fileSingle: Resources/LayeredHuman/10-face/F1_female_brown.png
  - typeSingle: HUMAN__10__F2_FACE
    fileSingle: Resources/LayeredHuman/10-face/F2_female_asian.png
  - typeSingle: HUMAN__10__F3_FACE
    fileSingle: Resources/LayeredHuman/10-face/F3_female_african.png

As you can see, we have added also a shorter way of defining single sprites.

The following definitions are equivalent:

Code: [Select]
  - typeSingle: HUMAN__10__F3_FACE
    fileSingle: Resources/LayeredHuman/10-face/F3_female_african.png

Code: [Select]
  - type: HUMAN__10__F3_FACE
    singleImage: true
    width: 320
    height: 200
    subX: 0
    subY: 0
    files:
      0: Resources/LayeredHuman/10-face/F3_female_african.png

I am also attaching a working sample, which you can try with xcom1... it replaces paperdolls for jump suits and personal armor.

PS: for big mods, this could cut down the number of paperdolls by 90% or more... and improve both loading time and memory usage... and most importantly time to create new paperdolls

Could you please suggest, where in the armor encoding the head is encoded?  Are these parts of definition (under the key layersDefinition, layersDefaultPrefix and layersSpecificPrefix) intended for torso only?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8974
    • View Profile
Re: [DONE] [Suggestion] Multi-Layered Paperdolls
« Reply #27 on: March 31, 2023, 10:08:24 am »
Could you please suggest, where in the armor encoding the head is encoded?

There is no fixed place for the head (or any other part of the paperdoll), it is fully up to the modder to decide.

Are these parts of definition (under the key layersDefinition, layersDefaultPrefix and layersSpecificPrefix) intended for torso only?

No, it's the complete paperdoll, not just the torso.

Offline zee_ra

  • Colonel
  • ****
  • Posts: 213
    • View Profile
Re: [DONE] [Suggestion] Multi-Layered Paperdolls
« Reply #28 on: March 31, 2023, 12:35:38 pm »
There is no fixed place for the head (or any other part of the paperdoll), it is fully up to the modder to decide.

No, it's the complete paperdoll, not just the torso.

What values determine the appearance on battlescape?  Is battlespace appearance computed automatically from the "paperdoll" model?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8974
    • View Profile
Re: [DONE] [Suggestion] Multi-Layered Paperdolls
« Reply #29 on: March 31, 2023, 12:43:15 pm »
What values determine the appearance on battlescape?  Is battlespace appearance computed automatically from the "paperdoll" model?

Paperdolls don't have anything to do with battlescape unit appearance (they are defined via spritesheets).

See `spriteSheet` in https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Armor