aliens

Author Topic: OpenXCom Modding Tools  (Read 121257 times)

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: OpenXCom Modding Tools
« Reply #15 on: October 29, 2014, 06:23:56 am »
now the palette tool makes non transparent macos compatible sprites
to make transparent images change "maketrans: false" to "maketrans: true" in the options
also:
you can now overwrite existing transformations
if you decrease the block size e.g. 16->8 the already assigned colors are not deleted

Offline oftcrash

  • Sergeant
  • **
  • Posts: 22
    • View Profile
Re: OpenXCom Modding Tools
« Reply #16 on: October 29, 2014, 05:53:53 pm »
I messed around some more this morning and got the script working. I've converted a couple previously unplayable mods and tried them out successfully. So far just a weapon mod and an armor mod, but its a start :)

https://pastebin.com/Ye30gcak

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: OpenXCom Modding Tools
« Reply #17 on: October 29, 2014, 06:04:41 pm »
@Falko: Sounds great! Thanks for the improvements :)

@oftcrash: Does this apply to everything? I know it does for items, but spritesheets, handobs, bigobs, all graphics?

I'll try to make the XCom Armoury Expanded v1.02 Mac Compatible (I know how it feels, many mods aren't Linux compatible too, although that's an easier fix). Once I release it, maybe you can take a look?

Offline oftcrash

  • Sergeant
  • **
  • Posts: 22
    • View Profile
Re: OpenXCom Modding Tools
« Reply #18 on: October 29, 2014, 07:48:00 pm »
Most of the code came from Falco, but then I took a few liberties so don't blame him for broken stuff :)

It searches through an entire directory structure and converts ANY GIF it finds to png, then converts any png to use the green for transparency. It then goes through any rul file it finds and changes all gif filename to png.

I've had a little more time to test things out and I've found a few issues.
  • Right now it assumes everything uses the battlescape palette. If there are graphics for the Geoscape or Base, they may get screwed up.
  • Some of the files aren't registering the transparency correctly. Some of the handobs cause the torso to disappear. Some of the bigobs have a black border around them that shows up wonky in the inventory screen
  • If rul file graphic extensions are all caps (.GIF) they won't be replaced properly.

I've had partial success though. Breach Charge, Colored Moriarty Armor, Gauss Weapons, Small Rocket all worked perfectly. Mostly working are EqualTerms, FusionTorch, GrenadeLauncher and Incendiary Grenade.

I'd be happy to try out your mod whenever you'd like.
While it is converting all the GIF files to PNG, and all PNG files to use the green for transparency, some of the files aren't converting correctly. I haven't found the pattern yet, but I'll keep futzing with it.

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: OpenXCom Modding Tools
« Reply #19 on: October 29, 2014, 08:06:41 pm »
regarding palette:
i changed the original (only 3.x/Pillow) version
from
tim.putpalette( [ im.palette.palette [ x ] for x in range(len(im.palette.palette)) ] )
to
tim.palette.palette=im.palette.palette
could you revert and test with the first version?

"Some of the files aren't registering the transparency correctly and other problems"
can you post examples images before/after script?

GIF problem try this
Code: [Select]
import re
gifsearch = re.compile(re.escape('.gif'), re.IGNORECASE)
...
gifsearch.sub('.png', line)

i could try to add a "fixer" for casesensitive paths/directorynames so this script solves most of the macos/linux issues for mods .. interested?

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: OpenXCom Modding Tools
« Reply #20 on: October 29, 2014, 09:46:13 pm »
You mean a new tool in your webpage where one could upload a zip file and that would fix case sensitivity and transparency automatically? Man, the only better thing would be if it merged graphics into spritesheets as well ;)

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: OpenXCom Modding Tools
« Reply #21 on: October 29, 2014, 10:08:38 pm »
merging images to spritesheets would be trying to be smarter than the mod creator/guessing what the file structure "means" .. that creates its own source of errors

idea:
  • check for files in that exists twice (like BLA.MAP and BLA.map) in a case sensitive filesystem if files exist and are differnt in content -> list them and abort
  • check for files/dir with non-ascii chars in pathname if exist list them and abort
  • rename all MAP/TERRAIN/ROUTES files uppercase
  • rename all Resources/ gif/png/wav/???/files + subdirectories lowercase
  • (optional?) every gif file in Resources is renamed to png
  • (optional?) every png file in Resources get the macos/transparency fix (assuming we can solve the existing issues)
  • go through all rulfiles:
    • every file-line in the extrasprites/sounds category is lowercased after the Resources directory
    • (optional?) every file-line ending in gif in the extrasprites category is renamed to png
    • every entry in mapDataSets blocks are made uppercase
    • every terrains-entry in alienDeployments blocks are made uppercase
    • every name-entry in mapBlocks blocks are made uppercase
    • every mapName-entry in facilities blocks are made uppercase
    • warn for referenced but missing files in extrasound/sprite/terrain/map/routes
most of the stuff above is already in the script/trivial to do
and instead of uploading to web it would be a script that linux/macos user can use (perhaps one could make a a simple gui)

Offline jackstraw2323

  • Colonel
  • ****
  • Posts: 206
    • View Profile
Re: OpenXCom Modding Tools
« Reply #22 on: October 29, 2014, 11:31:32 pm »
So any thoughts about updating the HWP builder? I'm working on some custom graphics, and while it's still early days I'm approaching the point of having all of my facings done, but not the animations, and I'd like to be able to test.

Hate to tip my hand, but I took some front mission sprites as reference, and chopped, remixed, redrew, and optimized. Still fiddling with some of the other facings as I had to draw from scratch, but I get at least 2 facings free from source materials.

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: OpenXCom Modding Tools
« Reply #23 on: October 30, 2014, 12:06:08 am »
i tried all hwp drawingroutines again and it seems to work fine
i updated the site to the current numbering schema (19->20, 20->21)
for your sectopod template problem
did you set the drawingRoutine to 5 in the armor ruleset ?


Offline jackstraw2323

  • Colonel
  • ****
  • Posts: 206
    • View Profile
Re: OpenXCom Modding Tools
« Reply #24 on: October 30, 2014, 03:05:03 am »
Worked for me with a couple of tweaks. Thanks for working on this so fast. If you're inclined a couple of extra suggestions/requests.

The pallet hasn't been updated, so since I'm on OSX had to resave again with the modified pallet. I know you're working on this on one of the other tools, so maybe that will get rolled in too.

The suggested use code for me when I cut and pasted into my editor converted some of the whitespace so if anyone else runs into issues try rewriting the rule by hand. Don't know if there's a way around this as your output is wrapped in a <pre> tag so that shouldn't have happened. Maybe I did something wrong on my end. But maybe some help text about YAML being strict about whitespace would be helpful on your usage text.

Thanks again. Once I'm done with a first draft I'll post something in the mods forum. Like everyone around here I've got plans for a largish mod. My basic idea is a campaign where HWP's are more important and possibly necessary in order to deal with aliens that are more heavily armored, but not necessarily better armed.  But that seems like a big job with lots of pieces to develop so I'll probably put this out first as a stand alone and roll into my campaign once I'm further along.

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: OpenXCom Modding Tools
« Reply #25 on: November 01, 2014, 05:32:45 am »
update
i included the new modtester
https://falkooxc2.pythonanywhere.com/rulcheck
(the old one is still available under https://falkooxc.pythonanywhere.com/)

it has some new functionality
but it also misses some of the old functions (mainly tests using binaries=map/image/sound)

there is no need for making a zipfile this works solely with the ruleset file now

in my opinion we get now more useful errors and the corresponding line number (click on it)

for user who have a lot of mods there is the option to upload multiple mods and quickly test them + merge them


another new tool is a formatter
eg. if you dont like the export-result of the workeditor
Code: [Select]
globe:
  polygons:
    - - 1
      - 349.5
      - -52.25
      - 350.5
      - -51.375
      - 353.5
      - -52.25
      - 350.75
      - -53.25
the formatter makes a recognizable yaml file structure where the order of the entries is always the same (type/name on top...)
Code: [Select]
globe:
  polygons:
    - [1, 349.5, -52.25, 350.5, -51.375, 353.5, -52.25, 350.75, -53.25]
try it: https://falkooxc2.pythonanywhere.com/rulformat

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
Re: OpenXCom Modding Tools
« Reply #26 on: November 01, 2014, 06:26:48 am »
Can your formatter work for save files too?  ie can it reorder the YAML in the saves to be the same everytime?

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: OpenXCom Modding Tools
« Reply #27 on: November 01, 2014, 06:41:06 am »
try it
it looks for a specified order
like
the order for /manufacture/[listelement]=[name,category, requires, space, time, cost, requiredItems, producedItems, listOrder]
all other properties are sorted alphabetically

the path "/manufacture/[listelement]" is of course not the same in a save file so the specified order is useless
but the alphabetical sort should work so the place of the properties would be at least predictable

i tested it
you need to delete the "---" between the metadata (version, mods, name,...) and the real data

Offline jackstraw2323

  • Colonel
  • ****
  • Posts: 206
    • View Profile
Re: OpenXCom Modding Tools
« Reply #28 on: November 01, 2014, 06:38:57 pm »
Thanks this just helped me track down some syntax errors in my .rul file. I wonder, would it be possible to parse the default ruleset and provide a select list to then edit the values of a specific type. I.E. Select the unit for type: STR_SECTOID_ENGINEER and then it would give you the full output to edit. Maybe that's too much trouble for not enough benefit. Anyhow thanks for the parser.

Offline davide

  • Commander
  • *****
  • Posts: 565
    • View Profile
Re: OpenXCom Modding Tools
« Reply #29 on: November 18, 2014, 03:09:07 pm »
I got an error on this file  :o