wal

Quake modding toolkit for R. Can read, export and import Quake bitmap images in WAL and Q1 texture formats, read and export MDL and MD2 models, extract PAK and WAD archives.

https://github.com/dfsp-spirit/wal

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.1%) to scientific vocabulary

Keywords

image pak quake quake-engine quake2 textures wad wal
Last synced: 6 months ago · JSON representation

Repository

Quake modding toolkit for R. Can read, export and import Quake bitmap images in WAL and Q1 texture formats, read and export MDL and MD2 models, extract PAK and WAD archives.

Basic Info
  • Host: GitHub
  • Owner: dfsp-spirit
  • License: gpl-3.0
  • Language: R
  • Default Branch: main
  • Homepage:
  • Size: 337 KB
Statistics
  • Stars: 10
  • Watchers: 2
  • Forks: 1
  • Open Issues: 0
  • Releases: 3
Topics
image pak quake quake-engine quake2 textures wad wal
Created over 5 years ago · Last pushed about 2 years ago
Metadata Files
Readme Changelog License

README.md

wal

Tools to work with Quake game assets in R. Useful for messing with Quake and Quake II game textures. Can read, write, create and export bitmap images in WAL file format and related texture formats. Includes tools to extract WAD and PAK files. Can read Quake and Quake II models in MDL and MD2 formats and allows for exporting to standard mesh formats.

Vis

About

The WAL file format is an old format for storing indexed bitmap images, used as textures in idtech1 and idtech2 games. A single WAL file contains four mipmaps of the same image. WAL format files are indexed but do not contain the palette needed to reconstruct the image. You can use your own palette, or use the Q1 or Q2 palettes that come with this package.

Note that whe WAL textures are stored inside Quake pak file archives (baseq2/pak0.pak), so you will not see any WAL files in your Quake 2 directory unless you extracted them for mapping or modding. For Quake I, textures in a very similar format that is also supported are stored directly in the BSP level files (which are inside Id1/PAK0.PAK), or in WAD files.

Package features

Managing WAL images:

  • Reading WAL format images, including all mipmap levels. By default, the largest version is used.
  • Visualization of WAL images in R, including all mipmap levels (requires a palette).
  • Export of WAL images to PNG and JPEG format files (requires a palette).
  • Two important palettes are included: the Q1 and Q2 palettes.
  • Writing of a WAL image instance to a new file in WAL format.
  • Converting other images (PNG, JPEG, whatever) to WAL instances and files, including:
    • Mapping the colors of the source image to the most similar colors of the target WAL palette. This is done in LAB color space using DeltaE as the similarity measure.
    • Generation of the mipmaps.

Related Formats and Features:

  • Reading WAD files in the 'WAD2' archive format used by Quake I and related games. These are tar-like archive files that hold collections of Quake assets (colormaps, textures in Q1 Mipmap Texture format, console pics, ...). Note that some games like Daikatana use a similar, but not identical format and still name their archives WAD files. These other WAD-like formats are currently not supported. Please open an issue if you need support for them.
  • Extracting WAD archives to a directory.
  • Reading, visualizing, and exporting Q1 Mipmap format textures. These are the textures used by Quake I, and they are typically stored directly in the binary maps (BSP files) or in WAD texture archives (see above). The Q1 Mipmap Texture format is very similar to the Quake II WAL format.
  • Reading and extracting 'PAK' archives.
  • Reading and exporting Quake models, including Quake MDL files and Quake II MD2 files. You can visualize them directly in R with 'rgl' or export them to standard model file formats like '.obj' format to open them in standard modeling software.

Installation

I recommend to install the stable wal version from CRAN. In your R session:

install.packages("wal");

To install the development version (no complaints or bug reports, please):

install.packages("devtools");
devtools::install_github('dfsp-spirit/wal')

Package API

Reading and displaying WAL textures in R

wal_file = "~/path/to/q2_pak0_extracted/textures/e1u2/basic1_7.wal";
wal = wal::read.wal(wal_file);

plot(wal);  # S3 plot method for 'wal' instances, uses preview palette. Alternatively:
wal::plotwal.mipmap(wal, mip_level = 1L, apply_palette = wal::pal_q2());  # Plot with full control.

Exporting WAL textures to other formats

wal::wal.export.to.jpeg(wal, "~/mytex.jpg", palette = wal::pal_q1(), quality = 0.95);
wal::wal.export.to.png(wal, "~/mytex.png");          # palette defaults to pal_q2().

Convert a JPEG or PNG image to WAL format

jpeg_file = "~/mytextures/bricks_256x256.jpg";
wal = img.to.wal(jpeg::readJPEG(jpeg_file));
wal::writeWAL("~/myfile.wal", wal);

For more information, read the detailed vignette that comes with the package. Examples for working with models and archives can be found in the unit tests.

References

Documentation on the WAL format seems sparse. I did not find any official spec so I used the Quake 2 source code to learn about the format. Relevant files are:

  • r_image.c with WAL loading function R_LoadWal
  • To understand the latter, you will need to have a look at the miptex_s struct in qfiles.h and at the image_s struct in r_local.h

Unit tests and CI

R-CMD-check

AppVeyor build status AppVeyor CI under Windows <!-- badges: end -->

Owner

  • Name: Tim Schäfer
  • Login: dfsp-spirit
  • Kind: user
  • Location: Frankfurt, Germany
  • Company: Max Planck Institute for Empirical Aesthetics

Bioinformatician, former Neuroscientist, and Software Developer. Currently Research Software Engineer at MPI AE.

GitHub Events

Total
Last Year

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 113
  • Total Committers: 2
  • Avg Commits per committer: 56.5
  • Development Distribution Score (DDS): 0.071
Top Committers
Name Email Commits
Tim Schäfer t****e@r****g 105
Tim Schäfer d****t@u****m 8
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 243 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 3
  • Total maintainers: 1
cran.r-project.org: wal

Read and Write 'wal' Bitmap Image Files and Other 'Quake' Assets

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 243 Last month
Rankings
Forks count: 21.9%
Stargazers count: 22.5%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Average: 39.5%
Downloads: 87.8%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • freesurferformats >= 0.1.12 imports
  • imager * imports
  • jpeg * imports
  • png * imports
  • spacesXYZ * imports
  • knitr * suggests
  • rmarkdown * suggests
  • testthat >= 2.1.0 suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v4 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite