Skip to content

About

A pseudo-3D FPS in one pure-PowerShell file. Renders real Doom levels from a WAD you supply. No Add-Type, no modules, no admin, pure ASCII source.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

DOOM.PS1

An FPS in one pure-PowerShell file. Runs on locked-down work machines: no modules, no admin, no Add-Type, no internet, PS 5.1 compatible.

It plays a built-in demo map out of the box, and it can also load and render a real Doom level from a WAD — full BSP renderer, per-sector floor and ceiling heights, portals, and Doom's own sector lighting.

Run

powershell -ExecutionPolicy Bypass -File .\doom.ps1

Playing a real Doom level

powershell -ExecutionPolicy Bypass -File .\doom.ps1 -Wad .\doom1.wad -Map E1M1

You need to supply the WAD. id Software open-sourced the Doom engine, not the levels — map geometry, textures and sprites are copyrighted content that ships in the game data, so there is none of it in this script. That is the same arrangement every source port uses.

The free shareware doom1.wad is the easiest way in: id has always allowed it to be redistributed, it costs nothing, and it contains E1M1. A doom.wad from any retail install works too. Drop either next to doom.ps1 and it will be found automatically; otherwise pass -Wad <path>.

What works today: the level's real geometry, sector heights, stairs and ledges, textured walls, floors and ceilings, the sky, things and monsters with correct 8-way sprite rotation and proper occlusion, solid props, four working weapons, doors and the level exit, plus Doom's own palette, light diminishing and movement rules (24-unit step limit, 56-unit headroom).

Skill works, and it matters more than you'd think. The map places different monsters at each difficulty, exactly as the original does — E1M1 has 4 monsters on the easy settings, 6 on Hurt Me Plenty and 29 on Ultra-Violence, where every one of its shotgun sergeants lives. Pick one at the title screen or pass -Skill 1..5; the default is Hurt Me Plenty, as Doom's own menu is.

Monsters now fight back. They notice you on sight, wake when they hear your gun, walk at you around corners, and attack: zombiemen and sergeants shoot, imps claw up close and otherwise throw a fireball you can see coming and sidestep. A hitscan shot draws a red tracer back to whoever fired it. Shooting one staggers it, and killing it plays its death animation and leaves a corpse. Armour soaks a third of what hits you, and at zero health the view sinks to the floor.

Doors open, and the level ends. Press E to use whatever you're facing — a door swings up, waits, and closes behind you; a keyed door tells you which colour it wants; and the exit switch finishes the level and gives you your kill and item tally. A door closing on you reverses rather than crushing you, and pressing E again reverses one mid-move.

Shots draw blood when they connect, which matters more than it sounds: the pistol needs five hits to drop an imp, and without any impact visual that reads as your bullets doing nothing at all.

Doom's status bar is on screen, drawn across the bottom of the view with the game's own bar background behind it: the big red digits for health, armour and ammo, and the face. It works with WADs old enough to predate the single STBAR graphic, which store the background in two halves.

The face works the way you remember. It gets bloodier as you do, turns toward whatever just shot you, winces at a heavy hit, grins when you pick up a weapon, and dies when you do. The red screen-edge marker stays too — the face is small, and it does not exist at all on the renderers that have no pixels to draw it with, which are exactly the ones where being shot from behind is hardest to read.

The status bar needs a colour renderer and textures; mono, ascii and cell keep the one-line text HUD, as does -NoTextures.

Lifts, moving floors and the triggers that fire when you walk over them are still to come, as is sound.

About damage you cannot see coming

Two separate problems, with two separate cues.

Something in front of you is shooting. Zombiemen and sergeants fire hitscan weapons, which hit instantly — there is no fireball to watch travel, so the shot itself used to draw nothing at all, even with the shooter plainly on screen. Now every hitscan shot leaves a brief red tracer from the shooter to your gun, so a hit always names which monster fired it. It is longest when the shooter is far off and only a few pixels tall, which is exactly when you need it most.

Something behind you is shooting. Roughly two thirds of the damage you take comes from outside your field of view. That is Doom behaving normally — monsters shoot you in the back — but Doom tells you about it with sound and a status-bar face that turns toward the hit, and neither of those exists here yet.

So instead, a red marker lights the screen edge the damage came from: the left or right side for something beside you, and the bottom edge for something behind you. The HUD names the direction in words too, for the renderers with no colour. Step out of the starting alcove and something will usually see you within a couple of hundred units — turn toward the marker.

Monsters also will not shoot from further away than the viewport can actually draw them: one has to appear at least ten pixels tall before it may fire. Doom's shooters engage from around 2000 units, but Doom had 200 rows — here that same monster is a three-pixel smudge, so inheriting its range just meant being hit by something invisible. Note this is a limit in pixels, not units, which is why it tightens as the resolution rises rather than cancelling the benefit. They still wake from far off and walk toward you.

The bodies and gore already lying around the map are scenery placed by the level designer, not live monsters; they are drawn with their death frames.

Monsters the designer marked as ambush stay put until they actually see you — they will not come running at the sound of your gun. Several of the ones guarding E1M1's armour corridor are flagged that way.

Difficulty

skill E1M1 monsters
1 I'm Too Young To Die 4 — plus double ammo and half damage taken
2 Hey, Not Too Rough 4
3 Hurt Me Plenty (default) 6
4 Ultra-Violence 29
5 Nightmare! 29 — faster monsters, double ammo

Doom stores skill in each thing's flags with one bit covering two settings, so 1 and 2 place the same monsters, as do 4 and 5; what separates each pair is the ammo and damage handling. Monsters placed for multiplayer only are skipped, as they should be in a single-player game. Nightmare does not respawn the dead.

The HUD shows kills as K killed/total, so the denominator tells you which skill is actually in force.

Add -Ascii if block characters render as garbage. Must be a real console window (not ISE). Needs at least 62x24.

Resolution

The view follows your console window instead of a fixed size, up to 147x46 by default — 81% more pixels than it used to draw. Making the window bigger, or the terminal font smaller, is the single biggest visual upgrade available and costs the renderer nothing.

Width is capped to a constant 3.2:1 against the height, which holds the vertical field of view at ~64 degrees whatever size you play at. Without that a maximised terminal would render a letterbox slit with a different FOV from a small one, so extra window width buys detail, never more visible world.

-MaxWidth 160 -MaxHeight 50     # bigger, if your machine can take it
-MaxWidth 0   -MaxHeight 0      # fill the window, no cap

Width comes first. The view is always about 3.2x wider than it is tall, so if -MaxWidth ends up smaller than -MaxHeight the two are probably swapped — the game will say so rather than just refusing to start.

The default is deliberately not the largest thing that averages inside budget. On real E1M1 at hi, 147x46 costs 21.8 ms a frame with a 29.1 ms worst case against a 33 ms budget; 160x50 averages a comfortable 25.4 but spikes to 39, and that spike is what you feel. Larger is one switch away if your terminal is quick.

Higher resolution also makes enemies bigger, and they will not shoot you from further away to compensate — a monster has to appear at least 10 pixels tall before it opens fire, so the extra pixels go into seeing what is shooting at you rather than into longer sightlines. They still notice you from a distance and walk in.

If it stutters — read the two numbers

The HUD shows the frame cost as 21r 31p: r is the renderer, p is your terminal swallowing the frame. They are different problems with opposite fixes, and on most machines p is the larger one — drawing a textured frame is cheap next to shipping ~100 KB of colour codes to a console 30 times a second.

the bigger number what is short reach for
p (present) terminal throughput -NoTextures — cuts the output ~5x
r (render) CPU -Fast, or a smaller -MaxHeight

Measured at 160x50 on real E1M1: -Fast takes the render from 25.4 to 16.9 ms, -NoTextures takes it to 13.4 ms and the wire from 3.55 to 0.73 MB/s. So if p is what's high, -NoTextures is the answer even though -Fast sounds like the speed switch.

The game also does this for you. If it runs slow for a second it looks at which number is bigger, applies the matching fix, and says so — dropping textures first on a slow terminal, halving the columns first on a slow CPU, and falling back to mono if neither is enough. Forcing -Render hi does not stop it: that pins the renderer tier, and the game may still adjust columns and textures underneath it.

Everything it takes away, you can take back. It only ever downgrades on its own, so each thing it removes has a key that restores it:

it did this you undo it with
halved the columns F
dropped textures T
dropped a tier V

Pressing any of those also tells the game to stop adjusting things by itself. The tier readout in the HUD shows what is currently in force — f for halved columns, -t for textures off — so a flat-shaded picture is never a mystery.

The status bar needs textures, so if the game drops them the bar goes too. T brings both back.

Multiplayer

Off unless you ask for it. Nothing binds, listens or connects without -Lan or -Join, and when you do use it the game tells you exactly what is open.

# host on the LAN - no firewall rule, nothing exposed
.\doom.ps1 -Wad .\DOOM.WAD -Lan -Deathmatch -Name alice

# join them
.\doom.ps1 -Wad .\DOOM.WAD -Join THEIR-PC -Deathmatch -Name dave

The LAN default rides a named pipe over SMB, which is already open on any office network — so there is no firewall prompt, nothing for security software to flag, and no admin rights needed. Both machines need to be on the same domain or workgroup.

Over the internet you need TCP instead, because SMB's port is blocked end to end by essentially every ISP. That means forwarding a port on the host's router, so a password is required rather than optional:

.\doom.ps1 -Wad .\DOOM.WAD -Lan -Tcp 6666 -Pass hunter2 -Deathmatch
.\doom.ps1 -Wad .\DOOM.WAD -Join home.example.net:6666 -Pass hunter2

Anyone who finds that port can talk to the game, and the password is what stops them getting further. Consider a VPN between the machines instead — then the LAN path works unchanged and nothing is exposed at all.

Joining, and being in charge

Everyone picks a name (-Name, or your Windows username). The host has to admit you: they see dave wants to join and press Y or N. Names must be unique, and anyone silent for 90 seconds is dropped so they stop holding a slot.

key
Enter open the chat line, Enter again to send, Esc to cancel
Tab frag table
Y / N host only: admit or refuse whoever is knocking

Chat also takes commands: /kick <name> (host only) and /who.

Deathmatch

-Deathmatch spawns everyone at the map's own deathmatch starts — id placed those, so E1M1 has five and some maps have eleven — and stops filtering out the multiplayer-only weapon pickups, which exist precisely so MP players have something to find. Other players appear as marines, take hits, and respawn.

The host decides every hit: your machine says "I hit dave", the host checks the range and the line of sight before it counts. Frames are 50-100 ms stale, so this is a novelty rather than a competitive shooter — aiming at someone moving is genuinely hard.

Renderers

The game picks a renderer from your terminal's capabilities at startup and tells you which one it chose. Press V in-game to cycle through them if the pick looks wrong — that is the fastest way to find what your machine actually does well.

Tier What you get
hi Half-block truecolor: double vertical resolution, textured brick walls, perspective floor and ceiling, drawn sprites
mid Same, without the textured floor/ceiling
low Half-block truecolor, smoothly lit flat walls
cell 16-colour character cells
mono Character shading ramp, no colour — works anywhere
ascii Pure ASCII, for raster fonts where block characters break

The pixel tiers use the ▄ half-block glyph, whose foreground colours the bottom half of each character cell and background the top — so every cell is two independently coloured pixels.

hi auto-engages in Windows Terminal, the VS Code terminal, and ConEmu. Legacy conhost gets mono, because enabling VT there needs a P/Invoke call this script deliberately does not make. If a tier runs too slowly the game drops down one and says so; picking one yourself with V turns that off.

Switch Effect
-Render <tier> Force a tier: auto (default), hi, mid, low, cell, mono, ascii
-Ascii Shorthand for -Render ascii
-Color Force colour on where it was not detected
-NoColor Force the escape-free path — always wins
-MaxWidth / -MaxHeight Cap the viewport, default 147x46; 0 means fill the window
-Fast Render every other column and double it — WAD mode only; F toggles it in-game
-Wad <path> Load a real level from a WAD instead of the demo map
-Map <name> Which map to load, default E1M1
-Skill <1-5> Difficulty, default 3 (Hurt Me Plenty). Changes which monsters the map places
-NoTextures Flat-shade the level instead of sampling textures; T toggles it in-game

Keys

W/S move, A/D strafe, arrows turn, SPACE fire, E use (doors and switches), 1-4 weapon, V renderer, F sharpness, T textures, Q quit. At the title screen, 1-5 picks a skill.

In WAD mode you start with the pistol, as Doom does. Walk over the shotgun or chaingun to unlock them, then switch with 1-4. Pickups for health, armour and ammo all work. Kill the imps (&), grab shells (A), reach the exit (E) — the exit shows up as a beacon once you have a clear line of sight to it.

Imps stay put until they can actually see you, and neither you nor they can shoot through walls. The HUD's r and p figures are the real per-frame cost, split into renderer and terminal (the fps figure is capped at 30 by the frame pacing, so it tells you little on its own).

Iterating

See CLAUDE.md for architecture, hard constraints, and the feature roadmap.

About

A pseudo-3D FPS in one pure-PowerShell file. Renders real Doom levels from a WAD you supply. No Add-Type, no modules, no admin, pure ASCII source.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages