WadC session running [pipeloop.wl](https://github.com/jmtd/wadc/blob/master/examples/beta/pipeloop.wl)

WadC session running pipeloop.wl

WadC is a programming language (formally, a normal-order evaluated functional language1) for the construction of Doom maps. Think of it like Logo on steroids, with demons and shotguns.

WadC requires Java to run (get Oracle's here). The current version of WadC is 2.0. (Here's a zip). You can get the WadC source code from github.

Getting started

Download WadC. You'll also need a Doom engine (I recommend Eternity), a node builder (I recommend glBSP) and an IWAD (game data). If you don't have the commercial game data, buy it from GoG or grab FreeDoom. Unpack them all. Launch WadC by double-clicking the JAR file. Open (⌘ + O) up the newly created default wadc.cfg file which is in a folder .wadc in your home space (possibly c:\users\yourname or /home/you). Fix the paths in doomexe and bspcmd then Run the cfg file (⌘ + R), Save it (⌘ + S) and Open up one of the files from "examples/" in the unpacked WadC ZIP. From the WadC Control menu, hit Run / Save / Save WAD / BSP / Doom to try it out!

Try hacking an existing example or writing your own - see the language reference.

New in 2.0

An old WadC session

An old WadC session

Check the release notes for the full details, but in brief

  • A tech-preview command line interface (wadcc)
  • Now distributed in a JAR file:
    • not sensitive to current working directory anymore
    • one binary file to copy around ("portable"), double-click to launch
  • CFG file now read and written from your home space
  • include files now looked for in the same place as the code that included them, then failing that, the JAR file
  • configuration file paths to WADs, engines etc. now work fine with paths with spaces or other special characters in them
  • WadC code gets embedded in your WADs in a WADCSRC lump!
  • define custom textures (texture(...) and add patches to them (addpatch(...)
  • You can fix the random number generator seed for reproducible builds
  • new library helpers for Boom deep water management
  • lots of new examples (including half finished ones) and little library helpers
  • documentation revised and revamped
  • bug fixes, etc.


Have you made a cool WadC level? Let's put it in WadC! The easiest way to collaborate is to send a pull request on github. Feel free to make suggestions or report bugs via github issues.

You can also just email me if you don't like GitHub, or leave a comment on this page.

Future work

the resulting map

the resulting map

For the most part, WadC is very rarely updated. The following have been considered and may happen one day:

  • A verbose tutorial
  • improve or at least diagnose and report issues running wadc in non-Sun JREs
  • investigate feasibility of altering the way sector lines are chosen so as to make chaining stuff together easier (i.e., if you choose a line already assigned to a sector, instead of dying, try another line which terminates at the same vertex — but ensure we remain deterministic)
  • compiler optimisations
  • Contemplate a rewrite in Haskell

See also

WadC was originally written by Wouter van Oortmerssen (Aardappel). Aardappel's historic WadC web page and version 1.1 are available at http://strlen.com/wadc/.


comment 1

Hi Jon,

Been playing with WadC the last week and have made some functions that (if they appear to work) you might want to put into the standard.h? The reason I looked to make them was to try and see if WadC could make random layouts.

greaterthaneq(a, b) {
  lessthaneq(add(b, 1), a)

roundup(val, step) {
  add(mul(div(val, step), step), step)

rounddown(val, step) {
  mul(div(val, step), step)

-- Random function: Call random(min, max)
-- random2 is a helper function to get "unique-ish" jump values
-- with each loop
random2(range) {
  set("randVal", add(get("randVal"), div(range, 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15)))

random(min, max) {
  set("randVal", min)
  for(1, 10 | 20 | 30 | 40, greaterthaneq(random2(add(abs(min),abs(max))), max) ? set("randVal", add(sub(get("randVal"), max), min)) : 0)

-- Square root function: Call sqrt(x)
-- sqrt2 & sqrt3 are helper macros to test upward and then
-- down if we go over the target value.
sqrt3(_val, _exp) {
  lessthaneq(div(_val, _exp), _exp) ? sqrt3(_val, sub(_exp, 1)): add(_exp, 1)

sqrt2(_val, _exp, _step) {
  lessthaneq(div(_val, _exp), _exp) ? sqrt3(_val, _exp) : sqrt2(_val, add(_exp, _step), _step)

sqrt(_val) {
  lessthaneq(_val, 0) ? 0 : { greaterthaneq(_val, 100) ? sqrt2(_val, 1, 50) : sqrt2(_val, 1, 5)}

-- I also changed the existing for(x, y, z) function to use the "_" notion
-- as explained in your readme as I was coming across the "lazyness" in
-- the loops for random and sqrt functions. I think it still works as intended?
for(_from, _to, body) {
  lessthaneq(_from, _to) ? body for(add(_from, 1), _to, body) : 0

All the best, Travers

Comment by traversd
comment 2


This seems like an interesting concept.

Too bad it requires Java. I hate using Java apps, because it requires the presence of Java, something I'd rather keep as far away as possible from my machine.

Please consider porting it to C++, shouldn't be too much work, given the similarity of languages.

Comment by PooshhMao
comment 3


Please consider porting it to C++, shouldn't be too much work, given the similarity of languages.

Thanks for your comment. There's basically no chance of me porting this to C++. I've tried to resist the effort to do much clean-up or other yak-shaving and focus any effort I put into WadC on adding something useful. I want to try and keep a very high effort:gain ratio as I don't have much time to put into it.

I can appreciate that some people are not happy to install a JRE. It is likely quite possible for WadC to be compiled in some alternative way to result in something other than java classes/JAR. I imagine that the CLI at least will work fine if compiled to a native EXE via GCC. It might also be posslble to do something interesting with IKVM to run it on a .NET platform. However, I will leave these investigations to others. I'd be happy to hear how people got on - it's just not my itch to scratch.

(I might at least give a native build a quick look when I do the Debian package in the near future.)

The reason I'm reluctant to wander too far "off reservation" is if I did have more time to dedicate to this, I'd basically like to rewrite/redesign it from the ground up on top of something like Haskell, most likely as an EDSL, and therefore harness much of the power of an existing, mature functional language, rather than have to implement that all again.

comment 4


We've added a link to WadC to LinuxLinks.com

Regards, Steve

Comment by Steve Emms