space-game/bjsEditorPlugin/README.md
Michael Mainguy f73661c23b Add BabylonJS Editor plugin for level editing
Plugin features:
- Token-based authentication (user pastes token from website)
- Browse and load official levels
- Browse, load, and save personal levels
- Export current scene as level config JSON
- Import level config into Editor scene
- Editor script components for game objects (asteroid, ship, planet, etc.)
- Floating UI panel for quick access to tools
- Camera speed controls for editor navigation

Note: Uses public Supabase anon key (same as website client bundle)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-09 07:11:49 -06:00

1.4 KiB

Space Game BabylonJS Editor Plugin

Export BabylonJS Editor scenes to Space Game LevelConfig format.

Installation

  1. Build the plugin:

    cd bjsEditorPlugin
    npm install
    npm run build
    
  2. Install in BabylonJS Editor:

    • Open BabylonJS Editor
    • Edit → Preferences → Plugins
    • Click "Add" and select this folder
    • Apply and restart Editor

Usage

  1. Create a workspace in BabylonJS Editor
  2. Copy the script components from editorScripts/ to your workspace's src/scenes/ folder
  3. Place meshes in your scene and attach the appropriate scripts:
    • AsteroidComponent - for asteroids
    • ShipComponent - for player spawn point
    • SunComponent - for the sun
    • PlanetComponent - for planets
    • TargetComponent - for orbit/movement targets
  4. Configure properties in the Inspector panel
  5. Space Game → Export Level Config...

Script Components

The editorScripts/ folder contains TypeScript components to use in your Editor workspace. These expose game-specific properties (velocities, targets, etc.) in the Inspector.

Plugin Menu

  • Export Level Config... - Downloads level.json file
  • Export to Clipboard - Copies JSON to clipboard

Development

npm run watch  # Watch mode for development
npm run build  # Production build

Debug in Editor: CTRL+ALT+i to open DevTools, F5 to reload plugin.