{"by":"Flux159","descendants":18,"id":46784221,"kids":[46822281,46821953,46821080,46831866,46822891,46822922,46821045],"score":50,"text":"Hi HN, I&#x27;ve been building Mystral Native — a lightweight native runtime that lets you write games in JavaScript&#x2F;TypeScript using standard Web APIs (WebGPU, Canvas 2D, Web Audio, fetch) and run them as standalone desktop apps. Think &quot;Electron for games&quot; but without Chromium. Or a JS runtime like Node, Deno, or Bun but optimized for WebGPU (and bundling a window &#x2F; event system using SDL3).<p>Why: I originally started by starting a new game engine in WebGPU, and I loved the iteration loop of writing Typescript &amp; instantly seeing the changes in the browser with hot reloading. After getting something working and shipping a demo, I realized that shipping a whole browser doesn&#x27;t really work if I also want the same codebase to work on mobile. Sure, I could use a webview, but that&#x27;s not always a good or consistent experience for users - there are nuances with Safari on iOS supporting WebGPU, but not the same features that Chrome does on desktop. What I really wanted was a WebGPU runtime that is consistent &amp; works on any platform. I was inspired by deno&#x27;s --unsafe-webgpu flag, but I realized that deno probably wouldn&#x27;t be a good fit long term because it doesn&#x27;t support iOS or Android &amp; doesn&#x27;t bundle a window &#x2F; event system (they have &quot;bring your own window&quot;, but that means writing a lot of custom code for events, dealing with windowing, not to mention more specific things like implementing a WebAudio shim, etc.). So that got me down the path of building a native runtime specifically for games &amp; that&#x27;s Mystral Native.<p>So now with Mystral Native, I can have the same developer experience (write JS, use shaders in WGSL, call requestAnimationFrame) but get a real native binary I can ship to players on any platform without requiring a webview or a browser. No 200MB Chromium runtime, no CEF overhead, just the game code and a ~25MB runtime.<p>What it does:\n- Full WebGPU via Dawn (Chrome&#x27;s implementation) or wgpu-native (Rust)\n- Native window &amp; events via SDL3\n- Canvas 2D support (Skia), Web Audio (SDL3), fetch (file&#x2F;http&#x2F;https)\n- V8 for JS (same engine as Chrome&#x2F;Node), also supports QuickJS and JSC\n- ES modules, TypeScript via SWC\n- Compile to single binary (think &quot;pkg&quot;): `mystral compile game.js --include assets -o my-game`\n- macOS .app bundles with code signing, Linux&#x2F;Windows standalone executables\n- Embedding API for iOS and Android (JSC&#x2F;QuickJS + wgpu-native)<p>It&#x27;s early alpha — the core rendering path works well &amp; I&#x27;ve tested on Mac, Linux (Ubuntu 24.04), and Windows 11, and some custom builds for iOS &amp; Android to validate that they can work, but there&#x27;s plenty to improve. Would love to get some feedback and see where it can go!<p>MIT licensed.<p>Repo: <a href=\"https:&#x2F;&#x2F;github.com&#x2F;mystralengine&#x2F;mystralnative\" rel=\"nofollow\">https:&#x2F;&#x2F;github.com&#x2F;mystralengine&#x2F;mystralnative</a><p>Docs: <a href=\"https:&#x2F;&#x2F;mystralengine.github.io&#x2F;mystralnative&#x2F;\" rel=\"nofollow\">https:&#x2F;&#x2F;mystralengine.github.io&#x2F;mystralnative&#x2F;</a>","time":1769538785,"title":"Show HN: Mystral Native – Run JavaScript games natively with WebGPU (no browser)","type":"story","url":"https://github.com/mystralengine/mystralnative"}