… but can it play DOOM?

Every major computing platform has been asked the eternal question: But can it play DOOM? This question has been asked of cars, fridges, smartwatches, and many other devices or systems never meant to host a 3D game. Somehow, Business Central has eluded the question until now; check the video for the answer that might shock you.

https://youtu.be/a8W1x0xwkv4

In this video, Erik takes on one of computing’s most enduring challenges: “But can it play DOOM?” Every computing platform — from microwaves to cars to watches — eventually faces this question. This time, it’s Microsoft Business Central’s turn, and Erik delivers a fully playable version of DOOM running inside the ERP system, with the game engine translated entirely into AL code.

The Demo: DOOM in Business Central

Erik opens Business Central and clicks on a page labeled “Doom.” A selection dialog appears offering multiple game options:

  • Doom Shareware — the free version
  • Doom Registered — the version Erik paid for back in 1993
  • Doom 2: Hell on Earth
  • An open source version

He selects the registered version, the WAD file imports, and the game launches — fully playable inside Business Central. He navigates through the first level, picking up armor, fighting enemies, finding secret doors, grabbing a shotgun, and even saving the game (with the save name “Erik YouTube,” naturally stored in a Business Central table).

Architecture: How It All Fits Together

The implementation consists of several layers working together:

The Page and User Control

At the top level, there’s a Business Central page hosting a user control — a “control add-in” that bridges the AL backend with the JavaScript frontend. Here’s a simplified example of how a user control is hosted on a page:

page 50700 "Test Babylon"
{
    PageType = Card;
    layout
    {
        area(Content)
        {
            usercontrol(Babylon; Babylon)
            {
                ApplicationArea = All;
            }
        }
    }
}

The actual DOOM page follows this same pattern, with a control add-in called “Doom Screen.” When the control is ready, it fires a StartDoom function. The control add-in exposes events like RequestFrames and ApplyInput, handling the communication loop between the JavaScript rendering layer and the AL game engine.

WAD Files: Game Resources

All of DOOM’s game assets — maps, sprites, sounds, music — are stored in WAD files (Where’s All the Data). These WAD files are embedded as resources in the AL app. When you select a game version, the WAD file is read from the app’s resources and deserialized into a Business Central table called Doom WAD Lump — with table number 66600, because of course it is.

This table contains all the game’s resources broken down into individual lumps: demos, maps (like E1M1 — Episode 1, Map 1), vertices, line definitions, things, and everything else that makes up the DOOM world.

Save Games and Settings

Save games are stored in Business Central tables as binary blobs. Erik demonstrates this by saving a game as “Erik YouTube” and then finding it in the database. Game settings — screen configuration, key bindings, etc. — are similarly persisted in tables. It’s a fully integrated experience within the BC data layer.

The JavaScript Layer

Erik is emphatic about what the JavaScript portion does and — more importantly — does not do. The JS code is roughly 530 lines and handles only:

  • Rendering fully composited frames received from the AL engine
  • Playing music using a library called SpinSynth (an open-source JavaScript synth player with a General MIDI sound font)
  • Capturing user input (keyboard, mouse) and sending it back to AL

There is no game logic in JavaScript — no missiles, no shotguns, no enemy AI. It’s purely a display and input layer.

Screen Rendering and Filters

Native DOOM renders at 320×200 pixels. The JavaScript layer uses WebGL to upscale and render these frames. Erik demonstrates switching between different display filters, including a CRT emulator that gives the game an authentic early-90s monitor look.

Music Formats

DOOM uses two music formats: standard MIDI files and MUS files (used by Sound Blaster and AdLib cards in the 1990s). A mus2midi JavaScript utility handles conversion between these formats so that the SpinSynth player can handle playback.

The Engine: 45,000+ Lines of AL

The heart of the project is the DOOM engine itself — a code unit containing over 45,000 lines of AL code. This is a line-for-line, function-for-function translation of Pure Doom, a portable, dependency-friendly C implementation of the DOOM engine.

The code header reads: “Generated by C2AL. Do not edit by hand.” (Though Erik did edit it by hand — for cheats.)

How C Becomes AL: The C2AL Tool

Translating tens of thousands of lines of C code into AL by hand — or even with AI assistance — wasn’t feasible. At scale, AI-assisted translation still breaks down. So Erik built a custom tool called C2AL.

The pipeline works as follows:

  1. Input: Take the Pure Doom C source code
  2. Standard library shim: Provide a custom header file that replaces C standard library functions with implementations that can be translated (this only works when there are minimal external dependencies)
  3. Parse: Use a C compiler/parser tool (a parser from a language called “cic”) to generate an abstract syntax tree from the C code
  4. Transform: A Python-based tool processes the parsed output into an intermediary representation
  5. Output: Generate AL code — a complete code unit

The resulting AL code looks unusual. Since C is fundamentally about memory manipulation — pointers, pointer arithmetic, direct memory access — the translated AL code uses a list of integers as its “memory.” Every pointer operation in C becomes an index operation on this list. It’s not pretty, and it could be optimized further, but it works — and crucially, it’s not the performance bottleneck.

Comparing C and AL Side by Side

Erik demonstrates the fidelity of the translation by comparing functions. For example, the P_SpawnMissile function in both the original C and the generated AL shows the same logical flow: spawn an object, set its sound, calculate angles — all translated one-to-one. The AL version has the same structure, the same operations, just expressed in AL syntax with memory operations instead of pointer dereferencing.

Performance

DOOM runs at 35 ticks per second natively. In Business Central, Erik gets around 10–12 frames per second. The AL computation itself takes only about 12 milliseconds per frame — it’s the round-trip latency between JavaScript and Business Central that consumes most of the time budget.

Erik jokes that he needs to talk to Microsoft about improving this round-trip performance — because, obviously, we need better frame rates for DOOM in Business Central.

Despite the frame rate limitations, the game is fully playable.

Cheating: Because You Have the Source Code

One of the perks of having the game engine in editable AL code is the ability to modify game behavior directly. Erik demonstrates two cheats:

Cheat 1: BFG Pistol

In the A_FirePistol function, Erik replaces the normal bullet-firing logic with the plasma/BFG missile-launching code. The result: the starting pistol now fires BFG projectiles. The catch? If you fire it at something too close, the splash damage kills you too.

Cheat 2: God Mode

In the P_DamageMObject function — which calculates damage whenever something hits something — Erik adds a simple condition: if the target is the player, skip the damage. The result: invincibility. He walks through enemies on “Hurt Me Plenty” difficulty, health locked at 100.

After each modification, he simply publishes the AL extension, and the changes take effect immediately in the running game — a remarkably quick development loop given the 45,000-line code unit.

Compatibility

The engine runs any game built on the original DOOM engine, including:

  • DOOM (Shareware and Registered)
  • DOOM II: Hell on Earth
  • Other WAD files compatible with the original engine

Games that used enhanced versions of the engine — like Heretic — won’t work, as their WAD files expect engine features not present in the Pure Doom base.

Summary

Yes, Business Central can play DOOM. The game engine runs entirely in AL — over 45,000 lines of code translated from C using a custom-built C2AL transpiler tool. JavaScript handles only rendering, audio, and input capture. Game resources (WAD files), save games, and settings are all stored in Business Central tables. The C2AL tool that made this possible could potentially be used to translate other C codebases into AL — though it works best with minimal external dependencies. The performance bottleneck isn’t the AL computation itself (around 12ms per frame) but the round-trip latency between the JavaScript control add-in and the Business Central server. And if you have the source code to DOOM in an editable language, of course you’re going to give yourself a BFG pistol.