Dev.to · 4 min read

I kept Doom's 1993 engine and wrote a new renderer for it

I kept Doom's 1993 engine and wrote a new renderer for it

Most Doom remasters rebuild the game. I wanted the opposite: keep the original 1993 engine running every rule, monster and door exactly as it was, and replace only what you see. The result is Relit. Press V at any moment and it flips between the original 1993 look and a new 3D one, same spot, mid-fight. It's free and open source: github.com/shouvik12/relit The idea: don't touch the game, watch it Doom's engine is really two things: a simulation (where everything is, what it's doing) and a renderer (how it draws that on screen). If you can read the simulation, you can draw it any way you like. So Relit has three parts: The original engine, running in your browser A small bridge that lets the page peek at what's happening in the game A new renderer that draws it all in 3D The engine never knows it's being drawn differently. 1. The original engine, in a browser The engine is id Software's original Doom source code (via doomgeneric), compiled to WebAssembly so it runs in any modern browser. I barely changed it: a handful of lines, so it can share what it's doing. 2. The bridge The bridge is a small piece of code, about 280 lines, that reports the game's live state 35 times a second: The rooms: floor and ceiling heights and light levels, so doors, lifts and flickering lights all come through The walls: which textures they show right now, so switches and animated walls update Everything that moves: every monster, item and fireball, with where it is and which way it faces You: your position, where you're looking, your health, ammo and weapon The shape of each level never changes, so the page reads that straight from the game file once, when the level loads. 3. The new renderer The renderer, built with Three.js, takes the level's shape and the live state and draws them in real 3D: Rooms become real geometry, and doors and lifts move as the engine moves them Motion is smoothed out. Doom updates 35 times a second, which looks jerky on a modern screen, so Relit blends between updates for smooth movement Light is real. Muzzle flashes and fireballs light up the walls around them, and the flashlight (L) casts shadows Pressing V just switches which picture you see. The game keeps running underneath, so the flip is instant. Sharper textures, on your own computer Doom's textures are tiny, and stretched across a modern screen they get blurry. Relit uses an AI upscaler (Real-ESRGAN) that runs on your own graphics card to make every texture 4× sharper. Nothing is sent anywhere, and the original art is the starting point, so it's sharpened, not replaced. Sound The music plays through an emulation of the sound chip on 1993 sound cards, so it sounds like it did back then. Sound effects come from around you in 3D. One file, nothing to install Everything, the engine, renderer, upscaler and page, fits in a single relit.html file of about 4.7 MB. Double-click it and play, even offline. It comes with Freedoom, a free community-made set of 36 levels, or you can load your own copy of Doom. How I built it I built Relit with Claude as a pair programmer, over an afternoon of fast iteration. It was a joy to watch it come together. The architecture, decisions and testing were mine; Claude did a lot of the typing. What I learned from launch day I posted it to r/Doom, X and YouTube. In the first day: 700+ views on the YouTube Short 2.3K+ views on Reddit Real feedback: classic Doom fans love the original pixels, some found it slow, and one person pointed out that Freedoom isn't the original Doom content (true, and the reason is legal: id still owns that content, so I can't include it) What's next The biggest known slowdown: while a door or lift is moving, the walls get rebuilt every frame. Handing that job to the graphics card should give a big speed boost. I'd also like to add a "pixel" mode that keeps the original crisp textures and adds only the new lighting. And if you want to put a completely different look on the same engine, whether VR, a new art style or something else, the bridge is deliberately small and simple. That's the part I'm proudest of. Try it, break it, and tell me which maps look wrong: github.com/shouvik12/relit ⭐

This is a summary aggregated from Dev.to. Read the complete article on the original site:

Read full article at Dev.to

More AI & Machine Learning News