Modules
The actions things run on entering a state, by the names the state table gives them.
The WAD a game is played from, read once and shared by every process: its pictures, levels, sounds and music, and the tables derived from them.
Doom as a Cauldron2D.Client.Game: the keys, the picture the terminal shows, the sound
effects and the music.
Hurting and killing: damage with its knockback, armour and pain; death and what a monster drops; instant-hit shots and the aim that picks their target; missiles; and blasts that hurt everything in sight of them.
What monsters do in their states: wait and listen, chase, close in and attack, and cry out when hurt or killed.
Doom as a Cauldron2D.Game: an episode played level by level at 35 tics a second.
A player's view described for the graphics card, as a scene's :gpu
(Cauldron2D.Client.Game): the same picture ElixirDoom.Render draws in software.
Doom's 2D layer for the graphics card's picture, as RGBA 640 by 400 (Doom's 320 by
200 screen twice over) to be stretched over the frame: during a level the weapon in
hand, the border of a smaller view, the status bar, messages and the automap; between
levels the tally and the closing text, opaque; and an open menu over all of it. Pixels
nothing is drawn on are fully see-through.
Doom's shimmer (a spectre, a partly invisible player's weapon) as a graphics card material: the picture's shape filled with what is behind it, each row taken from one of Doom's 200 screen rows above or below, darkened as light table 6 darkens.
The things of a level view as upright pictures for the graphics card, one instance a thing, kept under the thing's id so the renderer moves it smoothly between ticks.
Doom's palette washes as the graphics card's screen tint: the display colour and
strength {r, g, b, a} (0..1) that blending the finished frame's display colours
towards gives the colours of palette index in place of palette 0.
The weapon of a partly invisible player for the graphics card: its shimmering
pictures (ElixirDoom.Render.Weapon.sprites/4) as flat pictures held just in front of
the camera, filling the same rectangles of the view as Doom draws them, drawn with
ElixirDoom.Gpu.Shimmer. The weapon's other pictures are in the overlay.
Doom's pictures read out of a WAD into one Cauldron2D.Sectors.Pictures set: the
composed wall textures, the floor flats, every patch — sprites, the status bar, the
weapons — and the palettes and light tables to draw them with.
Doom's state table and thing types, generated from the GPL info.c by
mix doom.info. Do not edit by hand.
Picking things up: what each pickup gives, the message it shows, the sound it makes, and whether it is taken at all — a full medikit is left lying when health is full.
Drawing over a finished picture: whatever a function draws onto a frame the picture's size is laid over the picture's RGBA, every other pixel left as it was. The function is run on two frames of different colours, so a pixel it drew is known whatever colour it drew in. Rows it drew nothing on are copied whole.
A Doom level read from a WAD into a Cauldron2D.Sectors.Map, with the things placed in
it.
Doom's menus, as the player moves through them: main, episode, skill, options, sound
volume, controls, the read-this screens, and Doom's messages that wait for a key or for
y or n (a controller's A, {:key, :enter, [:pad]}, answers y).
Doom's menus drawn as Doom draws them, from the WAD's own pictures at Doom's positions in its 320 by 200 screen, stretched to the frame and kept above the status bar: the title, the items (the options raised to make room for the controls), the blinking skull, the sliders, the on and off switches, the read-this screens, the controls in Doom's small font, and Doom's messages centred on the screen.
Things — players, monsters, missiles, pickups, decorations — and how each moves and changes state every tic.
A player: what they carry, how their keys move them, how high their eye sits and bobs, reaching for switches and doors, taking damage through armour, and dying.
A player's view drawn as a picture of any size: the level through
Cauldron2D.Sectors.View, the weapon in hand, messages, the status bar along the
bottom, the automap when it is open, the screen's red and gold flashes, and the
tallies between levels.
The automap: the lines of the level the player has seen (all of them with the computer map), drawn around the player's arrow on black.
Doom's screen sizes: below size 10 the view is a smaller window centred in the space above the status bar, framed by the border flat and its bevelled edges.
Where things go on a level's picture: the player's options with Doom's defaults filled in, the screen size in force (at least 10 while the automap is open), the status bar's height (32 of every 200 rows, none at size 11) and the height left above it for the view.
The pictures shown between levels and when nothing is in play: the tally after a level, the episode's closing text, a blank screen, and the backdrops they stand on.
How a player's state colours the whole picture: the palette it is drawn through (red when hurt or berserk, gold on a pickup, green in a radiation suit) and the light table that replaces lighting while invulnerable or wearing light amplification goggles.
The weapon in the player's hands and its muzzle flash, drawn over the view as Doom draws its player sprites: placed on Doom's 320 by 168 view stretched to the view's size, lit by the player's sector, unlit when bright, through the fixed light table when one is in force, and as a shimmer while the player is partly invisible.
The lines each player has seen on each level, for their automap. The view that draws a player's picture records what it drew; the automap reads it back.
Doom's sound effects — the DS* lumps, 8-bit DMX recordings — as TuningFork voices.
The level's machinery, as the rest of the game reaches it: lines that do something when used, walked over or shot; the sector specials a level starts with; floors that hurt; and running every machine once a tic.
Starting ceilings and crushers by tag, stopping crushers, and starting stopped ones again.
Starting doors: the ones a player opens by hand — the sector behind the line used, some locked to a key — and the ones a line opens or shuts by tag.
Starting floors that move by tag, and stairs that build themselves step by step.
Sector lights that change by themselves — flickering, strobing, glowing — and lines that set a tagged sector's light.
The world's running machines — movers, lights, switch timers — kept as
Cauldron2D.Thinkers, and which sectors a mover has taken. A sector taken by one mover
is not given to another until the first is released.
Doors, lifts, floors and ceilings moving a tic at a time, and what moving a plane does to the things in its sector: lifting them, stopping against them, crushing them.
Starting lifts and the floors that rise and take another sector's texture, stopping them, and starting stopped ones again.
Questions the level's machinery asks about sectors: their neighbours' floors, ceilings and lights, which sectors carry a tag, where a sector is, and the shortest lower texture round one.
Switches: the texture on a used line flips to its pair, and a switch that can be used again flips back a second later. A line that works once is marked used.
Teleporters: a thing crossing a teleport line from its front arrives at the teleport destination in the tagged sector, facing its way, with fog and a sound at both ends. Missiles never teleport. A player arriving where something stands kills it; anything else finds the way blocked and stays.
Doom's status bar drawn onto a frame: ammunition, health, the weapons owned, the face, armour, keys and every ammunition count, laid out as Doom lays them out across the bottom 32 rows of its 320 by 200 screen and stretched to the frame.
Doom's fixed tables: the random table every chance is drawn from, the weapons and their states, ammunition, the textures and flats that animate, and the switch pairs.
Writing in Doom's small font (STCFN033..STCFN095) onto a frame, placed in Doom's
320 by 200 screen and stretched to the frame, and the message line a player sees after
picking something up.
The numbers that decide how Doom moves and fights, as a Cauldron2D.Tuning. Defaults
are Doom's own; config :elixir_doom, <setting>, value moves a default, and
ElixirDoom.Game.init/1's :tuning option beats both.
A Doom WAD file: its lumps by name and in order.
The weapon a player holds: the two pictures drawn over the view — the weapon and its muzzle flash — each running through its own states, raising, lowering, readying and firing, and what each weapon does when it fires.
One level being played: the sectors and sides as they are now, every thing in it, the players, the sector machinery at work, and the random draw everything shares.
Mix Tasks
Play a Doom WAD in the terminal.
Read the state table and thing definitions out of a GPL Doom source tree's info.c
and write them as lib/elixir_doom/info.ex.