Utility for generating preview images of StarCraft: Brood War and Remastered maps

Overview

MIT license

bwpreview

Utility for generating preview images of StarCraft: Brood War and Remastered maps (.scm and .scx files).

All of the actual work of parsing map files and generating the images is done by the scm-extractor and bw-chk libraries made by the ShieldBattery project. To make it work, you need the required tileset, sprite and unit graphics from StarCraft.

Example image (Eclipse 1.2)

This script is designed around two common use cases: generating lossless, full-size PNG images of maps, and generating smaller AVIF preview files for use on the web.

Usage

After installation, see bwpreview --help for usage information:

usage: bwpreview [-h] [-v] [-d PATH [PATH ...]] [-m] [-f] [-q] [--preset NAME]
                 [--suffix STR] [--type TYPE] [--size PX] [--skip-existing]
                 [--skip-obs] [--rel-path PATH] [--out-path PATH] [--gfx-path PATH]
                 [FILE ...]

Utility for generating preview images of StarCraft: Brood War and Remastered maps.

positional arguments:
  FILE                 StarCraft map files (.scm, .scx) to generate images for

optional arguments:
  -h, --help           show this help message and exit
  -v, --version        show program's version number and exit
  -d PATH [PATH ...], --dir PATH [PATH ...]
                       directory containing StarCraft map files to process
  -m, --map-name       use map name, not filename, to determine output filename
  -f, --flatten        flatten output directory structure
  -q, --quiet          no output except for errors
  --preset NAME        generation preset to use ("preview", "full"); sets --suffix, --type, --size
  --suffix STR         suffix string to include in the image filename
  --type TYPE          type of image to generate ("png", "jpg", "avif", "webp")
  --size PX            size in which to fit the image (e.g. 500 to make up to a 500x500 image)
  --skip-existing      skip generation when an image of the expected name already exists
  --skip-obs           skip generation of observer maps (with "(Ob)" in the name)
  --rel-path PATH      path from which to calculate relative paths (for use with -d)
  --out-path PATH      path to save image files to (if unspecified, same as map file)
  --gfx-path PATH      path where the StarCraft graphics files can be found

The path to the StarCraft graphics defaults to ~/.config/bwpreview. If an output path is not specified, the images are saved to the current directory.

Examples

Let's say we've got a collection of maps at ~/BWmaps/, with maps being grouped together in subdirectories.

To generate full-size images for each of them, putting the images in the same location as the original map file, we can do the following:

bwpreview -d . --preset full

Here's an example of how that works:

$ cd ~/BWmaps/
$ ls -l ASL\ S12/
.rwx------  87k msikma 19 Jul  2021 (4)GOOD NIGHT 1.3.scx
.rwx------ 461k msikma  5 Jul  2021 (4)Largo_1.4.scx
.rwx------  94k msikma  8 Jul  2021 (4)Lemon 0.95.scx
.rwx------  73k msikma 14 Jul  2021 (4)Revolver0.95.scx
$ ls -l BSL\ S13/
.rwxr-xr-x@  42k msikma 24 Nov  2019 (2)Heartbreak Ridge 2.1.scx
.rwxr-xr-x@  71k msikma  1 Oct  2021 (2)Vertebrae_1.33(n).scm
.rwxr-xr-x@  91k msikma  1 Oct  2021 (3)Ascension_1.0.scx
.rwxr-xr-x@  42k msikma 29 Jul  2018 (3)Aztec 2.1.scx
.rwxr-xr-x@  89k msikma  1 Oct  2021 (4)GOOD NIGHT 1.31.scx
.rwxr-xr-x@  73k msikma  1 Oct  2021 (4)Revolver1.0.scx
.rwxr-xr-x@  98k msikma  1 Oct  2021 (4)Wavelet_2.06(n).scx
$ bwpreview -d . --preset full
Generated image: ASL S12/(4)GOOD NIGHT 1.3.png (png, 4096x4096, 3155 ms, 7.88 MB)
Generated image: ASL S12/(4)Largo_1.4.png (png, 4096x4096, 3001 ms, 8.88 MB)
Generated image: ASL S12/(4)Lemon 0.95.png (png, 4096x4096, 1667 ms, 8.14 MB)
Generated image: ASL S12/(4)Revolver0.95.png (png, 4096x4096, 1496 ms, 6.39 MB)
Generated image: BSL S13/(2)Heartbreak Ridge 2.1.png (png, 4096x3072, 2994 ms, 6.22 MB)
Generated image: BSL S13/(2)Vertebrae_1.33(n).png (png, 3584x4096, 1585 ms, 8.62 MB)
Generated image: BSL S13/(3)Ascension_1.0.png (png, 4096x4096, 3651 ms, 8.42 MB)
Generated image: BSL S13/(3)Aztec 2.1.png (png, 4096x4096, 1440 ms, 8.84 MB)
Generated image: BSL S13/(4)GOOD NIGHT 1.31.png (png, 4096x4096, 1750 ms, 7.93 MB)
Generated image: BSL S13/(4)Revolver1.0.png (png, 4096x4096, 1492 ms, 6.39 MB)
Generated image: BSL S13/(4)Wavelet_2.06(n).png (png, 4096x4096, 1959 ms, 7.84 MB)

If we instead want just small preview files, and we want to save them all to a flat structure, we can do the following instead:

$ mkdir map_previews
$ bwpreview -d . --preset preview --out-path ./map_previews --flatten
Generated image: map_previews/(4)GOOD NIGHT 1.3-preview.avif (avif, 1000x1000, 1961 ms, 263.77 kB)
Generated image: map_previews/(4)Largo_1.4-preview.avif (avif, 1000x1000, 2132 ms, 304.36 kB)
Generated image: map_previews/(4)Lemon 0.95-preview.avif (avif, 1000x1000, 2009 ms, 285.33 kB)
Generated image: map_previews/(4)Revolver0.95-preview.avif (avif, 1000x1000, 1784 ms, 228.55 kB)
Generated image: map_previews/(2)Heartbreak Ridge 2.1-preview.avif (avif, 1000x750, 3479 ms, 184.5 kB)
Generated image: map_previews/(2)Vertebrae_1.33(n)-preview.avif (avif, 875x1000, 3580 ms, 311.09 kB)
Generated image: map_previews/(3)Ascension_1.0-preview.avif (avif, 1000x1000, 3889 ms, 247.8 kB)
Generated image: map_previews/(3)Aztec 2.1-preview.avif (avif, 1000x1000, 1951 ms, 264.51 kB)
Generated image: map_previews/(4)GOOD NIGHT 1.31-preview.avif (avif, 1000x1000, 3354 ms, 264.84 kB)
Generated image: map_previews/(4)Revolver1.0-preview.avif (avif, 1000x1000, 1788 ms, 228.55 kB)
Generated image: map_previews/(4)Wavelet_2.06(n)-preview.avif (avif, 1000x1000, 2582 ms, 318.27 kB)

Note that the generated previews are much smaller in both image size and in filesize, and that all resulting files are in the same directory as opposed to in a directory structure like before.

Graphics

To be able to generate preview images, you'll need to extract the required graphics from StarCraft.

A copy of the required graphics can be found here (18.4M), provided for convenience reasons.

You can also extract them from the game files directly using a program such as CascView.

The following files are needed:

  • all files listed in units.js and sprites.js files from bw-chk;
  • for all tilesets ['badlands', 'platform', 'install', 'ashworld', 'jungle', 'desert', 'ice', 'twilight'], all files of extension ['.cv5', '.vx4', '.vr4', '.wpe', '.vx4ex'].

All filenames should be lowercase, as that's how bw-chk expects them to be (although on case insensitive filesystems this doesn't matter).

License

MIT license

You might also like...

A tiny script and component intended to be used with Astro for generating images with eleventy-img.

Astro + eleventy-img A tiny script and component intended to be used with Astro for generating images with eleventy-img. It also supports creating blu

Dec 16, 2022

πŸ–Ό Simple file-upload utility that shows a preview of the uploaded image. Written in TypeScript. No dependencies. Works well with or without a framework.

πŸ–Ό Simple file-upload utility that shows a preview of the uploaded image. Written in TypeScript. No dependencies. Works well with or without a framework.

file-upload-with-preview πŸ–Ό Simple file-upload utility that shows a preview of the uploaded image. Written in TypeScript. No dependencies. Works well

Dec 26, 2022

Piccloud is a full-stack (Angular & Spring Boot) online image clipboard that lets you share images over the internet by generating a unique URL. Others can access the image via this URL.

Piccloud Piccloud is a full-stack application built with Angular & Spring Boot. It is an online image clipboard that lets you share images over the in

Dec 15, 2022

It's a javascript Class which contains utility methods that simplify working with google maps web SDK

About GoogleMapsJSHelper It's a javascript Class which contains utility methods that simplify working with google maps web SDK Note: i used ES7 Class

Jul 23, 2022

A vanilla js library to show preview images on hover

Hover Preview A vanilla js library to show preview images on hover, check a Demo here Please watch πŸ‘€ or star 🌟 this repo if you like it. Getting sta

Dec 13, 2021

Generate social preview images in your Next.js API from Sanity webhooks

Generate social preview images in your Next.js API from Sanity webhooks

sanity-next-social-image-generator Automatically generate social share images using Sanity webhooks, and your Next.js API! Requirements A Next.js appl

Sep 4, 2022

A utility for creating toggleable items with JavaScript. Inspired by bootstrap's toggle utility. Implemented in vanillaJS in a functional style.

LUX TOGGLE Demo: https://jesschampion.github.io/lux-toggle/ A utility for creating toggleable dom elements with JavaScript. Inspired by bootstrap's to

Oct 3, 2020

This repo contains utility tools for manipulating files, process images and automation.

This repo contains utility tools for manipulating files, process images and automation.

utility-tools-cli This repo contains utility tools which makes life lil bit easier. Features Rename Files in a Folder with the convention you want. Re

Nov 4, 2022

Utility to generate adwaita presets for use with AdwCustomizer from images using Google's MaterialU color generator.

Utility to generate adwaita presets for use with AdwCustomizer from images using Google's MaterialU color generator.

Adwaita Preset Generator using Material U Color Generation Material U Color generation is done using the material-color-utilities available here: http

Oct 31, 2022
Owner
Michiel Sikma
Dutch programmer, ζ—₯本θͺžπŸ†—. I mostly work with Node. πŸ˜‹πŸ§πŸ˜‹πŸ‘πŸ˜‹πŸ…πŸ˜‹πŸπŸ˜‹πŸ°πŸ˜‹πŸ—πŸ˜‹πŸ©πŸ˜‹πŸ’πŸ˜‹πŸπŸ˜‹πŸ–πŸ˜‹πŸ¨πŸ˜‹πŸŒπŸ˜‹πŸ€πŸ˜‹πŸŽπŸ˜‹πŸ‡πŸ˜‹πŸœπŸ˜‹πŸ‘πŸ˜‹πŸŒ½πŸ˜‹
Michiel Sikma
Grupprojekt fΓΆr kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet fΓΆr kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide FΓΆr information om hur utv

Svante Jonsson IT-HΓΆgskolan 3 May 18, 2022
Hemsida fΓΆr personer i Sverige som kan och vill erbjuda boende till mΓ€nniskor pΓ₯ flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo fΓΆr kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Codebraid Preview provides a Markdown preview for Pandoc documents within VS Code.

Codebraid Preview provides a Markdown preview for Pandoc documents within VS Code. Most Markdown previews don't support all of Pandoc's extensions to Markdown syntax. Codebraid Preview supports 100% of Pandoc featuresβ€”because the preview is generated by Pandoc itself! There is also full bidirectional scroll sync and document export.

Geoffrey Poore 12 Dec 28, 2022
Get an isolated preview database for every Netlify Preview Deployment

Netlify Preview Database Plugin Create an isolated preview database for each preview deployment in Netlify Quickstart β€’ Website β€’ Docs β€’ Discord β€’ Twi

Snaplet 10 Nov 16, 2022
πŸ’„ An app to create, edit, and preview HDR environment maps in the browser

Environment Map Light Editor Create, edit, and preview HDR environment maps in the browser. Preview your models in realtime and export lightmaps to us

Poimandres 30 Dec 30, 2022
Help Ukraine - add ribbon with Ukraine flag into the website you manage, show the anti-war message to Russian users, or block them from your service.

?? Stop war on Ukraine ?? Help Ukraine - add ribbon with Ukraine flag into the website you manage, show the anti-war message to Russian users, or bloc

Pavol HejnΓ½ 46 Jan 7, 2023
Will rock your s/o/x off β€” This is war you "hackerman" πŸ€“

tiktxk An open source, privacy first Cloudflare Worker for generating TikTok video download links. Replace the o with x and you'll get served the vide

Britmoji Inc. 30 Dec 12, 2022
Password Generator - A fast, simple and powerful open-source utility tool for generating strong, unique and random passwords

A fast, simple and powerful open-source utility tool for generating strong, unique and random passwords. Password Generator is free to use as a secure password generator on any computer, phone, or tablet.

Sebastien Rousseau 11 Aug 3, 2022
A utility for generating Solidity code for recovering signatures using the EIP-712 signTypedData schema.

EIP 712 Codegen EIP 712: Sign Typed Data as of 2022 is the most human-readable way of getting signatures from user that are easily parsed into solidit

Dan Finlay 58 Oct 20, 2022