2025-12-30 11:13:26 +08:00
|
|
|
# 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
|
2025-12-30 22:33:06 +08:00
|
|
|
- **Rust** >= 1.70 (for Tauri and WASM builds)
|
|
|
|
|
- **wasm-pack** (for building Rapier2D physics engine)
|
2025-12-30 11:13:26 +08:00
|
|
|
- **Platform-specific dependencies**:
|
|
|
|
|
- **Windows**: Microsoft Visual Studio C++ Build Tools
|
|
|
|
|
- **macOS**: Xcode Command Line Tools (`xcode-select --install`)
|
|
|
|
|
- **Linux**: See [Tauri prerequisites](https://tauri.app/v1/guides/getting-started/prerequisites)
|
|
|
|
|
|
2025-12-30 22:33:06 +08:00
|
|
|
### Installing wasm-pack
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# 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
|
|
|
|
|
```
|
|
|
|
|
|
2025-12-30 11:13:26 +08:00
|
|
|
## Quick Start
|
|
|
|
|
|
|
|
|
|
### 1. Clone and Install
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
git clone https://github.com/esengine/esengine.git
|
|
|
|
|
cd esengine
|
|
|
|
|
pnpm install
|
|
|
|
|
```
|
|
|
|
|
|
2025-12-30 22:33:06 +08:00
|
|
|
### 2. Build Rapier2D WASM
|
|
|
|
|
|
|
|
|
|
The editor depends on Rapier2D physics engine WASM artifacts. First-time setup only requires one command:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
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
|
2025-12-30 11:13:26 +08:00
|
|
|
|
|
|
|
|
From the project root:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
pnpm build:editor
|
|
|
|
|
```
|
|
|
|
|
|
2025-12-30 22:33:06 +08:00
|
|
|
### 4. Run Editor
|
2025-12-30 11:13:26 +08:00
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
cd packages/editor/editor-app
|
|
|
|
|
pnpm tauri:dev
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Available Scripts
|
|
|
|
|
|
|
|
|
|
| Script | Description |
|
|
|
|
|
|--------|-------------|
|
2025-12-30 22:33:06 +08:00
|
|
|
| `pnpm build:rapier2d` | Build Rapier2D WASM (required for first-time setup) |
|
|
|
|
|
| `pnpm build:editor` | Build editor and all dependencies |
|
2025-12-30 11:13:26 +08:00
|
|
|
| `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
|
|
|
|
|
|
2025-12-30 22:33:06 +08:00
|
|
|
### 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
|
|
|
|
|
|
2025-12-30 11:13:26 +08:00
|
|
|
### Build Errors
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
pnpm clean
|
|
|
|
|
pnpm install
|
|
|
|
|
pnpm build:editor
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Rust/Tauri Errors
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
rustup update
|
|
|
|
|
```
|
|
|
|
|
|
2025-12-30 22:33:06 +08:00
|
|
|
### 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](https://github.com/esengine/esengine/releases)
|
|
|
|
|
|
2025-12-30 11:13:26 +08:00
|
|
|
## Documentation
|
|
|
|
|
|
|
|
|
|
- [ESEngine Documentation](https://esengine.cn/)
|
|
|
|
|
- [Tauri Documentation](https://tauri.app/)
|
|
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
|
|
MIT License
|