Miu2D: A 176,000-Line 2D ARPG Engine Built on Raw WebGL and Rust WASM
Miu2D is a 2D RPG game engine built with Rust + TypeScript + React + Canvas, designed for the Web platform. 2/ / .
At a glance
- What is it?
- Miu2D is a from-scratch 2D action RPG engine for the browser, using TypeScript, React, and raw WebGL, with Rust WASM for pathfinding. It rebuilds three classic Kingsoft wuxia games as a proof of concept, but its architecture demands serious commitment.
- Who is it for?
- Adopt Miu2D if you are building a browser-based 2D ARPG and want full control over every rendering and scripting layer, and you are willing to invest in a complex, AI-assisted codebase. Do not adopt it if you need a mature, community-supported engine with extensive documentation, or if your team lacks deep WebGL and Rust expertise.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 9 days ago.
- What is it written in?
- Mainly TypeScript, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 14, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE ANALYSIS
What Miu2D Actually Solves
Miu2D addresses a specific gap: web-based 2D ARPG development without leaning on established game frameworks like Phaser or PixiJS. The README states it is a 176,000-line engine written in TypeScript and Rust, rendering through raw WebGL with zero game-framework dependencies. The target user is a developer who wants to understand and control every subsystem, from sprite batching to scripting, rather than working within someone else's abstraction. The proof of concept is significant: three classic Kingsoft wuxia RPGs, including Legend of Yue Ying (2001) and Swords of Legends 2 (1998), have been rebuilt and are playable in a browser. This is not a toy; it is a full engine with 17 integrated ARPG subsystems and 218 script commands. The intended audience is engineers who are comfortable with low-level graphics programming and are willing to navigate a large, complex codebase.
The Architecture: Raw WebGL, Rust WASM, and a Custom Script VM
The engine's core is a layered architecture. The UI layer is React 19 with 84 components and three themes, but the engine itself is pure TypeScript with no React dependency. The renderer talks directly to WebGLRenderingContext, bypassing any framework. A SpriteBatcher coalesces roughly 4,800 map tile draws into 1 to 5 WebGL draw calls, and a RectBatcher reduces about 300 weather particles to a single call. This is a deliberate design choice to minimize draw calls and maximize control over the render loop. Pathfinding runs in Rust compiled to WASM, with obstacle data written directly into linear memory, avoiding serialization and FFI copies. The scripting system is dual: it supports 218 DSL commands through a custom parser and executor, plus a full Lua 5.4 runtime via wasmoon, both sharing the same GameAPI. This dual approach is unusual and adds complexity, but it gives developers a choice between a domain-specific language and a general-purpose scripting language.
Getting It Running: Commands and Configuration from the README
The README does not provide explicit installation commands, which is a notable gap for a project of this scale. It mentions a monorepo using pnpm workspaces with 11 packages, and the tech stack lists TypeScript 5.9, Vite 8 (rolldown), Tailwind CSS 4, and React 19. The backend uses Hono, tRPC 11, Prisma ORM, PostgreSQL 16, and MinIO or S3. To get started, you would likely clone the repository and run `pnpm install` at the root, then use package-specific scripts, but the README does not confirm these steps. The live demo at miu2d.com is the easiest way to see the engine in action without building from source. The repository layout suggests separate packages for the engine (`@miu2d/engine`), WASM (`@miu2d/engine-wasm`), server (`@miu2d/server`), and dashboard editor (`@miu2d/dashboard`). Without explicit setup instructions, potential adopters must explore the codebase to understand how to run each component, which is a barrier to entry.
Performance Claims and the Cost of Raw WebGL
The README makes specific performance claims: A* pathfinding runs in about 0.2 ms via WASM, and the sprite batcher reduces thousands of tile draws to a handful of WebGL calls. These numbers are plausible given the architecture, but they are not benchmarked in the provided material. The trade-off is that raw WebGL requires manual management of buffers, shaders, and the render loop. There is no scene graph, no 3D math overhead, and no framework event model, which the README calls 'no abstraction tax.' However, this also means every feature, from lighting to particle effects, must be implemented from scratch. The engine includes real-time lighting and shadows, GLSL color filters, and screen effects like water ripple, all of which are complex to get right. For a team that is not deeply familiar with WebGL, this could lead to significant debugging time. The Canvas2D fallback is a safety net, but it likely does not deliver the same performance or visual fidelity.
The Scripting VM: 218 DSL Commands and Lua 5.4
Miu2D's scripting system is a differentiator. The custom DSL has 218 commands, covering movement, combat, magic, and NPC AI. The README mentions a custom parser and async executor, which suggests the DSL is interpreted at runtime. The addition of a full Lua 5.4 runtime via wasmoon is notable because it allows developers to write game logic in a widely known language. Both systems share the same GameAPI, so scripts written in either language can access the same engine functions. This dual approach is powerful but also raises questions about maintenance: two parsers, two execution models, and two sets of documentation. The README does not explain how to choose between the DSL and Lua for a given task, nor does it provide examples of script syntax. For a developer, this means learning both systems or relying on the DSL for everything, which may not be ideal. The async executor hints at non-blocking script execution, but the details are not elaborated.
Limitations and Failure Modes: Where Miu2D Is the Wrong Tool
Miu2D is not a general-purpose game engine. It is tailored to 2D RPG mechanics, as evidenced by its character hierarchy (Sprite to Player) and magic system with 22 MoveKind trajectories. If you are building a platformer, puzzle game, or any genre outside the ARPG mold, much of the engine's specific logic would be irrelevant or need heavy modification. The README does not mention any support for mobile browsers beyond a virtual joystick screenshot, so touch optimization may be incomplete. The project is developed with AI-assisted programming, which the README calls 'Vibe Coding.' This could mean the codebase has inconsistent style or undocumented assumptions, though the README claims a clean 8-level class hierarchy. Another limitation is the lack of a release history; the material shows no recent releases, which makes versioning and stability unclear. The backend requires PostgreSQL and MinIO or S3, so a single-player, offline game would need to either ignore the server or run a local instance, adding operational overhead.
Alternatives: Phaser, PixiJS, and the Trade-Off in Abstraction
The README explicitly positions Miu2D against Phaser and PixiJS. Phaser is a full 2D game framework that provides a scene graph, physics, and a plugin ecosystem, but it abstracts away the render loop. PixiJS is a rendering library that focuses on WebGL performance but leaves game logic to the developer. Miu2D's approach is different: it is a complete engine, but it also exposes raw WebGL, meaning you get both the game logic and the rendering internals. The trade-off is control versus speed of development. With Phaser, you can prototype a game in days, but you are constrained by its API and performance characteristics. With Miu2D, you can optimize every draw call, but you must understand the entire pipeline. For a team that values learning and complete control, Miu2D is a viable alternative. For a team that needs to ship quickly, Phaser or PixiJS are more practical. The README also mentions Unity and Godot WASM builds, but those bring their own runtime overhead and licensing considerations.
Maintenance and Licensing: What the Repository Tells Us
The repository is licensed under MIT, which is permissive and allows commercial use, modification, and distribution, provided the license text is included. The README does not mention any contribution guidelines, code of conduct, or issue templates, which are common in mature open-source projects. The last push date is unknown, and there are no recent releases retrieved, which raises concerns about active maintenance. The project is not archived, but the lack of release history means you cannot rely on semantic versioning or changelogs. The monorepo structure with 11 packages suggests a modular design, but it also implies a higher maintenance burden: changes to the engine may require updates across multiple packages. The use of Biome for linting and TypeScript strict mode indicates a focus on code quality, but the AI-assisted development approach could introduce subtle bugs that are hard to trace. Before adopting Miu2D, you should inspect the repository's commit history and open issues to gauge activity, and verify that the live demo works as described.
Editorial conclusion
Adopt Miu2D if you are building a browser-based 2D ARPG and want full control over every rendering and scripting layer, and you are willing to invest in a complex, AI-assisted codebase. Do not adopt it if you need a mature, community-supported engine with extensive documentation, or if your team lacks deep WebGL and Rust expertise. Before committing, verify the live demo at miu2d.com, inspect the repository's current state (last push and releases are not available in the provided material), and review the MIT license terms. This engine is a serious technical artifact, but it is not a turnkey solution; its real value is as a reference for how to build such a system from first principles.
Community notes