Homeโ€บ๐ŸŽฎ Foundationsโ€บModule 32 min read ยท 4/15

Loading DOOM

Hands-on

Loading DOOM

The actual 1993 DOOM running inside Dynatrace using js-dos โ€” a JavaScript DOSBox emulator. This is real, deployed code.

CSP Configuration

DOOM needs WebAssembly compilation and external CDN access. From the real app.config.json:

{
  "server": { "enableCSP": false },
  "app": {
    "functionSandbox": {
      "unsafe-eval": {
        "value": true,
        "comment": "Required for WebAssembly compilation by DOSBox emulator"
      }
    },
    "csp": {
      "script-src": [
        { "value": "https://v8.js-dos.com", "comment": "js-dos emulator scripts" },
        { "value": "https://cdn.dos.zone", "comment": "DOOM game bundle" }
      ],
      "style-src": [{ "value": "https://v8.js-dos.com" }],
      "img-src": [{ "value": "https://v8.js-dos.com" }, { "value": "https://cdn.dos.zone" }],
      "font-src": [{ "value": "https://v8.js-dos.com" }]
    }
  }
}

โš ๏ธ unsafe-eval is a security risk. Only use it for special cases like game emulators. Never in production monitoring apps.

The DOOM Component

From the real deployed app โ€” uses an iframe with srcdoc to load DOSBox:

import React, { useCallback, useRef, useState } from "react";
import { Flex } from "@dynatrace/strato-components/layouts";
import { Heading, Text } from "@dynatrace/strato-components/typography";
import { Button } from "@dynatrace/strato-components/buttons";

export const DoomPage = () => {
  const iframeRef = useRef<HTMLIFrameElement>(null);
  const [launched, setLaunched] = useState(false);

  return (
    <Flex flexDirection="column" gap={16} padding={16}>
      <Heading level={1}>DOOM</Heading>
      <Text>Classic DOOM shareware (id Software, 1993) โ€” running inside DOSBox via js-dos.</Text>

      <Flex gap={8}>
        {!launched ? (
          <Button variant="accent" onClick={() => setLaunched(true)}>Launch DOOM</Button>
        ) : (
          <Button variant="default" onClick={() => setLaunched(false)}>Stop</Button>
        )}
      </Flex>

      <div style={{ width: "100%", aspectRatio: "4/3", maxWidth: 960, background: "#000", borderRadius: 4 }}>
        {launched && (
          <iframe ref={iframeRef} srcDoc={SRCDOC}
            sandbox="allow-scripts allow-same-origin" allow="autoplay"
            style={{ width: "100%", height: "100%", border: "none" }} />
        )}
      </div>
    </Flex>
  );
};

๐Ÿ’ก This proves AppEngine can run anything โ€” even a 3D game engine. If it can run DOOM, it can run any custom monitoring dashboard.

๐Ÿ›  Try it: Open app.config.json โ†’ add {"name": "storage:metrics:read"} to the scopes array โ†’ save. Now your app can query Dynatrace metrics. Try adding a DQL query with useDqlQuery from @dynatrace-sdk/react-hooks.