Skip to content

A data-oriented game engine written in Rust with a custom ECS πŸ¦€ Works on Windows/Linux/MacOS/Web/OpenXR

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

matthewjberger/nightshade

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

679 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

nightshade

github crates.io docs.rs book

Nightshade is a data-oriented game engine written in rust πŸ¦€

demo Screenshot 2025-12-28 121420

Documentation

πŸ“– Read the Book - Comprehensive guide covering all engine systems, from getting started to advanced features like SDF sculpting and audio-reactive effects.

Gallery

View the gallery here πŸ”Ž

image

Getting Started

The fastest way to get started is with the nightshade-template.

It is also possible to host a webview with bidirectional IPC, demonstrated in nightshade-webview.

Examples

For a collection of example projects showcasing Nightshade's features, see the nightshade-examples repository.

Features

Nightshade uses a modular feature system for fine-grained dependency control.

Feature Hierarchy

nightshade features:
β”œβ”€β”€ core ─────────────── Minimal: windowing, math, ECS, time
β”œβ”€β”€ text ─────────────── 3D text rendering (fontdue)
β”œβ”€β”€ behaviors ────────── Built-in entity behaviors (stateless, WASM-compatible)
β”œβ”€β”€ assets ───────────── Asset loading (gltf, image, bincode, lz4)
β”œβ”€β”€ runtime ──────────── core + text + behaviors
β”œβ”€β”€ engine (default) ─── runtime + assets + scene_graph + terrain + picking + file_dialog + more
β”œβ”€β”€ full ─────────────── engine + egui + audio + physics + scripting + fbx + editor + more
β”‚
β”‚ Add-on features:
β”œβ”€β”€ wgpu ─────────────── GPU rendering (dx12, metal, vulkan, webgpu)
β”œβ”€β”€ egui ─────────────── Immediate mode UI (egui + tiles)
β”œβ”€β”€ audio ────────────── Audio playback (kira)
β”œβ”€β”€ fft ──────────────── FFT audio analysis (rustfft)
β”œβ”€β”€ physics ──────────── 3D physics (rapier3d)
β”œβ”€β”€ gamepad ──────────── Controller input (gilrs)
β”œβ”€β”€ navmesh ──────────── Navigation mesh (rerecast)
β”œβ”€β”€ scripting ────────── Rhai scripting
β”œβ”€β”€ fbx ──────────────── FBX asset format (ufbx)
β”œβ”€β”€ lattice ──────────── Lattice deformation
β”œβ”€β”€ sdf_sculpt ───────── SDF sculpting
β”œβ”€β”€ mosaic ──────────── Multi-pane desktop app framework (egui_tiles)
β”œβ”€β”€ editor ──────────── Scene editor infrastructure (gizmo, undo, inspector, picking)
β”œβ”€β”€ openxr ───────────── VR/AR support
β”œβ”€β”€ steam ────────────── Steam integration
β”œβ”€β”€ mcp ──────────────── AI scene manipulation (MCP server)
β”œβ”€β”€ claude ──────────── Claude Code CLI integration
β”œβ”€β”€ webview ──────────── Embedded webview with IPC
└── plugins ──────────── WASI plugin system

Minimal Build

For a lightweight egui app without asset loading:

nightshade = { default-features = false, features = ["runtime", "wgpu", "egui"] }

Quickstart

# native
just run

# wasm (webgpu)
just run-wasm

# serve site
cd site && just serve

All chromium-based browsers like Brave, Vivaldi, Chrome, etc support WebGPU. Firefox also supports WebGPU now starting with version 141. Run just with no arguments to list all commands

Prerequisites

  • just
  • trunk (for web builds)
  • git-cliff (for changelog generation)
  • gh (GitHub CLI, for creating releases)

Platform Guides

Native (Windows/macOS/Linux)

Build and run natively using cargo:

just run [project]  # defaults to nightshade-editor
just build          # release build

WebAssembly (WASM)

Build for web browsers with WebGPU support:

just run-wasm [project]   # defaults to editor
just build-wasm [project]

Steam Deck

See STEAM_DECK.md for deployment instructions.

Steam Integration

See STEAM.md for Steam integration (achievements, stats, friends).

Profiling & Logging

See PROFILING.md for detailed profiling and logging documentation.

Plugins

See PLUGINS.md for runtime WASI plugin support.

Scripting

See SCRIPTING.md for Rhai scripting support.

AI Integration (Native Only)

Nightshade has two features for AI integration: mcp for exposing the engine as an MCP server, and claude for spawning and communicating with Claude Code CLI as a subprocess.

MCP Server (mcp feature)

The mcp feature starts an HTTP-based Model Context Protocol server on http://127.0.0.1:3333/mcp when the application launches. Any MCP client (Claude Code, Claude Desktop, or custom tooling) can connect and manipulate the running scene in real time.

nightshade = { features = ["mcp"] }

Connect Claude Code:

claude mcp add --transport http nightshade http://127.0.0.1:3333/mcp

Available tools (50+):

Category Tools
Entities list_entities, query_entity, spawn_entity, despawn_entity, clear_scene
Transforms set_position, set_rotation, set_scale, set_parent, set_visibility
Materials set_material_color, set_emissive, set_material, set_casts_shadow
Lighting spawn_light, set_light
Camera set_camera
Assets load_asset, spawn_prefab, list_loaded_assets
Environment set_atmosphere, load_hdr, set_graphics
Effects spawn_water, spawn_particles, set_particles, spawn_decal
Text spawn_hud_text, set_hud_text, spawn_3d_text
Physics add_rigid_body, add_collider, apply_impulse, apply_force, set_velocity
Animation play_animation, stop_animation, list_animations
Scripting set_script, remove_script, set_game_state, get_game_state
Debug add_line, add_lines, clear_lines, get_input, get_time
Batch batch (atomic multi-operation), run (concise text commands)

Batch operations: Use batch to execute multiple operations atomically in a single frame, reducing round-trip latency.

Concise commands: Use run for shorthand text commands (e.g. spawn sun Sphere 0,0,0 scale:2 emissive:5,4,0).

State hook: Applications can intercept MCP commands before the engine processes them by implementing handle_mcp_command on the State trait. Return Some(response) to handle a command yourself, or None to let the engine handle it with default behavior.

Claude Code CLI (claude feature)

The claude feature provides types and a worker thread for spawning Claude Code as a subprocess and streaming its output. This lets applications embed an AI assistant panel that can send queries, receive streamed responses (text, thinking, tool use events), and optionally auto-configure MCP so Claude can manipulate the scene.

nightshade = { features = ["claude"] }

Key types: ClaudeConfig (system prompt, allowed/disallowed tools, MCP config, custom CLI args), CliCommand (StartQuery, Cancel), CliEvent (SessionStarted, TextDelta, ThinkingDelta, ToolUseStarted, ToolUseFinished, TurnComplete, Complete, Error).

When both claude and mcp features are enabled, McpConfig::Auto automatically configures Claude Code to connect to the engine's MCP server β€” no manual mcp add step needed.

The editor enables both features by default for AI-assisted development workflows.

Contributing

Nightshade is currently in its early stages of development. The project is not accepting external contributions at this time as the architecture and core systems are still being established. Once the engine reaches a more mature and stable state, I will open up contributions and provide contributor guidelines.

License

Nightshade is free, open source and permissively licensed! All code in this repository is dual-licensed under either:

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in nightshade by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

A data-oriented game engine written in Rust with a custom ECS πŸ¦€ Works on Windows/Linux/MacOS/Web/OpenXR

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Contributing

Stars

Watchers

Forks

Sponsor this project