API Reference elixir_doom v#0.1.0

Copy Markdown View Source

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.

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.

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