WadMaker & SpriteMaker - command-line wad & sprite making tools Created 5 months ago2021-05-16 22:05:58 UTC by Captain P Captain P

Created 5 months ago2021-05-16 22:05:58 UTC by Captain P Captain P

Posted 5 months ago2021-05-16 22:05:58 UTC Post #345618
WadMaker & SpriteMaker are finally finished!
It can be downloaded here. For more information, see the readme, or check out the Making textures with WadMaker tutorial.

These command-line tools can turn a directory full of images into a Half-Life wad file or into a directory full of sprites - just drag the directory onto the right tool. They can also extract textures from wad and bsp files, remove embedded textures from bsp files and convert sprites back into images.

WadMaker and SpriteMaker directly support png, jpg, gif, bmp and tga files, as well as Photoshop (psd, psb) and Krita files (kra, ora), and can be configured to call external conversion tools for other formats (example configurations for Gimp and Aseprite files are included). Both tools will automatically create a suitable 256-color palette for each texture or sprite. They will also apply a limited form of dithering, which can be disabled if necessary. For transparent textures and sprites, the alpha channel of the input image is compared against a configurable threshold, but it is also possible to treat a specific input color as transparent. For water textures, the fog color and intensity are derived from the image itself, but they can also be specified explicitly. Texture-specific settings can be overridden with a plain-text wadmaker.config file in the images directory. Common sprite settings such as orientation and texture format can be set within filenames, other settings can be overridden with a spritemaker.config file.

Why did I make these tools? First, I was investigating the various Half-Life file formats anyway. Second, I wanted a faster workflow than Wally and Half-Life Texture Tools (for me, running a batch file is faster than opening a GUI tool, dragging files around, saving a wad file, and closing the GUI tool). And finally, investigating various approaches to color quantization and dithering, and reading up on color spaces and color perception turned out to be very interesting.
Changes in v1.2:
SpriteMaker:
  • Workflow: converts directories full of images to directories full of sprites, similar to how WadMaker works. Can also convert sprites back to images.
  • Efficiency: only modified files and settings are processed.
  • Configuration: common settings like sprite orientation and texture format can be configured within an image's filename. Other settings can be specified in spritemaker.config files.
  • Flexibility: accepts various image formats (png, jpg, gif, bmp, tga), Photoshop files (psd, psb) and Krita files (kra, ora). Input images can be true-color and can contain transparency, SpriteMaker will automatically generate a suitable palette. Support for other file formats can be enabled with converter rules (a global spritemaker.config file with example rules for Gimp and Aseprite files is provided).
  • Animation: animated sprites can be created with numbered image sequences, spritesheets and/or gif files.
WadMaker:
New features/changes:
  • Added support for a global configuration file (a wadmaker.config file in the executable's directory). Global rules always apply, unless overridden by a local config file.
  • The provided global config file contains example rules for converting Gimp and Aseprite files and instructions on how to enable them.
  • Custom converters are no longer forced to output png files, the output file extension must now be specified in the converter arguments.
  • Custom converters can now also use {input_escaped} and {output_escaped} placeholders, for when backslashes need to be escaped.
Bugfixes:
  • Fixed a problem where processing transparent images with very little color variation could fail with an 'At least one color must be provided.' error.
  • Fixed that the dither-scale setting was not parsed correctly, so it could only effectively be set to 0 or 1.
  • Fixed that WadMaker would fail to create a wad file if the output directory did not exist.
  • Fixed that mipmaps were not extracted correctly.
  • Fixed some cases where WadMaker would fail to create a log file or a directory.

Changes in v1.1:
WadMaker:
New features:
  • Added support for Photoshop files (.psd, .psb) that have been saved with 'maximize compatibility' enabled.
  • Added support for Krita (.kra) and OpenRaster (.ora) files.
  • Added support for creating and extracting decal wad files (decals.wad).
  • Updated the wadmaker.config system to apply all matching rules (with more specific rules overriding less specific ones).
  • Console output is now logged to a file (only in create-wad mode). This can be disabled with a command-line option.
Bugfixes:
  • Fixed that removing an image with an uppercase name would cause updating a wad file to fail.
  • Fixed that water color was accidentally black by default.
Posted 5 months ago2021-05-16 22:42:00 UTC Post #345619
You're making such cool stuff, Cap'n!! Awesome
Archie ArchieGoodbye Moonmen
Posted 5 months ago2021-05-18 05:23:22 UTC Post #345630
That's great! I actually long longed for such a tool, good job Captain!
Posted 5 months ago2021-05-18 19:58:37 UTC Post #345631
Posted 5 months ago2021-05-19 00:13:40 UTC Post #345633
Thanks! Don't hesitate to ask if you have questions or feedback. :)
Posted 5 months ago2021-05-19 11:52:31 UTC Post #345635
sound like a boon for big projects
Posted 5 months ago2021-05-19 13:09:24 UTC Post #345638
Nice, sounds very useful.
Posted 4 months ago2021-05-30 23:41:52 UTC Post #345668
WadMaker 1.1 is now available!
It can be downloaded here. For more information, see the readme.

New features:
  • Added support for Photoshop files (.psd, .psb) that have been saved with 'maximize compatibility' enabled.
  • Added support for Krita (.kra) and OpenRaster (.ora) files.
  • Added support for creating and extracting decal wad files (decals.wad).
  • Updated the wadmaker.config system to apply all matching rules (with more specific rules overriding less specific ones).
  • Console output is now logged to a file (only in create-wad mode). This can be disabled with a command-line option.
Bugfixes:
  • Fixed that removing an image with an uppercase name would cause updating a wad file to fail.
  • Fixed that water color was accidentally black by default.

WadMaker will automatically switch to decal mode when the ouput wad file name is 'decals.wad', and it expects input images to have an alpha channel - which it will use to create the decal texture. The average color of the input image is used as decal color. If you're not sure what format is expected, then first try extracting a decals.wad file, and take a look at the extracted images. It's also possible to enable grayscale input with a wadmaker.config setting - in that case you should also specify the decal color in the settings file.

As for Photoshop files, not all compression methods are supported because I could only find test files with raw and RLE compressed composite images. So please let me know if certain files don't work. I can add support as soon as I get some files to test with.
Posted 2 months ago2021-07-20 19:55:44 UTC Post #345792
That might be a whole lot to ask for, but did you consider adding support for converting Gimp’s XCF files too, as well as to automatically resize converted images to valid Goldsource dimensions (less than 256 and divisible by 16). Realistically though, this would just make things a bit more convenient.
Posted 2 months ago2021-07-21 09:03:27 UTC Post #345793
I did investigate Gimp's file format a while ago, but the main problem is that it doesn't contain a flattened image. I'd have to implement layer compositing, but that's a fair bit of extra work. The same problem applies to Aseprite and Paint.NET files.

But WadMaker can be configured to use external (command-line) conversion tools, and there seem to be several tools that can convert .xcf files (Gimp's batch mode, xcf2png, ImageMagick, Irfanview). So if you can get one of these tools to work, then it's just a matter of creating a wadmaker.config file in your source image folder and adding a line like the following (where {input} is the full input .xcf path, and {output} is a .png file in a temporary folder):
*.xcf    converter: '"C:\Tools\XcfConverter.exe"' arguments: '-in="{input}" -out="{output}"'
The above is just an example. Once I'm done with SpriteMaker I'll update the documentation with .xcf and .aseprite file conversion examples.

As for automatic resizing, if you're talking about allowing images of arbitrary size then I don't think that's a good idea due to quality loss. But if you're working with high-res source images (say, 2x as large) then I guess a scaling factor setting could be useful. I'll think about it. For now, you could perhaps use the above converter approach to resize your images.
Posted 2 months ago2021-08-07 10:25:25 UTC Post #345860
SpriteMaker is now available, and WadMaker has a few improvements and bugfixes (and some example configurations for setting up automatic Gimp and Aseprite file conversions)! See the first post in this thread for download links and a full changelog.
Posted 2 months ago2021-08-07 16:54:42 UTC Post #345863
Noice noice! Thanks!
Posted 6 days ago2021-10-13 22:03:41 UTC Post #345973
I just finished a tutorial (with lots of pictures) for WadMaker: Making textures with WadMaker. Feedback is welcome. :)
You must be logged in to post a response.