It renders DOOM E1M1 in real-time. BSP traversal, perspective projection, distance fog, sector lighting, collision detection, step climbing - all PHP, compiled to native, running at 15+ FPS. You walk around the actual shareware WAD.
I can hear you: "but does it run DOOM?". No, it renders DOOM. There's a difference. The imps are safe. For now.
Why PHP? PHP has a simple, approachable syntax that millions of developers worldwide already know. That makes it an ideal bridge to bring web developers closer to systems programming, native binaries, and understanding what happens under the hood, without forcing them to learn an entirely new language first.
Of course, PHP was never designed to parse WAD files or traverse BSP trees. To get here, elephc had to grow beyond standard PHP with compiler extensions: packed class for flat POD records (all the DOOM geometry - vertices, linedefs, sectors, segs - lives in these), buffer<T> for contiguous typed arrays (the hot-path storage that makes real-time rendering possible), ptr for raw memory access, and extern for calling SDL2 directly via FFI. You write PHP, but the data structures "perform" like C (not really yet ;)). You can find everything that's been added on top of standard PHP syntax here: https://github.com/illegalstudio/elephc/tree/main/docs/beyon...
PHP vs DOOM (Video): https://media.nahi.me/illegalstudio/elephc/elephc-doom-3d-mo...
GitHub: https://github.com/illegalstudio/elephc
If this made you smile, exhale sharply through your nose, or question my life choices, consider dropping a on the repo. It's how people find the project, and it makes me mass echo dopamine.
gosingk•1h ago
nahime•1h ago
nahime•1h ago