{"id":36606251,"url":"https://github.com/stepstone-tech/doom-graalvm","last_synced_at":"2026-01-12T08:45:39.211Z","repository":{"id":63905605,"uuid":"570165174","full_name":"stepstone-tech/doom-graalvm","owner":"stepstone-tech","description":"PoC of running Doom on top of GraalVM","archived":false,"fork":false,"pushed_at":"2022-12-01T16:39:53.000Z","size":6816,"stargazers_count":62,"open_issues_count":1,"forks_count":5,"subscribers_count":5,"default_branch":"main","last_synced_at":"2023-03-02T07:56:03.136Z","etag":null,"topics":["doom","graalvm","java","polyglot","polyglot-programming","wasm","webassembly"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stepstone-tech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-24T13:38:06.000Z","updated_at":"2023-02-13T09:20:48.000Z","dependencies_parsed_at":"2023-01-22T11:00:37.969Z","dependency_job_id":null,"html_url":"https://github.com/stepstone-tech/doom-graalvm","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/stepstone-tech/doom-graalvm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stepstone-tech%2Fdoom-graalvm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stepstone-tech%2Fdoom-graalvm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stepstone-tech%2Fdoom-graalvm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stepstone-tech%2Fdoom-graalvm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stepstone-tech","download_url":"https://codeload.github.com/stepstone-tech/doom-graalvm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stepstone-tech%2Fdoom-graalvm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28337599,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T06:09:07.588Z","status":"ssl_error","status_checked_at":"2026-01-12T06:05:18.301Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["doom","graalvm","java","polyglot","polyglot-programming","wasm","webassembly"],"created_at":"2026-01-12T08:45:39.146Z","updated_at":"2026-01-12T08:45:39.200Z","avatar_url":"https://github.com/stepstone-tech.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nAt [Stepstone](https://www.stepstone.com), as part of our internal brown bag session, we talked about [polyglot capabilities of GraalVM](https://www.graalvm.org/latest/reference-manual/languages/). \nWe know, that GraalVM can run javascript, python, llvm and especially WebAssembly. But...\n\u003e  **Can it run Doom? :suspect:**\n\nSo, we took [Doom port compiled to WebAssembly](https://github.com/diekmann/wasm-fizzbuzz/tree/main/doom) created by [@diekmann](https://github.com/diekmann) and ran it on top of GraalVM. See [Internals](#Internals) for implementation details.\n\n# GraalVM version\n\nThis program was written on GraalVM 17+ v22.3. You must install wasm support by running `gu install wasm`.\n\n# Running\n\n\u003e :warning: **To run correctly, you must increase stack size with `-Xss4m`**\n\nFrom IDE - just run `com.stepstone.jc.demo.Doom` class\n\nFrom the command line - compile with `mvn package` and then run with:\n```bash\njava -Xss4m -jar doom-wasm-1.0-SNAPSHOT-jar-with-dependencies.jar\n```\n\nAfter this, you should see a Java Swing window **and you can start killing monsters :godmode:**\n\n![Game window](doom.png \"Game window\")\n\n\n## Internals\n\nThe process of porting Doom to WASM is described in the [original repo](https://github.com/diekmann/wasm-fizzbuzz/tree/main/doom).\n\nGraalVM's support for WASM, for now, is very basic. One important missing feature is the ability to inject java object with bindings, which will be called by the wasm program.\nJust running `context.eval(\"wasm\", doomWasmBytes)` will lead to unresolved dependency one `env` and `js` modules.\nThere is no direct equivalent of [javascript's WebAssembly.instantiate](https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/instantiate) accessible from standard GraalVM polyglot context. That's why we need to do some hacking. We use methods accessible by WebAssembly bindings to read and instantiate the WASM module, and to create an instance of WASM memory.\n\nWhat we need to do:\n\n* create an object, that will be used as WASM\u003c-\u003eGraalVM binding and will contain `js` and `env` objects inside (`com.stepstone.jc.demo.Bindings`)\n* load `doom.wasm` module using `com.stepstone.jc.demo.WASMModule.module_decode`\n* instantiate this module with bindings using `com.stepstone.jc.demo.WASMModule.module_instantiate`\n* having this, we can run Doom's `main()` function to setup game\n* then we just need to run periodically main game loop using `doom_loop_step()`\n\n# Native image\n\nIt is also possible to compile GraalVM-WASM-based Doom into the native image.\n\nFirst, you need to run `mvn package` and then run `native-image`:\n\n```bash\nnative-image --language:wasm --initialize-at-build-time=sun.awt.Toolkit -Djava.awt.headless=false -H:ConfigurationFileDirectories=native-config -H:DynamicProxyConfigurationFiles=native-config\\dynamic-proxy.json --no-fallback  -jar target\\doom-wasm-1.0-SNAPSHOT-jar-with-dependencies.jar  \n```\n\nThis way you will have Doom compiled to LLVM, compiled to WASM, wrapped in the Java Swing app, and compiled to native code. Simple, right? ¯\\_(ツ)_/¯","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstepstone-tech%2Fdoom-graalvm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstepstone-tech%2Fdoom-graalvm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstepstone-tech%2Fdoom-graalvm/lists"}