Files
yhh b38fe5ebf4 docs(editor): improve editor-app build documentation and add build:rapier2d script
- Add `pnpm build:rapier2d` command to automate Rapier2D WASM build process
- Fix gen-src.mjs path to correctly locate thirdparty/rapier.js
- Update init.ts to work with new wasm-pack web target (auto-initialization)
- Fix behavior-tree-editor build config for asset-system dependency
- Update README_CN.md and README.md with simplified build instructions
2025-12-30 22:33:06 +08:00

3.1 KiB

ESEngine Editor

A cross-platform desktop visual editor built with Tauri 2.x + React 18.

Prerequisites

Before running the editor, ensure you have the following installed:

  • Node.js >= 18.x
  • pnpm >= 10.x
  • Rust >= 1.70 (for Tauri and WASM builds)
  • wasm-pack (for building Rapier2D physics engine)
  • Platform-specific dependencies:
    • Windows: Microsoft Visual Studio C++ Build Tools
    • macOS: Xcode Command Line Tools (xcode-select --install)
    • Linux: See Tauri prerequisites

Installing wasm-pack

# Using cargo
cargo install wasm-pack

# Or using the official installer script (Linux/macOS)
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

Quick Start

1. Clone and Install

git clone https://github.com/esengine/esengine.git
cd esengine
pnpm install

2. Build Rapier2D WASM

The editor depends on Rapier2D physics engine WASM artifacts. First-time setup only requires one command:

pnpm build:rapier2d

This command automatically:

  1. Prepares the Rust project
  2. Builds WASM
  3. Copies artifacts to packages/physics/rapier2d/pkg
  4. Generates TypeScript source code

Note

: Requires Rust and wasm-pack to be installed.

3. Build Editor

From the project root:

pnpm build:editor

4. Run Editor

cd packages/editor/editor-app
pnpm tauri:dev

Available Scripts

Script Description
pnpm build:rapier2d Build Rapier2D WASM (required for first-time setup)
pnpm build:editor Build editor and all dependencies
pnpm tauri:dev Run editor in development mode with hot-reload
pnpm tauri:build Build production application
pnpm build:sdk Build editor-runtime SDK

Project Structure

editor-app/
├── src/                    # React application source
│   ├── components/         # UI components
│   ├── panels/             # Editor panels
│   └── services/           # Core services
├── src-tauri/              # Tauri (Rust) backend
├── public/                 # Static assets
└── scripts/                # Build scripts

Troubleshooting

Rapier2D WASM Build Failed

Error: Could not resolve "../pkg/rapier_wasm2d"

Cause: Missing Rapier2D WASM artifacts.

Solution:

  1. Ensure wasm-pack is installed: cargo install wasm-pack
  2. Run pnpm build:rapier2d
  3. Verify packages/physics/rapier2d/pkg/ directory exists and contains rapier_wasm2d_bg.wasm file

Build Errors

pnpm clean
pnpm install
pnpm build:editor

Rust/Tauri Errors

rustup update

Windows Users Building WASM

The pnpm build:rapier2d script works directly on Windows. If you encounter issues:

  1. Use Git Bash or WSL
  2. Or download pre-built WASM artifacts from Releases

Documentation

License

MIT License