Skip to content

Latest commit

 

History

History
211 lines (145 loc) · 11.3 KB

File metadata and controls

211 lines (145 loc) · 11.3 KB

StemStudio

A browser-based 3D sandbox editor and runtime. Build, script, and play 3D games in your browser. Open source under MIT.

License: MIT Three.js Built with Bun

StemStudio gives you a complete authoring environment — scene editor, behavior scripting in JavaScript, physics, multiplayer, an AI copilot — that runs entirely on your machine. Projects live in your browser (IndexedDB) or in a folder you pick (File System Access API). No accounts, no cloud, no lock-in.

Sponsor this project

If StemStudio is useful to you or your organization, please consider sponsoring its continued development. Sponsorships fund maintenance, new features, documentation, and community support.

Sponsor


Features

  • 3D scene editor built on Three.js — primitives, materials, transforms, scene tree, viewport, gizmos.
  • Behaviors — JavaScript classes attached to scene objects with a lifecycle (init, update, onCollision, etc.) and a built-in pack covering input, character controllers, vehicles, AI NPCs, UI, audio, and more.
  • Lambdas — an entity-component system on top of behaviors when you need archetype-driven, batched work.
  • In-editor code editor — Monaco for behavior and script authoring with full TypeScript-style assist.
  • Physics — Ammo.js / Rapier integration with rigid bodies, joints, raycasting.
  • Local multiplayer — Colyseus sidecar auto-spawned on bun run dev. Two browser tabs on the same machine join a real room.
  • AI copilot (BYOK) — bring your own keys for Anthropic, OpenAI, Meshy / Tripo / Rodin (3D model gen), ElevenLabs (TTS), and AnythingWorld. Configure once, use everywhere.
  • Local-first persistence — IndexedDB for seamless auto-save, or open a real folder via File System Access API (Chromium) for git-friendly workflows.
  • Export & share — package any project as a standalone static site (Player-only build) you can host anywhere.

Quick start

Prerequisites: Bun 1.0+, Go 1.21+, Node.js 20+. New machine? See Setting up your dev environment for per-OS install steps (macOS, Windows, Linux).

git clone https://github.com/your-org/stemstudio.git
cd stemstudio
git submodule update --init --recursive
bun install
bun run dev

That single command starts three processes:

  • Vite on http://localhost:5173 — the editor.
  • AI server on http://localhost:8081 — proxies AI calls to providers using your keys.
  • Multiplayer sidecar on ws://localhost:2567 — Colyseus rooms for local multiplayer.

Open http://localhost:5173 and follow the first-time bootstrap modal to pick your project storage mode (IndexedDB or local folder).

To use AI features, add a .env file (copy from .env.example) with whichever provider keys you want:

ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
MESHY_API_KEY=...
ELEVENLABS_API_KEY=...
ANYTHING_WORLD_API_KEY=...

Any key you omit makes that provider unavailable — the editor will prompt you for it when you first try a feature that needs it.

Setting up your dev environment

You need three tools on your PATH: Bun 1.0+ (package manager + task runner), Go 1.21+ (the AI proxy server), and Node.js 20+ with npm (the multiplayer sidecar). Pick your OS below, then continue with Quick start.

macOS

Using Homebrew:

brew install oven-sh/bun/bun go node git

Or install each from its official site (links above). Apple Silicon and Intel are both supported.

Linux

# Bun
curl -fsSL https://bun.sh/install | bash

# Node.js 20+ — via nvm (recommended; distro packages are often older)
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
nvm install 20

# Go 1.21+ — prefer the official tarball; distro `golang-go` may lag
#   https://go.dev/doc/install   (or: sudo apt install golang-go / sudo dnf install golang)

# Build essentials for any native dependency compilation
sudo apt install -y build-essential git    # Debian/Ubuntu
# sudo dnf groupinstall "Development Tools"  # Fedora/RHEL

Open a new shell (or source ~/.bashrc) so the freshly installed tools land on your PATH.

Windows

Use WSL2 (recommended). Several package.json scripts use Unix-shell idioms — inline env vars like BUILD_MODE=oss … and .sh deploy scripts — that do not run under native cmd/PowerShell. WSL2 gives you a real Linux shell where everything works as documented.

wsl --install            # installs Ubuntu; reboot if prompted

Then open the Ubuntu terminal and follow the Linux instructions above. Clone the repo inside the WSL filesystem (e.g. ~/code/…, not /mnt/c/…) for usable file-watch and build performance.

Native Windows (advanced, unsupported)
winget install OpenJS.NodeJS.LTS GoLang.Go Git.Git
powershell -c "irm bun.sh/install.ps1 | iex"

You will still need to work around the Unix-style scripts (e.g. run the editor, AI server, and MP sidecar separately and set BUILD_MODE via $env:BUILD_MODE). WSL2 is strongly preferred.

Verify

bun --version     # 1.0+
go version        # go1.21+
node --version    # v20+

If all three print a version, you're ready for Quick start.

What's in the box

  • Editor, player, runtime, behaviors, lambdas, physics, rendering, scheduler, asset loading.
  • Monaco-based script/behavior editor.
  • Local multiplayer Colyseus sidecar.
  • AI proxy server (Go) that forwards calls to your provider keys.
  • BYOK key management — keys stay in your browser's IndexedDB and are only sent to the provider you configured.
  • Build tooling (Vite, TypeScript, ESLint, Bun test).
  • Engine docs alongside the code: behaviors, lambdas/ECS, physics, UI, art specs.

Documentation

  • Architecture overview — how the editor, AI server, and multiplayer sidecar fit together.
  • Scheduler & editor settings — frame scheduler architecture, quality presets, performance controls, and profiling tools.
  • Stem Script — the editor DSL, command-contract boundary, Script Tool mode, and .stemscript game imports.
  • Built-in behaviors — the behavior model, the full catalog, and how to attach or author one.
  • Lambdas (ECS layer) — batched, dependency-scheduled systems over many objects, with examples.
  • Import packs — curated reusable script modules (noise, prng, uikit-dual-mode) and the @import workflow.
  • BYOK setup — connect your AI provider keys.
  • Multiplayer guide — local sidecar and self-hosted deployment.
  • Exporting a game — package a Player-only static site.
  • Contributing — development workflow and PR guidelines.

Existing games in Stem Script format live in Stem-Studio/Games-StemScript. Deeper engine docs (behaviors lifecycle, lambdas/ECS, physics, scheduler, rendering) live under docs/ in this repo.

Development workflow

This project uses Bun as its package manager and task runner.

bun run dev            # All-in-one: Vite + AI server + MP sidecar
bun run dev:editor     # Editor only (Vite)
bun run dev:ai         # AI server only
bun run dev:mp         # MP sidecar only

bun run build          # Production static build
bun run typecheck      # TypeScript verification
bun run test           # Unit + integration tests
bun run lint           # ESLint

To export a single project as a Player-only static site, use the in-editor File → Export game action and follow the instructions in docs/exporting-a-game.md.

Browser support

  • Chromium-based (Chrome, Edge, Brave, Arc): full feature set including File System Access API for folder-based project storage.
  • Firefox: full feature set with IndexedDB storage only (no folder access).
  • Safari: full feature set with IndexedDB storage only (no folder access).

WebGPU support is required. We do not support WebGL

Team


papiguy

mvromanov

fayd404

ikerr
CTO & Venture Lead Head of Engineering Head of Product Platform & Physics

querielo

AndreiRudenko

gajendra906

nafeezable
Three.js Wizard Games QA Community

JNicoSD

Jan

Anand
Games Games Head of SRE

Contributing

We welcome contributions. Please read CONTRIBUTING.md before opening a PR.

Bug reports, feature requests, and discussions: GitHub Issues.

You can sponsor us via GitHub Sponsors. Every contribution, large or small, is appreciated.

License

MIT. See THIRD-PARTY-NOTICES.md for the licenses of bundled dependencies.

Security

Found a vulnerability? Please don't open a public issue. See SECURITY.md for private disclosure.

Acknowledgements

Built on Three.js, React, Vite, Colyseus, Monaco Editor, Ammo.js, Rapier, and Bun.