Skip to content
简体中文

Game Ecosystem & EGFX ARCADE

Emacs GFX ships a complete native game ecosystem for stock GNU Emacs 29.1+ across macOS (Metal), Windows (Direct3D 11 / 12), and Linux (Vulkan). Every runtime renders straight into an Emacs window at 60 FPS with hardware audio, native gamepad support, and zero OpenGL.

Layer Packages Role
L0 Core Infrastructure (packages/) egfx, egfx-audio, egfx-wgpu Domain-agnostic native GPU compositor, child-view containers, focus handoff (egfx-grab-focus), relative Pointer Lock, OS Gamepad, 32-voice hardware audio mixer, and Rust wgpu 2.0 GPU provider. Zero game business logic.
L1 Game Foundation (games/) egfx-game Shared pure-Elisp game layer: centered floating child-frame controls popup (egfx-game-guide-show), IoC schema-registered arrow-first keybindings (egfx-game-keys-register, egfx-game-keys-customize), 60 Hz 2D game engine (lazy egfx-wgpu/egfx-audio), and built-in 3-world Starlight Meadow (egfx-game-starlight-play).
L2 Orthogonal Engine Backends (games/) egfx-retro, egfx-doom, egfx-bevy Independent native C/Rust engine hosts with isolated dynamic modules. Each registers its own key profile and controls into egfx-game.
L3 Unified Hub (games/) egfx-arcade EGFX ARCADE full-window 16:9 cover-art launcher with unified GPU top navigation bar, curated WebGL/HTML5 runner over optional egfx-browser (with built-in COOP/COEP localhost server), favorites, playtime stats, and global mute/hide.

Runs standard Libretro cores natively inside an Emacs GPU surface over egfx_abi.h v3 and egfx-audio:

  • 1-Click Core & Curated Homebrew Installer: Fetches official Libretro Buildbot cores (mGBA, Snes9x, FCEUmm, TIC-80, WASM-4, 2048) and curated open-source GBA titles (Celeste Classic and Apotris) directly from Emacs, plus mouse/pointer input support for compatible cores.
  • Console Ergonomics: 4-port native Gamepad input, instant save-state slots with companion TIFF visual thumbnails, and an in-memory C rewind ring buffer.

2. HTML5, WebGL2 & WASM (egfx-arcade-webgame-*)

Section titled “2. HTML5, WebGL2 & WASM (egfx-arcade-webgame-*)”

Integrated directly inside egfx-arcade atop optional egfx-browser’s chromeless OS WebView (WKWebView / WebView2 / WebKitGTK):

  • Built-in Pure-Elisp COOP/COEP Server: Serves local game directories over 127.0.0.1 with Cross-Origin-Opener-Policy: same-origin, Cross-Origin-Embedder-Policy: require-corp, and application/wasm MIME headers so SharedArrayBuffer and multithreaded WASM run out of the box.

3. Native C & Rust Engines (egfx-doom, egfx-bevy)

Section titled “3. Native C & Rust Engines (egfx-doom, egfx-bevy)”

Demonstrates direct adoption of mature C and Rust game engines over egfx_abi.h v3 with zero frame-readback overhead:

  • egfx-doom: Portable doomgeneric 3D FPS engine with relative Pointer Lock mouse turning, native Gamepad support, 16-channel DMX digital SFX over egfx-audio, and 1-click Freedoom Phase 1 WAD installation.
  • egfx-bevy: Authentic Bevy 0.15 ECS (World, Schedule, Query) linked against egfx-wgpu-core’s Rust rlib for zero-copy 3D Metal/D3D12/Vulkan rendering, paired with a live side-window *egfx-bevy ECS Inspector* that inspects and spawns live 3D entities from Elisp.

4. Live-Coding 60 FPS GPU Games (egfx-game)

Section titled “4. Live-Coding 60 FPS GPU Games (egfx-game)”

Build native 60 FPS 2D games directly in Emacs Lisp with hardware-instanced sprites, Tiled .tmj levels, GPU Post-FX, and save-on-edit hot-reload. See the Building Games with egfx-game guide for a complete walkthrough, or run M-x egfx-game-starlight-play to play Starlight Meadow, the built-in 3-world Kenney CC0 pixel platformer (Sunny Meadow, Sunset Canyon, and Starlight Peaks).

All five game packages (egfx-game, egfx-retro, egfx-doom, egfx-bevy, egfx-arcade) project together to emacs-gfx/egfx-games. Launch curated offline and WebGL titles (Starlight Meadow, Freedoom: Phase 1, Celeste Classic, Apotris, Slow Roads, Townscaper, shapez, TETR.IO, Lichess, 2048) from the 16:9 cover gallery:

M-x egfx-arcade
  • Unified GPU Top Bar & Inspector Dock: A single 62 px GPU navigation bar provides the EGFX ARCADE brand mark, segmented category filters (全部 / 本地 / 网页 / 收藏) with live counts, an interactive search box with clear button (/), and quick 按键 / 隐藏 actions. A persistent bottom dock displays live controls, description, favorite toggle, and launch CTA.
  • Zero-Friction Startup & On-Demand Controls: Games launch directly into gameplay with immediate keyboard response; press ? at any time to toggle the centered controls overlay and ESC to return keyboard focus to Emacs.
  • Arrow-First Customizable Keybindings: Local engines (egfx-game, egfx-retro, egfx-doom) register their own arrow-first schemas into egfx-game-keys. Press K (or M-x egfx-game-keys-customize) to rebind any action in a centered modal with instant live reload and JSON persistence (~/.emacs.d/egfx-game/keybindings.json).
  • Global Mute & Hide: Press B (egfx-arcade-boss-key) or click 隐藏 to mute audio, pause every running game, and return to code.

Every native module (egfx, egfx-audio, egfx-wgpu, egfx-browser, egfx-retro, egfx-doom, egfx-bevy) is built across macOS (arm64 + x86_64), Linux (x86_64 + arm64), and Windows (x86_64) by the native-modules.yml release workflow with module-load smoke verification and SHA-256 manifests.

Users without a local C or Rust toolchain can install any module directly from Emacs:

M-x egfx-install-native

Modules are verified against SHA-256 checksums, ad-hoc signed on macOS, and cached under ~/.cache/emacs-gfx/native/<package>/<version>/.