Fire.dll Lab
2026 · Rust · WebAssembly · Unreal Engine 1 · Deus Ex in the Browser
In 1998, before pixel shaders existed on consumer hardware, Unreal Engine 1 shipped a dedicated dynamic-link library — Fire.dll — written by Erik de Neve to synthesize animated flames, electrical arcs, swirling plasma, and refracted puddles directly on a Pentium II CPU. Every flickering barrel fire on Liberty Island, every humming MJ12 plasma conduit, and every rain-dappled canal in Hong Kong in Deus Ex is an 8-bit paletted texture driven by that exact 8-byte spark engine.
The Fire.dll Lab runs the oracle-verified Rust translation of Fire.dll from my Deus Ex decompilation straight in WebAssembly. Paint any of the 29 authored spark types, watch the live 8-byte FSpark structs mutate in memory, switch to water or wet mode and drop any photo of your own to refract it through UWetTexture, preview 3×3 seamless toroidal tiling, and export crisp looping GIF89a animations straight from the Wasm buffer. Nothing is uploaded, and your emitter patch travels in the link.
Four additions and a lookup table
UFireTexture never runs a floating-point instruction during ConstantTimeTick. Its entire fluid simulation is a 4-tap cellular automaton operating on an 8-bit indexed bitmap (P8, mip 0) that wraps seamlessly in both X and Y:
- Rising mode (
bRising = true): walks top-to-bottom so heat climbs upward each tick, P[y][x] = \text{RenderTable}\Bigl[\,P[y+1][x-1] + P[y+1][x] + P[y+1][x+1] + P[y+2][x]\,\Bigr] - Still mode (
bRising = false): averages the pixel's own horizontal neighbourhood with the pixel below it, keeping plasma, Lissajous loops, and lightning arcs anchored in place, P[y][x] = \text{RenderTable}\Bigl[\,P[y][x-1] + P[y][x] + P[y][x+1] + P[y+1][x]\,\Bigr]
Cooling is baked once into the 1024-entry RenderTable whenever RenderHeat changes:
\text{RenderTable}[i] = \operatorname{trunc}\!\left(\operatorname{clamp}\!\left(\frac{i}{4} + 1 - \frac{255 - \text{RenderHeat}}{16},\ 0,\ 255\right)\right)
Raising RenderHeat shrinks the cooling subtraction so trails linger longer across the torus; lowering it snuffs them out almost immediately. On a 1998 Pentium Pro / Pentium II, four byte loads and a single indexed table read per pixel ran fast enough to update dozens of live textures every frame without touching the GPU.
Eight bytes per spark
Every fire emitter — and every temporary particle it spawns — lives in the same flat array of 8-byte FSpark records:
byte 0: Type (0x00..0x1e authored emitters, 0x20..0x2b spawned temporaries)
byte 1: Heat (palette index / initial intensity / phase)
byte 2: X (column, masked to USize - 1)
byte 3: Y (row, masked to VSize - 1)
byte 4: ByteA (velocity X, angle, delta-X, or phase depending on Type)
byte 5: ByteB (velocity Y, radius, delta-Y, or saved background pixel)
byte 6: ByteC (lifetime counter, spread radius, or angular speed)
byte 7: ByteD (decay rate, frequency, or lightning trigger threshold)Look at the 8-byte records panel while campfire or nano-emp runs: permanent emitters (0x00..0x1e) stay pinned while temporary particles (0x20..0x2b) append at ActiveSparkNum, walk using Fire.dll's inlined 64-dword lagged-XOR PRNG, decrement their heat or lifetime, and get swap-removed when they die. Lightning (0x17, 0x18, 0x19) doesn't even spawn particles — it calls DrawFlashRamp, which draws a jittered 6-bit fixed-point polyline directly into the P8 buffer and lets the cellular filter bloom the bolt into an afterglow.
Staggered-grid water and 1D refraction
UWaterTexture and UWetTexture reuse the exact same module sine table and lagged-XOR PRNG, but replace the cellular heat buffer with a half-resolution staggered heightfield (USize/2 × VSize bytes) split into alternating even/odd parity buffers. Each tick updates one parity from the four diagonal corners of the other through a 1536-byte WaveTable damping lookup:
H_{\text{new}} = \text{WaveTable}\bigl[\,H_{NW} + H_{NE} + H_{SW} + H_{SE} - 2 H_{\text{old}} + 512\,\bigr]
Then each heightfield cell writes a 2×2 block of full-resolution pixels from its horizontal wave slopes. In Water mode, RenderTable maps those slopes to palette brightness for specular caustics. In Wet mode, SetRefractionTable stores signed byte offsets in [-128, 127] scaled by WaveAmp / 512, and ApplyWetTexture refracts a source image along each horizontal scanline in one byte add:
\text{dst}[y, x] = \text{src}\bigl[\,y,\ (x + \text{offset}[y, x]) \bmod W\,\bigr]
Drop any image from your disk onto the wet canvas (or switch to the built-in street / mosaic textures) and drag across the surface — you're seeing the exact 1998 scanline displacement trick that made Unreal's puddles shimmer without a single fragment shader.
How it's built
fire.wasm is a zero-dependency Rust crate (82 KB compiled with opt-level = "s" and LTO) implementing the complete UFireTexture, UWaterTexture, and UWetTexture kernels plus a built-in LZW GIF89a encoder (adapted from the Dither Lab). Because Fire and Water natively produce 8-bit indexed frames, export GIF packs the raw P8 mip-0 buffer straight into a looping animated GIF with zero re-quantization loss.
Back to Labs · read the decompilation story in Deus Ex in the Browser · hear the engine's audio mixer in the Galaxy Lab · see how this site works.