{"slug": "show-hn-phi-a-browser-native-and-desktop-game-engine", "title": "Show HN: Phi – A browser-native and desktop game engine", "summary": "Phi, a browser-native and desktop game engine with a Blender-style editor, Python scripting, and built-in Claude AI, has been released as a single opaque engine.wasm or native executable. The engine integrates Claude as a first-class editor participant, allowing it to introspect the live scene and asset library via an Anthropic tool-use loop, with the API key kept on the authoring server. It supports C and Python scripting, WebGL 2/OpenGL 3.3 rendering, Bullet physics, and glTF 2.0 mesh format, and ships with a playable first-person-shooter example.", "body_md": "**A browser-native and desktop game engine with a Blender-style editor, Python scripting, and Claude built in as a first-class editor participant.**\n\nPhi ships as a single opaque `engine.wasm`\n\n(or a native executable on\nLinux/Windows/macOS) that is the mesh editor, the animation editor, and the\nnode-graph system at once. There's no separate authoring tool and no\nseparate runtime: the same binary edits a scene live and plays it. Game\nlogic, NPC behaviour, and tool UI (`@phi.panel`\n\n) are written in Python,\nrunning on an embedded MicroPython interpreter — the same language and the\nsame API surface in the editor and in a shipped game.\n\nA standalone-game path ships alongside the editor. `phi.h`\n\naggregates the\nengine's internals — geometry operations, Bullet physics, animation/armature\nplayback, node graphs, render-pass hooks, gamepad input, keyboard/mouse\ninput, camera control, and audio — into one public C header, so\n`game/src/main.c`\n\ncompiles and links against it directly. The same ground is\ncovered from Python: `phi.*`\n\nexposes mesh editing, whole-object transforms,\nobject-id-keyed physics, animation playback, node graphs, per-face\nmaterials, keyboard/mouse/gamepad input, and sound playback, all addressed\nby object id rather than through the editor's own selection state. Custom\nshaders are supported at a low level — `render_hooks.h`\n\nlets C code register\na callback at one of four pipeline insertion points and write GL/GLSL\nagainst the live `GBuffer*`\n\n. Gamepad input, including Steam Deck, runs on a\nvendored SDL2 `GameController`\n\nsubsystem (`SDL_GameControllerDB`\n\n's mapping\ndatabase); Steam Deck runs a standard Linux desktop under the hood, so the\nnative build covers it without extra work. Audio is a hand-written WAV\ndecoder and mixer, with ALSA on native Linux (detected at build time, with a\nno-op fallback otherwise) and the Web Audio API in the browser, including\npositional 3D sound. A shipped game runs chromeless: `player_main.c`\n\nis an\nindependent driver with no editor UI, no Asset Browser, and no live server\nconnection, loading `./game/`\n\ninto a per-frame gameplay loop with its own\ncamera, input, physics, and audio.\n\n`game/src/main.c`\n\nis a playable first-person-shooter example built entirely\nin C — WASD movement, mouse look under OS/browser pointer capture, and\nphysics-driven targets — with no MicroPython in the hot path. `make player_wasm`\n\nbuilds the same game for the browser, for evaluation without a\nnative toolchain; it isn't part of the standalone-shipping path itself,\nwhich stays native-only.\n\n``` php\nLanguage:    C (Emscripten -> WASM, or native via glext.h — no SDL/GLFW)\nRendering:   WebGL 2 (GLES3) in-browser, OpenGL 3.3 core natively,\n             deferred (G-buffer) pipeline with TAA\nScripting:   MicroPython, embedded directly into engine.wasm\nPhysics:     Bullet, compiled straight into the same binary\nNetworking:  WebSockets (RFC 6455 — hand-rolled client + server)\nServer:      Pure Python stdlib — no third-party dependencies\nMesh format: glTF 2.0 (.glb/.gltf) — no bespoke format\n```\n\n**Blender DNA/RNA-style UI, not Dear ImGui.** A recursive area-split panel system (drag-to-resize, split, join) written in C, with panels authorable from Python via`@phi.panel`\n\n— the same architecture Blender uses, not an immediate-mode debug UI dressed up.**Claude runs inside the editor**, not beside it as a chat-window bolt-on. The Chat panel talks to an Anthropic tool-use loop running server-side — mention`@llm`\n\nand it can introspect the live scene (`get_scene_state`\n\n) and the asset library (`get_asset_list`\n\n) to answer questions about what you're building. The API key stays on the authoring server; it never ships to a client.**One mesh representation, one file format.** The editor holds a half-edge structure for live topology edits (extrude, inset, loop cut); glTF is the load/save interchange format, not an intermediate that loses information on round-trip.**Client-authored, server-persisted.** Every edit — a vertex drag, a Python panel's button click, an AI-proposed change — applies locally first and is reconciled by an authoritative server, the same pattern this codebase's predecessor project (`qek`\n\n, a multiplayer octree-editor arena shooter) established.\n\nPhase 0 (deferred renderer, G-buffer, TAA), Phase 1 (mesh editor: picking,\ngizmos, extrude/inset/loop-cut, PBR materials per face, Voronoi\npre-fracture, the Native UI System, DNA/RNA property system, a Python\nconsole, the Asset Browser, and the Chat panel described above), and Phase 2\n(Bullet physics, wrapped in a hand-written C API since Bullet ships no\nofficial one, wired into both the editor and its Python API) are complete.\nPhase 9 (standalone-game shipping — the editor/player split, `./game/`\n\nloading, the `phi.h`\n\nC API, node graphs, render-pass hooks, vendored-SDL2\ngamepad/Steam Deck support, camera control, whole-object transforms,\nkeyboard/mouse input, and object-id-keyed physics) and Phase 10 (audio — WAV\ndecode/mixing, native ALSA, wasm Web Audio, a win32 stub, and Python\nbindings) are also complete, demonstrated end to end by OS/browser pointer\ncapture (`input_capture_mouse`\n\n) and the first-person-shooter example\n(`game/src/main.c`\n\n, `make player`\n\n/ `make player_wasm`\n\n). Outstanding: the\nAsset Browser's \"mark this asset for `./game/`\n\n\" UI, and win32 support for\nboth the player target and native audio — none built or verified in this\nproject's history yet. See [ phi.md](/float64co/Phi/blob/main/phi.md) for the full phase-by-phase\nbrief, including what's verified versus outstanding at any given point.\n\n``` php\nmake native     # native editor binary -> build/phi_native  (fastest edit loop)\nmake wasm       # browser editor build -> www/game.js + www/game.wasm\n                 # (needs Emscripten: source /path/to/emsdk/emsdk_env.sh first)\nmake win32       # cross-compiled Windows editor binary -> build/phi_win32.exe\nmake player      # standalone chromeless game binary -> build/phi_player\n                 # (native only; boots ./game/main.py or ./game/src/main.c)\nmake player_wasm # same game, browser build -> www/player.js + www/player.wasm\n                 # (for evaluation without a native toolchain — see Status;\n                 #  the standalone-shipping path itself stays native-only)\n```\n\nAn example ships in `./game/`\n\n: a first-person shooter (`game/src/main.c`\n\n)\nwith physics targets and OS/browser mouse capture. Build and run with\n`make player && ./build/phi_player`\n\n, or `make player_wasm`\n\nand open\n`player.html`\n\n(see Run, below). Click the canvas to lock the mouse, WASD to\nmove, click to shoot, Escape to release.\n\n```\ncd server && python3 server.py\n```\n\nOpen `http://localhost:8765`\n\nfor the browser editor, or\n`http://localhost:8765/player.html`\n\nfor the browser player build (`make player_wasm`\n\n), or run `build/phi_native`\n\n/ `build/phi_player`\n\ndirectly for\nthe native builds. `server.py`\n\nserves all of it; the player build makes no\nlive server connection at runtime, so this is only serving static files for\nthat path.\n\nSet `ANTHROPIC_API_KEY`\n\nin the server's own environment before launching\n`server.py`\n\n— never in a client, never committed. Then open the Chat panel\nand mention `@llm`\n\nanywhere in your message.\n\n```\nclient/     Engine + editor, plain C (compiles unchanged with gcc or emcc)\n  editor_main.c       editor entry point / frame loop (full panel UI)\n  player_main.c       standalone-game entry point — no editor chrome, see phi.md's Phase 9\n  phi.h               public C API for game/src/*.c (geometry, physics, animation, node graphs, render hooks, gamepad)\n  ui.c, area_tree.c   Native UI System — panel layout, DNA/RNA-style widgets\n  meshobject.c, halfedge.c, halfedge_gltf.c   editable mesh representation\n  mesh_edit.c, fracture.c, gizmo.c            editing operations\n  mp_port.c           MicroPython embedding + the phi.* Python API surface\n  phi_physics.cpp     hand-written C wrapper over vendored Bullet\n  render_hooks.c      C-level render-pass insertion points for custom shaders\n  phi_audio.h, audio_wav.c, audio_native.c, audio_wasm.c   WAV decode/mixer + ALSA/Web Audio backends\n  chat.c, console.c, asset_browser.c, net.c   editor panels + wire protocol\n  vendor/             Bullet, MicroPython, cgltf, nanosvg, stb, SDL2 (gamepad only) — all vendored\n\nserver/     Pure-Python stdlib HTTP + WebSocket server, asset DB, and the\n            Anthropic tool-use loop the Chat panel talks to\n\nwww/        Browser shells: index.html (editor) + player.html (player),\n            each loading its own emcc-generated .js/.wasm\nassets/     glTF test assets + the uploaded asset library\n\ngame/       Example game — what `make player` / `make player_wasm` boot\n  src/main.c   the FPS example (game_init/game_tick/game_shutdown, no MicroPython)\n  main.py      an equivalent Python-driven example (mutually exclusive with\n               src/main.c at build time — see phi.md's Phase 9 \"./game/\n               directory\" section)\n```\n\n[ phi.md](/float64co/Phi/blob/main/phi.md) is the living design document and status log for this\nproject — architecture decisions, the full 10-phase roadmap, and a dated\naccount of what's built and verified versus outstanding at every stage.\nStart there for anything beyond a quick look.\n\nFloat64 LLC", "url": "https://wpnews.pro/news/show-hn-phi-a-browser-native-and-desktop-game-engine", "canonical_source": "https://github.com/float64co/Phi", "published_at": "2026-08-18 08:56:44+00:00", "updated_at": "2026-08-18 09:11:07.722085+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools", "artificial-intelligence"], "entities": ["Phi", "Claude", "Anthropic", "Blender", "MicroPython", "Bullet", "SDL2", "Steam Deck"], "alternates": {"html": "https://wpnews.pro/news/show-hn-phi-a-browser-native-and-desktop-game-engine", "markdown": "https://wpnews.pro/news/show-hn-phi-a-browser-native-and-desktop-game-engine.md", "text": "https://wpnews.pro/news/show-hn-phi-a-browser-native-and-desktop-game-engine.txt", "jsonld": "https://wpnews.pro/news/show-hn-phi-a-browser-native-and-desktop-game-engine.jsonld"}}