Author Topic: [MODDING RULES] Questions about modding (sprites, sounds, ...)  (Read 5967 times)

Offline Aldorn

  • Commander
  • *****
  • Posts: 750
    • View Profile
I have some questions about referecing external files (sprites, sounds, ... )
I made some tests and have some answers, but ideally I would like to know opinion from some developper, to be sure...
These questions are interesting while trying to merge many mods

1) Is it allowed to use same number as reference inside two different RuleSet files ?

ANSWER is : YES

Example :

Mod_Crafts_Weapon1.rul
Code: [Select]
items:
  - type: STR_WEAPON1
    bigSprite: 10001
    floorSprite: 10002
    handSprite: 10003

Mod_Crafts_Weapon2.rul
Code: [Select]
items:
  - type: STR_WEAPON2
    bigSprite: 10001
    floorSprite: 10002
    handSprite: 10003

2) Is there any limit to these numbers, while referencing any of following properties ?
(I mean : could I use 10000, 100000, 1000000 ?)

CF ANSWER IN YELLOW

Code: [Select]
crafts:
  - type: STR_MY_NEW_CRAFT
    [b]sprite[/b]: 100001
Code: [Select]
items:
  - type: STR_MY_NEW_WEAPON
    [b]bigSprite[/b]: 10001
    [b]floorSprite[/b]: 10002
    [b]handSprite[/b]: 10003
    [b]bulletSprite[/b]: 10004
    [b]fireSound[/b]: 10005
    [b]hitSound[/b]: 10006
    [b]hitAnimation[/b]: 10007

Code: [Select]
armors:
  - type: STR_MY_NEW_ARMOR
    [b]spriteSheet[/b]: 1001
    [b]spriteInv[/b]: 1002


3) ListOrder

3a) In case two items (of same nature) having same listOrder in same RuleSet file, will they be sorted :
- alphabetically ?
- by order of appearence ?

3b) In case two items (of same nature) having same listOrder in different RuleSet files, will they be sorted :
- alphabetically ?
- by order of reading RuleSet files ?

ANSWER is : BY ORDER OF APPEARANCE (ALSO BASED ON MOD ORDER FIRST, LINE ORDER SECOND) IF LISTORDER NOT SPECIFIED, ELSE CF BELOW

3c) Is there any limit to listOrder (1000, 10000, 100000, ...) ?
ANSWER is : NO


ANSWER OF SupSuper

Some clarifications:

- Every ruleset has a safe numeric ID range of 0..999. No rulesets can conflict within this range, except when modifying original resources. If you exceed this, then all bets are off (we'll probably just use string IDs for everything in the future), so don't try to guess and avoid other mod's IDs, you'll just make it worse.

- If a numeric ID matches an original resource, than it's treated as such, otherwise it's treated as a new resource. If you don't wanna keep track of where the original resources end and the new ones start for everything, it's probably safe to always start at 100.

- listOrders are different. They apply globally to every ruleset combined, and have no limit.

- Every item by default gets a listOrder based on the mod order first, line order second, unless manually specified.

- If multiple items specify the same listOrder, they'll be next to each other. Which comes first depends on how the algorithm is feeling that day, as it's not stable.


EDIT : other interesting information related to BaseBit, IntIcon or bulletSprite -> https://openxcom.org/forum/index.php?topic=2031.msg21679#msg21679
« Last Edit: May 23, 2014, 10:41:14 am by Aldorn »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11722
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [MODDING RULES] Questions about modding (sprites, sounds, ...)
« Reply #1 on: May 20, 2014, 07:52:26 pm »
1) Is it allowed to use same number as reference inside two different RuleSet files ?

Example :

Mod_Crafts_Weapon1.rul
Code: [Select]
items:
  - type: STR_WEAPON1
    bigSprite: 10001
    floorSprite: 10002
    handSprite: 10003

Mod_Crafts_Weapon2.rul
Code: [Select]
items:
  - type: STR_WEAPON2
    bigSprite: 10001
    floorSprite: 10002
    handSprite: 10003

Yes, it's fine - they won't conflict with each other, as every ruleset is considered a separate data set.
Otherwise we'd have mod conflicts all the time... :)


2) Is there any limit to these numbers, while referencing any of following properties ?
(I mean : could I use 10000, 100000, 1000000 ?)

Code: [Select]
crafts:
  - type: STR_MY_NEW_CRAFT
    [b]sprite[/b]: 100001
Code: [Select]
items:
  - type: STR_MY_NEW_WEAPON
    [b]bigSprite[/b]: 10001
    [b]floorSprite[/b]: 10002
    [b]handSprite[/b]: 10003
    [b]bulletSprite[/b]: 10004
    [b]fireSound[/b]: 10005
    [b]hitSound[/b]: 10006
    [b]hitAnimation[/b]: 10007

Code: [Select]
armors:
  - type: STR_MY_NEW_ARMOR
    [b]spriteSheet[/b]: 1001
    [b]spriteInv[/b]: 1002


I'm not sure - the system seems to be quite robust, but not infinitely so. Generally speaking, it would be very hard to add enough items to force such great numbers. It's best to stick to low numbers when possible.

3) ListOrder

3a) In case two items (of same nature) having same listOrder in same RuleSet file, will they be sorted :
- alphabetically ?
- by order of appearence ?

Frankly I don't know right now. I just make sure this never happens. :P

3c) Is there any limit to listOrder (1000, 10000, 100000, ...) ?

See above - there are limits, but they're extremely high, and it's not necessary to go there.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: [MODDING RULES] Questions about modding (sprites, sounds, ...)
« Reply #2 on: May 20, 2014, 07:56:10 pm »
Yes, it's fine - they won't conflict with each other, as every ruleset is considered a separate data set.
Otherwise we'd have mod conflicts all the time... :)
that's just straight up WRONG.

don't use numbers for sprites over 1000... ever. trust me.

no, unless the sprite is within the original range (ie:replacing original graphics), then it will have to be defined in each ruleset.

by order of appearance, including mod load order.

no limit to listOrder.
« Last Edit: May 20, 2014, 08:07:57 pm by Warboy1982 »

Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Re: [MODDING RULES] Questions about modding (sprites, sounds, ...)
« Reply #3 on: May 20, 2014, 08:00:09 pm »
don't use numbers for sprites over 1000... ever.
lol. First ruleset I examined when I started modding had 12000, so I started there with the numeration for my mods: basically I've been always using more than 1000 everywhere.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: [MODDING RULES] Questions about modding (sprites, sounds, ...)
« Reply #4 on: May 20, 2014, 08:01:57 pm »
you're gonna have so many compatibilty errors...

Offline Aldorn

  • Commander
  • *****
  • Posts: 750
    • View Profile
Re: [MODDING RULES] Questions about modding (sprites, sounds, ...)
« Reply #5 on: May 20, 2014, 08:59:59 pm »
Ok

Nice that it is per ruleset file

So if I report to wiki https://www.ufopaedia.org/index.php?title=Ruleset_Reference_%28OpenXcom%29#Items, "as low as possible" means :
- bigSprite  => from 57 (as 0..56 used by engine for original items)
- floorSprite => from 73 (as 0..72 used by engine for original items)
- handSprite => from 16 (as 0..15 used by engine for original items)


Offline robin

  • Commander
  • *****
  • Posts: 1224
  • ULTIMATE ROOKIE
    • View Profile
Re: [MODDING RULES] Questions about modding (sprites, sounds, ...)
« Reply #6 on: May 20, 2014, 09:37:56 pm »
This is my numeration. I could just go over them.

Bigobs, Floorob:
(UNITS):
300     MIB0
301     MIB1
302     MIB2
303     WASPITE
304     CYBERMITE
305     MIB3
306     GAZER
307     HOLODRONE
64      ARMORED VEST
77      ARMORED VEST


Bigobs, Floorob, (Handsprite):
(ITEMS):
12004(to 12011) MACHINE PISTOL
12005           MACHINE PISTOL CLIP
12012(to 12019) SNIPER RIFLE
12013           SNIPER RIFLE CLIP


... so.. are 100 and 300 (for items, i'd like to keep them separated) good numbers to start from?
« Last Edit: May 20, 2014, 09:45:43 pm by robin »

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: [MODDING RULES] Questions about modding (sprites, sounds, ...)
« Reply #7 on: May 20, 2014, 09:57:05 pm »
Some clarifications:

- Every ruleset has a safe numeric ID range of 0..999. No rulesets can conflict within this range, except when modifying original resources. If you exceed this, then all bets are off (we'll probably just use string IDs for everything in the future), so don't try to guess and avoid other mod's IDs, you'll just make it worse.

- If a numeric ID matches an original resource, than it's treated as such, otherwise it's treated as a new resource. If you don't wanna keep track of where the original resources end and the new ones start for everything, it's probably safe to always start at 100.

- listOrders are different. They apply globally to every ruleset combined, and have no limit.

- Every item by default gets a listOrder based on the mod order first, line order second, unless manually specified.

- If multiple items specify the same listOrder, they'll be next to each other. Which comes first depends on how the algorithm is feeling that day, as it's not stable.
« Last Edit: May 20, 2014, 10:03:21 pm by SupSuper »