GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - godofecht/doom-flow: The Doom engine ported to the Flow programming language.

BranchesTags
Open more actions menu

Latest commit

 

History

82 Commits
82 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
doomgeneric
doomgeneric
 
 
media
media
 
 
scripts
scripts
 
 
site
site
 
 
ui
ui
 
 
.gitignore
.gitignore
 
 
CITATION.cff
CITATION.cff
 
 
DOOM1.WAD
DOOM1.WAD
 
 
LICENSE
LICENSE
 
 
PORTING.md
PORTING.md
 
 
README.md
README.md
 
 
argv.flow
argv.flow
 
 
automap.flow
automap.flow
 
 
bsp.flow
bsp.flow
 
 
cdmus.flow
cdmus.flow
 
 
ceiling.flow
ceiling.flow
 
 
cheat.flow
cheat.flow
 
 
checksum.flow
checksum.flow
 
 
config.flow
config.flow
 
 
controls.flow
controls.flow
 
 
dmain.flow
dmain.flow
 
 
doom.flow
doom.flow
 
 
doors.flow
doors.flow
 
 
draw.flow
draw.flow
 
 
dummy.flow
dummy.flow
 
 
endoom.flow
endoom.flow
 
 
enemy.flow
enemy.flow
 
 
event.flow
event.flow
 
 
finale.flow
finale.flow
 
 
fixp.flow
fixp.flow
 
 
floor.flow
floor.flow
 
 
flow.toml
flow.toml
 
 
game.flow
game.flow
 
 
game_state.flow
game_state.flow
 
 
hud.flow
hud.flow
 
 
info.flow
info.flow
 
 
input.flow
input.flow
 
 
inter.flow
inter.flow
 
 
isound.flow
isound.flow
 
 
items.flow
items.flow
 
 
ivideo.flow
ivideo.flow
 
 
iwad.flow
iwad.flow
 
 
joystick.flow
joystick.flow
 
 
lights.flow
lights.flow
 
 
loop.flow
loop.flow
 
 
map.flow
map.flow
 
 
maputl.flow
maputl.flow
 
 
memio.flow
memio.flow
 
 
menu.flow
menu.flow
 
 
misc.flow
misc.flow
 
 
mobj.flow
mobj.flow
 
 
mode.flow
mode.flow
 
 
net.flow
net.flow
 
 
plane.flow
plane.flow
 
 
platform.flow
platform.flow
 
 
plats.flow
plats.flow
 
 
pspr.flow
pspr.flow
 
 
rdata.flow
rdata.flow
 
 
rl_arena.flow
rl_arena.flow
 
 
rmain.flow
rmain.flow
 
 
saveg.flow
saveg.flow
 
 
segs.flow
segs.flow
 
 
setup.flow
setup.flow
 
 
sha1.flow
sha1.flow
 
 
sight.flow
sight.flow
 
 
sky.flow
sky.flow
 
 
sound.flow
sound.flow
 
 
spec.flow
spec.flow
 
 
statdump.flow
statdump.flow
 
 
stbar.flow
stbar.flow
 
 
switch.flow
switch.flow
 
 
system.flow
system.flow
 
 
tables.flow
tables.flow
 
 
telept.flow
telept.flow
 
 
things.flow
things.flow
 
 
tick.flow
tick.flow
 
 
timer.flow
timer.flow
 
 
user.flow
user.flow
 
 
video.flow
video.flow
 
 
wad.flow
wad.flow
 
 
wipe.flow
wipe.flow
 
 
wistuff.flow
wistuff.flow
 
 
wmain.flow
wmain.flow
 
 
zone.flow
zone.flow
 
 

Repository files navigation

doom-flow

WASM smoke Deploy GitHub Pages

Play: godofecht.github.io/doom-flow

Doom, rewritten in Flow. Native build uses Flow's C backend. The browser demo ships with the MLIR backend (MLIR to LLVM to emcc). Framebuffer output is byte-identical to the C backend, verified across the deterministic parity suites.

Doom AI pilot gameplay (CI GIF)

Flow language github.com/flooooooooooow/flow
Flow wiki flooooooooooow.github.io/flow
WASM gallery wiki /wasm/
Flow playground flooooooooooow.github.io/flow/playground/
RL sister repo doom-flow-rl
Discord https://discord.gg/YK7VaHy24T

Compile path

*.flow  ──flow.transpiler──►  C  ──clang──►  native (macOS gfx)
         │
         └── --mlir --llvm ►  emcc + gfx_wasm.c ──►  .wasm (Pages)

The MLIR object compiles at -O2 and links with emcc at -O2. The C backend is used for native macOS builds. Both backends produce byte-identical framebuffer output.

CI records the GIF by driving the MLIR WASM build in Node with the deterministic test clock, capturing RGBA frames, and encoding with frames_to_gif.py.

GitHub Pages rebuilds the production WASM from the current Flow checkout before uploading site/, then runs the MLIR smoke test against that freshly built artifact. The checked-in site/wasm/doom/doom.wasm is therefore no longer allowed to silently become a stale production binary.

Build and run (native)

Needs Flow at ~/flow (or sibling ../flow; see flow.toml), Python 3, clang, macOS. Shareware DOOM1.WAD is included.

~/flow/flow build-native
./build/doom
DOOMFLOW_ARGS="-timedemo demo1" ./build/doom   # must print: timed 5026 gametics

Browser / WASM

FLOW_DIR=~/flow ./scripts/build_wasm.sh                 # MLIR backend (default)
FLOW_DIR=~/flow BACKEND=c ./scripts/build_wasm.sh       # C backend
python3 -m http.server 8000 --directory site

The game loop is rAF-driven: main() returns after init, JS calls doomflow_frame() and doomflow_present() per requestAnimationFrame. No ASYNCIFY.

Pages modes: Play, Watch AI (DOOMFLOW_AI pilot, auto-advances through levels every 3600 frames).

Byte-identical verification

FLOW_DIR=~/flow bash scripts/run_byte_identical.sh
FLOW_DIR=~/flow bash scripts/run_gameplay_test.sh

Both suites build C and MLIR WASM variants, drive them through the deterministic test clock, and compare CRC32 values per sampled frame.

Record a GIF

FLOW_DIR=~/flow ./scripts/build_wasm.sh --doom-only --test-clock
FLOW_DIR=~/flow node scripts/record_wasm_gif.js --frames 600 --skip 6 --fps 15 --width 320 --out media/doom.gif

Controls

Arrows / WASD move. X or F fire. Space or E use. 1-7 weapons. Tab automap. Esc menu.

See PORTING.md for how the C to Flow port works.

Postmortem: the barrel bug

Issue #8 exposed a gap in the verification strategy rather than a missing Doom mechanic. The Flow source already contained the vanilla barrel path: barrels have 20 health, enter the expected BEXP death-state sequence, dispatch A_Explode, and call P_RadiusAttack. The hitscan, damage, death-state, and radius-attack paths also match the original Doom implementation.

The browser nevertheless served a broken barrel implementation because a previous optimization experiment post-processed generated LLVM IR with aggressive pointer attributes, including blanket noalias annotations. That assumption is invalid for Doom's heavily aliased object/state model. The pass was later removed from scripts/build_wasm.sh, but the already-generated site/wasm/doom/doom.wasm remained checked in. The Pages workflow simply uploaded site/, so production continued serving the stale miscompiled binary while CI rebuilt correct binaries from source.

This also explains why CRC parity did not catch the problem. The parity suites compare the C and MLIR backends of the same Flow port. They are excellent at finding backend divergences, but they do not prove semantic equivalence with vanilla Doom, and they say nothing about a separately checked-in production artifact. Two backends can agree perfectly on the same porting mistake, and a correct CI build can coexist with an obsolete deployed binary.

The corrective rule is now simple: production is built from source during the Pages job and smoke-tested before deployment. Backend parity remains useful, but it is treated as one layer of verification rather than a complete gameplay oracle. Behavioural regressions should be tested at the level where users observe them, and deployment artifacts must be derived from the commit being deployed rather than trusted as independent source files.

About

The Doom engine ported to the Flow programming language.

godofecht.github.io/doom-flow/

Topics

c-backenddoomflow-languagegame-engineport

Resources

Readme
GPL-2.0 license
Activity

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.