A WadC session

A WadC session

WadC is a programming language for the construction of Doom maps. The current version of WadC is 1.2: (zip).

You can get the WadC source code from github.

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/.

New in 1.2

An old WadC session

An old WadC session

  • Doom features:
    • friendly flag - toggle boom friendly monsters
    • impassable flag - toggle impassable 2s lines
    • midtex flag - toggle middle-textures on 2s lines
  • new examples:
    • 1.2_features.wl - demo the new features above
    • entryway.wl - a recreation of Doom 2 MAP01 in WadC, thanks GreyGhost

Future work

the resulting map

the resulting map

the map again

the map again

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

  • A verbose tutorial
  • convert the lisp-style lists example into a re-usable library routine
  • improve or at least diagnose and report issues running wadc in non-Sun JREs
  • decouple the compiler from the UI, so as to provide a command-line compiler
  • 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

Comments

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)))
  get("randVal")
  }

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)
  get("randVal")
}

-- 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